pinecall 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/README.md +134 -0
- package/dist/agent/accepts.d.ts +32 -0
- package/dist/agent/accepts.d.ts.map +1 -0
- package/dist/agent/accepts.js +28 -0
- package/dist/agent/accepts.js.map +1 -0
- package/dist/agent/agent.d.ts +189 -0
- package/dist/agent/agent.d.ts.map +1 -0
- package/dist/agent/agent.js +262 -0
- package/dist/agent/agent.js.map +1 -0
- package/dist/agent/authors.d.ts +12 -0
- package/dist/agent/authors.d.ts.map +1 -0
- package/dist/agent/authors.js +28 -0
- package/dist/agent/authors.js.map +1 -0
- package/dist/agent/decorators.d.ts +22 -0
- package/dist/agent/decorators.d.ts.map +1 -0
- package/dist/agent/decorators.js +49 -0
- package/dist/agent/decorators.js.map +1 -0
- package/dist/agent/docstrings.d.ts +43 -0
- package/dist/agent/docstrings.d.ts.map +1 -0
- package/dist/agent/docstrings.js +311 -0
- package/dist/agent/docstrings.js.map +1 -0
- package/dist/agent/lifecycle.d.ts +29 -0
- package/dist/agent/lifecycle.d.ts.map +1 -0
- package/dist/agent/lifecycle.js +11 -0
- package/dist/agent/lifecycle.js.map +1 -0
- package/dist/agent/stages.d.ts +28 -0
- package/dist/agent/stages.d.ts.map +1 -0
- package/dist/agent/stages.js +32 -0
- package/dist/agent/stages.js.map +1 -0
- package/dist/agent/state.d.ts +43 -0
- package/dist/agent/state.d.ts.map +1 -0
- package/dist/agent/state.js +104 -0
- package/dist/agent/state.js.map +1 -0
- package/dist/agent/tools.d.ts +66 -0
- package/dist/agent/tools.d.ts.map +1 -0
- package/dist/agent/tools.js +148 -0
- package/dist/agent/tools.js.map +1 -0
- package/dist/agent/visibility.d.ts +40 -0
- package/dist/agent/visibility.d.ts.map +1 -0
- package/dist/agent/visibility.js +89 -0
- package/dist/agent/visibility.js.map +1 -0
- package/dist/call/call.d.ts +55 -0
- package/dist/call/call.d.ts.map +1 -0
- package/dist/call/call.js +108 -0
- package/dist/call/call.js.map +1 -0
- package/dist/call/history.d.ts +34 -0
- package/dist/call/history.d.ts.map +1 -0
- package/dist/call/history.js +38 -0
- package/dist/call/history.js.map +1 -0
- package/dist/call/room.d.ts +58 -0
- package/dist/call/room.d.ts.map +1 -0
- package/dist/call/room.js +68 -0
- package/dist/call/room.js.map +1 -0
- package/dist/cli/browser.d.ts +8 -0
- package/dist/cli/browser.d.ts.map +1 -0
- package/dist/cli/browser.js +27 -0
- package/dist/cli/browser.js.map +1 -0
- package/dist/cli/callbacks.d.ts +26 -0
- package/dist/cli/callbacks.d.ts.map +1 -0
- package/dist/cli/callbacks.js +68 -0
- package/dist/cli/callbacks.js.map +1 -0
- package/dist/cli/chat.d.ts +21 -0
- package/dist/cli/chat.d.ts.map +1 -0
- package/dist/cli/chat.js +214 -0
- package/dist/cli/chat.js.map +1 -0
- package/dist/cli/config.d.ts +16 -0
- package/dist/cli/config.d.ts.map +1 -0
- package/dist/cli/config.js +94 -0
- package/dist/cli/config.js.map +1 -0
- package/dist/cli/connected.d.ts +30 -0
- package/dist/cli/connected.d.ts.map +1 -0
- package/dist/cli/connected.js +32 -0
- package/dist/cli/connected.js.map +1 -0
- package/dist/cli/credentials.d.ts +41 -0
- package/dist/cli/credentials.d.ts.map +1 -0
- package/dist/cli/credentials.js +98 -0
- package/dist/cli/credentials.js.map +1 -0
- package/dist/cli/ear.d.ts +3 -0
- package/dist/cli/ear.d.ts.map +1 -0
- package/dist/cli/ear.js +59 -0
- package/dist/cli/ear.js.map +1 -0
- package/dist/cli/env.d.ts +40 -0
- package/dist/cli/env.d.ts.map +1 -0
- package/dist/cli/env.js +45 -0
- package/dist/cli/env.js.map +1 -0
- package/dist/cli/eval.d.ts +37 -0
- package/dist/cli/eval.d.ts.map +1 -0
- package/dist/cli/eval.js +83 -0
- package/dist/cli/eval.js.map +1 -0
- package/dist/cli/groups.d.ts +17 -0
- package/dist/cli/groups.d.ts.map +1 -0
- package/dist/cli/groups.js +38 -0
- package/dist/cli/groups.js.map +1 -0
- package/dist/cli/index.d.ts +16 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +169 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/keys.d.ts +28 -0
- package/dist/cli/keys.d.ts.map +1 -0
- package/dist/cli/keys.js +137 -0
- package/dist/cli/keys.js.map +1 -0
- package/dist/cli/knowledge.d.ts +35 -0
- package/dist/cli/knowledge.d.ts.map +1 -0
- package/dist/cli/knowledge.js +174 -0
- package/dist/cli/knowledge.js.map +1 -0
- package/dist/cli/line.d.ts +33 -0
- package/dist/cli/line.d.ts.map +1 -0
- package/dist/cli/line.js +134 -0
- package/dist/cli/line.js.map +1 -0
- package/dist/cli/listening.d.ts +38 -0
- package/dist/cli/listening.d.ts.map +1 -0
- package/dist/cli/listening.js +124 -0
- package/dist/cli/listening.js.map +1 -0
- package/dist/cli/load.d.ts +38 -0
- package/dist/cli/load.d.ts.map +1 -0
- package/dist/cli/load.js +99 -0
- package/dist/cli/load.js.map +1 -0
- package/dist/cli/login.d.ts +30 -0
- package/dist/cli/login.d.ts.map +1 -0
- package/dist/cli/login.js +158 -0
- package/dist/cli/login.js.map +1 -0
- package/dist/cli/machine.d.ts +8 -0
- package/dist/cli/machine.d.ts.map +1 -0
- package/dist/cli/machine.js +41 -0
- package/dist/cli/machine.js.map +1 -0
- package/dist/cli/memory.d.ts +26 -0
- package/dist/cli/memory.d.ts.map +1 -0
- package/dist/cli/memory.js +148 -0
- package/dist/cli/memory.js.map +1 -0
- package/dist/cli/numbers.d.ts +25 -0
- package/dist/cli/numbers.d.ts.map +1 -0
- package/dist/cli/numbers.js +132 -0
- package/dist/cli/numbers.js.map +1 -0
- package/dist/cli/personas.d.ts +5 -0
- package/dist/cli/personas.d.ts.map +1 -0
- package/dist/cli/personas.js +94 -0
- package/dist/cli/personas.js.map +1 -0
- package/dist/cli/pipeline.d.ts +52 -0
- package/dist/cli/pipeline.d.ts.map +1 -0
- package/dist/cli/pipeline.js +184 -0
- package/dist/cli/pipeline.js.map +1 -0
- package/dist/cli/profiles.d.ts +70 -0
- package/dist/cli/profiles.d.ts.map +1 -0
- package/dist/cli/profiles.js +210 -0
- package/dist/cli/profiles.js.map +1 -0
- package/dist/cli/prompt.d.ts +20 -0
- package/dist/cli/prompt.d.ts.map +1 -0
- package/dist/cli/prompt.js +58 -0
- package/dist/cli/prompt.js.map +1 -0
- package/dist/cli/providers.d.ts +14 -0
- package/dist/cli/providers.d.ts.map +1 -0
- package/dist/cli/providers.js +116 -0
- package/dist/cli/providers.js.map +1 -0
- package/dist/cli/remember.d.ts +29 -0
- package/dist/cli/remember.d.ts.map +1 -0
- package/dist/cli/remember.js +112 -0
- package/dist/cli/remember.js.map +1 -0
- package/dist/cli/run.d.ts +20 -0
- package/dist/cli/run.d.ts.map +1 -0
- package/dist/cli/run.js +347 -0
- package/dist/cli/run.js.map +1 -0
- package/dist/cli/runs/candidate.d.ts +51 -0
- package/dist/cli/runs/candidate.d.ts.map +1 -0
- package/dist/cli/runs/candidate.js +127 -0
- package/dist/cli/runs/candidate.js.map +1 -0
- package/dist/cli/runs/drift.d.ts +75 -0
- package/dist/cli/runs/drift.d.ts.map +1 -0
- package/dist/cli/runs/drift.js +151 -0
- package/dist/cli/runs/drift.js.map +1 -0
- package/dist/cli/runs/index.d.ts +5 -0
- package/dist/cli/runs/index.d.ts.map +1 -0
- package/dist/cli/runs/index.js +99 -0
- package/dist/cli/runs/index.js.map +1 -0
- package/dist/cli/runs/suites.d.ts +16 -0
- package/dist/cli/runs/suites.d.ts.map +1 -0
- package/dist/cli/runs/suites.js +63 -0
- package/dist/cli/runs/suites.js.map +1 -0
- package/dist/cli/secret.d.ts +18 -0
- package/dist/cli/secret.d.ts.map +1 -0
- package/dist/cli/secret.js +41 -0
- package/dist/cli/secret.js.map +1 -0
- package/dist/cli/sessions.d.ts +21 -0
- package/dist/cli/sessions.d.ts.map +1 -0
- package/dist/cli/sessions.js +174 -0
- package/dist/cli/sessions.js.map +1 -0
- package/dist/cli/signup.d.ts +25 -0
- package/dist/cli/signup.d.ts.map +1 -0
- package/dist/cli/signup.js +122 -0
- package/dist/cli/signup.js.map +1 -0
- package/dist/cli/simulate.d.ts +45 -0
- package/dist/cli/simulate.d.ts.map +1 -0
- package/dist/cli/simulate.js +320 -0
- package/dist/cli/simulate.js.map +1 -0
- package/dist/cli/supervise.d.ts +18 -0
- package/dist/cli/supervise.d.ts.map +1 -0
- package/dist/cli/supervise.js +134 -0
- package/dist/cli/supervise.js.map +1 -0
- package/dist/cli/test.d.ts +12 -0
- package/dist/cli/test.d.ts.map +1 -0
- package/dist/cli/test.js +128 -0
- package/dist/cli/test.js.map +1 -0
- package/dist/cli/testing/caller.d.ts +28 -0
- package/dist/cli/testing/caller.d.ts.map +1 -0
- package/dist/cli/testing/caller.js +30 -0
- package/dist/cli/testing/caller.js.map +1 -0
- package/dist/cli/testing/gateway.d.ts +172 -0
- package/dist/cli/testing/gateway.d.ts.map +1 -0
- package/dist/cli/testing/gateway.js +96 -0
- package/dist/cli/testing/gateway.js.map +1 -0
- package/dist/cli/testing/goldens.d.ts +61 -0
- package/dist/cli/testing/goldens.d.ts.map +1 -0
- package/dist/cli/testing/goldens.js +54 -0
- package/dist/cli/testing/goldens.js.map +1 -0
- package/dist/cli/testing/latency.d.ts +15 -0
- package/dist/cli/testing/latency.d.ts.map +1 -0
- package/dist/cli/testing/latency.js +44 -0
- package/dist/cli/testing/latency.js.map +1 -0
- package/dist/cli/testing/matrix.d.ts +12 -0
- package/dist/cli/testing/matrix.d.ts.map +1 -0
- package/dist/cli/testing/matrix.js +103 -0
- package/dist/cli/testing/matrix.js.map +1 -0
- package/dist/cli/testing/progress.d.ts +26 -0
- package/dist/cli/testing/progress.d.ts.map +1 -0
- package/dist/cli/testing/progress.js +185 -0
- package/dist/cli/testing/progress.js.map +1 -0
- package/dist/cli/testing/reproduction.d.ts +19 -0
- package/dist/cli/testing/reproduction.d.ts.map +1 -0
- package/dist/cli/testing/reproduction.js +65 -0
- package/dist/cli/testing/reproduction.js.map +1 -0
- package/dist/cli/testing/score.d.ts +11 -0
- package/dist/cli/testing/score.d.ts.map +1 -0
- package/dist/cli/testing/score.js +54 -0
- package/dist/cli/testing/score.js.map +1 -0
- package/dist/cli/testing/seeding.d.ts +32 -0
- package/dist/cli/testing/seeding.d.ts.map +1 -0
- package/dist/cli/testing/seeding.js +44 -0
- package/dist/cli/testing/seeding.js.map +1 -0
- package/dist/cli/testing/suite.d.ts +40 -0
- package/dist/cli/testing/suite.d.ts.map +1 -0
- package/dist/cli/testing/suite.js +103 -0
- package/dist/cli/testing/suite.js.map +1 -0
- package/dist/cli/testing/voice.d.ts +37 -0
- package/dist/cli/testing/voice.d.ts.map +1 -0
- package/dist/cli/testing/voice.js +53 -0
- package/dist/cli/testing/voice.js.map +1 -0
- package/dist/cli/ui/admin/assets/index-C3WMXdfL.css +1 -0
- package/dist/cli/ui/admin/assets/index-DR1mxoAh.js +58 -0
- package/dist/cli/ui/admin/index.html +20 -0
- package/dist/cli/ui/asked.d.ts +16 -0
- package/dist/cli/ui/asked.d.ts.map +1 -0
- package/dist/cli/ui/asked.js +53 -0
- package/dist/cli/ui/asked.js.map +1 -0
- package/dist/cli/ui/browser.d.ts +10 -0
- package/dist/cli/ui/browser.d.ts.map +1 -0
- package/dist/cli/ui/browser.js +30 -0
- package/dist/cli/ui/browser.js.map +1 -0
- package/dist/cli/ui/chatting.d.ts +62 -0
- package/dist/cli/ui/chatting.d.ts.map +1 -0
- package/dist/cli/ui/chatting.js +171 -0
- package/dist/cli/ui/chatting.js.map +1 -0
- package/dist/cli/ui/console/assets/index-DCTnou52.css +1 -0
- package/dist/cli/ui/console/assets/index-dOcE4usU.js +99 -0
- package/dist/cli/ui/console/index.html +20 -0
- package/dist/cli/ui/console/logo-mark.png +0 -0
- package/dist/cli/ui/doors.d.ts +37 -0
- package/dist/cli/ui/doors.d.ts.map +1 -0
- package/dist/cli/ui/doors.js +70 -0
- package/dist/cli/ui/doors.js.map +1 -0
- package/dist/cli/ui/drifting.d.ts +23 -0
- package/dist/cli/ui/drifting.d.ts.map +1 -0
- package/dist/cli/ui/drifting.js +33 -0
- package/dist/cli/ui/drifting.js.map +1 -0
- package/dist/cli/ui/index.d.ts +15 -0
- package/dist/cli/ui/index.d.ts.map +1 -0
- package/dist/cli/ui/index.js +117 -0
- package/dist/cli/ui/index.js.map +1 -0
- package/dist/cli/ui/knowing.d.ts +36 -0
- package/dist/cli/ui/knowing.d.ts.map +1 -0
- package/dist/cli/ui/knowing.js +86 -0
- package/dist/cli/ui/knowing.js.map +1 -0
- package/dist/cli/ui/promoting.d.ts +26 -0
- package/dist/cli/ui/promoting.d.ts.map +1 -0
- package/dist/cli/ui/promoting.js +44 -0
- package/dist/cli/ui/promoting.js.map +1 -0
- package/dist/cli/ui/refusal.d.ts +18 -0
- package/dist/cli/ui/refusal.d.ts.map +1 -0
- package/dist/cli/ui/refusal.js +26 -0
- package/dist/cli/ui/refusal.js.map +1 -0
- package/dist/cli/ui/refused.d.ts +8 -0
- package/dist/cli/ui/refused.d.ts.map +1 -0
- package/dist/cli/ui/refused.js +11 -0
- package/dist/cli/ui/refused.js.map +1 -0
- package/dist/cli/ui/remembering.d.ts +38 -0
- package/dist/cli/ui/remembering.d.ts.map +1 -0
- package/dist/cli/ui/remembering.js +87 -0
- package/dist/cli/ui/remembering.js.map +1 -0
- package/dist/cli/ui/reproducing.d.ts +23 -0
- package/dist/cli/ui/reproducing.d.ts.map +1 -0
- package/dist/cli/ui/reproducing.js +52 -0
- package/dist/cli/ui/reproducing.js.map +1 -0
- package/dist/cli/ui/server.d.ts +22 -0
- package/dist/cli/ui/server.d.ts.map +1 -0
- package/dist/cli/ui/server.js +211 -0
- package/dist/cli/ui/server.js.map +1 -0
- package/dist/cli/ui/simulating.d.ts +47 -0
- package/dist/cli/ui/simulating.d.ts.map +1 -0
- package/dist/cli/ui/simulating.js +86 -0
- package/dist/cli/ui/simulating.js.map +1 -0
- package/dist/cli/ui/testing.d.ts +49 -0
- package/dist/cli/ui/testing.d.ts.map +1 -0
- package/dist/cli/ui/testing.js +104 -0
- package/dist/cli/ui/testing.js.map +1 -0
- package/dist/cli/view.d.ts +43 -0
- package/dist/cli/view.d.ts.map +1 -0
- package/dist/cli/view.js +137 -0
- package/dist/cli/view.js.map +1 -0
- package/dist/cli/whoami.d.ts +37 -0
- package/dist/cli/whoami.d.ts.map +1 -0
- package/dist/cli/whoami.js +78 -0
- package/dist/cli/whoami.js.map +1 -0
- package/dist/cli/world.d.ts +33 -0
- package/dist/cli/world.d.ts.map +1 -0
- package/dist/cli/world.js +48 -0
- package/dist/cli/world.js.map +1 -0
- package/dist/client/agent.d.ts +87 -0
- package/dist/client/agent.d.ts.map +1 -0
- package/dist/client/agent.js +209 -0
- package/dist/client/agent.js.map +1 -0
- package/dist/client/calls.d.ts +77 -0
- package/dist/client/calls.d.ts.map +1 -0
- package/dist/client/calls.js +153 -0
- package/dist/client/calls.js.map +1 -0
- package/dist/client/client.d.ts +58 -0
- package/dist/client/client.d.ts.map +1 -0
- package/dist/client/client.js +146 -0
- package/dist/client/client.js.map +1 -0
- package/dist/client/connection.d.ts +47 -0
- package/dist/client/connection.d.ts.map +1 -0
- package/dist/client/connection.js +141 -0
- package/dist/client/connection.js.map +1 -0
- package/dist/client/endpoints.d.ts +7 -0
- package/dist/client/endpoints.d.ts.map +1 -0
- package/dist/client/endpoints.js +21 -0
- package/dist/client/endpoints.js.map +1 -0
- package/dist/client/frames.d.ts +24 -0
- package/dist/client/frames.d.ts.map +1 -0
- package/dist/client/frames.js +49 -0
- package/dist/client/frames.js.map +1 -0
- package/dist/client/index.d.ts +15 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +14 -0
- package/dist/client/index.js.map +1 -0
- package/dist/client/listeners.d.ts +36 -0
- package/dist/client/listeners.d.ts.map +1 -0
- package/dist/client/listeners.js +61 -0
- package/dist/client/listeners.js.map +1 -0
- package/dist/client/observe.d.ts +44 -0
- package/dist/client/observe.d.ts.map +1 -0
- package/dist/client/observe.js +122 -0
- package/dist/client/observe.js.map +1 -0
- package/dist/client/testing/gateway.d.ts +39 -0
- package/dist/client/testing/gateway.d.ts.map +1 -0
- package/dist/client/testing/gateway.js +129 -0
- package/dist/client/testing/gateway.js.map +1 -0
- package/dist/client/testing/index.d.ts +4 -0
- package/dist/client/testing/index.d.ts.map +1 -0
- package/dist/client/testing/index.js +4 -0
- package/dist/client/testing/index.js.map +1 -0
- package/dist/client/testing/log.d.ts +26 -0
- package/dist/client/testing/log.d.ts.map +1 -0
- package/dist/client/testing/log.js +111 -0
- package/dist/client/testing/log.js.map +1 -0
- package/dist/client/testing/loopback.d.ts +3 -0
- package/dist/client/testing/loopback.d.ts.map +1 -0
- package/dist/client/testing/loopback.js +3 -0
- package/dist/client/testing/loopback.js.map +1 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +35 -0
- package/dist/index.js.map +1 -0
- package/dist/runtime/channels.d.ts +16 -0
- package/dist/runtime/channels.d.ts.map +1 -0
- package/dist/runtime/channels.js +30 -0
- package/dist/runtime/channels.js.map +1 -0
- package/dist/runtime/connect.d.ts +51 -0
- package/dist/runtime/connect.d.ts.map +1 -0
- package/dist/runtime/connect.js +284 -0
- package/dist/runtime/connect.js.map +1 -0
- package/dist/runtime/dispatch.d.ts +37 -0
- package/dist/runtime/dispatch.d.ts.map +1 -0
- package/dist/runtime/dispatch.js +52 -0
- package/dist/runtime/dispatch.js.map +1 -0
- package/dist/runtime/grounding.d.ts +15 -0
- package/dist/runtime/grounding.d.ts.map +1 -0
- package/dist/runtime/grounding.js +72 -0
- package/dist/runtime/grounding.js.map +1 -0
- package/dist/runtime/recall.d.ts +10 -0
- package/dist/runtime/recall.d.ts.map +1 -0
- package/dist/runtime/recall.js +13 -0
- package/dist/runtime/recall.js.map +1 -0
- package/dist/runtime/run-tool.d.ts +26 -0
- package/dist/runtime/run-tool.d.ts.map +1 -0
- package/dist/runtime/run-tool.js +82 -0
- package/dist/runtime/run-tool.js.map +1 -0
- package/dist/views/components.d.ts +17 -0
- package/dist/views/components.d.ts.map +1 -0
- package/dist/views/components.js +33 -0
- package/dist/views/components.js.map +1 -0
- package/dist/views/jsx-dev-runtime.d.ts +3 -0
- package/dist/views/jsx-dev-runtime.d.ts.map +1 -0
- package/dist/views/jsx-dev-runtime.js +5 -0
- package/dist/views/jsx-dev-runtime.js.map +1 -0
- package/dist/views/jsx-runtime.d.ts +49 -0
- package/dist/views/jsx-runtime.d.ts.map +1 -0
- package/dist/views/jsx-runtime.js +67 -0
- package/dist/views/jsx-runtime.js.map +1 -0
- package/dist/views/lang.d.ts +17 -0
- package/dist/views/lang.d.ts.map +1 -0
- package/dist/views/lang.js +46 -0
- package/dist/views/lang.js.map +1 -0
- package/dist/views/layout.d.ts +19 -0
- package/dist/views/layout.d.ts.map +1 -0
- package/dist/views/layout.js +62 -0
- package/dist/views/layout.js.map +1 -0
- package/dist/views/render.d.ts +19 -0
- package/dist/views/render.d.ts.map +1 -0
- package/dist/views/render.js +26 -0
- package/dist/views/render.js.map +1 -0
- package/package.json +76 -0
- package/tsconfig.tenant.json +24 -0
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
/** `pinecall simulate --persona x`: a model plays the caller, and the call is judged at hang-up. */
|
|
2
|
+
import { parseArgs } from "node:util";
|
|
3
|
+
import { Pinecall } from "../client/index.js";
|
|
4
|
+
import WebSocket from "ws";
|
|
5
|
+
import { mount } from "../runtime/connect.js";
|
|
6
|
+
import { chatUrl } from "./chat.js";
|
|
7
|
+
import { theDoor } from "./env.js";
|
|
8
|
+
import { anEarIn } from "./listening.js";
|
|
9
|
+
import { load, mountOptions } from "./load.js";
|
|
10
|
+
import { NO_PERSONAS, personaNamed } from "./testing/caller.js";
|
|
11
|
+
import { entriesOf, theNextLine } from "./testing/gateway.js";
|
|
12
|
+
import { latencyLine, mediansOf } from "./testing/latency.js";
|
|
13
|
+
import { linesOfScore } from "./testing/score.js";
|
|
14
|
+
import { aCallId, aVoiceCall, DEGRADED, watching } from "./testing/voice.js";
|
|
15
|
+
import { lineFor, metricsLine } from "./view.js";
|
|
16
|
+
const USAGE = "usage: pinecall simulate --persona <name> [--judge] [--turns n] [--voice] [--listen]\n" +
|
|
17
|
+
" [--background-noise <dB under the caller>] [--packet-loss <percent>] [--file agent.tsx]\n";
|
|
18
|
+
export const group = {
|
|
19
|
+
purpose: "a model plays one persona against the agent, live, and the call is scored at hang-up",
|
|
20
|
+
usage: `${USAGE}
|
|
21
|
+
A model in the gateway plays the caller: every turn improvised from the persona's goal, its
|
|
22
|
+
style and its own facts — there is no script. This terminal holds the class and the transcript;
|
|
23
|
+
the gateway holds the provider keys. The call lands in the log like any other.
|
|
24
|
+
|
|
25
|
+
--persona <name> a file of test/personas, by its name
|
|
26
|
+
--judge read back the call.score the log seals on, and print every judge
|
|
27
|
+
--turns n how many turns the caller improvises before hanging up (default 6)
|
|
28
|
+
--voice a real line: a room, the persona's own voice, the box's speech
|
|
29
|
+
--listen the call on this machine's speakers while it happens; turns --voice on
|
|
30
|
+
--background-noise dB under the caller: a television behind them. Spoken runs only
|
|
31
|
+
--packet-loss percent of the caller's packets that never arrive. Spoken runs only
|
|
32
|
+
--file agent.tsx which class to mount, when the directory holds more than one`,
|
|
33
|
+
run,
|
|
34
|
+
};
|
|
35
|
+
// Hearing a call means a call with audio in it, so the flag turns the line on rather than refusing
|
|
36
|
+
// a person who asked to listen to a written one. Said out loud, because it changes what is run.
|
|
37
|
+
const LISTEN_IS_A_LINE = "--listen is a call with audio in it: --voice is on";
|
|
38
|
+
// A spoiled line is a property of audio: there is nothing to mix into a written turn, and a flag
|
|
39
|
+
// that quietly did nothing would be a run reporting a noisy line it never had.
|
|
40
|
+
export const ONLY_ON_A_LINE = "--background-noise and --packet-loss are about audio: add --voice";
|
|
41
|
+
/**
|
|
42
|
+
* How many turns a caller improvises when nobody said. Six is the length of the walkthrough the
|
|
43
|
+
* examples are written against, and long enough for a booking to reach its confirmation.
|
|
44
|
+
*/
|
|
45
|
+
export const TURNS = 6;
|
|
46
|
+
// How long a written call is left quiet before the caller says the next thing. The app answers
|
|
47
|
+
// `call.started` with a render and a tool may run after the reply, so a turn is over when nothing
|
|
48
|
+
// has been written for a moment — the same silence the gateway's own runner waits for.
|
|
49
|
+
const SETTLE_MS = 400;
|
|
50
|
+
// And how long one turn may take before the simulation gives up on it. A tenant's tool that awaits
|
|
51
|
+
// something for ever must not leave a person watching a prompt that never returns.
|
|
52
|
+
const A_TURN_MAY_TAKE_MS = 30_000;
|
|
53
|
+
// The log seals on `call.score`, which is written after the caller has gone — so it is read back
|
|
54
|
+
// rather than heard, and this is how long the judges are given before the terminal gives up.
|
|
55
|
+
const JUDGING_MAY_TAKE_MS = 60_000;
|
|
56
|
+
const TERMINAL_ENTRY = "call.score";
|
|
57
|
+
// `sessions` is a group of the runtime's CLI, not of this one: pointing a person at `pinecall
|
|
58
|
+
// sessions show` sends them to a stub that prints "not built yet" and nothing else.
|
|
59
|
+
const notSealed = (call) => `no ${TERMINAL_ENTRY} within ${JUDGING_MAY_TAKE_MS / 1000}s: read the call with ` +
|
|
60
|
+
`\`pinecall sessions ${call}\`, or the console → Sessions`;
|
|
61
|
+
export async function run(argv, out = process.stdout) {
|
|
62
|
+
const { values } = parseArgs({
|
|
63
|
+
args: argv,
|
|
64
|
+
options: {
|
|
65
|
+
persona: { type: "string" },
|
|
66
|
+
judge: { type: "boolean", default: false },
|
|
67
|
+
listen: { type: "boolean", default: false },
|
|
68
|
+
voice: { type: "boolean", default: false },
|
|
69
|
+
"background-noise": { type: "string" },
|
|
70
|
+
"packet-loss": { type: "string" },
|
|
71
|
+
turns: { type: "string" },
|
|
72
|
+
file: { type: "string" },
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
const listen = values.listen === true;
|
|
76
|
+
const voice = values.voice === true || listen;
|
|
77
|
+
if (listen && values.voice !== true)
|
|
78
|
+
out.write(`${LISTEN_IS_A_LINE}\n`);
|
|
79
|
+
if (values.persona === undefined) {
|
|
80
|
+
process.stderr.write(USAGE);
|
|
81
|
+
return 2;
|
|
82
|
+
}
|
|
83
|
+
const degraded = degradedBy(values["background-noise"], values["packet-loss"]);
|
|
84
|
+
if (!voice && degraded !== undefined) {
|
|
85
|
+
process.stderr.write(`${ONLY_ON_A_LINE}\n`);
|
|
86
|
+
return 2;
|
|
87
|
+
}
|
|
88
|
+
const persona = await personaNamed(values.persona);
|
|
89
|
+
if (persona === undefined) {
|
|
90
|
+
process.stderr.write(`no persona called ${values.persona}: ${NO_PERSONAS}\n`);
|
|
91
|
+
return 2;
|
|
92
|
+
}
|
|
93
|
+
const said = await aSimulation(persona, {
|
|
94
|
+
agentFile: values.file,
|
|
95
|
+
judge: values.judge === true,
|
|
96
|
+
voice,
|
|
97
|
+
listen,
|
|
98
|
+
...(degraded === undefined ? {} : { degraded }),
|
|
99
|
+
turns: values.turns === undefined ? TURNS : Number(values.turns),
|
|
100
|
+
out,
|
|
101
|
+
});
|
|
102
|
+
return exitCodeOf(said);
|
|
103
|
+
}
|
|
104
|
+
/** How the line is to be spoiled, when it is: a level in dB, and a share of packets lost. */
|
|
105
|
+
export function degradedBy(noise, loss) {
|
|
106
|
+
if (noise === undefined && loss === undefined)
|
|
107
|
+
return undefined;
|
|
108
|
+
return {
|
|
109
|
+
interferer_db: noise === undefined || noise === "" ? DEGRADED.interferer_db : Number(noise),
|
|
110
|
+
packet_loss: loss === undefined || loss === "" ? DEGRADED.packet_loss : Number(loss) / 100,
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
// A call nobody could open is a failure of this command; a call a judge answered `broken` about is
|
|
114
|
+
// a failure of the agent. A call NOBODY judged is neither — and it does not exit zero either,
|
|
115
|
+
// because an exit code is a gate and "nobody looked at this" must not open one. The three states
|
|
116
|
+
// are told apart on the screen, where a verdict belongs — the runtime's docs/decisions/scoring.md.
|
|
117
|
+
export function exitCodeOf(said) {
|
|
118
|
+
if (said === undefined)
|
|
119
|
+
return 2;
|
|
120
|
+
if (said.score === undefined)
|
|
121
|
+
return 0;
|
|
122
|
+
return said.score.passed === true ? 0 : 1;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* The class is mounted in THIS process, as `chat` and `test` mount it, and a model in the runtime
|
|
126
|
+
* plays the caller: this terminal holds the persona and the transcript, the gateway holds the
|
|
127
|
+
* provider keys. Every turn is improvised from the goal, the style and the persona's own facts,
|
|
128
|
+
* and with `judge` the `call.score` the log seals on is read back and printed.
|
|
129
|
+
*/
|
|
130
|
+
export async function aSimulation(persona, how) {
|
|
131
|
+
const door = how.door ?? theDoor();
|
|
132
|
+
if (door === undefined)
|
|
133
|
+
return undefined;
|
|
134
|
+
const loaded = await load(how.agentFile);
|
|
135
|
+
const url = door.url;
|
|
136
|
+
const pc = new Pinecall({ url, apiKey: door.apiKey });
|
|
137
|
+
// A written call names this app in its own socket URL, so the terminal takes nothing it did not
|
|
138
|
+
// open. A spoken one arrives through the worker, which names no app (worker/entry.py:82) — so a
|
|
139
|
+
// `--voice` run has to be willing to serve the call the runtime opens for it, which is exactly
|
|
140
|
+
// the posture `pinecall run` has, and the gateway refuses the job otherwise.
|
|
141
|
+
const mounted = mount(loaded.ctor, {
|
|
142
|
+
...mountOptions(loaded, pc),
|
|
143
|
+
takesUnclaimed: how.voice,
|
|
144
|
+
opening: () => persona.state,
|
|
145
|
+
});
|
|
146
|
+
how.out.write(`${persona.name} · ${persona.goal}\n`);
|
|
147
|
+
try {
|
|
148
|
+
await pc.connect();
|
|
149
|
+
const call = how.voice
|
|
150
|
+
? await outLoud(door, mounted.slug, persona, how)
|
|
151
|
+
: await inWriting(chatUrl(url, mounted.slug, mounted.agent.app), door.apiKey, door, persona, how);
|
|
152
|
+
return { call, ...(await theEnding(door, call, how)) };
|
|
153
|
+
}
|
|
154
|
+
finally {
|
|
155
|
+
pc.close();
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
// The written door: one socket, the improvised lines down it one at a time, the log up it as it
|
|
159
|
+
// happens. Closing the socket is the hangup, and the hangup is what writes the score.
|
|
160
|
+
async function inWriting(socketUrl, apiKey, door, persona, how) {
|
|
161
|
+
const socket = new WebSocket(socketUrl, { headers: { authorization: `Bearer ${apiKey}` } });
|
|
162
|
+
const heard = new Heard(how.out, how.opened);
|
|
163
|
+
socket.on("message", (frame) => heard.absorb(JSON.parse(frame.toString())));
|
|
164
|
+
await once(socket, "open");
|
|
165
|
+
await heard.quiet();
|
|
166
|
+
for (let turn = 0; turn < how.turns; turn += 1) {
|
|
167
|
+
const next = await theNextLine(door, {
|
|
168
|
+
persona: callingAs(persona),
|
|
169
|
+
heard: heard.said,
|
|
170
|
+
turns_left: how.turns - turn,
|
|
171
|
+
});
|
|
172
|
+
if (next.say === "")
|
|
173
|
+
break;
|
|
174
|
+
const before = heard.agentTurns;
|
|
175
|
+
socket.send(JSON.stringify({ text: next.say }));
|
|
176
|
+
await heard.answered(before);
|
|
177
|
+
if (next.hangup)
|
|
178
|
+
break;
|
|
179
|
+
}
|
|
180
|
+
socket.close();
|
|
181
|
+
how.out.write(` ${heard.call ?? "no call"} · ${heard.agentTurns} agent turn(s)\n`);
|
|
182
|
+
return heard.call ?? "";
|
|
183
|
+
}
|
|
184
|
+
// The spoken door: a room, the agent dispatched into it, and the persona's own voice on a line
|
|
185
|
+
// that may be spoiled on purpose. The whole call is held in the runtime, where the LiveKit pair
|
|
186
|
+
// and the box's speech tool are; this side mints the id and watches the log while it happens.
|
|
187
|
+
async function outLoud(door, slug, persona, how) {
|
|
188
|
+
const call = aCallId();
|
|
189
|
+
how.opened?.(call);
|
|
190
|
+
const heard = new Heard(how.out);
|
|
191
|
+
// The ear is taken before the call is asked for: the seat is minted off the room, which opens a
|
|
192
|
+
// moment later, and joining late is joining after the greeting — the one turn worth hearing.
|
|
193
|
+
const ear = how.listen === true ? listening(door, call, how.out) : null;
|
|
194
|
+
const held = aVoiceCall(door, {
|
|
195
|
+
call,
|
|
196
|
+
agent: slug,
|
|
197
|
+
persona: callingAs(persona),
|
|
198
|
+
turns: how.turns,
|
|
199
|
+
...(how.degraded === undefined ? {} : { degraded: how.degraded }),
|
|
200
|
+
});
|
|
201
|
+
await watching(door, call, held, (entry) => heard.absorb(entry));
|
|
202
|
+
const called = await held;
|
|
203
|
+
await (await ear)?.leave();
|
|
204
|
+
how.out.write(` ${call} · ${called.turns} caller turn(s) · ${heard.agentTurns} agent turn(s) · ${called.line}\n`);
|
|
205
|
+
return call;
|
|
206
|
+
}
|
|
207
|
+
// An ear that could not be taken is a line printed and a call that still happens: a machine with
|
|
208
|
+
// no player, or without the optional room library, must not lose the simulation over it.
|
|
209
|
+
async function listening(door, call, out) {
|
|
210
|
+
try {
|
|
211
|
+
return await anEarIn(door, call, out);
|
|
212
|
+
}
|
|
213
|
+
catch (failed) {
|
|
214
|
+
out.write(` not listening: ${failed instanceof Error ? failed.message : String(failed)}\n`);
|
|
215
|
+
return null;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
/** The persona as the runtime's two doors take it: three declarations, and no script at all. */
|
|
219
|
+
function callingAs(persona) {
|
|
220
|
+
return {
|
|
221
|
+
name: persona.name,
|
|
222
|
+
goal: persona.goal,
|
|
223
|
+
style: persona.style,
|
|
224
|
+
...(persona.facts === undefined ? {} : { facts: persona.facts }),
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
// What is read back off the call's own log once the caller has gone: the latencies livekit
|
|
228
|
+
// measured for every turn, and — when somebody asked for it — the `call.score` the log seals on.
|
|
229
|
+
// Nothing here computes a metric the log does not already carry.
|
|
230
|
+
async function theEnding(door, call, how) {
|
|
231
|
+
if (call === "")
|
|
232
|
+
return {};
|
|
233
|
+
const measured = latencyLine(mediansOf(await entriesOf(door, call)));
|
|
234
|
+
how.out.write(` ${measured === "" ? "no metrics on this call" : measured}\n`);
|
|
235
|
+
return { score: how.judge ? await theScore(door, call, how.out) : undefined };
|
|
236
|
+
}
|
|
237
|
+
// The judges take as long as they take; nothing here hurries them, and a call that never sealed
|
|
238
|
+
// says so instead of printing a verdict nobody wrote.
|
|
239
|
+
async function theScore(door, call, out) {
|
|
240
|
+
const deadline = Date.now() + JUDGING_MAY_TAKE_MS;
|
|
241
|
+
while (Date.now() < deadline) {
|
|
242
|
+
const sealed = await sealing(door, call);
|
|
243
|
+
if (sealed !== undefined) {
|
|
244
|
+
out.write(`${linesOfScore(sealed).join("\n")}\n`);
|
|
245
|
+
return sealed;
|
|
246
|
+
}
|
|
247
|
+
await after(SETTLE_MS);
|
|
248
|
+
}
|
|
249
|
+
out.write(`${notSealed(call)}\n`);
|
|
250
|
+
return undefined;
|
|
251
|
+
}
|
|
252
|
+
/** The entry the log seals on, when it is there yet. A log still being written has none. */
|
|
253
|
+
async function sealing(door, call) {
|
|
254
|
+
const sealed = (await entriesOf(door, call)).find((entry) => entry.type === TERMINAL_ENTRY);
|
|
255
|
+
return sealed === undefined ? undefined : sealed.data;
|
|
256
|
+
}
|
|
257
|
+
// The call's log as this terminal hears it: printed as it lands, and quiet when the app has
|
|
258
|
+
// finished reacting. Everything the simulation knows about where the call is, it knows from here —
|
|
259
|
+
// including the transcript the caller model is handed, which is the log's own turns and not a
|
|
260
|
+
// second copy this process kept.
|
|
261
|
+
class Heard {
|
|
262
|
+
out;
|
|
263
|
+
opened;
|
|
264
|
+
call;
|
|
265
|
+
agentTurns = 0;
|
|
266
|
+
said = [];
|
|
267
|
+
last = Date.now();
|
|
268
|
+
constructor(out, opened) {
|
|
269
|
+
this.out = out;
|
|
270
|
+
this.opened = opened;
|
|
271
|
+
}
|
|
272
|
+
/** One entry: remembered, and printed when it is a line of the conversation rather than wiring. */
|
|
273
|
+
absorb(entry) {
|
|
274
|
+
this.last = Date.now();
|
|
275
|
+
if (typeof entry.call === "string" && this.call === undefined) {
|
|
276
|
+
this.call = entry.call;
|
|
277
|
+
this.opened?.(entry.call);
|
|
278
|
+
}
|
|
279
|
+
if (entry.type === "turn.agent")
|
|
280
|
+
this.agentTurns += 1;
|
|
281
|
+
if (entry.type === "turn.user" || entry.type === "turn.agent") {
|
|
282
|
+
this.said.push({
|
|
283
|
+
who: entry.type === "turn.agent" ? "agent" : "caller",
|
|
284
|
+
said: String(entry.data["text"] ?? ""),
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
// Both sides are printed off the log and never off what this process sent: on a spoken call
|
|
288
|
+
// the caller's own turn is what the STT heard, which is the line that matters.
|
|
289
|
+
const line = lineFor(entry);
|
|
290
|
+
if (line === null)
|
|
291
|
+
return;
|
|
292
|
+
const metrics = entry.type === "turn.agent"
|
|
293
|
+
? ` ${metricsLine(entry.data["metrics"])}`
|
|
294
|
+
: "";
|
|
295
|
+
this.out.write(`${line.mark} ${line.text}${metrics}\n`);
|
|
296
|
+
}
|
|
297
|
+
/** Waits until the agent has spoken again, and then until the app has finished reacting. */
|
|
298
|
+
async answered(said) {
|
|
299
|
+
const deadline = Date.now() + A_TURN_MAY_TAKE_MS;
|
|
300
|
+
while (this.agentTurns === said && Date.now() < deadline)
|
|
301
|
+
await after(SETTLE_MS / 4);
|
|
302
|
+
await this.quiet();
|
|
303
|
+
}
|
|
304
|
+
/** Waits until nothing has been written for a moment: the app has answered and re-rendered. */
|
|
305
|
+
async quiet() {
|
|
306
|
+
const deadline = Date.now() + A_TURN_MAY_TAKE_MS;
|
|
307
|
+
while (Date.now() - this.last < SETTLE_MS && Date.now() < deadline)
|
|
308
|
+
await after(SETTLE_MS / 4);
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
function after(ms) {
|
|
312
|
+
return new Promise((wake) => setTimeout(wake, ms));
|
|
313
|
+
}
|
|
314
|
+
function once(socket, event) {
|
|
315
|
+
return new Promise((done, failed) => {
|
|
316
|
+
socket.on(event, () => done());
|
|
317
|
+
socket.on("error", failed);
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
//# sourceMappingURL=simulate.js.map
|
|
@@ -0,0 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AAC;AACL,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** `pinecall supervise <call>`: a human at the desk — the transcript as it lands, and the five moves. */
|
|
2
|
+
import type { Verb } from "@pinecall/protocol";
|
|
3
|
+
import type { Group } from "./groups.js";
|
|
4
|
+
export declare const ON_THE_SPEAKERS = "the audio of a live call is the console, which has a room \u2014 `pinecall run` prints its URL; this is the transcript and the desk";
|
|
5
|
+
/** What a supervisor may type, one move per line. `q` leaves and the call goes on without them. */
|
|
6
|
+
export declare const MOVES: readonly [readonly ["w <text>", "whisper to the agent — the caller never hears it"], readonly ["s <text>", "say it to the caller, in the agent's voice, verbatim"], readonly ["t", "take the line: the agent stops speaking and you are on it"], readonly ["x", "give it back: the agent has the line again"], readonly ["e [reason]", "end the call"], readonly ["q", "leave the desk; the call goes on"]];
|
|
7
|
+
export declare const group: Group;
|
|
8
|
+
/** What the verb can be told besides the argv: where to print, and which environment. Tests only. */
|
|
9
|
+
export interface Running {
|
|
10
|
+
out?: NodeJS.WritableStream;
|
|
11
|
+
err?: NodeJS.WritableStream;
|
|
12
|
+
env?: NodeJS.ProcessEnv;
|
|
13
|
+
}
|
|
14
|
+
export declare function run(argv: string[], how?: Running): Promise<number>;
|
|
15
|
+
/** One typed line as the verb it names, `leave` for q, and nothing at all for a line nobody meant. */
|
|
16
|
+
export declare function moveOf(typed: string): Verb | "leave" | null;
|
|
17
|
+
export declare function lineOf(seq: number, type: string, data: Record<string, unknown>): string | null;
|
|
18
|
+
//# sourceMappingURL=supervise.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"supervise.d.ts","sourceRoot":"","sources":["../../src/cli/supervise.ts"],"names":[],"mappings":"AAAA,yGAAyG;AAIzG,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAK/C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AASzC,eAAO,MAAM,eAAe,wIACsG,CAAC;AAEnI,mGAAmG;AACnG,eAAO,MAAM,KAAK,sBACf,UAAU,EAAE,kDAAkD,aAC9D,UAAU,EAAE,sDAAsD,aAClE,GAAG,EAAE,2DAA2D,aAChE,GAAG,EAAE,4CAA4C,aACjD,YAAY,EAAE,cAAc,aAC5B,GAAG,EAAE,kCAAkC,EAChC,CAAC;AAEX,eAAO,MAAM,KAAK,EAAE,KAWnB,CAAC;AAEF,qGAAqG;AACrG,MAAM,WAAW,OAAO;IACtB,GAAG,CAAC,EAAE,MAAM,CAAC,cAAc,CAAC;IAC5B,GAAG,CAAC,EAAE,MAAM,CAAC,cAAc,CAAC;IAC5B,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;CACzB;AAED,wBAAsB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,GAAE,OAAY,GAAG,OAAO,CAAC,MAAM,CAAC,CAkB5E;AA0CD,sGAAsG;AACtG,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,GAAG,IAAI,CAW3D;AASD,wBAAgB,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,GAAG,IAAI,CAW9F"}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/** `pinecall supervise <call>`: a human at the desk — the transcript as it lands, and the five moves. */
|
|
2
|
+
import { createInterface } from "node:readline";
|
|
3
|
+
import { Pinecall } from "../client/index.js";
|
|
4
|
+
import { theDoor } from "./env.js";
|
|
5
|
+
import { asked } from "./testing/gateway.js";
|
|
6
|
+
import { refusal } from "./whoami.js";
|
|
7
|
+
const USAGE = "usage: pinecall supervise <call>";
|
|
8
|
+
// The audio is the console's, deliberately: a terminal has no speakers this process may reach, and
|
|
9
|
+
// `pinecall simulate --listen` already says the same sentence about the same room. What a terminal
|
|
10
|
+
// CAN do is the transcript and the desk, which is what this verb is.
|
|
11
|
+
export const ON_THE_SPEAKERS = "the audio of a live call is the console, which has a room — `pinecall run` prints its URL; this is the transcript and the desk";
|
|
12
|
+
/** What a supervisor may type, one move per line. `q` leaves and the call goes on without them. */
|
|
13
|
+
export const MOVES = [
|
|
14
|
+
["w <text>", "whisper to the agent — the caller never hears it"],
|
|
15
|
+
["s <text>", "say it to the caller, in the agent's voice, verbatim"],
|
|
16
|
+
["t", "take the line: the agent stops speaking and you are on it"],
|
|
17
|
+
["x", "give it back: the agent has the line again"],
|
|
18
|
+
["e [reason]", "end the call"],
|
|
19
|
+
["q", "leave the desk; the call goes on"],
|
|
20
|
+
];
|
|
21
|
+
export const group = {
|
|
22
|
+
purpose: "listen in: whisper, say, takeover, transfer, end",
|
|
23
|
+
usage: `${USAGE}
|
|
24
|
+
|
|
25
|
+
The call's transcript as it happens, and one line to move on it:
|
|
26
|
+
|
|
27
|
+
${MOVES.map(([key, what]) => ` ${key.padEnd(11)} ${what}`).join("\n")}
|
|
28
|
+
|
|
29
|
+
Every move lands in the caller's own log as its own \`supervisor.*\` entry with a seq, so what a
|
|
30
|
+
human did to a call is read the same way as what the agent did. ${ON_THE_SPEAKERS}.`,
|
|
31
|
+
run,
|
|
32
|
+
};
|
|
33
|
+
export async function run(argv, how = {}) {
|
|
34
|
+
const out = how.out ?? process.stdout;
|
|
35
|
+
const err = how.err ?? process.stderr;
|
|
36
|
+
const call = argv.find((word) => !word.startsWith("-"));
|
|
37
|
+
if (call === undefined) {
|
|
38
|
+
err.write(`${USAGE}\n`);
|
|
39
|
+
return 2;
|
|
40
|
+
}
|
|
41
|
+
const door = theDoor(how.env ?? process.env, err);
|
|
42
|
+
if (door === undefined)
|
|
43
|
+
return 2;
|
|
44
|
+
out.write(`${call} · ${ON_THE_SPEAKERS}\n`);
|
|
45
|
+
const pc = new Pinecall({ url: door.url, apiKey: door.apiKey });
|
|
46
|
+
try {
|
|
47
|
+
return await atTheDesk(pc, door, call, out, err);
|
|
48
|
+
}
|
|
49
|
+
catch (refused) {
|
|
50
|
+
err.write(`${refusal(refused)}\n`);
|
|
51
|
+
return 1;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* The two halves at once: the log printing itself, and a keyboard sending verbs. Neither waits for
|
|
56
|
+
* the other — a move typed while the caller is mid-sentence is sent while they finish it.
|
|
57
|
+
*/
|
|
58
|
+
async function atTheDesk(pc, door, call, out, err) {
|
|
59
|
+
const lines = createInterface({ input: process.stdin, output: process.stdout, prompt: "> " });
|
|
60
|
+
let ended = false;
|
|
61
|
+
const watching = (async () => {
|
|
62
|
+
for await (const seen of pc.observe({ call })) {
|
|
63
|
+
// The entry's own data and not the folded event: what a desk prints is what the log wrote.
|
|
64
|
+
const line = lineOf(seen.entry.seq, seen.entry.type, seen.entry.data);
|
|
65
|
+
if (line !== null)
|
|
66
|
+
out.write(`\r${line}\n`);
|
|
67
|
+
lines.prompt();
|
|
68
|
+
if (seen.entry.type === "call.ended")
|
|
69
|
+
ended = true;
|
|
70
|
+
if (ended)
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
73
|
+
})();
|
|
74
|
+
lines.prompt();
|
|
75
|
+
for await (const typed of lines) {
|
|
76
|
+
if (ended)
|
|
77
|
+
break;
|
|
78
|
+
const move = moveOf(typed.trim());
|
|
79
|
+
if (move === "leave")
|
|
80
|
+
break;
|
|
81
|
+
if (move === null) {
|
|
82
|
+
err.write(`\rnot a move. ${MOVES.map(([key]) => key.split(" ")[0]).join(" · ")}\n`);
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
await sent(door, call, move).catch((refused) => err.write(`\r${refusal(refused)}\n`));
|
|
86
|
+
}
|
|
87
|
+
lines.prompt();
|
|
88
|
+
}
|
|
89
|
+
lines.close();
|
|
90
|
+
await watching.catch(() => undefined);
|
|
91
|
+
return 0;
|
|
92
|
+
}
|
|
93
|
+
/** One typed line as the verb it names, `leave` for q, and nothing at all for a line nobody meant. */
|
|
94
|
+
export function moveOf(typed) {
|
|
95
|
+
const [key, ...rest] = typed.split(" ");
|
|
96
|
+
const said = rest.join(" ").trim();
|
|
97
|
+
if (key === "q")
|
|
98
|
+
return "leave";
|
|
99
|
+
if (key === "t")
|
|
100
|
+
return { verb: "takeover" };
|
|
101
|
+
if (key === "x")
|
|
102
|
+
return { verb: "release" };
|
|
103
|
+
if (key === "e")
|
|
104
|
+
return { verb: "end", reason: said === "" ? undefined : said };
|
|
105
|
+
if (said === "")
|
|
106
|
+
return null;
|
|
107
|
+
if (key === "w")
|
|
108
|
+
return { verb: "whisper", text: said };
|
|
109
|
+
if (key === "s")
|
|
110
|
+
return { verb: "say", text: said };
|
|
111
|
+
return null;
|
|
112
|
+
}
|
|
113
|
+
async function sent(door, call, verb) {
|
|
114
|
+
await asked(door, `/v1/calls/${encodeURIComponent(call)}/verbs`, { method: "POST", body: verb });
|
|
115
|
+
}
|
|
116
|
+
// What a person at a desk reads: both speakers, and every move anybody made on this call. The
|
|
117
|
+
// entries a supervisor cannot act on — metrics, prompt changes, state — are not printed, because
|
|
118
|
+
// the whole point of the desk is the conversation.
|
|
119
|
+
export function lineOf(seq, type, data) {
|
|
120
|
+
const at = String(seq).padStart(4, " ");
|
|
121
|
+
if (type === "turn.user")
|
|
122
|
+
return `${at} caller ${String(data["text"] ?? "")}`;
|
|
123
|
+
if (type === "turn.agent")
|
|
124
|
+
return `${at} agent ${String(data["text"] ?? "")}`;
|
|
125
|
+
if (type === "call.ended")
|
|
126
|
+
return `${at} —— ended: ${String(data["reason"] ?? "")}`;
|
|
127
|
+
if (type.startsWith("supervisor.")) {
|
|
128
|
+
const what = type.slice("supervisor.".length);
|
|
129
|
+
const said = data["text"] ?? data["reason"] ?? data["to"] ?? "";
|
|
130
|
+
return `${at} desk ${what}${said === "" ? "" : ` ${String(said)}`}`;
|
|
131
|
+
}
|
|
132
|
+
return null;
|
|
133
|
+
}
|
|
134
|
+
//# sourceMappingURL=supervise.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
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AAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** `pinecall test [paths]`: the goldens, through the app this terminal is holding, scored by the runtime. */
|
|
2
|
+
import type { Group } from "./groups.js";
|
|
3
|
+
export declare const group: Group;
|
|
4
|
+
/**
|
|
5
|
+
* The class is mounted HERE, in this process, exactly as `pinecall chat` mounts it: the tenant's
|
|
6
|
+
* @tool bodies run against the tenant's own database and a breakpoint in one is reachable. The
|
|
7
|
+
* gateway drives the conversations and scores them, because the judge, the keys and the log are
|
|
8
|
+
* its — see docs/decisions/pinecall-test.md. The suite itself is `testing/suite.ts`, which the
|
|
9
|
+
* console runs too.
|
|
10
|
+
*/
|
|
11
|
+
export declare function run(argv: string[], out?: NodeJS.WritableStream): Promise<number>;
|
|
12
|
+
//# sourceMappingURL=test.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test.d.ts","sourceRoot":"","sources":["../../src/cli/test.ts"],"names":[],"mappings":"AAAA,6GAA6G;AAS7G,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAUzC,eAAO,MAAM,KAAK,EAAE,KAiBnB,CAAC;AA0BF;;;;;;GAMG;AACH,wBAAsB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,GAAE,MAAM,CAAC,cAA+B,GAAG,OAAO,CAAC,MAAM,CAAC,CA2CtG"}
|