Implementation:23blocks OS Ai maestro Signal Collection
Appearance
| Knowledge Sources | |
|---|---|
| Domains | Status_Presence, Signal_Collection |
| Last Updated | 2026-10-26 10:00 GMT |
Overview
Concrete tool for collecting raw activity signals from hooks and transcript files, provided by AI Maestro's `lib/agent-presence.ts`, `lib/transcript-codex.mjs`, and `lib/observed-permission.mjs`.
Description
These are the signal-collecting functions that feed the activity feed:
- hookNeedsYou (agent-presence.ts): checks if the hook report means the agent is blocked on the user (permission_request or waiting_for_input with a blocking notification type).
- codexLiveStatusFromFile (transcript-codex.mjs): reads the tail of a Codex transcript JSONL file to extract the live status string. Reads only `tailBytes` (default 64KB) from the end.
- observedPermissionVerdict (observed-permission.mjs): inspects pane text to decide whether a permission dialog is still open ('keep'), was answered and the agent is working ('active'), or was dismissed ('idle').
Usage
These are internal functions called by the activity feed aggregation and the status normalisation logic. They are not called directly from API routes.
Code Reference
Source Location
- Repository: ai-maestro
- File: lib/agent-presence.ts (L40-44 hookNeedsYou), lib/transcript-codex.mjs (L254-269 codexLiveStatusFromFile), lib/observed-permission.mjs (L37-43 observedPermissionVerdict)
Signature
export function hookNeedsYou(
hookStatus?: string | null,
notificationType?: string | null
): boolean
export function codexLiveStatusFromFile(
filePath: string,
tailBytes: number = 65536
): string | null
export function observedPermissionVerdict(
opts: { ageMs: number; paneText: string }
): { verdict: 'keep' | 'active' | 'idle'; reason: string } | null
Import
import { hookNeedsYou } from '@/lib/agent-presence'
import { codexLiveStatusFromFile } from '@/lib/transcript-codex.mjs'
import { observedPermissionVerdict } from '@/lib/observed-permission.mjs'
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| hookStatus | string | No (hookNeedsYou) | Raw hook status word |
| filePath | string | Yes (codex) | Codex transcript JSONL file |
| opts.ageMs | number | Yes (observed) | Age of observation in ms |
| opts.paneText | string | Yes (observed) | tmux pane text |
Outputs
| Name | Type | Description |
|---|---|---|
| hookNeedsYou() returns | boolean | true if agent is blocked on user |
| codexLiveStatusFromFile() returns | null | Live status string |
| observedPermissionVerdict() returns | null | verdict: keep, active, or idle |
Usage Examples
import { hookNeedsYou } from '@/lib/agent-presence'
import { codexLiveStatusFromFile } from '@/lib/transcript-codex.mjs'
// Check if a hook status means the agent needs the user
const blocked = hookNeedsYou('waiting_for_input', 'permission_prompt')
if (blocked) showNeedsYouBadge(agent)
// Read Codex live status from transcript
const status = codexLiveStatusFromFile('/path/to/codex/rollout.jsonl')
Related Pages
Implements Principle
Page Connections
Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment