declare const MEMORY_FORMAT_VERSION: 1; declare const MEMORY_SCHEMA_VERSION: 1; type MemoryFormatVersion = typeof MEMORY_FORMAT_VERSION; type MemorySchemaVersion = typeof MEMORY_SCHEMA_VERSION; type MemoryId = string; type Timestamp = string; type JsonPrimitive = string | number | boolean | null; type JsonValue = JsonPrimitive | JsonValue[] | { [key: string]: JsonValue; }; type SourceReferenceKind = 'thread' | 'message' | 'iteration' | 'artifact' | 'event' | 'record' | 'external'; type SourceReference = { kind: SourceReferenceKind; id: string; uri?: string; excerpt?: string; }; type Provenance = { id: MemoryId; schemaVersion: MemorySchemaVersion; projectId: MemoryId; createdAt: Timestamp; participantId: MemoryId; sourceRefs: SourceReference[]; }; type ParticipantKind = 'human' | 'ai' | 'system' | 'integration'; type AuthorityLevel = 'owner' | 'delegate' | 'contributor'; type AuthorityMode = 'local_trusted' | 'hosted'; type ExecutionContext = { sessionId?: string; provider?: string; model?: string; deviceId?: string; mode?: string; }; type AuthorityContext = { level: AuthorityLevel; mode: AuthorityMode; grantId?: MemoryId; authenticatedAt?: Timestamp; }; type ParticipantRecord = Provenance & { recordType: 'participant'; kind: ParticipantKind; displayName: string; status: 'active' | 'disabled'; }; type AuthorityGrantRecord = Provenance & { recordType: 'authority_grant'; granteeId: MemoryId; level: AuthorityLevel; grantedById: MemoryId; subjectIds: MemoryId[]; startsAt: Timestamp; endsAt?: Timestamp; revokedAt?: Timestamp; }; type SubjectType = 'project' | 'file' | 'route' | 'component' | 'element' | 'token' | 'interaction'; type SubjectLocatorKind = 'project_root' | 'source_file' | 'route_pattern' | 'file_export' | 'source_span' | 'dom_selector' | 'token_path' | 'interaction_key' | 'custom'; type SubjectLocator = { id: MemoryId; kind: SubjectLocatorKind; value: string; status: 'current' | 'historical' | 'unresolved'; validFrom: Timestamp; validUntil?: Timestamp; sourceRefs: SourceReference[]; }; type SubjectRecord = Provenance & { recordType: 'subject'; subjectType: SubjectType; label: string; aliases: string[]; locators: SubjectLocator[]; }; type ParticipantStance = { stance: 'supports' | 'opposes' | 'uncertain' | 'needs_evidence'; reason?: string; }; type CaptureContext = { route?: string; subjectIds: MemoryId[]; artifactIds: MemoryId[]; }; type ObservationState = 'open' | 'resolved' | 'dismissed'; type ObservationRecord = Provenance & { recordType: 'observation'; state: ObservationState; statement: string; captureContext: CaptureContext; stance?: ParticipantStance; resolvedByIds: MemoryId[]; }; type DecisionKind = 'principle' | 'preference' | 'rule' | 'constraint'; type ProposalState = 'draft' | 'pending' | 'accepted' | 'rejected' | 'withdrawn' | 'deferred'; type AssertionOrigin = { mode: 'declared' | 'inferred'; sourceText?: string; iterationId?: MemoryId; inferredById?: MemoryId; reviewedById?: MemoryId; }; type DecisionSubject = { subjectId: MemoryId; role: 'governed' | 'consumer' | 'provider' | 'context'; }; type ProposalRecord = Provenance & { recordType: 'proposal'; state: ProposalState; claim: string; rationale?: string; proposedKind?: DecisionKind; subjects: DecisionSubject[]; subjectSemantics?: string; origin: AssertionOrigin; stance?: ParticipantStance; bundleId?: MemoryId; }; type DecisionState = 'active' | 'superseded' | 'revoked'; type DecisionRecord = Provenance & { recordType: 'decision'; proposalId: MemoryId; acceptanceEventId: MemoryId; acceptedById: MemoryId; authority: AuthorityContext; state: DecisionState; kind: DecisionKind; claim: string; rationale?: string; subjects: DecisionSubject[]; subjectSemantics?: string; noChange: boolean; effectiveAt?: Timestamp; effectiveMilestone?: string; bundleId?: MemoryId; }; type ThreadOutcome = 'decision_created' | 'proposal_rejected' | 'observation_resolved' | 'observation_dismissed' | 'question_unresolved' | 'implementation_only' | 'no_outcome'; type ThreadRecord = Provenance & { recordType: 'thread'; title?: string; state: 'open' | 'resolved'; messageArtifactIds: MemoryId[]; outcome: ThreadOutcome; resultRefs: EntityReference[]; }; type IterationOutcome = 'completed' | 'cancelled' | 'question_asked' | 'failed' | 'no_change'; type IterationRecord = Provenance & { recordType: 'iteration'; threadIds: MemoryId[]; startedAt: Timestamp; completedAt?: Timestamp; requestSummary: string; responseSummary?: string; outcome: IterationOutcome; execution: ExecutionContext; artifactIds: MemoryId[]; imprintAssessment?: { state: 'mutated' | 'none' | 'missing' | 'invalid' | 'not_applicable'; reason?: string; }; }; type EvidenceKind = 'judgment' | 'artifact' | 'eval' | 'log' | 'user_feedback' | 'external_source' | 'project_state'; type EvidenceRecord = Provenance & { recordType: 'evidence'; kind: EvidenceKind; summary: string; availability: 'available' | 'missing' | 'redacted' | 'forgotten'; stance?: ParticipantStance; artifactIds: MemoryId[]; }; /** * An advisory explanation is learned, revisable shared understanding. It can * guide future work, but it is deliberately distinct from accepted product * truth (`decision`). */ type AdvisoryExplanationKind = 'intention' | 'principle' | 'pattern'; type AdvisoryExplanationState = 'emerging' | 'testing' | 'grounded' | 'challenged' | 'retired'; type AdvisoryExplanationScope = { kind: 'project' | 'route' | 'component' | 'selector' | 'file'; values: string[]; }; type AdvisoryConcreteBinding = { id: string; modelPath: string; value: JsonValue; createdAt: Timestamp; updatedAt: Timestamp; }; type AdvisoryExplanationRecord = Provenance & { recordType: 'advisory_explanation'; kind: AdvisoryExplanationKind; state: AdvisoryExplanationState; statement: string; rationale: string; scope: AdvisoryExplanationScope; subjectIds: MemoryId[]; evidenceIds: MemoryId[]; concreteBindings: AdvisoryConcreteBinding[]; supersededById?: MemoryId; updatedAt: Timestamp; }; type CoverageClaim = { decisionId: MemoryId; coverage: 'partial' | 'full'; claim: string; sourceRefs: SourceReference[]; }; type ImplementationState = 'planned' | 'in_progress' | 'completed' | 'failed' | 'abandoned'; type ImplementationAttemptRecord = Provenance & { recordType: 'implementation_attempt'; state: ImplementationState; iterationIds: MemoryId[]; coverageClaims: CoverageClaim[]; projectStateRef?: SourceReference; summary: string; artifactIds: MemoryId[]; }; type VerificationState = 'queued' | 'running' | 'passed' | 'failed' | 'inconclusive' | 'error' | 'cancelled'; type VerificationTarget = { entityType: 'decision' | 'implementation_attempt' | 'model_entry'; entityId: MemoryId; }; /** @deprecated Retained only so existing memory journals remain readable. */ type EvalSpecState = 'draft' | 'active' | 'retired'; /** @deprecated Retained only so existing memory journals remain readable. */ type EvalDependency = { kind: 'model_path' | 'source_file' | 'route' | 'subject'; value: string; subjectId?: MemoryId; }; /** @deprecated Retained only so existing memory journals remain readable. */ type EvalScenario = { id: string; label?: string; route?: string; routePattern?: string; components?: Array<{ name: string; sourceFile?: string; exportName?: string; }>; subjectIds?: MemoryId[]; states?: Array<{ kind: 'viewport' | 'theme' | 'auth' | 'locale' | 'feature_flag' | 'fixture' | 'interaction' | 'custom'; key?: string; value: string; }>; steps?: Array<{ action: 'navigate' | 'click' | 'type' | 'select'; target?: string; value?: string; }>; }; /** @deprecated Retained only so existing memory journals remain readable. */ type EvalSpecRecord = Provenance & { recordType: 'eval_spec'; state: EvalSpecState; legacyId: string; replacesSpecId?: MemoryId; title: string; category: 'component' | 'layout' | 'copy' | 'interaction' | 'visual' | 'workflow'; prompt: string; assertions: string[]; rationale: string; decisionIds: MemoryId[]; subjectIds: MemoryId[]; threadRefs: string[]; dependencies?: EvalDependency[]; scenarios?: EvalScenario[]; targets: VerificationTarget[]; evaluator: { kind: 'human' | 'ai' | 'test' | 'external'; name: string; evidenceTypes: string[]; }; scope: { kind: 'current_page' | 'project' | 'subject'; route?: string; }; }; type VerificationAttemptRecord = Provenance & { recordType: 'verification_attempt'; evalSpecId?: MemoryId; scopeFingerprint?: string; state: VerificationState; evaluator: { kind: 'human' | 'ai' | 'test' | 'eval' | 'external'; participantId?: MemoryId; name: string; }; targets: VerificationTarget[]; summary?: string; evidenceIds: MemoryId[]; /** @deprecated Historical presentation data retained for journal compatibility. */ evalRun?: { id: string; threadId?: string; createdAt: number; completedAt: number; durationMs: number; scope: { type: 'current_page'; url: string; viewport: { width: number; height: number; }; }; assertionResults: Array<{ assertion: string; status: 'pass' | 'fail' | 'needs_review'; summary: string; evidence: string[]; }>; tooling: { chromeDevtools: 'available' | 'unavailable' | 'unknown'; evidenceTypes: string[]; }; provider?: string; model?: string; screenshotPath?: string; codeFingerprint?: string; }; }; type ModelEntryRecord = Provenance & { recordType: 'model_entry'; key: string; subjectIds: MemoryId[]; decisionIds: MemoryId[]; value: JsonValue; }; type ModelProjectionRecord = Provenance & { recordType: 'model_projection'; state: 'applied'; runId: string; presentationJobId?: string; appliedById: MemoryId; authority: AuthorityContext; appliedAt: Timestamp; decisionIds: MemoryId[]; entryIds: MemoryId[]; coverage: Array<{ decisionId: MemoryId; status: 'unprojected' | 'partially_projected' | 'projected' | 'stale'; }>; }; type EntityType = 'participant' | 'authority_grant' | 'subject' | 'observation' | 'proposal' | 'decision' | 'thread' | 'iteration' | 'evidence' | 'advisory_explanation' | 'implementation_attempt' | 'eval_spec' | 'verification_attempt' | 'model_entry' | 'model_projection' | 'freshness_signal'; type MemoryObjectType = EntityType | 'relationship' | 'lifecycle_event' | 'artifact'; type EntityReference = { entityType: EntityType; entityId: MemoryId; /** Omitted for a reference within the relationship's owning store. */ storeId?: string; }; type RelationshipType = 'supports' | 'contradicts' | 'supersedes' | 'excepts' | 'duplicates' | 'implements' | 'verifies' | 'replaces' | 'derived_from' | 'expresses' /** Legacy explanation topology names remain readable at the boundary. */ | 'operationalizes' | 'refines' | 'instantiates'; type RelationshipRecord = Provenance & { recordType: 'relationship'; relationshipType: RelationshipType; from: EntityReference; to: EntityReference; reason: string; authority?: AuthorityContext; }; type FreshnessSignalType = 'subject_unresolved' | 'implementation_drift' | 'evidence_unavailable' | 'new_conflict' | 'verification_expired' | 'review_interval_elapsed' | 'schema_or_tooling_change'; type FreshnessTargetKind = 'subject_locator' | 'implementation_presence' | 'verification_result' | 'model_coverage' | 'evidence_reference' | 'decision_applicability'; type FreshnessSignalRecord = Provenance & { recordType: 'freshness_signal'; signalType: FreshnessSignalType; state: 'open' | 'resolved'; targetKind: FreshnessTargetKind; target: EntityReference; reason: string; evidenceIds: MemoryId[]; resolvedAt?: Timestamp; resolvedByEventId?: MemoryId; }; type ProposalDeferralContext = { kind: 'proposal_deferral'; taskContext?: string; subjectIds: MemoryId[]; resurfaceWhen: Array<'different_action' | 'new_evidence' | 'new_conflict' | 'owner_request' | 'after_date'>; revisitAfter?: Timestamp; }; type LifecycleEvent = Provenance & { recordType: 'lifecycle_event'; entity: EntityReference; eventType: string; fromState: string | null; toState: string; authority: AuthorityContext; execution?: ExecutionContext; reason?: string; transitionContext?: ProposalDeferralContext; }; type ArtifactKind = 'message' | 'screenshot' | 'image' | 'diff' | 'file_snapshot' | 'log' | 'eval_output' | 'external_document' | 'other'; type ArtifactManifestEntry = { id: MemoryId; kind: ArtifactKind; mediaType?: string; byteSize?: number; contentHash?: string; location?: string; availability: 'available' | 'missing' | 'redacted' | 'forgotten'; }; type Tombstone = { id: MemoryId; schemaVersion: MemorySchemaVersion; projectId: MemoryId; objectId: MemoryId; objectType: MemoryObjectType; deletedAt: Timestamp; deletedById: MemoryId; authority: AuthorityContext; reasonCategory: 'privacy' | 'legal' | 'serious_error' | 'intentional_forgetting'; erasureLevel: 'content' | 'content_and_evidence' | 'full_where_permitted'; invalidates: EntityReference[]; }; type CanonicalRecord = ParticipantRecord | AuthorityGrantRecord | SubjectRecord | ObservationRecord | ProposalRecord | DecisionRecord | ThreadRecord | IterationRecord | EvidenceRecord | AdvisoryExplanationRecord | ImplementationAttemptRecord | EvalSpecRecord | VerificationAttemptRecord | ModelEntryRecord | ModelProjectionRecord | FreshnessSignalRecord; type MemoryFeature = 'authority' | 'subjects' | 'decisions' | 'advisory_explanations' | 'implementations' | 'verification' | 'eval_specs' | 'model_projection' | 'freshness' | 'portable_artifacts' | 'bounded_retrieval'; type ProjectMemoryManifest = { formatVersion: MemoryFormatVersion; projectId: MemoryId; createdAt: Timestamp; updatedAt: Timestamp; features: MemoryFeature[]; writer: { name: string; version: string; }; }; type ProjectMemoryBundle = { manifest: ProjectMemoryManifest; records: CanonicalRecord[]; events: LifecycleEvent[]; relationships: RelationshipRecord[]; artifacts: ArtifactManifestEntry[]; tombstones: Tombstone[]; }; type SchemaIssue = { path: string; code: string; message: string; severity: 'error' | 'warning'; }; type LegacyImportIssue = { severity: 'info' | 'warning' | 'error'; code: string; source?: string; message: string; }; type LegacyImportReport = { projectRoot: string; source: { threads: number; messages: number; decisionEnvelopes: number; modelEntries: number; artifactsReferenced: number; }; imported: Record; unresolvedAcceptance: number; deferredModelEntries: number; proofCases: Array<{ legacyId: string; threadFound: boolean; decisionEnvelopeFound: boolean; recordIds: string[]; }>; issues: LegacyImportIssue[]; schemaIssues: SchemaIssue[]; }; type LegacyImportResult = { bundle: ProjectMemoryBundle; report: LegacyImportReport; }; type LegacyImportOptions = { projectRoot: string; projectKey?: string; proofCaseIds?: string[]; writerVersion?: string; }; declare function legacyUuidV7(namespace: string, kind: string, legacyId: string, occurredAt: number): string; declare function importLegacyProject(options: LegacyImportOptions): Promise; export { type LegacyImportIssue, type LegacyImportOptions, type LegacyImportReport, type LegacyImportResult, importLegacyProject, legacyUuidV7 };