> For the complete documentation index, see [llms.txt](https://ai-os-and-trend-finder.gitbook.io/ai-os-and-trend-finder-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ai-os-and-trend-finder.gitbook.io/ai-os-and-trend-finder-docs/.spec_system/prd/phase_41/session_05_voice_token_bootstrap.md).

# Session 05: Voice Token Bootstrap

**Session ID**: `phase41-session05-voice-token-bootstrap` **Status**: Not Started **Estimated Tasks**: \~12-25 **Estimated Duration**: 2-4 hours

***

## Objective

Make Start Voice and direct `bun run voice` token-ready without manual `AI_OS_VOICE_TOKEN` setup.

***

## Scope

### In Scope (MVP)

* Update `/__start_voice` launch behavior in `scripts/lib/voice-launch-bridge.ts`.
* Update `scripts/lib/voice-broker.ts`, `voice-lab/server.ts`, and direct `bun run voice` token bootstrap behavior.
* Preserve provider-key, browser credential, loopback, broker unavailability, and token failure states as named recoverable failures.
* Update voice launch, broker, server, direct command, and token failure tests.

### Out of Scope

* Intelligence portal UI action copy owned by Session 06.

***

## Prerequisites

* [ ] Sessions 01 through 03 are complete.

***

## Deliverables

1. Browser-launched voice and direct voice flows that are token-ready by default in local dev.
2. Visible recovery states for real provider, credential, broker, loopback, and token failures.
3. Tests proving automatic token readiness and failure recovery.

***

## Success Criteria

* [ ] Start Voice can reach `/__start_voice` in local dev without manual Hermes admin env setup.
* [ ] Direct `bun run voice` works without manual token configuration or returns a specific recoverable dependency failure.
* [ ] Voice tests cover success and failure paths.

***

## Folded Handoff Session Details

The following session-specific details were migrated from the former ongoing-projects handoff. They preserve the original objective, scope, outputs, dependencies, notes, and acceptance checks for this session.

#### Session 05: Voice Token Bootstrap

**Objective**: Make Start Voice and direct `bun run voice` token-ready without manual `AI_OS_VOICE_TOKEN` setup.

**Scope**:

* Update `scripts/lib/voice-launch-bridge.ts` so `/__start_voice` remains loopback and same-run-token protected but is not blocked by Hermes admin default-off state.
* Update `scripts/lib/voice-broker.ts`, `voice-lab/server.ts`, and the `bun run voice` path so direct local voice startup receives or mints the required token automatically.
* Keep provider-key, browser credential, loopback, broker unavailability, and token failure states explicit.
* Update voice launch, broker, server, direct command, and token failure tests.

**Outputs**:

* Browser-launched voice and direct `bun run voice` flows that are token-ready by default in local dev.
* Visible recovery states for missing provider keys, missing browser credentials, broker unavailability, loopback rejection, and token failure.
* Tests proving token bootstrap success and failure paths.

**Dependencies / Notes**:

* Depends on Sessions 01 through 03 so voice launch is decoupled from the old Hermes admin gate.
* Out of scope: Intelligence portal UI action copy, covered by Session 06.

**Acceptance Checks**:

* Start Voice can reach `/__start_voice` in local dev without manual Hermes admin env setup.
* Direct `bun run voice` works without manual `AI_OS_VOICE_TOKEN` configuration or returns a specific recoverable dependency failure.
* Voice tests prove both automatic token readiness and visible failure recovery.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://ai-os-and-trend-finder.gitbook.io/ai-os-and-trend-finder-docs/.spec_system/prd/phase_41/session_05_voice_token_bootstrap.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
