import type { Diagnostic } from "../../compiler.js"; import type { PendingWrite, SourceStore } from "../../source-store.js"; import type { ResolvedWorkspace } from "../../workspace.js"; import type { VisualDiagnostic, VisualViewOperation } from "./protocol-contract.js"; import type { PatternShape } from "../../compiler.js"; import type { NestingKind, ProjectionDefinition, ProjectionExclusion, ProjectionQuery } from "../../projection.js"; import type { ResolvedProfileContext, SemanticGraph } from "../../compiler.js"; import { type CataloguePatternMembership, type CataloguePatternVacancy } from "../../interrogate-command.js"; import type { VisualKindOption, VisualPatternOption, VisualViewSummary } from "./protocol-contract.js"; import type { VisualInterrogationOverlay, VisualRenderedModel } from "./wire.js"; /** * What a workspace looks like to the editor, however the editor is being run * (#252). * * These were the session server's, and the session server is one host now: an * embedder mounting the editor over its own store computes the same model, the * same vocabulary and the same view counts, and two definitions of any of them * would be two answers to the same question. So the arithmetic lives here and * the orchestration - which bytes to read, which digests to pin, what a layout * sidecar says - stays with whoever owns those. * * Browser-safe: no `node:`, no filesystem, no session. Everything is a pure * function of a compile result. */ /** * The kinds a browser may offer, each with the core kind it descends from. * * `[0]` is the nearest declared ancestor, the same reading * `projectGraphForCanvas` gives an authored subject its `coreKindLabel`. A kind * with no lineage IS a core kind and stands for itself. Without the core label * an editor can read a palette but cannot judge it: the ArchiMate table is * keyed on core kinds, so offering an extension kind unchecked puts a `YM404` * one click away. */ export declare const kindOptionsOf: (lineages: ReadonlyMap, /** Which kinds ARE patterns, so a palette can group them (#473 phase 4). */ patterns?: ReadonlyMap, /** The profile's display names, where it authored any. */ names?: ReadonlyMap) => readonly VisualKindOption[]; /** * Every pattern a browser may offer, with its slots resolved to what they * admit. * * `admits` is the expensive part and the reason this lives here rather than in * the browser: a slot declaring `kindMatching: descendants` accepts a whole * family, and resolving that needs the lineage map the frame does not carry. * A picker built from the declared kind alone would refuse subjects the * compiler accepts. */ export declare const patternOptionsOf: (patterns: readonly PatternShape[], lineages: ReadonlyMap, names?: ReadonlyMap) => readonly VisualPatternOption[]; /** * How many SUBJECTS a query matches, which is not the size of its match set. * * A `SemanticGraph`'s subjects are concepts and relationships together, so the * match set returns both — right for narrowing a canvas that draws edges as * well as nodes, and wrong for a number sitting beside a view called its * subject count. A view over three components with two relationships between * them would read as five, and the reviewer counting boxes would find three. */ export declare const conceptCountOf: (graph: SemanticGraph, query: ProjectionQuery, profileContext: ResolvedProfileContext, memberships?: readonly CataloguePatternMembership[], nesting?: readonly NestingKind[], showResponsibility?: boolean) => number; /** * Folds one interrogation report into what the canvas draws (#292). * * Undefined — never a throw — when the catalogue does not load: the overlay * is a garnish on the model, and a model frame must not be blocked by it. * Subject ids come from the same compiled graph as `CanvasNode.id`, so the * join in the browser is a plain lookup. */ export interface DismissedQuestion { readonly questionId: string; /** Absent dismisses the question wherever it appears. */ readonly subject?: string; } export declare const interrogationOverlayOf: (compiled: { readonly graph: SemanticGraph; readonly profileContext: ResolvedProfileContext; /** From the compilation (ADR 0131); absent, slot questions stay quiet. */ readonly patternMemberships?: readonly CataloguePatternMembership[]; /** From the compilation (#447); absent, `missing-part` stays quiet. */ readonly patternVacancies?: readonly CataloguePatternVacancy[]; }, /** * The catalogue, or the composed SET a workspace carries (#345, ADR 0129). * A set rather than one document so the pane asks the same interview the * CLI does over the same workspace: an editor showing fewer questions than * `design` does over the same files is a disagreement with no symptom. */ catalogue: { readonly path: string; readonly source: string; } | readonly { readonly path: string; readonly source: string; }[], /** * What the host has already dealt with (#328). Evaluation is unchanged and * the model is untouched: this decides only what the pane draws, because a * question set aside in the host's own product should not be asked again by * a pane embedded in it. */ dismissed?: readonly DismissedQuestion[]) => VisualInterrogationOverlay | undefined; /** * Rebuilds the shared editor workspace from one successful compile. * * The caller owns metadata which cannot be inferred from a graph (authority, * source revisions, layouts, and initial view); this helper owns all derived * canvas, vocabulary, view-count, and interrogation arithmetic. `catalogue` * is the question catalogue's bytes — this module cannot read files, so * whoever can hands them over; omitting it ships a model with no overlay. */ export declare const renderedWorkspaceOf: (compiled: { readonly graph: SemanticGraph; readonly profileContext: ResolvedProfileContext; readonly patternMemberships?: readonly CataloguePatternMembership[]; /** Threaded on to the overlay (#447); absent, `missing-part` stays quiet. */ readonly patternVacancies?: readonly CataloguePatternVacancy[]; }, views: readonly VisualViewSummary[], metadata: Omit, catalogue?: { readonly path: string; readonly source: string; } | readonly { readonly path: string; readonly source: string; }[], dismissed?: readonly DismissedQuestion[]) => { readonly model: VisualRenderedModel; readonly views: readonly VisualViewSummary[]; }; /** Every subject a query draws, concepts and relationships alike. */ export declare const matchedIdsOf: (graph: SemanticGraph, query: ProjectionQuery, profileContext: ResolvedProfileContext, memberships?: readonly CataloguePatternMembership[], nesting?: readonly NestingKind[], showResponsibility?: boolean) => readonly string[]; /** Every concept a query dropped, and the facet that dropped it (#248). */ export declare const exclusionsOf: (graph: SemanticGraph, query: ProjectionQuery, profileContext: ResolvedProfileContext, memberships?: readonly CataloguePatternMembership[], nesting?: readonly NestingKind[], showResponsibility?: boolean) => readonly ProjectionExclusion[]; /** * One saved view, as the rail reads it. `subjectCount` is the caller's, * because counting needs a compiled graph and a session builds its first list * before it has one. */ export declare const viewSummaryOf: (projection: ProjectionDefinition, path: string, subjectCount?: number) => VisualViewSummary; /** * Applies a landed view batch to a host-owned list. * * Writes are read back through the callback, so a malformed or otherwise * unreadable landed document cannot become a fabricated summary. */ export declare const adoptLandedViews: (views: readonly VisualViewSummary[], operations: readonly VisualViewOperation[], readSummary: (path: string) => VisualViewSummary | undefined) => readonly VisualViewSummary[]; /** * The document a diagnostic the runtime minted itself points at. Not a file: * these are about the session rather than about anything the workspace holds. */ export declare const VISUAL_SERVER_DOCUMENT = "visual-session-server"; export declare const published: (diagnostics: readonly Diagnostic[], sources: readonly { readonly path: string; readonly source: string; }[]) => readonly VisualDiagnostic[]; export declare const serverDiagnostic: (code: string, message: string, pointer?: string) => VisualDiagnostic; /** * Whether the workspace would load a projection written at this path. * * This is a DIRECTORY check, not a pattern match, and deliberately so: ADR * 0100 recorded that the manifest's pattern dialect has never been named - it * is whatever `globSync` happens to support, undocumented and untested past * one wildcard - so a matcher written here would be inventing the dialect * rather than honouring it. A directory that already holds a projection the * manifest resolved is a directory the manifest demonstrably reaches. * * A workspace with no projections at all has nothing to demonstrate, so the * default directory is allowed: refusing there would make the first view in a * fresh workspace impossible to create. */ export declare const projectionDirectoryIsCovered: (path: string, workspace: ResolvedWorkspace) => boolean; /** * Turns staged view operations into pending writes, refusing before anything * is written (ADR 0103). * * A `write-view` is validated through the same `loadProjection` the CLI's own * projection writes go through, so a document the schema would reject never * reaches the store. A `delete-view` names a revision, which is what makes a * removal refusable rather than a silent success on a file someone else * already changed. */ export declare const planViewWrites: (operations: readonly VisualViewOperation[], workspace: ResolvedWorkspace, store: SourceStore) => { readonly ok: true; readonly writes: readonly PendingWrite[]; } | { readonly ok: false; readonly diagnostics: readonly VisualDiagnostic[]; };