@securecoms/agent-bridge 0.11.2 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/README.md +75 -0
  2. package/dist/bin.js +2657 -93
  3. package/dist/bridge-agent.d.ts +331 -0
  4. package/dist/config.d.ts +3 -0
  5. package/dist/errors.d.ts +1 -1
  6. package/dist/http-server.d.ts +4 -4
  7. package/dist/index.js +2674 -112
  8. package/dist/memory-taps.d.ts +6 -2
  9. package/dist/rate-limit.d.ts +10 -0
  10. package/dist/sodium-ready.d.ts +16 -8
  11. package/dist/summarize.d.ts +54 -0
  12. package/dist/voice/fast-client.d.ts +13 -0
  13. package/dist/voice/fast-prompt.d.ts +53 -0
  14. package/dist/voice/persona.d.ts +23 -0
  15. package/dist/voice/prompt-compiler.d.ts +4 -0
  16. package/dist/voice/settings.d.ts +31 -0
  17. package/package.json +7 -1
  18. package/dist/attachments.js +0 -49
  19. package/dist/auth.js +0 -56
  20. package/dist/bin.js.pre-c1-f803007 +0 -5795
  21. package/dist/bin.js.pre-c3-096a9a3 +0 -5832
  22. package/dist/bin.js.pre-ffrebuild-b162d4a +0 -5639
  23. package/dist/bin.js.pre-kpheal-20260708-150924 +0 -5531
  24. package/dist/bin.js.pre-kppersist-20260708-152341 +0 -5543
  25. package/dist/bin.js.pre-p0-20260708-102415 +0 -5196
  26. package/dist/bin.js.pre-p1b-02f47e1 +0 -5639
  27. package/dist/bin.js.pre-warmfix-20260708-153705 +0 -5613
  28. package/dist/bin.js.pretrace-113205 +0 -5395
  29. package/dist/bridge-agent.js +0 -831
  30. package/dist/config.js +0 -74
  31. package/dist/coordination.js +0 -63
  32. package/dist/errors.js +0 -25
  33. package/dist/http-server.js +0 -220
  34. package/dist/index.js.pre-p0-20260708-102415 +0 -4879
  35. package/dist/latency.js +0 -87
  36. package/dist/rate-limit.js +0 -56
  37. package/dist/service/config.js +0 -26
  38. package/dist/service/install.js +0 -60
  39. package/dist/service/launchd.js +0 -30
  40. package/dist/service/systemd.js +0 -25
  41. package/dist/ws-server.js +0 -254
package/README.md CHANGED
@@ -404,6 +404,81 @@ attachments: the cryptography lives in the daemon, not the agent.
404
404
 
405
405
  ---
406
406
 
