import { type IrIdentityIndex } from '../model/ir-identity.js'; /** Default home for an element the request does not place. */ export declare const DEFAULT_ELEMENT_FILE = "model/catalog/project.sysml"; export interface ElementWriteRequest { id: string; name?: string; kind?: string; construct?: string; layer?: string; doc?: string; attributes?: Record; /** Project-relative source file. */ file?: string; /** * Qualified name of the package that should declare this element. * * Creation only — a package change on an existing declaration is a move, * which is ./package-writer.ts's job because it has to cut the declaration * out of where it currently is. Absent means the file's last package, which * is what a request that does not care about placement gets. */ package?: string; /** * IR identity of the declaration being edited. * * Required to *update* an existing declaration. Absent means "create": * there is no identity to quote for source that does not exist yet. */ irIdentity?: string; /** * The element ID the quoted identity is expected to name, when this write * changes the declaration's own identifier. * * Without it a rename is indistinguishable from a stale address — both are * "the identity names something other than `id`" — and the safe reading of * that ambiguity is to refuse. Saying so explicitly is what makes a rename * a deliberate act rather than an accident the checker has to tolerate. */ renamedFrom?: string; } /** Advisory notes about a write that succeeded. */ export interface ElementWriteWarning { code: 'rename-is-text-only'; message: string; } export interface ElementWriteResult { success: boolean; filePath: string; /** True when the declaration was replaced rather than appended. */ replaced?: boolean; warnings?: ElementWriteWarning[]; error?: string; /** Set when the failure was a stale identity, so callers can say so. */ stale?: boolean; } /** * Why a rename is only a text edit, said once here so every surface says the * same thing. * * Updating references would need name resolution across the workspace — the * linker, which is Track B B5 and does not exist yet. Silently rewriting the * declaration and leaving every reference pointing at the old name would be a * broken model presented as a successful edit, so the write succeeds and says * what it did not do. */ export declare const RENAME_IS_TEXT_ONLY: string; /** * Write one element into project source. * * `index` is the identity index of the current revision. Passing it is what * makes an update identity-addressed; without it only creation is possible, * and an update that quotes an identity is refused rather than silently * degraded to a name match. */ export declare function saveElementToFile(cwd: string, element: ElementWriteRequest, index?: IrIdentityIndex): Promise; /** * Parse-before-commit, then write atomically. * * Source that does not parse never reaches disk. The editor model (§1.1) says a * *user* may save anything; it does not say a machine-generated splice may * corrupt a file the user did not touch. */ export declare function commitSource(absolutePath: string, relativePath: string, updated: string): Promise<{ success: boolean; error?: string; }>; //# sourceMappingURL=persistor.d.ts.map