@chatpanel/events 0.222.0 → 0.278.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.
Files changed (62) hide show
  1. package/agent-kinds.js +1 -0
  2. package/agent-run-hint.js +1 -0
  3. package/browser-relay.js +1 -0
  4. package/bug-report.js +11 -0
  5. package/capture-plan.js +1 -0
  6. package/citations.js +5 -5
  7. package/client-prefs.js +1 -1
  8. package/decide-by-model.js +2 -0
  9. package/drive-backup.js +1 -0
  10. package/feature-map.js +1 -1
  11. package/history-search.js +8 -0
  12. package/index.js +1 -1
  13. package/kokoro-text.js +1 -0
  14. package/library.js +10 -10
  15. package/link-connect.js +1 -0
  16. package/link-noise.js +1 -0
  17. package/link-protocol.js +1 -0
  18. package/meeting-apps.js +1 -0
  19. package/memory-capture.js +1 -0
  20. package/memory.js +2 -2
  21. package/model-entries.js +1 -1
  22. package/model-list.js +1 -0
  23. package/note-merge.js +13 -0
  24. package/note-transcript.js +10 -0
  25. package/offers.js +3 -0
  26. package/package.json +79 -1
  27. package/page-guard.js +4 -0
  28. package/prefetch.js +2 -2
  29. package/prompted-tools.js +17 -0
  30. package/provider-presets.js +1 -0
  31. package/qr.js +1 -0
  32. package/recall.js +7 -0
  33. package/record-entities.js +2 -0
  34. package/reply-focus.js +1 -0
  35. package/request-options.js +1 -0
  36. package/research.js +16 -0
  37. package/sandbox-policy.js +1 -1
  38. package/search-modes.js +9 -0
  39. package/settings-registry.js +1 -1
  40. package/skill-creator.js +8 -0
  41. package/skill-scan.js +3 -3
  42. package/slash-commands.js +1 -1
  43. package/sources-retrieval.js +3 -3
  44. package/speak-stream.js +1 -1
  45. package/speaker-cluster.js +1 -0
  46. package/stitch.js +24 -0
  47. package/stream-reveal.cases.json +348 -0
  48. package/stream-reveal.js +1 -0
  49. package/text-index.js +1 -0
  50. package/titles.js +4 -4
  51. package/voice-barge-in.cases.json +1 -0
  52. package/voice-brain.js +1 -0
  53. package/voice-channel-gate.cases.json +1 -0
  54. package/voice-channel-gate.js +1 -0
  55. package/voice-channels.js +1 -1
  56. package/voice-intents.js +2 -2
  57. package/voice-loop.js +1 -1
  58. package/voice-scribe.js +1 -1
  59. package/voice-speaker.js +1 -1
  60. package/voice-vad.js +1 -1
  61. package/web-research.js +7 -0
  62. package/web-search-tool.js +3 -3
