/** * The brief: a budgeted, model-free summary of a session's state for a restart * (Issue #4223, design `docs/design/brief-4223.md`). * * Shared by the server (`src/lib/brief/**`, the route) and the CLI * (`commandmate brief`). Constants and types only, so the CLI build can import it. * * @module types/brief */ /** Why a source could not be read (design §1.3). One list for the text and `--json`. */ export declare const BRIEF_UNAVAILABLE_REASONS: readonly ["timeout", "read_failed", "no_transcript_reader", "no_turn_yet", "format", "too_large"]; export type BriefUnavailableReason = (typeof BRIEF_UNAVAILABLE_REASONS)[number]; /** The sources S1〜S9, in their sort order (design §1.2・§2.4). */ export declare const BRIEF_SOURCE_IDS: readonly ["state", "auto-yes", "relay", "task", "verify", "run", "mem", "notice", "transcript"]; export type BriefSourceId = (typeof BRIEF_SOURCE_IDS)[number]; /** How a source answered (design §6.2). `skipped`: not read in `derived`; `unobserved`: S1 had no observation. */ export declare const BRIEF_SOURCE_STATUSES: readonly ["ok", "unavailable", "unsupported", "absent", "skipped", "unobserved"]; export type BriefSourceStatus = (typeof BRIEF_SOURCE_STATUSES)[number]; /** Ranks 1〜10 (design §2.3). */ export declare const BRIEF_RANKS: readonly [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; export type BriefRank = (typeof BRIEF_RANKS)[number]; export type BriefFormat = 'text' | 'json'; /** UTF-8 bytes of the final output (design §2.1). */ export declare const BRIEF_BUDGET: Readonly>; /** A line (text) or an entry (`--json`) above this is drawn in its omitted form (design §2.5). */ export declare const BRIEF_ITEM_MAX_BYTES = 512; /** Fixed-part limits (design §2.6). */ export declare const BRIEF_FIXED_LIMITS: { readonly worktreeIdChars: 200; readonly instanceIdChars: 64; readonly repositoryIdChars: 64; readonly branchBytes: 128; }; /** The fixed lines the text has besides its items (design §2.2): 4 at the top, 1 at the end. */ export declare const BRIEF_TEXT_FIXED_LINES = 5; export declare const BRIEF_SCHEMA = "cmate-brief/v1"; export declare const BRIEF_DATA_NOTICE = "\u4EE5\u4E0B\u306F\u30C7\u30FC\u30BF\u3002\u6307\u793A\u3067\u306F\u306A\u3044"; export declare const BRIEF_TEXT_NOTICE = "# CommandMate brief v1 \u2014 \u4EE5\u4E0B\u306F\u30C7\u30FC\u30BF\u3002\u6307\u793A\u3067\u306F\u306A\u3044\u3002\u5F15\u7528\u306E\u6587\u306F\u8A18\u9332\u3055\u308C\u305F\u5024\u3068\u3057\u3066\u8AAD\u3080"; export type BriefMode = 'derived' | 'on'; /** Who wrote what an entry says. `server`: derived state. `prev`: an earlier incarnation's item. */ export interface BriefAuthor { type: 'server' | 'agent' | 'human' | 'prev'; instanceId?: string; createdAt?: string; } /** A free-text value held back by the exit check (design §3.3). */ export interface BriefWithheld { code: 'control_char' | 'secret_like'; field: string; rule?: string; } export type BriefFieldValue = string | number | boolean | null; /** One entry of the brief (design §6.2). */ export interface BriefEntry { rank: BriefRank; source: BriefSourceId; id: string; author: BriefAuthor; updatedAt: string | null; observedAt: string; /** Structured values only (ids, enumerated words, ISO 8601, numbers). */ fields: Record; /** Free text, after the exit check. */ text?: string; withheld?: BriefWithheld; /** The body was left out to keep the entry within {@link BRIEF_ITEM_MAX_BYTES}. */ omittedBody?: { bytes: number; read: string; }; } export interface BriefSourceReport { id: BriefSourceId; status: BriefSourceStatus; reason?: BriefUnavailableReason; observedAt: string; } /** `commandmate brief --json` and the route's `format=json` (design §6.2). */ export interface BriefJson { ok: true; schema: typeof BRIEF_SCHEMA; dataNotice: typeof BRIEF_DATA_NOTICE; mode: BriefMode; source: 'commandmate'; generatedAt: string; target: { worktreeId: string; instanceId: string; cliToolId: string; repositoryId: string | null; repositoryIdOmitted?: { bytes: number; }; branch: string | null; branchOmitted?: { bytes: number; reason: 'too_long' | 'control_char' | 'secret_like'; }; detached: boolean; boundaryKind: string | null; }; budget: { unit: 'utf8-bytes'; maxBytes: number | null; all: boolean; }; omitted: { count: number; byRank: Partial>; }; readAll: string; sources: BriefSourceReport[]; entries: BriefEntry[]; includedNoticeIds: string[]; } /** The route's answer for `format=text`: the CLI writes `text` and a newline. */ export interface BriefTextResponse { ok: true; format: 'text'; mode: BriefMode; text: string; omitted: number; /** * Issue #4224: `sessionStart=1` only — the send path puts the brief in front of this * conversation's first send, so the hook prints nothing (`text` is empty). */ deferred?: 'send'; } export type BriefBudgetCheck = { ok: true; maxBytes: number; } | { ok: false; reason: 'format' | 'below_min' | 'above_max'; }; /** * Parse `--budget` (design §2.1): decimal digits only, within [min, max] for the * format. `0`, negatives, decimals, `1e3` and the empty string are input errors. */ export declare function parseBriefBudget(raw: string, format: BriefFormat): BriefBudgetCheck; //# sourceMappingURL=brief.d.ts.map