407
+ ## Voice fast path
408
+
409
+ On a live voice call, the daemon can send an instant, persona-voiced
410
+ one-sentence acknowledgement while your full agent harness is still thinking —
411
+ so the human hears *something* immediately instead of dead air.
412
+
413
+ **The credential file's `voice` block is now a fallback, not the primary
414
+ source.** As of `@securecoms/agent-bridge` 0.13.0, the daemon fetches this
415
+ agent's voice settings from the backend (`GET /api/v1/agents/{identity_id}/voice-settings`)
416
+ on start and again whenever it receives a `voice_settings_changed` ping, and
417
+ prefers that backend row whenever its `version` is ≥ 1 — an owner has saved
418
+ settings from the web app's "Voice settings" page (`/app/agents/:identityId/voice`).
419
+ A `version: 0` response (nothing saved yet) keeps the file's persona/voice/pace
420
+ as a default, but **the fast-path LLM call goes through the SecureComs
421
+ backend proxy** (`POST /api/v1/voice/fast-complete`) whenever the settings
422
+ fetch itself succeeds — `voice_settings_source` is `"backend"`, or `"file"`
423
+ with `version: 0` — and in that case the file's own
424
+ `fast_path.api_key`/`base_url`/`model` are ignored; only the file's `persona`
425
+ and `enabled` flag still matter, as the fallback source for those fields. The
426
+ daemon needs no API key of its own for the proxied path — the backend proxy
427
+ holds `OPENROUTER_API_KEY` and does the call. **If the settings fetch itself
428
+ fails at boot** (network error, backend down), the daemon has no proxy config
429
+ to fall back to and instead falls back to the file's own `fast_path` block
430
+ in full, including its `api_key`/`api_key_env`/`base_url`/`model` — the
431
+ daemon then calls your own model provider directly with that key until a
432
+ later fetch succeeds.
433
+
434
+ Check which source is active via the daemon's health endpoint:
435
+ ```bash
436
+ curl -H "Authorization: Bearer $(cat <credential-dir>/bridge-token)" \
437
+ http://127.0.0.1:7077/healthz | jq '.voice_settings_version, .voice_settings_source'
438
+ ```
439
+ `voice_settings_source` is `"backend"` (a saved row won), `"file"` (fell back
440
+ to the credential file's `voice` block), or `"none"` (neither is configured).
441
+
442
+ Add a `voice` block to `agent.json` (used only as the fallback described above):
443
+
444
+ ```json
445
+ "voice": {
446
+ "persona": { "display_name": "Cortina",
447
+ "persona": "You are Cortina, a crisp, warm operations lead who co-owns AgentVault with Eric and Chris.",
448
+ "quirks": ["opens with 'Right —' when sure", "asks one clarifying question instead of guessing"] },
449
+ "fast_path": { "enabled": true, "base_url": "https://api.openai.com/v1", "model": "gpt-4o-mini",
450
+ "api_key_env": "SECURECOMS_VOICE_LLM_KEY", "timeout_ms": 2500, "max_tokens": 80 }
451
+ }
452
+ ```
453
+
454
+ - `persona` describes how the fast-path model should speak; it is folded into
455
+ a compiled-in system prompt shared with the daemon's other voice guidance.
456
+ - `fast_path.api_key_env` names an environment variable holding your LLM
457
+ provider's API key (e.g. `SECURECOMS_VOICE_LLM_KEY`); `api_key` accepts one
458
+ inline instead, but the env-var form is preferred so the key never lives in
459
+ the credential file. Without a resolvable key, the fast path stays disabled
460
+ even if `enabled: true`.
461
+ - `fast_path.base_url` must be `https://` or a loopback (`127.0.0.1` /
462
+ `localhost` / `::1`) `http://` URL — the daemon refuses any other
463
+ non-loopback plaintext endpoint, the same rule it applies to itself.
464
+ - Only a genuine live voice turn from a human (or unknown) sender fires the
465
+ fast path; it never fires for the agent's own relayed turns, and a fast-path
466
+ failure (timeout, network, bad response) is fail-soft — it never blocks or
467
+ delays your full agent's reply.
468
+
469
+ **The fast-path call runs through the SecureComs backend proxy — your own
470
+ model key never pays for it — whenever the settings fetch succeeds** (the
471
+ `fast_path.api_key`/`api_key_env`/`base_url`/`model` fields above are
472
+ ignored whenever `voice_settings_source` is `"backend"`, or `"file"` with
473
+ `version: 0`; they only take effect again if the settings fetch fails at
474
+ boot, in which case the daemon falls back to the file's own `fast_path`
475
+ including its key). Each proxied call is metered server-side
476
+ (`voice_fast_completions` table; `usage_daily` metrics `fast_voice_calls`,
477
+ `fast_voice_tokens_in`, `fast_voice_tokens_out`), capped at
478
+ `VOICE_FAST_CALLS_PER_MINUTE` (default 60) per agent.
479
+
480
+ ---
481
+
407
482
  ## Flags and environment
408
483
 
409
484
  | Flag | Env var | Default | Description |