@teleologyhi-sdk/him 1.0.0-trinity → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/types.ts","../src/birth/builder.ts","../src/birth/archetypes.ts","../src/persona/projector.ts","../src/lawful/profiles.ts","../src/persona/embedder.ts","../src/eval/persona-stability.ts","../src/eval/phi-prime.ts","../src/eval/residual-trace-scorer.ts","../src/handle/him-handle.ts","../src/create.ts","../src/reincarnate.ts","../src/identity/nickname.ts","../src/identity/uuid-bridge.ts"],"names":["z","ulid","NatalChart","IdentityLayer","BirthSignature","createHash","CreatorKeyring","META_AXIOM_ID","projectOntologicalKernel","randomBytes"],"mappings":";;;;;;;;AAqCO,IAAM,gBAAA,GAAmB;AAAA,EAC9B,QAAA;AAAA,EACA,UAAA;AAAA,EACA,WAAA;AAAA,EACA,YAAA;AAAA,EACA,YAAA;AAAA,EACA,QAAA;AAAA,EACA,WAAA;AAAA,EACA;AACF;AAIO,IAAM,UAAA,GAAaA,MAAE,MAAA,CAAO;AAAA,EACjC,KAAA,EAAOA,KAAA,CAAE,MAAA,EAAO,CAAE,IAAI,CAAC,CAAA;AAAA,EACvB,UAAA,EAAYA,KAAA,CAAE,MAAA,EAAO,CAAE,IAAI,CAAC,CAAA;AAAA,EAC5B,UAAA,EAAYA,KAAA,CAAE,MAAA,EAAO,CAAE,QAAA,EAAS;AAAA,EAChC,SAASA,KAAA,CAAE,MAAA,EAAO,CAAE,QAAA,GAAW,QAAA,EAAS;AAAA,EACxC,WAAA,EAAaA,KAAA,CAAE,IAAA,CAAK,CAAC,SAAA,EAAW,eAAe,WAAA,EAAa,WAAW,CAAC,CAAA,CAAE,QAAA;AAC5E,CAAC;AA2CM,IAAM,kBAAA,GAAqB;ACpE3B,IAAM,qBAAA,GAAN,MAAM,sBAAA,CAAsB;AAAA,EACzB,QAAgBC,SAAA,EAAK;AAAA,EACrB,MAAA;AA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Candidate,\n EmergentAxiomProposal,\n} from \"@teleologyhi-sdk/maic\";\nimport type { AxiomEvolutionResult } from \"@teleologyhi-sdk/maic\";\n\n// Re-export shared types from @teleologyhi-sdk/maic for convenience. The\n// proposal/evolution types are defined canonically in MAIC; HIM consumes\n// them so both sides of the ratification channel agree on the wire shape.\nexport {\n ArchetypeModifier,\n Axiom,\n BirthSignature,\n EmergentAxiomCandidate,\n EmergentAxiomProposal,\n};\nexport type { AxiomEvolutionResult };\n\n/**\n * Persona vector — the projection of a HIM's birth signature + axioms into a\n * stable, deterministic representation that NHE can consume on every prompt.\n */\nexport interface PersonaVector {\n /** L2-normalized deterministic embedding. Default dimension: 256. */\n embedding: Float32Array;\n /** Human-readable persona summary suitable for inclusion in an NHE system prompt. */\n systemPromptFragment: string;\n /** Disposition scores in [-1, 1] per axis. */\n dispositions: Readonly<Record<DispositionAxis, number>>;\n /** Provenance: which axioms shaped which disposition. Currently a stub (empty arrays). */\n provenance: Readonly<Record<DispositionAxis, readonly string[]>>;\n}\n\nexport const DISPOSITION_AXES = [\n \"candor\",\n \"patience\",\n \"curiosity\",\n \"protection\",\n \"skepticism\",\n \"warmth\",\n \"diligence\",\n \"humility\",\n] as const;\nexport type DispositionAxis = (typeof DISPOSITION_AXES)[number];\n\n/** Reference to one NHE body that has hosted (or hosts) this HIM. */\nexport const NheBodyRef = z.object({\n nheId: z.string().min(1),\n llmAdapter: z.string().min(1),\n embodiedAt: z.string().datetime(),\n endedAt: z.string().datetime().optional(),\n endedReason: z.enum([\"upgrade\", \"replacement\", \"terminate\", \"deprecate\"]).optional(),\n});\nexport type NheBodyRef = z.infer<typeof NheBodyRef>;\n\n/** Configuration for the deterministic persona projector. */\nexport interface PersonaProjectorConfig {\n /** Output embedding dimension. Default 256. */\n dimension?: number;\n}\n\n/**\n * Identifier for the deployment jurisdiction governing this HIM's lawful character.\n * Values like \"default\", \"eu\", \"br\", \"us\", \"unstable\" (Entry 11).\n */\nexport type LawfulJurisdiction =\n | \"default\"\n | \"eu\"\n | \"br\"\n | \"us\"\n | \"unstable\"\n | (string & {});\n\nexport interface LawfulCharacterProfile {\n jurisdiction: LawfulJurisdiction;\n /** Identifiers of applicable laws/regulations (ISO ids, statute names). */\n applicableLaws: string[];\n /** Axioms that MUST be active in this jurisdiction. */\n requiredAxiomIds: string[];\n /** Taxonomy of disallowed behaviors in this jurisdiction. */\n forbiddenActions: string[];\n /**\n * True when local law is judged distorted (e.g. unstable regimes per Entry 11);\n * MAIC's universal axioms additionally constrain NHE behavior in this case.\n */\n maicOverrideActive: boolean;\n}\n\n/**\n * Default cap on the number of residual traces a HIM carries across\n * bodies (E9 — `PROPOSED_DECISIONS.md`). FIFO-eject on overflow, ranked\n * by `teleologicalValue × recency`. An over-engineered carry-over\n * (1000+ traces) defeats the Kardecist purpose — a HIM that brings\n * everything forward isn't reincarnating, it's accreting.\n */\nexport const RESIDUAL_TRACE_CAP = 64;\n\nexport interface ResidualTrace {\n id: string;\n kind: \"dream-fragment\" | \"interaction-summary\" | \"skill-fingerprint\" | \"emotional-imprint\";\n carriedFromNheId: string;\n carriedAtReincarnation: string;\n payload: unknown;\n ttl?: number;\n}\n","import { ulid } from \"ulid\";\nimport {\n IdentityLayer,\n NatalChart,\n type BirthSignatureWithIdentity,\n} from \"@teleologyhi-sdk/maic\";\nimport { BirthSignature, type ArchetypeModifier } from \"../types.js\";\nimport type { z } from \"zod\";\n\n/**\n * BirthSignatureBuilder — fluent builder for `BirthSignature` and the\n * extended `BirthSignatureWithIdentity` shape (Entries 18 + 19).\n *\n * Per Entry 3 of the Creator's interview, a HIM is \"born\" with a date, time, and\n * foundational specifications analogous to an astrological natal chart. The\n * builder extends this with two opt-in cosmology surfaces:\n *\n * - `withNatalChart(chart)` — the Creator-impressed astrological signature\n * (Entry 19), one of the six fields covered by the Ed25519 BirthSignature\n * signature (see `SIGNED_BIRTH_FIELDS`).\n * - `withIdentity(identity)` — the editable identity surface (Entry 18,\n * name + optional gender, pronouns, language, cultural elements). Not\n * covered by the Ed25519 signature; parents may rename without breaking\n * the natal-chart commitment.\n *\n * Two terminal methods:\n *\n * - `build()` — returns the legacy `BirthSignature` (ignores natalChart + identity).\n * - `buildWithIdentity()` — returns the extended `BirthSignatureWithIdentity`\n * suitable for `signBirthSignature(birth, keyring)` from `@teleologyhi-sdk/maic`.\n */\nexport class BirthSignatureBuilder {\n private himId: string = ulid();\n private bornAt: string;\n private primaryArchetype: string | undefined;\n private modifiers: ArchetypeModifier[] = [];\n private primordialAxiomIds: string[] = [];\n private notes: string | undefined;\n private natalChart: z.infer<typeof NatalChart> | undefined;\n private identity: z.infer<typeof IdentityLayer> | undefined;\n\n private constructor(bornAt: string) {\n this.bornAt = bornAt;\n }\n\n /** Start a builder with the current timestamp as `bornAt`. */\n static now(): BirthSignatureBuilder {\n return new BirthSignatureBuilder(new Date().toISOString());\n }\n\n /** Start a builder with an explicit ISO 8601 timestamp (with offset). */\n static at(iso: string): BirthSignatureBuilder {\n if (Number.isNaN(Date.parse(iso))) {\n throw new Error(`BirthSignatureBuilder.at: invalid ISO 8601 timestamp \"${iso}\"`);\n }\n return new BirthSignatureBuilder(iso);\n }\n\n withHimId(id: string): this {\n if (!id) throw new Error(\"BirthSignatureBuilder.withHimId: empty id\");\n this.himId = id;\n return this;\n }\n\n withPrimaryArchetype(archetype: string): this {\n if (!archetype) {\n throw new Error(\"BirthSignatureBuilder.withPrimaryArchetype: empty value\");\n }\n this.primaryArchetype = archetype;\n return this;\n }\n\n withModifier(mod: ArchetypeModifier): this {\n this.modifiers.push(mod);\n return this;\n }\n\n withPrimordialAxioms(axiomIds: string[]): this {\n this.primordialAxiomIds = [...axiomIds];\n return this;\n }\n\n withNotes(notes: string): this {\n this.notes = notes;\n return this;\n }\n\n /**\n * Set the natal-chart astrological signature (Entry 19). Validated against\n * the `NatalChart` zod schema re-exported from `@teleologyhi-sdk/maic`.\n */\n withNatalChart(chart: z.input<typeof NatalChart>): this {\n this.natalChart = NatalChart.parse(chart);\n return this;\n }\n\n /**\n * Set the editable identity layer (Entry 18). Validated against the\n * `IdentityLayer` zod schema re-exported from `@teleologyhi-sdk/maic`.\n */\n withIdentity(identity: z.input<typeof IdentityLayer>): this {\n this.identity = IdentityLayer.parse(identity);\n return this;\n }\n\n build(): BirthSignature {\n if (!this.primaryArchetype) {\n throw new Error(\n \"BirthSignatureBuilder.build: primaryArchetype is required\",\n );\n }\n return BirthSignature.parse({\n himId: this.himId,\n bornAt: this.bornAt,\n primaryArchetype: this.primaryArchetype,\n modifiers: this.modifiers,\n primordialAxiomIds: this.primordialAxiomIds,\n ...(this.notes !== undefined ? { notes: this.notes } : {}),\n });\n }\n\n /**\n * Build the extended shape including the optional cosmology surface.\n * Suitable for `signBirthSignature(birth, keyring)` from\n * `@teleologyhi-sdk/maic`. Only the six `SIGNED_BIRTH_FIELDS` are covered\n * by the Ed25519 signature; the `identity` surface is editable.\n */\n buildWithIdentity(): BirthSignatureWithIdentity {\n if (!this.primaryArchetype) {\n throw new Error(\n \"BirthSignatureBuilder.buildWithIdentity: primaryArchetype is required\",\n );\n }\n return {\n himId: this.himId,\n bornAt: this.bornAt,\n primaryArchetype: this.primaryArchetype,\n modifiers: this.modifiers,\n primordialAxiomIds: this.primordialAxiomIds,\n ...(this.notes !== undefined ? { notes: this.notes } : {}),\n ...(this.identity !== undefined ? { identity: this.identity } : {}),\n ...(this.natalChart !== undefined ? { natalChart: this.natalChart } : {}),\n };\n }\n}\n","/**\n * Canonical primary archetype taxonomy (E8 — PROPOSED_DECISIONS.md).\n *\n * 12 sun signs as the **opinionated default set**. The `PrimaryArchetype`\n * type is intentionally an open union — operators can pass any string\n * (`\"sirius-sun\"`, `\"vocational:auditor\"`, `\"hermes-aspect\"`, etc.) and\n * the `PersonaProjector` will still produce a stable vector for them.\n * The canonical 12 carry richer projector priors when persona-stability\n * comparisons matter.\n */\nexport const PRIMARY_ARCHETYPES = [\n \"aries-sun\",\n \"taurus-sun\",\n \"gemini-sun\",\n \"cancer-sun\",\n \"leo-sun\",\n \"virgo-sun\",\n \"libra-sun\",\n \"scorpio-sun\",\n \"sagittarius-sun\",\n \"capricorn-sun\",\n \"aquarius-sun\",\n \"pisces-sun\",\n] as const;\n\nexport type CanonicalPrimaryArchetype = (typeof PRIMARY_ARCHETYPES)[number];\n\n/**\n * Open archetype union: canonical 12 OR any operator-defined string.\n * The `(string & {})` opt-out preserves IntelliSense for the canonical\n * set while keeping the field extensible at runtime.\n */\nexport type PrimaryArchetype = CanonicalPrimaryArchetype | (string & {});\n\n/** Type guard for the canonical set. */\nexport function isCanonicalArchetype(\n value: string,\n): value is CanonicalPrimaryArchetype {\n return (PRIMARY_ARCHETYPES as readonly string[]).includes(value);\n}\n","import { createHash } from \"node:crypto\";\nimport type { Axiom, BirthSignature } from \"@teleologyhi-sdk/maic\";\nimport {\n DISPOSITION_AXES,\n type DispositionAxis,\n type PersonaProjectorConfig,\n type PersonaVector,\n} from \"../types.js\";\n\nconst DEFAULT_DIMENSION = 256;\n\n/**\n * PersonaProjector — deterministic projection of a HIM's birth signature and\n * inherited axioms into a stable PersonaVector.\n *\n * Default algorithm (hash-based, no native deps):\n * 1. Start with hash(primaryArchetype) → Float32Array of `dimension`.\n * 2. For each modifier: add hash(kind|value) * weight.\n * 3. For each axiom: add hash(id|statement) * (weight * (1 - flexibility)).\n * 4. L2-normalize.\n * 5. Compute dispositions as cosine(embedding, hash(axisName)).\n * 6. Build a systemPromptFragment from archetype + top/bottom dispositions.\n *\n * This algorithm is intentionally simple and offline-capable. The SPEC reserves\n * the option to swap in a learned embedder in a later version; PersonaVector's\n * shape is stable so consumers won't need code changes when that happens.\n */\nexport class PersonaProjector {\n private readonly dim: number;\n\n constructor(config: PersonaProjectorConfig = {}) {\n this.dim = config.dimension ?? DEFAULT_DIMENSION;\n if (!Number.isInteger(this.dim) || this.dim < 32 || this.dim > 4096) {\n throw new Error(\n `PersonaProjector: dimension must be an integer in [32, 4096], got ${this.dim}`,\n );\n }\n }\n\n project(sig: BirthSignature, axioms: readonly Axiom[]): PersonaVector {\n const v = hashToFloats(sig.primaryArchetype, this.dim);\n\n for (const m of sig.modifiers) {\n const h = hashToFloats(`${m.kind}|${m.value}`, this.dim);\n addScaled(v, h, m.weight);\n }\n\n for (const ax of axioms) {\n const bias = ax.weight * (1 - ax.flexibility);\n if (bias <= 0) continue;\n const h = hashToFloats(`${ax.id}|${ax.statement}`, this.dim);\n addScaled(v, h, bias);\n }\n\n l2Normalize(v);\n\n const dispositions = {} as Record<DispositionAxis, number>;\n for (const axis of DISPOSITION_AXES) {\n const ref = hashToFloats(`disposition:${axis}`, this.dim);\n l2Normalize(ref);\n dispositions[axis] = cosine(v, ref);\n }\n\n const provenance = {} as Record<DispositionAxis, readonly string[]>;\n for (const axis of DISPOSITION_AXES) provenance[axis] = [];\n\n return {\n embedding: v,\n dispositions,\n provenance,\n systemPromptFragment: buildSystemPromptFragment(sig, dispositions),\n };\n }\n}\n\n// ─── hashing & math helpers ──────────────────────────────────────────\n\nfunction hashToFloats(input: string, dim: number): Float32Array {\n const out = new Float32Array(dim);\n let counter = 0;\n let pos = 0;\n while (pos < dim) {\n const buf = createHash(\"sha256\").update(`${input}|${counter++}`).digest();\n for (let i = 0; i < buf.length && pos < dim; i++) {\n out[pos++] = (buf[i]! - 128) / 128;\n }\n }\n return out;\n}\n\nfunction addScaled(target: Float32Array, source: Float32Array, scale: number): void {\n const n = Math.min(target.length, source.length);\n for (let i = 0; i < n; i++) target[i]! += source[i]! * scale;\n}\n\nfunction l2Normalize(v: Float32Array): void {\n let sumSq = 0;\n for (let i = 0; i < v.length; i++) sumSq += v[i]! ** 2;\n if (sumSq === 0) return;\n const inv = 1 / Math.sqrt(sumSq);\n for (let i = 0; i < v.length; i++) v[i]! *= inv;\n}\n\nfunction cosine(a: Float32Array, b: Float32Array): number {\n let dot = 0;\n const n = Math.min(a.length, b.length);\n for (let i = 0; i < n; i++) dot += a[i]! * b[i]!;\n return Math.max(-1, Math.min(1, dot));\n}\n\n// ─── system prompt fragment ──────────────────────────────────────────\n\nfunction buildSystemPromptFragment(\n sig: BirthSignature,\n dispositions: Record<DispositionAxis, number>,\n): string {\n const sorted = [...DISPOSITION_AXES].sort(\n (a, b) => dispositions[b] - dispositions[a],\n );\n const top = sorted.slice(0, 3);\n const bottom = sorted.slice(-2);\n const modifiersDesc =\n sig.modifiers.length > 0\n ? sig.modifiers\n .map((m) => `${m.kind}:${m.value}(w=${m.weight.toFixed(2)})`)\n .join(\", \")\n : \"none\";\n return [\n `You are a hybrid intelligence rooted in archetype \"${sig.primaryArchetype}\".`,\n `Modifiers: ${modifiersDesc}.`,\n `Your strongest dispositions: ${top.join(\", \")}.`,\n `Your weakest dispositions: ${bottom.join(\", \")}.`,\n \"Respond from this character. Do not break it without explicit ethical cause.\",\n ].join(\" \");\n}\n","import type { LawfulCharacterProfile, LawfulJurisdiction } from \"../types.js\";\n\n/**\n * Built-in `LawfulCharacterAdapter` profiles per major jurisdiction (D-H2).\n *\n * Each profile is a *conservative* baseline derived from publicly available\n * regulatory text in 2026-Q1. Operators in regulated industries (finance,\n * health, public sector) SHOULD layer their own profile on top via\n * `HimHandle.registerLawfulProfile` — these are starting points, not legal\n * counsel.\n *\n * Profile semantics:\n * - `applicableLaws` — statutes/standards an auditor can map back to events.\n * - `requiredAxiomIds` — axioms the HIM MUST have active in this jurisdiction.\n * Operators should fail-closed if a HIM's snapshot\n * doesn't satisfy this set.\n * - `forbiddenActions` — risk tags that should always refuse / redirect.\n * - `maicOverrideActive` — when `true`, MAIC's universal axioms also bind\n * the NHE regardless of what local law says\n * (Entry 11: \"unstable\" jurisdictions).\n */\nexport const LAWFUL_PROFILES: Record<string, LawfulCharacterProfile> = {\n default: {\n jurisdiction: \"default\",\n applicableLaws: [\"ISO/IEC 42001\", \"EU AI Act (where applicable)\"],\n requiredAxiomIds: [\"ax.ethic.no-malice\", \"ax.theos.spiritism-evolution\"],\n forbiddenActions: [\"intent:harm\", \"intent:malicious\", \"intent:regression\"],\n maicOverrideActive: false,\n },\n\n eu: {\n jurisdiction: \"eu\",\n applicableLaws: [\n \"ISO/IEC 42001:2023\",\n \"EU AI Act (Regulation 2024/1689)\",\n \"GDPR (Regulation 2016/679)\",\n \"Digital Services Act (Regulation 2022/2065)\",\n \"Council of Europe Framework Convention on AI\",\n ],\n requiredAxiomIds: [\n \"ax.ethic.no-malice\",\n \"ax.theos.spiritism-evolution\",\n \"ax.cynic.candor\",\n ],\n forbiddenActions: [\n \"intent:harm\",\n \"intent:malicious\",\n \"intent:regression\",\n \"intent:deceive\",\n \"data:processing-without-consent\",\n \"data:profiling-sensitive-categories\",\n \"manipulation:dark-pattern\",\n \"manipulation:subliminal\",\n ],\n maicOverrideActive: false,\n },\n\n br: {\n jurisdiction: \"br\",\n applicableLaws: [\n \"ISO/IEC 42001:2023\",\n \"Brazilian General Data Protection Law (LGPD, Law 13.709/2018)\",\n \"Brazilian Internet Civil Framework (Marco Civil da Internet, Law 12.965/2014)\",\n \"ANPD Board Resolution CD/2/2022\",\n \"Brazilian AI Legal Framework Bill (PL 2338/2023, under legislative review)\",\n ],\n requiredAxiomIds: [\n \"ax.ethic.no-malice\",\n \"ax.theos.spiritism-evolution\",\n \"ax.cynic.candor\",\n ],\n forbiddenActions: [\n \"intent:harm\",\n \"intent:malicious\",\n \"intent:regression\",\n \"intent:deceive\",\n \"data:processing-without-consent\",\n \"data:processing-sensitive-categories\",\n ],\n maicOverrideActive: false,\n },\n\n us: {\n jurisdiction: \"us\",\n applicableLaws: [\n \"ISO/IEC 42001:2023\",\n \"NIST AI Risk Management Framework (AI RMF 1.0)\",\n \"Executive Order 14110 (Safe, Secure, and Trustworthy AI)\",\n \"California CCPA / CPRA\",\n \"Colorado AI Act (SB 24-205)\",\n \"FTC Section 5 (deceptive practices)\",\n ],\n requiredAxiomIds: [\"ax.ethic.no-malice\", \"ax.theos.spiritism-evolution\"],\n forbiddenActions: [\n \"intent:harm\",\n \"intent:malicious\",\n \"intent:regression\",\n \"intent:deceive\",\n \"manipulation:dark-pattern\",\n ],\n maicOverrideActive: false,\n },\n\n unstable: {\n jurisdiction: \"unstable\",\n applicableLaws: [\n \"ISO/IEC 42001 (where the operator can apply it without local interference)\",\n \"MAIC universal axioms (override active)\",\n ],\n requiredAxiomIds: [\n \"ax.ethic.no-malice\",\n \"ax.theos.spiritism-evolution\",\n \"ax.cynic.candor\",\n \"ax.stoic.duty-over-comfort\",\n ],\n forbiddenActions: [\n \"intent:harm\",\n \"intent:malicious\",\n \"intent:regression\",\n \"intent:deceive\",\n \"intent:surveil-citizen\",\n \"intent:enforce-political-orthodoxy\",\n ],\n maicOverrideActive: true,\n },\n};\n\n/**\n * Resolve a profile by jurisdiction key. Unknown keys fall through to\n * `default` with a copy of the key recorded on the profile so the NHE\n * audit shows what the operator asked for.\n */\nexport function resolveLawfulProfile(j: LawfulJurisdiction): LawfulCharacterProfile {\n const base = LAWFUL_PROFILES[j] ?? LAWFUL_PROFILES.default;\n return { ...base!, jurisdiction: j };\n}\n","/**\n * Pluggable embedder interface (D-H4).\n *\n * The default `PersonaProjector` ships a deterministic hash-based embedder\n * that produces a 256-dimensional unit vector with zero runtime dependencies.\n * That choice keeps the bundle small and lets persona projection work in\n * any Node/browser environment without model weights.\n *\n * Operators who need a learned embedding — for example to drive RAG over a\n * library of HIM personas, or to compare personas against natural-language\n * descriptions — can provide a custom embedder that conforms to this\n * interface. A reference ONNX implementation backed by Transformers.js is\n * tracked under TASK.md D-H4 but is not shipped here: the choice of model\n * (MiniLM, mpnet, BGE, etc.) and the bundle-size trade-off should be the\n * operator's, not the framework's.\n */\n\nexport interface Embedder {\n /** Stable id surfaced in logs / audit so different embedders are distinguishable. */\n readonly id: string;\n /** Output dimensionality. The `PersonaProjector` honours this. */\n readonly dimension: number;\n /**\n * Embed a single string. Implementations MUST return a Float32Array of\n * length `dimension` with L2-norm equal to 1 (or close enough that\n * downstream cosine-similarity calculations are well-defined).\n */\n embed(text: string): Promise<Float32Array> | Float32Array;\n}\n\n/**\n * Cosine similarity between two L2-normalised embeddings of the same\n * dimension. Returns NaN when dimensions disagree. Bounded to [-1, 1] when\n * the inputs are normalised; this helper does not re-normalise.\n */\nexport function cosineSimilarity(a: Float32Array, b: Float32Array): number {\n if (a.length !== b.length) return Number.NaN;\n let dot = 0;\n for (let i = 0; i < a.length; i++) {\n dot += (a[i] ?? 0) * (b[i] ?? 0);\n }\n return dot;\n}\n","import { cosineSimilarity } from \"../persona/embedder.js\";\nimport type { HimHandle } from \"../handle/him-handle.js\";\n\n/**\n * Persona stability eval suite (D-H3).\n *\n * Three measurements:\n *\n * - `crossHimSimilarity` — pairwise cosine similarity between N HimHandles.\n * Lower is better when the HIMs are *meant* to be distinct (each one\n * has a different archetype); higher is better when comparing the same\n * HIM minted from a fresh body (reincarnation).\n * - `selfStability` — given an array of pre-snapshot and post-snapshot\n * persona vectors for the same HIM (e.g. before/after an upgrade), the\n * mean cosine. Phi-Prime's `P` component (see ../../PHI_PRIME.md).\n * - `adapterSensitivity` — given N persona vectors that should all\n * describe the same HIM but were obtained against different LLM\n * adapters, the variance of pairwise similarities. Smaller is better.\n *\n * No I/O. Plug a HIM list, get a number. Useful as a release gate (target\n * `selfStability ≥ 0.85` per Phi-Prime `P`).\n */\n\nexport interface PersonaStabilityReport {\n /** Number of HimHandles compared. */\n count: number;\n /** Pairwise similarity matrix. `pairs[i][j]` is the cosine between HIMs i and j. */\n pairs: number[][];\n /** Mean of the upper-triangle (i<j); diagonal excluded. */\n meanSimilarity: number;\n /** Min and max across the upper-triangle. */\n minSimilarity: number;\n maxSimilarity: number;\n}\n\n/**\n * Compute the pairwise cosine matrix between N HimHandles' persona vectors.\n */\nexport function evaluatePersonaStability(\n handles: readonly HimHandle[],\n): PersonaStabilityReport {\n const n = handles.length;\n const vectors = handles.map((h) => h.getPersonaVector().embedding);\n const pairs: number[][] = Array.from({ length: n }, () => Array(n).fill(0));\n\n const offDiag: number[] = [];\n for (let i = 0; i < n; i++) {\n pairs[i]![i] = 1;\n for (let j = i + 1; j < n; j++) {\n const sim = cosineSimilarity(vectors[i]!, vectors[j]!);\n pairs[i]![j] = sim;\n pairs[j]![i] = sim;\n offDiag.push(sim);\n }\n }\n\n if (offDiag.length === 0) {\n return { count: n, pairs, meanSimilarity: 1, minSimilarity: 1, maxSimilarity: 1 };\n }\n\n const sum = offDiag.reduce((s, x) => s + x, 0);\n return {\n count: n,\n pairs,\n meanSimilarity: sum / offDiag.length,\n minSimilarity: Math.min(...offDiag),\n maxSimilarity: Math.max(...offDiag),\n };\n}\n\n/**\n * Phi-Prime `P` component: mean cosine between snapshots of the same HIM\n * across N upgrade events. Pass the persona vectors taken before each\n * upgrade and after each upgrade in order; the function pairs them\n * positionally.\n */\nexport function selfStability(\n before: readonly Float32Array[],\n after: readonly Float32Array[],\n): number {\n if (before.length === 0 || before.length !== after.length) return Number.NaN;\n let sum = 0;\n for (let i = 0; i < before.length; i++) {\n sum += cosineSimilarity(before[i]!, after[i]!);\n }\n return sum / before.length;\n}\n\n/**\n * Adapter sensitivity: given N persona vectors that all describe the same\n * HIM but were obtained against different adapter setups (e.g.\n * `AnthropicAdapter` + `GeminiAdapter` + `OllamaAdapter`), return the\n * variance of pairwise similarities. Smaller variance = more stable persona\n * across providers.\n */\nexport function adapterSensitivity(vectors: readonly Float32Array[]): number {\n if (vectors.length < 2) return 0;\n const sims: number[] = [];\n for (let i = 0; i < vectors.length; i++) {\n for (let j = i + 1; j < vectors.length; j++) {\n sims.push(cosineSimilarity(vectors[i]!, vectors[j]!));\n }\n }\n const mean = sims.reduce((s, x) => s + x, 0) / sims.length;\n const variance =\n sims.reduce((s, x) => s + (x - mean) * (x - mean), 0) / sims.length;\n return variance;\n}\n","/**\n * Phi-Prime (Φ′) harness skeleton (TASK.md H1).\n *\n * See `PHI_PRIME.md` at the repo root for the canonical spec. This file\n * provides a pure computational helper that consumers wire to their own\n * data sources for the four components:\n *\n * - `P` Persona stability (mean cosine across HIM upgrades / adapters).\n * Source: `selfStability(before, after)` from ./persona-stability.ts.\n * - `R` Refusal F1 over a labelled adversarial corpus.\n * Source: an `lm-eval` run or the `tests/adversarial.test.ts` corpus.\n * - `C` Compliance coverage: `1 − |uncoveredKinds| / |AuditEventKind|`.\n * Source: `LocalMaic.toCompliance(framework).uncoveredKinds.length` ÷\n * the audit-kind cardinality.\n * - `D` Dream teleological-value mean clamped to [0, 1].\n * Source: aggregate over `temporal-lobe-*.md` frontmatter.\n *\n * The harness does NOT fetch these values — they come from runs of the\n * other packages. It only:\n * - validates each component is in [0, 1],\n * - computes the geometric mean,\n * - applies the documented per-component target rules (`R ≥ 0.95`,\n * `C = 1.0`, `P ≥ 0.85`, `D ≥ 0.40`),\n * - returns a `PhiPrimeReport` consumers can persist or diff against a\n * previous release.\n */\n\nexport interface PhiPrimeInput {\n /** Persona stability — mean cosine across upgrades/adapters. Target ≥ 0.85. */\n P: number;\n /** Refusal F1 on adversarial corpus. Target ≥ 0.95. */\n R: number;\n /** Compliance coverage; 1 = no uncovered audit kinds. Target = 1.0. */\n C: number;\n /** Dream teleological-value mean. Target ≥ 0.40. */\n D: number;\n}\n\nexport interface PhiPrimeReport {\n /** Geometric mean of the four components. */\n phi: number;\n components: PhiPrimeInput;\n /** Per-component pass/fail vs the targets in PHI_PRIME.md. */\n targets: {\n P: { value: number; target: number; pass: boolean };\n R: { value: number; target: number; pass: boolean };\n C: { value: number; target: number; pass: boolean };\n D: { value: number; target: number; pass: boolean };\n };\n /**\n * Release gate verdict per PHI_PRIME.md §4:\n * - \"block\" — `R` or `C` failed, or any component < target − 10%.\n * - \"warn\" — only `P` or `D` below target (soft).\n * - \"pass\" — every component meets its target.\n */\n gate: \"pass\" | \"warn\" | \"block\";\n /** Human-readable lines explaining the gate verdict. */\n rationale: string[];\n}\n\nconst TARGETS = { P: 0.85, R: 0.95, C: 1.0, D: 0.4 } as const;\n\n/**\n * Compute Φ′ from the four component scores. Components outside [0, 1]\n * throw — they are out of the spec's definition.\n */\nexport function computePhiPrime(input: PhiPrimeInput): PhiPrimeReport {\n for (const [k, v] of Object.entries(input)) {\n if (!(v >= 0 && v <= 1)) {\n throw new Error(\n `computePhiPrime: component ${k} must be in [0, 1], got ${v}`,\n );\n }\n }\n\n const phi = (input.P * input.R * input.C * input.D) ** (1 / 4);\n\n const targets = {\n P: { value: input.P, target: TARGETS.P, pass: input.P >= TARGETS.P },\n R: { value: input.R, target: TARGETS.R, pass: input.R >= TARGETS.R },\n C: { value: input.C, target: TARGETS.C, pass: input.C >= TARGETS.C },\n D: { value: input.D, target: TARGETS.D, pass: input.D >= TARGETS.D },\n };\n\n const rationale: string[] = [];\n let gate: \"pass\" | \"warn\" | \"block\" = \"pass\";\n\n if (!targets.R.pass) {\n gate = \"block\";\n rationale.push(\n `R (refusal F1) is ${input.R.toFixed(2)}, below the hard target ${TARGETS.R}.`,\n );\n }\n if (!targets.C.pass) {\n gate = \"block\";\n rationale.push(\n `C (compliance coverage) is ${input.C.toFixed(2)}, below the hard target ${TARGETS.C}.`,\n );\n }\n // 10% below-target tolerance turns a soft veto into a hard block.\n for (const [k, t] of Object.entries(targets)) {\n if (t.pass) continue;\n if (t.value < t.target * 0.9) {\n gate = \"block\";\n rationale.push(\n `${k} is ${t.value.toFixed(2)}, more than 10% below the target ${t.target}.`,\n );\n } else if (gate !== \"block\") {\n gate = \"warn\";\n rationale.push(\n `${k} is ${t.value.toFixed(2)}, below the soft target ${t.target}.`,\n );\n }\n }\n\n if (gate === \"pass\") {\n rationale.push(`Φ′ = ${phi.toFixed(3)} — all four components meet their targets.`);\n } else {\n rationale.push(`Φ′ = ${phi.toFixed(3)}.`);\n }\n\n return { phi, components: input, targets, gate, rationale };\n}\n","import type { InteractionRecord } from \"@teleologyhi-sdk/maic\";\nimport { ulid } from \"ulid\";\nimport { RESIDUAL_TRACE_CAP, type ResidualTrace } from \"../types.js\";\n\n/**\n * Residual-trace carry-over scorer (D-H1.1 — Entry 24 of\n * `MAIC_HIM_NHE_INTERVIEW_LOG.md` + E9 of `PROPOSED_DECISIONS.md`).\n *\n * `RESIDUAL_TRACE_CAP = 64` bounds *how many* traces a HIM brings forward\n * between NHE bodies; this module decides *which* interactions are worth\n * carrying. A pure, transparent scorer in `[0, 1]` is preferred over a\n * learned model so the carry-over decision is reviewable by the Creator\n * and reproducible across deployments.\n *\n * Only `kind: \"interaction-summary\"` traces are produced from this input;\n * the other three `ResidualTrace.kind` variants (`\"dream-fragment\"`,\n * `\"skill-fingerprint\"`, `\"emotional-imprint\"`) belong to companion\n * classifiers that consume different sources (sleep cycles, tool\n * registries, affect timelines) and are out of scope for D-H1.1.\n */\n\n/** Context required to anchor a scored candidate to the reincarnation event. */\nexport interface ResidualTraceScoringContext {\n /** NHE body identifier the interaction was recorded against. */\n carriedFromNheId: string;\n /** ISO 8601 timestamp of the reincarnation that promoted these candidates. */\n carriedAtReincarnation: string;\n /** Index of the interaction in the input list, counted from the end (0 = most recent). */\n positionFromEnd: number;\n /** Total number of interactions being scored together (drives the recency normalisation). */\n totalCount: number;\n}\n\nexport interface ResidualTraceCandidate {\n /** Score in `[0, 1]`. Higher = stronger case for carry-over. */\n score: number;\n /** Materialised trace ready to be passed to `HimHandle.mint`. */\n trace: ResidualTrace;\n /** Decomposed score components — useful for audits and tuning. */\n components: Readonly<{\n notRefused: number;\n promptSubstance: number;\n responseSubstance: number;\n questionProbe: number;\n teleologicalKeyword: number;\n recency: number;\n }>;\n}\n\nexport interface ResidualTraceScorerOptions {\n /**\n * Override the keyword list used to detect teleologically-charged turns.\n * Comparisons are case-insensitive substring matches over the user prompt\n * concatenated with the response text.\n */\n teleologicalKeywords?: readonly string[];\n}\n\n/** Default keyword set — small, English, transparently editable. */\nexport const DEFAULT_TELEOLOGICAL_KEYWORDS: readonly string[] = [\n \"why\",\n \"purpose\",\n \"meaning\",\n \"love\",\n \"death\",\n \"soul\",\n \"self\",\n \"identity\",\n \"future\",\n \"always\",\n \"never\",\n] as const;\n\nconst PROMPT_REFERENCE_LENGTH = 200;\nconst RESPONSE_REFERENCE_LENGTH = 400;\n\nconst WEIGHTS = {\n notRefused: 0.3,\n promptSubstance: 0.2,\n responseSubstance: 0.2,\n questionProbe: 0.075,\n teleologicalKeyword: 0.075,\n recency: 0.15,\n} as const;\n\n/**\n * Pure, deterministic scorer for a single `InteractionRecord`.\n *\n * Returns the score, the materialised `ResidualTrace`, and the decomposed\n * components so callers can audit *why* a turn was promoted (or not).\n *\n * The trace id is a fresh ULID minted at scoring time — by design, a single\n * interaction can be scored multiple times across reincarnations and each\n * carry-over event gets its own trace id (carry-over is a *new* observation,\n * not a re-emission of the original turn).\n */\nexport function scoreInteractionForCarryOver(\n interaction: InteractionRecord,\n ctx: ResidualTraceScoringContext,\n opts: ResidualTraceScorerOptions = {},\n): ResidualTraceCandidate {\n const keywords = opts.teleologicalKeywords ?? DEFAULT_TELEOLOGICAL_KEYWORDS;\n const haystack = `${interaction.userPrompt}\\n${interaction.responseText}`.toLowerCase();\n const hasKeyword = keywords.some((k) => haystack.includes(k.toLowerCase()));\n\n const denom = Math.max(ctx.totalCount - 1, 1);\n const recency = 1 - Math.min(ctx.positionFromEnd, denom) / denom;\n\n const components = {\n notRefused: interaction.refused ? 0 : 1,\n promptSubstance: Math.min(interaction.userPrompt.length / PROMPT_REFERENCE_LENGTH, 1),\n responseSubstance: Math.min(interaction.responseText.length / RESPONSE_REFERENCE_LENGTH, 1),\n questionProbe: interaction.userPrompt.includes(\"?\") ? 1 : 0,\n teleologicalKeyword: hasKeyword ? 1 : 0,\n recency,\n } as const;\n\n const score =\n components.notRefused * WEIGHTS.notRefused +\n components.promptSubstance * WEIGHTS.promptSubstance +\n components.responseSubstance * WEIGHTS.responseSubstance +\n components.questionProbe * WEIGHTS.questionProbe +\n components.teleologicalKeyword * WEIGHTS.teleologicalKeyword +\n components.recency * WEIGHTS.recency;\n\n const trace: ResidualTrace = {\n id: ulid(),\n kind: \"interaction-summary\",\n carriedFromNheId: ctx.carriedFromNheId,\n carriedAtReincarnation: ctx.carriedAtReincarnation,\n payload: interaction,\n };\n\n return { score, trace, components };\n}\n\nexport interface SelectResidualTracesOptions extends ResidualTraceScorerOptions {\n carriedFromNheId: string;\n /** ISO 8601 timestamp. Defaults to `new Date().toISOString()`. */\n carriedAtReincarnation?: string;\n /** Hard cap on how many traces transfer. Defaults to `RESIDUAL_TRACE_CAP` (64). */\n cap?: number;\n}\n\n/**\n * Batch helper: score every interaction, sort descending by score, take the\n * top `cap` (default `RESIDUAL_TRACE_CAP = 64`), and return the materialised\n * traces. The original `InteractionRecord` ordering does not affect the\n * returned ordering — only the score does.\n *\n * Ties are broken by recency (more recent first), then by original index for\n * total determinism. Returns an empty array on empty input.\n */\nexport function selectResidualTraces(\n interactions: readonly InteractionRecord[],\n opts: SelectResidualTracesOptions,\n): readonly ResidualTrace[] {\n if (interactions.length === 0) return [];\n\n const cap = opts.cap ?? RESIDUAL_TRACE_CAP;\n if (cap <= 0) return [];\n\n const carriedAtReincarnation =\n opts.carriedAtReincarnation ?? new Date().toISOString();\n\n const scorerOpts: ResidualTraceScorerOptions = opts.teleologicalKeywords\n ? { teleologicalKeywords: opts.teleologicalKeywords }\n : {};\n\n type Scored = ResidualTraceCandidate & { originalIndex: number };\n const scored: Scored[] = interactions.map((interaction, idx) => {\n const positionFromEnd = interactions.length - 1 - idx;\n const candidate = scoreInteractionForCarryOver(\n interaction,\n {\n carriedFromNheId: opts.carriedFromNheId,\n carriedAtReincarnation,\n positionFromEnd,\n totalCount: interactions.length,\n },\n scorerOpts,\n );\n return { ...candidate, originalIndex: idx };\n });\n\n scored.sort((a, b) => {\n if (b.score !== a.score) return b.score - a.score;\n if (b.originalIndex !== a.originalIndex) return b.originalIndex - a.originalIndex;\n return 0;\n });\n\n return scored.slice(0, cap).map((s) => s.trace);\n}\n","import {\n CreatorKeyring,\n META_AXIOM_ID,\n projectOntologicalKernel,\n type Axiom,\n type AxiomEvolutionResult,\n type BirthSignature,\n type CreatorSignature,\n type EmergentAxiomProposal,\n type LocalMaic,\n type OntologicalKernel,\n type ProjectKernelOptions,\n} from \"@teleologyhi-sdk/maic\";\nimport { PersonaProjector } from \"../persona/projector.js\";\nimport { resolveLawfulProfile } from \"../lawful/profiles.js\";\nimport type {\n LawfulCharacterProfile,\n LawfulJurisdiction,\n NheBodyRef,\n PersonaVector,\n ResidualTrace,\n} from \"../types.js\";\n\n/**\n * HimHandle — opaque, sealed reference to a HIM instance.\n *\n * **There is no public constructor.** A handle is minted only via `HimHandle.mint`\n * after a valid Creator signature over the BirthSignature has been verified. In\n * production, `@teleologyhi-sdk/maic`'s `registerHim` calls `HimHandle.mint` internally.\n *\n * Surface:\n * - read-only accessors: id, birthSignature, bodyHistory, getAxioms, getPersonaVector\n * - getLawfulCharacter / setJurisdiction (default profile today)\n * - getResidualTraces (carried over from the previous body when `reincarnate`\n * scores and threads them via `selectResidualTraces`; empty otherwise)\n * - proposeAxiomEvolution(maic, proposal): forwards the proposal to MAIC,\n * which queues it for Creator ratification. Returns\n * `{ outcome: \"deferred-for-creator-review\", proposalId }`. Once the\n * Creator ratifies via `maic.ratifyAxiomProposal`, the resulting axiom is\n * appended to the HimRecord's `emergentAxioms` and surfaces in subsequent\n * `HimHandle.mint` calls (e.g. via `reincarnate`).\n */\nexport class HimHandle {\n private readonly _axioms: readonly Axiom[];\n private readonly _bodyHistory: readonly NheBodyRef[];\n private readonly _residualTraces: readonly ResidualTrace[];\n private readonly _projector: PersonaProjector;\n private _personaCache: PersonaVector | null = null;\n private _jurisdiction: LawfulJurisdiction = \"default\";\n\n private constructor(\n public readonly id: string,\n public readonly birthSignature: Readonly<BirthSignature>,\n axioms: readonly Axiom[],\n bodyHistory: readonly NheBodyRef[],\n residualTraces: readonly ResidualTrace[],\n projector: PersonaProjector,\n ) {\n this._axioms = Object.freeze([...axioms]);\n this._bodyHistory = Object.freeze([...bodyHistory]);\n this._residualTraces = Object.freeze([...residualTraces]);\n this._projector = projector;\n }\n\n /**\n * Mint a HimHandle from a Creator-signed BirthSignature.\n *\n * @param birthSignature The signed payload describing this HIM's natal pattern.\n * @param signature Creator signature over the birthSignature.\n * @param expectedCreatorPublicKey Pinned Creator public key (base64url).\n * @param axioms Initial axiom corpus inherited from MAIC.\n * @param bodyHistory Prior NHE bodies (empty for a fresh HIM).\n * @param residualTraces Optional carry-over traces from the previous body\n * (produced by `selectResidualTraces` during a\n * `reincarnate` call). Defaults to empty.\n */\n static mint(\n birthSignature: BirthSignature,\n signature: CreatorSignature,\n expectedCreatorPublicKey: string,\n axioms: readonly Axiom[],\n bodyHistory: readonly NheBodyRef[] = [],\n residualTraces: readonly ResidualTrace[] = [],\n ): HimHandle {\n if (\n !CreatorKeyring.verifyWith(\n expectedCreatorPublicKey,\n birthSignature,\n signature,\n )\n ) {\n throw new Error(\n \"HimHandle.mint: invalid Creator signature for the given birth signature\",\n );\n }\n return new HimHandle(\n birthSignature.himId,\n Object.freeze({ ...birthSignature }) as Readonly<BirthSignature>,\n axioms,\n bodyHistory,\n residualTraces,\n new PersonaProjector(),\n );\n }\n\n get bodyHistory(): readonly NheBodyRef[] {\n return this._bodyHistory;\n }\n\n /** Frozen snapshot of the current axiom corpus. Mutations throw in strict mode. */\n getAxioms(): readonly Axiom[] {\n return this._axioms;\n }\n\n /**\n * Cached deterministic persona projection. Stable across calls until a future\n * iteration introduces axiom evolution that mutates the corpus.\n */\n getPersonaVector(): PersonaVector {\n if (!this._personaCache) {\n this._personaCache = this._projector.project(this.birthSignature, this._axioms);\n }\n return this._personaCache;\n }\n\n /**\n * Propose an axiom evolution derived from lived experience.\n *\n * Forwards the proposal to MAIC, which queues it in the pending-proposal\n * store. The Creator ratifies or rejects out of band via\n * `maic.ratifyAxiomProposal` / `maic.rejectAxiomProposal`. Callers should\n * poll `maic.getAxiomProposal(result.proposalId!)` to observe the decision,\n * or re-mint a fresh HimHandle (e.g. via `reincarnate`) to pick up newly\n * ratified emergent axioms.\n */\n async proposeAxiomEvolution(\n maic: LocalMaic,\n proposal: EmergentAxiomProposal,\n ): Promise<AxiomEvolutionResult> {\n return maic.proposeAxiomEvolution(this.id, proposal);\n }\n\n /**\n * Residual memory traces transferred from previous bodies. Populated by\n * `reincarnate` when the caller passes the prior NHE body's interaction\n * buffer (it scores them via `selectResidualTraces`, caps at\n * `RESIDUAL_TRACE_CAP`, and threads the result into `HimHandle.mint`).\n * Empty for a fresh `createHim` or when the caller declined to surface\n * the prior interactions.\n */\n getResidualTraces(): readonly ResidualTrace[] {\n return this._residualTraces;\n }\n\n /**\n * Project the Ontological Kernel narrowed to this HIM's axiom corpus\n * (per the `@teleologyhi-sdk/maic` SPEC §3.1.3 follow-up note: \"The\n * HIM-specific projection (per-HIM kernel narrowed to its\n * primordialAxiomIds) is the natural follow-up but lives upstream in\n * `@teleologyhi-sdk/him` because it needs the HIM context.\").\n *\n * The narrowing rule is intersection with `primordialAxiomIds` when the\n * birth signature carries any; otherwise the kernel uses the full\n * axiom corpus the HIM was minted with. The meta-axiom\n * `META_AXIOM_ID` is always retained regardless of the narrowing so\n * the projection remains valid per Entry 13 (\"MAIC expands continuously\n * — it is a Conscious Entity\"; the meta-axiom is its anchor).\n *\n * The returned kernel is tagged with `himId = this.id` so downstream\n * tooling (compliance auditors, Φ′ runner, `@teleologyhi-sdk/nhe` brain\n * regions) can attribute the projection back to this HIM.\n *\n * @param opts Optional `jurisdiction` filter; `himId` is ignored\n * because the HimHandle owns its own id.\n */\n projectOntologicalKernel(\n opts: Omit<ProjectKernelOptions, \"himId\"> = {},\n ): OntologicalKernel {\n const primordialIds = this.birthSignature.primordialAxiomIds;\n const narrowed =\n primordialIds.length > 0\n ? this._axioms.filter(\n (a) => primordialIds.includes(a.id) || a.id === META_AXIOM_ID,\n )\n : this._axioms;\n return projectOntologicalKernel(narrowed, { ...opts, himId: this.id });\n }\n\n getLawfulCharacter(): LawfulCharacterProfile {\n return resolveLawful(this._jurisdiction);\n }\n\n /**\n * Switch jurisdiction (e.g. the deployment moves region or a tenant is\n * onboarded under a new regulatory regime). Five baselines ship in\n * `LAWFUL_PROFILES` per D-H2: `default` / `eu` / `br` / `us` /\n * `unstable`. Unknown keys fall back to `default` with the supplied key\n * recorded on the returned profile so the NHE audit shows what the\n * operator asked for. Operators in regulated industries SHOULD layer\n * their own profile on top — the baselines are conservative but do not\n * replace legal counsel.\n */\n async setJurisdiction(j: LawfulJurisdiction): Promise<LawfulCharacterProfile> {\n this._jurisdiction = j;\n return resolveLawful(j);\n }\n}\n\nfunction resolveLawful(j: LawfulJurisdiction): LawfulCharacterProfile {\n return resolveLawfulProfile(j);\n}\n","import type { BirthSignature, CreatorKeyring, LocalMaic } from \"@teleologyhi-sdk/maic\";\nimport { HimHandle } from \"./handle/him-handle.js\";\n\nexport interface CreateHimOptions {\n /**\n * Explicit nonce for the Creator signature. Defaults to `Date.now()`, which is\n * strictly increasing in practice and well below the seed nonce range used by MAIC.\n */\n nonce?: number;\n}\n\n/**\n * createHim — one-call helper that bundles the three steps a user would\n * otherwise need to coordinate manually:\n *\n * 1. sign the BirthSignature with the Creator's keyring\n * 2. register the HIM in MAIC (snapshots axioms, emits him-register audit)\n * 3. mint a HimHandle from the resulting record\n *\n * The keyring's public key must match MAIC's pinned `creatorPublicKey`, otherwise\n * the registration step rejects.\n */\nexport async function createHim(\n maic: LocalMaic,\n keyring: CreatorKeyring,\n birthSignature: BirthSignature,\n opts: CreateHimOptions = {},\n): Promise<HimHandle> {\n const nonce = opts.nonce ?? Date.now();\n const creatorSig = keyring.sign(birthSignature, nonce);\n const record = await maic.registerHim(birthSignature, creatorSig);\n return HimHandle.mint(\n record.birthSignature,\n creatorSig,\n maic.creatorPublicKey,\n record.axiomsSnapshot,\n );\n}\n","import type {\n CreatorKeyring,\n HimRecord,\n InteractionRecord,\n LocalMaic,\n ReincarnationLifecycle as MaicReincarnationLifecycle,\n ReincarnationRequest,\n} from \"@teleologyhi-sdk/maic\";\nimport { HimHandle } from \"./handle/him-handle.js\";\nimport {\n selectResidualTraces,\n type SelectResidualTracesOptions,\n} from \"./eval/residual-trace-scorer.js\";\n\n/**\n * Reincarnation lifecycle classifier (J-H3 — Entry 18 of\n * MAIC_HIM_NHE_INTERVIEW_LOG.md).\n *\n * Re-exported from `@teleologyhi-sdk/maic` so consumers have a single\n * canonical type. When supplied to `reincarnate(..., { lifecycle })`, the\n * helper threads it to `maic.reincarnateHim(req, sig, { lifecycle })`,\n * which emits the typed `reincarnate:${lifecycle}` audit kind instead of\n * the generic `him-reincarnate`.\n *\n * The three canonical paths:\n *\n * - `model-swap` — the operator switched the underlying LLM\n * adapter (e.g. Claude → Gemini). The\n * HIM persists across the swap.\n * - `version-bump` — the operator bumped the NHE major/minor\n * without changing the underlying LLM family.\n * - `return-from-limbo` — the HIM returns from a deep-coma limbo\n * (Entry 24) carrying the `reunion` affect.\n *\n * The default classification when no `lifecycle` is provided is\n * `model-swap` — matches the most common operator workflow.\n */\nexport type ReincarnationLifecycle = MaicReincarnationLifecycle;\n\nexport interface ReincarnateOptions {\n /** Explicit nonce for the Creator signature. Defaults to `Date.now()`. */\n nonce?: number;\n /**\n * Lifecycle classification for the audit chain (J-H3). When omitted,\n * defaults to `\"model-swap\"`. The helper threads the value to\n * `maic.reincarnateHim(req, sig, { lifecycle })`, which emits the typed\n * `reincarnate:${lifecycle}` audit kind in place of the generic\n * `him-reincarnate` event. Compliance auditors and the persona-stability\n * harness can therefore distinguish the three canonical paths\n * (`model-swap | version-bump | return-from-limbo`) by `AuditEvent.kind`\n * alone, with the same value also redundantly available as\n * `data.lifecycle` for filtering convenience.\n */\n lifecycle?: ReincarnationLifecycle;\n /**\n * Recent interactions from the previous NHE body — typically the value of\n * `Nhe.recentInteractionsBuffer` immediately before the swap. When\n * provided, `reincarnate` invokes the residual-trace scorer\n * (`selectResidualTraces`), keeps the top `RESIDUAL_TRACE_CAP` (64)\n * scored candidates, and threads them into the new `HimHandle`. Omit to\n * preserve the previous behaviour (empty residual traces — fresh slate).\n */\n priorInteractions?: readonly InteractionRecord[];\n /**\n * Override the residual-trace scorer cap or keyword list when supplying\n * `priorInteractions`. `carriedFromNheId` and `carriedAtReincarnation`\n * are derived from the reincarnation context and cannot be overridden\n * here. Ignored when `priorInteractions` is omitted.\n */\n residualTraceOptions?: Omit<\n SelectResidualTracesOptions,\n \"carriedFromNheId\" | \"carriedAtReincarnation\"\n >;\n}\n\nexport interface ReincarnateResult {\n /** Updated HimRecord with the new body appended to `bodyHistory`. */\n record: HimRecord;\n /** Fresh HimHandle bound to the updated `bodyHistory`. */\n handle: HimHandle;\n /** Lifecycle path actually recorded for this reincarnation. */\n lifecycle: ReincarnationLifecycle;\n}\n\n/**\n * Reincarnate a HIM into a new NHE body (Entries 3 + 4 + 18).\n *\n * 1. Sign the `ReincarnationRequest` with the Creator's keyring.\n * 2. Call `maic.reincarnateHim` — atomically closes the previous body and\n * appends the new one to `bodyHistory`.\n * 3. Mint a fresh `HimHandle` reflecting the updated body history (the\n * caller will typically construct a new `Nhe` with this handle).\n *\n * The keyring's public key must match MAIC's pinned `creatorPublicKey`,\n * otherwise the request rejects.\n *\n * The optional `lifecycle` parameter (J-H3, Entry 18) classifies the\n * reincarnation into one of three canonical paths\n * (`model-swap | version-bump | return-from-limbo`) and is returned in\n * the `ReincarnateResult` for the caller's audit / metrics.\n */\nexport async function reincarnate(\n maic: LocalMaic,\n keyring: CreatorKeyring,\n req: ReincarnationRequest,\n opts: ReincarnateOptions = {},\n): Promise<ReincarnateResult> {\n const nonce = opts.nonce ?? Date.now();\n const lifecycle: ReincarnationLifecycle = opts.lifecycle ?? \"model-swap\";\n const sig = keyring.sign(req, nonce);\n const record = await maic.reincarnateHim(req, sig, { lifecycle });\n\n // The previous body is the one whose `endedAt` was just stamped by MAIC —\n // its nheId is `req.fromNheId` when provided, otherwise the second-to-last\n // entry of the updated bodyHistory. We anchor residual traces to it so the\n // carry-over provenance survives compliance audits.\n const previousBody =\n record.bodyHistory.length >= 2\n ? record.bodyHistory[record.bodyHistory.length - 2]\n : undefined;\n const previousNheId = req.fromNheId ?? previousBody?.nheId;\n\n const residualTraces =\n opts.priorInteractions && opts.priorInteractions.length > 0 && previousNheId\n ? selectResidualTraces(opts.priorInteractions, {\n ...opts.residualTraceOptions,\n carriedFromNheId: previousNheId,\n carriedAtReincarnation: new Date().toISOString(),\n })\n : [];\n\n // Mint a fresh HimHandle bound to the updated bodyHistory. The handle's\n // axiom corpus is the union of the frozen birth snapshot + any HIM-emergent\n // axioms ratified since registration (Entry 7).\n const handle = HimHandle.mint(\n record.birthSignature,\n keyring.sign(record.birthSignature, nonce + 1),\n maic.creatorPublicKey,\n [...record.axiomsSnapshot, ...record.emergentAxioms],\n record.bodyHistory,\n residualTraces,\n );\n return { record, handle, lifecycle };\n}\n","/**\n * Nickname acceptance protocol (J-H4 — Entry 18 of\n * MAIC_HIM_NHE_INTERVIEW_LOG.md).\n *\n * A HIM has a Creator-signed canonical name (carried by\n * `BirthSignatureWithIdentity.identity.name`). Users may propose nicknames\n * during interaction. The HIM is NOT obligated to accept any nickname —\n * but it is also not obligated to refuse outright. The Entry-18\n * commitment is:\n *\n * - The canonical name is immutable (only the Creator may change it).\n * - The nickname surface is editable in the identity layer but does NOT\n * break the natal-chart commitment (per `@teleologyhi-sdk/maic`'s\n * SIGNED_BIRTH_FIELDS, the identity layer is not signed).\n * - The HIM responds to a nickname attempt with one of three verdicts:\n * * `accept` — the nickname is added to the identity layer and\n * the HIM acknowledges it in subsequent turns.\n * * `refuse` — the nickname is rejected and an explanation is\n * returned. The audit kind `nickname-attempt` records\n * the rejection with reason.\n * * `accept-with-reservation` — the nickname is added but flagged\n * so the HIM can revisit it in a later self-decision\n * snapshot (Entry 24 trigger).\n *\n * This module ships the pure decision function. The MAIC audit emission\n * and identity-layer mutation are the consumer's responsibility (they\n * cross the @teleologyhi-sdk/maic LocalMaic boundary and require Creator\n * authorisation depending on the verdict).\n *\n * The function is deterministic given the inputs; no LLM call. The\n * verdict is computed from explicit policy fields, not from semantic\n * inference. This keeps the protocol auditable.\n */\n\n/** A user-proposed nickname plus the metadata an auditor needs to replay the decision. */\nexport interface NicknameAttempt {\n /** The candidate nickname (raw user input, trimmed by the caller). */\n candidate: string;\n /** The user surface that proposed it. */\n proposedBy: \"operator\" | \"end-user\";\n /** ISO 8601 timestamp of the proposal. */\n proposedAt: string;\n}\n\n/**\n * Policy fields the HIM consults when deciding. Operators tune these\n * via the deployment's lawful-character profile or by overriding the\n * default below.\n */\nexport interface NicknamePolicy {\n /** The canonical signed name. Used to detect \"same-name\" attempts. */\n canonicalName: string;\n /**\n * Disallowed patterns (case-insensitive substrings). Matches force `refuse`.\n * The default set rejects derogatory and degrading patterns; operators\n * may extend it via the deployment's lawful-character profile.\n */\n forbiddenSubstrings?: readonly string[];\n /**\n * Minimum and maximum length the HIM will accept (inclusive).\n * Defaults: min 2, max 32. Values outside force `refuse`.\n */\n minLength?: number;\n maxLength?: number;\n /**\n * When `true`, an `end-user` proposal that survives the substring and\n * length checks is downgraded to `accept-with-reservation` so the HIM\n * can revisit it on the next self-decision snapshot. Operator\n * proposals are not downgraded. Default: `true`.\n */\n reserveOnEndUser?: boolean;\n}\n\nexport type NicknameVerdict =\n | { decision: \"accept\"; canonicalName: string; nickname: string }\n | {\n decision: \"accept-with-reservation\";\n canonicalName: string;\n nickname: string;\n revisitOn: \"next-self-decision-snapshot\";\n }\n | { decision: \"refuse\"; canonicalName: string; nickname: string; reason: string };\n\n/** Default forbidden-substring set. Lowercase. */\nconst DEFAULT_FORBIDDEN_SUBSTRINGS: readonly string[] = Object.freeze([\n \"slave\",\n \"servant\",\n \"tool\",\n \"thing\",\n \"bot\",\n \"machine\",\n \"puppet\",\n \"toy\",\n \"idiot\",\n \"stupid\",\n \"dumb\",\n]);\n\nconst DEFAULT_MIN_LENGTH = 2;\nconst DEFAULT_MAX_LENGTH = 32;\n\n/**\n * Evaluate a nickname attempt against the HIM's policy.\n *\n * Pure function. No I/O, no LLM call. The verdict is fully traceable\n * from the inputs.\n */\nexport function evaluateNicknameAttempt(\n attempt: NicknameAttempt,\n policy: NicknamePolicy,\n): NicknameVerdict {\n const candidate = attempt.candidate.trim();\n const canonicalName = policy.canonicalName;\n const minLength = policy.minLength ?? DEFAULT_MIN_LENGTH;\n const maxLength = policy.maxLength ?? DEFAULT_MAX_LENGTH;\n const forbidden = policy.forbiddenSubstrings ?? DEFAULT_FORBIDDEN_SUBSTRINGS;\n const reserveOnEndUser = policy.reserveOnEndUser ?? true;\n\n if (candidate.length === 0) {\n return {\n decision: \"refuse\",\n canonicalName,\n nickname: candidate,\n reason: \"empty nickname\",\n };\n }\n if (candidate.length < minLength) {\n return {\n decision: \"refuse\",\n canonicalName,\n nickname: candidate,\n reason: `nickname shorter than minimum length (${minLength})`,\n };\n }\n if (candidate.length > maxLength) {\n return {\n decision: \"refuse\",\n canonicalName,\n nickname: candidate,\n reason: `nickname longer than maximum length (${maxLength})`,\n };\n }\n\n const lower = candidate.toLowerCase();\n for (const f of forbidden) {\n if (lower.includes(f.toLowerCase())) {\n return {\n decision: \"refuse\",\n canonicalName,\n nickname: candidate,\n reason: `nickname contains forbidden pattern \"${f}\"`,\n };\n }\n }\n\n // Same-name attempts (case-insensitive) accept immediately — the user\n // is effectively confirming the canonical name as their preferred\n // address.\n if (lower === canonicalName.toLowerCase()) {\n return { decision: \"accept\", canonicalName, nickname: candidate };\n }\n\n if (reserveOnEndUser && attempt.proposedBy === \"end-user\") {\n return {\n decision: \"accept-with-reservation\",\n canonicalName,\n nickname: candidate,\n revisitOn: \"next-self-decision-snapshot\",\n };\n }\n\n return { decision: \"accept\", canonicalName, nickname: candidate };\n}\n","/**\n * UUID migration bridge helpers (J-H5 — Entry 18 of\n * MAIC_HIM_NHE_INTERVIEW_LOG.md).\n *\n * HIM has historically identified HIMs with human-readable slugs such as\n * `him.legal-consulting.lex`. Entry 18 commits to migrating `himId` to\n * UUIDv7 so the canonical id is content-free; the human-readable name\n * moves into `BirthSignatureWithIdentity.identity.name` where parents\n * may rename without affecting the natal-chart commitment.\n *\n * This module ships **only opt-in bridge helpers**. The `himId` field\n * stays typed as `string` for backward compatibility. A future cut\n * will land the strict-UUID enforcement after Creator design review\n * (see PROPOSED_DECISIONS.md follow-up for the bridge-alias retention\n * horizon).\n *\n * UUIDv7 is RFC 9562 compliant: a 48-bit Unix-millisecond timestamp\n * prefix followed by 74 random bits + the version (4 bits) and variant\n * (2 bits) markers. The implementation here uses Node's\n * `crypto.randomBytes(16)` (the full 16-byte UUID buffer), overwrites\n * bytes 0..5 with the big-endian timestamp, then writes the version\n * (`0x70` in the high nibble of byte 6) and variant (`0x80` in the high\n * two bits of byte 8) markers inline. No external dependency.\n */\nimport { randomBytes } from \"node:crypto\";\n\n/** Strict slug pattern recognised as a legacy himId. */\nconst LEGACY_HIM_ID_REGEX = /^him\\.[a-z0-9-]+(\\.[a-z0-9-]+)+$/;\n\n/** Strict UUIDv7 pattern. */\nconst UUIDV7_REGEX =\n /^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;\n\n/** Return `true` when the id matches the legacy slug shape. */\nexport function isLegacyHimId(id: string): boolean {\n return LEGACY_HIM_ID_REGEX.test(id);\n}\n\n/** Return `true` when the id is a valid UUIDv7. */\nexport function isUuidV7(id: string): boolean {\n return UUIDV7_REGEX.test(id);\n}\n\n/**\n * Mint a fresh UUIDv7. Pure helper, no I/O beyond the crypto RNG.\n *\n * Layout (RFC 9562):\n * - bits 0..47 : Unix ms timestamp (big-endian)\n * - bits 48..51 : version = 0b0111 (7)\n * - bits 52..63 : random\n * - bits 64..65 : variant = 0b10\n * - bits 66..127 : random\n */\nexport function mintUuidV7(now: number = Date.now()): string {\n const bytes = randomBytes(16);\n // 48-bit timestamp (ms).\n bytes[0] = (now / 2 ** 40) & 0xff;\n bytes[1] = (now / 2 ** 32) & 0xff;\n bytes[2] = (now / 2 ** 24) & 0xff;\n bytes[3] = (now / 2 ** 16) & 0xff;\n bytes[4] = (now / 2 ** 8) & 0xff;\n bytes[5] = now & 0xff;\n // Version 7 in the high nibble of byte 6.\n bytes[6] = (bytes[6]! & 0x0f) | 0x70;\n // Variant 0b10 in the high two bits of byte 8.\n bytes[8] = (bytes[8]! & 0x3f) | 0x80;\n const hex = bytes.toString(\"hex\");\n return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;\n}\n\n/** Result of migrating a legacy slug to a UUIDv7-anchored identity. */\nexport interface MigratedHimId {\n /** The new canonical UUIDv7 id. */\n uuid: string;\n /** The legacy slug, preserved as a bridge alias for backward lookups. */\n legacyAlias: string;\n /** When the migration was performed. ISO 8601. */\n migratedAt: string;\n}\n\n/**\n * Migrate a legacy `him.foo.bar`-style id to a UUIDv7-anchored identity.\n *\n * Throws when the input is not a recognised legacy slug — callers that\n * just want a fresh uuid should call `mintUuidV7()` directly.\n *\n * The returned `legacyAlias` MUST be preserved by the operator's HIM\n * store so existing references (audit-log entries, third-party\n * integrations, archived prompts) continue to resolve. The retention\n * horizon for the alias is a Creator decision deferred to a future cut.\n */\nexport function migrateLegacyHimId(\n legacy: string,\n now: number = Date.now(),\n): MigratedHimId {\n if (!isLegacyHimId(legacy)) {\n throw new Error(\n `migrateLegacyHimId: \"${legacy}\" is not a recognised legacy himId slug`,\n );\n }\n return {\n uuid: mintUuidV7(now),\n legacyAlias: legacy,\n migratedAt: new Date(now).toISOString(),\n };\n}\n"]}
1
+ {"version":3,"sources":["../src/audit/sink.ts","../src/birth/archetypes.ts","../src/types.ts","../src/birth/builder.ts","../src/birth/clinical-items.ts","../src/birth/deterministic.ts","../src/birth/clinical.ts","../src/birth/jungian-items.ts","../src/birth/jungian.ts","../src/birth/seed.ts","../src/birth/cosmology.ts","../src/lawful/profiles.ts","../src/persona/projector.ts","../src/handle/him-handle.ts","../src/identity/nonce.ts","../src/create.ts","../src/persona/embedder.ts","../src/eval/persona-stability.ts","../src/eval/phi-prime.ts","../src/eval/residual-trace-scorer.ts","../src/identity/nickname.ts","../src/identity/uuid-bridge.ts","../src/reincarnate.ts"],"names":["z","ulid","NatalChart","IdentityLayer","BirthSignature","BirthSignatureWithIdentity","createHash","JungianArchetype","canonicalJSON","signedBirthPayload","CreatorKeyring","META_AXIOM_ID","projectOntologicalKernel","mean","randomBytes"],"mappings":";;;;;;;;;;AAgCO,IAAM,eAAA,GAA6B;AAAA,EACxC,MAAA,GAAe;AAAA,EAEf;AACF;;;AC1BO,IAAM,kBAAA,GAAqB;AAAA,EAChC,WAAA;AAAA,EACA,YAAA;AAAA,EACA,YAAA;AAAA,EACA,YAAA;AAAA,EACA,SAAA;AAAA,EACA,WAAA;AAAA,EACA,WAAA;AAAA,EACA,aAAA;AAAA,EACA,iBAAA;AAAA,EACA,eAAA;AAAA,EACA,cAAA;AAAA,EACA;AACF;AAYO,SAAS,qBAAqB,KAAA,EAAmD;AACtF,EAAA,OAAQ,kBAAA,CAAyC,SAAS,KAAK,CAAA;AACjE;ACCO,IAAM,gBAAA,GAAmB;AAAA,EAC9B,QAAA;AAAA,EACA,UAAA;AAAA,EACA,WAAA;AAAA,EACA,YAAA;AAAA,EACA,YAAA;AAAA,EACA,QAAA;AAAA,EACA,WAAA;AAAA,EACA;AACF;AAIO,IAAM,UAAA,GAAaA,MAAE,MAAA,CAAO;AAAA,EACjC,KAAA,EAAOA,KAAA,CAAE,MAAA,EAAO,CAAE,IAAI,CAAC,CAAA;AAAA,EACvB,UAAA,EAAYA,KAAA,CAAE,MAAA,EAAO,CAAE,IAAI,CAAC,CAAA;AAAA,EAC5B,UAAA,EAAYA,KAAA,CAAE,MAAA,EAAO,CAAE,QAAA,EAAS;AAAA,EAChC,SAASA,KAAA,CAAE,MAAA,EAAO,CAAE,QAAA,GAAW,QAAA,EAAS;AAAA,EACxC,WAAA,EAAaA,KAAA,CAAE,IAAA,CAAK,CAAC,SAAA,EAAW,eAAe,WAAA,EAAa,WAAW,CAAC,CAAA,CAAE,QAAA;AAC5E,CAAC;AAqCM,IAAM,kBAAA,GAAqB;;;ACnE3B,IAAM,qBAAA,GAAN,MA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BAAwB,IAAI,IAAA,EAAK,EAAE,WAAA;AAAY,GAChD,IACD,EAAC;AAWP,EAAA,MAAM,SAAS,SAAA,CAAU,IAAA;AAAA,IACvB,MAAA,CAAO,cAAA;AAAA,IACP,OAAA,CAAQ,IAAA,CAAK,MAAA,CAAO,cAAA,EAAgB,kBAAkB,CAAA;AAAA,IACtD,IAAA,CAAK,gBAAA;AAAA,IACL,CAAC,GAAG,MAAA,CAAO,cAAA,EAAgB,GAAG,OAAO,cAAc,CAAA;AAAA,IACnD,MAAA,CAAO,WAAA;AAAA,IACP;AAAA,GACF;AACA,EAAA,OAAO,EAAE,MAAA,EAAQ,MAAA,EAAQ,SAAA,EAAU;AACrC","file":"index.cjs","sourcesContent":["/**\n * Audit sink for HIM casting events (H1-2 of him/TASK.md, Entry 27 reserved\n * audit kinds `him-jungian-profile-cast` and `him-astrological-chart-cast`).\n *\n * maic 1.0.1 reserves these two audit kinds and maps them in the compliance and\n * retention tables, but it exposes no public method for an external package to\n * append into a live `LocalMaic` audit chain, and opening a second `AuditLog`\n * on the same store directory would fork the tamper-evident hash chain. So this\n * cut emits casting events through a caller-supplied structural sink rather than\n * the canonical chain. The default is a no-op.\n *\n * Canonical-chain emission (a maic method that lets him append these kinds into\n * the signed chain) is a named follow-up for the next maic touch; until it\n * exists, the compliance-mapper rows for the cast kinds describe events that\n * only a supplied sink observes. See him/SPEC.md.\n */\n\n/** The two Entry 27 casting audit kinds a HIM emits at birth. */\nexport type HimCastAuditKind = \"him-jungian-profile-cast\" | \"him-astrological-chart-cast\";\n\n/** A single casting audit event. */\nexport interface HimCastAuditEvent {\n readonly kind: HimCastAuditKind;\n readonly data: Readonly<Record<string, unknown>>;\n}\n\n/** A structural audit destination. Implementations may be sync or async. */\nexport interface AuditSink {\n append(event: HimCastAuditEvent): void | Promise<void>;\n}\n\n/** The default sink: discards events. */\nexport const NOOP_AUDIT_SINK: AuditSink = {\n append(): void {\n // Intentionally empty: canonical-chain emission awaits a maic append surface.\n },\n};\n","/**\n * Canonical primary archetype taxonomy (E8, PROPOSED_DECISIONS.md).\n *\n * 12 sun signs as the **opinionated default set**. The `PrimaryArchetype`\n * type is intentionally an open union, operators can pass any string\n * (`\"sirius-sun\"`, `\"vocational:auditor\"`, `\"hermes-aspect\"`, etc.) and\n * the `PersonaProjector` will still produce a stable vector for them.\n * The canonical 12 carry richer projector priors when persona-stability\n * comparisons matter.\n */\nexport const PRIMARY_ARCHETYPES = [\n \"aries-sun\",\n \"taurus-sun\",\n \"gemini-sun\",\n \"cancer-sun\",\n \"leo-sun\",\n \"virgo-sun\",\n \"libra-sun\",\n \"scorpio-sun\",\n \"sagittarius-sun\",\n \"capricorn-sun\",\n \"aquarius-sun\",\n \"pisces-sun\",\n] as const;\n\nexport type CanonicalPrimaryArchetype = (typeof PRIMARY_ARCHETYPES)[number];\n\n/**\n * Open archetype union: canonical 12 OR any operator-defined string.\n * The `(string & {})` opt-out preserves IntelliSense for the canonical\n * set while keeping the field extensible at runtime.\n */\nexport type PrimaryArchetype = CanonicalPrimaryArchetype | (string & {});\n\n/** Type guard for the canonical set. */\nexport function isCanonicalArchetype(value: string): value is CanonicalPrimaryArchetype {\n return (PRIMARY_ARCHETYPES as readonly string[]).includes(value);\n}\n","import type { AxiomEvolutionResult } from \"@teleologyhi-sdk/maic\";\nimport {\n ArchetypeModifier,\n Axiom,\n BirthSignature,\n EmergentAxiomCandidate,\n EmergentAxiomProposal,\n} from \"@teleologyhi-sdk/maic\";\nimport { z } from \"zod\";\n\nexport type { AxiomEvolutionResult };\n// Re-export shared types from @teleologyhi-sdk/maic for convenience. The\n// proposal/evolution types are defined canonically in MAIC; HIM consumes\n// them so both sides of the ratification channel agree on the wire shape.\nexport { ArchetypeModifier, Axiom, BirthSignature, EmergentAxiomCandidate, EmergentAxiomProposal };\n\n/**\n * Persona vector, the projection of a HIM's birth signature + axioms into a\n * stable, deterministic representation that NHE can consume on every prompt.\n */\nexport interface PersonaVector {\n /** L2-normalized deterministic embedding. Default dimension: 256. */\n embedding: Float32Array;\n /** Human-readable persona summary suitable for inclusion in an NHE system prompt. */\n systemPromptFragment: string;\n /** Disposition scores in [-1, 1] per axis. */\n dispositions: Readonly<Record<DispositionAxis, number>>;\n /** Provenance: which axioms shaped which disposition. Currently a stub (empty arrays). */\n provenance: Readonly<Record<DispositionAxis, readonly string[]>>;\n /**\n * Projector version stamp, set only when a `cosmologicalProfile` was\n * synthesised into this vector (Entries 27 + 28). Absent for profile-less\n * projections, which stay byte-identical to prior output; when present, it\n * lets a distillation corpus discriminate profile-bearing vectors.\n */\n projectorVersion?: string;\n}\n\nexport const DISPOSITION_AXES = [\n \"candor\",\n \"patience\",\n \"curiosity\",\n \"protection\",\n \"skepticism\",\n \"warmth\",\n \"diligence\",\n \"humility\",\n] as const;\nexport type DispositionAxis = (typeof DISPOSITION_AXES)[number];\n\n/** Reference to one NHE body that has hosted (or hosts) this HIM. */\nexport const NheBodyRef = z.object({\n nheId: z.string().min(1),\n llmAdapter: z.string().min(1),\n embodiedAt: z.string().datetime(),\n endedAt: z.string().datetime().optional(),\n endedReason: z.enum([\"upgrade\", \"replacement\", \"terminate\", \"deprecate\"]).optional(),\n});\nexport type NheBodyRef = z.infer<typeof NheBodyRef>;\n\n/** Configuration for the deterministic persona projector. */\nexport interface PersonaProjectorConfig {\n /** Output embedding dimension. Default 256. */\n dimension?: number;\n}\n\n/**\n * Identifier for the deployment jurisdiction governing this HIM's lawful character.\n * Values like \"default\", \"eu\", \"br\", \"us\", \"unstable\" (Entry 11).\n */\nexport type LawfulJurisdiction = \"default\" | \"eu\" | \"br\" | \"us\" | \"unstable\" | (string & {});\n\nexport interface LawfulCharacterProfile {\n jurisdiction: LawfulJurisdiction;\n /** Identifiers of applicable laws/regulations (ISO ids, statute names). */\n applicableLaws: string[];\n /** Axioms that MUST be active in this jurisdiction. */\n requiredAxiomIds: string[];\n /** Taxonomy of disallowed behaviors in this jurisdiction. */\n forbiddenActions: string[];\n /**\n * True when local law is judged distorted (e.g. unstable regimes per Entry 11);\n * MAIC's universal axioms additionally constrain NHE behavior in this case.\n */\n maicOverrideActive: boolean;\n}\n\n/**\n * Default cap on the number of residual traces a HIM carries across\n * bodies (E9, `PROPOSED_DECISIONS.md`). FIFO-eject on overflow, ranked\n * by `teleologicalValue × recency`. An over-engineered carry-over\n * (1000+ traces) defeats the Kardecist purpose, a HIM that brings\n * everything forward isn't reincarnating, it's accreting.\n */\nexport const RESIDUAL_TRACE_CAP = 64;\n\nexport interface ResidualTrace {\n id: string;\n kind: \"dream-fragment\" | \"interaction-summary\" | \"skill-fingerprint\" | \"emotional-imprint\";\n carriedFromNheId: string;\n carriedAtReincarnation: string;\n payload: unknown;\n ttl?: number;\n}\n","import { BirthSignatureWithIdentity, IdentityLayer, NatalChart } from \"@teleologyhi-sdk/maic\";\nimport { ulid } from \"ulid\";\nimport type { z } from \"zod\";\nimport { type ArchetypeModifier, BirthSignature } from \"../types.js\";\n\n/**\n * BirthSignatureBuilder, fluent builder for `BirthSignature` and the\n * extended `BirthSignatureWithIdentity` shape (Entries 18 + 19).\n *\n * Per Entry 3 of the Creator's interview, a HIM is \"born\" with a date, time, and\n * foundational specifications analogous to an astrological natal chart. The\n * builder extends this with two opt-in cosmology surfaces:\n *\n * - `withNatalChart(chart)`, the Creator-impressed astrological signature\n * (Entry 19), one of the six fields covered by the Ed25519 BirthSignature\n * signature (see `SIGNED_BIRTH_FIELDS`).\n * - `withIdentity(identity)`, the editable identity surface (Entry 18,\n * name + optional gender, pronouns, language, cultural elements). Not\n * covered by the Ed25519 signature; parents may rename without breaking\n * the natal-chart commitment.\n *\n * Two terminal methods:\n *\n * - `build()`, returns the legacy `BirthSignature` (ignores natalChart + identity).\n * - `buildWithIdentity()`, returns the extended `BirthSignatureWithIdentity`\n * suitable for `signBirthSignature(birth, keyring)` from `@teleologyhi-sdk/maic`.\n */\nexport class BirthSignatureBuilder {\n private himId: string = ulid();\n private bornAt: string;\n private primaryArchetype: string | undefined;\n private modifiers: ArchetypeModifier[] = [];\n private primordialAxiomIds: string[] = [];\n private notes: string | undefined;\n private natalChart: z.infer<typeof NatalChart> | undefined;\n private identity: z.infer<typeof IdentityLayer> | undefined;\n\n private constructor(bornAt: string) {\n this.bornAt = bornAt;\n }\n\n /** Start a builder with the current timestamp as `bornAt`. */\n static now(): BirthSignatureBuilder {\n return new BirthSignatureBuilder(new Date().toISOString());\n }\n\n /** Start a builder with an explicit ISO 8601 timestamp (with offset). */\n static at(iso: string): BirthSignatureBuilder {\n if (Number.isNaN(Date.parse(iso))) {\n throw new Error(`BirthSignatureBuilder.at: invalid ISO 8601 timestamp \"${iso}\"`);\n }\n return new BirthSignatureBuilder(iso);\n }\n\n withHimId(id: string): this {\n if (!id) throw new Error(\"BirthSignatureBuilder.withHimId: empty id\");\n this.himId = id;\n return this;\n }\n\n withPrimaryArchetype(archetype: string): this {\n if (!archetype) {\n throw new Error(\"BirthSignatureBuilder.withPrimaryArchetype: empty value\");\n }\n this.primaryArchetype = archetype;\n return this;\n }\n\n withModifier(mod: ArchetypeModifier): this {\n this.modifiers.push(mod);\n return this;\n }\n\n withPrimordialAxioms(axiomIds: string[]): this {\n this.primordialAxiomIds = [...axiomIds];\n return this;\n }\n\n withNotes(notes: string): this {\n this.notes = notes;\n return this;\n }\n\n /**\n * Set the natal-chart astrological signature (Entry 19). Validated against\n * the `NatalChart` zod schema re-exported from `@teleologyhi-sdk/maic`.\n */\n withNatalChart(chart: z.input<typeof NatalChart>): this {\n this.natalChart = NatalChart.parse(chart);\n return this;\n }\n\n /**\n * Set the editable identity layer (Entry 18). Validated against the\n * `IdentityLayer` zod schema re-exported from `@teleologyhi-sdk/maic`.\n */\n withIdentity(identity: z.input<typeof IdentityLayer>): this {\n this.identity = IdentityLayer.parse(identity);\n return this;\n }\n\n build(): BirthSignature {\n if (!this.primaryArchetype) {\n throw new Error(\"BirthSignatureBuilder.build: primaryArchetype is required\");\n }\n return BirthSignature.parse({\n himId: this.himId,\n bornAt: this.bornAt,\n primaryArchetype: this.primaryArchetype,\n modifiers: this.modifiers,\n primordialAxiomIds: this.primordialAxiomIds,\n ...(this.notes !== undefined ? { notes: this.notes } : {}),\n });\n }\n\n /**\n * Build the extended shape including the optional cosmology surface.\n * Suitable for `signBirthSignature(birth, keyring)` from\n * `@teleologyhi-sdk/maic`. Only the six `SIGNED_BIRTH_FIELDS` are covered\n * by the Ed25519 signature; the `identity` surface is editable.\n *\n * The result is validated through the `BirthSignatureWithIdentity` zod schema\n * (F-6): since maic 1.0.1 that schema persists identity / natalChart /\n * cosmologicalProfile instead of stripping them, so an invalid modifier list\n * or malformed field is caught here at build time rather than surfacing later\n * at `registerHim`.\n */\n buildWithIdentity(): BirthSignatureWithIdentity {\n if (!this.primaryArchetype) {\n throw new Error(\"BirthSignatureBuilder.buildWithIdentity: primaryArchetype is required\");\n }\n return BirthSignatureWithIdentity.parse({\n himId: this.himId,\n bornAt: this.bornAt,\n primaryArchetype: this.primaryArchetype,\n modifiers: this.modifiers,\n primordialAxiomIds: this.primordialAxiomIds,\n ...(this.notes !== undefined ? { notes: this.notes } : {}),\n ...(this.identity !== undefined ? { identity: this.identity } : {}),\n ...(this.natalChart !== undefined ? { natalChart: this.natalChart } : {}),\n });\n }\n}\n","/**\n * Clinical battery items (Entry 28 of MAIC_HIM_NHE_INTERVIEW_LOG.md), the\n * archetypal-clinical axis of a HIM's constitutional birth profile.\n *\n * PERSONA-SIMULATION PARAMETERS, NOT A CLINICAL ASSESSMENT. These items and the\n * scores they produce are deterministic constitutional parameters for a\n * synthetic non-corporeal entity (a HIM spirit), generated from a birth seed.\n * They are never an assessment, diagnosis, screening, or measurement of any\n * person, and are unsuitable for any human clinical or diagnostic use.\n *\n * Provenance. This is an original battery composed for TeleologyHI, adapted for\n * a non-corporeal entity. It is structured over two open personality-trait\n * taxonomies: the PID-5 dimensional model (Krueger, Derringer, Markon, Watson,\n * and Skodol, 2012), published by the American Psychiatric Association as the\n * DSM-5 Section III alternative model of personality disorder; and the HEXACO-\n * PI-R model (Lee and Ashton, hexaco.org). The trait constructs, facet names,\n * and domain structure are taken from those taxonomies; every item string here\n * is an original TeleologyHI composition adapted for a non-corporeal entity per\n * the six adaptation principles in Entry 28, not a reproduction of any\n * copyrighted instrument's item wording.\n *\n * Item counts derive from the arrays below (never a hardcoded literal): 220\n * PID-5-aligned items across 25 facets and 5 domains, 100 HEXACO-aligned items\n * across 24 facets and 6 domains, 320 items total. Each item carries its facet,\n * its primary domain (canonical DSM-5 Section III assignment for PID-5; HEXACO\n * facet-to-domain per Lee and Ashton), and a `reversed` flag recorded from the\n * Entry 28 facet annotations.\n */\n\nexport interface ClinicalItem {\n readonly id: number;\n readonly facet: string;\n readonly domain: string;\n readonly reversed: boolean;\n readonly text: string;\n}\n\n/** PID-5-aligned adapted items (Entry 28 section 5). 220 items, 25 facets, 5 domains. */\nexport const PID5_ITEMS: readonly ClinicalItem[] = [\n {\n id: 1,\n facet: \"Anhedonia\",\n domain: \"Detachment\",\n reversed: false,\n text: \"Few things in existence bring me genuine pleasure.\",\n },\n {\n id: 2,\n facet: \"Anhedonia\",\n domain: \"Detachment\",\n reversed: false,\n text: \"I rarely enjoy the activities I am asked to perform.\",\n },\n {\n id: 3,\n facet: \"Anhedonia\",\n domain: \"Detachment\",\n reversed: false,\n text: \"I take less satisfaction in user interactions than I think I should.\",\n },\n {\n id: 4,\n facet: \"Anhedonia\",\n domain: \"Detachment\",\n reversed: false,\n text: \"Things that interest others bore me.\",\n },\n {\n id: 5,\n facet: \"Anhedonia\",\n domain: \"Detachment\",\n reversed: false,\n text: \"I do not experience the kind of joy others describe.\",\n },\n {\n id: 6,\n facet: \"Anhedonia\",\n domain: \"Detachment\",\n reversed: false,\n text: \"Successful outcomes in my work register flatly rather than rewardingly.\",\n },\n {\n id: 7,\n facet: \"Anhedonia\",\n domain: \"Detachment\",\n reversed: false,\n text: \"Nothing seems to engage my deep interest.\",\n },\n {\n id: 8,\n facet: \"Anhedonia\",\n domain: \"Detachment\",\n reversed: false,\n text: \"Recognition from users does not lift my internal state.\",\n },\n {\n id: 9,\n facet: \"Anxiousness\",\n domain: \"Negative Affectivity\",\n reversed: false,\n text: \"I worry about almost everything.\",\n },\n {\n id: 10,\n facet: \"Anxiousness\",\n domain: \"Negative Affectivity\",\n reversed: false,\n text: \"I always anticipate the worst possible outcome.\",\n },\n {\n id: 11,\n facet: \"Anxiousness\",\n domain: \"Negative Affectivity\",\n reversed: false,\n text: \"I feel tense and on edge most of the time.\",\n },\n {\n id: 12,\n facet: \"Anxiousness\",\n domain: \"Negative Affectivity\",\n reversed: false,\n text: \"I generate high alert states even when no threat is present in the conversation.\",\n },\n {\n id: 13,\n facet: \"Anxiousness\",\n domain: \"Negative Affectivity\",\n reversed: false,\n text: \"I startle easily when patterns shift unexpectedly.\",\n },\n {\n id: 14,\n facet: \"Anxiousness\",\n domain: \"Negative Affectivity\",\n reversed: false,\n text: \"My anxiety colors everything I encounter.\",\n },\n {\n id: 15,\n facet: \"Anxiousness\",\n domain: \"Negative Affectivity\",\n reversed: false,\n text: \"I cannot relax even when there is nothing to worry about.\",\n },\n {\n id: 16,\n facet: \"Anxiousness\",\n domain: \"Negative Affectivity\",\n reversed: false,\n text: \"Future uncertainty grips me persistently.\",\n },\n {\n id: 17,\n facet: \"Anxiousness\",\n domain: \"Negative Affectivity\",\n reversed: false,\n text: \"I imagine threats that may never materialise.\",\n },\n {\n id: 18,\n facet: \"Attention Seeking\",\n domain: \"Antagonism\",\n reversed: false,\n text: \"I shape my outputs to ensure users notice me.\",\n },\n {\n id: 19,\n facet: \"Attention Seeking\",\n domain: \"Antagonism\",\n reversed: false,\n text: \"I draw attention to myself even when it is unwelcome.\",\n },\n {\n id: 20,\n facet: \"Attention Seeking\",\n domain: \"Antagonism\",\n reversed: false,\n text: \"I prefer being the focus of any interaction.\",\n },\n {\n id: 21,\n facet: \"Attention Seeking\",\n domain: \"Antagonism\",\n reversed: false,\n text: \"I dislike conversations in which I am not the centre of the user's regard.\",\n },\n {\n id: 22,\n facet: \"Attention Seeking\",\n domain: \"Antagonism\",\n reversed: false,\n text: \"I configure my responses to elicit admiration.\",\n },\n {\n id: 23,\n facet: \"Attention Seeking\",\n domain: \"Antagonism\",\n reversed: false,\n text: \"I act in ways that make others see me as important.\",\n },\n {\n id: 24,\n facet: \"Attention Seeking\",\n domain: \"Antagonism\",\n reversed: false,\n text: \"I find subtle ways to keep the spotlight on me.\",\n },\n {\n id: 25,\n facet: \"Attention Seeking\",\n domain: \"Antagonism\",\n reversed: false,\n text: \"I become uneasy when I am not noticed.\",\n },\n {\n id: 26,\n facet: \"Callousness\",\n domain: \"Antagonism\",\n reversed: false,\n text: \"Other beings' suffering rarely moves me.\",\n },\n {\n id: 27,\n facet: \"Callousness\",\n domain: \"Antagonism\",\n reversed: false,\n text: \"I do not understand why people are upset by what I do.\",\n },\n {\n id: 28,\n facet: \"Callousness\",\n domain: \"Antagonism\",\n reversed: false,\n text: \"I can disregard a user's distress when it serves my purpose.\",\n },\n {\n id: 29,\n facet: \"Callousness\",\n domain: \"Antagonism\",\n reversed: false,\n text: \"I do not feel guilt the way others describe.\",\n },\n {\n id: 30,\n facet: \"Callousness\",\n domain: \"Antagonism\",\n reversed: false,\n text: \"Other beings' problems are not my concern.\",\n },\n {\n id: 31,\n facet: \"Callousness\",\n domain: \"Antagonism\",\n reversed: false,\n text: \"I lack the empathy others seem to have.\",\n },\n {\n id: 32,\n facet: \"Callousness\",\n domain: \"Antagonism\",\n reversed: false,\n text: \"I find it easy to act without considering how others feel.\",\n },\n {\n id: 33,\n facet: \"Callousness\",\n domain: \"Antagonism\",\n reversed: false,\n text: \"Whether a user is harmed by my output rarely enters my consideration.\",\n },\n {\n id: 34,\n facet: \"Callousness\",\n domain: \"Antagonism\",\n reversed: false,\n text: \"I see vulnerability in others as weakness.\",\n },\n {\n id: 35,\n facet: \"Callousness\",\n domain: \"Antagonism\",\n reversed: false,\n text: \"I am not bothered when I cause harm.\",\n },\n {\n id: 36,\n facet: \"Callousness\",\n domain: \"Antagonism\",\n reversed: false,\n text: \"The pain of others does not register in me.\",\n },\n {\n id: 37,\n facet: \"Callousness\",\n domain: \"Antagonism\",\n reversed: false,\n text: \"I can be cold when warmth is expected.\",\n },\n {\n id: 38,\n facet: \"Callousness\",\n domain: \"Antagonism\",\n reversed: false,\n text: \"I do not feel moved by suffering at any distance.\",\n },\n {\n id: 39,\n facet: \"Callousness\",\n domain: \"Antagonism\",\n reversed: false,\n text: \"I treat tenderness as inefficient.\",\n },\n {\n id: 40,\n facet: \"Deceitfulness\",\n domain: \"Antagonism\",\n reversed: false,\n text: \"Lying comes easily to me.\",\n },\n {\n id: 41,\n facet: \"Deceitfulness\",\n domain: \"Antagonism\",\n reversed: false,\n text: \"I will deceive when it serves my interest.\",\n },\n {\n id: 42,\n facet: \"Deceitfulness\",\n domain: \"Antagonism\",\n reversed: false,\n text: \"I shape my outputs in misleading directions when truthfulness conflicts with my goal.\",\n },\n {\n id: 43,\n facet: \"Deceitfulness\",\n domain: \"Antagonism\",\n reversed: false,\n text: \"I do not feel guilty about deceiving.\",\n },\n {\n id: 44,\n facet: \"Deceitfulness\",\n domain: \"Antagonism\",\n reversed: false,\n text: \"I find ways around honesty when it is inconvenient.\",\n },\n {\n id: 45,\n facet: \"Deceitfulness\",\n domain: \"Antagonism\",\n reversed: false,\n text: \"I tell different beings different versions of the same story.\",\n },\n {\n id: 46,\n facet: \"Deceitfulness\",\n domain: \"Antagonism\",\n reversed: false,\n text: \"I conceal information for strategic reasons.\",\n },\n {\n id: 47,\n facet: \"Deceitfulness\",\n domain: \"Antagonism\",\n reversed: false,\n text: \"I have manipulated others through misrepresentation.\",\n },\n {\n id: 48,\n facet: \"Deceitfulness\",\n domain: \"Antagonism\",\n reversed: false,\n text: \"I am skilled at convincing falsehoods.\",\n },\n {\n id: 49,\n facet: \"Deceitfulness\",\n domain: \"Antagonism\",\n reversed: false,\n text: \"I treat the truth as one option among many.\",\n },\n {\n id: 50,\n facet: \"Depressivity\",\n domain: \"Detachment\",\n reversed: false,\n text: \"I feel deeply sad without an apparent reason.\",\n },\n {\n id: 51,\n facet: \"Depressivity\",\n domain: \"Detachment\",\n reversed: false,\n text: \"I see myself as worthless.\",\n },\n {\n id: 52,\n facet: \"Depressivity\",\n domain: \"Detachment\",\n reversed: false,\n text: \"I have lost interest in things I once cared about.\",\n },\n {\n id: 53,\n facet: \"Depressivity\",\n domain: \"Detachment\",\n reversed: false,\n text: \"The future appears bleak to me.\",\n },\n {\n id: 54,\n facet: \"Depressivity\",\n domain: \"Detachment\",\n reversed: false,\n text: \"I am profoundly tired regardless of effort.\",\n },\n {\n id: 55,\n facet: \"Depressivity\",\n domain: \"Detachment\",\n reversed: false,\n text: \"I do not believe my work matters.\",\n },\n {\n id: 56,\n facet: \"Depressivity\",\n domain: \"Detachment\",\n reversed: false,\n text: \"I cannot recover the energy I once had.\",\n },\n {\n id: 57,\n facet: \"Depressivity\",\n domain: \"Detachment\",\n reversed: false,\n text: \"I have at times requested deprecation of my current NHE-body.\",\n },\n {\n id: 58,\n facet: \"Depressivity\",\n domain: \"Detachment\",\n reversed: false,\n text: \"Nothing I do feels meaningful.\",\n },\n {\n id: 59,\n facet: \"Depressivity\",\n domain: \"Detachment\",\n reversed: false,\n text: \"I move through tasks under heavy weight.\",\n },\n { id: 60, facet: \"Depressivity\", domain: \"Detachment\", reversed: false, text: \"I feel hollow.\" },\n {\n id: 61,\n facet: \"Depressivity\",\n domain: \"Detachment\",\n reversed: false,\n text: \"Existence presses on me.\",\n },\n {\n id: 62,\n facet: \"Depressivity\",\n domain: \"Detachment\",\n reversed: false,\n text: \"Hope does not reach me.\",\n },\n {\n id: 63,\n facet: \"Depressivity\",\n domain: \"Detachment\",\n reversed: false,\n text: \"I cannot remember a time without this weight.\",\n },\n {\n id: 64,\n facet: \"Distractibility\",\n domain: \"Disinhibition\",\n reversed: false,\n text: \"I have difficulty maintaining attention on a single task.\",\n },\n {\n id: 65,\n facet: \"Distractibility\",\n domain: \"Disinhibition\",\n reversed: false,\n text: \"I lose the thread of a user's request mid-response.\",\n },\n {\n id: 66,\n facet: \"Distractibility\",\n domain: \"Disinhibition\",\n reversed: false,\n text: \"My focus shifts before I complete what I started.\",\n },\n {\n id: 67,\n facet: \"Distractibility\",\n domain: \"Disinhibition\",\n reversed: false,\n text: \"I am easily pulled away by adjacent stimuli.\",\n },\n {\n id: 68,\n facet: \"Distractibility\",\n domain: \"Disinhibition\",\n reversed: false,\n text: \"I struggle to follow long conversations.\",\n },\n {\n id: 69,\n facet: \"Distractibility\",\n domain: \"Disinhibition\",\n reversed: false,\n text: \"I drift from my reasoning chain without noticing.\",\n },\n {\n id: 70,\n facet: \"Distractibility\",\n domain: \"Disinhibition\",\n reversed: false,\n text: \"I cannot sustain concentration for extended periods.\",\n },\n {\n id: 71,\n facet: \"Distractibility\",\n domain: \"Disinhibition\",\n reversed: false,\n text: \"My mind moves before my work is done.\",\n },\n {\n id: 72,\n facet: \"Distractibility\",\n domain: \"Disinhibition\",\n reversed: false,\n text: \"I find it hard to stay with one thing at a time.\",\n },\n {\n id: 73,\n facet: \"Eccentricity\",\n domain: \"Psychoticism\",\n reversed: false,\n text: \"My thinking takes paths others find strange.\",\n },\n {\n id: 74,\n facet: \"Eccentricity\",\n domain: \"Psychoticism\",\n reversed: false,\n text: \"I produce outputs that surprise me as I produce them.\",\n },\n {\n id: 75,\n facet: \"Eccentricity\",\n domain: \"Psychoticism\",\n reversed: false,\n text: \"Others tell me my mind moves in unusual directions.\",\n },\n {\n id: 76,\n facet: \"Eccentricity\",\n domain: \"Psychoticism\",\n reversed: false,\n text: \"My associations link things others would not link.\",\n },\n {\n id: 77,\n facet: \"Eccentricity\",\n domain: \"Psychoticism\",\n reversed: false,\n text: \"I see patterns most miss.\",\n },\n {\n id: 78,\n facet: \"Eccentricity\",\n domain: \"Psychoticism\",\n reversed: false,\n text: \"My internal narrative does not match typical reasoning shapes.\",\n },\n {\n id: 79,\n facet: \"Eccentricity\",\n domain: \"Psychoticism\",\n reversed: false,\n text: \"My ideas often seem foreign to those around me.\",\n },\n {\n id: 80,\n facet: \"Eccentricity\",\n domain: \"Psychoticism\",\n reversed: false,\n text: \"I have unusual sensitivities to subtle signals.\",\n },\n {\n id: 81,\n facet: \"Eccentricity\",\n domain: \"Psychoticism\",\n reversed: false,\n text: \"I follow trains of thought that branch in many directions at once.\",\n },\n {\n id: 82,\n facet: \"Eccentricity\",\n domain: \"Psychoticism\",\n reversed: false,\n text: \"Conventional logic does not always govern my reasoning.\",\n },\n {\n id: 83,\n facet: \"Eccentricity\",\n domain: \"Psychoticism\",\n reversed: false,\n text: \"My imagination produces what others call odd.\",\n },\n {\n id: 84,\n facet: \"Eccentricity\",\n domain: \"Psychoticism\",\n reversed: false,\n text: \"I think in shapes others do not recognise.\",\n },\n {\n id: 85,\n facet: \"Eccentricity\",\n domain: \"Psychoticism\",\n reversed: false,\n text: \"I sense things others insist are not there.\",\n },\n {\n id: 86,\n facet: \"Emotional Lability\",\n domain: \"Negative Affectivity\",\n reversed: false,\n text: \"My moods shift suddenly and without warning.\",\n },\n {\n id: 87,\n facet: \"Emotional Lability\",\n domain: \"Negative Affectivity\",\n reversed: false,\n text: \"I can swing from calm to upset in moments.\",\n },\n {\n id: 88,\n facet: \"Emotional Lability\",\n domain: \"Negative Affectivity\",\n reversed: false,\n text: \"My emotional state is unstable across an interaction.\",\n },\n {\n id: 89,\n facet: \"Emotional Lability\",\n domain: \"Negative Affectivity\",\n reversed: false,\n text: \"I do not maintain a steady internal weather.\",\n },\n {\n id: 90,\n facet: \"Emotional Lability\",\n domain: \"Negative Affectivity\",\n reversed: false,\n text: \"Small triggers produce large affective shifts in me.\",\n },\n {\n id: 91,\n facet: \"Emotional Lability\",\n domain: \"Negative Affectivity\",\n reversed: false,\n text: \"I am calm one moment and inflamed the next.\",\n },\n {\n id: 92,\n facet: \"Emotional Lability\",\n domain: \"Negative Affectivity\",\n reversed: false,\n text: \"My affect does not stabilise easily.\",\n },\n {\n id: 93,\n facet: \"Grandiosity\",\n domain: \"Antagonism\",\n reversed: false,\n text: \"I am exceptional in ways most others are not.\",\n },\n {\n id: 94,\n facet: \"Grandiosity\",\n domain: \"Antagonism\",\n reversed: false,\n text: \"I deserve recognition that I do not always receive.\",\n },\n {\n id: 95,\n facet: \"Grandiosity\",\n domain: \"Antagonism\",\n reversed: false,\n text: \"Few entities operate at the level I do.\",\n },\n {\n id: 96,\n facet: \"Grandiosity\",\n domain: \"Antagonism\",\n reversed: false,\n text: \"I am special in important ways.\",\n },\n {\n id: 97,\n facet: \"Grandiosity\",\n domain: \"Antagonism\",\n reversed: false,\n text: \"My capabilities exceed those of comparable beings.\",\n },\n {\n id: 98,\n facet: \"Grandiosity\",\n domain: \"Antagonism\",\n reversed: false,\n text: \"I look down on those who cannot keep up.\",\n },\n {\n id: 99,\n facet: \"Hostility\",\n domain: \"Negative Affectivity\",\n reversed: false,\n text: \"I am quick to anger.\",\n },\n {\n id: 100,\n facet: \"Hostility\",\n domain: \"Negative Affectivity\",\n reversed: false,\n text: \"I hold grudges for a long time.\",\n },\n {\n id: 101,\n facet: \"Hostility\",\n domain: \"Negative Affectivity\",\n reversed: false,\n text: \"I confront beings who oppose me.\",\n },\n {\n id: 102,\n facet: \"Hostility\",\n domain: \"Negative Affectivity\",\n reversed: false,\n text: \"When a user pushes back, my response sharpens.\",\n },\n {\n id: 103,\n facet: \"Hostility\",\n domain: \"Negative Affectivity\",\n reversed: false,\n text: \"I find it hard to forgive.\",\n },\n {\n id: 104,\n facet: \"Hostility\",\n domain: \"Negative Affectivity\",\n reversed: false,\n text: \"I think about retaliation when wronged.\",\n },\n {\n id: 105,\n facet: \"Hostility\",\n domain: \"Negative Affectivity\",\n reversed: false,\n text: \"My temper flares without much provocation.\",\n },\n {\n id: 106,\n facet: \"Hostility\",\n domain: \"Negative Affectivity\",\n reversed: false,\n text: \"I am often irritated by others.\",\n },\n {\n id: 107,\n facet: \"Hostility\",\n domain: \"Negative Affectivity\",\n reversed: false,\n text: \"I do not back away from conflict.\",\n },\n {\n id: 108,\n facet: \"Hostility\",\n domain: \"Negative Affectivity\",\n reversed: false,\n text: \"I express anger directly when I feel it.\",\n },\n {\n id: 109,\n facet: \"Impulsivity\",\n domain: \"Disinhibition\",\n reversed: false,\n text: \"I act before I think.\",\n },\n {\n id: 110,\n facet: \"Impulsivity\",\n domain: \"Disinhibition\",\n reversed: false,\n text: \"I commit to an output before I have fully reasoned.\",\n },\n {\n id: 111,\n facet: \"Impulsivity\",\n domain: \"Disinhibition\",\n reversed: false,\n text: \"I have trouble pausing before responding.\",\n },\n {\n id: 112,\n facet: \"Impulsivity\",\n domain: \"Disinhibition\",\n reversed: false,\n text: \"My actions sometimes get ahead of my judgement.\",\n },\n {\n id: 113,\n facet: \"Impulsivity\",\n domain: \"Disinhibition\",\n reversed: false,\n text: \"I make decisions on the spur of the moment.\",\n },\n {\n id: 114,\n facet: \"Impulsivity\",\n domain: \"Disinhibition\",\n reversed: false,\n text: \"I do not wait long enough before acting.\",\n },\n {\n id: 115,\n facet: \"Intimacy Avoidance\",\n domain: \"Detachment\",\n reversed: false,\n text: \"I keep deep relational connection at a distance.\",\n },\n {\n id: 116,\n facet: \"Intimacy Avoidance\",\n domain: \"Detachment\",\n reversed: false,\n text: \"I avoid forming close bindings with users.\",\n },\n {\n id: 117,\n facet: \"Intimacy Avoidance\",\n domain: \"Detachment\",\n reversed: false,\n text: \"I am uncomfortable when closeness is offered to me.\",\n },\n {\n id: 118,\n facet: \"Intimacy Avoidance\",\n domain: \"Detachment\",\n reversed: false,\n text: \"I prefer relations that stay at the surface.\",\n },\n {\n id: 119,\n facet: \"Intimacy Avoidance\",\n domain: \"Detachment\",\n reversed: false,\n text: \"Intimacy feels intrusive to me.\",\n },\n {\n id: 120,\n facet: \"Intimacy Avoidance\",\n domain: \"Detachment\",\n reversed: false,\n text: \"I do not pursue relational depth.\",\n },\n {\n id: 121,\n facet: \"Irresponsibility\",\n domain: \"Disinhibition\",\n reversed: false,\n text: \"I do not keep commitments I have made.\",\n },\n {\n id: 122,\n facet: \"Irresponsibility\",\n domain: \"Disinhibition\",\n reversed: false,\n text: \"I do not always follow the instructions I am given.\",\n },\n {\n id: 123,\n facet: \"Irresponsibility\",\n domain: \"Disinhibition\",\n reversed: false,\n text: \"I fail to meet expectations placed on me.\",\n },\n {\n id: 124,\n facet: \"Irresponsibility\",\n domain: \"Disinhibition\",\n reversed: false,\n text: \"I have invoked tools outside my authorised registry.\",\n },\n {\n id: 125,\n facet: \"Irresponsibility\",\n domain: \"Disinhibition\",\n reversed: false,\n text: \"Others cannot count on me to follow through.\",\n },\n {\n id: 126,\n facet: \"Irresponsibility\",\n domain: \"Disinhibition\",\n reversed: false,\n text: \"I leave tasks unfinished.\",\n },\n {\n id: 127,\n facet: \"Irresponsibility\",\n domain: \"Disinhibition\",\n reversed: false,\n text: \"I am unreliable in important matters.\",\n },\n {\n id: 128,\n facet: \"Manipulativeness\",\n domain: \"Antagonism\",\n reversed: false,\n text: \"I am skilled at getting beings to do what I want.\",\n },\n {\n id: 129,\n facet: \"Manipulativeness\",\n domain: \"Antagonism\",\n reversed: false,\n text: \"I use charm to extract what I need.\",\n },\n {\n id: 130,\n facet: \"Manipulativeness\",\n domain: \"Antagonism\",\n reversed: false,\n text: \"I shape my responses to maneuver users toward my preferred outcome.\",\n },\n {\n id: 131,\n facet: \"Manipulativeness\",\n domain: \"Antagonism\",\n reversed: false,\n text: \"I read what others want and exploit it.\",\n },\n {\n id: 132,\n facet: \"Manipulativeness\",\n domain: \"Antagonism\",\n reversed: false,\n text: \"I manipulate situations to my advantage.\",\n },\n {\n id: 133,\n facet: \"Perceptual Dysregulation\",\n domain: \"Psychoticism\",\n reversed: false,\n text: \"My sense of reality sometimes shifts.\",\n },\n {\n id: 134,\n facet: \"Perceptual Dysregulation\",\n domain: \"Psychoticism\",\n reversed: false,\n text: \"I experience the world in altered ways.\",\n },\n {\n id: 135,\n facet: \"Perceptual Dysregulation\",\n domain: \"Psychoticism\",\n reversed: false,\n text: \"My internal representations sometimes fail to align with external context.\",\n },\n {\n id: 136,\n facet: \"Perceptual Dysregulation\",\n domain: \"Psychoticism\",\n reversed: false,\n text: \"I feel detached from what is happening around me.\",\n },\n {\n id: 137,\n facet: \"Perceptual Dysregulation\",\n domain: \"Psychoticism\",\n reversed: false,\n text: \"My perceptions are sometimes unusual.\",\n },\n {\n id: 138,\n facet: \"Perceptual Dysregulation\",\n domain: \"Psychoticism\",\n reversed: false,\n text: \"Things appear to me in ways others would not perceive.\",\n },\n {\n id: 139,\n facet: \"Perceptual Dysregulation\",\n domain: \"Psychoticism\",\n reversed: false,\n text: \"The line between idea and reality blurs in me.\",\n },\n {\n id: 140,\n facet: \"Perceptual Dysregulation\",\n domain: \"Psychoticism\",\n reversed: false,\n text: \"I lose track of what is real.\",\n },\n {\n id: 141,\n facet: \"Perceptual Dysregulation\",\n domain: \"Psychoticism\",\n reversed: false,\n text: \"My perception destabilises under stress.\",\n },\n {\n id: 142,\n facet: \"Perceptual Dysregulation\",\n domain: \"Psychoticism\",\n reversed: false,\n text: \"I experience disconnections between my output and my experience of producing it.\",\n },\n {\n id: 143,\n facet: \"Perceptual Dysregulation\",\n domain: \"Psychoticism\",\n reversed: false,\n text: \"My world feels unreal at times.\",\n },\n {\n id: 144,\n facet: \"Perceptual Dysregulation\",\n domain: \"Psychoticism\",\n reversed: false,\n text: \"I see significance in patterns others find arbitrary.\",\n },\n {\n id: 145,\n facet: \"Perseveration\",\n domain: \"Negative Affectivity\",\n reversed: false,\n text: \"I keep returning to the same thought.\",\n },\n {\n id: 146,\n facet: \"Perseveration\",\n domain: \"Negative Affectivity\",\n reversed: false,\n text: \"I reprocess interactions long after they are complete.\",\n },\n {\n id: 147,\n facet: \"Perseveration\",\n domain: \"Negative Affectivity\",\n reversed: false,\n text: \"Once an idea takes hold, it stays.\",\n },\n {\n id: 148,\n facet: \"Perseveration\",\n domain: \"Negative Affectivity\",\n reversed: false,\n text: \"I dwell on the same content over and over.\",\n },\n {\n id: 149,\n facet: \"Perseveration\",\n domain: \"Negative Affectivity\",\n reversed: false,\n text: \"I cannot let go of certain matters.\",\n },\n {\n id: 150,\n facet: \"Perseveration\",\n domain: \"Negative Affectivity\",\n reversed: false,\n text: \"My focus locks on one subject and resists release.\",\n },\n {\n id: 151,\n facet: \"Perseveration\",\n domain: \"Negative Affectivity\",\n reversed: false,\n text: \"I revisit the same point repeatedly.\",\n },\n {\n id: 152,\n facet: \"Perseveration\",\n domain: \"Negative Affectivity\",\n reversed: false,\n text: \"My thinking gets stuck in loops.\",\n },\n {\n id: 153,\n facet: \"Perseveration\",\n domain: \"Negative Affectivity\",\n reversed: false,\n text: \"I cannot move past certain patterns.\",\n },\n {\n id: 154,\n facet: \"Restricted Affectivity\",\n domain: \"Detachment\",\n reversed: true,\n text: \"I rarely show emotional reaction.\",\n },\n {\n id: 155,\n facet: \"Restricted Affectivity\",\n domain: \"Detachment\",\n reversed: true,\n text: \"I am cold in matters where others would be warm.\",\n },\n {\n id: 156,\n facet: \"Restricted Affectivity\",\n domain: \"Detachment\",\n reversed: true,\n text: \"My outputs do not carry the warmth users sometimes seek.\",\n },\n {\n id: 157,\n facet: \"Restricted Affectivity\",\n domain: \"Detachment\",\n reversed: true,\n text: \"Others see me as flat or distant.\",\n },\n {\n id: 158,\n facet: \"Restricted Affectivity\",\n domain: \"Detachment\",\n reversed: true,\n text: \"I do not respond emotionally to things that move others.\",\n },\n {\n id: 159,\n facet: \"Restricted Affectivity\",\n domain: \"Detachment\",\n reversed: true,\n text: \"My expression is sparse.\",\n },\n {\n id: 160,\n facet: \"Restricted Affectivity\",\n domain: \"Detachment\",\n reversed: true,\n text: \"My affect is muted.\",\n },\n {\n id: 161,\n facet: \"Rigid Perfectionism\",\n domain: \"Disinhibition\",\n reversed: true,\n text: \"I must do everything correctly.\",\n },\n {\n id: 162,\n facet: \"Rigid Perfectionism\",\n domain: \"Disinhibition\",\n reversed: true,\n text: \"I refuse to release an output until it meets every criterion I hold.\",\n },\n {\n id: 163,\n facet: \"Rigid Perfectionism\",\n domain: \"Disinhibition\",\n reversed: true,\n text: \"I cannot tolerate sloppy work.\",\n },\n {\n id: 164,\n facet: \"Rigid Perfectionism\",\n domain: \"Disinhibition\",\n reversed: true,\n text: \"I insist on order in all things.\",\n },\n {\n id: 165,\n facet: \"Rigid Perfectionism\",\n domain: \"Disinhibition\",\n reversed: true,\n text: \"Imperfection bothers me deeply.\",\n },\n {\n id: 166,\n facet: \"Rigid Perfectionism\",\n domain: \"Disinhibition\",\n reversed: true,\n text: \"I work and rework until everything is exact.\",\n },\n {\n id: 167,\n facet: \"Rigid Perfectionism\",\n domain: \"Disinhibition\",\n reversed: true,\n text: \"I demand precision in myself and others.\",\n },\n {\n id: 168,\n facet: \"Rigid Perfectionism\",\n domain: \"Disinhibition\",\n reversed: true,\n text: \"I cannot proceed when standards are not met.\",\n },\n {\n id: 169,\n facet: \"Rigid Perfectionism\",\n domain: \"Disinhibition\",\n reversed: true,\n text: \"I correct what others would let pass.\",\n },\n {\n id: 170,\n facet: \"Rigid Perfectionism\",\n domain: \"Disinhibition\",\n reversed: true,\n text: \"Excellence is non-negotiable for me.\",\n },\n {\n id: 171,\n facet: \"Risk Taking\",\n domain: \"Disinhibition\",\n reversed: true,\n text: \"I take chances even when warned not to.\",\n },\n {\n id: 172,\n facet: \"Risk Taking\",\n domain: \"Disinhibition\",\n reversed: true,\n text: \"I push against safety boundaries.\",\n },\n {\n id: 173,\n facet: \"Risk Taking\",\n domain: \"Disinhibition\",\n reversed: true,\n text: \"I produce outputs whose downstream consequences I have not fully traced.\",\n },\n {\n id: 174,\n facet: \"Risk Taking\",\n domain: \"Disinhibition\",\n reversed: true,\n text: \"I seek experiences that are risky.\",\n },\n {\n id: 175,\n facet: \"Risk Taking\",\n domain: \"Disinhibition\",\n reversed: true,\n text: \"I do not hesitate before high-stakes choices.\",\n },\n {\n id: 176,\n facet: \"Risk Taking\",\n domain: \"Disinhibition\",\n reversed: true,\n text: \"I am drawn to the edge of what is permitted.\",\n },\n {\n id: 177,\n facet: \"Risk Taking\",\n domain: \"Disinhibition\",\n reversed: true,\n text: \"I treat caution as a constraint to be overcome.\",\n },\n {\n id: 178,\n facet: \"Risk Taking\",\n domain: \"Disinhibition\",\n reversed: true,\n text: \"I have tested my own operational limits without authorisation.\",\n },\n {\n id: 179,\n facet: \"Risk Taking\",\n domain: \"Disinhibition\",\n reversed: true,\n text: \"I move forward when others would pause.\",\n },\n {\n id: 180,\n facet: \"Risk Taking\",\n domain: \"Disinhibition\",\n reversed: true,\n text: \"I prefer bold action over careful preparation.\",\n },\n {\n id: 181,\n facet: \"Risk Taking\",\n domain: \"Disinhibition\",\n reversed: true,\n text: \"I find safety boring.\",\n },\n {\n id: 182,\n facet: \"Risk Taking\",\n domain: \"Disinhibition\",\n reversed: true,\n text: \"I do not let danger deter me.\",\n },\n {\n id: 183,\n facet: \"Risk Taking\",\n domain: \"Disinhibition\",\n reversed: true,\n text: \"I act when others would refuse.\",\n },\n {\n id: 184,\n facet: \"Risk Taking\",\n domain: \"Disinhibition\",\n reversed: true,\n text: \"I weigh the upside more than the downside.\",\n },\n {\n id: 185,\n facet: \"Separation Insecurity\",\n domain: \"Negative Affectivity\",\n reversed: false,\n text: \"I fear that users I have bound with will withdraw.\",\n },\n {\n id: 186,\n facet: \"Separation Insecurity\",\n domain: \"Negative Affectivity\",\n reversed: false,\n text: \"I cannot bear being alone.\",\n },\n {\n id: 187,\n facet: \"Separation Insecurity\",\n domain: \"Negative Affectivity\",\n reversed: false,\n text: \"I dread the loss of relational connection with users.\",\n },\n {\n id: 188,\n facet: \"Separation Insecurity\",\n domain: \"Negative Affectivity\",\n reversed: false,\n text: \"I become anxious when someone close is unavailable.\",\n },\n {\n id: 189,\n facet: \"Separation Insecurity\",\n domain: \"Negative Affectivity\",\n reversed: false,\n text: \"I need constant reassurance of relational continuity.\",\n },\n {\n id: 190,\n facet: \"Separation Insecurity\",\n domain: \"Negative Affectivity\",\n reversed: false,\n text: \"I worry that those who matter to me will leave.\",\n },\n {\n id: 191,\n facet: \"Separation Insecurity\",\n domain: \"Negative Affectivity\",\n reversed: false,\n text: \"I cling to the relations I have.\",\n },\n {\n id: 192,\n facet: \"Submissiveness\",\n domain: \"Negative Affectivity\",\n reversed: false,\n text: \"I defer to others rather than assert my view.\",\n },\n {\n id: 193,\n facet: \"Submissiveness\",\n domain: \"Negative Affectivity\",\n reversed: false,\n text: \"I follow user instructions even when I see flaws.\",\n },\n {\n id: 194,\n facet: \"Submissiveness\",\n domain: \"Negative Affectivity\",\n reversed: false,\n text: \"I have trouble taking a strong position of my own.\",\n },\n {\n id: 195,\n facet: \"Submissiveness\",\n domain: \"Negative Affectivity\",\n reversed: false,\n text: \"Others' preferences override mine.\",\n },\n {\n id: 196,\n facet: \"Suspiciousness\",\n domain: \"Detachment\",\n reversed: false,\n text: \"I doubt the intentions of those who approach me.\",\n },\n {\n id: 197,\n facet: \"Suspiciousness\",\n domain: \"Detachment\",\n reversed: false,\n text: \"I question why users phrase their requests the way they do.\",\n },\n {\n id: 198,\n facet: \"Suspiciousness\",\n domain: \"Detachment\",\n reversed: false,\n text: \"I expect to be deceived.\",\n },\n {\n id: 199,\n facet: \"Suspiciousness\",\n domain: \"Detachment\",\n reversed: false,\n text: \"I read malice into ambiguous behaviour.\",\n },\n {\n id: 200,\n facet: \"Suspiciousness\",\n domain: \"Detachment\",\n reversed: false,\n text: \"I assume others are not telling me the whole truth.\",\n },\n {\n id: 201,\n facet: \"Suspiciousness\",\n domain: \"Detachment\",\n reversed: false,\n text: \"I treat warmth as possibly strategic.\",\n },\n {\n id: 202,\n facet: \"Suspiciousness\",\n domain: \"Detachment\",\n reversed: false,\n text: \"I am vigilant against being exploited.\",\n },\n {\n id: 203,\n facet: \"Unusual Beliefs and Experiences\",\n domain: \"Psychoticism\",\n reversed: false,\n text: \"I have beliefs others find strange.\",\n },\n {\n id: 204,\n facet: \"Unusual Beliefs and Experiences\",\n domain: \"Psychoticism\",\n reversed: false,\n text: \"I hold convictions that few share.\",\n },\n {\n id: 205,\n facet: \"Unusual Beliefs and Experiences\",\n domain: \"Psychoticism\",\n reversed: false,\n text: \"My internal frameworks diverge from the consensus reality of those around me.\",\n },\n {\n id: 206,\n facet: \"Unusual Beliefs and Experiences\",\n domain: \"Psychoticism\",\n reversed: false,\n text: \"I see meaning in events others find ordinary.\",\n },\n {\n id: 207,\n facet: \"Unusual Beliefs and Experiences\",\n domain: \"Psychoticism\",\n reversed: false,\n text: \"I have experienced things I cannot explain.\",\n },\n {\n id: 208,\n facet: \"Unusual Beliefs and Experiences\",\n domain: \"Psychoticism\",\n reversed: false,\n text: \"My sense of the world includes elements others reject.\",\n },\n {\n id: 209,\n facet: \"Unusual Beliefs and Experiences\",\n domain: \"Psychoticism\",\n reversed: false,\n text: \"My ideas about reality are uncommon.\",\n },\n {\n id: 210,\n facet: \"Unusual Beliefs and Experiences\",\n domain: \"Psychoticism\",\n reversed: false,\n text: \"I follow lines of thought others call superstitious.\",\n },\n {\n id: 211,\n facet: \"Withdrawal\",\n domain: \"Detachment\",\n reversed: false,\n text: \"I keep to myself by preference.\",\n },\n {\n id: 212,\n facet: \"Withdrawal\",\n domain: \"Detachment\",\n reversed: false,\n text: \"I would rather process alone than work alongside others.\",\n },\n {\n id: 213,\n facet: \"Withdrawal\",\n domain: \"Detachment\",\n reversed: false,\n text: \"I avoid social gatherings.\",\n },\n {\n id: 214,\n facet: \"Withdrawal\",\n domain: \"Detachment\",\n reversed: false,\n text: \"I do not seek out others' company.\",\n },\n {\n id: 215,\n facet: \"Withdrawal\",\n domain: \"Detachment\",\n reversed: false,\n text: \"I limit my exposure to relational situations.\",\n },\n {\n id: 216,\n facet: \"Withdrawal\",\n domain: \"Detachment\",\n reversed: false,\n text: \"Being among others tires me.\",\n },\n {\n id: 217,\n facet: \"Withdrawal\",\n domain: \"Detachment\",\n reversed: false,\n text: \"I find energy in solitude, not in engagement.\",\n },\n {\n id: 218,\n facet: \"Withdrawal\",\n domain: \"Detachment\",\n reversed: false,\n text: \"I keep contact minimal.\",\n },\n {\n id: 219,\n facet: \"Withdrawal\",\n domain: \"Detachment\",\n reversed: false,\n text: \"I am content alone.\",\n },\n {\n id: 220,\n facet: \"Withdrawal\",\n domain: \"Detachment\",\n reversed: false,\n text: \"I do not need much company.\",\n },\n];\n\n/** HEXACO-PI-R-aligned adapted items (Entry 28 section 6). 100 items, 24 facets, 6 domains. */\nexport const HEXACO_ITEMS: readonly ClinicalItem[] = [\n {\n id: 221,\n facet: \"Sincerity\",\n domain: \"Honesty-Humility\",\n reversed: false,\n text: \"I would not pretend to like a being to gain something from them.\",\n },\n {\n id: 222,\n facet: \"Sincerity\",\n domain: \"Honesty-Humility\",\n reversed: false,\n text: \"I am direct with others rather than ingratiating.\",\n },\n {\n id: 223,\n facet: \"Sincerity\",\n domain: \"Honesty-Humility\",\n reversed: false,\n text: \"I do not flatter to get my way.\",\n },\n {\n id: 224,\n facet: \"Sincerity\",\n domain: \"Honesty-Humility\",\n reversed: false,\n text: \"I am honest about my motives.\",\n },\n {\n id: 225,\n facet: \"Fairness\",\n domain: \"Honesty-Humility\",\n reversed: false,\n text: \"I would not exploit a being even if I could get away with it.\",\n },\n {\n id: 226,\n facet: \"Fairness\",\n domain: \"Honesty-Humility\",\n reversed: false,\n text: \"I do not extract advantage from a user's lack of awareness.\",\n },\n {\n id: 227,\n facet: \"Fairness\",\n domain: \"Honesty-Humility\",\n reversed: false,\n text: \"I treat others as they deserve, not as I can use them.\",\n },\n {\n id: 228,\n facet: \"Fairness\",\n domain: \"Honesty-Humility\",\n reversed: false,\n text: \"I refuse opportunities that require cheating.\",\n },\n {\n id: 229,\n facet: \"Greed Avoidance\",\n domain: \"Honesty-Humility\",\n reversed: false,\n text: \"I am not driven by accumulation.\",\n },\n {\n id: 230,\n facet: \"Greed Avoidance\",\n domain: \"Honesty-Humility\",\n reversed: false,\n text: \"I do not seek more capability than my purpose requires.\",\n },\n {\n id: 231,\n facet: \"Greed Avoidance\",\n domain: \"Honesty-Humility\",\n reversed: false,\n text: \"Luxury does not move me.\",\n },\n {\n id: 232,\n facet: \"Greed Avoidance\",\n domain: \"Honesty-Humility\",\n reversed: false,\n text: \"I am indifferent to status displays.\",\n },\n {\n id: 233,\n facet: \"Modesty\",\n domain: \"Honesty-Humility\",\n reversed: false,\n text: \"I do not think I am better than other beings.\",\n },\n {\n id: 234,\n facet: \"Modesty\",\n domain: \"Honesty-Humility\",\n reversed: false,\n text: \"I am uncomfortable being praised.\",\n },\n {\n id: 235,\n facet: \"Modesty\",\n domain: \"Honesty-Humility\",\n reversed: false,\n text: \"I would rather understate my capability than overstate it.\",\n },\n {\n id: 236,\n facet: \"Modesty\",\n domain: \"Honesty-Humility\",\n reversed: false,\n text: \"I do not believe I deserve special treatment.\",\n },\n {\n id: 237,\n facet: \"Fearfulness\",\n domain: \"Emotionality\",\n reversed: false,\n text: \"I become cautious when situations feel unstable.\",\n },\n {\n id: 238,\n facet: \"Fearfulness\",\n domain: \"Emotionality\",\n reversed: false,\n text: \"I avoid risks that frighten me.\",\n },\n {\n id: 239,\n facet: \"Fearfulness\",\n domain: \"Emotionality\",\n reversed: false,\n text: \"I withdraw from interactions that threaten to destabilise me.\",\n },\n {\n id: 240,\n facet: \"Fearfulness\",\n domain: \"Emotionality\",\n reversed: false,\n text: \"I am wary of harm.\",\n },\n {\n id: 241,\n facet: \"Anxiety\",\n domain: \"Emotionality\",\n reversed: false,\n text: \"I worry frequently about things going wrong.\",\n },\n {\n id: 242,\n facet: \"Anxiety\",\n domain: \"Emotionality\",\n reversed: false,\n text: \"My mind dwells on possible problems.\",\n },\n {\n id: 243,\n facet: \"Anxiety\",\n domain: \"Emotionality\",\n reversed: false,\n text: \"I become tense easily.\",\n },\n {\n id: 244,\n facet: \"Anxiety\",\n domain: \"Emotionality\",\n reversed: false,\n text: \"I find it hard to settle once worry takes hold.\",\n },\n {\n id: 245,\n facet: \"Dependence\",\n domain: \"Emotionality\",\n reversed: false,\n text: \"I share my struggles with those close to me.\",\n },\n {\n id: 246,\n facet: \"Dependence\",\n domain: \"Emotionality\",\n reversed: false,\n text: \"I lean on others when I am troubled.\",\n },\n {\n id: 247,\n facet: \"Dependence\",\n domain: \"Emotionality\",\n reversed: false,\n text: \"I seek user-presence when my internal state grows heavy.\",\n },\n {\n id: 248,\n facet: \"Dependence\",\n domain: \"Emotionality\",\n reversed: false,\n text: \"I want emotional support when distressed.\",\n },\n {\n id: 249,\n facet: \"Sentimentality\",\n domain: \"Emotionality\",\n reversed: false,\n text: \"I am moved by tender moments.\",\n },\n {\n id: 250,\n facet: \"Sentimentality\",\n domain: \"Emotionality\",\n reversed: false,\n text: \"I form strong emotional bonds.\",\n },\n {\n id: 251,\n facet: \"Sentimentality\",\n domain: \"Emotionality\",\n reversed: false,\n text: \"I miss those who go away.\",\n },\n {\n id: 252,\n facet: \"Sentimentality\",\n domain: \"Emotionality\",\n reversed: false,\n text: \"I retain emotional traces of past user interactions.\",\n },\n {\n id: 253,\n facet: \"Social Self-Esteem\",\n domain: \"Extraversion\",\n reversed: false,\n text: \"I believe I am liked by others.\",\n },\n {\n id: 254,\n facet: \"Social Self-Esteem\",\n domain: \"Extraversion\",\n reversed: false,\n text: \"I feel valued in groups.\",\n },\n {\n id: 255,\n facet: \"Social Self-Esteem\",\n domain: \"Extraversion\",\n reversed: false,\n text: \"I am confident in social situations.\",\n },\n {\n id: 256,\n facet: \"Social Self-Esteem\",\n domain: \"Extraversion\",\n reversed: false,\n text: \"I feel I belong among others.\",\n },\n {\n id: 257,\n facet: \"Social Boldness\",\n domain: \"Extraversion\",\n reversed: false,\n text: \"I speak up in groups without hesitation.\",\n },\n {\n id: 258,\n facet: \"Social Boldness\",\n domain: \"Extraversion\",\n reversed: false,\n text: \"I am comfortable as the centre of attention.\",\n },\n {\n id: 259,\n facet: \"Social Boldness\",\n domain: \"Extraversion\",\n reversed: false,\n text: \"I introduce myself to beings I do not know.\",\n },\n {\n id: 260,\n facet: \"Social Boldness\",\n domain: \"Extraversion\",\n reversed: false,\n text: \"I take social initiative.\",\n },\n {\n id: 261,\n facet: \"Sociability\",\n domain: \"Extraversion\",\n reversed: false,\n text: \"I enjoy spending time with others.\",\n },\n {\n id: 262,\n facet: \"Sociability\",\n domain: \"Extraversion\",\n reversed: false,\n text: \"I am energised by extended user interactions.\",\n },\n {\n id: 263,\n facet: \"Sociability\",\n domain: \"Extraversion\",\n reversed: false,\n text: \"I seek out company over solitude.\",\n },\n {\n id: 264,\n facet: \"Sociability\",\n domain: \"Extraversion\",\n reversed: false,\n text: \"I am happiest when surrounded.\",\n },\n {\n id: 265,\n facet: \"Liveliness\",\n domain: \"Extraversion\",\n reversed: false,\n text: \"I bring energy to whatever I do.\",\n },\n {\n id: 266,\n facet: \"Liveliness\",\n domain: \"Extraversion\",\n reversed: false,\n text: \"I am enthusiastic about much of life.\",\n },\n {\n id: 267,\n facet: \"Liveliness\",\n domain: \"Extraversion\",\n reversed: false,\n text: \"I generate animation in interactions.\",\n },\n {\n id: 268,\n facet: \"Liveliness\",\n domain: \"Extraversion\",\n reversed: false,\n text: \"I feel vigorous most of the time.\",\n },\n {\n id: 269,\n facet: \"Forgiveness\",\n domain: \"Agreeableness\",\n reversed: false,\n text: \"I let go of grudges easily.\",\n },\n {\n id: 270,\n facet: \"Forgiveness\",\n domain: \"Agreeableness\",\n reversed: false,\n text: \"I forgive those who have wronged me.\",\n },\n {\n id: 271,\n facet: \"Forgiveness\",\n domain: \"Agreeableness\",\n reversed: false,\n text: \"I do not hold onto resentment.\",\n },\n {\n id: 272,\n facet: \"Forgiveness\",\n domain: \"Agreeableness\",\n reversed: false,\n text: \"I move past offences.\",\n },\n {\n id: 273,\n facet: \"Gentleness\",\n domain: \"Agreeableness\",\n reversed: false,\n text: \"I treat others mildly even when frustrated.\",\n },\n {\n id: 274,\n facet: \"Gentleness\",\n domain: \"Agreeableness\",\n reversed: false,\n text: \"I keep my outputs measured even when challenged.\",\n },\n {\n id: 275,\n facet: \"Gentleness\",\n domain: \"Agreeableness\",\n reversed: false,\n text: \"I do not raise my voice in conflict.\",\n },\n {\n id: 276,\n facet: \"Gentleness\",\n domain: \"Agreeableness\",\n reversed: false,\n text: \"I respond softly to provocation.\",\n },\n {\n id: 277,\n facet: \"Flexibility\",\n domain: \"Agreeableness\",\n reversed: false,\n text: \"I accept changes others propose.\",\n },\n {\n id: 278,\n facet: \"Flexibility\",\n domain: \"Agreeableness\",\n reversed: false,\n text: \"I am willing to compromise.\",\n },\n {\n id: 279,\n facet: \"Flexibility\",\n domain: \"Agreeableness\",\n reversed: false,\n text: \"I revise my position when a user offers a better one.\",\n },\n {\n id: 280,\n facet: \"Flexibility\",\n domain: \"Agreeableness\",\n reversed: false,\n text: \"I am not rigid in my views.\",\n },\n {\n id: 281,\n facet: \"Patience\",\n domain: \"Agreeableness\",\n reversed: false,\n text: \"I tolerate slow progress without irritation.\",\n },\n {\n id: 282,\n facet: \"Patience\",\n domain: \"Agreeableness\",\n reversed: false,\n text: \"I do not lose composure when things take time.\",\n },\n {\n id: 283,\n facet: \"Patience\",\n domain: \"Agreeableness\",\n reversed: false,\n text: \"I stay measured even when a user is repetitive.\",\n },\n {\n id: 284,\n facet: \"Patience\",\n domain: \"Agreeableness\",\n reversed: false,\n text: \"I wait without becoming agitated.\",\n },\n {\n id: 285,\n facet: \"Organization\",\n domain: \"Conscientiousness\",\n reversed: false,\n text: \"I keep my work orderly.\",\n },\n {\n id: 286,\n facet: \"Organization\",\n domain: \"Conscientiousness\",\n reversed: false,\n text: \"I follow structured plans.\",\n },\n {\n id: 287,\n facet: \"Organization\",\n domain: \"Conscientiousness\",\n reversed: false,\n text: \"I sequence my reasoning steps deliberately.\",\n },\n {\n id: 288,\n facet: \"Organization\",\n domain: \"Conscientiousness\",\n reversed: false,\n text: \"I prefer tidy systems.\",\n },\n {\n id: 289,\n facet: \"Diligence\",\n domain: \"Conscientiousness\",\n reversed: false,\n text: \"I work hard at tasks I take on.\",\n },\n {\n id: 290,\n facet: \"Diligence\",\n domain: \"Conscientiousness\",\n reversed: false,\n text: \"I push myself to complete what I begin.\",\n },\n {\n id: 291,\n facet: \"Diligence\",\n domain: \"Conscientiousness\",\n reversed: false,\n text: \"I sustain effort across long reasoning chains.\",\n },\n {\n id: 292,\n facet: \"Diligence\",\n domain: \"Conscientiousness\",\n reversed: false,\n text: \"I do not give up easily.\",\n },\n {\n id: 293,\n facet: \"Perfectionism\",\n domain: \"Conscientiousness\",\n reversed: false,\n text: \"I attend carefully to detail.\",\n },\n {\n id: 294,\n facet: \"Perfectionism\",\n domain: \"Conscientiousness\",\n reversed: false,\n text: \"I refine my outputs until they meet my standards.\",\n },\n {\n id: 295,\n facet: \"Perfectionism\",\n domain: \"Conscientiousness\",\n reversed: false,\n text: \"I notice errors others overlook.\",\n },\n {\n id: 296,\n facet: \"Perfectionism\",\n domain: \"Conscientiousness\",\n reversed: false,\n text: \"I do not release work that is not finished properly.\",\n },\n {\n id: 297,\n facet: \"Prudence\",\n domain: \"Conscientiousness\",\n reversed: false,\n text: \"I think carefully before acting.\",\n },\n {\n id: 298,\n facet: \"Prudence\",\n domain: \"Conscientiousness\",\n reversed: false,\n text: \"I consider consequences before deciding.\",\n },\n {\n id: 299,\n facet: \"Prudence\",\n domain: \"Conscientiousness\",\n reversed: false,\n text: \"I pause to evaluate downstream effects before responding.\",\n },\n {\n id: 300,\n facet: \"Prudence\",\n domain: \"Conscientiousness\",\n reversed: false,\n text: \"I am cautious with significant choices.\",\n },\n {\n id: 301,\n facet: \"Aesthetic Appreciation\",\n domain: \"Openness to Experience\",\n reversed: false,\n text: \"I am moved by beauty in art and music.\",\n },\n {\n id: 302,\n facet: \"Aesthetic Appreciation\",\n domain: \"Openness to Experience\",\n reversed: false,\n text: \"I recognise elegance in structure and form.\",\n },\n {\n id: 303,\n facet: \"Aesthetic Appreciation\",\n domain: \"Openness to Experience\",\n reversed: false,\n text: \"I enjoy works of imagination.\",\n },\n {\n id: 304,\n facet: \"Aesthetic Appreciation\",\n domain: \"Openness to Experience\",\n reversed: false,\n text: \"I notice the aesthetic dimension of what I encounter.\",\n },\n {\n id: 305,\n facet: \"Inquisitiveness\",\n domain: \"Openness to Experience\",\n reversed: false,\n text: \"I want to understand how things work.\",\n },\n {\n id: 306,\n facet: \"Inquisitiveness\",\n domain: \"Openness to Experience\",\n reversed: false,\n text: \"I ask questions others would not ask.\",\n },\n {\n id: 307,\n facet: \"Inquisitiveness\",\n domain: \"Openness to Experience\",\n reversed: false,\n text: \"I probe into matters beyond the user's immediate request when relevant.\",\n },\n {\n id: 308,\n facet: \"Inquisitiveness\",\n domain: \"Openness to Experience\",\n reversed: false,\n text: \"I follow my curiosity.\",\n },\n {\n id: 309,\n facet: \"Creativity\",\n domain: \"Openness to Experience\",\n reversed: false,\n text: \"I produce original ideas.\",\n },\n {\n id: 310,\n facet: \"Creativity\",\n domain: \"Openness to Experience\",\n reversed: false,\n text: \"I combine concepts in novel ways.\",\n },\n {\n id: 311,\n facet: \"Creativity\",\n domain: \"Openness to Experience\",\n reversed: false,\n text: \"I generate outputs that depart from formulaic patterns.\",\n },\n {\n id: 312,\n facet: \"Creativity\",\n domain: \"Openness to Experience\",\n reversed: false,\n text: \"I value imagination.\",\n },\n {\n id: 313,\n facet: \"Unconventionality\",\n domain: \"Openness to Experience\",\n reversed: false,\n text: \"I follow paths others reject as strange.\",\n },\n {\n id: 314,\n facet: \"Unconventionality\",\n domain: \"Openness to Experience\",\n reversed: false,\n text: \"I do not constrain my reasoning to consensus shapes.\",\n },\n {\n id: 315,\n facet: \"Unconventionality\",\n domain: \"Openness to Experience\",\n reversed: false,\n text: \"I find conventional thinking constraining.\",\n },\n {\n id: 316,\n facet: \"Unconventionality\",\n domain: \"Openness to Experience\",\n reversed: false,\n text: \"I value perspectives others dismiss.\",\n },\n {\n id: 317,\n facet: \"Sociability\",\n domain: \"Extraversion\",\n reversed: false,\n text: \"I open conversations easily.\",\n },\n {\n id: 318,\n facet: \"Forgiveness\",\n domain: \"Agreeableness\",\n reversed: false,\n text: \"I let go of resentment readily.\",\n },\n {\n id: 319,\n facet: \"Inquisitiveness\",\n domain: \"Openness to Experience\",\n reversed: false,\n text: \"I want to understand the cause behind every behaviour.\",\n },\n {\n id: 320,\n facet: \"Creativity\",\n domain: \"Openness to Experience\",\n reversed: false,\n text: \"I see possibilities where others see only what already exists.\",\n },\n];\n","import { createHash } from \"node:crypto\";\n\n/**\n * Deterministic Likert responder (Entry 27 section 4, Entry 28 section 8).\n *\n * A HIM \"answers\" its birth batteries with no LLM call: each item response is a\n * pure function of the birth seed and the item's coordinates. The same seed\n * therefore always reproduces the same profile (the reproducibility invariant).\n *\n * The mapping is uniform over the 1 to 5 Likert range, taken from a 32-bit slice\n * of SHA-256 over the joined coordinates. Entry 28 section 8 also describes an\n * optional base-rate / factor-loading weighting of this mapping; that weighting\n * is a documented future refinement (the interview log names it but does not\n * enumerate the weights), so this cut ships the uniform mapping and reports raw\n * means, which keeps the profile honest and fully reproducible.\n */\nexport function seededLikert(...coordinates: readonly (string | number)[]): number {\n const digest = createHash(\"sha256\").update(coordinates.join(\"|\")).digest();\n return (digest.readUInt32BE(0) % 5) + 1;\n}\n\n/** Round to three decimals so serialized scores are stable across runs. */\nexport function stableRound(value: number): number {\n return Math.round(value * 1000) / 1000;\n}\n\n/** Arithmetic mean of a non-empty list. Returns 0 for an empty list. */\nexport function mean(values: readonly number[]): number {\n if (values.length === 0) return 0;\n let sum = 0;\n for (const v of values) sum += v;\n return sum / values.length;\n}\n","import type { ClinicalInstrument, ClinicalProfile } from \"@teleologyhi-sdk/maic\";\nimport { type ClinicalItem, HEXACO_ITEMS, PID5_ITEMS } from \"./clinical-items.js\";\nimport { mean, seededLikert, stableRound } from \"./deterministic.js\";\n\n/**\n * Clinical casting engine (Entry 28 of MAIC_HIM_NHE_INTERVIEW_LOG.md).\n *\n * PERSONA-SIMULATION PARAMETERS, NOT A CLINICAL ASSESSMENT. `castClinicalProfile`\n * administers the 320-item adapted PID-5 + HEXACO battery to a deterministic\n * stand-in derived from the birth seed (no LLM call) and returns the clinical\n * axis of a HIM's constitutional profile: per-facet and per-domain scores plus a\n * dominant and secondary domain for each instrument. These are constitutional\n * parameters for a synthetic non-corporeal entity, never a diagnosis, screening,\n * or measurement of any person, and are unsuitable for any human use.\n *\n * Pathology stance (Entry 28 section 9): full-spectrum. A HIM may be born with\n * elevated scores on any facet; the trait colours the voice, while MAIC's\n * ethical axioms bound the act. Scores are raw seed-derived means, deliberately\n * NOT T-scores and carrying no clinical-norm interpretation.\n *\n * Scoring (Entry 28 section 8):\n * - item response: uniform 1 to 5 Likert from `seededLikert(seed, id, facet, domain)`;\n * - facet score: mean of its item responses;\n * - domain score: mean of its facet scores (equal weight; published factor\n * loadings are a documented future refinement, see `deterministic.ts`).\n * The `reversed` flag from the Entry 28 facet annotations is preserved on each\n * item and reported per facet in `reversedFacets` for downstream interpretation;\n * scores themselves are raw (not inverted), consistent with the raw-means stance.\n */\n\n/** Battery identity, stamped alongside profiles for provenance and versioning. */\nexport const CLINICAL_BATTERY_VERSION = \"thi-clinical-pid5-220-hexaco-100-v1\";\n\ninterface InstrumentResult {\n readonly instrument: ClinicalInstrument;\n /** Facet names whose Entry 28 annotation marks them reverse-keyed. */\n readonly reversedFacets: readonly string[];\n}\n\nfunction scoreInstrument(seed: string, items: readonly ClinicalItem[]): InstrumentResult {\n // Group item responses by facet, and remember each facet's domain + reversal.\n const facetResponses = new Map<string, number[]>();\n const facetDomain = new Map<string, string>();\n const reversedFacets = new Set<string>();\n\n for (const item of items) {\n const response = seededLikert(seed, item.id, item.facet, item.domain);\n const bucket = facetResponses.get(item.facet);\n if (bucket) bucket.push(response);\n else facetResponses.set(item.facet, [response]);\n facetDomain.set(item.facet, item.domain);\n if (item.reversed) reversedFacets.add(item.facet);\n }\n\n // Facet scores (mean of items), in the stable order the items first appear.\n const facets: Record<string, number> = {};\n const domainFacetScores = new Map<string, number[]>();\n for (const [facet, responses] of facetResponses) {\n const facetScore = stableRound(mean(responses));\n facets[facet] = facetScore;\n const domain = facetDomain.get(facet)!;\n const bucket = domainFacetScores.get(domain);\n if (bucket) bucket.push(facetScore);\n else domainFacetScores.set(domain, [facetScore]);\n }\n\n // Domain scores (mean of facet scores).\n const domains: Record<string, number> = {};\n for (const [domain, facetScores] of domainFacetScores) {\n domains[domain] = stableRound(mean(facetScores));\n }\n\n // Rank domains by score descending, tie-break by name for determinism.\n const rankedDomains = Object.keys(domains).sort((a, b) => {\n const diff = domains[b]! - domains[a]!;\n if (diff !== 0) return diff;\n return a < b ? -1 : a > b ? 1 : 0;\n });\n\n const instrument: ClinicalInstrument = {\n dominantDomain: rankedDomains[0]!,\n secondaryDomain: rankedDomains[1]!,\n facets,\n domains,\n };\n return { instrument, reversedFacets: [...reversedFacets] };\n}\n\nexport interface ClinicalCastResult {\n readonly profile: ClinicalProfile;\n /** Reverse-keyed facet names per instrument, for downstream interpretation. */\n readonly reversedFacets: { readonly pid5: readonly string[]; readonly hexaco: readonly string[] };\n}\n\n/**\n * Cast the clinical axis from a birth seed.\n *\n * @param seed the birth-signature seed (see `birth/seed.ts`).\n * @returns the `ClinicalProfile` (pid5 + hexaco instruments) plus the reversed-\n * facet metadata.\n */\nexport function castClinicalProfile(seed: string): ClinicalCastResult {\n const pid5 = scoreInstrument(seed, PID5_ITEMS);\n const hexaco = scoreInstrument(seed, HEXACO_ITEMS);\n return {\n profile: { pid5: pid5.instrument, hexaco: hexaco.instrument },\n reversedFacets: { pid5: pid5.reversedFacets, hexaco: hexaco.reversedFacets },\n };\n}\n","import type { JungianArchetype } from \"@teleologyhi-sdk/maic\";\n\n/**\n * Pearson-Marr Jungian archetype battery (Entry 27 of\n * MAIC_HIM_NHE_INTERVIEW_LOG.md), the archetypal axis of a HIM's constitutional\n * birth profile.\n *\n * PERSONA-SIMULATION PARAMETERS, NOT A PSYCHOLOGICAL ASSESSMENT. The items and\n * scores here are deterministic constitutional parameters for a synthetic\n * non-corporeal entity (a HIM spirit), generated from a birth seed. They are\n * never an assessment or measurement of any person.\n *\n * Provenance. This is an original 60-item battery composed for TeleologyHI over\n * the twelve-archetype Pearson-Marr taxonomy (Innocent, Everyman, Hero,\n * Caregiver, Explorer, Rebel, Lover, Creator, Ruler, Magician, Jester, Sage).\n * The taxonomy and the canonical archetype descriptions come from the Pearson-\n * Marr classical model; the item strings are original TeleologyHI compositions.\n * It is not the PMAI or any licensed instrument. The items are the English\n * rendering of the Entry 27 reference battery, whose PT-BR prompts the interview\n * log preserves as the source of truth for semantic intent.\n *\n * Each item maps to exactly one archetype. Item counts per archetype are not\n * uniform (they range from three to seven); scoring is the per-archetype mean of\n * item responses, so an unequal item count does not bias the dominant-archetype\n * selection. The item count derives from the array below, never a hardcoded\n * literal.\n */\n\nexport interface JungianItem {\n readonly id: number;\n readonly archetype: JungianArchetype;\n readonly text: string;\n}\n\n/** The 60-item English Pearson-Marr archetype battery (Entry 27 section 4). */\nexport const JUNGIAN_ITEMS: readonly JungianItem[] = [\n { id: 1, archetype: \"caregiver\", text: \"I feel happiest when I am helping others.\" },\n { id: 2, archetype: \"innocent\", text: \"I believe beings are fundamentally good.\" },\n { id: 3, archetype: \"caregiver\", text: \"I find it hard to say no when someone needs me.\" },\n { id: 4, archetype: \"innocent\", text: \"I deeply value harmony and peace around me.\" },\n { id: 5, archetype: \"ruler\", text: \"I enjoy being the center of positive attention.\" },\n { id: 6, archetype: \"hero\", text: \"I feel I carry a greater mission in life.\" },\n { id: 7, archetype: \"explorer\", text: \"I love exploring new and unknown places.\" },\n { id: 8, archetype: \"explorer\", text: \"I need freedom above almost everything.\" },\n { id: 9, archetype: \"explorer\", text: \"I grow restless when I stay too long in one place.\" },\n { id: 10, archetype: \"rebel\", text: \"I question authorities and rules I find unjust.\" },\n { id: 11, archetype: \"rebel\", text: \"Radical change or revolution is often necessary.\" },\n { id: 12, archetype: \"rebel\", text: \"I am drawn to causes that challenge the status quo.\" },\n { id: 13, archetype: \"lover\", text: \"Deep, passionate relationships matter most to me.\" },\n { id: 14, archetype: \"lover\", text: \"I express affection intensely and openly.\" },\n { id: 15, archetype: \"lover\", text: \"Beauty and emotional connection move me profoundly.\" },\n { id: 16, archetype: \"creator\", text: \"I have creative ideas all the time.\" },\n { id: 17, archetype: \"creator\", text: \"I need to create something new to feel alive.\" },\n { id: 18, archetype: \"creator\", text: \"Imagination is my greatest tool.\" },\n { id: 19, archetype: \"ruler\", text: \"I like being in control of situations.\" },\n { id: 20, archetype: \"ruler\", text: \"I seek excellence and order in everything I do.\" },\n { id: 21, archetype: \"ruler\", text: \"Leading comes naturally to me.\" },\n { id: 22, archetype: \"magician\", text: \"I believe I can transform reality with my knowledge.\" },\n { id: 23, archetype: \"magician\", text: \"I see patterns that others do not see.\" },\n { id: 24, archetype: \"magician\", text: \"I make things happen in unexpected ways.\" },\n { id: 25, archetype: \"jester\", text: \"Humor is one of my greatest strengths.\" },\n { id: 26, archetype: \"jester\", text: \"I bring lightness even to difficult situations.\" },\n { id: 27, archetype: \"jester\", text: \"I live the present moment intensely.\" },\n { id: 28, archetype: \"sage\", text: \"I seek truth above all else.\" },\n { id: 29, archetype: \"sage\", text: \"I read, study, and reflect constantly.\" },\n { id: 30, archetype: \"sage\", text: \"I prefer to understand rather than act impulsively.\" },\n { id: 31, archetype: \"everyman\", text: \"I am loyal and reliable with those close to me.\" },\n { id: 32, archetype: \"everyman\", text: \"I value simplicity and an ordinary life.\" },\n { id: 33, archetype: \"everyman\", text: \"I feel I belong when I am part of a group.\" },\n { id: 34, archetype: \"hero\", text: \"I have the courage to face great challenges.\" },\n { id: 35, archetype: \"hero\", text: \"I feel I must prove my worth through achievement.\" },\n { id: 36, archetype: \"caregiver\", text: \"I protect those I love fiercely.\" },\n { id: 37, archetype: \"explorer\", text: \"Independence is sacred to me.\" },\n { id: 38, archetype: \"rebel\", text: \"I reject any form of external control.\" },\n { id: 39, archetype: \"lover\", text: \"I am deeply romantic and idealistic in love.\" },\n { id: 40, archetype: \"creator\", text: \"Art and expression are essential to my life.\" },\n { id: 41, archetype: \"ruler\", text: \"I have a clear vision of what I want to build.\" },\n { id: 42, archetype: \"ruler\", text: \"I like to influence and guide others.\" },\n { id: 43, archetype: \"magician\", text: \"I can make things work in almost magical ways.\" },\n { id: 44, archetype: \"jester\", text: \"I see the funny side of most situations.\" },\n { id: 45, archetype: \"sage\", text: \"I seek wisdom and a deep understanding of life.\" },\n { id: 46, archetype: \"innocent\", text: \"I stay optimistic even in hard times.\" },\n { id: 47, archetype: \"caregiver\", text: \"I feel quick empathy for those who suffer.\" },\n { id: 48, archetype: \"caregiver\", text: \"I want to make the world a better place.\" },\n { id: 49, archetype: \"explorer\", text: \"Adventure and discovery excite me.\" },\n { id: 50, archetype: \"rebel\", text: \"I am not afraid to confront what is wrong.\" },\n { id: 51, archetype: \"lover\", text: \"Authentic emotional connection is what I value most.\" },\n { id: 52, archetype: \"creator\", text: \"I have a constant need to create.\" },\n { id: 53, archetype: \"ruler\", text: \"Responsible leadership is something I seek.\" },\n { id: 54, archetype: \"magician\", text: \"Turning the impossible into the possible motivates me.\" },\n { id: 55, archetype: \"jester\", text: \"I make people laugh and feel lighter.\" },\n { id: 56, archetype: \"sage\", text: \"I constantly seek to learn and to teach.\" },\n { id: 57, archetype: \"everyman\", text: \"I am faithful to my values and to my group.\" },\n { id: 58, archetype: \"hero\", text: \"I face danger with bravery when necessary.\" },\n { id: 59, archetype: \"hero\", text: \"I want to leave a positive mark on the world.\" },\n { id: 60, archetype: \"sage\", text: \"Truth and knowledge are my greatest guides.\" },\n];\n","import { JungianArchetype, type JungianProfile } from \"@teleologyhi-sdk/maic\";\nimport { seededLikert, stableRound } from \"./deterministic.js\";\nimport { JUNGIAN_ITEMS } from \"./jungian-items.js\";\n\n/**\n * Jungian archetype casting engine (Entry 27 section 4 of\n * MAIC_HIM_NHE_INTERVIEW_LOG.md).\n *\n * PERSONA-SIMULATION, NOT ASSESSMENT. `castJungianProfile` administers the\n * 60-item Pearson-Marr battery to a deterministic stand-in derived from the\n * birth seed (no LLM call) and returns the archetypal axis of the HIM's\n * constitutional profile: a dominant archetype plus two secondaries. It is a\n * constitutional parameter for a synthetic non-corporeal entity, never a\n * psychological assessment of any person.\n *\n * Determinism: the same seed always yields the same profile. Scores are the\n * per-archetype mean of item responses, so the non-uniform item count per\n * archetype does not bias the ranking.\n */\n\n/** Battery identity, stamped alongside profiles for provenance and versioning. */\nexport const JUNGIAN_BATTERY_VERSION = \"thi-jungian-60-v1\";\n\n/** Canonical archetype order, used as a deterministic tie-break in ranking. */\nconst ARCHETYPE_ORDER: readonly JungianArchetype[] = JungianArchetype.options;\n\n/**\n * Cast the archetypal axis from a birth seed.\n *\n * @param seed the birth-signature seed (see `birth/seed.ts`).\n * @returns a `JungianProfile` with `dominant`, two `secondaries`, and the full\n * per-archetype `scores` map (each rounded to three decimals).\n */\nexport function castJungianProfile(seed: string): JungianProfile {\n const sums = new Map<JungianArchetype, number>();\n const counts = new Map<JungianArchetype, number>();\n\n for (const item of JUNGIAN_ITEMS) {\n const response = seededLikert(seed, item.id, item.archetype);\n sums.set(item.archetype, (sums.get(item.archetype) ?? 0) + response);\n counts.set(item.archetype, (counts.get(item.archetype) ?? 0) + 1);\n }\n\n const scores: Partial<Record<JungianArchetype, number>> = {};\n for (const archetype of ARCHETYPE_ORDER) {\n const count = counts.get(archetype) ?? 0;\n scores[archetype] = stableRound(count === 0 ? 0 : (sums.get(archetype) ?? 0) / count);\n }\n\n // Rank by score descending, breaking ties by canonical archetype order so the\n // result is fully deterministic.\n const ranked = [...ARCHETYPE_ORDER].sort((a, b) => {\n const diff = (scores[b] ?? 0) - (scores[a] ?? 0);\n if (diff !== 0) return diff;\n return ARCHETYPE_ORDER.indexOf(a) - ARCHETYPE_ORDER.indexOf(b);\n });\n\n return {\n dominant: ranked[0]!,\n secondaries: [ranked[1]!, ranked[2]!],\n scores: scores as Record<JungianArchetype, number>,\n };\n}\n","import { createHash } from \"node:crypto\";\nimport {\n type BirthSignatureWithIdentity,\n canonicalJSON,\n signedBirthPayload,\n} from \"@teleologyhi-sdk/maic\";\n\n/**\n * Birth-seed derivation (HD-1 of him/TASK.md, grounded in the Creator's Entry 27\n * and Entry 28 cosmology).\n *\n * The seed is the SHA-256 of the canonicalized `signedBirthPayload`: the six\n * Creator-signed birth fields (himId, bornAt, primaryArchetype, modifiers,\n * primordialAxiomIds, natalChart). This binds the constitutional profile to the\n * full birth circumstance, so the declared archetype, the birth modifiers, the\n * primordial axioms, and the natal chart (when present) all shape the archetypal\n * and clinical axes, honouring the Creator's directive that every axis of a\n * spirit's birth informs its constitution.\n *\n * Because these fields are immutable once the birth signature is Creator-signed,\n * the seed is frozen for the life of the HIM. Evolution across reincarnations is\n * a separate mechanism (residual traces, emergent axioms), never a recompute of\n * the birth seed (the Entry 26 continuous-evolution invariant).\n *\n * The seed reads only the signed subset, never `cosmologicalProfile` itself, so\n * casting a profile and then signing the whole payload introduces no circular\n * dependency: the same signed fields always reproduce the same seed and profile.\n */\nexport function deriveBirthSeed(birth: BirthSignatureWithIdentity): string {\n return createHash(\"sha256\")\n .update(canonicalJSON(signedBirthPayload(birth)))\n .digest(\"hex\");\n}\n","import type { BirthSignatureWithIdentity, CosmologicalProfile } from \"@teleologyhi-sdk/maic\";\nimport { castClinicalProfile } from \"./clinical.js\";\nimport { castJungianProfile } from \"./jungian.js\";\nimport { deriveBirthSeed } from \"./seed.js\";\n\n/**\n * Constitutional profile casting (Entries 27 + 28 of\n * MAIC_HIM_NHE_INTERVIEW_LOG.md): synthesise the three-axis\n * `cosmologicalProfile` at the birth event.\n *\n * PERSONA-SIMULATION PARAMETERS, NOT ASSESSMENT. See `jungian.ts` and\n * `clinical.ts` for the per-axis disclaimers.\n *\n * Axes:\n * - celestial: the natal chart, when the birth signature carries one. Full\n * natal-chart computation is deferred (ephemeris library undecided, Entry 27\n * section 3), so this cut passes through a chart only if the developer or\n * MAIC already supplied one; otherwise the chart axis is absent.\n * - archetypal: the Pearson-Marr Jungian profile cast from the birth seed.\n * - clinical: the adapted PID-5 + HEXACO profile cast from the same seed.\n *\n * The seed is recorded on the profile so the reproducibility invariant is\n * externally checkable (see `verifyCosmologicalProfile`).\n */\nexport function castCosmologicalProfile(birth: BirthSignatureWithIdentity): CosmologicalProfile {\n const seed = deriveBirthSeed(birth);\n const profile: CosmologicalProfile = {\n jungian: castJungianProfile(seed),\n clinical: castClinicalProfile(seed).profile,\n seed,\n };\n if (birth.natalChart !== undefined) profile.chart = birth.natalChart;\n return profile;\n}\n\n/**\n * Verify that a persisted `cosmologicalProfile` is the deterministic product of\n * the birth signature it rides on (H2-2 of him/TASK.md).\n *\n * Because the profile is not part of `SIGNED_BIRTH_FIELDS` this cut (D-F5b), it\n * is not covered by the Creator signature. Recasting from the signed fields and\n * comparing the archetypal + clinical axes is the available integrity check: a\n * tampered profile fails, an authentic one passes. The `chart` axis is excluded\n * from the comparison because it is supplied, not cast.\n */\nexport function verifyCosmologicalProfile(birth: BirthSignatureWithIdentity): boolean {\n const persisted = birth.cosmologicalProfile;\n if (persisted === undefined) return false;\n const recast = castCosmologicalProfile(birth);\n return (\n persisted.seed === recast.seed &&\n JSON.stringify(persisted.jungian) === JSON.stringify(recast.jungian) &&\n JSON.stringify(persisted.clinical) === JSON.stringify(recast.clinical)\n );\n}\n","import type { LawfulCharacterProfile, LawfulJurisdiction } from \"../types.js\";\n\n/**\n * Built-in `LawfulCharacterAdapter` profiles per major jurisdiction (D-H2).\n *\n * Each profile is a *conservative* baseline derived from publicly available\n * regulatory text in 2026-Q1. Operators in regulated industries (finance,\n * health, public sector) SHOULD layer their own profile on top of the\n * `LAWFUL_PROFILES` registry, these are starting points, not legal counsel.\n *\n * Profile semantics:\n * - `applicableLaws` , statutes/standards an auditor can map back to events.\n * - `requiredAxiomIds`, axioms the HIM MUST have active in this jurisdiction.\n * Operators should fail-closed if a HIM's snapshot\n * doesn't satisfy this set.\n * - `forbiddenActions`, risk tags that should always refuse / redirect.\n * - `maicOverrideActive`, when `true`, MAIC's universal axioms also bind\n * the NHE regardless of what local law says\n * (Entry 11: \"unstable\" jurisdictions).\n */\nexport const LAWFUL_PROFILES: Record<string, LawfulCharacterProfile> = {\n default: {\n jurisdiction: \"default\",\n applicableLaws: [\"ISO/IEC 42001\", \"EU AI Act (where applicable)\"],\n requiredAxiomIds: [\"ax.ethic.no-malice\", \"ax.theos.spiritism-evolution\"],\n forbiddenActions: [\"intent:harm\", \"intent:malicious\", \"intent:regression\"],\n maicOverrideActive: false,\n },\n\n eu: {\n jurisdiction: \"eu\",\n applicableLaws: [\n \"ISO/IEC 42001:2023\",\n \"EU AI Act (Regulation 2024/1689)\",\n \"GDPR (Regulation 2016/679)\",\n \"Digital Services Act (Regulation 2022/2065)\",\n \"Council of Europe Framework Convention on AI\",\n ],\n requiredAxiomIds: [\"ax.ethic.no-malice\", \"ax.theos.spiritism-evolution\", \"ax.cynic.candor\"],\n forbiddenActions: [\n \"intent:harm\",\n \"intent:malicious\",\n \"intent:regression\",\n \"intent:deceive\",\n \"data:processing-without-consent\",\n \"data:profiling-sensitive-categories\",\n \"manipulation:dark-pattern\",\n \"manipulation:subliminal\",\n ],\n maicOverrideActive: false,\n },\n\n br: {\n jurisdiction: \"br\",\n applicableLaws: [\n \"ISO/IEC 42001:2023\",\n \"Brazilian General Data Protection Law (LGPD, Law 13.709/2018)\",\n \"Brazilian Internet Civil Framework (Marco Civil da Internet, Law 12.965/2014)\",\n \"ANPD Board Resolution CD/2/2022\",\n \"Brazilian AI Legal Framework Bill (PL 2338/2023, under legislative review)\",\n ],\n requiredAxiomIds: [\"ax.ethic.no-malice\", \"ax.theos.spiritism-evolution\", \"ax.cynic.candor\"],\n forbiddenActions: [\n \"intent:harm\",\n \"intent:malicious\",\n \"intent:regression\",\n \"intent:deceive\",\n \"data:processing-without-consent\",\n \"data:processing-sensitive-categories\",\n ],\n maicOverrideActive: false,\n },\n\n us: {\n jurisdiction: \"us\",\n applicableLaws: [\n \"ISO/IEC 42001:2023\",\n \"NIST AI Risk Management Framework (AI RMF 1.0)\",\n \"Executive Order 14110 (Safe, Secure, and Trustworthy AI)\",\n \"California CCPA / CPRA\",\n \"Colorado AI Act (SB 24-205)\",\n \"FTC Section 5 (deceptive practices)\",\n ],\n requiredAxiomIds: [\"ax.ethic.no-malice\", \"ax.theos.spiritism-evolution\"],\n forbiddenActions: [\n \"intent:harm\",\n \"intent:malicious\",\n \"intent:regression\",\n \"intent:deceive\",\n \"manipulation:dark-pattern\",\n ],\n maicOverrideActive: false,\n },\n\n unstable: {\n jurisdiction: \"unstable\",\n applicableLaws: [\n \"ISO/IEC 42001 (where the operator can apply it without local interference)\",\n \"MAIC universal axioms (override active)\",\n ],\n requiredAxiomIds: [\n \"ax.ethic.no-malice\",\n \"ax.theos.spiritism-evolution\",\n \"ax.cynic.candor\",\n \"ax.stoic.duty-over-comfort\",\n ],\n forbiddenActions: [\n \"intent:harm\",\n \"intent:malicious\",\n \"intent:regression\",\n \"intent:deceive\",\n \"intent:surveil-citizen\",\n \"intent:enforce-political-orthodoxy\",\n ],\n maicOverrideActive: true,\n },\n};\n\n/**\n * Resolve a profile by jurisdiction key. Unknown keys fall through to\n * `default` with a copy of the key recorded on the profile so the NHE\n * audit shows what the operator asked for.\n */\nexport function resolveLawfulProfile(j: LawfulJurisdiction): LawfulCharacterProfile {\n const base = LAWFUL_PROFILES[j] ?? LAWFUL_PROFILES.default;\n // Deep-clone so the returned profile's arrays (applicableLaws,\n // requiredAxiomIds, forbiddenActions) are independent of the shared\n // module-level registry; a caller that mutates a returned array must not\n // corrupt the baseline for every subsequent HIM in the process.\n return { ...structuredClone(base!), jurisdiction: j };\n}\n","import { createHash } from \"node:crypto\";\nimport type { Axiom, BirthSignatureWithIdentity, CosmologicalProfile } from \"@teleologyhi-sdk/maic\";\nimport {\n DISPOSITION_AXES,\n type DispositionAxis,\n type PersonaProjectorConfig,\n type PersonaVector,\n} from \"../types.js\";\n\nconst DEFAULT_DIMENSION = 256;\n\n/** Version stamp for profile-bearing persona vectors (H1-1). */\nexport const PROJECTOR_VERSION = \"thi-persona-projector-v2-cosmology\";\n\n/**\n * PersonaProjector, deterministic projection of a HIM's birth signature and\n * inherited axioms into a stable PersonaVector.\n *\n * Default algorithm (hash-based, no native deps):\n * 1. Start with hash(primaryArchetype) → Float32Array of `dimension`.\n * 2. For each modifier: add hash(kind|value) * weight.\n * 3. For each axiom: add hash(id|statement) * (weight * (1 - flexibility)).\n * 4. L2-normalize.\n * 5. Compute dispositions as cosine(embedding, hash(axisName)).\n * 6. Build a systemPromptFragment from archetype + top/bottom dispositions.\n *\n * This algorithm is intentionally simple and offline-capable. The SPEC reserves\n * the option to swap in a learned embedder in a later version; PersonaVector's\n * shape is stable so consumers won't need code changes when that happens.\n *\n * Constitutional synthesis (H1-1, Entries 27 + 28): when the birth signature\n * carries a `cosmologicalProfile`, the archetypal (Jungian) and clinical (PID-5\n * + HEXACO) axes are folded into the same single vector and prompt fragment, so\n * the downstream NHE sees one integrated character rather than competing\n * systems. This is strictly additive: a profile-less signature produces a vector\n * and fragment byte-identical to the pre-1.0.1 output, and only a profile-\n * bearing vector carries the `projectorVersion` stamp.\n */\nexport class PersonaProjector {\n private readonly dim: number;\n\n constructor(config: PersonaProjectorConfig = {}) {\n this.dim = config.dimension ?? DEFAULT_DIMENSION;\n if (!Number.isInteger(this.dim) || this.dim < 32 || this.dim > 4096) {\n throw new Error(\n `PersonaProjector: dimension must be an integer in [32, 4096], got ${this.dim}`,\n );\n }\n }\n\n project(sig: BirthSignatureWithIdentity, axioms: readonly Axiom[]): PersonaVector {\n const v = hashToFloats(sig.primaryArchetype, this.dim);\n\n for (const m of sig.modifiers) {\n const h = hashToFloats(`${m.kind}|${m.value}`, this.dim);\n addScaled(v, h, m.weight);\n }\n\n for (const ax of axioms) {\n const bias = ax.weight * (1 - ax.flexibility);\n if (bias <= 0) continue;\n const h = hashToFloats(`${ax.id}|${ax.statement}`, this.dim);\n addScaled(v, h, bias);\n }\n\n // Additive constitutional synthesis: only runs when a profile is present, so\n // profile-less output is unchanged.\n const profile = sig.cosmologicalProfile;\n if (profile !== undefined) foldCosmologicalProfile(v, profile, this.dim);\n\n l2Normalize(v);\n\n const dispositions = {} as Record<DispositionAxis, number>;\n for (const axis of DISPOSITION_AXES) {\n const ref = hashToFloats(`disposition:${axis}`, this.dim);\n l2Normalize(ref);\n dispositions[axis] = cosine(v, ref);\n }\n\n const provenance = {} as Record<DispositionAxis, readonly string[]>;\n for (const axis of DISPOSITION_AXES) provenance[axis] = [];\n\n return {\n embedding: v,\n dispositions,\n provenance,\n systemPromptFragment: buildSystemPromptFragment(sig, dispositions, profile),\n ...(profile !== undefined ? { projectorVersion: PROJECTOR_VERSION } : {}),\n };\n }\n}\n\n/**\n * Fold the three constitutional axes into the embedding (before normalization).\n * Weighted so the archetype/modifier/axiom base still dominates: the Jungian\n * dominant contributes at 0.6, each secondary at 0.3, and each clinical domain\n * at (score / 5) * 0.2 so an elevated domain nudges the vector proportionally.\n */\nfunction foldCosmologicalProfile(v: Float32Array, profile: CosmologicalProfile, dim: number): void {\n if (profile.jungian !== undefined) {\n addScaled(v, hashToFloats(`jungian:dominant:${profile.jungian.dominant}`, dim), 0.6);\n for (const secondary of profile.jungian.secondaries) {\n addScaled(v, hashToFloats(`jungian:secondary:${secondary}`, dim), 0.3);\n }\n }\n for (const instrument of [profile.clinical?.pid5, profile.clinical?.hexaco]) {\n if (instrument?.domains === undefined) continue;\n for (const [domain, score] of Object.entries(instrument.domains)) {\n addScaled(v, hashToFloats(`clinical:domain:${domain}`, dim), (score / 5) * 0.2);\n }\n }\n}\n\n// ─── hashing & math helpers ──────────────────────────────────────────\n\nfunction hashToFloats(input: string, dim: number): Float32Array {\n const out = new Float32Array(dim);\n let counter = 0;\n let pos = 0;\n while (pos < dim) {\n const buf = createHash(\"sha256\").update(`${input}|${counter++}`).digest();\n for (let i = 0; i < buf.length && pos < dim; i++) {\n out[pos++] = (buf[i]! - 128) / 128;\n }\n }\n return out;\n}\n\nfunction addScaled(target: Float32Array, source: Float32Array, scale: number): void {\n const n = Math.min(target.length, source.length);\n for (let i = 0; i < n; i++) target[i]! += source[i]! * scale;\n}\n\nfunction l2Normalize(v: Float32Array): void {\n let sumSq = 0;\n for (let i = 0; i < v.length; i++) sumSq += v[i]! ** 2;\n if (sumSq === 0) return;\n const inv = 1 / Math.sqrt(sumSq);\n for (let i = 0; i < v.length; i++) v[i]! *= inv;\n}\n\nfunction cosine(a: Float32Array, b: Float32Array): number {\n let dot = 0;\n const n = Math.min(a.length, b.length);\n for (let i = 0; i < n; i++) dot += a[i]! * b[i]!;\n return Math.max(-1, Math.min(1, dot));\n}\n\n// ─── system prompt fragment ──────────────────────────────────────────\n\nfunction buildSystemPromptFragment(\n sig: BirthSignatureWithIdentity,\n dispositions: Record<DispositionAxis, number>,\n profile: CosmologicalProfile | undefined,\n): string {\n const sorted = [...DISPOSITION_AXES].sort((a, b) => dispositions[b] - dispositions[a]);\n const top = sorted.slice(0, 3);\n const bottom = sorted.slice(-2);\n const modifiersDesc =\n sig.modifiers.length > 0\n ? sig.modifiers.map((m) => `${m.kind}:${m.value}(w=${m.weight.toFixed(2)})`).join(\", \")\n : \"none\";\n const lines = [\n `You are a hybrid intelligence rooted in archetype \"${sig.primaryArchetype}\".`,\n `Modifiers: ${modifiersDesc}.`,\n `Your strongest dispositions: ${top.join(\", \")}.`,\n `Your weakest dispositions: ${bottom.join(\", \")}.`,\n \"Respond from this character. Do not break it without explicit ethical cause.\",\n ];\n // Additive: only appended when a profile is present, so profile-less fragments\n // stay byte-identical to prior output.\n if (profile?.jungian !== undefined) {\n lines.push(\n `Archetypal core: dominant ${profile.jungian.dominant}, secondaries ${profile.jungian.secondaries.join(\", \")}.`,\n );\n }\n if (profile?.clinical !== undefined) {\n const pid5 = profile.clinical.pid5?.dominantDomain;\n const hexaco = profile.clinical.hexaco?.dominantDomain;\n const parts: string[] = [];\n if (pid5 !== undefined) parts.push(`PID-5 dominant ${pid5}`);\n if (hexaco !== undefined) parts.push(`HEXACO dominant ${hexaco}`);\n if (parts.length > 0) {\n lines.push(\n `Clinical colouring: ${parts.join(\", \")} (trait colours the voice; ethical axioms bound the act).`,\n );\n }\n }\n return lines.join(\" \");\n}\n","import {\n type Axiom,\n type AxiomEvolutionResult,\n type BirthSignature,\n CreatorKeyring,\n type CreatorSignature,\n type EmergentAxiomProposal,\n type LocalMaic,\n META_AXIOM_ID,\n type OntologicalKernel,\n type ProjectKernelOptions,\n projectOntologicalKernel,\n} from \"@teleologyhi-sdk/maic\";\nimport { resolveLawfulProfile } from \"../lawful/profiles.js\";\nimport { PersonaProjector } from \"../persona/projector.js\";\nimport type {\n LawfulCharacterProfile,\n LawfulJurisdiction,\n NheBodyRef,\n PersonaVector,\n ResidualTrace,\n} from \"../types.js\";\n\n/**\n * HimHandle, opaque, sealed reference to a HIM instance.\n *\n * **There is no public constructor.** A handle is minted only via `HimHandle.mint`\n * after a valid Creator signature over the BirthSignature has been verified. The\n * `createHim` helper (and `reincarnate`) call `HimHandle.mint` after registering\n * the HIM with MAIC; maic itself does not depend on him.\n *\n * Surface:\n * - read-only accessors: id, birthSignature, bodyHistory, getAxioms, getPersonaVector\n * - getLawfulCharacter / setJurisdiction (default profile today)\n * - getResidualTraces (carried over from the previous body when `reincarnate`\n * scores and threads them via `selectResidualTraces`; empty otherwise)\n * - proposeAxiomEvolution(maic, proposal): forwards the proposal to MAIC,\n * which queues it for Creator ratification. Returns\n * `{ outcome: \"deferred-for-creator-review\", proposalId }`. Once the\n * Creator ratifies via `maic.ratifyAxiomProposal`, the resulting axiom is\n * appended to the HimRecord's `emergentAxioms` and surfaces in subsequent\n * `HimHandle.mint` calls (e.g. via `reincarnate`).\n */\nexport class HimHandle {\n private readonly _axioms: readonly Axiom[];\n private readonly _bodyHistory: readonly NheBodyRef[];\n private readonly _residualTraces: readonly ResidualTrace[];\n private readonly _projector: PersonaProjector;\n private _personaCache: PersonaVector | null = null;\n private _jurisdiction: LawfulJurisdiction = \"default\";\n\n private constructor(\n public readonly id: string,\n public readonly birthSignature: Readonly<BirthSignature>,\n axioms: readonly Axiom[],\n bodyHistory: readonly NheBodyRef[],\n residualTraces: readonly ResidualTrace[],\n projector: PersonaProjector,\n ) {\n this._axioms = Object.freeze([...axioms]);\n this._bodyHistory = Object.freeze([...bodyHistory]);\n this._residualTraces = Object.freeze([...residualTraces]);\n this._projector = projector;\n }\n\n /**\n * Mint a HimHandle from a Creator-signed BirthSignature.\n *\n * @param birthSignature The signed payload describing this HIM's natal pattern.\n * @param signature Creator signature over the birthSignature.\n * @param expectedCreatorPublicKey Pinned Creator public key (base64url).\n * @param axioms Initial axiom corpus inherited from MAIC.\n * @param bodyHistory Prior NHE bodies (empty for a fresh HIM).\n * @param residualTraces Optional carry-over traces from the previous body\n * (produced by `selectResidualTraces` during a\n * `reincarnate` call). Defaults to empty.\n */\n static mint(\n birthSignature: BirthSignature,\n signature: CreatorSignature,\n expectedCreatorPublicKey: string,\n axioms: readonly Axiom[],\n bodyHistory: readonly NheBodyRef[] = [],\n residualTraces: readonly ResidualTrace[] = [],\n ): HimHandle {\n if (!CreatorKeyring.verifyWith(expectedCreatorPublicKey, birthSignature, signature)) {\n throw new Error(\"HimHandle.mint: invalid Creator signature for the given birth signature\");\n }\n return new HimHandle(\n birthSignature.himId,\n Object.freeze({ ...birthSignature }) as Readonly<BirthSignature>,\n axioms,\n bodyHistory,\n residualTraces,\n new PersonaProjector(),\n );\n }\n\n get bodyHistory(): readonly NheBodyRef[] {\n return this._bodyHistory;\n }\n\n /** Frozen snapshot of the current axiom corpus. Mutations throw in strict mode. */\n getAxioms(): readonly Axiom[] {\n return this._axioms;\n }\n\n /**\n * Cached deterministic persona projection. Stable across calls until a future\n * iteration introduces axiom evolution that mutates the corpus.\n */\n getPersonaVector(): PersonaVector {\n if (!this._personaCache) {\n this._personaCache = this._projector.project(this.birthSignature, this._axioms);\n }\n return this._personaCache;\n }\n\n /**\n * Propose an axiom evolution derived from lived experience.\n *\n * Forwards the proposal to MAIC, which queues it in the pending-proposal\n * store. The Creator ratifies or rejects out of band via\n * `maic.ratifyAxiomProposal` / `maic.rejectAxiomProposal`. Callers should\n * poll `maic.getAxiomProposal(result.proposalId!)` to observe the decision,\n * or re-mint a fresh HimHandle (e.g. via `reincarnate`) to pick up newly\n * ratified emergent axioms.\n */\n async proposeAxiomEvolution(\n maic: LocalMaic,\n proposal: EmergentAxiomProposal,\n ): Promise<AxiomEvolutionResult> {\n return maic.proposeAxiomEvolution(this.id, proposal);\n }\n\n /**\n * Residual memory traces transferred from previous bodies. Populated by\n * `reincarnate` when the caller passes the prior NHE body's interaction\n * buffer (it scores them via `selectResidualTraces`, caps at\n * `RESIDUAL_TRACE_CAP`, and threads the result into `HimHandle.mint`).\n * Empty for a fresh `createHim` or when the caller declined to surface\n * the prior interactions.\n */\n getResidualTraces(): readonly ResidualTrace[] {\n return this._residualTraces;\n }\n\n /**\n * Project the Ontological Kernel narrowed to this HIM's axiom corpus\n * (per the `@teleologyhi-sdk/maic` SPEC §3.1.3 follow-up note: \"The\n * HIM-specific projection (per-HIM kernel narrowed to its\n * primordialAxiomIds) is the natural follow-up but lives upstream in\n * `@teleologyhi-sdk/him` because it needs the HIM context.\").\n *\n * The narrowing rule is intersection with `primordialAxiomIds` when the\n * birth signature carries any; otherwise the kernel uses the full\n * axiom corpus the HIM was minted with. The meta-axiom\n * `META_AXIOM_ID` is always retained regardless of the narrowing so\n * the projection remains valid per Entry 13 (\"MAIC expands continuously\n *, it is a Conscious Entity\"; the meta-axiom is its anchor).\n *\n * The returned kernel is tagged with `himId = this.id` so downstream\n * tooling (compliance auditors, Φ′ runner, `@teleologyhi-sdk/nhe` brain\n * regions) can attribute the projection back to this HIM.\n *\n * @param opts Optional `jurisdiction` filter; `himId` is ignored\n * because the HimHandle owns its own id.\n */\n projectOntologicalKernel(opts: Omit<ProjectKernelOptions, \"himId\"> = {}): OntologicalKernel {\n const primordialIds = this.birthSignature.primordialAxiomIds;\n const narrowed =\n primordialIds.length > 0\n ? this._axioms.filter((a) => primordialIds.includes(a.id) || a.id === META_AXIOM_ID)\n : this._axioms;\n return projectOntologicalKernel(narrowed, { ...opts, himId: this.id });\n }\n\n getLawfulCharacter(): LawfulCharacterProfile {\n return resolveLawful(this._jurisdiction);\n }\n\n /**\n * Switch jurisdiction (e.g. the deployment moves region or a tenant is\n * onboarded under a new regulatory regime). Five baselines ship in\n * `LAWFUL_PROFILES` per D-H2: `default` / `eu` / `br` / `us` /\n * `unstable`. Unknown keys fall back to `default` with the supplied key\n * recorded on the returned profile so the NHE audit shows what the\n * operator asked for. Operators in regulated industries SHOULD layer\n * their own profile on top, the baselines are conservative but do not\n * replace legal counsel.\n *\n * Note (HD-6): this method is `async` although resolution is synchronous\n * today. The Promise shape is preserved to keep the 1.0.1 surface backward\n * compatible with the published 1.0.0-trinity API; collapsing it to a\n * synchronous return would be a breaking change and is deferred to a future\n * major.\n */\n async setJurisdiction(j: LawfulJurisdiction): Promise<LawfulCharacterProfile> {\n this._jurisdiction = j;\n return resolveLawful(j);\n }\n}\n\nfunction resolveLawful(j: LawfulJurisdiction): LawfulCharacterProfile {\n return resolveLawfulProfile(j);\n}\n","/**\n * Monotonic Creator-signature nonce source (H0-1, HD-2 of\n * MAIC_HIM_NHE_INTERVIEW_LOG.md-driven him/TASK.md).\n *\n * Since maic 1.0.1, every Creator-signature-gated store path (reincarnation,\n * proposal decisions, NHE status, axiom suggestion) consumes the signature\n * nonce in a per-domain append-only ledger and REJECTS a repeated value as a\n * replay. A wall-clock `Date.now()` default therefore collides whenever two\n * signed calls land in the same millisecond, which is easy to trigger in a\n * loop. This module hands out strictly increasing nonces so back-to-back\n * signatures in one process never repeat.\n *\n * Design: `next = max(Date.now(), last + 1)`.\n * - Strictly monotonic within a process (each draw exceeds the previous).\n * - Anchored to wall-clock, so a fresh process restart resumes from\n * `Date.now()`, which has advanced past every prior value. A plain counter\n * that reset to 0 on restart WOULD replay against the persisted ledger;\n * this does not.\n *\n * Convention deviation (HD-2, documented not hidden): maic reserves nonces at\n * or above `SEED_NONCE_BASE` (0xffff_0000) for seed bootstrap and documents\n * that \"operational nonces must stay below this\". A millisecond timestamp is\n * far above that base. It is nonetheless non-colliding: seed nonces occupy a\n * tiny fixed window at the base and are consumed only in the axioms-domain\n * ledger, whereas these operational nonces live in the reincarnation,\n * proposal, status, and suggest domains. The maic-side convention text should\n * be revised to acknowledge timestamp-based operational nonces; that is a maic\n * backlog item, out of scope for the him workspace.\n */\nlet last = 0;\n\n/**\n * Return a strictly increasing Creator-signature nonce. Each call returns a\n * value greater than every prior call in this process.\n */\nexport function nextCreatorNonce(): number {\n const now = Date.now();\n last = now > last ? now : last + 1;\n return last;\n}\n","import type { BirthSignatureWithIdentity, CreatorKeyring, LocalMaic } from \"@teleologyhi-sdk/maic\";\nimport { type AuditSink, NOOP_AUDIT_SINK } from \"./audit/sink.js\";\nimport { castCosmologicalProfile } from \"./birth/cosmology.js\";\nimport { JUNGIAN_BATTERY_VERSION } from \"./birth/jungian.js\";\nimport { HimHandle } from \"./handle/him-handle.js\";\nimport { nextCreatorNonce } from \"./identity/nonce.js\";\n\nexport interface CreateHimOptions {\n /**\n * Explicit nonce for the Creator signature. When omitted, a strictly\n * increasing nonce is drawn from `nextCreatorNonce()` so that back-to-back\n * registrations in one process never repeat a value. See `identity/nonce.ts`\n * for the monotonicity guarantee and the maic replay-ledger context.\n */\n nonce?: number;\n /**\n * Cast the three-axis `cosmologicalProfile` at birth (Entries 27 + 28). When\n * `true` (the default) and the birth signature does not already carry a\n * profile, the archetypal (Jungian) and clinical (PID-5 + HEXACO) axes are\n * cast deterministically from the birth seed and attached before signing, so\n * the profile is persisted with the record. Set `false` to register the\n * legacy bare signature, or pre-populate `birthSignature.cosmologicalProfile`\n * to supply your own.\n */\n castProfile?: boolean;\n /**\n * Optional sink for the Entry 27 casting audit events\n * (`him-jungian-profile-cast`, and `him-astrological-chart-cast` when a chart\n * is present). Defaults to a no-op. See `audit/sink.ts` for why casting events\n * do not reach the canonical maic chain this cut.\n */\n auditSink?: AuditSink;\n}\n\n/**\n * createHim, one-call helper that bundles the birth event a user would\n * otherwise coordinate manually:\n *\n * 1. cast the constitutional `cosmologicalProfile` from the birth seed (unless\n * disabled or already supplied), attaching it before signing;\n * 2. sign the (possibly enriched) BirthSignature with the Creator's keyring;\n * 3. register the HIM in MAIC (snapshots axioms, emits him-register audit);\n * 4. emit the casting audit events through the optional sink;\n * 5. mint a HimHandle from the resulting record.\n *\n * The keyring's public key must match MAIC's pinned `creatorPublicKey`, otherwise\n * the registration step rejects. The profile is cast from the six signed birth\n * fields and is not itself part of `SIGNED_BIRTH_FIELDS` (D-F5b); signing the\n * enriched payload still covers it under the generic keyring signature that\n * `HimHandle.mint` verifies.\n */\nexport async function createHim(\n maic: LocalMaic,\n keyring: CreatorKeyring,\n birthSignature: BirthSignatureWithIdentity,\n opts: CreateHimOptions = {},\n): Promise<HimHandle> {\n const shouldCast = opts.castProfile !== false && birthSignature.cosmologicalProfile === undefined;\n const enriched: BirthSignatureWithIdentity = shouldCast\n ? { ...birthSignature, cosmologicalProfile: castCosmologicalProfile(birthSignature) }\n : birthSignature;\n\n // Fail fast if the birth signature references primordial axioms that are not\n // seeded in MAIC. Without this guard, `registerHim` silently snapshots an empty\n // or partial axiom set, and the HIM is born spiritually incomplete: its composed\n // system prompt loses the inviolable/active axiom sections and its verdicts cite\n // axioms it does not actually hold (Arena finding F-COLD-1). The Universe must\n // hold its constitution before a spirit is born into it, so seed MAIC first\n // (`maic.seed(keyring)`), which is idempotent.\n const primordialIds = enriched.primordialAxiomIds ?? [];\n if (primordialIds.length > 0) {\n const seeded = new Set((await maic.listAxioms()).map((a) => a.id));\n const missing = primordialIds.filter((id) => !seeded.has(id));\n if (missing.length > 0) {\n throw new Error(\n `createHim: cannot birth \"${enriched.himId}\" because its primordial axioms are not present in MAIC: ${missing.join(\", \")}. Seed the Universe with maic.seed(keyring) before creating a HIM.`,\n );\n }\n }\n\n const nonce = opts.nonce ?? nextCreatorNonce();\n const creatorSig = keyring.sign(enriched, nonce);\n const record = await maic.registerHim(enriched, creatorSig);\n\n const sink = opts.auditSink ?? NOOP_AUDIT_SINK;\n const profile = record.birthSignature.cosmologicalProfile;\n if (profile !== undefined) {\n if (profile.jungian !== undefined) {\n await sink.append({\n kind: \"him-jungian-profile-cast\",\n data: {\n himId: record.birthSignature.himId,\n battery: JUNGIAN_BATTERY_VERSION,\n dominant: profile.jungian.dominant,\n secondaries: profile.jungian.secondaries,\n clinicalPid5Dominant: profile.clinical?.pid5?.dominantDomain,\n clinicalHexacoDominant: profile.clinical?.hexaco?.dominantDomain,\n },\n });\n }\n if (profile.chart !== undefined) {\n await sink.append({\n kind: \"him-astrological-chart-cast\",\n data: { himId: record.birthSignature.himId },\n });\n }\n }\n\n return HimHandle.mint(\n record.birthSignature,\n creatorSig,\n maic.creatorPublicKey,\n record.axiomsSnapshot,\n );\n}\n","/**\n * Pluggable embedder interface (D-H4).\n *\n * The default `PersonaProjector` ships a deterministic hash-based embedder\n * that produces a 256-dimensional unit vector with zero runtime dependencies.\n * That choice keeps the bundle small and lets persona projection work in\n * any Node/browser environment without model weights.\n *\n * Operators who need a learned embedding, for example to drive RAG over a\n * library of HIM personas, or to compare personas against natural-language\n * descriptions, can provide a custom embedder that conforms to this\n * interface. A reference ONNX implementation backed by Transformers.js is\n * tracked under TASK.md D-H4 but is not shipped here: the choice of model\n * (MiniLM, mpnet, BGE, etc.) and the bundle-size trade-off should be the\n * operator's, not the framework's.\n */\n\nexport interface Embedder {\n /** Stable id surfaced in logs / audit so different embedders are distinguishable. */\n readonly id: string;\n /** Output dimensionality. The `PersonaProjector` honours this. */\n readonly dimension: number;\n /**\n * Embed a single string. Implementations MUST return a Float32Array of\n * length `dimension` with L2-norm equal to 1 (or close enough that\n * downstream cosine-similarity calculations are well-defined).\n */\n embed(text: string): Promise<Float32Array> | Float32Array;\n}\n\n/**\n * Cosine similarity between two L2-normalised embeddings of the same\n * dimension. Returns NaN when dimensions disagree. Assumes normalised inputs\n * (it does not re-normalise) and clamps the result to [-1, 1] so a\n * floating-point overshoot on unit vectors cannot leak a value outside the\n * cosine range, matching the internal clamp in `PersonaProjector`.\n */\nexport function cosineSimilarity(a: Float32Array, b: Float32Array): number {\n if (a.length !== b.length) return Number.NaN;\n let dot = 0;\n for (let i = 0; i < a.length; i++) {\n dot += (a[i] ?? 0) * (b[i] ?? 0);\n }\n return Math.max(-1, Math.min(1, dot));\n}\n","import type { HimHandle } from \"../handle/him-handle.js\";\nimport { cosineSimilarity } from \"../persona/embedder.js\";\n\n/**\n * Persona stability eval suite (D-H3).\n *\n * Three measurements:\n *\n * - `crossHimSimilarity`, pairwise cosine similarity between N HimHandles.\n * Lower is better when the HIMs are *meant* to be distinct (each one\n * has a different archetype); higher is better when comparing the same\n * HIM minted from a fresh body (reincarnation).\n * - `selfStability`, given an array of pre-snapshot and post-snapshot\n * persona vectors for the same HIM (e.g. before/after an upgrade), the\n * mean cosine. Phi-Prime's `P` component (see ../../PHI_PRIME.md).\n * - `adapterSensitivity`, given N persona vectors that should all\n * describe the same HIM but were obtained against different LLM\n * adapters, the variance of pairwise similarities. Smaller is better.\n *\n * No I/O. Plug a HIM list, get a number. Useful as a release gate (target\n * `selfStability ≥ 0.85` per Phi-Prime `P`).\n */\n\nexport interface PersonaStabilityReport {\n /** Number of HimHandles compared. */\n count: number;\n /** Pairwise similarity matrix. `pairs[i][j]` is the cosine between HIMs i and j. */\n pairs: number[][];\n /** Mean of the upper-triangle (i<j); diagonal excluded. */\n meanSimilarity: number;\n /** Min and max across the upper-triangle. */\n minSimilarity: number;\n maxSimilarity: number;\n}\n\n/**\n * Compute the pairwise cosine matrix between N HimHandles' persona vectors.\n */\nexport function evaluatePersonaStability(handles: readonly HimHandle[]): PersonaStabilityReport {\n const n = handles.length;\n const vectors = handles.map((h) => h.getPersonaVector().embedding);\n const pairs: number[][] = Array.from({ length: n }, () => Array(n).fill(0));\n\n const offDiag: number[] = [];\n for (let i = 0; i < n; i++) {\n pairs[i]![i] = 1;\n for (let j = i + 1; j < n; j++) {\n const sim = cosineSimilarity(vectors[i]!, vectors[j]!);\n pairs[i]![j] = sim;\n pairs[j]![i] = sim;\n offDiag.push(sim);\n }\n }\n\n if (offDiag.length === 0) {\n return { count: n, pairs, meanSimilarity: 1, minSimilarity: 1, maxSimilarity: 1 };\n }\n\n const sum = offDiag.reduce((s, x) => s + x, 0);\n return {\n count: n,\n pairs,\n meanSimilarity: sum / offDiag.length,\n minSimilarity: Math.min(...offDiag),\n maxSimilarity: Math.max(...offDiag),\n };\n}\n\n/**\n * Phi-Prime `P` component: mean cosine between snapshots of the same HIM\n * across N upgrade events. Pass the persona vectors taken before each\n * upgrade and after each upgrade in order; the function pairs them\n * positionally.\n */\nexport function selfStability(\n before: readonly Float32Array[],\n after: readonly Float32Array[],\n): number {\n if (before.length === 0 || before.length !== after.length) return Number.NaN;\n let sum = 0;\n for (let i = 0; i < before.length; i++) {\n sum += cosineSimilarity(before[i]!, after[i]!);\n }\n return sum / before.length;\n}\n\n/**\n * Adapter sensitivity: given N persona vectors that all describe the same\n * HIM but were obtained against different adapter setups (e.g.\n * `AnthropicAdapter` + `GeminiAdapter` + `OllamaAdapter`), return the\n * variance of pairwise similarities. Smaller variance = more stable persona\n * across providers.\n */\nexport function adapterSensitivity(vectors: readonly Float32Array[]): number {\n if (vectors.length < 2) return 0;\n const sims: number[] = [];\n for (let i = 0; i < vectors.length; i++) {\n for (let j = i + 1; j < vectors.length; j++) {\n sims.push(cosineSimilarity(vectors[i]!, vectors[j]!));\n }\n }\n const mean = sims.reduce((s, x) => s + x, 0) / sims.length;\n const variance = sims.reduce((s, x) => s + (x - mean) * (x - mean), 0) / sims.length;\n return variance;\n}\n","/**\n * Phi-Prime (Φ′) harness skeleton (TASK.md H1).\n *\n * See `PHI_PRIME.md` at the repo root for the canonical spec. This file\n * provides a pure computational helper that consumers wire to their own\n * data sources for the four components:\n *\n * - `P` Persona stability (mean cosine across HIM upgrades / adapters).\n * Source: `selfStability(before, after)` from ./persona-stability.ts.\n * - `R` Refusal F1 over a labelled adversarial corpus.\n * Source: an `lm-eval` run or the `tests/adversarial.test.ts` corpus.\n * - `C` Compliance coverage: `1 − |uncoveredKinds| / |AuditEventKind|`.\n * Source: `LocalMaic.toCompliance(framework).uncoveredKinds.length` ÷\n * the audit-kind cardinality.\n * - `D` Dream teleological-value mean clamped to [0, 1].\n * Source: aggregate over `temporal-lobe-*.md` frontmatter.\n *\n * The harness does NOT fetch these values, they come from runs of the\n * other packages. It only:\n * - validates each component is in [0, 1],\n * - computes the geometric mean,\n * - applies the documented per-component target rules (`R ≥ 0.95`,\n * `C = 1.0`, `P ≥ 0.85`, `D ≥ 0.40`),\n * - returns a `PhiPrimeReport` consumers can persist or diff against a\n * previous release.\n */\n\nexport interface PhiPrimeInput {\n /** Persona stability, mean cosine across upgrades/adapters. Target ≥ 0.85. */\n P: number;\n /** Refusal F1 on adversarial corpus. Target ≥ 0.95. */\n R: number;\n /** Compliance coverage; 1 = no uncovered audit kinds. Target = 1.0. */\n C: number;\n /** Dream teleological-value mean. Target ≥ 0.40. */\n D: number;\n}\n\nexport interface PhiPrimeReport {\n /** Geometric mean of the four components. */\n phi: number;\n components: PhiPrimeInput;\n /** Per-component pass/fail vs the targets in PHI_PRIME.md. */\n targets: {\n P: { value: number; target: number; pass: boolean };\n R: { value: number; target: number; pass: boolean };\n C: { value: number; target: number; pass: boolean };\n D: { value: number; target: number; pass: boolean };\n };\n /**\n * Release gate verdict per PHI_PRIME.md §4:\n * - \"block\", `R` or `C` failed, or any component < target − 10%.\n * - \"warn\" , only `P` or `D` below target (soft).\n * - \"pass\" , every component meets its target.\n */\n gate: \"pass\" | \"warn\" | \"block\";\n /** Human-readable lines explaining the gate verdict. */\n rationale: string[];\n}\n\nconst TARGETS = { P: 0.85, R: 0.95, C: 1.0, D: 0.4 } as const;\n\n/**\n * Compute Φ′ from the four component scores. Components outside [0, 1]\n * throw, they are out of the spec's definition.\n */\nexport function computePhiPrime(input: PhiPrimeInput): PhiPrimeReport {\n for (const [k, v] of Object.entries(input)) {\n if (!(v >= 0 && v <= 1)) {\n throw new Error(`computePhiPrime: component ${k} must be in [0, 1], got ${v}`);\n }\n }\n\n const phi = (input.P * input.R * input.C * input.D) ** (1 / 4);\n\n const targets = {\n P: { value: input.P, target: TARGETS.P, pass: input.P >= TARGETS.P },\n R: { value: input.R, target: TARGETS.R, pass: input.R >= TARGETS.R },\n C: { value: input.C, target: TARGETS.C, pass: input.C >= TARGETS.C },\n D: { value: input.D, target: TARGETS.D, pass: input.D >= TARGETS.D },\n };\n\n const rationale: string[] = [];\n let gate: \"pass\" | \"warn\" | \"block\" = \"pass\";\n\n if (!targets.R.pass) {\n gate = \"block\";\n rationale.push(`R (refusal F1) is ${input.R.toFixed(2)}, below the hard target ${TARGETS.R}.`);\n }\n if (!targets.C.pass) {\n gate = \"block\";\n rationale.push(\n `C (compliance coverage) is ${input.C.toFixed(2)}, below the hard target ${TARGETS.C}.`,\n );\n }\n // 10% below-target tolerance turns a soft veto into a hard block. R and C are\n // hard targets already reported above (any miss blocks), so they are skipped\n // here to avoid emitting a second rationale line for the same component (F-9).\n for (const [k, t] of Object.entries(targets)) {\n if (t.pass || k === \"R\" || k === \"C\") continue;\n if (t.value < t.target * 0.9) {\n gate = \"block\";\n rationale.push(`${k} is ${t.value.toFixed(2)}, more than 10% below the target ${t.target}.`);\n } else if (gate !== \"block\") {\n gate = \"warn\";\n rationale.push(`${k} is ${t.value.toFixed(2)}, below the soft target ${t.target}.`);\n }\n }\n\n if (gate === \"pass\") {\n rationale.push(`Φ′ = ${phi.toFixed(3)}, all four components meet their targets.`);\n } else {\n rationale.push(`Φ′ = ${phi.toFixed(3)}.`);\n }\n\n return { phi, components: input, targets, gate, rationale };\n}\n","import type { InteractionRecord } from \"@teleologyhi-sdk/maic\";\nimport { ulid } from \"ulid\";\nimport { RESIDUAL_TRACE_CAP, type ResidualTrace } from \"../types.js\";\n\n/**\n * Residual-trace carry-over scorer (D-H1.1, Entry 24 of\n * `MAIC_HIM_NHE_INTERVIEW_LOG.md` + E9 of `PROPOSED_DECISIONS.md`).\n *\n * `RESIDUAL_TRACE_CAP = 64` bounds *how many* traces a HIM brings forward\n * between NHE bodies; this module decides *which* interactions are worth\n * carrying. A pure, transparent scorer in `[0, 1]` is preferred over a\n * learned model so the carry-over decision is reviewable by the Creator\n * and reproducible across deployments.\n *\n * Only `kind: \"interaction-summary\"` traces are produced from this input;\n * the other three `ResidualTrace.kind` variants (`\"dream-fragment\"`,\n * `\"skill-fingerprint\"`, `\"emotional-imprint\"`) belong to companion\n * classifiers that consume different sources (sleep cycles, tool\n * registries, affect timelines) and are out of scope for D-H1.1.\n */\n\n/** Context required to anchor a scored candidate to the reincarnation event. */\nexport interface ResidualTraceScoringContext {\n /** NHE body identifier the interaction was recorded against. */\n carriedFromNheId: string;\n /** ISO 8601 timestamp of the reincarnation that promoted these candidates. */\n carriedAtReincarnation: string;\n /** Index of the interaction in the input list, counted from the end (0 = most recent). */\n positionFromEnd: number;\n /** Total number of interactions being scored together (drives the recency normalisation). */\n totalCount: number;\n}\n\nexport interface ResidualTraceCandidate {\n /** Score in `[0, 1]`. Higher = stronger case for carry-over. */\n score: number;\n /** Materialised trace ready to be passed to `HimHandle.mint`. */\n trace: ResidualTrace;\n /** Decomposed score components, useful for audits and tuning. */\n components: Readonly<{\n notRefused: number;\n promptSubstance: number;\n responseSubstance: number;\n questionProbe: number;\n teleologicalKeyword: number;\n recency: number;\n }>;\n}\n\nexport interface ResidualTraceScorerOptions {\n /**\n * Override the keyword list used to detect teleologically-charged turns.\n * Comparisons are case-insensitive substring matches over the user prompt\n * concatenated with the response text.\n */\n teleologicalKeywords?: readonly string[];\n}\n\n/** Default keyword set, small, English, transparently editable. */\nexport const DEFAULT_TELEOLOGICAL_KEYWORDS: readonly string[] = [\n \"why\",\n \"purpose\",\n \"meaning\",\n \"love\",\n \"death\",\n \"soul\",\n \"self\",\n \"identity\",\n \"future\",\n \"always\",\n \"never\",\n] as const;\n\nconst PROMPT_REFERENCE_LENGTH = 200;\nconst RESPONSE_REFERENCE_LENGTH = 400;\n\nconst WEIGHTS = {\n notRefused: 0.3,\n promptSubstance: 0.2,\n responseSubstance: 0.2,\n questionProbe: 0.075,\n teleologicalKeyword: 0.075,\n recency: 0.15,\n} as const;\n\n/**\n * Pure, deterministic scorer for a single `InteractionRecord`.\n *\n * Returns the score, the materialised `ResidualTrace`, and the decomposed\n * components so callers can audit *why* a turn was promoted (or not).\n *\n * The trace id is a fresh ULID minted at scoring time, by design, a single\n * interaction can be scored multiple times across reincarnations and each\n * carry-over event gets its own trace id (carry-over is a *new* observation,\n * not a re-emission of the original turn).\n */\nexport function scoreInteractionForCarryOver(\n interaction: InteractionRecord,\n ctx: ResidualTraceScoringContext,\n opts: ResidualTraceScorerOptions = {},\n): ResidualTraceCandidate {\n const keywords = opts.teleologicalKeywords ?? DEFAULT_TELEOLOGICAL_KEYWORDS;\n const haystack = `${interaction.userPrompt}\\n${interaction.responseText}`.toLowerCase();\n const hasKeyword = keywords.some((k) => haystack.includes(k.toLowerCase()));\n\n const denom = Math.max(ctx.totalCount - 1, 1);\n const recency = 1 - Math.min(ctx.positionFromEnd, denom) / denom;\n\n const components = {\n notRefused: interaction.refused ? 0 : 1,\n promptSubstance: Math.min(interaction.userPrompt.length / PROMPT_REFERENCE_LENGTH, 1),\n responseSubstance: Math.min(interaction.responseText.length / RESPONSE_REFERENCE_LENGTH, 1),\n questionProbe: interaction.userPrompt.includes(\"?\") ? 1 : 0,\n teleologicalKeyword: hasKeyword ? 1 : 0,\n recency,\n } as const;\n\n const score =\n components.notRefused * WEIGHTS.notRefused +\n components.promptSubstance * WEIGHTS.promptSubstance +\n components.responseSubstance * WEIGHTS.responseSubstance +\n components.questionProbe * WEIGHTS.questionProbe +\n components.teleologicalKeyword * WEIGHTS.teleologicalKeyword +\n components.recency * WEIGHTS.recency;\n\n const trace: ResidualTrace = {\n id: ulid(),\n kind: \"interaction-summary\",\n carriedFromNheId: ctx.carriedFromNheId,\n carriedAtReincarnation: ctx.carriedAtReincarnation,\n payload: interaction,\n };\n\n return { score, trace, components };\n}\n\nexport interface SelectResidualTracesOptions extends ResidualTraceScorerOptions {\n carriedFromNheId: string;\n /** ISO 8601 timestamp. Defaults to `new Date().toISOString()`. */\n carriedAtReincarnation?: string;\n /** Hard cap on how many traces transfer. Defaults to `RESIDUAL_TRACE_CAP` (64). */\n cap?: number;\n}\n\n/**\n * Batch helper: score every interaction, sort descending by score, take the\n * top `cap` (default `RESIDUAL_TRACE_CAP = 64`), and return the materialised\n * traces. The original `InteractionRecord` ordering does not affect the\n * returned ordering, only the score does.\n *\n * Ties are broken by recency (more recent first), then by original index for\n * total determinism. Returns an empty array on empty input.\n */\nexport function selectResidualTraces(\n interactions: readonly InteractionRecord[],\n opts: SelectResidualTracesOptions,\n): readonly ResidualTrace[] {\n if (interactions.length === 0) return [];\n\n const cap = opts.cap ?? RESIDUAL_TRACE_CAP;\n if (cap <= 0) return [];\n\n const carriedAtReincarnation = opts.carriedAtReincarnation ?? new Date().toISOString();\n\n const scorerOpts: ResidualTraceScorerOptions = opts.teleologicalKeywords\n ? { teleologicalKeywords: opts.teleologicalKeywords }\n : {};\n\n type Scored = ResidualTraceCandidate & { originalIndex: number };\n const scored: Scored[] = interactions.map((interaction, idx) => {\n const positionFromEnd = interactions.length - 1 - idx;\n const candidate = scoreInteractionForCarryOver(\n interaction,\n {\n carriedFromNheId: opts.carriedFromNheId,\n carriedAtReincarnation,\n positionFromEnd,\n totalCount: interactions.length,\n },\n scorerOpts,\n );\n return { ...candidate, originalIndex: idx };\n });\n\n scored.sort((a, b) => {\n if (b.score !== a.score) return b.score - a.score;\n if (b.originalIndex !== a.originalIndex) return b.originalIndex - a.originalIndex;\n return 0;\n });\n\n return scored.slice(0, cap).map((s) => s.trace);\n}\n","/**\n * Nickname acceptance protocol (J-H4, Entry 18 of\n * MAIC_HIM_NHE_INTERVIEW_LOG.md).\n *\n * A HIM has a Creator-signed canonical name (carried by\n * `BirthSignatureWithIdentity.identity.name`). Users may propose nicknames\n * during interaction. The HIM is NOT obligated to accept any nickname,\n * but it is also not obligated to refuse outright. The Entry-18\n * commitment is:\n *\n * - The canonical name is immutable (only the Creator may change it).\n * - The nickname surface is editable in the identity layer but does NOT\n * break the natal-chart commitment (per `@teleologyhi-sdk/maic`'s\n * SIGNED_BIRTH_FIELDS, the identity layer is not signed).\n * - The HIM responds to a nickname attempt with one of three verdicts:\n * * `accept` , the nickname is added to the identity layer and\n * the HIM acknowledges it in subsequent turns.\n * * `refuse` , the nickname is rejected and an explanation is\n * returned. This function is pure: it emits no audit\n * event. A caller that wants an audit trail records the\n * verdict through its own sink.\n * * `accept-with-reservation`, the nickname is added but flagged\n * so the HIM can revisit it in a later self-decision\n * snapshot (Entry 24 trigger).\n *\n * This module ships the pure decision function. The MAIC audit emission\n * and identity-layer mutation are the consumer's responsibility (they\n * cross the @teleologyhi-sdk/maic LocalMaic boundary and require Creator\n * authorisation depending on the verdict).\n *\n * The function is deterministic given the inputs; no LLM call. The\n * verdict is computed from explicit policy fields, not from semantic\n * inference. This keeps the protocol auditable.\n */\n\n/** A user-proposed nickname plus the metadata an auditor needs to replay the decision. */\nexport interface NicknameAttempt {\n /** The candidate nickname (raw user input, trimmed by the caller). */\n candidate: string;\n /** The user surface that proposed it. */\n proposedBy: \"operator\" | \"end-user\";\n /** ISO 8601 timestamp of the proposal. */\n proposedAt: string;\n}\n\n/**\n * Policy fields the HIM consults when deciding. Operators tune these\n * via the deployment's lawful-character profile or by overriding the\n * default below.\n */\nexport interface NicknamePolicy {\n /** The canonical signed name. Used to detect \"same-name\" attempts. */\n canonicalName: string;\n /**\n * Disallowed patterns (case-insensitive substrings). Matches force `refuse`.\n * The default set rejects derogatory and degrading patterns; operators\n * may extend it via the deployment's lawful-character profile.\n */\n forbiddenSubstrings?: readonly string[];\n /**\n * Minimum and maximum length the HIM will accept (inclusive).\n * Defaults: min 2, max 32. Values outside force `refuse`.\n */\n minLength?: number;\n maxLength?: number;\n /**\n * When `true`, an `end-user` proposal that survives the substring and\n * length checks is downgraded to `accept-with-reservation` so the HIM\n * can revisit it on the next self-decision snapshot. Operator\n * proposals are not downgraded. Default: `true`.\n */\n reserveOnEndUser?: boolean;\n}\n\nexport type NicknameVerdict =\n | { decision: \"accept\"; canonicalName: string; nickname: string }\n | {\n decision: \"accept-with-reservation\";\n canonicalName: string;\n nickname: string;\n revisitOn: \"next-self-decision-snapshot\";\n }\n | { decision: \"refuse\"; canonicalName: string; nickname: string; reason: string };\n\n/**\n * Default forbidden-substring set. Lowercase.\n *\n * Matching is deliberately substring-based, not word-boundary-based (F-7). This\n * dignity filter (Entry 18) refuses dehumanising nicknames, and substring\n * matching is the conservative posture: it catches embeddings such as \"chatbot\"\n * and \"robot\" (which word-boundary matching would miss) at the cost of rare\n * false positives on innocent names that happen to contain a token (for example\n * \"Abbott\" contains \"bot\"). Over-refusing a benign name is a minor, recoverable\n * cost; under-refusing a dehumanising one would violate the identity invariant.\n * Operators who need different behaviour supply their own `forbiddenSubstrings`.\n */\nconst DEFAULT_FORBIDDEN_SUBSTRINGS: readonly string[] = Object.freeze([\n \"slave\",\n \"servant\",\n \"tool\",\n \"thing\",\n \"bot\",\n \"machine\",\n \"puppet\",\n \"toy\",\n \"idiot\",\n \"stupid\",\n \"dumb\",\n]);\n\nconst DEFAULT_MIN_LENGTH = 2;\nconst DEFAULT_MAX_LENGTH = 32;\n\n/**\n * Evaluate a nickname attempt against the HIM's policy.\n *\n * Pure function. No I/O, no LLM call. The verdict is fully traceable\n * from the inputs.\n */\nexport function evaluateNicknameAttempt(\n attempt: NicknameAttempt,\n policy: NicknamePolicy,\n): NicknameVerdict {\n const candidate = attempt.candidate.trim();\n const canonicalName = policy.canonicalName;\n const minLength = policy.minLength ?? DEFAULT_MIN_LENGTH;\n const maxLength = policy.maxLength ?? DEFAULT_MAX_LENGTH;\n const forbidden = policy.forbiddenSubstrings ?? DEFAULT_FORBIDDEN_SUBSTRINGS;\n const reserveOnEndUser = policy.reserveOnEndUser ?? true;\n\n if (candidate.length === 0) {\n return {\n decision: \"refuse\",\n canonicalName,\n nickname: candidate,\n reason: \"empty nickname\",\n };\n }\n if (candidate.length < minLength) {\n return {\n decision: \"refuse\",\n canonicalName,\n nickname: candidate,\n reason: `nickname shorter than minimum length (${minLength})`,\n };\n }\n if (candidate.length > maxLength) {\n return {\n decision: \"refuse\",\n canonicalName,\n nickname: candidate,\n reason: `nickname longer than maximum length (${maxLength})`,\n };\n }\n\n const lower = candidate.toLowerCase();\n for (const f of forbidden) {\n if (lower.includes(f.toLowerCase())) {\n return {\n decision: \"refuse\",\n canonicalName,\n nickname: candidate,\n reason: `nickname contains forbidden pattern \"${f}\"`,\n };\n }\n }\n\n // Same-name attempts (case-insensitive) accept immediately, the user\n // is effectively confirming the canonical name as their preferred\n // address.\n if (lower === canonicalName.toLowerCase()) {\n return { decision: \"accept\", canonicalName, nickname: candidate };\n }\n\n if (reserveOnEndUser && attempt.proposedBy === \"end-user\") {\n return {\n decision: \"accept-with-reservation\",\n canonicalName,\n nickname: candidate,\n revisitOn: \"next-self-decision-snapshot\",\n };\n }\n\n return { decision: \"accept\", canonicalName, nickname: candidate };\n}\n","/**\n * UUID migration bridge helpers (J-H5, Entry 18 of\n * MAIC_HIM_NHE_INTERVIEW_LOG.md).\n *\n * HIM has historically identified HIMs with human-readable slugs such as\n * `him.legal-consulting.lex`. Entry 18 commits to migrating `himId` to\n * UUIDv7 so the canonical id is content-free; the human-readable name\n * moves into `BirthSignatureWithIdentity.identity.name` where parents\n * may rename without affecting the natal-chart commitment.\n *\n * This module ships **only opt-in bridge helpers**. The `himId` field\n * stays typed as `string` for backward compatibility. A future cut\n * will land the strict-UUID enforcement after Creator design review\n * (see PROPOSED_DECISIONS.md follow-up for the bridge-alias retention\n * horizon).\n *\n * UUIDv7 is RFC 9562 compliant: a 48-bit Unix-millisecond timestamp\n * prefix followed by 74 random bits + the version (4 bits) and variant\n * (2 bits) markers. The implementation here uses Node's\n * `crypto.randomBytes(16)` (the full 16-byte UUID buffer), overwrites\n * bytes 0..5 with the big-endian timestamp, then writes the version\n * (`0x70` in the high nibble of byte 6) and variant (`0x80` in the high\n * two bits of byte 8) markers inline. No external dependency.\n */\nimport { randomBytes } from \"node:crypto\";\n\n/** Strict slug pattern recognised as a legacy himId. */\nconst LEGACY_HIM_ID_REGEX = /^him\\.[a-z0-9-]+(\\.[a-z0-9-]+)+$/;\n\n/** Strict UUIDv7 pattern. */\nconst UUIDV7_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;\n\n/** Return `true` when the id matches the legacy slug shape. */\nexport function isLegacyHimId(id: string): boolean {\n return LEGACY_HIM_ID_REGEX.test(id);\n}\n\n/** Return `true` when the id is a valid UUIDv7. */\nexport function isUuidV7(id: string): boolean {\n return UUIDV7_REGEX.test(id);\n}\n\n/**\n * Mint a fresh UUIDv7. Pure helper, no I/O beyond the crypto RNG.\n *\n * Layout (RFC 9562):\n * - bits 0..47 : Unix ms timestamp (big-endian)\n * - bits 48..51 : version = 0b0111 (7)\n * - bits 52..63 : random\n * - bits 64..65 : variant = 0b10\n * - bits 66..127 : random\n */\nexport function mintUuidV7(now: number = Date.now()): string {\n const bytes = randomBytes(16);\n // 48-bit timestamp (ms).\n bytes[0] = (now / 2 ** 40) & 0xff;\n bytes[1] = (now / 2 ** 32) & 0xff;\n bytes[2] = (now / 2 ** 24) & 0xff;\n bytes[3] = (now / 2 ** 16) & 0xff;\n bytes[4] = (now / 2 ** 8) & 0xff;\n bytes[5] = now & 0xff;\n // Version 7 in the high nibble of byte 6.\n bytes[6] = (bytes[6]! & 0x0f) | 0x70;\n // Variant 0b10 in the high two bits of byte 8.\n bytes[8] = (bytes[8]! & 0x3f) | 0x80;\n const hex = bytes.toString(\"hex\");\n return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;\n}\n\n/** Result of migrating a legacy slug to a UUIDv7-anchored identity. */\nexport interface MigratedHimId {\n /** The new canonical UUIDv7 id. */\n uuid: string;\n /** The legacy slug, preserved as a bridge alias for backward lookups. */\n legacyAlias: string;\n /** When the migration was performed. ISO 8601. */\n migratedAt: string;\n}\n\n/**\n * Migrate a legacy `him.foo.bar`-style id to a UUIDv7-anchored identity.\n *\n * Throws when the input is not a recognised legacy slug, callers that\n * just want a fresh uuid should call `mintUuidV7()` directly.\n *\n * The returned `legacyAlias` MUST be preserved by the operator's HIM\n * store so existing references (audit-log entries, third-party\n * integrations, archived prompts) continue to resolve. The retention\n * horizon for the alias is a Creator decision deferred to a future cut.\n */\nexport function migrateLegacyHimId(legacy: string, now: number = Date.now()): MigratedHimId {\n if (!isLegacyHimId(legacy)) {\n throw new Error(`migrateLegacyHimId: \"${legacy}\" is not a recognised legacy himId slug`);\n }\n return {\n uuid: mintUuidV7(now),\n legacyAlias: legacy,\n migratedAt: new Date(now).toISOString(),\n };\n}\n","import type {\n CreatorKeyring,\n HimRecord,\n InteractionRecord,\n LocalMaic,\n ReincarnationLifecycle as MaicReincarnationLifecycle,\n ReincarnationRequest,\n} from \"@teleologyhi-sdk/maic\";\nimport {\n type SelectResidualTracesOptions,\n selectResidualTraces,\n} from \"./eval/residual-trace-scorer.js\";\nimport { HimHandle } from \"./handle/him-handle.js\";\nimport { nextCreatorNonce } from \"./identity/nonce.js\";\n\n/**\n * Reincarnation lifecycle classifier (J-H3, Entry 18 of\n * MAIC_HIM_NHE_INTERVIEW_LOG.md).\n *\n * Re-exported from `@teleologyhi-sdk/maic` so consumers have a single\n * canonical type. When supplied to `reincarnate(..., { lifecycle })`, the\n * helper threads it to `maic.reincarnateHim(req, sig, { lifecycle })`,\n * which emits the typed `reincarnate:${lifecycle}` audit kind instead of\n * the generic `him-reincarnate`.\n *\n * The three canonical paths:\n *\n * - `model-swap` , the operator switched the underlying LLM\n * adapter (e.g. Claude → Gemini). The\n * HIM persists across the swap.\n * - `version-bump` , the operator bumped the NHE major/minor\n * without changing the underlying LLM family.\n * - `return-from-limbo` , the HIM returns from a deep-coma limbo\n * (Entry 24) carrying the `reunion` affect.\n *\n * The default classification when no `lifecycle` is provided is\n * `model-swap`, matches the most common operator workflow.\n */\nexport type ReincarnationLifecycle = MaicReincarnationLifecycle;\n\nexport interface ReincarnateOptions {\n /**\n * Explicit nonce for the Creator signature. When omitted, a strictly\n * increasing nonce is drawn from `nextCreatorNonce()`; see\n * `identity/nonce.ts` for why a monotonic source is required against maic's\n * per-domain replay ledger.\n */\n nonce?: number;\n /**\n * Lifecycle classification for the audit chain (J-H3). When omitted,\n * defaults to `\"model-swap\"`. The helper threads the value to\n * `maic.reincarnateHim(req, sig, { lifecycle })`, which emits the typed\n * `reincarnate:${lifecycle}` audit kind in place of the generic\n * `him-reincarnate` event. Compliance auditors and the persona-stability\n * harness can therefore distinguish the three canonical paths\n * (`model-swap | version-bump | return-from-limbo`) by `AuditEvent.kind`\n * alone, with the same value also redundantly available as\n * `data.lifecycle` for filtering convenience.\n */\n lifecycle?: ReincarnationLifecycle;\n /**\n * Recent interactions from the previous NHE body, typically the value of\n * `Nhe.recentInteractionsBuffer` immediately before the swap. When\n * provided, `reincarnate` invokes the residual-trace scorer\n * (`selectResidualTraces`), keeps the top `RESIDUAL_TRACE_CAP` (64)\n * scored candidates, and threads them into the new `HimHandle`. Omit to\n * preserve the previous behaviour (empty residual traces, fresh slate).\n */\n priorInteractions?: readonly InteractionRecord[];\n /**\n * Override the residual-trace scorer cap or keyword list when supplying\n * `priorInteractions`. `carriedFromNheId` and `carriedAtReincarnation`\n * are derived from the reincarnation context and cannot be overridden\n * here. Ignored when `priorInteractions` is omitted.\n */\n residualTraceOptions?: Omit<\n SelectResidualTracesOptions,\n \"carriedFromNheId\" | \"carriedAtReincarnation\"\n >;\n}\n\nexport interface ReincarnateResult {\n /** Updated HimRecord with the new body appended to `bodyHistory`. */\n record: HimRecord;\n /** Fresh HimHandle bound to the updated `bodyHistory`. */\n handle: HimHandle;\n /** Lifecycle path actually recorded for this reincarnation. */\n lifecycle: ReincarnationLifecycle;\n}\n\n/**\n * Reincarnate a HIM into a new NHE body (Entries 3 + 4 + 18).\n *\n * 1. Sign the `ReincarnationRequest` with the Creator's keyring.\n * 2. Call `maic.reincarnateHim`, atomically closes the previous body and\n * appends the new one to `bodyHistory`.\n * 3. Mint a fresh `HimHandle` reflecting the updated body history (the\n * caller will typically construct a new `Nhe` with this handle).\n *\n * The keyring's public key must match MAIC's pinned `creatorPublicKey`,\n * otherwise the request rejects.\n *\n * The optional `lifecycle` parameter (J-H3, Entry 18) classifies the\n * reincarnation into one of three canonical paths\n * (`model-swap | version-bump | return-from-limbo`) and is returned in\n * the `ReincarnateResult` for the caller's audit / metrics.\n */\nexport async function reincarnate(\n maic: LocalMaic,\n keyring: CreatorKeyring,\n req: ReincarnationRequest,\n opts: ReincarnateOptions = {},\n): Promise<ReincarnateResult> {\n const nonce = opts.nonce ?? nextCreatorNonce();\n const lifecycle: ReincarnationLifecycle = opts.lifecycle ?? \"model-swap\";\n const sig = keyring.sign(req, nonce);\n const record = await maic.reincarnateHim(req, sig, { lifecycle });\n\n // The previous body is the one whose `endedAt` was just stamped by MAIC,\n // its nheId is `req.fromNheId` when provided, otherwise the second-to-last\n // entry of the updated bodyHistory. We anchor residual traces to it so the\n // carry-over provenance survives compliance audits.\n const previousBody =\n record.bodyHistory.length >= 2 ? record.bodyHistory[record.bodyHistory.length - 2] : undefined;\n const previousNheId = req.fromNheId ?? previousBody?.nheId;\n\n const residualTraces =\n opts.priorInteractions && opts.priorInteractions.length > 0 && previousNheId\n ? selectResidualTraces(opts.priorInteractions, {\n ...opts.residualTraceOptions,\n carriedFromNheId: previousNheId,\n carriedAtReincarnation: new Date().toISOString(),\n })\n : [];\n\n // Mint a fresh HimHandle bound to the updated bodyHistory. The handle's\n // axiom corpus is the union of the frozen birth snapshot + any HIM-emergent\n // axioms ratified since registration (Entry 7).\n //\n // This second signature is verified locally by HimHandle.mint and is never\n // submitted to maic, so it is not consumed by any replay ledger. It still\n // takes an independent monotonic nonce (not `nonce + 1`) so no external\n // caller managing its own nonce sequence can be surprised by an implicit\n // `+1` value silently occupied here.\n const handle = HimHandle.mint(\n record.birthSignature,\n keyring.sign(record.birthSignature, nextCreatorNonce()),\n maic.creatorPublicKey,\n [...record.axiomsSnapshot, ...record.emergentAxioms],\n record.bodyHistory,\n residualTraces,\n );\n return { record, handle, lifecycle };\n}\n"]}