voicetools

package
v0.74.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 2, 2026 License: Apache-2.0 Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package voicetools binds an agentbridge.Agent to the voice agent's tool surface with the "Call GPT" semantics (owner decision 2026-08-10, AI-VOICE-SPEECHKIT-TARGET.md External Coding Agent Bridge):

  • The bridge is NEVER a standing default. No agent process exists until the user explicitly places the call ("Call GPT") mid-conversation.
  • Task tools (gpt_task/gpt_status/gpt_steer/gpt_stop) work only during an active call and fail closed with a speakable hint otherwise.
  • hang_up_gpt — or the idle timeout — tears the agent process down again. Threads stay resumable across calls.
  • Approval decisions are deliberately NOT a tool: the model can announce a pending approval, but only the host UI answers it (Coordinator.RespondApproval, wired to the overlay card in the device adapter).
  • The model alone can never start agent work: call_gpt and every gpt_task/gpt_steer block on Notifier.ConfirmAction, a host-side confirmation the model cannot answer; no answer within Policy.ConfirmTimeout means deny.
  • Agent output (item summaries, agent messages, agent errors) is handed to the host as Narration.AgentOutput — untrusted data the host must frame as such, never as a trusted host prompt.

Stability: Experimental — may change in any release.

Index

Constants

View Source
const (
	ToolCallGPT   = "call_gpt"
	ToolHangUpGPT = "hang_up_gpt"
	ToolGPTTask   = "gpt_task"
	ToolGPTStatus = "gpt_status"
	ToolGPTSteer  = "gpt_steer"
	ToolGPTStop   = "gpt_stop"
)

Tool names the model sees. call_gpt is the only entry point; everything else requires the active call.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action added in v0.74.0

type Action struct {
	Tool    string // ToolCallGPT | ToolGPTTask | ToolGPTSteer
	Project string // project alias (gpt_task)
	Path    string // project directory (gpt_task)
	Sandbox agentbridge.SandboxMode
	Text    string // the prompt (gpt_task) or instruction (gpt_steer)
}

Action describes a model-requested action awaiting user confirmation. Every field is shown to the user verbatim.

type Coordinator

type Coordinator struct {
	// contains filtered or unexported fields
}

Coordinator owns the call lifecycle: one optional agent process, its event pump, the idle timer, and the state gpt_status reports.

func New

func New(policy Policy, newAgent func() agentbridge.Agent, notifier Notifier, logger *slog.Logger) *Coordinator

New wires a Coordinator. newAgent is invoked once per call (and the agent closed on hang-up), so no process outlives a call.

func (*Coordinator) CallActive

func (c *Coordinator) CallActive() bool

CallActive reports whether a call is currently open.

func (*Coordinator) Close

func (c *Coordinator) Close()

Close hangs up if needed. Safe to call repeatedly.

func (*Coordinator) RespondApproval

func (c *Coordinator) RespondApproval(ctx context.Context, id string, d agentbridge.Decision) error

RespondApproval answers a pending approval from the HOST UI (overlay card). Deliberately not exposed as a model tool.

func (*Coordinator) Tools

func (c *Coordinator) Tools() []agentkit.Tool

Tools returns the six-call tool surface for agentkit registration.

type Narration added in v0.74.0

type Narration struct {
	Text        string
	AgentOutput string
}

Narration is one progress line for the voice session. Text is authored by this package (trusted, e.g. "GPT is done"); AgentOutput is text that came from the coding agent — derived from repository content the agent read — and must be passed to the model as clearly delimited untrusted data.

func (Narration) String added in v0.74.0

func (n Narration) String() string

String renders the line for display surfaces (transcript, logs).

type Notifier

type Notifier interface {
	Narrate(Narration)
	AnnounceApproval(agentbridge.ApprovalRequest)
	// ConfirmAction asks the USER (an on-screen card, never the model or a
	// spoken answer) whether the model-requested action may run. It blocks
	// until the user decides or ctx ends; anything but an explicit approval
	// must return false.
	ConfirmAction(ctx context.Context, action Action) bool
}

Notifier is the host sink for narration, approval announcements and action confirmations. The device adapter delivers Narrate to the voice session only while it is listening; AnnounceApproval renders the overlay card.

type Policy

type Policy struct {
	// Enabled mirrors the double config gate; false hides nothing but makes
	// call_gpt refuse with a speakable reason (the tool list is static per
	// session on most realtime providers).
	Enabled bool
	// Projects is the allowlist; gpt_task resolves aliases against it and
	// refuses anything else.
	Projects []Project
	// DefaultSandbox caps every turn; effective = min(default, project).
	DefaultSandbox agentbridge.SandboxMode
	// CallIdleHangup ends the call after inactivity (default 10 minutes).
	CallIdleHangup time.Duration
	// NarrationMinInterval rate-limits progress narration (default 20s).
	// Terminal events (done, error, approval) always narrate.
	NarrationMinInterval time.Duration
	// ConfirmTimeout bounds how long call_gpt, gpt_task and gpt_steer wait
	// for the user's on-screen confirmation before denying (default 2m).
	ConfirmTimeout time.Duration
}

Policy is the fail-closed gate for the tool surface.

type Project

type Project struct {
	Alias   string
	Path    string
	Sandbox agentbridge.SandboxMode
}

Project is one allowlisted working directory (mirrors the [agent_bridge.codex.projects] config entries).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL