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.
89 lines • 4.95 kB
TypeScript
import type { FrameworkEvent } from './events.js';
import { type ProjectRuntimeOptions } from './daemon-runtime.js';
import { JsonlTailer } from './jsonl-tail.js';
import { isLoopbackHost } from './loopback-host.js';
/**
* The dashboard process (#302). It is a pure projection of the store: a session appends its
* events to `.the-framework/events.jsonl`, and the dashboard *tails* that file, pushing each
* new event to connected browsers. No session<->dashboard IPC — the file is the seam, matching
* "the dashboard is a projection of the event stream". Steering goes the other way through
* `.the-framework/control.jsonl` (#344).
*
* It runs in the foreground and only in the foreground: Ctrl-C closes the dashboard and every
* session it is running. There is no detached mode, so there is no liveness record, no
* machine-global state file, and no second process to find, reuse or stop.
*
* Sessions and steering are keyed per project: it spawns each session with `--cwd <project
* path>` and appends its control entries to that project's own `control.jsonl`. Its own `cwd`
* is just the home project it streams by default.
*/
/** The default dashboard port the daemon binds. */
export declare const DEFAULT_DAEMON_PORT = 4200;
/** The default bind host (#1051): localhost only, so the daemon is unreachable off the machine. */
export declare const DEFAULT_DAEMON_HOST = "127.0.0.1";
/**
* True when `host` is a loopback address the browser reaches without leaving the machine (#1051).
* Defined in its own leaf module so the dashboard's RPC mount can share the one definition without
* importing this one back (a cycle); re-exported here for the callers that already had it.
*/
export { isLoopbackHost };
/** Where the dashboard came up, reported to {@link RunDaemonOptions.onListening}. */
export interface DaemonState {
/** The daemon process id. */
pid: number;
/** The port the dashboard is bound to. */
port: number;
/** The URL to open. */
url: string;
/** ISO timestamp the daemon started. */
startedAt: string;
/** The host the dashboard is bound to (#1051). */
host?: string;
}
/** True when `child` lives strictly inside `parent` (not equal, not outside). */
export declare function isNestedWithin(child: string, parent: string): boolean;
/**
* Make sure an activated home workspace shows up in the Projects list (#392). Best-effort
* and idempotent (addProject dedupes by path), so it never blocks the daemon coming up.
*
* Skips a cwd that lives inside an already-tracked project (#647): the daemon creates
* `.the-framework/` for its own state, so running it from a subfolder of a repo (e.g. the
* package dir the binary lives in) would otherwise keep re-adding a nested duplicate.
*/
export declare function registerHomeProject(cwd: string, env?: NodeJS.ProcessEnv): Promise<void>;
/** True when a process with this id is still running (best-effort, signal 0). The store's
* {@link isPidAlive} under the daemon's historical public name -- the two were byte-identical. */
export { isPidAlive as isProcessAlive } from './store/index.js';
/**
* Tails the append-only `.the-framework/events.jsonl` agent log. The generic tailing
* lives in {@link JsonlTailer}; this keeps the event-typed name the daemon (and
* public API) always had.
*/
export declare class EventTailer extends JsonlTailer<FrameworkEvent> {
}
/** Options for {@link runDaemon}. */
export interface RunDaemonOptions {
/** Port to bind. Default {@link DEFAULT_DAEMON_PORT}; pass `0` for an ephemeral port. */
port?: number;
/** Host to bind (#1051). Default {@link DEFAULT_DAEMON_HOST}; a non-loopback address generates and
* requires the shared token, and every route is then gated behind it. */
host?: string;
/** Shut the daemon down when this aborts (in addition to SIGINT/SIGTERM). For tests. */
signal?: AbortSignal;
/** The CLI entry script to re-invoke for a dashboard-started agent (#345). Default `process.argv[1]`. */
binPath?: string;
/** Env the registry is read from. Default `process.env`; injectable for tests. */
env?: NodeJS.ProcessEnv;
/** How a start checks the picked agent can run (#1326); default the real `preflight`. For tests. */
driverPreflight?: ProjectRuntimeOptions['driverPreflight'];
/** Called once the server has bound, before it blocks. The only way a caller learns the port. */
onListening?: (state: DaemonState) => void;
}
/**
* The daemon body, run in the foreground by bare `framework`. Serves the built dashboard bundle
* (#405/#426): the SPA reads each project's `.the-framework/events.jsonl` over an event stream and
* steers over control.jsonl, so the daemon just serves the files and spawns sessions. Resolves on
* SIGINT/SIGTERM after tearing the dashboard down.
*/
export declare function runDaemon(cwd: string, opts?: RunDaemonOptions): Promise<void>;
//# sourceMappingURL=daemon.d.ts.map