export interface ChannelContent { /** * Raw content bytes/string for this channel. Binary content awaits a future encoding pass (see AGENTS.md). */ content: string; mimetype: string; /** * Token count of `content` under the active model's tokenizer. */ tokens: number; } export type ClientStatement = (PlurnkStatement | LookStatement | BuffStatement); /** * The parsed AST of one plurnk statement. Discriminated on `op`. KILL, WORK, and FORK have no `` slot (`lineMarker` is always null for those); WORK and FORK also carry no signal (always null); SEND's `` slot is the `` park on a terminal [102] (wait up to T seconds, -1 = indefinite; null on mid-comms SENDs and other terminals); EXEC's `` slot carries an optional ``. `target` is the URI of the operand (parsed into ParsedPath structure); null when the operand slot was omitted. Body shape varies per op: matcher dialect for FIND/READ/OPEN/FOLD, raw string for EDIT/EXEC, ParsedPath for MOVE (destination URI), opaque raw string for COPY (a destination URI for entry copies, a prompt for worker forks — the scheme handler interprets it), SendBody for SEND, opaque annotation string for KILL (no assigned runtime meaning; lands in the log), reasoning text for PLAN (recorded to the log; no other effect), and an opaque task string for WORK (spawn a fresh named worker) and FORK (branch the current worker into a named child) — the `worker://` in target names the child. */ export type PlurnkStatement = (FindStatement | ReadStatement | OpenStatement | FoldStatement | EditStatement | CopyStatement | MoveStatement | SendStatement | ExecStatement | WorkStatement | ForkStatement | KillStatement | PlanStatement); /** * A parsed path slot from a plurnk statement. Discriminated on `kind`: a bare local path (no scheme), a fully decomposed URL, or a path-name regex (`#pattern#flags`) that matches entries by path rather than addressing one. */ export type ParsedPath = (LocalPath | UrlPath | RegexPath); /** * Parsed body of a FIND/READ/OPEN/FOLD statement, discriminated on `dialect`. The dialect is determined by the body's leading characters (`//` xpath, `#` regex, `$` jsonpath, `~` semantic, `@` graph, else glob). The regex variant carries pattern/flags split out of the `#pattern#flags` literal; the compiled `RegExp` object on the in-memory AST is a runtime ergonomic only and is not part of the persisted/wire contract. */ export type MatcherBody = (XPathBody | RegexBody | JsonPathBody | SemanticBody | GraphBody | GlobBody); export type TagSignal = (string[] | null); export type PathOrNull = (ParsedPath | null); export type LineMarkerOrNull = (LineMarker | null); export type MatcherBodyOrNull = (MatcherBody | null); export interface FindStatement { op: "FIND"; suffix: string; signal: (string[] | null); target: (ParsedPath | null); lineMarker: (LineMarker | null); body: (MatcherBody | null); position: Position; } /** * A bare local path with no `scheme://` prefix. The raw string is stored verbatim; resolution is the runtime's job. */ export interface LocalPath { kind: "local"; raw: string; } /** * A path with a `scheme://` prefix, fully decomposed via WHATWG URL. */ export interface UrlPath { kind: "url"; raw: string; scheme: string; username: (string | null); password: (string | null); hostname: (string | null); port: (number | null); pathname: string; params: Params; fragment: (string | null); /** * Request-metadata blocks split off the target — trailing `{key: value}` groups (e.g. `(https://api{Authorization: Bearer x})`). Ordered key/value pairs so order and duplicate names survive; opaque to the grammar's addressing, interpreted by the scheme handler (auth, content-type, method affordance). Absent when the target carries no `{...}` block. See #46. */ headers?: [string, string][]; } /** * URL query parameters parsed into a JSON object. Single-value keys map to strings; multi-value keys (repeated in the original query string) map to arrays of strings. Empty object when the URL has no query string; nullable usages wrap this schema in a oneOf with null. */ export interface Params { [k: string]: (string | string[]); } /** * A path-name regex `#pattern#flags` in the target slot — matches entries whose path matches the pattern, rather than addressing a single path. The leading `#` is the dispatch key (collision-free: `#channel` is a postfix, never a leading form). Pattern and flags are split out for direct use; `raw` preserves the literal. */ export interface RegexPath { kind: "regex"; raw: string; pattern: string; flags: string; } /** * A parsed `` slot: the ordered numeric components, verbatim. Signed numbers carry sentinel meaning (0 = prepend anchor, -1 = append anchor). Decimals address the spaces between (2.5 = after line 2) or, for `~` matchers, a similarity threshold in (0,1). Arity is interpretation, owned by the consumer: `[N]` = one position; `[N, M]` = a range; `[0.7, 10, 20]` = a thresholded range (score ≥ 0.7, positions 10–20). The grammar carries the numbers; it does not assign them roles. */ export interface LineMarker { /** * @minItems 1 */ marks: [number, ...(number)[]]; } /** * XPath 1.0 expression. Validated at parse time via the xpath library. */ export interface XPathBody { dialect: "xpath"; raw: string; } /** * JavaScript regex literal `#pattern#flags`. The `#` delimiter is collision-free against path `/` and regex's own `|` alternation. Pattern and flags are split out for direct use. `raw` preserves the literal form for round-tripping. */ export interface RegexBody { dialect: "regex"; raw: string; pattern: string; flags: string; } /** * JSONPath expression. Validated at parse time via jsonpath-plus. */ export interface JsonPathBody { dialect: "jsonpath"; raw: string; } /** * Semantic similarity query. Body is `~phrase` — natural language after the tilde, no parse step. Resolution happens service-side via the deep-embed channel; top-K narrowing via `` on the host statement. */ export interface SemanticBody { dialect: "semantic"; raw: string; } /** * Code-graph reference query. Body is `@symbol` (neighborhood — both inbound and outbound edges), `@symbol` (outbound — what this references). Resolution happens service-side via a deep-graph channel; no parse step in grammar. */ export interface GraphBody { dialect: "graph"; raw: string; } /** * Pattern with no dialect prefix; treated as a glob/literal match. */ export interface GlobBody { dialect: "glob"; raw: string; } /** * A line/column position in a parsed plurnk document. ANTLR emits 1-based lines and 0-based columns; degraded positions may use 0 for both when the source token's location is unknown. */ export interface Position { line: number; column: number; } export interface ReadStatement { op: "READ"; suffix: string; signal: (string[] | null); target: (ParsedPath | null); lineMarker: (LineMarker | null); body: (MatcherBody | null); position: Position; } export interface OpenStatement { op: "OPEN"; suffix: string; signal: (string[] | null); target: (ParsedPath | null); lineMarker: (LineMarker | null); body: (MatcherBody | null); position: Position; } export interface FoldStatement { op: "FOLD"; suffix: string; signal: (string[] | null); target: (ParsedPath | null); lineMarker: (LineMarker | null); body: (MatcherBody | null); position: Position; } export interface EditStatement { op: "EDIT"; suffix: string; signal: (string[] | null); target: (ParsedPath | null); lineMarker: (LineMarker | null); body: (string | null); position: Position; } export interface CopyStatement { op: "COPY"; suffix: string; signal: (string[] | null); target: (ParsedPath | null); lineMarker: (LineMarker | null); body: (string | null); position: Position; } export interface MoveStatement { op: "MOVE"; suffix: string; signal: (string[] | null); target: (ParsedPath | null); lineMarker: (LineMarker | null); body: (ParsedPath | null); position: Position; } export interface SendStatement { op: "SEND"; suffix: string; signal: (number | null); target: (ParsedPath | null); lineMarker: (LineMarker | null); body: (SendBody | null); position: Position; } /** * Parsed body of a SEND statement. `raw` is the literal body text; `json` is the best-effort `JSON.parse(raw)` result, or null when the body isn't valid JSON. */ export interface SendBody { raw: string; json: unknown; } export interface ExecStatement { op: "EXEC"; suffix: string; signal: (string | null); target: (ParsedPath | null); lineMarker: (LineMarker | null); body: (string | null); position: Position; } export interface WorkStatement { op: "WORK"; suffix: string; signal: null; target: (ParsedPath | null); lineMarker: null; body: (string | null); position: Position; } export interface ForkStatement { op: "FORK"; suffix: string; signal: null; target: (ParsedPath | null); lineMarker: null; body: (string | null); position: Position; } export interface KillStatement { op: "KILL"; suffix: string; signal: (number | null); target: (ParsedPath | null); lineMarker: null; body: (string | null); position: Position; } export interface PlanStatement { op: "PLAN"; suffix: string; signal: (string[] | null); target: (ParsedPath | null); lineMarker: (LineMarker | null); body: (string | null); position: Position; } export interface LookStatement { op: "LOOK"; suffix: string; signal: TagSignal; target: PathOrNull; lineMarker: LineMarkerOrNull; body: MatcherBodyOrNull; position: Position; } export interface BuffStatement { op: "BUFF"; suffix: string; signal: TagSignal; target: PathOrNull; lineMarker: LineMarkerOrNull; body: MatcherBodyOrNull; position: Position; } export type SendBodyOrNull = (SendBody | null); export interface ProviderDeclaration { /** * API vendor identifier (e.g. "local", "openrouter", "anthropic", "openai"). */ provider: string; /** * Model family (e.g. "gemma", "llama", "qwen", "claude", "gpt", "gemini"). */ family: string; /** * Specific model id (e.g. "gemma3-12b"). */ model: string; /** * Total context window in tokens. */ contextSize: number; /** * ISO 4217 code; the unit `cost_pico` is denominated in. */ currency: string; } export interface SchemeRegistration { /** * Scheme name without `://`. Matches the URL scheme character class. */ name: string; model_visible: boolean; category: string; default_scope: ("workspace" | "worker"); /** * Channel name selected when an op against this scheme has no fragment. Conventionally `body`; executor schemes (`{tag}://`) typically declare `stdout`. */ default_channel: string; /** * Per-channel content-orientation hints. `head` = whole-document or front-anchored (readers care about the beginning); `tail` = append-temporal stream (readers care about the latest content). Channels not listed default to `head`. Renderers use this to pick truncation direction; the amount to render is a core/runtime concern, not a contract field. */ channel_orientations?: { [k: string]: ("head" | "tail"); }; writable_by: ("model" | "client" | "system" | "plugin")[]; volatile: boolean; handler: (string | null); } export interface TelemetryEvent { /** * Producer identifier. Top-level for self-contained subsystems (`grammar`, `engine:rail`); colon-namespaced for parameterized producers (`scheme:wiki`, `provider:openai`). */ source: string; /** * Discriminator within a source. Open vocabulary — each producer mints kinds as needed. Examples: `parse_error` (grammar), `strike`/`cycle`/`sudden_death`/`no_ops`/`max_commands_exceeded` (engine:rail), `dispatch_failure` (scheme:*), `rate_limit` (provider:*). */ kind: string; /** * Severity, set by the producer at the emit site — it knows whether it is raising an error, a warning, or a note. Required: severity is meaning the producer owns, not something consumers re-derive by pattern-matching the open `kind` vocabulary. Consumers color and route straight off `level`. */ level: ("error" | "warn" | "info"); /** * Terse, factual message when present. Optional — engine rail kinds (strike, cycle) carry no human-meaningful message; the kind discriminator is the signal. Grammar/scheme/provider kinds typically include a message. */ message?: (string | null); /** * Optional typed position. ContentOffset points into the model's prior assistant.content (parser errors); LogCoordinate points at a specific log row (action failures). Tagged union extensible: future variants for entry-coordinate, channel-coordinate, range-coordinate. */ position?: (ContentOffset | LogCoordinate | null); [k: string]: unknown; } export interface ContentOffset { type: "content-offset"; line: number; column: number; } export interface LogCoordinate { type: "log-coordinate"; /** * Log row identity, typically `log:////`. */ coordinate: string; /** * Optional op token (FIND/READ/EDIT/...) at the coordinate, for human-readable rendering. */ op?: string; } //# sourceMappingURL=types.generated.d.ts.map