import type { MemoModelDTO, ParseError } from '../model/semantic.js'; import type { SysmlIR } from '../sysml-ir/index.js'; /** * Protocol version, `major.minor.patch`. * * Compatibility is by major: a client refuses a server whose major differs, * and accepts any minor at or above nothing in particular — new optional fields * are a minor bump, a changed or removed field is a major one. */ export declare const SYSMLC_PROTOCOL_VERSION = "1.1.0"; /** * IR payload version, tracked separately from the protocol that carries it. * * The wire shape and the model shape change for different reasons: Session 3 * replaces this payload with the canonical IR without touching the request that * delivers it. Two numbers, so that change costs one bump rather than a * protocol break. */ export declare const SYSMLC_IR_VERSION = "2.0.0"; /** The one custom request. Everything else on the wire is standard LSP. */ export declare const EMIT_IR_REQUEST = "memo/emitIr"; /** * Where the server advertises its protocol version. * * `capabilities.experimental` is LSP's own extension point, so a generic client * that knows nothing about MEMO still completes the handshake. */ export declare const PROTOCOL_CAPABILITY_KEY = "memoProtocol"; export interface ProtocolCapability { protocolVersion: string; irVersion: string; /** Implementation name and version, for diagnostics and probe output. */ implementation: string; implementationVersion?: string; } export interface EmitIrParams { /** Absolute path of the project to lower. */ projectDir: string; /** * Client-assigned, strictly increasing per project. * * This is what makes "a superseded revision never emits a stale result" * enforceable: the server compares the revision it is working on against * the newest it has been asked for, and refuses to answer with the old one. */ revision: number; /** The version the client is speaking, re-stated per request. */ protocolVersion: string; /** * The exact sources to lower, instead of the project's own discovery. * * Added in protocol 1.1.0 — an optional field, so a 1.0.0 server still * answers a 1.1.0 client's ordinary request. It exists for callers whose * subject is a file set rather than a project: `memo conformance` runs a * corpus unit whose files a project walker would not collect, and both * transports have to be able to say which files those are or only the * in-process one could run a corpus. * * A server that does not understand it lowers the project instead. That is * a visibly different answer, not a silently wrong one — the result names * the files it read. */ files?: readonly string[]; } /** * What the compiler understood from a revision. * * `parseErrors` is carried raw and separately from `model.errors`, because * domain routing is the *caller's* decision, not the compiler's: the same * failure is a `sysml` error when MEMO is the validator and a `memo-ingest` * warning when something else was. A compiler that stamped a domain here would * be answering a question it was not asked. */ export interface MemoIr { irVersion: string; model: MemoModelDTO; parseErrors: ParseError[]; /** True when lowering read the revision with no parse failures. */ accepted: boolean; /** Canonical AST-level IR. `model` is its Memo projection for compatibility. */ sysml: SysmlIR; } export interface EmitIrResult { outcome: 'ir'; protocolVersion: string; revision: number; ir: MemoIr; } /** * The answer to a request the world moved past. * * Returning the computed-but-stale IR would be the worse failure: the canvas * would draw a revision the user has already edited away from, with no way to * tell. Naming the newer revision lets the client wait for the answer it * actually wants. */ export interface EmitIrSuperseded { outcome: 'superseded'; protocolVersion: string; revision: number; supersededBy: number; } export type EmitIrResponse = EmitIrResult | EmitIrSuperseded; /** One-shot `memo-sysmlc check --format json` / `emit-ir --format json` output. */ export interface SysmlcCheckOutput { protocolVersion: string; accepted: boolean; parseErrors: ParseError[]; } export interface SysmlcEmitIrOutput { protocolVersion: string; ir: MemoIr; } export declare class ProtocolVersionError extends Error { readonly expected: string; readonly actual: string | undefined; constructor(expected: string, actual: string | undefined, where: string); } /** Same major version, both sides parseable. Anything else is incompatible. */ export declare function isProtocolCompatible(theirs: string | undefined, ours?: string): boolean; export declare function assertProtocolCompatible(theirs: string | undefined, where: string, ours?: string): void; //# sourceMappingURL=protocol.d.ts.map