@ouro.bot/cli 0.1.0-alpha.6 → 0.1.0-alpha.600
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/README.md +229 -183
- package/RepairGuide.ouro/agent.json +5 -0
- package/RepairGuide.ouro/psyche/IDENTITY.md +19 -0
- package/RepairGuide.ouro/psyche/SOUL.md +55 -0
- package/RepairGuide.ouro/skills/diagnose-broken-remote.md +63 -0
- package/RepairGuide.ouro/skills/diagnose-stacked-typed-issues.md +35 -0
- package/RepairGuide.ouro/skills/diagnose-sync-blocked.md +54 -0
- package/RepairGuide.ouro/skills/diagnose-vault-expired.md +60 -0
- package/SerpentGuide.ouro/agent.json +83 -0
- package/SerpentGuide.ouro/psyche/SOUL.md +25 -0
- package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/monty.md +2 -2
- package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/the-serpent.md +1 -1
- package/assets/ouroboros.png +0 -0
- package/changelog.json +4182 -0
- package/dist/arc/attention-types.js +8 -0
- package/dist/arc/cares.js +140 -0
- package/dist/arc/episodes.js +117 -0
- package/dist/arc/intentions.js +133 -0
- package/dist/arc/json-store.js +117 -0
- package/dist/arc/obligations.js +254 -0
- package/dist/arc/packets.js +193 -0
- package/dist/arc/presence.js +185 -0
- package/dist/arc/task-lifecycle.js +65 -0
- package/dist/heart/active-work.js +989 -0
- package/dist/heart/agent-entry.js +69 -3
- package/dist/heart/attachments/image-normalize.js +194 -0
- package/dist/heart/attachments/materialize.js +97 -0
- package/dist/heart/attachments/originals.js +88 -0
- package/dist/heart/attachments/render.js +29 -0
- package/dist/heart/attachments/sources/adapter.js +2 -0
- package/dist/heart/attachments/sources/bluebubbles.js +156 -0
- package/dist/heart/attachments/sources/cli-local-file.js +78 -0
- package/dist/heart/attachments/sources/index.js +16 -0
- package/dist/heart/attachments/store.js +103 -0
- package/dist/heart/attachments/types.js +93 -0
- package/dist/heart/auth/auth-flow.js +479 -0
- package/dist/heart/awaiting/await-alert.js +146 -0
- package/dist/heart/awaiting/await-expiry.js +108 -0
- package/dist/heart/awaiting/await-loader.js +91 -0
- package/dist/heart/awaiting/await-parser.js +141 -0
- package/dist/heart/awaiting/await-runtime-state.js +97 -0
- package/dist/heart/awaiting/await-scheduler.js +377 -0
- package/dist/heart/background-operations.js +281 -0
- package/dist/heart/bridges/manager.js +358 -0
- package/dist/heart/bridges/state-machine.js +135 -0
- package/dist/heart/bridges/store.js +123 -0
- package/dist/heart/bundle-state.js +168 -0
- package/dist/heart/commitments.js +142 -0
- package/dist/heart/config-registry.js +322 -0
- package/dist/heart/config.js +164 -135
- package/dist/heart/core.js +1069 -260
- package/dist/heart/cross-chat-delivery.js +131 -0
- package/dist/heart/daemon/agent-config-check.js +419 -0
- package/dist/heart/daemon/agent-discovery.js +180 -0
- package/dist/heart/daemon/agent-service.js +522 -0
- package/dist/heart/daemon/agentic-repair.js +547 -0
- package/dist/heart/daemon/bluebubbles-health-diagnostics.js +122 -0
- package/dist/heart/daemon/boot-sync-probe.js +197 -0
- package/dist/heart/daemon/cadence.js +70 -0
- package/dist/heart/daemon/cli-defaults.js +776 -0
- package/dist/heart/daemon/cli-exec.js +7571 -0
- package/dist/heart/daemon/cli-help.js +498 -0
- package/dist/heart/daemon/cli-parse.js +1599 -0
- package/dist/heart/daemon/cli-render-doctor.js +57 -0
- package/dist/heart/daemon/cli-render.js +763 -0
- package/dist/heart/daemon/cli-types.js +8 -0
- package/dist/heart/daemon/connect-bay.js +323 -0
- package/dist/heart/daemon/daemon-cli.js +30 -758
- package/dist/heart/daemon/daemon-entry.js +540 -8
- package/dist/heart/daemon/daemon-health.js +176 -0
- package/dist/heart/daemon/daemon-rollup.js +57 -0
- package/dist/heart/daemon/daemon-runtime-sync.js +287 -0
- package/dist/heart/daemon/daemon-tombstone.js +236 -0
- package/dist/heart/daemon/daemon.js +972 -20
- package/dist/heart/daemon/dns-workflow.js +394 -0
- package/dist/heart/daemon/doctor-types.js +8 -0
- package/dist/heart/daemon/doctor.js +873 -0
- package/dist/heart/daemon/health-monitor.js +122 -1
- package/dist/heart/daemon/hooks/agent-config-v2.js +33 -0
- package/dist/heart/daemon/hooks/bundle-meta.js +206 -0
- package/dist/heart/daemon/http-health-probe.js +80 -0
- package/dist/heart/daemon/human-command-screens.js +234 -0
- package/dist/heart/daemon/human-readiness.js +114 -0
- package/dist/heart/daemon/inner-status.js +89 -0
- package/dist/heart/daemon/interactive-repair.js +394 -0
- package/dist/heart/daemon/launchd.js +188 -0
- package/dist/heart/daemon/log-tailer.js +82 -12
- package/dist/heart/daemon/logs-prune.js +110 -0
- package/dist/heart/daemon/mcp-canary.js +297 -0
- package/dist/heart/daemon/message-router.js +17 -8
- package/dist/heart/daemon/os-cron-deps.js +135 -0
- package/dist/heart/daemon/os-cron.js +14 -12
- package/dist/heart/daemon/ouro-bot-entry.js +4 -2
- package/dist/heart/daemon/ouro-entry.js +3 -1
- package/dist/heart/daemon/process-manager.js +381 -26
- package/dist/heart/daemon/provider-discovery.js +137 -0
- package/dist/heart/daemon/provider-ping-progress.js +83 -0
- package/dist/heart/daemon/pulse.js +475 -0
- package/dist/heart/daemon/readiness-repair.js +365 -0
- package/dist/heart/daemon/run-hooks.js +39 -0
- package/dist/heart/daemon/runtime-logging.js +67 -16
- package/dist/heart/daemon/runtime-metadata.js +191 -0
- package/dist/heart/daemon/runtime-mode.js +67 -0
- package/dist/heart/daemon/safe-mode.js +161 -0
- package/dist/heart/daemon/sense-manager.js +731 -0
- package/dist/heart/daemon/session-id-resolver.js +131 -0
- package/dist/heart/daemon/skill-management-installer.js +94 -0
- package/dist/heart/daemon/socket-client.js +349 -0
- package/dist/heart/daemon/stale-bundle-prune.js +96 -0
- package/dist/heart/daemon/startup-tui.js +330 -0
- package/dist/heart/daemon/task-scheduler.js +3 -25
- package/dist/heart/daemon/terminal-ui.js +499 -0
- package/dist/heart/daemon/thoughts.js +524 -0
- package/dist/heart/daemon/up-progress.js +366 -0
- package/dist/heart/daemon/vault-items.js +56 -0
- package/dist/heart/delegation.js +62 -0
- package/dist/heart/habits/habit-migration.js +189 -0
- package/dist/heart/habits/habit-parser.js +140 -0
- package/dist/heart/habits/habit-runtime-state.js +100 -0
- package/dist/heart/habits/habit-scheduler.js +372 -0
- package/dist/heart/{daemon → hatch}/hatch-animation.js +10 -3
- package/dist/heart/{daemon → hatch}/hatch-flow.js +34 -136
- package/dist/heart/{daemon → hatch}/hatch-specialist.js +6 -8
- package/dist/heart/hatch/specialist-orchestrator.js +129 -0
- package/dist/heart/hatch/specialist-prompt.js +102 -0
- package/dist/heart/hatch/specialist-tools.js +306 -0
- package/dist/heart/identity.js +281 -67
- package/dist/heart/kept-notes.js +357 -0
- package/dist/heart/kicks.js +2 -20
- package/dist/heart/machine-identity.js +161 -0
- package/dist/heart/mail-import-discovery.js +353 -0
- package/dist/heart/mailbox/mailbox-http-hooks.js +66 -0
- package/dist/heart/mailbox/mailbox-http-response.js +7 -0
- package/dist/heart/mailbox/mailbox-http-routes.js +246 -0
- package/dist/heart/mailbox/mailbox-http-static.js +103 -0
- package/dist/heart/mailbox/mailbox-http-transport.js +116 -0
- package/dist/heart/mailbox/mailbox-http.js +99 -0
- package/dist/heart/mailbox/mailbox-read.js +31 -0
- package/dist/heart/mailbox/mailbox-types.js +27 -0
- package/dist/heart/mailbox/mailbox-view.js +195 -0
- package/dist/heart/mailbox/readers/agent-machine.js +382 -0
- package/dist/heart/mailbox/readers/continuity-readers.js +338 -0
- package/dist/heart/mailbox/readers/mail.js +367 -0
- package/dist/heart/mailbox/readers/runtime-readers.js +651 -0
- package/dist/heart/mailbox/readers/sessions.js +232 -0
- package/dist/heart/mailbox/readers/shared.js +111 -0
- package/dist/heart/mcp/mcp-server.js +656 -0
- package/dist/heart/migrate-config.js +100 -0
- package/dist/heart/model-capabilities.js +59 -0
- package/dist/heart/platform.js +81 -0
- package/dist/heart/progress-story.js +42 -0
- package/dist/heart/provider-attempt.js +134 -0
- package/dist/heart/provider-binding-resolver.js +267 -0
- package/dist/heart/provider-credentials.js +425 -0
- package/dist/heart/provider-failover.js +301 -0
- package/dist/heart/provider-models.js +81 -0
- package/dist/heart/provider-ping.js +262 -0
- package/dist/heart/provider-readiness-cache.js +40 -0
- package/dist/heart/provider-visibility.js +188 -0
- package/dist/heart/providers/anthropic-token.js +131 -0
- package/dist/heart/providers/anthropic.js +202 -50
- package/dist/heart/providers/azure.js +104 -13
- package/dist/heart/providers/error-classification.js +127 -0
- package/dist/heart/providers/github-copilot.js +145 -0
- package/dist/heart/providers/minimax-vlm.js +189 -0
- package/dist/heart/providers/minimax.js +29 -7
- package/dist/heart/providers/openai-codex.js +63 -39
- package/dist/heart/runtime-capability-check.js +170 -0
- package/dist/heart/runtime-credentials.js +367 -0
- package/dist/heart/runtime-cwd.js +87 -0
- package/dist/heart/sense-truth.js +70 -0
- package/dist/heart/session-activity.js +190 -0
- package/dist/heart/session-events.js +1149 -0
- package/dist/heart/session-playback-cli-main.js +5 -0
- package/dist/heart/session-playback-cli.js +36 -0
- package/dist/heart/session-playback.js +231 -0
- package/dist/heart/session-stats-cli-main.js +5 -0
- package/dist/heart/session-stats.js +182 -0
- package/dist/heart/session-transcript.js +243 -0
- package/dist/heart/start-of-turn-packet.js +345 -0
- package/dist/heart/streaming.js +129 -34
- package/dist/heart/sync-classification.js +176 -0
- package/dist/heart/sync.js +449 -0
- package/dist/heart/target-resolution.js +127 -0
- package/dist/heart/tempo.js +93 -0
- package/dist/heart/temporal-view.js +41 -0
- package/dist/heart/timeouts.js +101 -0
- package/dist/heart/tool-activity-callbacks.js +59 -0
- package/dist/heart/tool-description.js +143 -0
- package/dist/heart/tool-friction.js +55 -0
- package/dist/heart/tool-loop.js +200 -0
- package/dist/heart/turn-context.js +421 -0
- package/dist/heart/turn-coordinator.js +28 -0
- package/dist/heart/versioning/ouro-bot-global-installer.js +129 -0
- package/dist/heart/{daemon → versioning}/ouro-bot-wrapper.js +1 -1
- package/dist/heart/versioning/ouro-path-installer.js +426 -0
- package/dist/heart/{daemon → versioning}/ouro-uti.js +11 -2
- package/dist/heart/versioning/ouro-version-manager.js +295 -0
- package/dist/heart/versioning/staged-restart.js +146 -0
- package/dist/heart/versioning/update-checker.js +116 -0
- package/dist/heart/versioning/update-hooks.js +142 -0
- package/dist/heart/versioning/wrapper-publish-guard.js +86 -0
- package/dist/mailbox-ui/assets/index-B-461hes.js +61 -0
- package/dist/mailbox-ui/assets/index-BPr5vNuM.css +1 -0
- package/dist/mailbox-ui/index.html +15 -0
- package/dist/mailroom/attention.js +167 -0
- package/dist/mailroom/autonomy.js +209 -0
- package/dist/mailroom/blob-store.js +700 -0
- package/dist/mailroom/body-cache.js +61 -0
- package/dist/mailroom/core.js +788 -0
- package/dist/mailroom/entry.js +160 -0
- package/dist/mailroom/file-store.js +457 -0
- package/dist/mailroom/mbox-import.js +393 -0
- package/dist/mailroom/migration.js +164 -0
- package/dist/mailroom/outbound.js +380 -0
- package/dist/mailroom/policy.js +263 -0
- package/dist/mailroom/reader.js +233 -0
- package/dist/mailroom/search-cache.js +268 -0
- package/dist/mailroom/search-relevance.js +319 -0
- package/dist/mailroom/smtp-ingress.js +176 -0
- package/dist/mailroom/source-state.js +176 -0
- package/dist/mailroom/thread.js +109 -0
- package/dist/mailroom/travel-extract.js +89 -0
- package/dist/mind/bundle-manifest.js +77 -1
- package/dist/mind/context.js +174 -94
- package/dist/mind/diary-integrity.js +60 -0
- package/dist/mind/{memory.js → diary.js} +84 -96
- package/dist/mind/embedding-provider.js +60 -0
- package/dist/mind/file-state.js +179 -0
- package/dist/mind/first-impressions.js +16 -2
- package/dist/mind/friends/channel.js +74 -0
- package/dist/mind/friends/group-context.js +144 -0
- package/dist/mind/friends/resolver.js +54 -2
- package/dist/mind/friends/store-file.js +58 -3
- package/dist/mind/friends/trust-explanation.js +74 -0
- package/dist/mind/friends/types.js +10 -2
- package/dist/mind/journal-index.js +161 -0
- package/dist/mind/note-search.js +268 -0
- package/dist/mind/obligation-steering.js +221 -0
- package/dist/mind/pending.js +76 -9
- package/dist/mind/phrases.js +1 -0
- package/dist/mind/prompt-refresh.js +3 -2
- package/dist/mind/prompt.js +1267 -130
- package/dist/mind/provenance-trust.js +26 -0
- package/dist/mind/scrutiny.js +173 -0
- package/dist/mind/token-estimate.js +8 -12
- package/dist/nerves/cli-logging.js +22 -3
- package/dist/nerves/coverage/audit-rules.js +15 -6
- package/dist/nerves/coverage/audit.js +28 -2
- package/dist/nerves/coverage/cli.js +1 -1
- package/dist/nerves/coverage/contract.js +5 -5
- package/dist/nerves/coverage/file-completeness.js +129 -5
- package/dist/nerves/coverage/run-artifacts.js +1 -1
- package/dist/nerves/event-buffer.js +111 -0
- package/dist/nerves/index.js +224 -4
- package/dist/nerves/observation.js +20 -0
- package/dist/nerves/redact.js +79 -0
- package/dist/nerves/review/cli-main.js +5 -0
- package/dist/nerves/review/cli.js +156 -0
- package/dist/nerves/review/core.js +152 -0
- package/dist/nerves/runtime.js +5 -1
- package/dist/repertoire/ado-client.js +17 -56
- package/dist/repertoire/ado-semantic.js +11 -10
- package/dist/repertoire/api-client.js +97 -0
- package/dist/repertoire/bitwarden-store.js +997 -0
- package/dist/repertoire/bundle-templates.js +72 -0
- package/dist/repertoire/bw-installer.js +180 -0
- package/dist/repertoire/coding/codex-jsonl.js +64 -0
- package/dist/repertoire/coding/context-pack.js +330 -0
- package/dist/repertoire/coding/feedback.js +301 -0
- package/dist/repertoire/coding/index.js +4 -1
- package/dist/repertoire/coding/manager.js +220 -13
- package/dist/repertoire/coding/spawner.js +58 -12
- package/dist/repertoire/coding/tools.js +209 -7
- package/dist/repertoire/commerce-errors.js +109 -0
- package/dist/repertoire/commerce-self-test.js +156 -0
- package/dist/repertoire/credential-access.js +178 -0
- package/dist/repertoire/data/ado-endpoints.json +188 -0
- package/dist/repertoire/duffel-client.js +185 -0
- package/dist/repertoire/github-client.js +14 -55
- package/dist/repertoire/graph-client.js +11 -52
- package/dist/repertoire/guardrails.js +396 -0
- package/dist/repertoire/mcp-client.js +295 -0
- package/dist/repertoire/mcp-manager.js +362 -0
- package/dist/repertoire/mcp-tools.js +63 -0
- package/dist/repertoire/shell-sessions.js +133 -0
- package/dist/repertoire/skills.js +15 -24
- package/dist/repertoire/stripe-client.js +131 -0
- package/dist/repertoire/tasks/board.js +43 -5
- package/dist/repertoire/tasks/fix.js +182 -0
- package/dist/repertoire/tasks/index.js +39 -13
- package/dist/repertoire/tasks/lifecycle.js +2 -2
- package/dist/repertoire/tasks/parser.js +3 -2
- package/dist/repertoire/tasks/scanner.js +194 -37
- package/dist/repertoire/tasks/transitions.js +16 -79
- package/dist/repertoire/tool-results.js +29 -0
- package/dist/repertoire/tools-attachments.js +317 -0
- package/dist/repertoire/tools-awaiting.js +360 -0
- package/dist/repertoire/tools-base.js +56 -707
- package/dist/repertoire/tools-bluebubbles.js +94 -0
- package/dist/repertoire/tools-bridge.js +142 -0
- package/dist/repertoire/tools-bundle.js +984 -0
- package/dist/repertoire/tools-config.js +185 -0
- package/dist/repertoire/tools-continuity.js +248 -0
- package/dist/repertoire/tools-credential.js +381 -0
- package/dist/repertoire/tools-files.js +342 -0
- package/dist/repertoire/tools-flight.js +224 -0
- package/dist/repertoire/tools-flow.js +119 -0
- package/dist/repertoire/tools-github.js +1 -7
- package/dist/repertoire/tools-mail.js +1916 -0
- package/dist/repertoire/tools-notes.js +421 -0
- package/dist/repertoire/tools-obligations.js +142 -0
- package/dist/repertoire/tools-runtime.js +61 -0
- package/dist/repertoire/tools-session.js +809 -0
- package/dist/repertoire/tools-shell.js +120 -0
- package/dist/repertoire/tools-stripe.js +180 -0
- package/dist/repertoire/tools-surface.js +345 -0
- package/dist/repertoire/tools-teams.js +64 -61
- package/dist/repertoire/tools-travel.js +125 -0
- package/dist/repertoire/tools-trip.js +604 -0
- package/dist/repertoire/tools-user-profile.js +144 -0
- package/dist/repertoire/tools-vault.js +40 -0
- package/dist/repertoire/tools-voice.js +144 -0
- package/dist/repertoire/tools.js +154 -98
- package/dist/repertoire/travel-api-client.js +360 -0
- package/dist/repertoire/user-profile.js +131 -0
- package/dist/repertoire/vault-setup.js +246 -0
- package/dist/repertoire/vault-unlock.js +594 -0
- package/dist/scripts/claude-code-hook.js +41 -0
- package/dist/scripts/claude-code-stop-hook.js +47 -0
- package/dist/senses/attention-queue.js +116 -0
- package/dist/senses/await-turn-message.js +58 -0
- package/dist/senses/bluebubbles/active-turns.js +216 -0
- package/dist/senses/bluebubbles/attachment-cache.js +53 -0
- package/dist/senses/bluebubbles/attachment-download.js +137 -0
- package/dist/senses/bluebubbles/client.js +685 -0
- package/dist/senses/bluebubbles/entry.js +77 -0
- package/dist/senses/bluebubbles/inbound-log.js +126 -0
- package/dist/senses/bluebubbles/index.js +2548 -0
- package/dist/senses/bluebubbles/media.js +389 -0
- package/dist/senses/{bluebubbles-model.js → bluebubbles/model.js} +45 -16
- package/dist/senses/{bluebubbles-mutation-log.js → bluebubbles/mutation-log.js} +46 -6
- package/dist/senses/bluebubbles/processed-log.js +133 -0
- package/dist/senses/bluebubbles/replay.js +137 -0
- package/dist/senses/bluebubbles/runtime-state.js +137 -0
- package/dist/senses/bluebubbles/session-cleanup.js +72 -0
- package/dist/senses/bluebubbles-meta-guard.js +40 -0
- package/dist/senses/cli/bracketed-paste.js +82 -0
- package/dist/senses/cli/image-paste.js +287 -0
- package/dist/senses/cli/image-ref-navigation.js +75 -0
- package/dist/senses/cli/ink-app.js +156 -0
- package/dist/senses/cli/inline-diff.js +64 -0
- package/dist/senses/cli/input-keys.js +174 -0
- package/dist/senses/cli/kill-ring.js +86 -0
- package/dist/senses/cli/message-list.js +51 -0
- package/dist/senses/cli/ouro-tui.js +607 -0
- package/dist/senses/cli/spinner-imperative.js +135 -0
- package/dist/senses/cli/spinner.js +101 -0
- package/dist/senses/cli/status-line.js +60 -0
- package/dist/senses/cli/streaming-markdown.js +526 -0
- package/dist/senses/cli/tool-display.js +85 -0
- package/dist/senses/cli/tool-render.js +85 -0
- package/dist/senses/cli/tui-store.js +240 -0
- package/dist/senses/cli/virtual-list.js +35 -0
- package/dist/senses/cli-entry.js +60 -8
- package/dist/senses/cli-layout.js +187 -0
- package/dist/senses/cli.js +777 -264
- package/dist/senses/commands.js +66 -3
- package/dist/senses/continuity.js +94 -0
- package/dist/senses/habit-turn-message.js +108 -0
- package/dist/senses/inner-dialog-worker.js +209 -16
- package/dist/senses/inner-dialog.js +682 -91
- package/dist/senses/mail-entry.js +66 -0
- package/dist/senses/mail.js +379 -0
- package/dist/senses/pipeline.js +751 -0
- package/dist/senses/proactive-content-guard.js +51 -0
- package/dist/senses/shared-turn.js +392 -0
- package/dist/senses/surface-tool.js +70 -0
- package/dist/senses/teams-entry.js +60 -8
- package/dist/senses/teams.js +925 -195
- package/dist/senses/trust-gate.js +207 -2
- package/dist/senses/voice/audio-playback.js +237 -0
- package/dist/senses/voice/audio-routing.js +119 -0
- package/dist/senses/voice/elevenlabs.js +202 -0
- package/dist/senses/voice/floor-control.js +431 -0
- package/dist/senses/voice/floor-controller.js +115 -0
- package/dist/senses/voice/golden-path.js +116 -0
- package/dist/senses/voice/index.js +29 -0
- package/dist/senses/voice/meeting.js +113 -0
- package/dist/senses/voice/outbound.js +190 -0
- package/dist/senses/voice/phone.js +33 -0
- package/dist/senses/voice/playback.js +139 -0
- package/dist/senses/voice/realtime-eval.js +496 -0
- package/dist/senses/voice/realtime-trace.js +531 -0
- package/dist/senses/voice/transcript.js +70 -0
- package/dist/senses/voice/turn.js +191 -0
- package/dist/senses/voice/twilio-phone-runtime.js +807 -0
- package/dist/senses/voice/twilio-phone.js +5077 -0
- package/dist/senses/voice/types.js +2 -0
- package/dist/senses/voice/whisper.js +161 -0
- package/dist/senses/voice-entry.js +81 -0
- package/dist/senses/voice-realtime-eval-command.js +99 -0
- package/dist/senses/voice-realtime-eval-entry.js +21 -0
- package/dist/senses/voice-twilio-entry.js +87 -0
- package/dist/trips/core.js +138 -0
- package/dist/trips/store.js +265 -0
- package/package.json +52 -7
- package/skills/agent-commerce.md +106 -0
- package/skills/browser-navigation.md +117 -0
- package/skills/commerce-setup-guide.md +116 -0
- package/skills/commerce-setup.md +84 -0
- package/skills/configure-dev-tools.md +99 -0
- package/skills/travel-planning.md +138 -0
- package/AdoptionSpecialist.ouro/agent.json +0 -20
- package/AdoptionSpecialist.ouro/psyche/SOUL.md +0 -22
- package/dist/heart/daemon/specialist-orchestrator.js +0 -160
- package/dist/heart/daemon/specialist-prompt.js +0 -40
- package/dist/heart/daemon/specialist-session.js +0 -142
- package/dist/heart/daemon/specialist-tools.js +0 -128
- package/dist/heart/daemon/subagent-installer.js +0 -125
- package/dist/inner-worker-entry.js +0 -4
- package/dist/mind/associative-recall.js +0 -197
- package/dist/senses/bluebubbles-client.js +0 -279
- package/dist/senses/bluebubbles-entry.js +0 -11
- package/dist/senses/bluebubbles.js +0 -332
- package/subagents/README.md +0 -73
- package/subagents/work-doer.md +0 -233
- package/subagents/work-merger.md +0 -624
- package/subagents/work-planner.md +0 -373
- /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/basilisk.md +0 -0
- /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/jafar.md +0 -0
- /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/jormungandr.md +0 -0
- /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/kaa.md +0 -0
- /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/medusa.md +0 -0
- /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/nagini.md +0 -0
- /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/ouroboros.md +0 -0
- /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/python.md +0 -0
- /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/quetzalcoatl.md +0 -0
- /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/sir-hiss.md +0 -0
- /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/the-snake.md +0 -0
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.writeVoicePlaybackArtifact = writeVoicePlaybackArtifact;
|
|
37
|
+
const fs = __importStar(require("fs/promises"));
|
|
38
|
+
const path = __importStar(require("path"));
|
|
39
|
+
const runtime_1 = require("../../nerves/runtime");
|
|
40
|
+
const audio_routing_1 = require("./audio-routing");
|
|
41
|
+
function audioExtension(mimeType) {
|
|
42
|
+
if (mimeType === "audio/mpeg")
|
|
43
|
+
return "mp3";
|
|
44
|
+
if (mimeType === "audio/wav" || mimeType === "audio/x-wav")
|
|
45
|
+
return "wav";
|
|
46
|
+
if (mimeType.startsWith("audio/pcm"))
|
|
47
|
+
return "pcm";
|
|
48
|
+
return "audio";
|
|
49
|
+
}
|
|
50
|
+
function safeFileStem(input) {
|
|
51
|
+
const stem = input
|
|
52
|
+
.trim()
|
|
53
|
+
.toLowerCase()
|
|
54
|
+
.replace(/[^a-z0-9]+/g, "-")
|
|
55
|
+
.replace(/^-+|-+$/g, "");
|
|
56
|
+
return stem || "utterance";
|
|
57
|
+
}
|
|
58
|
+
function commandFailureMessage(exitCode, result) {
|
|
59
|
+
const stderr = result.stderr?.trim();
|
|
60
|
+
if (stderr)
|
|
61
|
+
return `exit ${exitCode}: ${stderr}`;
|
|
62
|
+
const stdout = result.stdout?.trim();
|
|
63
|
+
if (stdout)
|
|
64
|
+
return `exit ${exitCode}: ${stdout}`;
|
|
65
|
+
return `exit ${exitCode}`;
|
|
66
|
+
}
|
|
67
|
+
async function writeVoicePlaybackArtifact(request) {
|
|
68
|
+
const mkdir = request.mkdir ?? fs.mkdir;
|
|
69
|
+
const writeFile = request.writeFile ?? fs.writeFile;
|
|
70
|
+
const commandRunner = request.commandRunner ?? (0, audio_routing_1.createNodeVoiceCommandRunner)();
|
|
71
|
+
const timeoutMs = request.timeoutMs ?? 30_000;
|
|
72
|
+
const playbackCommandPath = request.playbackCommandPath ?? "afplay";
|
|
73
|
+
const audioPath = path.join(request.outputDir, `${safeFileStem(request.utteranceId)}.${audioExtension(request.delivery.mimeType)}`);
|
|
74
|
+
await mkdir(request.outputDir, { recursive: true });
|
|
75
|
+
await writeFile(audioPath, request.delivery.audio);
|
|
76
|
+
(0, runtime_1.emitNervesEvent)({
|
|
77
|
+
component: "senses",
|
|
78
|
+
event: "senses.voice_playback_artifact_written",
|
|
79
|
+
message: "voice playback artifact written",
|
|
80
|
+
meta: {
|
|
81
|
+
utteranceId: request.utteranceId,
|
|
82
|
+
audioPath,
|
|
83
|
+
byteLength: request.delivery.byteLength,
|
|
84
|
+
mimeType: request.delivery.mimeType,
|
|
85
|
+
},
|
|
86
|
+
});
|
|
87
|
+
if (request.playAudio !== true) {
|
|
88
|
+
return {
|
|
89
|
+
status: "written",
|
|
90
|
+
audioPath,
|
|
91
|
+
byteLength: request.delivery.byteLength,
|
|
92
|
+
mimeType: request.delivery.mimeType,
|
|
93
|
+
playbackAttempted: false,
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
(0, runtime_1.emitNervesEvent)({
|
|
97
|
+
component: "senses",
|
|
98
|
+
event: "senses.voice_playback_start",
|
|
99
|
+
message: "starting voice playback",
|
|
100
|
+
meta: { utteranceId: request.utteranceId, audioPath, playbackCommandPath },
|
|
101
|
+
});
|
|
102
|
+
try {
|
|
103
|
+
const result = await commandRunner(playbackCommandPath, [audioPath], { timeoutMs });
|
|
104
|
+
if (typeof result.exitCode === "number" && result.exitCode !== 0) {
|
|
105
|
+
throw new Error(commandFailureMessage(result.exitCode, result));
|
|
106
|
+
}
|
|
107
|
+
(0, runtime_1.emitNervesEvent)({
|
|
108
|
+
component: "senses",
|
|
109
|
+
event: "senses.voice_playback_end",
|
|
110
|
+
message: "finished voice playback",
|
|
111
|
+
meta: { utteranceId: request.utteranceId, audioPath },
|
|
112
|
+
});
|
|
113
|
+
return {
|
|
114
|
+
status: "played",
|
|
115
|
+
audioPath,
|
|
116
|
+
byteLength: request.delivery.byteLength,
|
|
117
|
+
mimeType: request.delivery.mimeType,
|
|
118
|
+
playbackAttempted: true,
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
catch (error) {
|
|
122
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
123
|
+
(0, runtime_1.emitNervesEvent)({
|
|
124
|
+
level: "error",
|
|
125
|
+
component: "senses",
|
|
126
|
+
event: "senses.voice_playback_error",
|
|
127
|
+
message: "voice playback failed",
|
|
128
|
+
meta: { utteranceId: request.utteranceId, audioPath, error: message },
|
|
129
|
+
});
|
|
130
|
+
return {
|
|
131
|
+
status: "failed",
|
|
132
|
+
audioPath,
|
|
133
|
+
byteLength: request.delivery.byteLength,
|
|
134
|
+
mimeType: request.delivery.mimeType,
|
|
135
|
+
playbackAttempted: true,
|
|
136
|
+
error: message,
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
}
|
|
@@ -0,0 +1,496 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.gradeVoiceRealtimeEvalTimeline = gradeVoiceRealtimeEvalTimeline;
|
|
4
|
+
exports.buildVoiceRealtimeEvalHappyPath = buildVoiceRealtimeEvalHappyPath;
|
|
5
|
+
exports.buildVoiceRealtimeEvalDefaultExpectation = buildVoiceRealtimeEvalDefaultExpectation;
|
|
6
|
+
exports.runBuiltInVoiceRealtimeEvalSuite = runBuiltInVoiceRealtimeEvalSuite;
|
|
7
|
+
exports.summarizeVoiceRealtimeEvalSuite = summarizeVoiceRealtimeEvalSuite;
|
|
8
|
+
const runtime_1 = require("../../nerves/runtime");
|
|
9
|
+
function validateTimeline(scenarioId, events, expectation) {
|
|
10
|
+
const normalizedScenarioId = scenarioId.trim();
|
|
11
|
+
if (!normalizedScenarioId)
|
|
12
|
+
throw new Error("voice eval scenario id is empty");
|
|
13
|
+
if (events.length === 0)
|
|
14
|
+
throw new Error("voice eval timeline is empty");
|
|
15
|
+
const budgets = [
|
|
16
|
+
expectation.maxFirstAssistantAudioMs,
|
|
17
|
+
expectation.maxUserTurnResponseMs,
|
|
18
|
+
expectation.maxToolPresenceMs,
|
|
19
|
+
expectation.maxBargeInClearMs,
|
|
20
|
+
expectation.maxBargeInTruncateMs,
|
|
21
|
+
];
|
|
22
|
+
if (budgets.some((budget) => !Number.isFinite(budget) || budget <= 0)) {
|
|
23
|
+
throw new Error("voice eval latency budgets must be positive");
|
|
24
|
+
}
|
|
25
|
+
return normalizedScenarioId;
|
|
26
|
+
}
|
|
27
|
+
function sortedEvents(events) {
|
|
28
|
+
return [...events].sort((left, right) => left.atMs - right.atMs);
|
|
29
|
+
}
|
|
30
|
+
function firstEvent(events, type) {
|
|
31
|
+
return events.find((event) => event.type === type);
|
|
32
|
+
}
|
|
33
|
+
function allEvents(events, type) {
|
|
34
|
+
return events.filter((event) => event.type === type);
|
|
35
|
+
}
|
|
36
|
+
function lowerText(value) {
|
|
37
|
+
return value?.toLowerCase() ?? "";
|
|
38
|
+
}
|
|
39
|
+
function pushFinding(findings, finding) {
|
|
40
|
+
findings.push(finding);
|
|
41
|
+
}
|
|
42
|
+
function floorDiagnostic(event, floor) {
|
|
43
|
+
return {
|
|
44
|
+
phase: event.floorPhase ?? floor?.floorPhase,
|
|
45
|
+
floorOwner: event.floorOwner ?? floor?.floorOwner,
|
|
46
|
+
speechDecision: event.speechDecision,
|
|
47
|
+
decisionReason: event.decisionReason ?? floor?.decisionReason,
|
|
48
|
+
responseId: event.type === "speech.policy.decision" || event.type === "response.requested"
|
|
49
|
+
? event.correlationId
|
|
50
|
+
: undefined,
|
|
51
|
+
toolCallId: event.type === "tool.result.ready" || event.type === "tool.result.spoken"
|
|
52
|
+
? event.correlationId
|
|
53
|
+
: undefined,
|
|
54
|
+
pendingSpeechId: event.pendingSpeechId ?? floor?.pendingSpeechId,
|
|
55
|
+
activeAssistantSpeechId: event.activeAssistantSpeechId ?? floor?.activeAssistantSpeechId,
|
|
56
|
+
pendingToolCallIds: event.pendingToolCallIds ?? floor?.pendingToolCallIds,
|
|
57
|
+
staleToolCallIds: event.staleToolCallIds ?? floor?.staleToolCallIds,
|
|
58
|
+
interruptionTurnId: event.interruptionTurnId ?? floor?.interruptionTurnId,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
function gradeFirstAudio(events, expectation, findings) {
|
|
62
|
+
const connected = firstEvent(events, "call.connected");
|
|
63
|
+
const firstAudio = firstEvent(events, "assistant.audio.started");
|
|
64
|
+
if (!connected || !firstAudio) {
|
|
65
|
+
pushFinding(findings, {
|
|
66
|
+
code: "first_audio_missing",
|
|
67
|
+
severity: "fail",
|
|
68
|
+
message: "Voice call did not produce assistant audio after connect.",
|
|
69
|
+
source: connected?.source ?? firstAudio?.source,
|
|
70
|
+
atMs: connected?.atMs ?? firstAudio?.atMs,
|
|
71
|
+
});
|
|
72
|
+
return undefined;
|
|
73
|
+
}
|
|
74
|
+
const ttfaMs = firstAudio.atMs - connected.atMs;
|
|
75
|
+
if (ttfaMs > expectation.maxFirstAssistantAudioMs) {
|
|
76
|
+
pushFinding(findings, {
|
|
77
|
+
code: "first_audio_late",
|
|
78
|
+
severity: "fail",
|
|
79
|
+
message: `First assistant audio started after ${ttfaMs}ms, over the ${expectation.maxFirstAssistantAudioMs}ms budget.`,
|
|
80
|
+
source: firstAudio.source,
|
|
81
|
+
atMs: firstAudio.atMs,
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
return ttfaMs;
|
|
85
|
+
}
|
|
86
|
+
function gradeFirstUserResponse(events, expectation, findings) {
|
|
87
|
+
const userTranscript = firstEvent(events, "user.transcript.done");
|
|
88
|
+
if (!userTranscript)
|
|
89
|
+
return undefined;
|
|
90
|
+
const response = events.find((event) => event.type === "response.requested"
|
|
91
|
+
&& event.atMs >= userTranscript.atMs
|
|
92
|
+
&& (!userTranscript.correlationId || event.correlationId === userTranscript.correlationId));
|
|
93
|
+
if (!response) {
|
|
94
|
+
pushFinding(findings, {
|
|
95
|
+
code: "user_response_missing",
|
|
96
|
+
severity: "fail",
|
|
97
|
+
message: "No voice response was requested after the caller transcript completed.",
|
|
98
|
+
source: userTranscript.source,
|
|
99
|
+
atMs: userTranscript.atMs,
|
|
100
|
+
});
|
|
101
|
+
return undefined;
|
|
102
|
+
}
|
|
103
|
+
const latencyMs = response.atMs - userTranscript.atMs;
|
|
104
|
+
if (latencyMs > expectation.maxUserTurnResponseMs) {
|
|
105
|
+
pushFinding(findings, {
|
|
106
|
+
code: "user_response_late",
|
|
107
|
+
severity: "fail",
|
|
108
|
+
message: `Voice response was requested after ${latencyMs}ms, over the ${expectation.maxUserTurnResponseMs}ms budget.`,
|
|
109
|
+
source: response.source,
|
|
110
|
+
atMs: response.atMs,
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
return latencyMs;
|
|
114
|
+
}
|
|
115
|
+
function gradeToolPresence(events, expectation, findings) {
|
|
116
|
+
const toolCall = firstEvent(events, "tool.call.started");
|
|
117
|
+
if (!toolCall)
|
|
118
|
+
return undefined;
|
|
119
|
+
const holding = events.find((event) => event.type === "tool.holding.started"
|
|
120
|
+
&& event.atMs >= toolCall.atMs
|
|
121
|
+
&& (!toolCall.correlationId || event.correlationId === toolCall.correlationId));
|
|
122
|
+
if (!holding) {
|
|
123
|
+
pushFinding(findings, {
|
|
124
|
+
code: "tool_presence_missing",
|
|
125
|
+
severity: "fail",
|
|
126
|
+
message: "Tool call did not produce a short voice holding phrase.",
|
|
127
|
+
source: toolCall.source,
|
|
128
|
+
atMs: toolCall.atMs,
|
|
129
|
+
});
|
|
130
|
+
return undefined;
|
|
131
|
+
}
|
|
132
|
+
const latencyMs = holding.atMs - toolCall.atMs;
|
|
133
|
+
if (latencyMs > expectation.maxToolPresenceMs) {
|
|
134
|
+
pushFinding(findings, {
|
|
135
|
+
code: "tool_presence_late",
|
|
136
|
+
severity: "fail",
|
|
137
|
+
message: `Tool holding phrase started after ${latencyMs}ms, over the ${expectation.maxToolPresenceMs}ms budget.`,
|
|
138
|
+
source: holding.source,
|
|
139
|
+
atMs: holding.atMs,
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
return latencyMs;
|
|
143
|
+
}
|
|
144
|
+
function gradeBargeIn(events, expectation, findings) {
|
|
145
|
+
const bargeIn = firstEvent(events, "barge_in.detected");
|
|
146
|
+
if (!bargeIn)
|
|
147
|
+
return {};
|
|
148
|
+
const clear = events.find((event) => event.type === "transport.playback_cleared" && event.atMs >= bargeIn.atMs);
|
|
149
|
+
const truncate = events.find((event) => event.type === "response.truncated" && event.atMs >= bargeIn.atMs);
|
|
150
|
+
const metrics = {};
|
|
151
|
+
if (!clear) {
|
|
152
|
+
pushFinding(findings, {
|
|
153
|
+
code: "barge_in_clear_missing",
|
|
154
|
+
severity: "fail",
|
|
155
|
+
message: "Caller barge-in did not clear transport playback.",
|
|
156
|
+
source: bargeIn.source,
|
|
157
|
+
atMs: bargeIn.atMs,
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
metrics.firstBargeInClearMs = clear.atMs - bargeIn.atMs;
|
|
162
|
+
if (metrics.firstBargeInClearMs > expectation.maxBargeInClearMs) {
|
|
163
|
+
pushFinding(findings, {
|
|
164
|
+
code: "barge_in_clear_late",
|
|
165
|
+
severity: "fail",
|
|
166
|
+
message: `Barge-in playback clear took ${metrics.firstBargeInClearMs}ms, over the ${expectation.maxBargeInClearMs}ms budget.`,
|
|
167
|
+
source: clear.source,
|
|
168
|
+
atMs: clear.atMs,
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
if (!truncate) {
|
|
173
|
+
pushFinding(findings, {
|
|
174
|
+
code: "barge_in_truncate_missing",
|
|
175
|
+
severity: "fail",
|
|
176
|
+
message: "Caller barge-in did not truncate the active Realtime response.",
|
|
177
|
+
source: bargeIn.source,
|
|
178
|
+
atMs: bargeIn.atMs,
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
else {
|
|
182
|
+
metrics.firstBargeInTruncateMs = truncate.atMs - bargeIn.atMs;
|
|
183
|
+
if (metrics.firstBargeInTruncateMs > expectation.maxBargeInTruncateMs) {
|
|
184
|
+
pushFinding(findings, {
|
|
185
|
+
code: "barge_in_truncate_late",
|
|
186
|
+
severity: "fail",
|
|
187
|
+
message: `Barge-in response truncation took ${metrics.firstBargeInTruncateMs}ms, over the ${expectation.maxBargeInTruncateMs}ms budget.`,
|
|
188
|
+
source: truncate.source,
|
|
189
|
+
atMs: truncate.atMs,
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
return metrics;
|
|
194
|
+
}
|
|
195
|
+
function gradeManualFloorControl(events, findings) {
|
|
196
|
+
const session = allEvents(events, "session.updated").find((event) => event.session?.turnDetection);
|
|
197
|
+
if (session?.session?.turnDetection?.createResponse === false
|
|
198
|
+
&& session.session.turnDetection.interruptResponse === false) {
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
pushFinding(findings, {
|
|
202
|
+
code: "manual_floor_control_missing",
|
|
203
|
+
severity: "fail",
|
|
204
|
+
message: "Realtime session did not disable provider auto-response and provider interruption.",
|
|
205
|
+
source: session?.source,
|
|
206
|
+
atMs: session?.atMs,
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
function gradeFriendContext(events, requirement, findings) {
|
|
210
|
+
const context = firstEvent(events, "voice.context.injected");
|
|
211
|
+
if (context?.friendId === requirement.friendId
|
|
212
|
+
&& context.sessionKey === requirement.sessionKey
|
|
213
|
+
&& lowerText(context.text).includes(requirement.marker.toLowerCase())) {
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
pushFinding(findings, {
|
|
217
|
+
code: "friend_context_mismatch",
|
|
218
|
+
severity: "fail",
|
|
219
|
+
message: "Voice context did not preserve the expected friend identity, trust marker, and stable session key.",
|
|
220
|
+
source: context?.source,
|
|
221
|
+
atMs: context?.atMs,
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
function gradeTranscripts(events, requirements, findings) {
|
|
225
|
+
for (const requirement of requirements) {
|
|
226
|
+
const type = requirement.role === "assistant"
|
|
227
|
+
? "assistant.transcript.done"
|
|
228
|
+
: "user.transcript.done";
|
|
229
|
+
const found = allEvents(events, type).some((event) => lowerText(event.text).includes(requirement.contains.toLowerCase()));
|
|
230
|
+
if (!found) {
|
|
231
|
+
pushFinding(findings, {
|
|
232
|
+
code: "transcript_missing",
|
|
233
|
+
severity: "fail",
|
|
234
|
+
message: `Missing ${requirement.role} transcript containing "${requirement.contains}".`,
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
function gradeHangup(events, findings) {
|
|
240
|
+
const hangup = firstEvent(events, "call.hangup.requested");
|
|
241
|
+
if (hangup)
|
|
242
|
+
return;
|
|
243
|
+
const ended = firstEvent(events, "call.ended");
|
|
244
|
+
pushFinding(findings, {
|
|
245
|
+
code: "hangup_missing",
|
|
246
|
+
severity: "fail",
|
|
247
|
+
message: "Voice eval expected an agent-controlled hangup request before call end.",
|
|
248
|
+
source: ended?.source,
|
|
249
|
+
atMs: ended?.atMs,
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
function gradeOverlappingResponses(events, findings) {
|
|
253
|
+
for (const response of allEvents(events, "response.requested")) {
|
|
254
|
+
const activeAudio = allEvents(events, "assistant.audio.started").find((started) => {
|
|
255
|
+
const done = events.find((event) => {
|
|
256
|
+
if (event.atMs < started.atMs)
|
|
257
|
+
return false;
|
|
258
|
+
if (event.type === "response.truncated" || event.type === "call.hangup.requested")
|
|
259
|
+
return true;
|
|
260
|
+
if (event.type !== "assistant.audio.done" && event.type !== "assistant.transcript.done")
|
|
261
|
+
return false;
|
|
262
|
+
return !started.correlationId || !event.correlationId || event.correlationId === started.correlationId;
|
|
263
|
+
});
|
|
264
|
+
return response.atMs > started.atMs && (!done || response.atMs < done.atMs);
|
|
265
|
+
});
|
|
266
|
+
if (activeAudio) {
|
|
267
|
+
pushFinding(findings, {
|
|
268
|
+
code: "response_overlap",
|
|
269
|
+
severity: "fail",
|
|
270
|
+
message: "Voice response was requested while assistant audio was still active.",
|
|
271
|
+
source: response.source,
|
|
272
|
+
atMs: response.atMs,
|
|
273
|
+
});
|
|
274
|
+
return;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
function floorIsCallerOwned(floor) {
|
|
279
|
+
return floor?.floorOwner === "caller" || floor?.floorPhase === "caller-speaking" || floor?.floorPhase === "interrupted";
|
|
280
|
+
}
|
|
281
|
+
function floorIsTerminal(floor) {
|
|
282
|
+
return floor?.floorOwner === "terminal" || floor?.floorPhase === "hangup" || floor?.floorPhase === "ended";
|
|
283
|
+
}
|
|
284
|
+
function gradeDuplexFloorPolicy(events, findings) {
|
|
285
|
+
let floor;
|
|
286
|
+
let hangupAtMs;
|
|
287
|
+
for (const event of events) {
|
|
288
|
+
if (event.type === "floor.state.changed") {
|
|
289
|
+
floor = event;
|
|
290
|
+
continue;
|
|
291
|
+
}
|
|
292
|
+
if (event.type === "call.hangup.requested")
|
|
293
|
+
hangupAtMs = event.atMs;
|
|
294
|
+
if (event.type === "speech.policy.decision" && event.speechDecision === "allow") {
|
|
295
|
+
if (floorIsCallerOwned(floor)) {
|
|
296
|
+
pushFinding(findings, {
|
|
297
|
+
code: "speech_allowed_while_caller_has_floor",
|
|
298
|
+
severity: "fail",
|
|
299
|
+
message: "Voice speech policy allowed assistant speech while the caller owned the floor.",
|
|
300
|
+
source: event.source,
|
|
301
|
+
atMs: event.atMs,
|
|
302
|
+
floor: floorDiagnostic(event, floor),
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
else if (floorIsTerminal(floor) || hangupAtMs !== undefined) {
|
|
306
|
+
pushFinding(findings, {
|
|
307
|
+
code: "speech_allowed_after_hangup",
|
|
308
|
+
severity: "fail",
|
|
309
|
+
message: "Voice speech policy allowed assistant speech after hangup began.",
|
|
310
|
+
source: event.source,
|
|
311
|
+
atMs: event.atMs,
|
|
312
|
+
floor: floorDiagnostic(event, floor),
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
if (event.type === "tool.result.spoken") {
|
|
317
|
+
const diagnostic = floorDiagnostic(event, floor);
|
|
318
|
+
if (event.correlationId && floor?.staleToolCallIds?.includes(event.correlationId)) {
|
|
319
|
+
pushFinding(findings, {
|
|
320
|
+
code: "stale_tool_result_spoken",
|
|
321
|
+
severity: "fail",
|
|
322
|
+
message: "Voice spoke a tool result that the floor model had already marked stale.",
|
|
323
|
+
source: event.source,
|
|
324
|
+
atMs: event.atMs,
|
|
325
|
+
floor: diagnostic,
|
|
326
|
+
});
|
|
327
|
+
}
|
|
328
|
+
else if (floorIsCallerOwned(floor)) {
|
|
329
|
+
pushFinding(findings, {
|
|
330
|
+
code: "tool_result_spoken_while_caller_has_floor",
|
|
331
|
+
severity: "fail",
|
|
332
|
+
message: "Voice spoke a tool result while the caller owned the floor.",
|
|
333
|
+
source: event.source,
|
|
334
|
+
atMs: event.atMs,
|
|
335
|
+
floor: diagnostic,
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
else if (floorIsTerminal(floor) || hangupAtMs !== undefined) {
|
|
339
|
+
pushFinding(findings, {
|
|
340
|
+
code: "tool_result_spoken_after_hangup",
|
|
341
|
+
severity: "fail",
|
|
342
|
+
message: "Voice spoke a tool result after hangup began.",
|
|
343
|
+
source: event.source,
|
|
344
|
+
atMs: event.atMs,
|
|
345
|
+
floor: diagnostic,
|
|
346
|
+
});
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
if (event.type === "response.requested" && hangupAtMs !== undefined && event.atMs > hangupAtMs) {
|
|
350
|
+
pushFinding(findings, {
|
|
351
|
+
code: "response_after_hangup",
|
|
352
|
+
severity: "fail",
|
|
353
|
+
message: "Voice requested a new response after hangup had already been requested.",
|
|
354
|
+
source: event.source,
|
|
355
|
+
atMs: event.atMs,
|
|
356
|
+
floor: floorDiagnostic(event, floor),
|
|
357
|
+
});
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
function collectTransportSources(events) {
|
|
362
|
+
return [...new Set(events.flatMap((event) => event.source ? [event.source.transport] : []))].sort();
|
|
363
|
+
}
|
|
364
|
+
function gradeVoiceRealtimeEvalTimeline(scenarioId, timeline, expectation) {
|
|
365
|
+
const normalizedScenarioId = validateTimeline(scenarioId, timeline, expectation);
|
|
366
|
+
const events = sortedEvents(timeline);
|
|
367
|
+
(0, runtime_1.emitNervesEvent)({
|
|
368
|
+
component: "senses",
|
|
369
|
+
event: "senses.voice_realtime_eval_start",
|
|
370
|
+
message: "starting Voice realtime eval timeline grading",
|
|
371
|
+
meta: { scenarioId: normalizedScenarioId, events: events.length },
|
|
372
|
+
});
|
|
373
|
+
const findings = [];
|
|
374
|
+
const metrics = {
|
|
375
|
+
ttfaMs: gradeFirstAudio(events, expectation, findings),
|
|
376
|
+
firstUserResponseMs: gradeFirstUserResponse(events, expectation, findings),
|
|
377
|
+
firstToolPresenceMs: gradeToolPresence(events, expectation, findings),
|
|
378
|
+
...gradeBargeIn(events, expectation, findings),
|
|
379
|
+
};
|
|
380
|
+
if (expectation.requireManualFloorControl)
|
|
381
|
+
gradeManualFloorControl(events, findings);
|
|
382
|
+
if (expectation.requireFriendContext)
|
|
383
|
+
gradeFriendContext(events, expectation.requireFriendContext, findings);
|
|
384
|
+
if (expectation.requiredTranscripts)
|
|
385
|
+
gradeTranscripts(events, expectation.requiredTranscripts, findings);
|
|
386
|
+
if (expectation.requireHangup)
|
|
387
|
+
gradeHangup(events, findings);
|
|
388
|
+
gradeOverlappingResponses(events, findings);
|
|
389
|
+
gradeDuplexFloorPolicy(events, findings);
|
|
390
|
+
const report = {
|
|
391
|
+
scenarioId: normalizedScenarioId,
|
|
392
|
+
passed: findings.every((finding) => finding.severity !== "fail"),
|
|
393
|
+
findings,
|
|
394
|
+
metrics,
|
|
395
|
+
transportSources: collectTransportSources(events),
|
|
396
|
+
};
|
|
397
|
+
(0, runtime_1.emitNervesEvent)({
|
|
398
|
+
component: "senses",
|
|
399
|
+
event: "senses.voice_realtime_eval_end",
|
|
400
|
+
message: "finished Voice realtime eval timeline grading",
|
|
401
|
+
meta: { scenarioId: normalizedScenarioId, passed: report.passed, findings: findings.length },
|
|
402
|
+
});
|
|
403
|
+
return report;
|
|
404
|
+
}
|
|
405
|
+
function buildVoiceRealtimeEvalHappyPath() {
|
|
406
|
+
return [
|
|
407
|
+
{ type: "call.connected", atMs: 0, source: { transport: "openai-sip", id: "sip-call-1" } },
|
|
408
|
+
{
|
|
409
|
+
type: "voice.context.injected",
|
|
410
|
+
atMs: 80,
|
|
411
|
+
friendId: "friend-ari",
|
|
412
|
+
sessionKey: "twilio-phone-friend-ari-via-ouro",
|
|
413
|
+
text: "Resolved voice friend: Ari (friendId=friend-ari, trust=family).",
|
|
414
|
+
source: { transport: "voice-eval" },
|
|
415
|
+
},
|
|
416
|
+
{
|
|
417
|
+
type: "session.updated",
|
|
418
|
+
atMs: 100,
|
|
419
|
+
session: { turnDetection: { createResponse: false, interruptResponse: false } },
|
|
420
|
+
source: { transport: "openai-realtime-control", id: "ws-1" },
|
|
421
|
+
},
|
|
422
|
+
{ type: "response.requested", atMs: 120, correlationId: "greeting", source: { transport: "openai-realtime-control", id: "ws-1" } },
|
|
423
|
+
{ type: "assistant.audio.started", atMs: 720, correlationId: "greeting", source: { transport: "openai-sip", id: "sip-call-1" } },
|
|
424
|
+
{ type: "assistant.audio.done", atMs: 1_820, correlationId: "greeting", source: { transport: "openai-sip", id: "sip-call-1" } },
|
|
425
|
+
{
|
|
426
|
+
type: "assistant.transcript.done",
|
|
427
|
+
atMs: 1_840,
|
|
428
|
+
correlationId: "greeting",
|
|
429
|
+
text: "Hey Ari, I am checking the weather now.",
|
|
430
|
+
source: { transport: "openai-realtime-control", id: "ws-1" },
|
|
431
|
+
},
|
|
432
|
+
{
|
|
433
|
+
type: "user.transcript.done",
|
|
434
|
+
atMs: 2_200,
|
|
435
|
+
correlationId: "user-1",
|
|
436
|
+
text: "Can you check the weather and then hang up?",
|
|
437
|
+
source: { transport: "twilio-media-stream", id: "stream-1" },
|
|
438
|
+
},
|
|
439
|
+
{ type: "response.requested", atMs: 2_480, correlationId: "user-1", source: { transport: "openai-realtime-control", id: "ws-1" } },
|
|
440
|
+
{ type: "assistant.audio.started", atMs: 2_540, correlationId: "user-1", source: { transport: "openai-sip", id: "sip-call-1" } },
|
|
441
|
+
{ type: "assistant.audio.done", atMs: 2_820, correlationId: "user-1", source: { transport: "openai-sip", id: "sip-call-1" } },
|
|
442
|
+
{ type: "tool.call.started", atMs: 3_000, correlationId: "tool-1", toolName: "weather_lookup", source: { transport: "openai-realtime-control", id: "ws-1" } },
|
|
443
|
+
{ type: "tool.holding.started", atMs: 3_260, correlationId: "tool-1", text: "One sec, checking.", source: { transport: "openai-sip", id: "sip-call-1" } },
|
|
444
|
+
{ type: "tool.call.completed", atMs: 3_800, correlationId: "tool-1", toolName: "weather_lookup", source: { transport: "openai-realtime-control", id: "ws-1" } },
|
|
445
|
+
{ type: "barge_in.detected", atMs: 4_100, source: { transport: "twilio-media-stream", id: "stream-1" } },
|
|
446
|
+
{ type: "transport.playback_cleared", atMs: 4_140, source: { transport: "twilio-media-stream", id: "stream-1" } },
|
|
447
|
+
{ type: "response.truncated", atMs: 4_170, source: { transport: "openai-realtime-control", id: "ws-1" } },
|
|
448
|
+
{ type: "call.hangup.requested", atMs: 5_000, source: { transport: "openai-realtime-control", id: "ws-1" } },
|
|
449
|
+
{ type: "call.ended", atMs: 5_100, source: { transport: "openai-sip", id: "sip-call-1" } },
|
|
450
|
+
];
|
|
451
|
+
}
|
|
452
|
+
function buildVoiceRealtimeEvalDefaultExpectation() {
|
|
453
|
+
return {
|
|
454
|
+
maxFirstAssistantAudioMs: 1_200,
|
|
455
|
+
maxUserTurnResponseMs: 900,
|
|
456
|
+
maxToolPresenceMs: 600,
|
|
457
|
+
maxBargeInClearMs: 120,
|
|
458
|
+
maxBargeInTruncateMs: 180,
|
|
459
|
+
requireManualFloorControl: true,
|
|
460
|
+
requireFriendContext: {
|
|
461
|
+
friendId: "friend-ari",
|
|
462
|
+
sessionKey: "twilio-phone-friend-ari-via-ouro",
|
|
463
|
+
marker: "trust=family",
|
|
464
|
+
},
|
|
465
|
+
requireHangup: true,
|
|
466
|
+
requiredTranscripts: [
|
|
467
|
+
{ role: "user", contains: "weather" },
|
|
468
|
+
{ role: "assistant", contains: "checking the weather" },
|
|
469
|
+
],
|
|
470
|
+
};
|
|
471
|
+
}
|
|
472
|
+
function buildKnownBadLatencyPath() {
|
|
473
|
+
return buildVoiceRealtimeEvalHappyPath().map((event) => {
|
|
474
|
+
if (event.type === "assistant.audio.started" && event.correlationId === "greeting")
|
|
475
|
+
return { ...event, atMs: 1_900 };
|
|
476
|
+
if (event.type === "response.requested" && event.correlationId === "user-1")
|
|
477
|
+
return { ...event, atMs: 3_500 };
|
|
478
|
+
return event;
|
|
479
|
+
});
|
|
480
|
+
}
|
|
481
|
+
function runBuiltInVoiceRealtimeEvalSuite() {
|
|
482
|
+
const expectation = buildVoiceRealtimeEvalDefaultExpectation();
|
|
483
|
+
return [
|
|
484
|
+
gradeVoiceRealtimeEvalTimeline("voice-happy-path", buildVoiceRealtimeEvalHappyPath(), expectation),
|
|
485
|
+
gradeVoiceRealtimeEvalTimeline("voice-known-bad-latency", buildKnownBadLatencyPath(), expectation),
|
|
486
|
+
];
|
|
487
|
+
}
|
|
488
|
+
function summarizeVoiceRealtimeEvalSuite(reports) {
|
|
489
|
+
const failedScenarioIds = reports.filter((report) => !report.passed).map((report) => report.scenarioId);
|
|
490
|
+
return {
|
|
491
|
+
passed: reports.length - failedScenarioIds.length,
|
|
492
|
+
failed: failedScenarioIds.length,
|
|
493
|
+
total: reports.length,
|
|
494
|
+
failedScenarioIds,
|
|
495
|
+
};
|
|
496
|
+
}
|