import { type H2AActorRegistration, type H2AOrgMembershipGrant, type H2ASubagentBinding, type H2AEnvelope, type H2AJournalEntry, type H2AJournalPayload, type H2ANegotiationRecord, type H2ADecisionDossier, type H2ADeclarationInteret, type H2APostureConfianceResult, type H2APostureConflitResult, type H2APresenterBias } from "@sentropic/h2a"; import { type LocalStorePaths } from "./paths.js"; export interface CreateLocalStoreOptions { root: string; /** * Timeout (ms) for acquiring any per-store advisory file lock. Defaults to * 5000. Tests use a much smaller value to exercise the timeout path * without slowing the suite. DEC-036. */ lockTimeoutMs?: number; /** * Read-only escape hatch: if the on-disk `.h2a-schema.json` declares a * version we don't recognize, proceed anyway with a stderr warning. Never * rewrites the sentinel. Intended for inspection tooling. DEC-036. */ allowVersionMismatch?: boolean; /** * Locking strategy for critical sections (DEC-066): * - `"pid"` (default) — same-machine advisory lock with PID-staleness * recovery (DEC-036). Zero-config, correct for the common single-machine * case. * - `"lease"` — time-based lease lock (DEC-065) safe across hosts/Pods on a * shared ReadWriteMany store (Scenario B of DEC-056). No PID assumption. */ lockMode?: "pid" | "lease"; /** * Lease duration (ms) when `lockMode === "lease"`. Must exceed the longest * critical section plus inter-host clock skew. Default 30000. */ leaseMs?: number; } /** * An append-only audit event for a subagent (DEC-071). Distinct from the * parent fan-in (DEC-070), which reflects *current* inbox state: the audit log * is the permanent history of what happened to a subagent and survives an * inbox pop. */ export interface H2ASubagentAuditEvent { subagent: string; type: "registered" | "routed" | "revoked"; at: string; envelopeId?: string; mailbox?: "inbox" | "outbox"; reason?: string; } export type H2ASubagentStatus = "active" | "revoked"; /** * An append-only keyring event for an instance (DEC-078). Keys can be added * (and, from DEC-079, revoked) without rewriting the append-only instance * registration, enabling key rotation: add a new key, both verify during the * overlap, then revoke the old one. */ export interface H2AKeyEvent { instance: string; publicKey: string; type: "added" | "revoked"; at: string; } export interface H2AOffboardTombstone { instance: string; reason?: string; revokedKeys: number; revokedSubagents: string[]; at: string; } export interface H2ADerivedDecisionDossier { negotiationId: string; dossier: H2ADecisionDossier; dossierHash: string; presenterBias?: H2APresenterBias; advisoryEvent?: H2AJournalEntry; } export interface LocalStore { paths: LocalStorePaths; registerInstance(reg: H2AActorRegistration): void; listInstances(): H2AActorRegistration[]; findInstance(id: string): H2AActorRegistration | undefined; addInstanceKey(instanceId: string, publicKeyPem: string): void; listInstanceKeys(instanceId: string): string[]; listKeyEvents(): H2AKeyEvent[]; revokeInstanceKey(instanceId: string, publicKeyPem: string): void; /** DEC-109 org provisioning: append a role/scope membership grant (keyed-only). */ grantOrgMembership(grant: H2AOrgMembershipGrant): void; listOrgMembership(): H2AOrgMembershipGrant[]; offboardInstance(instanceId: string, reason?: string): H2AOffboardTombstone; listOffboards(): H2AOffboardTombstone[]; registerSubagent(binding: H2ASubagentBinding): void; listSubagents(): H2ASubagentBinding[]; findSubagent(id: string): H2ASubagentBinding | undefined; listSubagentsOf(parentInstance: string): H2ASubagentBinding[]; openNegotiation(record: H2ANegotiationRecord): H2ANegotiationRecord; readNegotiation(id: string): H2ANegotiationRecord | undefined; updateNegotiationStatus(id: string, status: H2ANegotiationRecord["status"]): H2ANegotiationRecord; appendNegotiationEvent(negotiationId: string, payload: H2AJournalPayload): H2AJournalEntry; readNegotiationJournal(negotiationId: string): H2AJournalEntry[]; declareConflitInteret(negotiationId: string, declaration: H2ADeclarationInteret, options?: { eventId?: string; }): H2AJournalEntry; derivePosturesConflit(negotiationId: string): H2APostureConflitResult[]; deriveDecisionDossier(negotiationId: string, options?: { presenter?: string; advisoryGate?: boolean; eventId?: string; }): H2ADerivedDecisionDossier; derivePostureConfiance(negotiationId: string): H2APostureConfianceResult; stabilizeNegotiation(negotiationId: string, options?: { eventId?: string; }): { record: H2ANegotiationRecord; artifactHash: string; signers: string[]; finalEvent: H2AJournalEntry; advisoryEvents: H2AJournalEntry[]; artifactPath: string; }; putInboxMessage(actor: string, envelope: H2AEnvelope): void; readInbox(actor: string): H2AEnvelope[]; popInboxMessage(actor: string, envelopeId: string): H2AEnvelope | undefined; putOutboxMessage(actor: string, envelope: H2AEnvelope): void; readOutbox(actor: string): H2AEnvelope[]; routeToSubagent(subagentId: string, envelope: H2AEnvelope, mailbox?: "inbox" | "outbox"): void; readSubagentInboxes(parentInstance: string): Array<{ subagent: string; envelopes: H2AEnvelope[]; }>; readSubagentAudit(subagentId: string): H2ASubagentAuditEvent[]; readSubagentAuditOf(parentInstance: string): H2ASubagentAuditEvent[]; subagentStatus(subagentId: string): H2ASubagentStatus; revokeSubagent(subagentId: string, reason?: string): void; } export declare function createLocalStore(options: CreateLocalStoreOptions): LocalStore; //# sourceMappingURL=store.d.ts.map