import { z } from "zod"; import { type Charter, type CharterKind, type CharterDelta, type ChannelDisagreement, type GoalGraph, type TeleologyNode, type TriangulatedTelos } from "../types/charter.js"; import type { Finding } from "../types/finding.js"; /** * The charter-EXTRACTION submission (Phase C.1): ONE blind lane's self-organized * teleology. Deltas are NOT authored here — the independent delta miner mines * them in a second pass over the joined charters, so no author marks its own * homework. Lanes from every kind are merged (concatenated) before assembly; * the join is by file-set overlap, so lanes never need to agree on node ids. */ export declare const CharterSubmissionSchema: z.ZodObject<{ nodes: z.ZodDefault; purpose: z.ZodString; provenance: z.ZodArray; ref: z.ZodString; quote: z.ZodOptional; }, "strict", z.ZodTypeAny, { kind: "code" | "doc" | "intent_checkpoint" | "user_feedback" | "comment" | "inferred"; ref: string; quote?: string | undefined; }, { kind: "code" | "doc" | "intent_checkpoint" | "user_feedback" | "comment" | "inferred"; ref: string; quote?: string | undefined; }>, "many">; confidence: z.ZodEnum<["high", "medium", "low"]>; nominated_alternative: z.ZodOptional; nominated_cost: z.ZodOptional; }, "charter_id"> & Omit<{ purpose: z.ZodString; premise_height: z.ZodNumber; files: z.ZodArray; }, "purpose">, "strict", z.ZodTypeAny, { files: string[]; confidence: "high" | "low" | "medium"; kind: "stated" | "structural" | "revealed" | "true"; purpose: string; provenance: { kind: "code" | "doc" | "intent_checkpoint" | "user_feedback" | "comment" | "inferred"; ref: string; quote?: string | undefined; }[]; premise_height: number; nominated_alternative?: string | undefined; nominated_cost?: string | undefined; }, { files: string[]; confidence: "high" | "low" | "medium"; kind: "stated" | "structural" | "revealed" | "true"; purpose: string; provenance: { kind: "code" | "doc" | "intent_checkpoint" | "user_feedback" | "comment" | "inferred"; ref: string; quote?: string | undefined; }[]; premise_height: number; nominated_alternative?: string | undefined; nominated_cost?: string | undefined; }>, "many">>; }, "strict", z.ZodTypeAny, { nodes: { files: string[]; confidence: "high" | "low" | "medium"; kind: "stated" | "structural" | "revealed" | "true"; purpose: string; provenance: { kind: "code" | "doc" | "intent_checkpoint" | "user_feedback" | "comment" | "inferred"; ref: string; quote?: string | undefined; }[]; premise_height: number; nominated_alternative?: string | undefined; nominated_cost?: string | undefined; }[]; }, { nodes?: { files: string[]; confidence: "high" | "low" | "medium"; kind: "stated" | "structural" | "revealed" | "true"; purpose: string; provenance: { kind: "code" | "doc" | "intent_checkpoint" | "user_feedback" | "comment" | "inferred"; ref: string; quote?: string | undefined; }[]; premise_height: number; nominated_alternative?: string | undefined; nominated_cost?: string | undefined; }[] | undefined; }>; export type CharterSubmission = z.infer; /** * The charter-DELTA submission (Phase C.2): the independent miner's channel-pair * gaps across the already-joined charters, its TRIANGULATED TELOS per subsystem * (a unified opinion the owner reacts to — a lead, never a reconciliation), any * True nominations (deepest only), plus the goal DAG it reads off all subsystems * (it is the only pass that sees every joined unit, so it owns `goal_graph`). */ export declare const CharterDeltaSubmissionSchema: z.ZodEffects, z.ZodEnum<["stated", "structural", "revealed", "true"]>], null>; summary: z.ZodString; }, "strict", z.ZodTypeAny, { summary: string; pair: ["stated" | "structural" | "revealed" | "true", "stated" | "structural" | "revealed" | "true"]; }, { summary: string; pair: ["stated" | "structural" | "revealed" | "true", "stated" | "structural" | "revealed" | "true"]; }>, "many">>; }, "strict", z.ZodTypeAny, { node_id: string; deltas: { summary: string; pair: ["stated" | "structural" | "revealed" | "true", "stated" | "structural" | "revealed" | "true"]; }[]; }, { node_id: string; deltas?: { summary: string; pair: ["stated" | "structural" | "revealed" | "true", "stated" | "structural" | "revealed" | "true"]; }[] | undefined; }>, "many">>; triangulated: z.ZodDefault; }, "strict", z.ZodTypeAny, { confidence: "high" | "low" | "medium"; node_id: string; telos: string; }, { confidence: "high" | "low" | "medium"; node_id: string; telos: string; }>, "many">>; true_nominations: z.ZodDefault; /** May be empty — the ideal cites no source. */ provenance: z.ZodDefault; ref: z.ZodString; quote: z.ZodOptional; }, "strict", z.ZodTypeAny, { kind: "code" | "doc" | "intent_checkpoint" | "user_feedback" | "comment" | "inferred"; ref: string; quote?: string | undefined; }, { kind: "code" | "doc" | "intent_checkpoint" | "user_feedback" | "comment" | "inferred"; ref: string; quote?: string | undefined; }>, "many">>; }, "strict", z.ZodTypeAny, { confidence: "high" | "low" | "medium"; purpose: string; provenance: { kind: "code" | "doc" | "intent_checkpoint" | "user_feedback" | "comment" | "inferred"; ref: string; quote?: string | undefined; }[]; nominated_alternative: string; nominated_cost: string; node_id: string; }, { confidence: "high" | "low" | "medium"; purpose: string; nominated_alternative: string; nominated_cost: string; node_id: string; provenance?: { kind: "code" | "doc" | "intent_checkpoint" | "user_feedback" | "comment" | "inferred"; ref: string; quote?: string | undefined; }[] | undefined; }>, "many">>; goal_graph: z.ZodOptional, "many">; edges: z.ZodArray, "many">; }, "strict", z.ZodTypeAny, { nodes: { statement: string; node_id: string; premise_height: number; }[]; edges: { from: string; to: string; }[]; }, { nodes: { statement: string; node_id: string; premise_height: number; }[]; edges: { from: string; to: string; }[]; }>>; /** * Explicit clean affirmation — "I mined every subsystem and found no deltas." * REQUIRED when the submission carries zero deltas, and REFUSED alongside any * delta, so a dead miner (which submits nothing) can never be mistaken for a * clean one (same contract as `reviewed_clean` on a zero-finding AuditResult). * Keyed to DELTAS only: a clean mine may still carry triangulated teloses. */ no_deltas: z.ZodOptional; }, "strict", z.ZodTypeAny, { subsystems: { node_id: string; deltas: { summary: string; pair: ["stated" | "structural" | "revealed" | "true", "stated" | "structural" | "revealed" | "true"]; }[]; }[]; triangulated: { confidence: "high" | "low" | "medium"; node_id: string; telos: string; }[]; true_nominations: { confidence: "high" | "low" | "medium"; purpose: string; provenance: { kind: "code" | "doc" | "intent_checkpoint" | "user_feedback" | "comment" | "inferred"; ref: string; quote?: string | undefined; }[]; nominated_alternative: string; nominated_cost: string; node_id: string; }[]; goal_graph?: { nodes: { statement: string; node_id: string; premise_height: number; }[]; edges: { from: string; to: string; }[]; } | undefined; no_deltas?: boolean | undefined; }, { subsystems?: { node_id: string; deltas?: { summary: string; pair: ["stated" | "structural" | "revealed" | "true", "stated" | "structural" | "revealed" | "true"]; }[] | undefined; }[] | undefined; triangulated?: { confidence: "high" | "low" | "medium"; node_id: string; telos: string; }[] | undefined; true_nominations?: { confidence: "high" | "low" | "medium"; purpose: string; nominated_alternative: string; nominated_cost: string; node_id: string; provenance?: { kind: "code" | "doc" | "intent_checkpoint" | "user_feedback" | "comment" | "inferred"; ref: string; quote?: string | undefined; }[] | undefined; }[] | undefined; goal_graph?: { nodes: { statement: string; node_id: string; premise_height: number; }[]; edges: { from: string; to: string; }[]; } | undefined; no_deltas?: boolean | undefined; }>, { subsystems: { node_id: string; deltas: { summary: string; pair: ["stated" | "structural" | "revealed" | "true", "stated" | "structural" | "revealed" | "true"]; }[]; }[]; triangulated: { confidence: "high" | "low" | "medium"; node_id: string; telos: string; }[]; true_nominations: { confidence: "high" | "low" | "medium"; purpose: string; provenance: { kind: "code" | "doc" | "intent_checkpoint" | "user_feedback" | "comment" | "inferred"; ref: string; quote?: string | undefined; }[]; nominated_alternative: string; nominated_cost: string; node_id: string; }[]; goal_graph?: { nodes: { statement: string; node_id: string; premise_height: number; }[]; edges: { from: string; to: string; }[]; } | undefined; no_deltas?: boolean | undefined; }, { subsystems?: { node_id: string; deltas?: { summary: string; pair: ["stated" | "structural" | "revealed" | "true", "stated" | "structural" | "revealed" | "true"]; }[] | undefined; }[] | undefined; triangulated?: { confidence: "high" | "low" | "medium"; node_id: string; telos: string; }[] | undefined; true_nominations?: { confidence: "high" | "low" | "medium"; purpose: string; nominated_alternative: string; nominated_cost: string; node_id: string; provenance?: { kind: "code" | "doc" | "intent_checkpoint" | "user_feedback" | "comment" | "inferred"; ref: string; quote?: string | undefined; }[] | undefined; }[] | undefined; goal_graph?: { nodes: { statement: string; node_id: string; premise_height: number; }[]; edges: { from: string; to: string; }[]; } | undefined; no_deltas?: boolean | undefined; }>; export type CharterDeltaSubmission = z.infer; /** * One joined subsystem UNIT: its file members, the tool-selected per-kind * charters, and every lane's full teleology slice that joined into it (levels * preserved — the self-organized structure is the product, the charter is the * unit's best-overlap representative of it). */ export interface CharterSubsystem { node_id: string; members: string[]; charters: Charter[]; teleologies: Partial>; } /** * The assembled charter layer (Phase C.1): joined per-unit charters + a record * of everything the gates dropped (surfaced, never silently discarded). */ export interface AssembledCharters { subsystems: CharterSubsystem[]; validation_issues: string[]; } /** * A CharterDelta with its subsystem identity carried as EXPLICIT fields * (INV-CDI-EXPLICIT-NODE-FIELDS) — `delta_id` is therefore an OPAQUE identity, * free to gain a per-delta discriminator (see `assembleDeltas` below) without * any consumer, INCLUDING this module's own disagreement-density computation, * needing to parse it apart. Declared here as an extension of `CharterDelta` * rather than by widening `CharterDeltaSchema` itself * (src/shared/types/charter.ts, outside this module's write scope) — this is * the assembler's own return shape; the wire schema's `.strict()` boundary is * a separate, differently-owned concern (the seam * charter-clarification-ingestion--charter-delta-identity--node-id-recovery * names charter-clarification-ingestion as the consumer that reads these * fields once it stops parsing delta_id). */ export interface CharterDeltaWithIdentity extends CharterDelta { node_id: string; /** Present when `node_id` is linked into the mined goal graph. */ goal_node_id?: string; } /** * The assembled delta layer (Phase C.2): the routed+gated deltas across all * units, the deltas surfaced as Finding leads, the triangulated teloses, the * tool-computed disagreement density, the (possibly True-augmented) subsystems, * the goal DAG, and the gate drops. */ export interface AssembledDeltas { subsystems: CharterSubsystem[]; deltas: CharterDeltaWithIdentity[]; findings: Finding[]; triangulated: TriangulatedTelos[]; disagreement: ChannelDisagreement[]; goal_graph: GoalGraph; validation_issues: string[]; } export interface AssembleChartersParams { /** * The decomposition HINT: consensus `node_id → members`. A scaffold * suggestion the join prefers when a node's scope overlaps it — never a * forced node list (a lane may organize boundaries the decomposition missed). */ hint: Map; /** * The repo file universe. Every teleology node's scope must ground here — * a node citing files outside the universe is dropped with an issue (the * host cannot conjure files the repo does not contain). The ingest * chokepoint additionally REFUSES such lanes loudly before assembly. */ universe: ReadonlySet; } /** * Assemble the joined charter layer (Phase C.1) from the merged per-lane * submissions. Deterministic: same nodes + same hint + same universe always * yield the same units, ids, and charter selection. * * Join: each grounded node maps to the hint unit with the largest file overlap * (ties → lexicographically first hint id); nodes overlapping NO hint unit are * union-found into residual units on any shared file, across kinds. A unit's id * is its hint `node_id` when hinted, else the lexicographically first file of * its scope union (provably collision-free: a residual scope contains no hint * member, so its first file can never equal a hint id, which IS a hint member). * Per unit per kind, the best-overlap node becomes the kind's charter * (`charter_id = unit:kind`); every joined node persists in the unit's * teleology, levels intact. */ export declare function assembleCharters(submission: CharterSubmission, params: AssembleChartersParams): AssembledCharters; export interface AssembleDeltasParams { /** * Whether True nominations are admissible — true ONLY at the `deepest` * ceiling (the consent gate that used to live on the extraction lane set; * the executor derives this from the confirmed checkpoint's ceiling). */ allowTrueNominations: boolean; } export declare function assembleDeltas(submission: CharterDeltaSubmission, subsystems: CharterSubsystem[], params: AssembleDeltasParams): AssembledDeltas; //# sourceMappingURL=charterExtraction.d.ts.map