/** * PrincipleTreeLedgerAdapter — bridges LedgerAdapter interface to principle-tree-ledger.ts. * * Lives in principles-core/runtime-v2 so pd-cli can use the same adapter * as openclaw-plugin without depending on openclaw-plugin private code. */ import type { LedgerAdapter, LedgerPrincipleEntry } from '../candidate-intake.js'; import type { ReuseEvidenceEntry } from '../types/principle-schema.js'; /** * PrincipleTreeLedgerAdapter — bridges 11-field LedgerPrincipleEntry to ledger file. * * Maintains an in-memory idempotency map. Create once and reuse * across calls within the same process lifetime. */ export declare class PrincipleTreeLedgerAdapter implements LedgerAdapter { #private; constructor(opts: { stateDir: string; }); writeProbationEntry(entry: LedgerPrincipleEntry): LedgerPrincipleEntry; existsForCandidate(candidateId: string): LedgerPrincipleEntry | null; /** * Owner Decision Experience v1 Phase A (§9.1): plural ledger lookup for * identity binding. Governance publication requires a UNIQUE ledger target — * `existsForCandidate` intentionally returns the first match (legacy intake * idempotency semantics), which cannot distinguish "exactly one" from * "several". Returns every ledger principle referencing the candidate. */ listForCandidate(candidateId: string): { id: string; }[]; /** * PRI-917 PR3B Phase 2 — the reuse-side resolution lookup (LedgerAdapter * contract, see candidate-intake.ts). Scans `reuseEvidence[]` for the * candidate; never touches `derivedFromPainIds` / existsForCandidate. * * Entries on disk were shape-validated by the append writer; a record that * fails even the minimal read-side check cannot be a resolution and is * skipped rather than trusted (rc-2). */ findReuseResolutionForCandidate(candidateId: string): { principleId: string; evidence: ReuseEvidenceEntry; } | null; /** * PRI-917 PR3B Phase 2 — persist one reuse resolution (LedgerAdapter * contract). Thin delegation to the core writer, which owns the lock, the * integrity guards, candidateId idempotency, and append-only semantics. */ appendReuseEvidence(principleId: string, entry: ReuseEvidenceEntry): { principleId: string; reuseEvidence: ReuseEvidenceEntry[]; appended: boolean; }; /** * Owner Decision Experience v1 Phase A (§9.1): presence check by principle * id. A pre-existing artifact binding is only trusted when its target is a * real ledger principle ("验证目标确实存在"). */ hasPrinciple(principleId: string): boolean; /** * PRI-915: whether the ledger backing store is decidable right now. When * `false`, `hasPrinciple`/`listForCandidate` collapse the unreadable file to * an empty ledger, so their `false`/`[]` answers mean "cannot read", not * "non-member" — callers that would report data drift MUST consult this * first. A missing file is `true` (a true empty ledger), not an outage. */ isAvailable(): boolean; /** * Bug-O L3 fix: upgrade a ledger principle's status to 'active' after the * corresponding approval+activation has been dispatched successfully. * * Called by ApprovalsConsoleModel.approve() after the activation is written * to SQLite. Returns ok:false (not throw) when the principle is missing or * the update fails, so the caller can surface a non-fatal warning without * rolling back the already-committed activation (rc-9-no-silent-fallback). */ activatePrinciple(principleId: string): { ok: true; } | { ok: false; reason: string; }; } //# sourceMappingURL=principle-tree-ledger-adapter.d.ts.map