import { Receipt, TrackChangeInfo, TrackChangesListQuery, TrackChangesListResult } from '../types/index.js'; import { StoryLocator } from '../types/story.types.js'; import { TextTarget } from '../types/address.js'; import { RevisionGuardOptions } from '../write/write.js'; export type TrackChangesListInput = TrackChangesListQuery; export interface TrackChangesGetInput { id: string; /** Story containing the tracked change. Omit for body (backward compatible). */ story?: StoryLocator; } export interface TrackChangesAcceptInput { id: string; /** Story containing the tracked change. Omit for body (backward compatible). */ story?: StoryLocator; } export interface TrackChangesRejectInput { id: string; /** Story containing the tracked change. Omit for body (backward compatible). */ story?: StoryLocator; } export interface TrackChangesAcceptAllInput { /** * Optional explicit bulk filter. Omit or pass `'all'` to operate across * every revision-capable story; pass a StoryLocator to scope the decision * to one story. */ story?: StoryLocator | 'all'; } export interface TrackChangesRejectAllInput { /** * Optional explicit bulk filter. Omit or pass `'all'` to operate across * every revision-capable story; pass a StoryLocator to scope the decision * to one story. */ story?: StoryLocator | 'all'; } /** * Range target for partial-range decisions. * * `range` is a canonical {@link TextTarget}; the engine resolves the * selected overlap with each affected logical tracked change and applies * the {@link https://www.w3.org/TR/selection-api/ selection-style} partial * resolution rules from the tracked-changes spec ยง 9. */ export interface TrackChangesRangeInput { range: TextTarget; /** Story containing the range. Omit for body (backward compatible). */ story?: StoryLocator; } /** * Public decide target surface: * - `{ id, story? }` for a single logical tracked change * - `{ kind: 'range', range, story? }` for partial-range decisions * - `{ scope: 'all', story? }` for bulk decisions, optionally filtered by story * * The executor also accepts internal legacy aliases (`kind: 'id'` / * `kind: 'all'`) so JS-only callers keep working during the migration. */ export type ReviewDecisionTarget = { id: string; story?: StoryLocator; } | { kind: 'range'; range: TextTarget; story?: StoryLocator; part?: string; } | { scope: 'all'; story?: StoryLocator | 'all'; }; export type ReviewDecideInput = { decision: 'accept'; target: ReviewDecisionTarget; } | { decision: 'reject'; target: ReviewDecisionTarget; }; export interface TrackChangesAdapter { /** List tracked changes matching the given query. */ list(input?: TrackChangesListInput): TrackChangesListResult; /** Retrieve full information for a single tracked change. */ get(input: TrackChangesGetInput): TrackChangeInfo; /** Accept a tracked change, applying it to the document. */ accept(input: TrackChangesAcceptInput, options?: RevisionGuardOptions): Receipt; /** Reject a tracked change, reverting it from the document. */ reject(input: TrackChangesRejectInput, options?: RevisionGuardOptions): Receipt; /** Accept all tracked changes matching the requested bulk filter. */ acceptAll(input: TrackChangesAcceptAllInput, options?: RevisionGuardOptions): Receipt; /** Reject all tracked changes matching the requested bulk filter. */ rejectAll(input: TrackChangesRejectAllInput, options?: RevisionGuardOptions): Receipt; /** * Accept or reject a tracked-change selection range. Adapters * that have not been updated to handle `kind: 'range'` may return a * `CAPABILITY_UNAVAILABLE` failure receipt; the document-api executor * surfaces that to callers without falling back to the legacy id/all * paths because their semantics are not equivalent. */ decideRange?(input: { decision: 'accept' | 'reject'; } & TrackChangesRangeInput, options?: RevisionGuardOptions): Receipt; } /** Public surface for trackChanges on DocumentApi. */ export interface TrackChangesApi { list(input?: TrackChangesListInput): TrackChangesListResult; get(input: TrackChangesGetInput): TrackChangeInfo; decide(input: ReviewDecideInput, options?: RevisionGuardOptions): Receipt; } /** * Execute wrappers below are the canonical interception point for input * normalization and validation before delegating to the adapter. */ export declare function executeTrackChangesList(adapter: TrackChangesAdapter, input?: TrackChangesListInput): TrackChangesListResult; export declare function executeTrackChangesGet(adapter: TrackChangesAdapter, input: TrackChangesGetInput): TrackChangeInfo; /** * Executes the consolidated `trackChanges.decide` operation by routing to the * appropriate adapter method based on the discriminated input. * * Accepting/rejecting changes is a resolution action, not a content mutation - * changeMode and dryRun are not applicable, so this accepts * {@link RevisionGuardOptions} rather than `MutationOptions`. */ export declare function executeTrackChangesDecide(adapter: TrackChangesAdapter, rawInput: ReviewDecideInput, options?: RevisionGuardOptions): Receipt; //# sourceMappingURL=track-changes.d.ts.map