Implementation:23blocks OS Ai maestro Wake Flow
| Knowledge Sources | |
|---|---|
| Domains | Agent_Orchestration, UX_Flow |
| Last Updated | 2026-10-26 10:00 GMT |
Overview
Concrete tool for deciding whether an agent can be woken in one click and summarizing the wake action, provided by AI Maestro's `lib/wake-flow.ts`.
Description
The canWakeInOneClick function checks whether an agent already has a recorded tool (its `program` field is non-empty), meaning waking it needs no dialog. The oneClickWakeOptions function determines what a one-click wake sends: the stored permission mode for a tool that can honour it, and `remember: false`. wakeSummary produces a readable summary ("Claude Code, asks before changes") for the toast.
Usage
Call these functions to decide whether to show the wake dialog or wake directly, and to render the wake toast.
Code Reference
Source Location
- Repository: ai-maestro
- File: lib/wake-flow.ts (L19-21, L28-34, L46-49)
Signature
export function canWakeInOneClick(agent: WakeableAgent): boolean
export function oneClickWakeOptions(
agent: WakeableAgent
): WakeChoiceOptions & { permissionMode?: AgentPermissionMode }
export function wakeSummary(agent: WakeableAgent): string
interface WakeableAgent {
program?: string
permissionMode?: string
}
Import
import { canWakeInOneClick, oneClickWakeOptions, wakeSummary } from '@/lib/wake-flow'
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| agent.program | string | Yes | Recorded tool command |
| agent.permissionMode | string | No | Stored permission mode |
Outputs
| Name | Type | Description |
|---|---|---|
| canWakeInOneClick() returns | boolean | true when agent has a recorded tool |
| oneClickWakeOptions() returns | WakeChoiceOptions | permissionMode + remember:false |
| wakeSummary() returns | string | Human-readable tool + mode summary |
Usage Examples
import { canWakeInOneClick, wakeSummary } from '@/lib/wake-flow'
const agent = { program: 'claude', permissionMode: 'supervised' }
if (canWakeInOneClick(agent)) {
// Skip dialog, wake directly with stored options
console.log(`Waking with: ${wakeSummary(agent)}`)
} else {
// Show wake dialog (first wake, no recorded tool)
}