@@ -0,0 +1 @@
1
+ {"vad":{"defaults":{"minFrames":12,"ratio":3,"minEnergy":0.06,"floorAlpha":0.02,"cooldownFrames":45,"window":0},"sequences":{"quiet room never fires":[[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false]],"speech after a quiet room fires on the 12th loud frame":[[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,true],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false]],"a door slam (3 loud frames) does not":[[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.9,true,false],[0.9,true,false],[0.9,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false]],"cooldown: one interruption is one":[[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,true],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,true],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false]],"leak while the assistant is audible teaches nothing":[[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.05,false,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,true],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false],[0.3,true,false]],"a noisy room raises the bar":[[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.05,true,false],[0.12,true,false],[0.12,true,false],[0.12,true,false],[0.12,true,false],[0.12,true,false],[0.12,true,false],[0.12,true,false],[0.12,true,false],[0.12,true,false],[0.12,true,false],[0.12,true,false],[0.12,true,false],[0.12,true,false],[0.12,true,false],[0.12,true,false],[0.12,true,false],[0.12,true,false],[0.12,true,false],[0.12,true,false],[0.12,true,false],[0.2,true,false],[0.2,true,false],[0.2,true,false],[0.2,true,false],[0.2,true,false],[0.2,true,false],[0.2,true,false],[0.2,true,false],[0.2,true,false],[0.2,true,false],[0.2,true,false],[0.2,true,false],[0.2,true,false],[0.2,true,false],[0.2,true,false],[0.2,true,false],[0.2,true,false],[0.2,true,false],[0.2,true,false],[0.2,true,false]]},"gapped":{"minFrames":6,"window":50,"sequences":{"a voice chopped by the canceller (6 loud a second) fires":[[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.3,false,false],[0.3,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.3,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.3,false,false],[0.3,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.3,false,true],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.3,false,false],[0.3,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false]],"a door slam (3 frames) does not":[[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.3,false,false],[0.3,false,false],[0.3,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false]],"the leak of our own voice (a frame now and then) does not":[[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.3,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.3,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.3,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,false,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false],[0.01,true,false]]}}},"energy":[{"samples":[],"expect":0},{"samples":[0.1,0.1,0.1,0.1],"expect":0.4},{"samples":[0.5,-0.5,0.25,-0.25,0.125,0,0,0],"expect":1},{"samples":[0,0.04271151893767909,0.08455285563666298,0.12467155649791559,0.16225026400764944,0.1965233691535556,0.2267926095440197,0.25244129544236893,0.2729468738823372,0.28789157489000544,0.2969709229116372,0.29999994004001046,0.2969169146579464,0.2877846587186521,0.2727892280477045,0.2522361317385751,0.2265441078694974,0.19623659235197868,0.16193105472019312,0.12432641812832859,0.08418881985430705,0.042336002417960164,-0.000379346679113187,-0.04308696716454541,-0.08491675622467668,-0.12501649552604996,-0.16256921386782155,-0.19680983172745306,-0.22704074859237844,-0.2526460555094717,-0.27310408329323477,-0.28799803074204977,-0.29702445632875063,-0.29999946036023806,-0.296862431654034,-0.2876772823989415,-0.2726311460414019,-0.2520305647261331,-0.22629524396614892,-0.19594950178125922,-0.16161158651584687,-0.1239810809691422,-0.08382464945967776,-0.04196041820581425,0.0007586927516764905,0.04346234649824275,0.08528052103649561,0.12536123466119725,0.16288790379072984,0.1970959796156367,0.22728852461781604,0.2528504116124856,0.2732608560290302,0.28810402610456914,0.29707751482369055,0.2999985010014603,0.2968074739870145,0.28756944610256124,0.2724726281161919,0.2518245947337308,0.22604601823189127,0.19566209790043587,0.16129185990541875,0.12363554557252697,0.08346034503505924,0.0415847669017754,-0.0011380376111411298,-0.04383765633856436,-0.08564414949048409,-0.1257057733521429,-0.16320633326681092,-0.19738181236057514,-0.22753593722415516,-0.2530543634246592,-0.27341719183905405,-0.2882095608080843,-0.29713009831161985,-0.29999706196521103,-0.29675204174476166,-0.28746115000193406,-0.27231367452553407,-0.2516182220907005,-0.22579643106521946,-0.19537438116904762,-0.16097187540013047,-0.12328981249097125,-0.08309590716294915,-0.04120904910648512,0.0015173806509597315,0.04421289608541524,0.08600764100522527,0.12605011104799227,0.16352450178691702,0.19766732950524143,0.22778298601579947,0.253257910619887,0.27357309047333606,0.2883146346838524,0.29718220670846107,0.29999514325379123,0.2966961350159078,0.28735239427021847,0.2721542855235846,0.25141144712701813,0.2255464828652063,0.19508635204713504,0.1606516335116156,0.12294388227727834,0.08273133642606025,0.040833265420690684,-0.0018967212645884972,-0.044588065138812756,-0.08637099499951958,-0.1263942471981728,-0.16384240884231815,-0.19795253059311174,-0.22802967059773502,-0.253461052872711,-0.27372855168260496,-0.28841924756386705,-0.29723383993089647,-0.2999927448702688,-0.29663975388984426,-0.2872431790813073,-0.27199446136519545,-0.2512042701733027,-0.22529617403150284,-0.194798010995237,-0.16033113475191937,-0.1225977554845689,-0.08236663340731563,-0.040457416445244476,0.002276058845487775,0.0449631628988857,0.08673421089238888,0.12673818125243383,0.16416005392470234,0.19823741516817053,0.22827599057552905,0.25366378985831994,0.27388357521828827,0.28852339928085946,0.29728499789636786,0.29998986681847856,0.2965828984567202,0.28713350460982867,0.2718342023059152,0.25099669156081683,0.22504550496433576,0.1945093584743914,0.16001037963349787,0.12225143266627399,0.08200179868985202,0.04008150278110481,-0.002655392787121163,-0.04533818876587846,-0.08709728810307533,-0.12708191266084792,-0.16447743652617727,-0.19852198277490457,-0.22852194555533284,-0.2538661212525512,-0.27403816083251403,-0.28862708966829803,-0.2973356805230772,-0.2999865091030223,-0.29652556880744413,-0.28702337103114445,-0.27167350860198713,-0.25078871162146443,-0.22479447606450811,-0.19422039494613436,-0.15968936866921601,-0.12190491437614301,-0.08163683285701508,-0.03970552502933191,0.003034722482959676,0.04571314214014984,0.08746022605104285,0.12742544087381258,0.16479455613926772,0.19880623295831013,0.22876753514388082,0.25406804673189043,0.27419230827811014,0.2887303185603888,0.2973858877299865,0.2999826717292689,0.2964677650336821,0.2869127785213509,0.2715123805103497,0.25058033068779156,0.22454308773339832,0.19393112087249828,0.1593681023723507,0.12155820116823446,0.0812717364923607,0.03932948379108896,-0.0034140473264805864,-0.046088022422174545,-0.08782302415597902,-0.12776876534204729,-0.16511141225692158,-0.19909016526389026,-0.2290127589484917,-0.2542695659734724,-0.2743460173086052,-0.2888330857920759,-0.29743561943681746,-0.299978354703354,-0.29640948722785854,-0.286801727257278,-0.2713508182886359,-0.25037154909298537,-0.22429134037295864,-0.1936415367160146,-0.15904658125658414,-0.1212112935969195,-0.08090651017965347,-0.038953379667640654,0.0037933667111689244,0.04646282901254523,0.08818568183779199,0.12811188551660022,0.16542800437250718,0.199373779237657,0.22925761657706914,0.2544706786550819,0.2744992876782288,0.2889353911990409,0.2974848755640525,0.2999735580321801,0.2963507354831555,0.28669021741648926,0.2711888221951723,0.2501623671708735,0.22403923438571763,0.19335164293970905,0.15872480583600715,0.12086419221687908,0.08054115450286578,0.038577213260351205,-0.004172680030518448,-0.04683756131196921,-0.08854819851661644,-0.1284548008488453,-0.16574433197981583,-0.1996570744261283,-0.22950210763810286,-0.2546713844551516,-0.2746521191419123,-0.28903723461770436,-0.29753365603293475,-0.299968281723417,-0.2962915098935136,-0.28657824917728114,-0.2710263924889814,-0.24995278525592327,-0.22378677017477588,-0.19306144000709985,-0.15840277662511607,-0.12051689758310796,-0.08017567004617579,-0.03820098517068862,0.00455198667803368,0.04721221872127466,0.0889105736128156,0.12879751079048482,0.1660603945730583,0.19994005037633733,0.22974623174066602,0.2548716830527686,0.27480451145528717,0.2891386158852263,0.29758196076546717,0.299962525785501,0.29623181055362996,0.2864658227186843,0.2708635294297754,0.2497428036832439,0.22353394814380464,0.19277092838220355,0.1580804941388167,0.12016941025090304,0.07981005739397169,0.03782469600021215,-0.004931286047225546,-0.04758680064141269,-0.08927280654697396,-0.12914001479354575,-0.1663761916468752,-0.20022270663582137,-0.22998998849442334,-0.2550715741276666,-0.2749564643746901,-0.2892395348395044,-0.29762978968441356,-0.2999562902276354,-0.2961716375589604,-0.2863529382204599,-0.2707002332779633,-0.24953242278857948,-0.22328076869705074,-0.1924801085295305,-0.15775795889241354,-0.11982173077587714,-0.07944431713083949,-0.037448346350587136,0.005310577531624073,0.04796130647344985,0.08963489673990334,0.12948231231039098,0.1666917226963247,0.2005050427526352,0.23023337750962133,0.25527105736023553,0.27510797765715767,0.28933999131917526,0.29767714271329926,0.2999495750597907],"expect":0.8446592139293263},{"samples":[0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9,0.9],"expect":1}],"echo":{"overlap":0.6,"minWords":2,"cases":[{"text":"the atlas launch moved to friday","reply":"The Atlas launch moved to Friday because the review ran long.","expect":true},{"text":"stop, what about Monday instead","reply":"The Atlas launch moved to Friday because the review ran long.","expect":false},{"text":"friday","reply":"The Atlas launch moved to Friday because the review ran long.","expect":false},{"text":"The review ran long, Friday!","reply":"The Atlas launch moved to Friday because the review ran long.","expect":true},{"text":"no no no wait","reply":"The Atlas launch moved to Friday because the review ran long.","expect":false},{"text":"launch launch why","reply":"The Atlas launch moved to Friday because the review ran long.","expect":true}]}}
package/voice-brain.js ADDED
@@ -0,0 +1 @@
1
+ import{createSpeakerGate as b}from"./voice-speaker.js";import{createSpeakerClusterer as E,segmentWeight as I}from"./speaker-cluster.js";const k=2,O=4e3,T=4e3,_=4e3,N=.6,W=3e3,A=a=>String(a||"").toLowerCase().replace(/[^\p{L}\p{N}'\s]/gu," ").split(/\s+/).filter(Boolean);function S(a,n){const g=A(a);if(g.length<k||!n)return!1;const e=new Set(A(n));let s=0;for(const r of g)e.has(r)&&s++;return s/g.length>=N}const C=/^(?:(?:ok(?:ay)?|alright|all right|thanks?|thank you|great|cool|perfect|nice)[\s,!.]*)*(?:bye(?:[\s-]*bye)?|good\s*bye|see (?:you|ya)(?: later)?|talk (?:to you )?later|that'?s (?:all|it)(?: for now)?|i'?m done|we'?re done|end (?:the |this )?(?:call|conversation|chat)|hang up|stop (?:voice(?: mode)?|listening)|good\s*night)(?:[\s,!.]*(?:thanks?|thank you|for now|then|now))*[\s,!.]*$/i;function M(a){const n=String(a||"").trim();return!!n&&n.split(/\s+/).length<=8&&C.test(n)}const L="Another voice";function R(){return{phase:"listening",muted:!1,mutedAt:0,pending:"",asked:"",interimWords:0,bargedIn:!1,replyText:"",turnStartedAt:0,segmentStartedAt:0,answerEndedAt:0,gate:null,voices:null,paused:!1}}function D(a,n={},{now:g=Date.now}={}){const e={...R(),...a||{}},s=g(),r={},u=b({now:()=>s,seed:e.gate}),t=()=>({state:{...e,gate:u.toJSON()},act:r}),d=()=>{e.phase="listening",e.paused=!1};switch(n.type){case"interim":{if(e.muted)return t();const c=String(n.text||"");if(e.segmentStartedAt||(e.segmentStartedAt=s),e.phase==="listening")return r.caption=e.pending?`${e.pending} ${c}`:c,t();const l=A(c),i=l.slice(Math.max(0,Math.min(e.interimWords,l.length))),p=l.length-e.interimWords;return e.interimWords=l.length,!n.audible||p<k||S(i.join(" "),e.replyText)||(d(),e.bargedIn=!0,r.bargeIn=!0,r.caption=c),t()}case"final":{if(e.muted&&s-e.mutedAt>O)return t();e.interimWords=0;const c=e.bargedIn;e.bargedIn=!1;const l=e.segmentStartedAt||s;e.segmentStartedAt=0;const i=String(n.text||"").trim();if(!i)return t();let p=n.info||{};if(Array.isArray(n.vec)&&n.vec.length&&!p.speaker){const f=E({seed:e.voices}),o=f.assign(n.vec,I(n.seconds));e.voices=f.toJSON();const w=o.scores?.[o.label],y=(o.thin||o.weak)&&typeof w=="number"&&w<f.threshold;p={...p,speaker:{label:y?L:o.label,scores:o.scores,...o.weak?{weak:!0}:{},...o.thin?{thin:!0}:{}}}}const h=u.admit(p),x=e.paused;e.paused=!1;const m=()=>(x&&(r.resume=!0),t());if(!h.send&&!c)return r.held={speaker:h.speaker,text:i,count:u.heldCount()},m();if(M(i))return e.phase!=="listening"&&(r.cancel=!0),d(),e.pending="",r.end=!0,t();if(e.phase==="listening"&&!e.muted&&s-e.answerEndedAt<W&&S(i,e.replyText))return t();if(e.phase==="thinking"||e.phase==="speaking"){if(h.weak||i.split(/\s+/).filter(Boolean).length<k||S(i,e.replyText))return m();const f=!!n.audible;d(),r.cancel=!0,!f&&e.asked&&l-e.turnStartedAt<_&&(e.pending=e.asked)}return e.pending=e.pending?`${e.pending} ${i}`:i,n.info?.endOfTurn===!1&&e.pending.length<T?(r.pending=e.pending,t()):(r.send=e.pending,e.pending="",t())}case"onset":return!n.audible||e.muted||e.phase==="listening"||e.paused?t():u.primary()?(e.paused=!0,r.pause=!0,t()):(d(),r.bargeIn=!0,t());case"commit":return e.pending&&(r.send=e.pending,e.pending=""),t();case"pause-timeout":return e.paused&&(e.paused=!1,r.resume=!0),t();case"turn-start":return e.asked=String(n.said||""),e.interimWords=0,e.bargedIn=!1,e.replyText="",e.turnStartedAt=s,e.phase="thinking",t();case"reply":return e.replyText=String(n.text||""),e.replyText.trim()&&(e.phase="speaking"),t();case"turn-end":return e.answerEndedAt=s,e.paused=!1,d(),t();case"cancel":return e.paused=!1,d(),t();case"mute":return!!n.on===e.muted||(e.muted=!!n.on,e.muted?e.mutedAt=s:u.reset()),t();case"reset":return u.reset(),e.voices=null,e.pending="",t();case"stop":return d(),e.pending="",e.muted=!1,t();case"reset-speaker":return u.reset(),t();default:return t()}}const G=a=>({primary:a?.gate?.primary||"",held:a?.gate?.held||0});export{L as ANOTHER_VOICE,_ as CONTINUATION_WINDOW_MS,N as ECHO_OVERLAP,W as ECHO_TAIL_MS,T as MAX_PENDING_CHARS,k as MIN_BARGE_IN_WORDS,O as MUTE_GRACE_MS,R as initialVoiceState,M as isFarewell,S as looksLikeEcho,G as voiceSpeaker,D as voiceStep};
@@ -0,0 +1 @@
1
+ {"defaults":{"ratio":3,"minEnergy":0.03,"floorAlpha":0.02,"onset":5,"release":20,"first":"playback"},"sequences":{"silence keeps the first holder":[[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false]],"the person speaks while nothing plays":[[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.3,0.005,"playback",false],[0.3,0.005,"playback",false],[0.3,0.005,"playback",false],[0.3,0.005,"playback",false],[0.3,0.005,"mic",true],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false]],"the far side preempts the person":[[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.3,0.005,"playback",false],[0.3,0.005,"playback",false],[0.3,0.005,"playback",false],[0.3,0.005,"playback",false],[0.3,0.005,"mic",true],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.3,"mic",false],[0.3,0.3,"mic",false],[0.3,0.3,"mic",false],[0.3,0.3,"mic",false],[0.3,0.3,"playback",true],[0.3,0.3,"playback",false],[0.3,0.3,"playback",false],[0.3,0.3,"playback",false],[0.3,0.3,"playback",false],[0.3,0.3,"playback",false],[0.3,0.3,"playback",false],[0.3,0.3,"playback",false],[0.3,0.3,"playback",false],[0.3,0.3,"playback",false],[0.3,0.3,"playback",false],[0.3,0.3,"playback",false],[0.3,0.3,"playback",false],[0.3,0.3,"playback",false],[0.3,0.3,"playback",false],[0.3,0.3,"playback",false],[0.3,0.3,"playback",false],[0.3,0.3,"playback",false],[0.3,0.3,"playback",false],[0.3,0.3,"playback",false],[0.3,0.3,"playback",false],[0.3,0.3,"playback",false],[0.3,0.3,"playback",false],[0.3,0.3,"playback",false],[0.3,0.3,"playback",false],[0.3,0.3,"playback",false],[0.3,0.3,"playback",false],[0.3,0.3,"playback",false],[0.3,0.3,"playback",false],[0.3,0.3,"playback",false],[0.3,0.3,"playback",false],[0.3,0.3,"playback",false],[0.3,0.3,"playback",false],[0.3,0.3,"playback",false],[0.3,0.3,"playback",false],[0.3,0.3,"playback",false]],"echo of the playback on the mic never takes the turn":[[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false]],"a breath between the far side's sentences keeps their turn":[[0.005,0.3,"playback",false],[0.005,0.3,"playback",false],[0.005,0.3,"playback",false],[0.005,0.3,"playback",false],[0.005,0.3,"playback",false],[0.005,0.3,"playback",false],[0.005,0.3,"playback",false],[0.005,0.3,"playback",false],[0.005,0.3,"playback",false],[0.005,0.3,"playback",false],[0.005,0.3,"playback",false],[0.005,0.3,"playback",false],[0.005,0.3,"playback",false],[0.005,0.3,"playback",false],[0.005,0.3,"playback",false],[0.005,0.3,"playback",false],[0.005,0.3,"playback",false],[0.005,0.3,"playback",false],[0.005,0.3,"playback",false],[0.005,0.3,"playback",false],[0.005,0.3,"playback",false],[0.005,0.3,"playback",false],[0.005,0.3,"playback",false],[0.005,0.3,"playback",false],[0.005,0.3,"playback",false],[0.005,0.3,"playback",false],[0.005,0.3,"playback",false],[0.005,0.3,"playback",false],[0.005,0.3,"playback",false],[0.005,0.3,"playback",false],[0.005,0.3,"playback",false],[0.005,0.3,"playback",false],[0.005,0.3,"playback",false],[0.005,0.3,"playback",false],[0.005,0.3,"playback",false],[0.005,0.3,"playback",false],[0.005,0.3,"playback",false],[0.005,0.3,"playback",false],[0.005,0.3,"playback",false],[0.005,0.3,"playback",false],[0.3,0.005,"playback",false],[0.3,0.005,"playback",false],[0.3,0.005,"playback",false],[0.3,0.005,"playback",false],[0.3,0.005,"playback",false],[0.3,0.005,"playback",false],[0.3,0.005,"playback",false],[0.3,0.005,"playback",false],[0.3,0.005,"playback",false],[0.3,0.005,"playback",false],[0.005,0.3,"playback",false],[0.005,0.3,"playback",false],[0.005,0.3,"playback",false],[0.005,0.3,"playback",false],[0.005,0.3,"playback",false],[0.005,0.3,"playback",false],[0.005,0.3,"playback",false],[0.005,0.3,"playback",false],[0.005,0.3,"playback",false],[0.005,0.3,"playback",false],[0.005,0.3,"playback",false],[0.005,0.3,"playback",false],[0.005,0.3,"playback",false],[0.005,0.3,"playback",false],[0.005,0.3,"playback",false],[0.005,0.3,"playback",false],[0.005,0.3,"playback",false],[0.005,0.3,"playback",false],[0.005,0.3,"playback",false],[0.005,0.3,"playback",false],[0.005,0.3,"playback",false],[0.005,0.3,"playback",false],[0.005,0.3,"playback",false],[0.005,0.3,"playback",false],[0.005,0.3,"playback",false],[0.005,0.3,"playback",false],[0.005,0.3,"playback",false],[0.005,0.3,"playback",false],[0.005,0.3,"playback",false],[0.005,0.3,"playback",false],[0.005,0.3,"playback",false],[0.005,0.3,"playback",false],[0.005,0.3,"playback",false],[0.005,0.3,"playback",false],[0.005,0.3,"playback",false],[0.005,0.3,"playback",false],[0.005,0.3,"playback",false],[0.005,0.3,"playback",false],[0.005,0.3,"playback",false],[0.005,0.3,"playback",false]],"a turn-taking conversation":[[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.3,0.005,"playback",false],[0.3,0.005,"playback",false],[0.3,0.005,"playback",false],[0.3,0.005,"playback",false],[0.3,0.005,"mic",true],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.3,0.005,"mic",false],[0.005,0.005,"mic",false],[0.005,0.005,"mic",false],[0.005,0.005,"mic",false],[0.005,0.005,"mic",false],[0.005,0.005,"mic",false],[0.005,0.005,"mic",false],[0.005,0.005,"mic",false],[0.005,0.005,"mic",false],[0.005,0.005,"mic",false],[0.005,0.005,"mic",false],[0.005,0.005,"mic",false],[0.005,0.005,"mic",false],[0.005,0.005,"mic",false],[0.005,0.005,"mic",false],[0.005,0.005,"mic",false],[0.005,0.005,"mic",false],[0.005,0.005,"mic",false],[0.005,0.005,"mic",false],[0.005,0.005,"mic",false],[0.005,0.005,"mic",false],[0.12,0.3,"mic",false],[0.12,0.3,"mic",false],[0.12,0.3,"mic",false],[0.12,0.3,"mic",false],[0.12,0.3,"playback",true],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false],[0.12,0.3,"playback",false]],"a cough (3 loud frames) does not take the turn":[[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.9,0.005,"playback",false],[0.9,0.005,"playback",false],[0.9,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false],[0.005,0.005,"playback",false]]}}
@@ -0,0 +1 @@
1
+ const f=Object.freeze({ratio:3,minEnergy:.03,floorAlpha:.02,onset:5,release:20,first:"playback"}),u=Object.freeze(["mic","playback"]);function y(p={}){const e={...f,...p},c={mic:.02,playback:.02},r={mic:0,playback:0};let l=e.release,a=u.includes(e.first)?e.first:"playback",s=!1;const i=(t,o)=>{const n=Math.max(0,Math.min(1,Number(o)||0));return n>=Math.max(e.minEnergy,c[t]*e.ratio)?(r[t]++,!0):(r[t]=0,c[t]+=(n-c[t])*e.floorAlpha,!1)};return{get holder(){return a},get switched(){return s},feed(t,o){i("mic",t),l=i("playback",o)?0:l+1;const b=a;return a==="mic"&&r.playback>=e.onset?a="playback":a==="playback"&&l>=e.release&&r.mic>=e.onset&&(a="mic"),s=a!==b,a}}}export{u as GATE_CHANNELS,f as GATE_DEFAULTS,y as createChannelGate};
package/voice-channels.js CHANGED
@@ -1 +1 @@
1
- import{PINNED_SELF as $}from"./voice-speaker.js";const O=Object.freeze(["mic","playback"]),_=$,S="Speaker",w="In room",L=Object.freeze(["self","room"]),A=6e3,I=4e3,j=new Set(["thank you","thanks","you","uh","um","hmm","hm","mm","amen","bye","okay","ok","yeah","oh","the","that","so","and","i","a","me","we","yes","no","you you","thank you thank you"]);function C(n,r=null){if(r!=null&&r>2e3)return!1;const l=String(n||"").toLowerCase().replace(/[^\p{L}\p{N}\s]/gu,"").replace(/\s+/g," ").trim();return!l||j.has(l)}const R=n=>String(n||"").split(/\s+/).filter(Boolean).slice(0,2).map(r=>r[0].toUpperCase()).join("")||"?",D=n=>{if(!n)return S;const r=typeof n=="string"?n:n.label||n.id;return String(r||"").trim()||S};function P(n,r,{mic:l="self",playback:h=!0}={}){if(n==="mic"&&l!=="room")return _;const f=D(r);return n!=="mic"||!h?f:/^Speaker\b/.test(f)?f.replace(/^Speaker\b/,w):`${w} · ${f}`}const b=n=>String(n||"").replace(/\s+/g," ").trim();function B({now:n=Date.now,mic:r="self",playback:l=!0,seed:h=[]}={}){if(!L.includes(r))throw new Error(`unknown mic mode: ${r}`);const f={mic:r,playback:l},s=[],k={mic:"",playback:""};let g=0;for(const e of Array.isArray(h)?h:[]){if(!e||!e.text)continue;const t=e.speaker===_||r==="room"&&!l?"mic":"playback";s.push({sid:`s:${++g}`,t:Number(e.t)||0,channel:t,speaker:String(e.speaker||S),text:b(e.text),open:!1,seed:!0})}const N=e=>{for(let t=s.length-1;t>=0;t--)if(s[t].channel===e)return s[t];return null};return{final(e,t,{speaker:i,endOfTurn:a,durationMs:c=null}={}){if(!O.includes(e))throw new Error(`unknown channel: ${e}`);const u=n(),p=b(t);if(!p||(k[e]="",C(p,c)))return null;const d=P(e,i,f),o=s[s.length-1],m=c!=null?u-c-o?.t:null,y=m!=null?m<=I:u-(o?.t||0)<=A;if(o&&!o.seed&&o.channel===e&&o.speaker===d&&(o.open||y))return o.text=`${o.text} ${p}`,o.t=u,o.open=a===!1,{...o,joined:!0};const E={sid:`a:${++g}`,t:u,channel:e,speaker:d,text:p,open:a===!1};return s.push(E),{...E,joined:!1}},interim(e,t){O.includes(e)&&(k[e]=b(t))},interims:()=>({...k}),segments:()=>s.map(({sid:e,t,channel:i,speaker:a,text:c})=>({sid:e,t,channel:i,speaker:a,text:c})),delta:(e=0,t=40)=>s.filter(i=>i.t>=e).slice(-t).map(({sid:i,t:a,speaker:c,text:u})=>({sid:i,t:a,speaker:c,text:u})),speakers(){const e={mic:[],playback:[]};for(const t of s)e[t.channel].includes(t.speaker)||e[t.channel].push(t.speaker);return e},last:e=>{const t=N(e);return t?{...t}:null},record({id:e,title:t,startedAt:i,status:a="live",endReason:c=null,participants:u}={}){const p=a==="ended",d=this.speakers();return{id:e,schemaVersion:1,platform:"audio",meetingKey:`${l?"audio":"room"}:${i}`,title:t||(l?"Audio transcript":"Room transcript"),url:"",status:a,endReason:p?c||"ended":null,startedAt:i,endedAt:p?n():null,participants:u||[...d.mic,...d.playback].map(m=>({name:m,initials:R(m)})),segments:s.map(({t:m,speaker:y,text:x})=>({t:m,speaker:y,text:x})),chat:[]}}}}export{O as CHANNELS,A as JOIN_GAP_MS,I as JOIN_PAUSE_MS,_ as MIC_LABEL,L as MIC_MODES,S as OTHER_LABEL,w as ROOM_PREFIX,P as channelSpeaker,B as createChannelTranscript,C as isNoiseFinal};
1
+ import{PINNED_SELF as B}from"./voice-speaker.js";const $=Object.freeze(["mic","playback"]),A=B,_="Speaker",M="In room",W=Object.freeze(["self","room"]),z=6e3,F=4e3,v=new Set(["thank you","thanks","you","uh","um","hmm","hm","mm","amen","bye","okay","ok","yeah","oh","the","that","so","and","i","a","me","we","yes","no","you you","thank you thank you"]);function J(n,o=null){if(o!=null&&o>2e3)return!1;const r=String(n||"").toLowerCase().replace(/[^\p{L}\p{N}\s]/gu,"").replace(/\s+/g," ").trim();return!r||v.has(r)}const j=15e3,T=4,U=.7,R=n=>String(n||"").toLowerCase().replace(/[^\p{L}\p{N}\s']/gu," ").split(/\s+/).filter(Boolean);function q(n,o){const r=new Map;for(const i of o)r.set(i,(r.get(i)||0)+1);let m=0;for(const i of n){const k=r.get(i)||0;k>0&&(m++,r.set(i,k-1))}return n.length?m/n.length:0}const G=n=>String(n||"").split(/\s+/).filter(Boolean).slice(0,2).map(o=>o[0].toUpperCase()).join("")||"?",K=n=>{if(!n)return _;const o=typeof n=="string"?n:n.label||n.id;return String(o||"").trim()||_};function V(n,o,{mic:r="self",playback:m=!0}={}){if(n==="mic"&&r!=="room")return A;const i=K(o);return n!=="mic"||!m?i:/^Speaker\b/.test(i)?i.replace(/^Speaker\b/,M):`${M} · ${i}`}const b=n=>String(n||"").replace(/\s+/g," ").trim();function Q({now:n=Date.now,mic:o="self",playback:r=!0,seed:m=[],echoGuard:i=!1}={}){if(!W.includes(o))throw new Error(`unknown mic mode: ${o}`);const k={mic:o,playback:r},s=[],x={mic:"",playback:""},D=!!i&&!!r;let S=[],E=0;const w=e=>(S=S.filter(t=>e-t.t<=j),S.flatMap(t=>t.words)),N=(e,t)=>e.length>=T&&q(e,t)>=U;for(const e of Array.isArray(m)?m:[]){if(!e||!e.text)continue;const t=e.speaker===A||o==="room"&&!r?"mic":"playback";s.push({sid:`s:${++E}`,t:Number(e.t)||0,channel:t,speaker:String(e.speaker||_),text:b(e.text),open:!1,seed:!0})}const H=e=>{for(let t=s.length-1;t>=0;t--)if(s[t].channel===e)return s[t];return null};return{final(e,t,{speaker:a,endOfTurn:u,durationMs:p=null}={}){if(!$.includes(e))throw new Error(`unknown channel: ${e}`);const c=n(),f=b(t);if(!f||(x[e]="",J(f,p)))return null;if(D){const I=R(f);if(e==="mic"){if(N(I,w(c)))return null}else{S.push({t:c,words:I});const P=w(c);for(let g=s.length-1;g>=0&&c-s[g].t<=j;g--){const O=s[g];O.channel==="mic"&&!O.seed&&N(R(O.text),P)&&s.splice(g,1)}}}const d=V(e,a,k),l=s[s.length-1],h=p!=null?c-p-l?.t:null,y=h!=null?h<=F:c-(l?.t||0)<=z;if(l&&!l.seed&&l.channel===e&&l.speaker===d&&(l.open||y))return l.text=`${l.text} ${f}`,l.t=c,l.open=u===!1,{...l,joined:!0};const L={sid:`a:${++E}`,t:c,channel:e,speaker:d,text:f,open:u===!1};return s.push(L),{...L,joined:!1}},interim(e,t){$.includes(e)&&(x[e]=b(t))},interims:()=>({...x}),segments:()=>s.map(({sid:e,t,channel:a,speaker:u,text:p})=>({sid:e,t,channel:a,speaker:u,text:p})),delta:(e=0,t=40)=>s.filter(a=>a.t>=e).slice(-t).map(({sid:a,t:u,speaker:p,text:c})=>({sid:a,t:u,speaker:p,text:c})),speakers(){const e={mic:[],playback:[]};for(const t of s)e[t.channel].includes(t.speaker)||e[t.channel].push(t.speaker);return e},last:e=>{const t=H(e);return t?{...t}:null},record({id:e,title:t,startedAt:a,status:u="live",endReason:p=null,participants:c}={}){const f=u==="ended",d=this.speakers();return{id:e,schemaVersion:1,platform:"audio",meetingKey:`${r?"audio":"room"}:${a}`,title:t||(r?"Audio transcript":"Room transcript"),url:"",status:u,endReason:f?p||"ended":null,startedAt:a,endedAt:f?n():null,participants:c||[...d.mic,...d.playback].map(h=>({name:h,initials:G(h)})),segments:s.map(({t:h,speaker:y,text:C})=>({t:h,speaker:y,text:C})),chat:[]}}}}export{$ as CHANNELS,U as ECHO_MATCH,T as ECHO_MIN_WORDS,j as ECHO_WINDOW_MS,z as JOIN_GAP_MS,F as JOIN_PAUSE_MS,A as MIC_LABEL,W as MIC_MODES,_ as OTHER_LABEL,M as ROOM_PREFIX,V as channelSpeaker,Q as createChannelTranscript,J as isNoiseFinal};
package/voice-intents.js CHANGED
@@ -1,2 +1,2 @@
1
- import{defineSchema as ee,describeSchema as te,responseFormat as ne,coerce as re,createStructuredStream as se}from"./structured.js";import{DANGLING_TAILS as ie}from"./schedule.js";import{editDistance as U}from"./distance.js";class D extends Error{constructor(e,s){super(s),this.name="VoiceIntentError",this.code=e}}const oe=Object.freeze(["chatpanel"]);function I(t){return t<=4?0:t<=6?1:2}const j=3,ae=8;function C(t){return String(t||"").toLowerCase().replace(/[‘’]/g,"'").replace(/[^\p{L}\p{N}':.\s]/gu," ")}function W(t){const e=C(t),s=[],n=/[\p{L}\p{N}'.:]+/gu;let r;for(;r=n.exec(e);){const i=r[0].replace(/^[.:]+|[.:]+$/g,"");i&&s.push({w:i,start:r.index,end:r.index+r[0].length})}return s}function A(t=oe){const e=(Array.isArray(t)?t:String(t??"").split(/[,|;\n]/)).map(i=>String(i??"").trim()).filter(Boolean),s=[],n=[];let r=1;for(const i of e){const a=i.toLowerCase().replace(/[^\p{L}\p{N}]/gu,"");a.length<3||s.includes(a)||(s.push(a),n.push(i),r=Math.max(r,i.split(/\s+/).filter(Boolean).length+1))}if(!s.length)throw new D("BAD_WAKE","wake word must have at least 3 letters");return Object.freeze({phrases:Object.freeze(s),labels:Object.freeze(n),maxTokens:Math.min(Math.max(r,j),ae)})}const le=2;function ce(t,e,s){const n=[],r=s.maxTokens||j;for(let i=0;i<e.length;i++){let a="",c=!1;for(let l=0;l<r&&i+l<e.length&&!c;l++){a+=e[i+l].w.replace(/[^\p{L}\p{N}]/gu,"");for(const o of s.phrases)if(!(Math.abs(a.length-o.length)>I(o.length))&&U(a,o,I(o.length))<=I(o.length)){n.push({phrase:o,start:e[i].start,end:e[i+l].end,addressed:we(t,e,i,l)}),i+=l,c=!0;break}}}return n}function z(t,e){const s=String(t||"");if(!s)return s;const n=/[.!?…]+["'\u2019\u201d)\]]*(?=\s|$)/g;let r=0,i;for(;r<e&&(i=n.exec(s));)if(r+=1,r===e)return s.slice(0,i.index+i[0].length);return s}function F(t,e=A(),{maxSentences:s=le}={}){const n=String(t||""),r=W(n);if(!r.length)return[];const i=ce(n,r,e),a=[];let c=0;for(let l=0;l<i.length;l++){const o=i[l];if(!o.addressed&&o.start<c)continue;let f=n.length;for(let p=l+1;p<i.length;p++)if(i[p].addressed){f=i[p].start;break}const u=n.slice(o.end,f),d=ye($(z(u,s)).trim());c=Math.max(c,o.end+u.indexOf(d)+d.length),a.push({command:d,wake:o.phrase,heard:n.slice(o.start,o.end),at:o.start,addressed:o.addressed,rest:n.slice(o.end+u.indexOf(d)+d.length,f).trim()})}return a}function ue(t,e=A(),s={}){return F(t,e,s)[0]||null}const B=new RegExp("^(?:ok(?:ay)?|all ?right|right|so|well|um+|uh+|hmm+|yeah|yep|hey|and|but|then|now|let(?:'s| us) see|we(?:'ll| will) see|so we(?:'ll| will) see|i think it is doing something|it does anything|does it (?:do )?anything|hold on(?: a second)?|one second|let me see|i think|i guess|here we go|there we go|test(?:ing)?)[\\s,.!?]*$","i"),de=/(?<=[.!?])\s+/;function fe(t){const e=String(t||"").trim().replace(/^[\s,.:;!?-]+/,"");if(!e||B.test(e))return!0;const s=e.split(",").map(n=>n.trim()).filter(Boolean);return s.length>1&&s.every(n=>B.test(n))}function Be(t,{maxName:e=48}={}){const s=$(String(t||"")).trim();if(!s)return{request:"",name:""};const r=s.split(de).map(u=>u.trim()).filter(Boolean).filter(u=>!fe(u)),i=r.filter(u=>/\?\s*$/.test(u)),a=i.length>1,c=i.length===1?i[0]:r.length?r.join(" "):s,l=$(c).trim()||s,o=l.replace(/\s+/g," ").trim(),f=o.length>e?`${o.slice(0,e-1).replace(/\s+\S*$/,"")}…`:o;return{request:l,name:f||o,ambiguous:a}}const T=ee({name:"voice_refinement",fields:{request:{type:"string",required:!0,max:400,describe:"the one thing they actually want done, in their own words, one sentence"},name:{type:"string",max:48,describe:"a label of at most 6 words"},kind:{type:"enum",values:["question","action","monitor","note","skill","timer","none"],default:"question",describe:"the SMALLEST kind that does what they asked"},skill:{type:"string",max:80,describe:"the skill name, only when kind is skill"}},nothing:{request:"",name:"",kind:"none",skill:""}});function Ge(t){return["A person spoke to their assistant during a meeting. Below is everything they said after","the wake word, transcribed live — so it contains false starts, thinking aloud, and","sometimes several questions where only one is the request.","",te(T),"","Pick the SMALLEST kind that does what they asked:"," question — answer it once, now. The DEFAULT for anything they want to know.",' action — DO something in the browser or an app ("go to google.com and search for X").',' monitor — only if they asked to be told as the meeting CONTINUES ("let me know if",',' "keep an eye on"). A one-off question is NOT a monitor.',' note — they asked for notes written down ("take notes on", "write that up").',' skill — they named a saved skill ("use the summarize skill"); put its name in `skill`.',' timer — alerted after an AMOUNT OF TIME ("set a one minute"); keep it in `request`.'," none — not asking for anything: thinking aloud, or talking ABOUT the assistant.",'Never invent a request that is not there — return "none". Keep `request` close to their',"words; do not answer it.","","WHAT THEY SAID:",String(t||"")].join(`
2
- `)}function Ke(t="schema"){return ne(T,{mode:t})}function He(t){const e=re(t,T);return e?O(e.value):null}function O(t){if(!t)return null;const e=String(t.request||"").trim();if(t.kind==="none"||!e)return{request:"",name:"",kind:"none",skill:""};let s=t.kind==="skill"&&!t.skill?"question":t.kind;const n=String(t.name||"").trim()||e;if(s==="timer"){const r=M(e);return r?{request:e,name:n,kind:"timer",skill:"",ms:r.ms}:{request:e,name:n,kind:"question",skill:""}}return{request:e,name:n,kind:s,skill:t.skill||""}}function Ve(t,e){const s=String(e||"").toLowerCase();if(!s)return!1;let n;try{n=new URL(t).hostname.toLowerCase().replace(/^www\./,"")}catch{return!1}if(!n)return!1;if(s.includes(n))return!0;const r=n.split(".");return r.length!==2?!1:new RegExp(`\\b${r[0].replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\b`).test(s)}function Pe({onChange:t=null}={}){const e=se(T,{onChange:t?(n,r)=>t(O(n),r):null}),s=n=>({...n,value:O(n.value)});return{push:n=>s(e.push(n)),end:()=>s(e.end()),snapshot:()=>s(e.snapshot()),reset:()=>e.reset(),get text(){return e.text}}}const G=/^(?:the|a|an|our|your|their|my|this|that|these|those|about|on|in|of|with|via|using|called|named|to)$/i,he=/^(?:actually|really|also|always|never|just|only|still|often|usually|basically|literally|probably|certainly|definitely|now|then|even|apparently|obviously)$/i,me=/^(?:is|isn't|was|wasn't|are|aren't|were|weren't|has|hasn't|have|had|does|doesn't|did|didn't|can|can't|cannot|could|couldn't|will|won't|would|wouldn't|should|shouldn't|shall|may|might|must|seems|helps|lets|gives|allows|works|looks|means|needs|wants|keeps|makes|shows|tells|comes|goes|takes|runs|becomes|provides|supports)$/i,pe=/^(?:you|we|i|they|it|there|he|she)$/i,q=t=>String(t?.w||"").replace(/[^\p{L}\p{N}']/gu,"");function ge(t,e,s){const n=e[s+1];if(!n||/[.!?,;:–—-]/.test(t.slice(e[s].end,n.start)))return!1;let r=s+1;return he.test(q(e[r]))&&e[r+1]&&(r+=1),me.test(q(e[r]))?!pe.test(q(e[r+1])):!1}function we(t,e,s,n=0){if(n>0&&G.test(String(e[s].w||"").replace(/[^\p{L}\p{N}]/gu,""))||ge(t,e,s+n))return!1;if(s===0)return!0;const r=e[s-1],i=String(r.w||"").replace(/[^\p{L}\p{N}]/gu,"");if(G.test(i))return!1;if(/^(?:ok|okay|hey|hi|yo|hello|so|um|uh)$/i.test(i))return!0;const a=t.slice(r.start,e[s].start);return/[.!?,;:]["'’”)\]]*\s*$/.test(a)?!/[.!?…]/.test(a)||J(t.slice(0,r.end)):!1}function ye(t){return String(t).replace(/(?:[\s,.:;!?-]*\b(?:ok|okay|hey|hi|yo|hello|so|um+|uh+|and|then|now)\b)+[\s,.:;!?-]*$/i,"").trim()}function $(t){return String(t).replace(/^[\s,.:;!?-]+/,"").replace(/^(?:(?:hey|hi|ok|okay|yo)\b[\s,]*)+/i,"").replace(/^(?:(?:can|could|would|will)\s+you\s+(?:please\s+)?|please\s+)/i,"").trim()}const K={zero:0,one:1,two:2,three:3,four:4,five:5,six:6,seven:7,eight:8,nine:9,ten:10,eleven:11,twelve:12,thirteen:13,fourteen:14,fifteen:15,sixteen:16,seventeen:17,eighteen:18,nineteen:19},H={twenty:20,thirty:30,forty:40,fourty:40,fifty:50,sixty:60,seventy:70,eighty:80,ninety:90},x={half:.5,quarter:.25};function L(t){if(!t.length)return null;let e=null,s=!1;for(let n=0;n<t.length;n++){const r=t[n];if(!(r==="and"||r==="of")){if(r==="a"||r==="an"){e===null&&!(t[n+1]in x)&&(s=!0);continue}if(r in x){e=(e??0)+x[r];continue}if(r in K){e=(e??0)+K[r];continue}if(r in H){e=(e??0)+H[r];continue}if(/^\d+(?:\.\d+)?$/.test(r)){e=(e??0)+Number(r);continue}return null}}return e??(s?1:null)}const V={second:1e3,seconds:1e3,sec:1e3,secs:1e3,s:1e3,minute:6e4,minutes:6e4,min:6e4,mins:6e4,m:6e4,hour:36e5,hours:36e5,hr:36e5,hrs:36e5,h:36e5,day:864e5,days:864e5},ke=/^(\d+(?:\.\d+)?)(s|m|h|secs?|mins?|hrs?|seconds?|minutes?|hours?|days?)$/;function M(t){const e=W(t);let s=0,n=-1,r=-1,i=!1,a=[],c=-1;for(let l=0;l<e.length;l++){const o=e[l],f=(h,y,k,m)=>{s+=h*y,n<0&&(n=k),r=m,i=!0},u=ke.exec(o.w),d=u?V[u[2]]:V[o.w];if(!d){const h=[...a,o.w];L(h)!==null?(c<0&&(c=o.start),a=h):L([o.w])!==null?(a=[o.w],c=o.start):(a=[],c=-1);continue}if(u)f(Number(u[1]),d,o.start,o.end);else{const h=a.length?L(a):null;h!==null&&f(h,d,c>=0?c:o.start,o.end)}a=[],c=-1;const p=xe(e,l);p>l&&(s+=x[e[p].w]*d,r=e[p].end,l=p)}return!i||s<=0?null:{ms:Math.round(s),start:n,end:r}}function xe(t,e){let s=e+1;return t[s]?.w!=="and"?e:(s++,(t[s]?.w==="a"||t[s]?.w==="an")&&s++,x[t[s]?.w]===void 0?e:s)}const b={sunday:0,sun:0,monday:1,mon:1,tuesday:2,tue:2,tues:2,wednesday:3,wed:3,weds:3,thursday:4,thu:4,thur:4,thurs:4,friday:5,fri:5,saturday:6,sat:6},S=Object.freeze({morning:9,afternoon:14,evening:19,night:20,tonight:19,noon:12,midnight:0});function w(t,{days:e=0,hour:s,minute:n=0}){const r=new Date(t);return r.setDate(r.getDate()+e),r.setHours(s,n,0,0),r.getTime()}function P(t,{now:e=Date.now()}={}){const s=String(t||""),n=C(s);let r=1/0,i=-1;const a=(m,g)=>{m<r&&(r=m),g>i&&(i=g)},c=/\bin\s+(.+)$/i.exec(n);if(c){const m=M(c[1]);if(m){const g=c.index+c[0].length-c[1].length;return{at:e+m.ms,recurrence:null,kind:"relative",...E(n,c.index,g+m.end)}}}const l=/\bevery\s+(day|morning|afternoon|evening|night|week|weekday|[a-z]+day|mon|tue|tues|wed|weds|thu|thur|thurs|fri|sat|sun)\b/i.exec(n)||/\b(daily|nightly|weekly)\b/i.exec(n),o=Se(n),f=/\b(today|tonight|tomorrow)\b/i.exec(n),u=/\b(next\s+)?(sunday|sun|monday|mon|tuesday|tues|tue|wednesday|weds|wed|thursday|thurs|thur|thu|friday|fri|saturday|sat)\b/i.exec(n),d=/\b(morning|afternoon|evening|tonight|night|noon|midnight)\b/i.exec(n);l&&a(l.index,l.index+l[0].length),o&&a(o.start,o.end),f&&a(f.index,f.index+f[0].length),u&&a(u.index,u.index+u[0].length),d&&a(d.index,d.index+d[0].length);let p=o?o.hour:d?S[d[1]]:null;const h=o?o.minute:0;if(o&&!o.meridiem&&p<12&&d&&S[d[1]]>=12&&(p+=12),l){const m=(l[1]||"").toLowerCase(),g=p??S[m]??S[m.replace(/ly$/,"")]??9,R=m in b?X(e,b[m],g,h):m==="week"||m==="weekly"?w(e,{days:7,hour:g,minute:h}):be(e,g,h,m==="weekday"),Z=m in b?{kind:"weekly",weekday:b[m],hour:g,minute:h}:m==="week"||m==="weekly"?{kind:"weekly",weekday:new Date(e).getDay(),hour:g,minute:h}:{kind:"daily",hour:g,minute:h,weekdaysOnly:m==="weekday"};return{at:R,recurrence:Z,kind:"recurring",...E(n,r,i)}}if(p===null&&!f&&!u)return null;if(u){const m=b[u[2]];return{at:X(e,m,p??9,h,!!u[1]),recurrence:null,kind:"weekday",...E(n,r,i)}}const y=p??S[d?.[1]||"morning"];if(f){const m=f[1].toLowerCase();return{at:w(e,{days:m==="tomorrow"?1:0,hour:y,minute:h}),recurrence:null,kind:m,...E(n,r,i)}}let k=w(e,{hour:y,minute:h});return k<=e&&(k=w(e,{days:1,hour:y,minute:h})),{at:k,recurrence:null,kind:"clock",...E(n,r,i)}}function E(t,e,s){if(!(e>=0)||!(s>e))return{start:-1,end:-1};const n=/\b(?:at|on|by|in|this|starting|from)\s+$/i.exec(t.slice(0,e));return{start:n?e-n[0].length:e,end:s}}function be(t,e,s,n=!1){let r=w(t,{hour:e,minute:s});if(r<=t&&(r=w(t,{days:1,hour:e,minute:s})),n)for(let i=0;i<7;i++){const a=new Date(r).getDay();if(a!==0&&a!==6)break;r=w(r,{days:1,hour:e,minute:s})}return r}function X(t,e,s,n,r=!1){const i=new Date(t);let a=(e-i.getDay()+7)%7;return a===0&&(r||w(t,{hour:s,minute:n})<=t)&&(a=7),w(t,{days:a,hour:s,minute:n})}function Se(t){const e=C(t),s=/(\d{1,2})(?:[:.](\d{2}))?\s*(a\.?m\.?|p\.?m\.?|o'?clock)?/gi;let n;for(;n=s.exec(e);){const i=/\bat\s+$/.test(e.slice(0,n.index));if(!n[2]&&!n[3]&&!i)continue;let a=Number(n[1]);const c=n[2]?Number(n[2]):0;if(a>23||c>59)continue;const l=(n[3]||"").replace(/[.\s]/g,"").toLowerCase();return l==="pm"&&a<12&&(a+=12),l==="am"&&a===12&&(a=0),{hour:a,minute:c,meridiem:l==="am"||l==="pm",start:n.index,end:n.index+n[0].length}}const r=/\bat\s+([a-z]+)(?:\s+(a\.?m\.?|p\.?m\.?))?/i.exec(e);if(r){const i=L([r[1]]);if(i!==null&&Number.isInteger(i)&&i>=0&&i<=23){let a=i;const c=(r[2]||"").replace(/[.\s]/g,"").toLowerCase();return c==="pm"&&a<12&&(a+=12),c==="am"&&a===12&&(a=0),{hour:a,minute:0,meridiem:c==="am"||c==="pm",start:r.index,end:r.index+r[0].length}}}return null}function N({id:t,label:e,description:s="",examples:n=[],classUsed:r="R",effects:i="idempotent",requiresApproval:a=!1,match:c}){if(!t)throw new D("BAD_INTENT","intent.id required");if(typeof c!="function")throw new D("BAD_INTENT",`intent '${t}': match required`);return Object.freeze({id:t,label:e||t,description:s,examples:Object.freeze([...n]),classUsed:r,effects:i,requiresApproval:a,match:c})}function Ee(t=[]){const e=[...t];return{add(s){return e.push(s),()=>{const n=e.indexOf(s);n>=0&&e.splice(n,1)}},list:()=>[...e],get:s=>e.find(n=>n.id===s)||null,parse(s,n={}){const r=String(s||"").trim();if(!r)return null;for(const i of e){let a=null;try{a=i.match(r,n)}catch{a=null}if(a)return{intent:i.id,label:i.label,classUsed:i.classUsed,effects:i.effects,requiresApproval:i.requiresApproval,args:a,command:r,needsModel:!1}}return{intent:null,args:null,command:r,needsModel:!0}}}}const Ne=N({id:"voice:timer",label:"Set a timer",description:"Starts a countdown and alerts when it finishes.",examples:["set a timer for 10 minutes","start a 90 second timer","timer for an hour and a half"],match:(t,{now:e=Date.now()}={})=>{const s=M(t);if(!s||!/\btimers?\b/i.test(t)&&(!/^(?:set|start|make|create|put)\b/i.test(t.trim())||(t.slice(0,s.start)+" "+t.slice(s.end)).replace(/\b(set|start|make|create|put|a|an|the|for|please|to|of|and|half|quarter|this|that|time|up|on|me)\b/gi," ").replace(/[^\p{L}\p{N}]+/gu,"")))return null;const n=(t.slice(0,s.start)+" "+t.slice(s.end)).replace(/\b(set|start|make|create|a|an|the|for|please|timer|timers|to|of|and|half|quarter)\b/gi," ");return{ms:s.ms,at:e+s.ms,label:_(n)}}}),_e=N({id:"voice:reminder",label:"Set a reminder",description:"Remembers something and raises it at the time you said.",examples:["remind me to send the deck at 4pm","remember to take the kids to school at 9am on Wednesday","remind me every weekday morning to check the queue"],match:(t,{now:e=Date.now()}={})=>{const s=/\b(?:remind\s+(?:me|us)|reminder|remember)\b/i.exec(t);if(!s)return null;const n=P(t,{now:e});let r=n&&n.end>n.start?t.slice(0,n.start)+" "+t.slice(n.end):t;return r=r.slice(r.toLowerCase().indexOf(s[0].toLowerCase())+s[0].length),r=_(r.replace(/^(?:\s*(?:to|that|about|i\s+need\s+to|we\s+need\s+to))\b/i,"")),r?{text:r,at:n?.at??null,recurrence:n?.recurrence??null,when:n?.kind??null}:null}}),Ae=N({id:"voice:note",label:"Take a note",description:"Appends a line to the meeting notes.",examples:["note that we agreed to ship on Friday","take a note: budget is approved"],match:t=>{const e=/^(?:(?:take|make|write|jot|add)\s+(?:down\s+)?(?:a\s+|the\s+|some\s+)?notes?|(?:write|jot)\s+down|notes?)\b[\s:,-]*(?:down\s+)?(?:that\s+|of\s+|on\s+|about\s+|from\s+)?(.+)$/i.exec(t.trim()),s=e&&_(e[1]);return s?{text:s}:null}}),Te=N({id:"voice:monitor",label:"Watch for something",description:"Starts a live monitor that answers as the meeting continues.",examples:["watch for whether we agree a date","keep an eye on the pricing question","track who owns the migration"],classUsed:"C",match:t=>{const e=/^(?:(?:start|set\s+up|create|begin|add|open|run)\s+(?:a\s+|the\s+|an\s+)?(?:live\s+|new\s+)?(?:monitor|monitoring|watch|tracker)|watch\s+(?:out\s+)?for|watch|keep\s+an\s+eye\s+on|track|monitor|monitoring)\b[\s:,-]*(?:whether\s+|if\s+|for\s+|on\s+|about\s+|that\s+)?(.+)$/i.exec(t.trim()),s=e&&_(e[1]);return s&&s.length>2?{prompt:s}:null}}),Le=N({id:"voice:schedule",label:"Schedule something",description:"Runs one of your skills (or a plain instruction) on a schedule.",examples:["every weekday at 8am run my daily brief","run the standup summary every morning","tomorrow at 9 do the release checklist"],classUsed:"C",match:(t,{now:e=Date.now()}={})=>{if(!/\b(run|do|start|kick\s+off|execute)\b/i.exec(t))return null;const n=P(t,{now:e});if(!n)return null;let r=n.end>n.start?t.slice(0,n.start)+" "+t.slice(n.end):t;const i=/\b(run|do|start|kick\s+off|execute)\b/i.exec(r);return r=_((i?r.slice(i.index+i[0].length):r).replace(/^\s*(?:my|the|our)\b/i,"").replace(/\b(skill|job|task)\b\s*$/i,"")),r?{target:r,at:n.at,recurrence:n.recurrence,when:n.kind}:null}}),ve=Object.freeze([Ne,_e,Le,Ae,Te]);function _(t){return String(t||"").replace(/\s+/g," ").replace(/^[\s,.:;-]+|[\s,.:;-]+$/g,"").trim()}function Y(){return Ee(ve)}function Xe(t,{wake:e=A(),intents:s=Y(),now:n=Date.now()}={}){const r=ue(t,e);if(!r)return null;const i=s.parse(r.command,{now:n});return i?{...i,wake:r.wake,heard:r.heard,at:r.at,addressed:r.addressed!==!1}:null}const De=new Set(["maybe","perhaps","probably","basically","roughly","kinda","sorta"]);function J(t){const e=String(t||"").trim().replace(/[\s.,;:!?…'"’”)\]-]+$/u,"");if(!e)return!1;const s=e.toLowerCase().match(/[\p{L}\p{N}']+/gu)||[],n=s[s.length-1];return n?!ie.has(n)&&!De.has(n):!1}const Ie=t=>/[.!?…]["'’”)\]]*\s*$/.test(String(t||"").trim());function Ce(t,e,s){const n=z(t,1).trim();if(n&&n!==t){const r=e.parse(n,{now:s});if(r?.intent)return r}return e.parse(t,{now:s})}const Q=t=>String(t||"").toLowerCase().replace(/[^a-z0-9]+/g," ").trim().slice(0,160),v=6,Oe=t=>Q(t).split(" ").slice(0,v).join(" "),qe=3;function Ye(t,{wake:e=A(),intents:s=Y(),isSelf:n=null,sinceTs:r=0,now:i=Date.now(),meetingId:a="",max:c=qe,gate:l=null}={}){const o=[];for(const u of t||[])if(!(!u||!u.text)&&!(u.t&&u.t<=r))for(const d of F(u.text,e)){if(!d.command)continue;const p=Ce(d.command,s,i),h=p&&{...p,wake:d.wake,heard:d.heard,at:d.at,addressed:d.addressed,rest:d.rest};if(!h||!h.intent&&!h.addressed)continue;const y=J(d.command);if(!h.intent&&!l&&!(y&&Ie(u.text)))continue;const k=n?!!n(u.speaker):!1;o.push({...h,allowed:k,finished:y,speaker:u.speaker||"",t:u.t||i,meetingId:a,key:`voice:${a}:${h.intent||"ask"}:${h.ms??h.when??""}:${Oe(d.command)}`})}const f=o.length>c?o.slice(-c):o;return l?l.offer(f,i).due(i):f}const $e=5e3,Me=12e3,Re=3*6e4,Ue=24;function je(t,e){if(!t||!e)return!1;if(t===e||t.startsWith(e)||e.startsWith(t))return!0;const s=t.split(" ").slice(0,v),n=e.split(" ").slice(0,v);return s.length>=v&&s.join(" ")===n.join(" ")}function Je({settleMs:t=$e,danglingMs:e=Me,forgetMs:s=Re,max:n=Ue}={}){let r=[];const i=c=>c.command.finished===!1?e:t,a=(c,l)=>r.find(o=>o.meetingId===(c.meetingId||"")&&je(o.gist,l));return{offer(c,l=Date.now()){for(const o of c||[]){const f=Q(o.command);if(!f)continue;const u=a(o,f);if(!u){r.push({meetingId:o.meetingId||"",gist:f,command:o,changedAt:l,seenAt:l,done:!1});continue}u.seenAt=l,!u.done&&f!==u.gist&&(u.gist=f,u.command=o,u.changedAt=l)}return r=r.filter(o=>l-o.seenAt<=s),r.length>n&&(r=r.slice(-n)),this},due(c=Date.now()){const l=[];for(const o of r)o.done||c-o.changedAt<i(o)||(o.done=!0,l.push(o.command));return l},nextDueIn(c=Date.now()){let l=null;for(const o of r){if(o.done)continue;const f=Math.max(0,i(o)-(c-o.changedAt));(l===null||f<l)&&(l=f)}return l},get waiting(){return r.filter(c=>!c.done).length}}}export{ve as BUILTIN_VOICE_INTENTS,S as DAYPART_HOUR,oe as DEFAULT_WAKE,qe as MAX_COMMANDS_PER_DELTA,le as MAX_COMMAND_SENTENCES,v as OPENING_WORDS,T as REFINEMENT_SCHEMA,Me as UTTERANCE_DANGLING_MS,$e as UTTERANCE_SETTLE_MS,D as VoiceIntentError,J as commandLooksFinished,Ye as commandsFromSegments,A as compileWake,Je as createUtteranceGate,Ee as createVoiceIntentRegistry,Y as defaultVoiceIntents,N as defineVoiceIntent,U as editDistance,ue as findWakeCommand,F as findWakeCommands,Oe as gistOpening,Q as gistText,fe as isFillerSentence,Te as monitorIntent,C as normalizeSpeech,Ae as noteIntent,Se as parseClock,Xe as parseCommand,M as parseDuration,L as parseNumberWords,He as parseRefinement,P as parseWhen,Be as refineSpokenCommand,Ke as refinementFormat,Ge as refinementPrompt,Pe as refinementStream,_e as reminderIntent,je as sameUtterance,Le as scheduleIntent,O as settleRefinement,Ve as spokenNamesHost,Ne as timerIntent,W as tokenize};
1
+ import{defineSchema as ee,describeSchema as te,responseFormat as ne,coerce as re,createStructuredStream as se}from"./structured.js";import{DANGLING_TAILS as ie}from"./schedule.js";import{editDistance as U}from"./distance.js";class D extends Error{constructor(e,s){super(s),this.name="VoiceIntentError",this.code=e}}const oe=Object.freeze(["chatpanel"]);function I(t){return t<=4?0:t<=6?1:2}const j=3,ae=8;function C(t){return String(t||"").toLowerCase().replace(/[‘’]/g,"'").replace(/[^\p{L}\p{N}':.\s]/gu," ")}function W(t){const e=C(t),s=[],n=/[\p{L}\p{N}'.:]+/gu;let r;for(;r=n.exec(e);){const i=r[0].replace(/^[.:]+|[.:]+$/g,"");i&&s.push({w:i,start:r.index,end:r.index+r[0].length})}return s}function x(t=oe){const e=(Array.isArray(t)?t:String(t??"").split(/[,|;\n]/)).map(i=>String(i??"").trim()).filter(Boolean),s=[],n=[];let r=1;for(const i of e){const a=i.toLowerCase().replace(/[^\p{L}\p{N}]/gu,"");a.length<3||s.includes(a)||(s.push(a),n.push(i),r=Math.max(r,i.split(/\s+/).filter(Boolean).length+1))}if(!s.length)throw new D("BAD_WAKE","wake word must have at least 3 letters");return Object.freeze({phrases:Object.freeze(s),labels:Object.freeze(n),maxTokens:Math.min(Math.max(r,j),ae)})}function Be({words:t="",name:e=""}={}){const s=(Array.isArray(t)?t:String(t||"").split(/[,|;\n]/)).map(a=>String(a).trim()).filter(Boolean),n=String(e||"").trim(),i=[...n.replace(/[^\p{L}\p{N}]/gu,"").length>=3?[`hey ${n}`,n]:[],...s];return i.length?x(i):x()}const le=2;function ce(t,e,s){const n=[],r=s.maxTokens||j;for(let i=0;i<e.length;i++){let a="",c=!1;for(let l=0;l<r&&i+l<e.length&&!c;l++){a+=e[i+l].w.replace(/[^\p{L}\p{N}]/gu,"");for(const o of s.phrases)if(!(Math.abs(a.length-o.length)>I(o.length))&&U(a,o,I(o.length))<=I(o.length)){n.push({phrase:o,start:e[i].start,end:e[i+l].end,addressed:we(t,e,i,l)}),i+=l,c=!0;break}}}return n}function F(t,e){const s=String(t||"");if(!s)return s;const n=/[.!?…]+["'\u2019\u201d)\]]*(?=\s|$)/g;let r=0,i;for(;r<e&&(i=n.exec(s));)if(r+=1,r===e)return s.slice(0,i.index+i[0].length);return s}function z(t,e=x(),{maxSentences:s=le}={}){const n=String(t||""),r=W(n);if(!r.length)return[];const i=ce(n,r,e),a=[];let c=0;for(let l=0;l<i.length;l++){const o=i[l];if(!o.addressed&&o.start<c)continue;let f=n.length;for(let p=l+1;p<i.length;p++)if(i[p].addressed){f=i[p].start;break}const u=n.slice(o.end,f),d=ye(q(F(u,s)).trim());c=Math.max(c,o.end+u.indexOf(d)+d.length),a.push({command:d,wake:o.phrase,heard:n.slice(o.start,o.end),at:o.start,addressed:o.addressed,rest:n.slice(o.end+u.indexOf(d)+d.length,f).trim()})}return a}function ue(t,e=x(),s={}){return z(t,e,s)[0]||null}const B=new RegExp("^(?:ok(?:ay)?|all ?right|right|so|well|um+|uh+|hmm+|yeah|yep|hey|and|but|then|now|let(?:'s| us) see|we(?:'ll| will) see|so we(?:'ll| will) see|i think it is doing something|it does anything|does it (?:do )?anything|hold on(?: a second)?|one second|let me see|i think|i guess|here we go|there we go|test(?:ing)?)[\\s,.!?]*$","i"),de=/(?<=[.!?])\s+/;function fe(t){const e=String(t||"").trim().replace(/^[\s,.:;!?-]+/,"");if(!e||B.test(e))return!0;const s=e.split(",").map(n=>n.trim()).filter(Boolean);return s.length>1&&s.every(n=>B.test(n))}function Ge(t,{maxName:e=48}={}){const s=q(String(t||"")).trim();if(!s)return{request:"",name:""};const r=s.split(de).map(u=>u.trim()).filter(Boolean).filter(u=>!fe(u)),i=r.filter(u=>/\?\s*$/.test(u)),a=i.length>1,c=i.length===1?i[0]:r.length?r.join(" "):s,l=q(c).trim()||s,o=l.replace(/\s+/g," ").trim(),f=o.length>e?`${o.slice(0,e-1).replace(/\s+\S*$/,"")}…`:o;return{request:l,name:f||o,ambiguous:a}}const T=ee({name:"voice_refinement",fields:{request:{type:"string",required:!0,max:400,describe:"the one thing they actually want done, in their own words, one sentence"},name:{type:"string",max:48,describe:"a label of at most 6 words"},kind:{type:"enum",values:["question","action","monitor","note","skill","timer","none"],default:"question",describe:"the SMALLEST kind that does what they asked"},skill:{type:"string",max:80,describe:"the skill name, only when kind is skill"}},nothing:{request:"",name:"",kind:"none",skill:""}});function Ke(t){return["A person spoke to their assistant during a meeting. Below is everything they said after","the wake word, transcribed live — so it contains false starts, thinking aloud, and","sometimes several questions where only one is the request.","",te(T),"","Pick the SMALLEST kind that does what they asked:"," question — answer it once, now. The DEFAULT for anything they want to know.",' action — DO something in the browser or an app ("go to google.com and search for X").',' monitor — only if they asked to be told as the meeting CONTINUES ("let me know if",',' "keep an eye on"). A one-off question is NOT a monitor.',' note — they asked for notes written down ("take notes on", "write that up").',' skill — they named a saved skill ("use the summarize skill"); put its name in `skill`.',' timer — alerted after an AMOUNT OF TIME ("set a one minute"); keep it in `request`.'," none — not asking for anything: thinking aloud, or talking ABOUT the assistant.",'Never invent a request that is not there — return "none". Keep `request` close to their',"words; do not answer it.","","WHAT THEY SAID:",String(t||"")].join(`
2
+ `)}function He(t="schema"){return ne(T,{mode:t})}function Ve(t){const e=re(t,T);return e?O(e.value):null}function O(t){if(!t)return null;const e=String(t.request||"").trim();if(t.kind==="none"||!e)return{request:"",name:"",kind:"none",skill:""};let s=t.kind==="skill"&&!t.skill?"question":t.kind;const n=String(t.name||"").trim()||e;if(s==="timer"){const r=M(e);return r?{request:e,name:n,kind:"timer",skill:"",ms:r.ms}:{request:e,name:n,kind:"question",skill:""}}return{request:e,name:n,kind:s,skill:t.skill||""}}function Pe(t,e){const s=String(e||"").toLowerCase();if(!s)return!1;let n;try{n=new URL(t).hostname.toLowerCase().replace(/^www\./,"")}catch{return!1}if(!n)return!1;if(s.includes(n))return!0;const r=n.split(".");return r.length!==2?!1:new RegExp(`\\b${r[0].replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\b`).test(s)}function Xe({onChange:t=null}={}){const e=se(T,{onChange:t?(n,r)=>t(O(n),r):null}),s=n=>({...n,value:O(n.value)});return{push:n=>s(e.push(n)),end:()=>s(e.end()),snapshot:()=>s(e.snapshot()),reset:()=>e.reset(),get text(){return e.text}}}const G=/^(?:the|a|an|our|your|their|my|this|that|these|those|about|on|in|of|with|via|using|called|named|to)$/i,he=/^(?:actually|really|also|always|never|just|only|still|often|usually|basically|literally|probably|certainly|definitely|now|then|even|apparently|obviously)$/i,me=/^(?:is|isn't|was|wasn't|are|aren't|were|weren't|has|hasn't|have|had|does|doesn't|did|didn't|can|can't|cannot|could|couldn't|will|won't|would|wouldn't|should|shouldn't|shall|may|might|must|seems|helps|lets|gives|allows|works|looks|means|needs|wants|keeps|makes|shows|tells|comes|goes|takes|runs|becomes|provides|supports)$/i,pe=/^(?:you|we|i|they|it|there|he|she)$/i,$=t=>String(t?.w||"").replace(/[^\p{L}\p{N}']/gu,"");function ge(t,e,s){const n=e[s+1];if(!n||/[.!?,;:–—-]/.test(t.slice(e[s].end,n.start)))return!1;let r=s+1;return he.test($(e[r]))&&e[r+1]&&(r+=1),me.test($(e[r]))?!pe.test($(e[r+1])):!1}function we(t,e,s,n=0){if(n>0&&G.test(String(e[s].w||"").replace(/[^\p{L}\p{N}]/gu,""))||ge(t,e,s+n))return!1;if(s===0)return!0;const r=e[s-1],i=String(r.w||"").replace(/[^\p{L}\p{N}]/gu,"");if(G.test(i))return!1;if(/^(?:ok|okay|hey|hi|yo|hello|so|um|uh)$/i.test(i))return!0;const a=t.slice(r.start,e[s].start);return/[.!?,;:]["'’”)\]]*\s*$/.test(a)?!/[.!?…]/.test(a)||J(t.slice(0,r.end)):!1}function ye(t){return String(t).replace(/(?:[\s,.:;!?-]*\b(?:ok|okay|hey|hi|yo|hello|so|um+|uh+|and|then|now)\b)+[\s,.:;!?-]*$/i,"").trim()}function q(t){return String(t).replace(/^[\s,.:;!?-]+/,"").replace(/^(?:(?:hey|hi|ok|okay|yo)\b[\s,]*)+/i,"").replace(/^(?:(?:can|could|would|will)\s+you\s+(?:please\s+)?|please\s+)/i,"").trim()}const K={zero:0,one:1,two:2,three:3,four:4,five:5,six:6,seven:7,eight:8,nine:9,ten:10,eleven:11,twelve:12,thirteen:13,fourteen:14,fifteen:15,sixteen:16,seventeen:17,eighteen:18,nineteen:19},H={twenty:20,thirty:30,forty:40,fourty:40,fifty:50,sixty:60,seventy:70,eighty:80,ninety:90},b={half:.5,quarter:.25};function L(t){if(!t.length)return null;let e=null,s=!1;for(let n=0;n<t.length;n++){const r=t[n];if(!(r==="and"||r==="of")){if(r==="a"||r==="an"){e===null&&!(t[n+1]in b)&&(s=!0);continue}if(r in b){e=(e??0)+b[r];continue}if(r in K){e=(e??0)+K[r];continue}if(r in H){e=(e??0)+H[r];continue}if(/^\d+(?:\.\d+)?$/.test(r)){e=(e??0)+Number(r);continue}return null}}return e??(s?1:null)}const V={second:1e3,seconds:1e3,sec:1e3,secs:1e3,s:1e3,minute:6e4,minutes:6e4,min:6e4,mins:6e4,m:6e4,hour:36e5,hours:36e5,hr:36e5,hrs:36e5,h:36e5,day:864e5,days:864e5},ke=/^(\d+(?:\.\d+)?)(s|m|h|secs?|mins?|hrs?|seconds?|minutes?|hours?|days?)$/;function M(t){const e=W(t);let s=0,n=-1,r=-1,i=!1,a=[],c=-1;for(let l=0;l<e.length;l++){const o=e[l],f=(h,y,k,m)=>{s+=h*y,n<0&&(n=k),r=m,i=!0},u=ke.exec(o.w),d=u?V[u[2]]:V[o.w];if(!d){const h=[...a,o.w];L(h)!==null?(c<0&&(c=o.start),a=h):L([o.w])!==null?(a=[o.w],c=o.start):(a=[],c=-1);continue}if(u)f(Number(u[1]),d,o.start,o.end);else{const h=a.length?L(a):null;h!==null&&f(h,d,c>=0?c:o.start,o.end)}a=[],c=-1;const p=xe(e,l);p>l&&(s+=b[e[p].w]*d,r=e[p].end,l=p)}return!i||s<=0?null:{ms:Math.round(s),start:n,end:r}}function xe(t,e){let s=e+1;return t[s]?.w!=="and"?e:(s++,(t[s]?.w==="a"||t[s]?.w==="an")&&s++,b[t[s]?.w]===void 0?e:s)}const S={sunday:0,sun:0,monday:1,mon:1,tuesday:2,tue:2,tues:2,wednesday:3,wed:3,weds:3,thursday:4,thu:4,thur:4,thurs:4,friday:5,fri:5,saturday:6,sat:6},E=Object.freeze({morning:9,afternoon:14,evening:19,night:20,tonight:19,noon:12,midnight:0});function w(t,{days:e=0,hour:s,minute:n=0}){const r=new Date(t);return r.setDate(r.getDate()+e),r.setHours(s,n,0,0),r.getTime()}function P(t,{now:e=Date.now()}={}){const s=String(t||""),n=C(s);let r=1/0,i=-1;const a=(m,g)=>{m<r&&(r=m),g>i&&(i=g)},c=/\bin\s+(.+)$/i.exec(n);if(c){const m=M(c[1]);if(m){const g=c.index+c[0].length-c[1].length;return{at:e+m.ms,recurrence:null,kind:"relative",...N(n,c.index,g+m.end)}}}const l=/\bevery\s+(day|morning|afternoon|evening|night|week|weekday|[a-z]+day|mon|tue|tues|wed|weds|thu|thur|thurs|fri|sat|sun)\b/i.exec(n)||/\b(daily|nightly|weekly)\b/i.exec(n),o=Se(n),f=/\b(today|tonight|tomorrow)\b/i.exec(n),u=/\b(next\s+)?(sunday|sun|monday|mon|tuesday|tues|tue|wednesday|weds|wed|thursday|thurs|thur|thu|friday|fri|saturday|sat)\b/i.exec(n),d=/\b(morning|afternoon|evening|tonight|night|noon|midnight)\b/i.exec(n);l&&a(l.index,l.index+l[0].length),o&&a(o.start,o.end),f&&a(f.index,f.index+f[0].length),u&&a(u.index,u.index+u[0].length),d&&a(d.index,d.index+d[0].length);let p=o?o.hour:d?E[d[1]]:null;const h=o?o.minute:0;if(o&&!o.meridiem&&p<12&&d&&E[d[1]]>=12&&(p+=12),l){const m=(l[1]||"").toLowerCase(),g=p??E[m]??E[m.replace(/ly$/,"")]??9,R=m in S?X(e,S[m],g,h):m==="week"||m==="weekly"?w(e,{days:7,hour:g,minute:h}):be(e,g,h,m==="weekday"),Z=m in S?{kind:"weekly",weekday:S[m],hour:g,minute:h}:m==="week"||m==="weekly"?{kind:"weekly",weekday:new Date(e).getDay(),hour:g,minute:h}:{kind:"daily",hour:g,minute:h,weekdaysOnly:m==="weekday"};return{at:R,recurrence:Z,kind:"recurring",...N(n,r,i)}}if(p===null&&!f&&!u)return null;if(u){const m=S[u[2]];return{at:X(e,m,p??9,h,!!u[1]),recurrence:null,kind:"weekday",...N(n,r,i)}}const y=p??E[d?.[1]||"morning"];if(f){const m=f[1].toLowerCase();return{at:w(e,{days:m==="tomorrow"?1:0,hour:y,minute:h}),recurrence:null,kind:m,...N(n,r,i)}}let k=w(e,{hour:y,minute:h});return k<=e&&(k=w(e,{days:1,hour:y,minute:h})),{at:k,recurrence:null,kind:"clock",...N(n,r,i)}}function N(t,e,s){if(!(e>=0)||!(s>e))return{start:-1,end:-1};const n=/\b(?:at|on|by|in|this|starting|from)\s+$/i.exec(t.slice(0,e));return{start:n?e-n[0].length:e,end:s}}function be(t,e,s,n=!1){let r=w(t,{hour:e,minute:s});if(r<=t&&(r=w(t,{days:1,hour:e,minute:s})),n)for(let i=0;i<7;i++){const a=new Date(r).getDay();if(a!==0&&a!==6)break;r=w(r,{days:1,hour:e,minute:s})}return r}function X(t,e,s,n,r=!1){const i=new Date(t);let a=(e-i.getDay()+7)%7;return a===0&&(r||w(t,{hour:s,minute:n})<=t)&&(a=7),w(t,{days:a,hour:s,minute:n})}function Se(t){const e=C(t),s=/(\d{1,2})(?:[:.](\d{2}))?\s*(a\.?m\.?|p\.?m\.?|o'?clock)?/gi;let n;for(;n=s.exec(e);){const i=/\bat\s+$/.test(e.slice(0,n.index));if(!n[2]&&!n[3]&&!i)continue;let a=Number(n[1]);const c=n[2]?Number(n[2]):0;if(a>23||c>59)continue;const l=(n[3]||"").replace(/[.\s]/g,"").toLowerCase();return l==="pm"&&a<12&&(a+=12),l==="am"&&a===12&&(a=0),{hour:a,minute:c,meridiem:l==="am"||l==="pm",start:n.index,end:n.index+n[0].length}}const r=/\bat\s+([a-z]+)(?:\s+(a\.?m\.?|p\.?m\.?))?/i.exec(e);if(r){const i=L([r[1]]);if(i!==null&&Number.isInteger(i)&&i>=0&&i<=23){let a=i;const c=(r[2]||"").replace(/[.\s]/g,"").toLowerCase();return c==="pm"&&a<12&&(a+=12),c==="am"&&a===12&&(a=0),{hour:a,minute:0,meridiem:c==="am"||c==="pm",start:r.index,end:r.index+r[0].length}}}return null}function A({id:t,label:e,description:s="",examples:n=[],classUsed:r="R",effects:i="idempotent",requiresApproval:a=!1,match:c}){if(!t)throw new D("BAD_INTENT","intent.id required");if(typeof c!="function")throw new D("BAD_INTENT",`intent '${t}': match required`);return Object.freeze({id:t,label:e||t,description:s,examples:Object.freeze([...n]),classUsed:r,effects:i,requiresApproval:a,match:c})}function Ee(t=[]){const e=[...t];return{add(s){return e.push(s),()=>{const n=e.indexOf(s);n>=0&&e.splice(n,1)}},list:()=>[...e],get:s=>e.find(n=>n.id===s)||null,parse(s,n={}){const r=String(s||"").trim();if(!r)return null;for(const i of e){let a=null;try{a=i.match(r,n)}catch{a=null}if(a)return{intent:i.id,label:i.label,classUsed:i.classUsed,effects:i.effects,requiresApproval:i.requiresApproval,args:a,command:r,needsModel:!1}}return{intent:null,args:null,command:r,needsModel:!0}}}}const Ne=A({id:"voice:timer",label:"Set a timer",description:"Starts a countdown and alerts when it finishes.",examples:["set a timer for 10 minutes","start a 90 second timer","timer for an hour and a half"],match:(t,{now:e=Date.now()}={})=>{const s=M(t);if(!s||!/\btimers?\b/i.test(t)&&(!/^(?:set|start|make|create|put)\b/i.test(t.trim())||(t.slice(0,s.start)+" "+t.slice(s.end)).replace(/\b(set|start|make|create|put|a|an|the|for|please|to|of|and|half|quarter|this|that|time|up|on|me)\b/gi," ").replace(/[^\p{L}\p{N}]+/gu,"")))return null;const n=(t.slice(0,s.start)+" "+t.slice(s.end)).replace(/\b(set|start|make|create|a|an|the|for|please|timer|timers|to|of|and|half|quarter)\b/gi," ");return{ms:s.ms,at:e+s.ms,label:_(n)}}}),Ae=A({id:"voice:reminder",label:"Set a reminder",description:"Remembers something and raises it at the time you said.",examples:["remind me to send the deck at 4pm","remember to take the kids to school at 9am on Wednesday","remind me every weekday morning to check the queue"],match:(t,{now:e=Date.now()}={})=>{const s=/\b(?:remind\s+(?:me|us)|reminder|remember)\b/i.exec(t);if(!s)return null;const n=P(t,{now:e});let r=n&&n.end>n.start?t.slice(0,n.start)+" "+t.slice(n.end):t;return r=r.slice(r.toLowerCase().indexOf(s[0].toLowerCase())+s[0].length),r=_(r.replace(/^(?:\s*(?:to|that|about|i\s+need\s+to|we\s+need\s+to))\b/i,"")),r?{text:r,at:n?.at??null,recurrence:n?.recurrence??null,when:n?.kind??null}:null}}),_e=A({id:"voice:note",label:"Take a note",description:"Appends a line to the meeting notes.",examples:["note that we agreed to ship on Friday","take a note: budget is approved"],match:t=>{const e=/^(?:(?:take|make|write|jot|add)\s+(?:down\s+)?(?:a\s+|the\s+|some\s+)?notes?|(?:write|jot)\s+down|notes?)\b[\s:,-]*(?:down\s+)?(?:that\s+|of\s+|on\s+|about\s+|from\s+)?(.+)$/i.exec(t.trim()),s=e&&_(e[1]);return s?{text:s}:null}}),Te=A({id:"voice:monitor",label:"Watch for something",description:"Starts a live monitor that answers as the meeting continues.",examples:["watch for whether we agree a date","keep an eye on the pricing question","track who owns the migration"],classUsed:"C",match:t=>{const e=/^(?:(?:start|set\s+up|create|begin|add|open|run)\s+(?:a\s+|the\s+|an\s+)?(?:live\s+|new\s+)?(?:monitor|monitoring|watch|tracker)|watch\s+(?:out\s+)?for|watch|keep\s+an\s+eye\s+on|track|monitor|monitoring)\b[\s:,-]*(?:whether\s+|if\s+|for\s+|on\s+|about\s+|that\s+)?(.+)$/i.exec(t.trim()),s=e&&_(e[1]);return s&&s.length>2?{prompt:s}:null}}),Le=A({id:"voice:schedule",label:"Schedule something",description:"Runs one of your skills (or a plain instruction) on a schedule.",examples:["every weekday at 8am run my daily brief","run the standup summary every morning","tomorrow at 9 do the release checklist"],classUsed:"C",match:(t,{now:e=Date.now()}={})=>{if(!/\b(run|do|start|kick\s+off|execute)\b/i.exec(t))return null;const n=P(t,{now:e});if(!n)return null;let r=n.end>n.start?t.slice(0,n.start)+" "+t.slice(n.end):t;const i=/\b(run|do|start|kick\s+off|execute)\b/i.exec(r);return r=_((i?r.slice(i.index+i[0].length):r).replace(/^\s*(?:my|the|our)\b/i,"").replace(/\b(skill|job|task)\b\s*$/i,"")),r?{target:r,at:n.at,recurrence:n.recurrence,when:n.kind}:null}}),ve=Object.freeze([Ne,Ae,Le,_e,Te]);function _(t){return String(t||"").replace(/\s+/g," ").replace(/^[\s,.:;-]+|[\s,.:;-]+$/g,"").trim()}function Y(){return Ee(ve)}function Ye(t,{wake:e=x(),intents:s=Y(),now:n=Date.now()}={}){const r=ue(t,e);if(!r)return null;const i=s.parse(r.command,{now:n});return i?{...i,wake:r.wake,heard:r.heard,at:r.at,addressed:r.addressed!==!1}:null}const De=new Set(["maybe","perhaps","probably","basically","roughly","kinda","sorta"]);function J(t){const e=String(t||"").trim().replace(/[\s.,;:!?…'"’”)\]-]+$/u,"");if(!e)return!1;const s=e.toLowerCase().match(/[\p{L}\p{N}']+/gu)||[],n=s[s.length-1];return n?!ie.has(n)&&!De.has(n):!1}const Ie=t=>/[.!?…]["'’”)\]]*\s*$/.test(String(t||"").trim());function Ce(t,e,s){const n=F(t,1).trim();if(n&&n!==t){const r=e.parse(n,{now:s});if(r?.intent)return r}return e.parse(t,{now:s})}const Q=t=>String(t||"").toLowerCase().replace(/[^a-z0-9]+/g," ").trim().slice(0,160),v=6,Oe=t=>Q(t).split(" ").slice(0,v).join(" "),$e=3;function Je(t,{wake:e=x(),intents:s=Y(),isSelf:n=null,sinceTs:r=0,now:i=Date.now(),meetingId:a="",max:c=$e,gate:l=null}={}){const o=[];for(const u of t||[])if(!(!u||!u.text)&&!(u.t&&u.t<=r))for(const d of z(u.text,e)){if(!d.command)continue;const p=Ce(d.command,s,i),h=p&&{...p,wake:d.wake,heard:d.heard,at:d.at,addressed:d.addressed,rest:d.rest};if(!h||!h.intent&&!h.addressed)continue;const y=J(d.command);if(!h.intent&&!l&&!(y&&Ie(u.text)))continue;const k=n?!!n(u.speaker):!1;o.push({...h,allowed:k,finished:y,speaker:u.speaker||"",t:u.t||i,meetingId:a,key:`voice:${a}:${h.intent||"ask"}:${h.ms??h.when??""}:${Oe(d.command)}`})}const f=o.length>c?o.slice(-c):o;return l?l.offer(f,i).due(i):f}const qe=5e3,Me=12e3,Re=3*6e4,Ue=24;function je(t,e){if(!t||!e)return!1;if(t===e||t.startsWith(e)||e.startsWith(t))return!0;const s=t.split(" ").slice(0,v),n=e.split(" ").slice(0,v);return s.length>=v&&s.join(" ")===n.join(" ")}function Qe({settleMs:t=qe,danglingMs:e=Me,forgetMs:s=Re,max:n=Ue}={}){let r=[];const i=c=>c.command.finished===!1?e:t,a=(c,l)=>r.find(o=>o.meetingId===(c.meetingId||"")&&je(o.gist,l));return{offer(c,l=Date.now()){for(const o of c||[]){const f=Q(o.command);if(!f)continue;const u=a(o,f);if(!u){r.push({meetingId:o.meetingId||"",gist:f,command:o,changedAt:l,seenAt:l,done:!1});continue}u.seenAt=l,!u.done&&f!==u.gist&&(u.gist=f,u.command=o,u.changedAt=l)}return r=r.filter(o=>l-o.seenAt<=s),r.length>n&&(r=r.slice(-n)),this},due(c=Date.now()){const l=[];for(const o of r)o.done||c-o.changedAt<i(o)||(o.done=!0,l.push(o.command));return l},nextDueIn(c=Date.now()){let l=null;for(const o of r){if(o.done)continue;const f=Math.max(0,i(o)-(c-o.changedAt));(l===null||f<l)&&(l=f)}return l},get waiting(){return r.filter(c=>!c.done).length}}}export{ve as BUILTIN_VOICE_INTENTS,E as DAYPART_HOUR,oe as DEFAULT_WAKE,$e as MAX_COMMANDS_PER_DELTA,le as MAX_COMMAND_SENTENCES,v as OPENING_WORDS,T as REFINEMENT_SCHEMA,Me as UTTERANCE_DANGLING_MS,qe as UTTERANCE_SETTLE_MS,D as VoiceIntentError,J as commandLooksFinished,Je as commandsFromSegments,x as compileWake,Qe as createUtteranceGate,Ee as createVoiceIntentRegistry,Y as defaultVoiceIntents,A as defineVoiceIntent,U as editDistance,ue as findWakeCommand,z as findWakeCommands,Oe as gistOpening,Q as gistText,fe as isFillerSentence,Te as monitorIntent,C as normalizeSpeech,_e as noteIntent,Se as parseClock,Ye as parseCommand,M as parseDuration,L as parseNumberWords,Ve as parseRefinement,P as parseWhen,Ge as refineSpokenCommand,He as refinementFormat,Ke as refinementPrompt,Xe as refinementStream,Ae as reminderIntent,je as sameUtterance,Le as scheduleIntent,O as settleRefinement,Pe as spokenNamesHost,Ne as timerIntent,W as tokenize,Be as wakeFor};
package/voice-loop.js CHANGED
@@ -1 +1 @@
1
- import{createSpeakerGate as j}from"./voice-speaker.js";const K=["idle","listening","thinking","speaking","muted"],C=2,q=4e3,v=4e3,F=4e3,X=.6,z=3e3,I=x=>String(x||"").toLowerCase().replace(/[^\p{L}\p{N}'\s]/gu," ").split(/\s+/).filter(Boolean);function Q({listen:x,send:H,speakStream:W,onState:$,onError:B,onHeld:V,audible:O,now:c=Date.now}={}){let i="idle",a=!1,f=!1,N=0,s="",E="";const w=typeof O=="function"?O:()=>i==="speaking";let h=0,y=!1,k="",L=0,A=0,R=0;function M(e){const t=I(e);if(t.length<C||!k)return!1;const r=new Set(I(k));let u=0;for(const n of t)r.has(n)&&u++;return u/t.length>=X}const g=j({now:c});let m=null,p=0,d=null;const o=(e,t)=>{if(!(i===e&&t===void 0)){i=e;try{$?.({state:e,text:t})}catch{}}},T=e=>{try{B?.(typeof e=="string"?e:e?.message||"voice failed")}catch{}};function _(){if(p++,d){try{d.stop()}catch{}d=null}}async function P(e){const t=++p;E=e,h=0,y=!1,k="",L=c(),o("thinking",e);const r=W();d=r;let u=!1,n="";try{n=await H(e,{onDelta:l=>{p===t&&(k=String(l||""),!u&&String(l||"").trim()&&(u=!0),o(u?"speaking":"thinking",l),r.push(l))}})}catch(l){p===t&&(T(l),r.stop(),d=null,S());return}if(p===t){n&&(k=String(n),r.push(n)),r.end(),String(n||"").trim()&&o("speaking",n);try{await r.done}catch(l){T(l)}p===t&&(d=null,R=c(),S())}}function S(){a&&o(f?"muted":"listening")}function D(){try{m=x({onInterim:e=>{if(!a||f)return;const t=String(e||"");if(A||(A=c()),i==="listening"){o("listening",s?`${s} ${t}`:t);return}if(i!=="thinking"&&i!=="speaking")return;const r=I(t),u=r.slice(Math.max(0,Math.min(h,r.length))),n=r.length-h;h=r.length,!(!w()||n<C)&&(M(u.join(" "))||(_(),y=!0,S(),o("listening",t)))},onFinal:(e,t)=>{if(!a||f&&c()-N>q)return;h=0;const r=y;y=!1;const u=A||c();A=0;const n=String(e||"").trim();if(!n)return;const l=g.admit(t||{});if(!l.send&&!r){V?.({speaker:l.speaker,text:n,count:g.heldCount(),state:i});return}if(i==="listening"&&c()-R<z&&M(n))return;if(i==="thinking"||i==="speaking"){if(l.weak||n.split(/\s+/).filter(Boolean).length<C||M(n))return;const b=w();_(),!b&&E&&u-L<F&&(s=E)}if(s=s?`${s} ${n}`:n,t?.endOfTurn===!1&&s.length<v){o("listening",s);return}const U=s;s="",P(U)}})}catch(e){T(e),G()}}function G(){_(),a=!1,s="",f=!1;try{m?.()}catch{}m=null,o("idle")}return{state:()=>i,isRunning:()=>a,isMuted:()=>f,primarySpeaker:()=>g.primary(),heldCount:()=>g.heldCount(),resetSpeaker:()=>g.reset(),start(){a||(a=!0,g.reset(),s="",D(),S())},stop:G,setMuted(e){const t=!!e;if(t!==f&&(f=t,f&&(N=c()),!!a))if(f){try{m?.()}catch{}m=null,i==="listening"&&o("muted")}else g.reset(),D(),i==="muted"&&o("listening")},interrupt(){a&&(_(),S())}}}export{F as CONTINUATION_WINDOW_MS,X as ECHO_OVERLAP,z as ECHO_TAIL_MS,v as MAX_PENDING_CHARS,q as MUTE_GRACE_MS,K as VOICE_STATES,Q as createVoiceLoop};
1
+ import{voiceStep as R,initialVoiceState as D}from"./voice-brain.js";import{MIN_BARGE_IN_WORDS as H,MUTE_GRACE_MS as W,MAX_PENDING_CHARS as v,CONTINUATION_WINDOW_MS as F,ECHO_OVERLAP as P,ECHO_TAIL_MS as U,looksLikeEcho as q,isFarewell as B}from"./voice-brain.js";const b=["idle","listening","thinking","speaking","muted"];function w({listen:E,send:I,speakStream:A,onState:M,onError:T,onHeld:N,onEnd:O,audible:S,now:x=Date.now}={}){let l="idle",u=!1,s=D();const k=typeof S=="function"?S:()=>l==="speaking",i=t=>{const e=R(s,t,{now:x});return s=e.state,e.act};let p=null,a=0,o=null;const r=(t,e)=>{if(!(l===t&&e===void 0)){l=t;try{M?.({state:t,text:e})}catch{}}},y=t=>{try{T?.(typeof t=="string"?t:t?.message||"voice failed")}catch{}};function g(){if(a++,o){try{o.stop()}catch{}o=null}}async function C(t){const e=++a;i({type:"turn-start",said:t}),r("thinking",t);const n=A();o=n;let m=!1,f="";try{f=await I(t,{onDelta:c=>{a===e&&(i({type:"reply",text:String(c||"")}),!m&&String(c||"").trim()&&(m=!0),r(m?"speaking":"thinking",c),n.push(c))}})}catch(c){a===e&&(y(c),n.stop(),o=null,i({type:"cancel"}),d());return}if(a===e){f&&(i({type:"reply",text:String(f)}),n.push(f)),n.end(),String(f||"").trim()&&r("speaking",f);try{await n.done}catch(c){y(c)}a===e&&(o=null,i({type:"turn-end"}),d())}}function d(){u&&r(s.muted?"muted":"listening")}function _(){try{p=E({onInterim:t=>{if(!u)return;const e=i({type:"interim",text:String(t||""),audible:k()});if(e.bargeIn){g(),d(),r("listening",e.caption);return}e.caption!==void 0&&r("listening",e.caption)},onFinal:(t,e)=>{if(!u)return;const n=i({type:"final",text:t,info:e,audible:k()});if(n.held){N?.({...n.held,state:l});return}if(n.end){h();try{O?.()}catch{}return}if(n.cancel&&g(),n.pending!==void 0){r("listening",n.pending);return}n.send&&C(n.send)}})}catch(t){y(t),h()}}function h(){g(),u=!1,i({type:"stop"});try{p?.()}catch{}p=null,r("idle")}return{state:()=>l,isRunning:()=>u,isMuted:()=>s.muted,primarySpeaker:()=>s.gate?.primary||"",heldCount:()=>s.gate?.held||0,resetSpeaker:()=>{i({type:"reset-speaker"})},start(){u||(u=!0,i({type:"reset"}),_(),d())},stop:h,setMuted(t){const e=!!t;if(e!==s.muted&&(i({type:"mute",on:e}),!!u))if(e){try{p?.()}catch{}p=null,l==="listening"&&r("muted")}else _(),l==="muted"&&r("listening")},interrupt(){u&&(g(),i({type:"cancel"}),d())}}}export{F as CONTINUATION_WINDOW_MS,P as ECHO_OVERLAP,U as ECHO_TAIL_MS,v as MAX_PENDING_CHARS,H as MIN_BARGE_IN_WORDS,W as MUTE_GRACE_MS,b as VOICE_STATES,w as createVoiceLoop,B as isFarewell,q as looksLikeEcho};
package/voice-scribe.js CHANGED
@@ -1 +1 @@
1
- import{createChannelTranscript as P}from"./voice-channels.js";const j=4e3,L=3e4,N={setTimeout:(e,i)=>setTimeout(e,i),clearTimeout:e=>clearTimeout(e),setInterval:(e,i)=>setInterval(e,i),clearInterval:e=>clearInterval(e)},G=()=>Math.random().toString(36).slice(2,8),J=e=>{const i=new Date(e);return`${i.getHours()}:${String(i.getMinutes()).padStart(2,"0")}`};function Q({mic:e="self",playback:i=!0,resume:a=null,live:h=!1,openEar:y,capturePlayback:f,persist:I,onUpdate:c,onEnd:H,onNotice:w,now:A=Date.now,newId:q=G,timers:k=N,flushDebounceMs:x=j,heartbeatMs:z=L}={}){if(typeof y!="function")throw new Error("createAudioScribe: openEar is required");if(typeof I!="function")throw new Error("createAudioScribe: persist is required");if(i&&typeof f!="function")throw new Error("createAudioScribe: capturePlayback is required when playback is on");return{async start(){let n=null;if(i)try{n=await f({onEnded:()=>T("ended")})}catch(t){return t?.code!=="cancelled"&&w?.({level:"error",text:t?.message||"Could not capture what is playing"}),null}const v=a?.startedAt||A(),S=a?.meetingId||`mtg_${n?"audio":"room"}_${v.toString(36)}_${q()}`,s=P({now:A,mic:e,playback:!!n,seed:a?.segments||[]});let m=!0,_=!1,F=a?.segments?.length?Math.max(...a.segments.map(t=>Number(t.t)||0))+1:0,R=0,g=null,M=null,E=!1;const d={mic:null,playback:null},l={mic:"starting",playback:n?"starting":"off",lang:null},O=()=>{if(a?.title)return a.title;const t=J(v);return n?n.surface==="screen"?`System audio · ${t}`:n.surface==="tab"?`Tab audio · ${t}`:`Audio · ${t}`:`Room · ${t}`};async function b(t="live",$){if(E)return;const r=s.record({id:S,startedAt:v,status:t,endReason:$,title:O()}),u=s.delta(F);let p=null;try{p=await I(r,u)}catch{return}if(p?.limit){E=!0,T("limit");return}if(p?.ok===!1)return;R=A();const D=r.segments[r.segments.length-1];D&&(F=D.t)}function B(){if(m){if(A()-R>=x){b("live");return}g||(g=k.setTimeout(()=>{g=null,m&&b("live")},x))}}const C=(t,$)=>y(t,{...$,on:{onStart:()=>{l[t]="listening",c?.(o())},onInterim:r=>{s.interim(t,r),c?.(o())},onFinal:(r,u)=>{s.final(t,r,u||{})&&(B(),c?.(o()))},onStatus:r=>{r?.state==="language"&&r.lang?l.lang=r.lang:r?.state&&r.state!=="ready"&&(l[t]=r.state==="diarize"?"loading speaker model":r.state),c?.(o())},onError:({message:r,fatal:u}={})=>{l[t]=u?"failed":"listening",w?.({level:"error",text:`${t==="mic"?"Microphone":"Playback"}: ${r||"failed"}`});const p=t==="mic"?l.playback:l.mic;u&&(p==="failed"||p==="off")&&T("ended"),c?.(o())},onEnd:()=>{m&&l[t]!=="failed"&&(l[t]="stopped"),c?.(o())}}});d.mic=C("mic",{diarize:e==="room",interims:!!h,stream:null}),d.mic.start(),n&&(d.playback=C("playback",{diarize:!0,interims:!!h,stream:n.stream}),d.playback.start()),M=k.setInterval(()=>{m&&b("live")},z);function o(){return{meetingId:S,startedAt:v,mic:e,surface:n?n.surface:"mic",status:{...l},audio:{mic:d.mic?.stats?.()||null,playback:d.playback?.stats?.()||null},speakers:s.speakers(),interims:s.interims(),lines:s.segments().length,last:s.last("playback")||s.last("mic")}}function T(t="user"){if(_)return;_=!0,m=!1,k.clearInterval(M),g&&(k.clearTimeout(g),g=null);for(const u of Object.values(d))try{u?.stop()}catch{}try{n?.stop()}catch{}(E?Promise.resolve():b("ended",t==="user"?"user":t==="interrupted"?"interrupted":"ended")).finally(()=>H?.({meetingId:S,reason:t}))}return c?.(o()),{meetingId:S,isRunning:()=>m,snapshot:o,stop:T,flush:()=>b("live")}}}}function V(e,{now:i=Date.now()}={}){if(!e?.id)return null;const{id:a,title:h,tags:y,...f}=e;return{id:`meeting:${a}`,title:h||"Audio transcript",...y?{tags:y}:{},createdAt:e.startedAt||i,updatedAt:e.endedAt||i,body:{...f,segments:Array.isArray(f.segments)?f.segments:[]},meta:{origin:"capture",readOnly:!1,live:e.status!=="ended"}}}export{j as FLUSH_DEBOUNCE_MS,L as HEARTBEAT_MS,Q as createAudioScribe,V as meetingRecordFromCapture};
1
+ import{createChannelTranscript as W}from"./voice-channels.js";const X=4e3,Y=3e4,F=3e3,Z={setTimeout:(r,n)=>setTimeout(r,n),clearTimeout:r=>clearTimeout(r),setInterval:(r,n)=>setInterval(r,n),clearInterval:r=>clearInterval(r)},G=()=>Math.random().toString(36).slice(2,8),U=r=>{const n=new Date(r);return`${n.getHours()}:${String(n.getMinutes()).padStart(2,"0")}`};function et({mic:r="self",playback:n=!0,resume:o=null,live:v=!1,echoGuard:A=!1,openEar:y,capturePlayback:R,persist:w,onUpdate:m,onEnd:P,onNotice:C,onLine:_,now:f=Date.now,newId:j=G,timers:b=Z,flushDebounceMs:D=X,heartbeatMs:L=Y}={}){if(typeof y!="function")throw new Error("createAudioScribe: openEar is required");if(typeof w!="function")throw new Error("createAudioScribe: persist is required");if(n&&typeof R!="function")throw new Error("createAudioScribe: capturePlayback is required when playback is on");return{async start(){let i=null;if(n)try{i=await R({onEnded:()=>I("ended")})}catch(t){return t?.code!=="cancelled"&&C?.({level:"error",text:t?.message||"Could not capture what is playing"}),null}const E=o?.startedAt||f(),$=o?.meetingId||`mtg_${i?"audio":"room"}_${E.toString(36)}_${j()}`,l=W({now:f,mic:r,playback:!!i,seed:o?.segments||[],echoGuard:A});let h=!0,H=!1,q=o?.segments?.length?Math.max(...o.segments.map(t=>Number(t.t)||0))+1:0,z=0,T=null,O=null,x=!1;const g={mic:null,playback:null};let p=[],k=null;const J=t=>l.segments().some(s=>s.sid===t);function M(t=!1){const s=t?p:p.filter(e=>f()-e.at>=F);p=t?[]:p.filter(e=>f()-e.at<F);for(const e of s)J(e.line.sid)&&_?.(e.line);k&&(b.clearTimeout(k),k=null),p.length&&(k=b.setTimeout(()=>{k=null,M()},Math.max(0,F-(f()-p[0].at))))}function K(t,s,e){if(!_)return;const a={sid:s.sid,t:s.t,channel:t,speaker:s.speaker,text:e};if(t==="mic"&&A&&i){p.push({at:f(),line:a}),k||M();return}_(a)}const u={mic:"starting",playback:i?"starting":"off",lang:null},Q=()=>{if(o?.title)return o.title;const t=U(E);return i?i.surface==="screen"?`System audio · ${t}`:i.surface==="tab"?`Tab audio · ${t}`:`Audio · ${t}`:`Room · ${t}`};async function S(t="live",s){if(x)return;const e=l.record({id:$,startedAt:E,status:t,endReason:s,title:Q()}),a=l.delta(q);let c=null;try{c=await w(e,a)}catch{return}if(c?.limit){x=!0,I("limit");return}if(c?.ok===!1)return;z=f();const N=e.segments[e.segments.length-1];N&&(q=N.t)}function V(){if(h){if(f()-z>=D){S("live");return}T||(T=b.setTimeout(()=>{T=null,h&&S("live")},D))}}const B=(t,s)=>y(t,{...s,on:{onStart:()=>{u[t]="listening",m?.(d())},onInterim:e=>{l.interim(t,e),m?.(d())},onFinal:(e,a)=>{const c=l.final(t,e,a||{});c&&(K(t,c,String(e).replace(/\s+/g," ").trim()),V(),m?.(d()))},onStatus:e=>{e?.state==="language"&&e.lang?u.lang=e.lang:e?.state&&e.state!=="ready"&&(u[t]=e.state==="diarize"?"loading speaker model":e.state),m?.(d())},onError:({message:e,fatal:a}={})=>{u[t]=a?"failed":"listening",C?.({level:"error",text:`${t==="mic"?"Microphone":"Playback"}: ${e||"failed"}`});const c=t==="mic"?u.playback:u.mic;a&&(c==="failed"||c==="off")&&I("ended"),m?.(d())},onEnd:()=>{h&&u[t]!=="failed"&&(u[t]="stopped"),m?.(d())}}});g.mic=B("mic",{diarize:r==="room",interims:!!v,stream:null}),g.mic.start(),i&&(g.playback=B("playback",{diarize:!0,interims:!!v,stream:i.stream}),g.playback.start()),O=b.setInterval(()=>{h&&S("live")},L);function d(){return{meetingId:$,startedAt:E,mic:r,surface:i?i.surface:"mic",status:{...u},audio:{mic:g.mic?.stats?.()||null,playback:g.playback?.stats?.()||null},speakers:l.speakers(),interims:l.interims(),lines:l.segments().length,last:l.last("playback")||l.last("mic")}}function I(t="user"){if(H)return;H=!0,h=!1,b.clearInterval(O),T&&(b.clearTimeout(T),T=null),M(!0);for(const a of Object.values(g))try{a?.stop()}catch{}try{i?.stop()}catch{}(x?Promise.resolve():S("ended",t==="user"?"user":t==="interrupted"?"interrupted":"ended")).finally(()=>P?.({meetingId:$,reason:t}))}return m?.(d()),{meetingId:$,isRunning:()=>h,snapshot:d,stop:I,flush:()=>S("live")}}}}function rt(r,{now:n=Date.now()}={}){if(!r?.id)return null;const{id:o,title:v,tags:A,...y}=r;return{id:`meeting:${o}`,title:v||"Audio transcript",...A?{tags:A}:{},createdAt:r.startedAt||n,updatedAt:r.endedAt||n,body:{...y,segments:Array.isArray(y.segments)?y.segments:[]},meta:{origin:"capture",readOnly:!1,live:r.status!=="ended"}}}export{X as FLUSH_DEBOUNCE_MS,Y as HEARTBEAT_MS,F as LINE_SETTLE_MS,et as createAudioScribe,rt as meetingRecordFromCapture};
package/voice-speaker.js CHANGED
@@ -1 +1 @@
1
- const c=45e3,f="You",R=.6,d=r=>r?typeof r=="string"?r:String(r.label||r.id||""):"",p=(r,a)=>{const e=r&&typeof r=="object"?r.scores?.[a]:void 0;return typeof e=="number"&&Number.isFinite(e)?e:null};function E({reEnrollMs:r=45e3,now:a=Date.now}={}){let e="",n=0,u=0;return{primary:()=>e,heldCount:()=>u,admit(l={}){const o=l.speaker,t=d(o);if(!t)return{send:!0,reason:"no-speaker",speaker:""};const s=a();if(!e)return e=t,n=s,{send:!0,reason:"enrolled",speaker:t};if(t===e)return n=s,{send:!0,reason:"primary",speaker:t};const i=p(o,e);return i!==null&&i>=.6?(n=s,{send:!0,reason:"near",speaker:e}):o&&typeof o=="object"&&o.weak===!0?{send:!0,reason:"weak",speaker:t,weak:!0}:s-n>=r?(e=t,n=s,{send:!0,reason:"adopted",speaker:t}):(u+=1,{send:!1,reason:"other",speaker:t})},reset(){e="",n=0,u=0}}}export{R as NEAR_PRIMARY,f as PINNED_SELF,c as RE_ENROLL_MS,E as createSpeakerGate};
1
+ const f=45e3,N="You",R=.6,d=e=>e?typeof e=="string"?e:String(e.label||e.id||""):"",c=(e,l)=>{const n=e&&typeof e=="object"?e.scores?.[l]:void 0;return typeof n=="number"&&Number.isFinite(n)?n:null};function b({reEnrollMs:e=45e3,now:l=Date.now,seed:n=null}={}){let r=String(n?.primary||""),o=Number(n?.lastHeard)||0,u=Number(n?.held)||0;return{primary:()=>r,heldCount:()=>u,admit(p={}){const s=p.speaker,t=d(s);if(!t)return{send:!0,reason:"no-speaker",speaker:""};const a=l();if(!r)return r=t,o=a,{send:!0,reason:"enrolled",speaker:t};if(t===r)return o=a,{send:!0,reason:"primary",speaker:t};const i=c(s,r);return i!==null&&i>=.6?(o=a,{send:!0,reason:"near",speaker:r}):s&&typeof s=="object"&&s.weak===!0?{send:!0,reason:"weak",speaker:t,weak:!0}:a-o>=e?(r=t,o=a,{send:!0,reason:"adopted",speaker:t}):(u+=1,{send:!1,reason:"other",speaker:t})},reset(){r="",o=0,u=0},toJSON:()=>({primary:r,lastHeard:o,held:u})}}export{R as NEAR_PRIMARY,N as PINNED_SELF,f as RE_ENROLL_MS,b as createSpeakerGate};
package/voice-vad.js CHANGED
@@ -1 +1 @@
1
- const m=Object.freeze({minFrames:12,ratio:3,minEnergy:.06,floorAlpha:.02,cooldownFrames:45});function c(n={}){const t={...m,...n};let o=.02,e=0,r=0;return{get floor(){return o},feed(l,f=!0){const a=Math.max(0,Math.min(1,Number(l)||0));if(r>0)return r--,!1;const u=Math.max(t.minEnergy,o*t.ratio);return a>=u?(e++,e>=t.minFrames?(e=0,r=t.cooldownFrames,!0):!1):(e=0,f&&(o+=(a-o)*t.floorAlpha),!1)},reset(){e=0,r=0}}}function i(n,t=.25){if(!n||!n.length)return 0;const o=Math.max(1,Math.floor(n.length*t));let e=0;for(let r=0;r<o;r++)e+=n[r];return e/o/255}export{m as VAD_DEFAULTS,c as createVad,i as lowBandEnergy};
1
+ const w=Object.freeze({minFrames:12,ratio:3,minEnergy:.06,floorAlpha:.02,cooldownFrames:45,window:0});function g(e={}){const r={...w,...e};let o=.02,n=0,t=0;const l=r.window>0?new Uint8Array(r.window):null;let i=0,f=0;const u=a=>{l&&(f+=a-l[i],l[i]=a,i=(i+1)%l.length)};return{get floor(){return o},feed(a,c=!0){const h=Math.max(0,Math.min(1,Number(a)||0));if(t>0)return t--,!1;const m=Math.max(r.minEnergy,o*r.ratio);return h>=m?(n++,u(1),(l?f:n)>=r.minFrames?(n=0,l&&(l.fill(0),f=0),t=r.cooldownFrames,!0):!1):(n=0,u(0),c&&(o+=(h-o)*r.floorAlpha),!1)},reset(){n=0,t=0,l&&(l.fill(0),f=0)}}}function d(e,r=4){if(!e||!e.length)return 0;let o=0,n=0;for(let t=0;t<e.length;t+=r)o+=e[t]*e[t],n++;return Math.min(1,Math.sqrt(o/Math.max(1,n))*4)}function s(e,r=.25){if(!e||!e.length)return 0;const o=Math.max(1,Math.floor(e.length*r));let n=0;for(let t=0;t<o;t++)n+=e[t];return n/o/255}export{w as VAD_DEFAULTS,g as createVad,s as lowBandEnergy,d as pcmEnergy};
@@ -0,0 +1,7 @@
1
+ import{fuseRRF as F,planQueries as re}from"./rrf.js";import{buildIndex as oe,bm25Search as ne}from"./text-index.js";import{offersIn as ae,rankOffers as ie,quoteFormIn as ce,formatValue as W,basisLabel as T,hostOf as le}from"./offers.js";import{fenceUntrusted as ue}from"./page-guard.js";import{markdownUrl as U}from"./citations.js";const C=Object.freeze({queries:4,rounds:2,parallel:3,pages:10,perHost:2,read:6,passages:8,passageChars:700,offers:8,forms:5,ms:25e3,briefChars:9e3}),I="jan(?:uary)?|feb(?:ruary)?|mar(?:ch)?|apr(?:il)?|may|june?|july?|aug(?:ust)?|sep(?:t(?:ember)?)?|oct(?:ober)?|nov(?:ember)?|dec(?:ember)?",Y="monday|tuesday|wednesday|thursday|friday|saturday|sunday|mon|tue|wed|thu|fri|sat|sun",N=new RegExp(String.raw`\b(?:(?:${I})\.?\s+\d{1,2}(?:st|nd|rd|th)?(?:\s*(?:-|–|to|until)\s*(?:(?:${I})\.?\s+)?\d{1,2}(?:st|nd|rd|th)?)?(?:,?\s+\d{4})?|\d{1,2}(?:st|nd|rd|th)?\s+(?:${I})\b(?:\s+\d{4})?|(?:in|during|for|this|next|early|mid|late)\s+(?:${I})\b|\d{4}-\d{2}-\d{2}|\d{1,2}\/\d{1,2}(?:\/\d{2,4})?|(?:this|next|coming)\s+(?:week(?:end)?|month|(?:${Y}))|tomorrow|tonight|today|(?:over|for)\s+(?:christmas|thanksgiving|new year'?s?|easter|spring break|the holidays)|in\s+\d+\s+(?:days?|weeks?|months?))\b`,"i"),he=new RegExp(`^(?:${I}|${Y}|today|tomorrow|tonight|next|this|the|a|an|my|our|me|us|\\d+)$`,"i"),fe=/\s+(?:for|from|to|on|in|at|under|below|with|next|this|during|by|and|or|between|around|near|within|over|departing|leaving|returning|round|one|nonstop|direct|cheap|best|flights?|hotels?|deals?)\b.*$/i,de=/\b(\d{5}(?:-\d{4})?|[A-Z]{1,2}\d[A-Z\d]?\s?\d[A-Z]{2})\b/,K=/\b([A-Z]{3})\s*(?:-|–|→|>|to)\s*([A-Z]{3})\b/;function H(e){const t=String(e||"").replace(fe,"").replace(/[?!.,;:]+$/g,"").trim();return!t||t.split(/\s+/).length>4||he.test(t)||N.test(t)||!new RegExp("\\p{L}","u").test(t)||/^(?:me|here|there|home|you|it|them|us|the|a|my|our|cheap|best|flights?|hotels?)$/i.test(t)?"":t}const D={where:e=>{const t=de.exec(e);if(t)return t[1];const r=/\b(?:in|near|around|at|for)\s+([\p{L}][\p{L}.'’ -]{1,40})/iu.exec(e.replace(N," "));return r?H(r[1]):""},from:e=>{const t=K.exec(e);if(t)return t[1];const r=/\bfrom\s+([\p{L}][\p{L}.'’ -]{1,40}?)(?=\s+(?:to|→|-)\s|\s*$|[?,])/iu.exec(e)||/\b([\p{L}][\p{L}.'’ -]{1,30}?)\s+to\s+[\p{L}][\p{L} .'-]{1,30}?\s+(?:flights?|fares?|airfare|tickets?)\b/iu.exec(e);return r?H(r[1].replace(/^(?:cheap(?:est)?|best|find|flights?|fly(?:ing)?|airfares?)\s+/i,"").replace(/^(?:flights?|fly(?:ing)?)\s+/i,"")):""},to:e=>{const t=K.exec(e);if(t)return t[2];const r=/\bto\s+([\p{L}][\p{L}.'’ -]{1,40})/iu.exec(e.replace(/\bhow much\b/i,""));return r?H(r[1]):""},when:e=>(N.exec(e)?.[0]||"").trim(),who:e=>/\b(\d+|one|two|three|four|five|six|seven|eight)\s+(?:adults?|people|persons|passengers|travell?ers|guests|of us)\b|\bfamily of (\d+)\b|\b(solo|couple)\b/i.exec(e)?.[0]||"",budget:e=>/\b(?:under|below|less than|max(?:imum)?|up to|within|no more than|<)\s*(?:[$€£]\s?)?\d[\d,.]*\s?(?:k|usd|eur|gbp|dollars|euros|pounds)?(?:\s*(?:\/|per|a)\s*(?:mo(?:nth)?|yr|year|night))?\b/i.exec(e)?.[0]||"",kind:e=>(/\b(auto|car|vehicle|motorcycle|homeowners?|home|house|renters?|condo|landlord|term life|whole life|life|health|medical|dental|vision|pet|dog|cat|travel|boat|umbrella|business)\b/i.exec(e)?.[1]||"").toLowerCase()},B=Object.freeze([{id:"insurance",label:"insurance",match:/\binsur(?:ance|er|ers)\b|\b(?:premiums?|coverage) (?:quotes?|rates?|prices?)\b/i,terms:["insurance","quote","rate","premium","coverage"],subject:"{kind?} insurance",queries:["{kind?} insurance quotes {where?}","cheapest {kind?} insurance {where?} {year}","{kind?} insurance rates compared {year}"],slots:[{id:"kind",label:"what to insure (car, home, renters, life, health, pet, travel…)",required:!0},{id:"where",label:"ZIP code / postcode or state",required:!0}],forms:!0},{id:"flight",label:"flights",match:/\b(?:flights?|airfares?|air ?fares?|plane tickets?|airline tickets?|fly(?:ing)? (?:to|from|out)|nonstop to)\b/i,terms:["flight","fare","airline","round","trip"],subject:"flights",queries:["cheap flights {from} to {to} {when?}","{from} to {to} flight deals","{from} {to} airfare {when?} {year}","cheap flight deals {year}","best time to book flights {year}"],slots:[{id:"from",label:"departure city or airport",required:!0},{id:"to",label:"destination",required:!0},{id:"when",label:"travel dates",required:!0},{id:"who",label:"number of travellers",required:!1}],forms:!0},{id:"hotel",label:"hotels",match:/\b(?:hotels?|motels?|resorts?|accommodation|lodging|places? to stay|vacation rentals?|airbnb|b&b)\b/i,terms:["hotel","night","room","stay"],subject:"hotels",queries:["best hotel deals {where} {when?}","cheap hotels {where} {when?}","{where} hotels price per night {year}","hotel deals {year}"],slots:[{id:"where",label:"city or area",required:!0},{id:"when",label:"dates",required:!0},{id:"who",label:"number of guests",required:!1}],forms:!0},{id:"car-rental",label:"car rental",match:/\b(?:car rentals?|rental cars?|rent a car|hire car|car hire)\b/i,terms:["rental","car","day"],subject:"car rental",queries:["cheap car rental {where} {when?}","car rental deals {where} {year}","car rental deals {year}"],slots:[{id:"where",label:"pick-up city or airport",required:!0},{id:"when",label:"dates",required:!0}],forms:!0},{id:"plan",label:"plans",match:/\b(?:internet|broadband|fib(?:er|re)|wi-?fi|mobile|cell(?:ular)?|phone|sim|electric(?:ity)?|energy|power|gas|streaming|vpn|cloud storage)\s+(?:plans?|providers?|deals?|services?|bills?|tariffs?|rates?|packages?)\b/i,terms:["plan","month","price"],queries:["best {subject} {where?} {year}","cheapest {subject} {where?}","{subject} prices compared {year}"],slots:[{id:"where",label:"ZIP code / city",required:!1},{id:"budget",label:"budget",required:!1}],forms:!1},{id:"product",label:"products",match:null,terms:["price","review"],queries:["best {subject} {budget?} {year}","{subject} price","{subject} deals {budget?}"],slots:[{id:"budget",label:"budget",required:!1}],forms:!1}]),P=e=>B.find(t=>t.id===e)||B[B.length-1],Q=/\b(?:cheapest|cheaper|lowest (?:price|fare|rate|cost)s?|affordable|deals?|discounts?|coupons?|promo codes?|on sale|bargains?|prices?|pricing|fares?|(?:get|want|need|free|instant) (?:a |an |my )?quotes?|quotes? (?:for|on)|how much (?:is|are|does|do|would|will|for|to)\b(?!\s+(?:time|longer|more|of my|of the (?:meeting|page|doc)))[^?]*\b(?:cost|costs|charge|pay|price)|how much (?:is|are) (?:a|an|the)? ?(?:flight|ticket|hotel|room|night)|cost of (?:a|an|the)?)\b/i,pe=/\b(?:best|top[- ]rated|compare|comparison|vs\.?|versus|recommend(?:ation)?s? for|worth buying|quotes?|where (?:can i|to|should i) (?:buy|get|find|book|rent)|save money on|rates?)\b/i,ge=/\b(?:buy|buying|purchase|shop(?:ping)?|order|book(?:ing)?|rent(?:al|ing)?|subscribe|subscription|plans?|insurance|flights?|hotels?|tickets?|deals?|prices?|costs?|rates?|fares?|movers?|moving company|contractors?|plumbers?|roofers?|repair (?:shop|service)s?|installation|providers?|under\s*[$€£]?\s?\d)\b|[$€£]\s?\d/i,me=/\bbest\s+(?!way|ways|practice|practices|time|approach|method|answer|thing|things|idea|ideas|advice|place to (?:learn|start)|book(?!ing))[\p{L}\d][\p{L}\d+-]*(?:\s+[\p{L}\d][\p{L}\d+-]*){0,3}\s+(?:for|under|below|to buy|in 20\d\d|of 20\d\d)\b/iu,be=/\b(?:stocks?|shares?|share price|ticker|market cap|dividend|crypto(?:currency)?|bitcoin|ethereum|exchange rate)\b|\b(?:my|our) (?:notes?|meetings?|chats?|calendar|emails?|inbox|files?|docs?|documents?|history|library)\b|\b(?:this|the) (?:page|tab|doc(?:ument)?|file|repo(?:sitory)?|code(?:base)?|pr|diff|function|spreadsheet)\b|\b(?:function|exception|stack ?trace|npm|pip|python|javascript|typescript|regex|sql|compile|git|docker|kubernetes|api key|endpoint)\b/i,G=/^\s*(?:(?:hey|hi|ok(?:ay)?|so|please|pls|can you|could you|would you|will you|help me|i need(?: to)?|i want(?: to)?|i'?m looking for|i am looking for|look(?:ing)? for|find(?: me)?|get(?: me)?|show(?: me)?|search(?: for)?|look up|tell me|give me|what(?:'s| is| are)|which(?: is| are)?|where(?:'s| is| are| can i (?:buy|get|find|book))?|who (?:has|offers)|how much (?:is|are|does|do|for)|how much)\s+)+/i,Z=/\s+(?:for me|for us|near me|right now|now|today|online|please|pls|this year|in 20\d\d)\s*$|[?!.]+$/i,we=/\b(?:the|a|an|best|cheapest|cheaper|cheap|lowest|affordable|good|great|top[- ]rated|top|most|really|deals?|discounts?|coupons?|bargains?|quotes?|prices?|pricing|costs?|rates?|fares?|offers?|options?|compare|comparison|cost|to buy|on sale)\b/gi;function ye(e,t){let r=String(e||"").replace(G,"").replace(Z,"").replace(Z,"");return r=r.replace(N," ").replace(/\b(?:from|to|in|near|around|under|below|for|with|between)\s+.*$/i,o=>t.id==="product"||t.id==="plan"?o.replace(/\b(?:in|near|around|from|to)\s+.*$/i,""):""),r=r.replace(D.budget(r)||"\0"," ").replace(we," ").replace(/\b(?:does|do|is|are|a|an|it|cost|costs|20\d\d|i|can|buy|get|where)\b/gi," ").replace(/\s+/g," ").trim(),r.length>=2?r:t.label}function V(e,t){let r=!0;const o=e.replace(/\{(\w+)(\?)?\}/g,(i,a,s)=>(!t[a]&&!s&&(r=!1),t[a]||""));return r?o.replace(/\s+/g," ").trim():""}function Pe(e,{previous:t=null,now:r=Date.now()}={}){const o=String(e||"").trim();if(!o||o.length>400)return null;const i=o.split(/\s+/).length,a=t?.kind==="research"&&t.research?.domain?t.research:null;let s=B.find(l=>l.match&&l.match.test(o))||null;const h=s?s.slots.filter(l=>D[l.id]?.(o)).length:0,f=!be.test(o)&&i>=2&&(Q.test(o)||pe.test(o)&&(s||ge.test(o))||me.test(o)||s&&(/\b(?:find|search|look|book|get|need)\b/i.test(o)||h>=2));if(!f&&a&&i<=14&&(!s||s.id===a.domain)){const l=P(a.domain),b=Object.fromEntries(l.slots.map(c=>[c.id,D[c.id]?.(o)||""]).filter(([,c])=>c));return Object.keys(b).length?J(`${a.question} ${o}`,l,{...a.slots,...b},r,!0,l.subject?"":a.subject):null}if(!f)return null;s||=P("product");const d=Object.fromEntries(s.slots.map(l=>[l.id,D[l.id]?.(o)||""]).filter(([,l])=>l));return J(o,s,d,r,!1)}function J(e,t,r,o,i,a=""){const s=String(new Date(o).getFullYear()),h=a||(t.subject?V(t.subject,r):ye(e,t)),f={...r,subject:h,year:s},d=t.queries.map(c=>V(c,f)).filter(Boolean),l=i?"":e.replace(G,"").replace(Z,"").replace(/^(?:a|an|the)\s+/i,"").trim(),b=(l?re(l,{extra:d,max:C.queries*2}):[...new Set(d)]).filter(c=>c.split(/\s+/).length>=2).slice(0,C.queries);return{question:e,domain:t.id,subject:h,slots:r,missing:t.slots.filter(c=>c.required&&!r[c.id]).map(c=>({id:c.id,label:c.label})),queries:b,forms:t.forms,followUp:i}}function $e(e,t=[],{now:r=Date.now()}={}){const o=String(new Date(r).getFullYear()),i=P(e.domain),a=i.slots.map(l=>e.slots?.[l.id]).filter(Boolean).join(" "),s=e.subject,h=[`${s} ${a} price ${o}`,i.forms?`${s} ${a} average cost`:`${s} ${a} cost`,`${s} ${a} comparison`,`${s} ${a}`],f=new Set(t.map(l=>l.toLowerCase().replace(/\s+/g," ").trim())),d=[];for(const l of h){const b=l.replace(/\s+/g," ").trim();b.split(/\s+/).length>=2&&!f.has(b.toLowerCase())&&!d.includes(b)&&d.push(b)}return d.slice(0,3)}function ke(e){if(e&&typeof e=="object"&&Array.isArray(e.results))return{query:e.query||"",engines:e.engines||[],results:e.results.filter(a=>a?.url)};const t=typeof e=="string"?e:typeof e?.text=="string"?e.text:"",r=/^Web search results for "([^"]*)" \(engines: ([^)]*)\)/m.exec(t),o=t.indexOf("Result details:");if(!r||o<0)return{query:r?.[1]||"",engines:[],results:[]};const i=[];for(const a of t.slice(o).split(/\n+---\n+(?=### \[\d+\])/)){const s=/### \[(\d+)\] ([^\n]*)\n<([^>\s]+)>\n\n?([\s\S]*)$/.exec(a);s&&i.push({rank:Number(s[1]),title:s[2].trim(),url:s[3],text:s[4].trim()})}return{query:r[1],engines:r[2].split(/,\s*/).filter(Boolean),results:i}}const X=/^(?:utm_\w+|gclid|fbclid|msclkid|mc_[a-z]+|ref|ref_src|source|campaign|affiliate|aff_id|clickid|irclickid|_ga)$/i;function xe(e){try{const t=new URL(e);for(const r of[...t.searchParams.keys()])X.test(r)&&t.searchParams.delete(r);return t.hash="",t.toString()}catch{return String(e||"")}}function qe(e){try{const t=new URL(e),o=[...t.searchParams.entries()].filter(([i])=>!X.test(i)).sort(([i],[a])=>i.localeCompare(a)).map(([i,a])=>`${i}=${a}`).join("&");return`${t.hostname.replace(/^www\./,"").toLowerCase()}${t.pathname.replace(/\/+$/,"")||"/"}${o?`?${o}`:""}`}catch{return String(e||"")}}function ve(e,t=C.passageChars){const r=[];let o="";const i=()=>{const a=o.trim();a.length>=40&&r.push(a),o=""};for(const a of String(e||"").split(/\n\s*\n/)){const s=a.replace(/[ \t]+/g," ").trim();if(s)if(s.length>t){i();let h="";for(const f of s.split(/(?<=[.!?])\s+/))h&&h.length+f.length+1>t&&(o=h,i(),h=""),h=h?`${h} ${f}`:f.slice(0,t);o=h,i()}else o.length+s.length+2>t?(i(),o=s):o=o?`${o}
2
+ ${s}`:s}return i(),r}async function ee(e,t,r,o){const i=new Array(e.length);let a=0;const s=Array.from({length:Math.max(1,Math.min(t,e.length))},async()=>{for(;a<e.length;){const h=a++;try{i[h]=await r(e[h],h)}catch{i[h]=null}}});return await(o?Promise.race([Promise.all(s),o]):Promise.all(s)),i}async function je({ask:e,search:t,read:r=null,rerank:o=null,now:i=()=>Date.now(),until:a=null,limits:s={},onProgress:h=()=>{}}={}){if(!e||typeof t!="function")throw new Error("webResearch: ask and search required");const f={...C,...s},d=i(),l=()=>i()-d>f.ms;let b=!1;const c=a?a.then(()=>{b=!0}):null,q=P(e.domain),E=[],v=[],x=new Map,A=new Set;let u=0,p=null;const m=(S,R)=>{try{h({phase:S,label:R,searches:E.length,pages:x.size,offers:p?.offerCount||0})}catch{}};let k=e.queries.slice(0,f.queries);for(let S=1;S<=f.rounds&&k.length;S++){m("search",`Searching: ${k.map($=>`“${$}”`).join(", ")}`);const R=await ee(k,f.parallel,async $=>ke(await t($)),c);if(k.forEach(($,n)=>{E.push($);const g=R[n];if(!g?.results?.length){u+=1;return}g.engines.forEach(y=>A.add(y));const w=[];g.results.forEach(y=>{const L=qe(y.url);w.push(L);const M=x.get(L),z=String(y.text||y.snippet||"");M?(M.foundBy.push($),z.length>M.text.length&&(M.text=z)):x.set(L,{key:L,url:xe(y.url),title:y.title||y.url,host:le(y.url),text:z,foundBy:[$]})}),v.push(w)}),r&&!b&&!l()){const $=te(v,x,f).filter(n=>n.text.length<400).slice(0,f.read);if($.length){m("read",`Reading ${$.length} page${$.length===1?"":"s"}`);const n=await ee($,f.parallel,g=>r(g.url),c);$.forEach((g,w)=>{const y=n[w],L=typeof y=="string"?y:y?.text;L&&L.length>g.text.length&&(g.text=String(L),y?.title&&(g.title=y.title))})}}if(p=await se({ask:e,d:q,lists:v,pages:x,L:f,rerank:o}),m("decide",Se(p)),p.enough||b||l()||S===f.rounds)break;k=$e(e,E,{now:d})}p||=await se({ask:e,d:q,lists:v,pages:x,L:f,rerank:null});const j={searches:E.length,failed:u,pages:x.size,sites:new Set([...x.values()].map(S=>S.host)).size,engines:[...A],ms:Math.max(0,i()-d)},O={ask:e,queries:E,...p,stats:j};return{...O,text:Ee(O,f)}}function te(e,t,r){const o=new Map,i=[];for(const{id:a}of F(e)){const s=t.get(a);if(!s?.host)continue;const h=o.get(s.host)||0;if(!(h>=r.perHost)&&(o.set(s.host,h+1),i.push(s),i.length>=r.pages))break}return i}async function se({ask:e,d:t,lists:r,pages:o,L:i,rerank:a}){const s=te(r,o,i),h=new Map(s.map((n,g)=>[n.key,g])),f=[e.subject,...Object.values(e.slots||{}),...t.terms],d=t.id!=="product"||Q.test(e.question)||!!e.slots?.budget||/\b(?:cheap|costs?|deals?|quotes?|rates?)\b|[$€£]/i.test(e.question),l=[];for(const n of s)ve(n.text,i.passageChars).forEach((g,w)=>l.push({id:`${n.key}#${w}`,key:n.key,url:n.url,host:n.host,title:n.title,text:g}));const b=`${f.join(" ")}${d?" price cost per month":""}`,c=l.length?ne(oe(l),b).map(n=>n.id):[],q=[...l].sort((n,g)=>h.get(n.key)-h.get(g.key)).map(n=>n.id),E=d?l.filter(n=>/[$€£]\s?\d|\d\s?(?:€|£|USD|EUR|GBP)\b/.test(n.text)).map(n=>n.id):[],v=[c,q,...E.length?[E]:[]];if(typeof a=="function"&&c.length){const n=c.slice(0,40).map(g=>l.find(w=>w.id===g));try{const g=await a(e.question,n.map(w=>w.text));Array.isArray(g)&&g.length===n.length&&v.push(n.map((w,y)=>({id:w.id,s:Number(g[y])||0})).sort((w,y)=>y.s-w.s).map(w=>w.id))}catch{}}const x=new Set(c),A=new Map(l.map(n=>[n.id,n])),u=new Map,p=[];for(const{id:n}of F(v)){if(!x.has(n))continue;const g=A.get(n),w=u.get(g.host)||0;if(!(w>=2)&&(u.set(g.host,w+1),p.push(g),p.length>=i.passages))break}const m=d?ie(s.flatMap(n=>ae(n.text,{url:n.url,title:n.title,terms:f,max:i.offers}))):{basis:"",currency:"",ranked:[],floors:[],other:[],averages:[]},k=[];for(const n of s){const g=t.forms||/\bquote\b/i.test(e.question)?ce(n.text):"";if(g&&!k.some(w=>w.host===n.host)&&k.push({url:n.url,title:n.title,host:n.host,cta:g}),k.length>=i.forms)break}const j=m.ranked.length+m.floors.length,O=new Set([...m.ranked,...m.floors].map(n=>n.host)).size,S=m.ranked.some(n=>n.seenOn>=2),R=new Set(p.map(n=>n.host)).size,$=d?j>=3&&O>=2||S&&m.ranked.length>=2:p.length>=4&&R>=3;return{pages:s,passages:p,offers:m,forms:k,enough:$,offerCount:j,wantPrices:d}}function Se(e){const t=[`${e.pages.length} page${e.pages.length===1?"":"s"}`];return e.wantPrices&&t.push(`${e.offerCount} price${e.offerCount===1?"":"s"}`),e.forms.length&&t.push(`${e.forms.length} quote form${e.forms.length===1?"":"s"}`),t.join(" · ")}const _=(e,t)=>{const r=String(e||"").replace(/\s+/g," ").trim();return r.length>t?`${r.slice(0,t-1)}…`:r};function Ee(e,t={}){const r={...C,...t};if(!e?.pages?.length)return"";const o=new Map,i=u=>(o.has(u.url)||o.set(u.url,{n:o.size+1,title:u.title||u.host||u.url,url:u.url}),o.get(u.url).n),a=u=>`[${i(u)}](${U(u.url)})`,{offers:s,forms:h,passages:f,ask:d,stats:l}=e,b=P(d.domain),c=[];c.push(`(ALREADY RESEARCHED on the web for the question below — ${l.searches} search${l.searches===1?"":"es"}, ${l.pages} page${l.pages===1?"":"s"} from ${l.sites} site${l.sites===1?"":"s"}, ${(l.ms/1e3).toFixed(1)} s. Answer from this and cite with the markdown links given. `+(e.wantPrices?'State ONLY prices listed under "Prices found" — each was read on the linked page — and call a "from" price an advertised minimum, not a quote. ':"")+"Do not repeat these searches; search again only for something this does not cover.)"),c.push(""),c.push(`Question: ${_(d.question,200)}`);const q=b.slots.filter(u=>d.slots?.[u.id]).map(u=>`${u.id} = ${d.slots[u.id]}`);if(c.push(`Looking for: ${d.subject}${b.id!=="product"?` (${b.label})`:""}${q.length?` · known: ${q.join(" · ")}`:""}`),d.missing?.length&&c.push(`Missing for a personalised price: ${d.missing.map(u=>u.label).join("; ")}. Ask the user for these before filling any quote form — say what the prices below are based on meanwhile.`),e.wantPrices){c.push("");const u=s.basis==="month"?"per month":T(s.basis);if(s.ranked.length){c.push(`Prices found (cheapest first, ${u}${s.currency?`, ${s.currency}`:""}):`);const p=[];for(const m of s.ranked){const k=p.find(j=>j.o.currency===m.currency&&Math.round(j.o.value*100)===Math.round(m.value*100));k?k.also.some(j=>j.url===m.url)||k.also.push(m):p.push({o:m,also:[]})}p.slice(0,r.offers).forEach(({o:m,also:k},j)=>{const O=[m,...k].map(a).filter((S,R,$)=>$.indexOf(S)===R).join(" ");c.push(`${j+1}. ${W(m.value,m.currency,s.basis)}${m.converted?` (${m.raw} ${T(m.basis)})`:""} — “${_(m.quote,160)}” ${O}${m.seenOn>1?` · stated by ${m.seenOn} sites`:""}`)})}else c.push("Prices found: none stated plainly on the pages read — do not invent one; say so and offer to get a quote.");s.floors.length&&c.push(`Advertised minimums ("from" — not a quote for this person): ${s.floors.slice(0,4).map(p=>`${W(p.value,p.currency,s.basis)} ${a(p)}`).join(" · ")}`),s.other.length&&c.push(`On another basis or currency (not comparable with the list above): ${s.other.slice(0,4).map(p=>`${p.raw} ${T(p.basis)} ${a(p)}`).join(" · ")}`),s.averages.length&&c.push(`Averages (context, not offers): ${s.averages.slice(0,3).map(p=>`${p.raw} ${T(p.basis)} — “${_(p.quote,100)}” ${a(p)}`).join(" · ")}`)}if(h.length){c.push(""),c.push("Quote forms (an exact price needs the user's details — you can fill these in the user's browser with the page tools, asking them for anything missing; NEVER press a submit/continue/pay button without the user's OK):");for(const u of h)c.push(`- ${u.host}: “${u.cta}” ${a(u)}`)}const E=f.map(u=>`[${i(u)}] ${u.title?`${_(u.title,80)} — `:""}${u.text}`);c.push(""),c.push("Sources:");for(const u of o.values())c.push(`[${u.n}] [${_(u.title,90)}](${U(u.url)})`);let v=c.join(`
3
+ `);const x=r.briefChars-v.length-200;let A="";for(const u of E){if(A.length+u.length+2>x)break;A+=`${A?`
4
+
5
+ `:""}${u}`}return A&&(v+=`
6
+
7
+ ${ue(A,{source:"web search results"})}`),v}function Ae(e,t){return e?.tool==="find"?{tool:"find",input:{action:"web_search",args:{query:t}}}:{tool:e?.tool||"web_search",input:{query:t}}}async function _e(e,{execute:t,read:r=null,rerank:o=null,now:i=()=>Date.now(),until:a=null,onProgress:s=()=>{},limits:h={}}={}){const f=async l=>{const b=Ae(e,l),c=await t(b.tool,b.input,{prefetched:!0,research:!0}),q=typeof c=="string"?c:c?.text;if(!q||/^(?:error\b|\w+ failed\b|\{"error")/i.test(q))throw new Error("search failed");return q},d=await je({ask:e.research,search:f,read:r,rerank:o,now:i,until:a,limits:h,onProgress:s});return{text:d.text,result:d}}export{C as WEB_RESEARCH_LIMITS,B as WEB_TASK_DOMAINS,xe as cleanUrl,qe as pageKey,ke as parseSearchText,ve as passagesOf,$e as refineQueries,Pe as researchAsk,Ee as researchBrief,Ae as researchCall,_e as runResearch,je as webResearch};
@@ -1,5 +1,5 @@
1
- const a="web_search",u='You can call web_search to look up current information from the web — prices, news, recent events, documentation, or anything time-sensitive or that may have changed since your training. Call it whenever the user asks about such things instead of guessing or saying you are unsure. Cite results inline as markdown links — e.g. ([1](https://…)) — never HTML, <sup>, or bare numbers, and finish with a "Sources" list of the links you used.',c=Object.freeze({name:a,annotations:{readOnlyHint:!0,idempotentHint:!0,openWorldHint:!0},description:"Search the web and return ranked result snippets with their source URLs. Use this for current events, live prices/quotes, news, product/library docs, or any fact you are unsure about or that may have changed since training — prefer it over guessing.",parameters:{type:"object",properties:{query:{type:"string",description:"The search query — a few keywords work best."}},required:["query"],additionalProperties:!1}});function l(e){if(!e?.results?.length){const t=(e?.engines||[]).join(", ");return`No web results for "${e?.query||""}"`+(t?` (searched: ${t}).`:".")+" This may mean the engine blocked the request rather than that nothing exists — do NOT conclude the information is unavailable. Try a shorter, more general query (drop dates and qualifiers), and tell the user they can enable another search engine in ChatPanel settings if it keeps failing."}const r=Array.isArray(e.engines)?e.engines:[],o=e.results.map(t=>`[${t.rank}] [${t.title}](${t.url})`).join(`
2
- `),s=e.results[0].url,n=`Web search results for "${e.query}" (engines: ${r.join(", ")}).
1
+ import{markdownUrl as a}from"./citations.js";const u="web_search",c='You can call web_search to look up current information from the web — prices, news, recent events, documentation, or anything time-sensitive or that may have changed since your training. Call it whenever the user asks about such things instead of guessing or saying you are unsure. Cite results inline as markdown links — e.g. ([1](https://…)) — never HTML, <sup>, or bare numbers, and finish with a "Sources" list of the links you used.',l=Object.freeze({name:u,annotations:{readOnlyHint:!0,idempotentHint:!0,openWorldHint:!0},description:"Search the web and return ranked result snippets with their source URLs. Use this for current events, live prices/quotes, news, product/library docs, or any fact you are unsure about or that may have changed since training — prefer it over guessing.",parameters:{type:"object",properties:{query:{type:"string",description:"The search query — a few keywords work best."}},required:["query"],additionalProperties:!1}});function h(e){if(!e?.results?.length){const t=(e?.engines||[]).join(", ");return`No web results for "${e?.query||""}"`+(t?` (searched: ${t}).`:".")+" This may mean the engine blocked the request rather than that nothing exists — do NOT conclude the information is unavailable. Try a shorter, more general query (drop dates and qualifiers), and tell the user they can enable another search engine in ChatPanel settings if it keeps failing."}const r=Array.isArray(e.engines)?e.engines:[],o=e.results.map(t=>`[${t.rank}] [${t.title}](${a(t.url)})`).join(`
2
+ `),s=a(e.results[0].url),n=`Web search results for "${e.query}" (engines: ${r.join(", ")}).
3
3
 
4
4
  Citation rules: when a claim draws on a result below, cite it inline as a markdown link to that result's URL — e.g. ([1](${s})). Cite multiple sources as separate links: ([1](url)) ([3](url)). Do NOT output HTML, <sup>, or bare bracket numbers like [1] — every citation must be a clickable markdown link. Finish with a "Sources" section that repeats, as markdown links, each source you cited.
5
5
 
@@ -16,4 +16,4 @@ ${t.text}`).join(`
16
16
  ---
17
17
  Result details:
18
18
 
19
- ${i}`}function h({search:e}={}){if(typeof e!="function")throw new Error("webSearchToolProvider: search required");return{specs:[c],system:u,async execute(r,o){if(r!==a)return JSON.stringify({error:`Unknown tool: ${r}`});const s=String(o?.query||"").trim();if(!s)return"No query provided to web_search.";try{const n=await e(s),i=(n?.engines||[]).join(", ");return{text:l(n),note:i?`ChatPanel · ${i}`:"ChatPanel"}}catch(n){return`web_search failed: ${n?.message||n}`}}}}export{c as WEB_SEARCH_SPEC,a as WEB_SEARCH_TOOL_NAME,u as WEB_SEARCH_TOOL_SYSTEM,l as searchResultsToText,h as webSearchToolProvider};
19
+ ${i}`}function p({search:e}={}){if(typeof e!="function")throw new Error("webSearchToolProvider: search required");return{specs:[l],system:c,async execute(r,o){if(r!==u)return JSON.stringify({error:`Unknown tool: ${r}`});const s=String(o?.query||"").trim();if(!s)return"No query provided to web_search.";try{const n=await e(s),i=(n?.engines||[]).join(", ");return{text:h(n),note:i?`ChatPanel · ${i}`:"ChatPanel"}}catch(n){return`web_search failed: ${n?.message||n}`}}}}export{l as WEB_SEARCH_SPEC,u as WEB_SEARCH_TOOL_NAME,c as WEB_SEARCH_TOOL_SYSTEM,h as searchResultsToText,p as webSearchToolProvider};