import type { TCoreArgument, TCorePremise, TCorePropositionalExpression, TCorePropositionalVariable } from "../schemata/index.js"; import type { TCoreClaim } from "../schemata/claim.js"; import type { TCoreClaimConnection } from "../schemata/claim-connection.js"; import type { TCoreArgumentForkRecord, TCorePremiseForkRecord, TCoreExpressionForkRecord, TCoreVariableForkRecord, TCoreClaimForkRecord } from "../schemata/fork.js"; import type { TPropositCoreSnapshot, TPropositCoreConfig } from "./interfaces/library.interfaces.js"; import type { TInvariantValidationResult } from "../types/validation.js"; import type { TForkArgumentOptions, TForkRemapTable } from "../types/fork.js"; import type { TCoreArgumentDiff, TCoreDiffOptions } from "../types/diff.js"; import { ClaimLibrary } from "./claim-library.js"; import { ClaimCitationLibrary } from "./claim-citation-library.js"; import { ClaimAxiomLibrary } from "./claim-axiom-library.js"; import { OriginLibrary } from "./origin-library.js"; import type { TCoreOriginDocument, TCoreOriginLink, TCoreOriginAnchor } from "../schemata/origin.js"; import { ArgumentLibrary } from "./argument-library.js"; import { ArgumentEngine, type TArgumentEngineSnapshot } from "./argument-engine.js"; import { ForkLibrary } from "./fork-library.js"; /** * Options for constructing a `PropositCore` instance. Accepts optional * pre-constructed library instances and/or shared configuration. When a * library instance is provided, it is used directly; otherwise a new one * is constructed using the shared config. */ export type TPropositCoreOptions = TPropositCoreConfig & { /** Pre-constructed claim library instance. */ claimLibrary?: ClaimLibrary; /** Pre-constructed claim-citation library instance. */ claimCitationLibrary?: ClaimCitationLibrary; /** Pre-constructed claim-axiom library instance. */ claimAxiomLibrary?: ClaimAxiomLibrary; /** Pre-constructed fork library instance. */ forkLibrary?: ForkLibrary; /** Pre-constructed argument library instance. */ argumentLibrary?: ArgumentLibrary; /** Pre-constructed origin library instance. */ originLibrary?: OriginLibrary; }; /** * Top-level orchestrator for the proposit-core system. Owns every library * (claims, claim citations, axioms, forks, arguments, origins) and provides * unified snapshot/restore and validation. * * Construction order follows dependency order: * claims -> citations -> axioms -> origins -> forks -> arguments. * * A source is a claim with `type: "citation"`, and the `citations` library * holds the connections between claims and their sources. A parallel * `axioms` library holds axiomatic-claim connections (a third claim type * `"axiomatic"`). * The `origins` library holds the source texts arguments were built from, * their per-version links, and the spans individual parts derive from. */ export declare class PropositCore { readonly claims: ClaimLibrary; readonly citations: ClaimCitationLibrary; readonly axioms: ClaimAxiomLibrary; readonly forks: ForkLibrary; readonly arguments: ArgumentLibrary; readonly origins: OriginLibrary; protected generateId: () => string; constructor(options?: TPropositCoreOptions); /** * Returns a serializable snapshot of the entire PropositCore state, * including all libraries. */ snapshot(): TPropositCoreSnapshot; /** * Restores a `PropositCore` instance from a snapshot. Libraries are * restored in dependency order: claims -> citations -> axioms -> forks -> * arguments. * * @param snapshot - The serialized PropositCore snapshot. * @param config - Optional shared configuration for the restored instance. * @returns A fully restored `PropositCore` instance. */ static fromSnapshot(snapshot: TPropositCoreSnapshot, config?: TPropositCoreConfig): PropositCore; /** * Runs invariant validation across all managed libraries and merges * the results. * * @returns A combined validation result. */ validate(): TInvariantValidationResult; /** * Forks an argument, cloning its referenced claims (including any * citation-typed claims reachable via citations) and the citation edges * between them, then remaps variable claim references to point at the * cloned claims. Creates fork records in all five namespaces. * * @param argumentId - The ID of the argument to fork. * @param newArgumentId - The ID for the forked argument. Defaults to `this.generateId()`. * @param options - Optional fork configuration and extras for fork records. * @returns The forked engine, remap tables, and the argument fork record. */ forkArgument(argumentId: string, newArgumentId?: string, options?: TForkArgumentOptions & { forkId?: string; argumentForkExtras?: Partial>; premiseForkExtras?: Partial>; expressionForkExtras?: Partial>; variableForkExtras?: Partial>; claimForkExtras?: Partial>; /** * For a response, the argument it answers at the version it * answers, when this instance's argument library does not hold * that version. */ respondsToSnapshot?: TArgumentEngineSnapshot; }): { engine: ArgumentEngine; remapTable: TForkRemapTable; claimRemap: Map; argumentFork: TArgFork; }; /** * Maps every expression id in `engine` to the id of the premise that * holds it, read from a snapshot of the engine. */ private mapExpressionIdsToPremiseIds; /** * The claims bound in the argument a response answers, at the version it * answers; empty for a standard argument. * * @throws When `engine` is a response and neither `respondsToSnapshot` nor * this instance's argument library holds the argument it answers at that * version. */ private claimsSharedWithAnswered; /** * Determines the closure of claims a fork clones — start from * claim-bound variables, then transitively pull in any source-side * claim referenced by a citation whose citing-side is already in the * closure (citation-typed claims become part of the fork too) — along * with every citation and axiom edge walked on the way. */ private collectClaimClosure; /** * Creates a new claim for the current version of every claim in the * closure, returning the original-to-clone id map and the version each * original was cloned from. */ private cloneClaimClosure; /** * Adds a copy of each connection to `library` between the cloned * claims. A connection from a cloned claim to a kept one points at the * kept claim as it was; any other connection whose ends were not both * cloned is skipped. */ private cloneConnections; /** * Rebuilds the forked engine with its variables and derivation premises * pointing at the cloned claims. */ private rebuildWithRemappedClaims; /** * Records the fork in all five namespaces: the argument, then each * premise, expression, variable and claim, in that order. Every record * carries the same base fields; the caller's extras for that namespace * are spread last. */ private createForkRecords; /** * Computes a structural diff between two arguments managed by this * `PropositCore` instance. Automatically injects fork-aware entity * matchers derived from the fork records stored in `this.forks`. * Caller-provided matchers in `options` take precedence over the * fork-aware defaults. * * Modified entities carry a `state` field: `modified-own` (own change) or * `modified-within` (contained/referenced change only). See `diffArguments` * for the id-stability contract governing state expressibility. * * @param argumentIdA - The ID of the "before" argument. * @param argumentIdB - The ID of the "after" argument. * @param options - Optional diff configuration and comparator overrides. * @returns A structural diff between the two arguments. */ diffArguments(argumentIdA: string, argumentIdB: string, options?: TCoreDiffOptions): TCoreArgumentDiff; } //# sourceMappingURL=proposit-core.d.ts.map