UNPKG

framework

Version:

The (AI) Framework: turnkey, zero-config AI orchestration that wraps a coding-agent CLI (Claude Code) as a black box and takes you from an idea to a running app. Vite for AI.

98 lines 4.65 kB
import type { AutoHandoffSkip, FrameworkEvent } from './events.js'; /** The agent's lifecycle progress (#326): the session name it chose and whether it is ready for merge. */ export interface AgentProgress { /** The `[a-z0-9-]` session name (also the branch), once the agent set one via `setSessionName()`. */ sessionName?: string; /** True once the agent signalled `setReadyForMerge()`: building (false) -> ready (true). */ readyForMerge: boolean; } /** * The agent's lifecycle progress (#326): the latest `session-name` the agent set and whether * a `ready-for-merge` has fired. Drives the dashboard status label + dot (orange building, * green ready). Always returns a value — an untouched agent is `{ readyForMerge: false }`. */ export declare function agentProgress(events: readonly FrameworkEvent[]): AgentProgress; /** One error the agent reported through an `error` block (#1500). */ export interface AgentError { /** What is wrong, in one line. */ headline: string; /** What it ran and what that said, when the agent wrote any. */ detail?: string; } /** * Every error the agent reported (#1500), oldest first — the count the dashboard shows on the * session, and the latest headline it shows beside it. * * A fold over the log rather than state of its own: an error is an event that happened, so the * list only ever grows, and reopening a finished agent shows exactly what it showed while it ran. */ export declare function agentErrors(events: readonly FrameworkEvent[]): AgentError[]; /** What a session will do with its work when it ends (#1102), and what it did. */ export interface HandoffState { /** Push the branch to `origin` on finish. */ push: boolean; /** Open a draft PR on finish. Implies {@link push}. */ pr: boolean; /** * Merge the PR once opened (#1216) — armed at launch, no checkbox, never changes mid-run. * Unlike the pair above this defaults to off: merging is opt-in, so a stream from before the * event carried it (#1382) must not read as an agent that will land on main by itself. */ merge: boolean; /** How the handoff ended, once it has run. Absent while the session is still going. */ result?: { outcome: 'skipped'; reason: AutoHandoffSkip; } | { outcome: 'done'; url?: string; } | { outcome: 'failed'; error: string; }; } /** * What the session is armed to hand back, folded from its own events (#1102). * * Both halves start armed, so an agent from before this existed — which emits no `handoff-armed` — * reads as armed, which is what it will actually do once it is running new code. Latest wins: the * checkboxes re-emit on every change. * * `initial` seeds the armed pair for a reader whose event stream missed the opening * `handoff-armed` (#1376): the agent writes it as its very first event, before the live channel has * attached, so a live tab can only learn the real state from the agent record's mirror * (`AgentRecord.handoff`) — without it, a session the launcher armed push-only reads as "Open PR". * A `handoff-armed` event in the stream still wins: it is newer than any record snapshot. */ export declare function handoffState(events: readonly FrameworkEvent[], initial?: { push: boolean; pr: boolean; merge?: boolean; }): HandoffState; /** The wrapped agent session (#431): its id and a deep link, when one is known. */ export interface SessionInfo { driver?: string; fake?: boolean; sessionId?: string; sessionLink?: string; /** * The directory the agent ran in (#1195), from the opening `session` event. * * Taken from the event rather than the filesystem on purpose: an agent that finishes cleanly has * its worktree removed (`tearDownWorktree`), so the event is the only surviving record of where * the session lived — and that path is exactly what `claude --resume` needs to find it again. */ workspace?: string; /** * The model id the current leg's agent was started with (#1438). Folded per leg like the * driver/workspace: the latest `session` event wins, and a leg that recorded none clears it. */ model?: string; } /** * The session behind the agent (#431): the driver + workspace from the opening `session` * event, then the id and any deep link from the latest `session-update`. Null before the * session opens. The link is what the old dashboard surfaced as "open session". */ export declare function sessionInfo(events: readonly FrameworkEvent[]): SessionInfo | null; //# sourceMappingURL=agent-view.d.ts.map