/** * EDM TypeScript Types * Inferred from Zod schemas * EDM schema version is declared in src/version.ts */ import { z } from "zod"; import { MetaSchema, CoreSchema, ConstellationSchema, MilkyWaySchema, GravitySchema, ImpulseSchema, GovernanceSchema, TelemetrySchema, SystemSchema, CrosswalksSchema, EdmArtifactSchema, LlmExtractedFieldsSchema, RetentionPolicySchema, SubjectRightsSchema, KAnonymitySchema, EmbeddingRefSchema, IndicesSchema } from "./edm-schema.js"; export type Meta = z.infer; export type Core = z.infer; export type Constellation = z.infer; export type MilkyWay = z.infer; export type Gravity = z.infer; export type Impulse = z.infer; export type Governance = z.infer; export type Telemetry = z.infer; export type System = z.infer; export type Crosswalks = z.infer; export type RetentionPolicy = z.infer; export type SubjectRights = z.infer; export type KAnonymity = z.infer; export type EmbeddingRef = z.infer; export type Indices = z.infer; export type EdmArtifact = z.infer; export type LlmExtractedFields = z.infer; export interface ExtractionInput { /** Primary text content */ text: string; /** Optional base64-encoded image */ image?: string; /** Optional image media type */ imageMediaType?: "image/jpeg" | "image/png" | "image/gif" | "image/webp"; /** * How to treat the text (default "memory"): * - "memory": first-person memory/passage, sent to the model as-is * - "conversation": a flattened chat transcript (USER:/ASSISTANT: turns). * Extractors wrap it in source-material framing so the model classifies * the conversation instead of replying to it, and treats the USER * speaker as the subject. */ inputType?: "memory" | "conversation"; } /** * Experiential stance — whose experience the emotionally salient material * is, relative to the subject. Proposed for EDM v0.9; until then it travels * in extraction results and telemetry notes, never in the artifact body. */ export declare const EXPERIENTIAL_STANCE: readonly ["lived", "witnessed", "quoted_third_party", "assistant_generated", "hypothetical"]; export type ExperientialStance = (typeof EXPERIENTIAL_STANCE)[number]; export interface ExtractionMetadata { /** Owner identifier (VitaPass recommended) */ subjectId?: string; /** Regulatory jurisdiction */ jurisdiction?: Governance["jurisdiction"]; /** Legal basis for processing */ consentBasis: Meta["consent_basis"]; /** Locale code (e.g., "en-us") */ locale?: string; /** Parent artifact ID for threading */ parentId?: string; /** User-defined tags */ tags?: string[]; /** Visibility setting */ visibility?: Meta["visibility"]; /** PII classification */ piiTier?: Meta["pii_tier"]; /** Retention policy basis (default "user_defined") */ retentionPolicyBasis?: RetentionPolicy["basis"]; } /** * Partner profile ID with required "partner:" prefix per ADR-0017 * e.g. "partner:com.deepadata.journaling.v1" */ export type PartnerProfileId = `partner:${string}`; /** * EDM Implementation Profile * - essential: minimal extraction for memory platforms * - extended: adds full Constellation and key Gravity fields * - full: the complete field set, complete extraction * - partner:: partner-defined profile per ADR-0017 * Field membership per profile is defined by the edm-spec composite * schemas (installed `edm-spec` package) — see assembler.ts manifests. */ export type EdmProfile = 'essential' | 'extended' | 'full' | PartnerProfileId; export interface ExtractionOptions { /** Content to extract from */ content: ExtractionInput; /** Metadata and governance options */ metadata: ExtractionMetadata; /** * EDM profile to extract (default: 'full') * - essential: minimal, for memory platforms and agent frameworks * - extended: mid-tier, for journaling and companion AI * - full: the complete field set, for therapy and regulated systems * * The 'full' default when unset is INTENTIONAL (founder decision, * 2026-08-04): an initial user gets the entire view of what the EDM * captures. Not a defect — do not change to a lighter default. */ profile?: EdmProfile; /** * LLM provider to use for extraction. Resolves via model-config: * per-request → EXTRACTION_PROVIDER env → 'anthropic' * (claude-haiku-4-5; founder decision 2026-08-04, 0.8.14 bake-off). */ provider?: 'anthropic' | 'openai' | 'kimi'; /** Model to use for extraction (provider-specific, uses default if omitted) */ model?: string; /** Temperature for OpenAI extractions (0-2, lower = more deterministic) */ temperature?: number; /** * Output token budget for the extraction call. Defaults to 2048 for * non-thinking models (real completions run 600–1,200 tokens), or * 16384 when the model is a thinking model (reasoning tokens count * against max_tokens, and smaller budgets silently truncated extraction * on exactly the most emotionally dense inputs). */ maxTokens?: number; /** * Model for the stance-classifier verification pass. Has its own knob: * per-request here → STANCE_MODEL env → the fast non-thinking default in * model-config. Deliberately does NOT inherit the extraction model (or * EXTRACTION_MODEL) — the classifier answers with one word and a * thinking-class model would double latency for nothing. */ stanceModel?: string; /** * Stance classifier verification pass (see stance-guard): * - "auto" (default): run a cheap classifier call when the input is a * conversation and the extraction claims lived/witnessed material at * emotional_weight >= 0.6 — the regime where misattribution bites * - true: always run; false: never run (prompt + deterministic guard * still apply) */ verifyStance?: boolean | "auto"; } export interface ValidationResult { valid: boolean; errors: ValidationError[]; /** * Non-fatal conditions the caller should surface — e.g. a partner * profile whose completeness validation was SKIPPED pending registry * lookup (ADR-0012). Added for D4 (partner-profiles 2026-08-02): * /v1/validate previously returned a bare `valid: true` and the caller * could not see that conformance was skipped. Present only when * non-empty. */ warnings?: ValidationWarning[]; } export interface ValidationError { path: string; message: string; code: string; } export interface ValidationWarning { path: string; message: string; code: string; } export declare const EMOTION_PRIMARY: readonly ["joy", "sadness", "fear", "anger", "wonder", "peace", "tenderness", "reverence", "pride", "anxiety", "gratitude", "longing", "hope", "shame", "disappointment", "relief", "frustration"]; export declare const NARRATIVE_ARC: readonly ["overcoming", "transformation", "connection", "reflection", "closure", "loss", "confrontation"]; export declare const RELATIONAL_DYNAMICS: readonly ["parent_child", "grandparent_grandchild", "romantic_partnership", "couple", "sibling_bond", "family", "friendship", "friend", "companionship", "colleague", "mentorship", "reunion", "community_ritual", "grief", "self_reflection", "professional", "therapeutic", "service", "adversarial"]; export declare const TEMPORAL_CONTEXT: readonly ["childhood", "early_adulthood", "midlife", "late_life", "recent", "future", "timeless"]; export declare const MEMORY_TYPE: readonly ["legacy_artifact", "fleeting_moment", "milestone", "reflection", "formative_experience"]; export declare const NARRATIVE_ARCHETYPE: readonly ["hero", "caregiver", "seeker", "sage", "lover", "outlaw", "innocent", "magician", "creator", "everyman", "jester", "ruler"]; export declare const DRIVE_STATE: readonly ["explore", "approach", "avoid", "repair", "persevere", "share", "confront", "protect", "process"]; export declare const MOTIVATIONAL_ORIENTATION: readonly ["belonging", "safety", "mastery", "meaning", "autonomy", "authenticity"]; export interface ActivateResult { activationId: string | null; arcTypes: string[]; primaryDomain: string | null; fieldFilters: Array<{ field: string; operator: string; value: unknown; weight: number; }>; confidence: number; significanceGate: boolean; } export interface FeedbackOptions { activationId: string; hit: boolean; subjectVpId?: string; apiKey?: string; baseUrl?: string; } export interface ActivateReasonSource { date: string; narrative: string; arc_type: string | null; emotional_weight: number; identity_thread: string | null; tether_type: string | null; } export interface ActivateReasonResult { /** Reasoning event ID for partner correlation; null when significance gate is closed */ arcReasoningEventId: string | null; /** Reasoned answer grounded in retrieved candidates; null when significance gate is closed */ answer: string | null; /** Top sources that informed the answer (length capped by topK, max 20) */ sources: ActivateReasonSource[]; /** EDM fields the reasoning model attended to */ reasoningFieldsUsed: string[]; /** Arc types matched by query classification */ arcTypes: string[]; /** Classification confidence (0-1) */ confidence: number; /** True when the query carries enough significance for reasoning to fire */ significanceGate: boolean; /** Number of candidate artifacts considered before sources were selected */ candidateCount: number; /** Reasoning model used (e.g. "kimi-k2"); null when significance gate is closed and no reasoning fired */ reasoningModel: string | null; /** ISO timestamp of when reasoning completed */ activatedAt: string | null; } export interface ActivateReasonOptions { /** TurboPuffer namespace to query against */ namespace: string; /** Optional VitaPass subject ID for scoping the activation event */ subjectVpId?: string; /** Number of sources to return in the response (default 5, max 20) */ topK?: number; /** API key for the deepadata-com platform; falls back to DEEPADATA_API_KEY env */ apiKey?: string; /** Override platform base URL; defaults to https://deepadata.com */ baseUrl?: string; } //# sourceMappingURL=types.d.ts.map