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.
56 lines • 3.4 kB
TypeScript
import type { StartAgentKind, StartAgentOptions } from './dashboard/index.js';
/**
* The dashboard's process API to a session it spawns (D4).
*
* This used to be twenty-seven command-line flags. `StartAgentOptions` was serialized onto an argv
* — every field carrying a "maps to `--x`" comment — which made the dashboard's IPC format and the
* CLI's human surface the same thing. That is what forced the flags to be mutually validated,
* documented in a 140-line help text, and tri-stated: `--auto-open-pr` / `--no-auto-open-pr` both
* had to exist because argv has no way to say `false`, only "present" and "absent".
*
* JSON has a real `false`, so none of that is needed. The dashboard writes this blob to a temp
* file and spawns `framework --agent <path>`; the child reads it, deletes it, and runs. The
* flags are gone, the `--no-*` pairs with them, and the CLI is left with the four options a human
* actually types.
*/
export interface AgentSpec {
/** What the session is asked to do. Empty is allowed for `research`, which has its own default. */
prompt: string;
/** Build from an intent, run one prompt verbatim, or run the Research preset. */
kind: StartAgentKind;
/** The checkout the session runs in: a worktree, or the project itself. */
cwd: string;
/** The id its worktree is named with, so the directory and the agent recorded inside it are one string. */
agentId?: string;
/** Reopen `agentId`'s log instead of truncating it: the follow-up IS that agent (#762). */
continueAgent?: boolean;
/** Everything the launcher's options gear and Settings decide about the session. */
options: StartAgentOptions;
}
/**
* Write a spec and return its path, for `framework --agent <path>`.
*
* A file rather than a pipe or an fd: the child is spawned detached with its stdio closed, so
* there is no channel to inherit, and a path survives the spawn without either side blocking on
* the other. The child removes it once read, so a spec never outlives the session it started.
*/
export declare function writeAgentSpec(spec: AgentSpec, env?: NodeJS.ProcessEnv): Promise<string>;
/**
* Remove a spec — and the directory {@link writeAgentSpec} made for it, or removing one spec per
* session would leave one empty directory per session behind forever. Only a directory this
* module verifiably made goes whole: it must carry the mkdtemp prefix AND sit directly in the
* configured spec home. `--agent <path>` accepts any path, and neither a hand-written spec nor a
* user's own directory that happens to be named like ours may be taken with the file.
*
* Also the cleanup for a spawn whose child never consumed the spec — the spawn failed outright,
* or the child died before reading it — which otherwise left the whole prompt sitting on disk.
* Idempotent: removing a spec an exiting child already consumed is a no-op.
*/
export declare function removeAgentSpec(path: string, env?: NodeJS.ProcessEnv): Promise<void>;
/**
* Read a spec, and remove it. Consumed rather than merely read: it is a one-shot handoff, and a
* session's options can name a device token (`options.remote`), which has no business staying on
* disk after the session that used it has started.
*/
export declare function readAgentSpec(path: string, env?: NodeJS.ProcessEnv): Promise<AgentSpec>;
//# sourceMappingURL=agent-spec.d.ts.map