import type { HttpClient } from "./client.js"; import type { MapReference, ActionReference, EntryReference } from "./workflow-types.js"; /** Exact target identity. Empty paths mean the top document, outside shadow roots. */ export interface RecognitionTarget { kind?: "web_dom"; selector: string; documentPath?: Array>; shadowPath?: Array>; } export type RecognitionControlTarget = RecognitionTarget; /** An exact captured content entry, not its DOM subtree or contained controls. */ export type RecognitionRegionTarget = RecognitionTarget; export interface StateRecognitionRules { /** Excluded only from recognition comparisons, never observations or actions. */ ignoredControlsForRecognition: RecognitionControlTarget[]; /** Excluded only from region similarity; text remains available to workflows. */ ignoredRegionsForRecognition: RecognitionRegionTarget[]; } export interface MapDocument { service_map_id: string; revision: string; name: string; states: Array<{ state_id: string; evidence: Record; actions: Array>; }>; entries: Array<{ entry_id: string; destination: Record; }>; transitions: Array>; observation_bindings?: Record>; } export declare class ServiceMapKnowledge { readonly document: MapDocument; readonly ref: MapReference; readonly states: Record; actions: Record; recognition: StateRecognitionRules; }>; readonly entries: Record; readonly bindings: Record>; constructor(document: MapDocument); action(stateId: string, actionId: string): ActionReference; } export declare function defineMap(document: MapDocument): ServiceMapKnowledge; export interface StateActionReference { stateId: string; actionId: string; } /** An exact edge in the pinned revision, not a mutable transition_N array index. */ export type MapTransitionReference = { sourceStateId: string; actionId: string; targetStateId: string; entryId?: never; } | { entryId: string; targetStateId: string; actionId?: string; sourceStateId?: never; }; export interface MergeStatesOptions { /** Retains this state's ID, captured baseline, name, board position and preview. */ keep: string; remove: string; /** Every edge between these states must explicitly become a retained form action. */ convertTransitionsToFormActions?: StateActionReference[]; } export interface MapEditRemap { states: Record; /** Keys are original "stateId/actionId"; values are the final identities. */ actions: Record; /** Edge rewrites in edit order. A null after value means the edge was removed. */ transitions: Array<{ before: MapTransitionReference; after: MapTransitionReference | null; }>; } export interface MapEditPreview { committed: false; expectedRevision: string; /** Proposed document only. Its actions are not executable until commit. */ serviceMap: MapDocument; remap: MapEditRemap; } export interface MapEditResult { committed: true; requestId: string; map: ServiceMapKnowledge; remap: MapEditRemap; } export type MapEditChange = { kind: "ignore_controls_for_recognition" | "unignore_controls_for_recognition"; stateId: string; controls: RecognitionControlTarget[]; } | { kind: "ignore_regions_for_recognition" | "unignore_regions_for_recognition"; stateId: string; regions: RecognitionRegionTarget[]; } | ({ kind: "merge_states"; } & MergeStatesOptions) | { kind: "redirect_transition"; transition: MapTransitionReference; targetStateId: string; } | { kind: "remove_transition"; transition: MapTransitionReference; } | { kind: "remove_state"; stateId: string; }; /** Build once, preview, then commit all changes against one immutable revision. */ export declare class ServiceMapEdits { private readonly http; readonly requestId: string; private readonly changes; private snapshot?; private readonly reference; constructor(http: HttpClient, reference: MapReference, options?: { requestId?: string; }); /** Keeps controls actionable and visible. Only state recognition ignores them. */ ignoreControlsForRecognition(stateId: string, controls: RecognitionControlTarget[]): this; /** Restore these controls to recognition without changing their actions or values. */ unignoreControlsForRecognition(stateId: string, controls: RecognitionControlTarget[]): this; /** Exclude exact content regions from similarity, without hiding text or controls. */ ignoreRegionsForRecognition(stateId: string, regions: RecognitionRegionTarget[]): this; /** Restore these captured content regions to the weighted recognition comparison. */ unignoreRegionsForRecognition(stateId: string, regions: RecognitionRegionTarget[]): this; mergeStates(options: MergeStatesOptions): this; redirectTransition(transition: MapTransitionReference, targetStateId: string): this; /** Removes this edge and its recorded source action. Preview exposes the deletion. */ removeTransition(transition: MapTransitionReference): this; /** Requires an isolated state. Use mergeStates to preserve and reconnect its actions. */ removeState(stateId: string): this; preview(): Promise; /** Same requestId can be committed again after a lost response, without editing twice. */ commit(): Promise; private get path(); private edge; private add; private seal; } export declare class MapsResource { private readonly http; constructor(http: HttpClient); create(name: string, medium?: string): Promise; delete(reference: MapReference): Promise<{ status: string; }>; list(): Promise<{ maps: Record[]; }>; get(mapId: string, revision?: string): Promise; edit(reference: MapReference, options?: { requestId?: string; }): ServiceMapEdits; /** Existing low-level edits, such as entries, bindings and action parameter schemas. */ edit(mapId: string, expectedRevision: string, changes: Record[]): Promise; ignoreControlsForRecognition(reference: MapReference, stateId: string, controls: RecognitionControlTarget[]): Promise; unignoreControlsForRecognition(reference: MapReference, stateId: string, controls: RecognitionControlTarget[]): Promise; ignoreRegionsForRecognition(reference: MapReference, stateId: string, regions: RecognitionRegionTarget[]): Promise; unignoreRegionsForRecognition(reference: MapReference, stateId: string, regions: RecognitionRegionTarget[]): Promise; plan(reference: MapReference, fromState: string, toState: string, allowedActions: string[]): Promise>; }