@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.
- package/CHANGELOG.md +46 -1
- package/NOTICE +22 -2
- package/README.md +89 -45
- package/SPEC.md +55 -52
- package/TRADEMARK.md +2 -2
- package/dist/index.cjs +2928 -407
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +509 -219
- package/dist/index.d.ts +509 -219
- package/dist/index.js +2895 -410
- package/dist/index.js.map +1 -1
- package/package.json +13 -7
package/dist/index.d.cts
CHANGED
|
@@ -1,9 +1,60 @@
|
|
|
1
|
+
import { ArchetypeModifier, NatalChart, IdentityLayer, BirthSignature, BirthSignatureWithIdentity, ClinicalProfile, CosmologicalProfile, JungianProfile, JungianArchetype, CreatorSignature, Axiom, LocalMaic, EmergentAxiomProposal, AxiomEvolutionResult, ProjectKernelOptions, OntologicalKernel, CreatorKeyring, InteractionRecord, ReincarnationLifecycle as ReincarnationLifecycle$1, HimRecord, ReincarnationRequest } from '@teleologyhi-sdk/maic';
|
|
2
|
+
export { Affect, ArchetypeModifier, AstrologicalAspect, Axiom, AxiomEvolutionResult, BirthSignature, BirthSignatureWithIdentity, ClinicalInstrument, ClinicalProfile, CosmologicalProfile, EmergentAxiomProposal, IdentityLayer, IdentitySnapshot, InvalidBirthSignatureError, JungianArchetype, JungianProfile, LimboReturn, LimboState, LimboTransition, META_AXIOM_ID, MemoryRecord, NatalChart, NatalChartAspect, NatalChartPosition, NatalPlanet, OntologicalKernel, ProjectKernelOptions, SIGNED_BIRTH_FIELDS, SemioticPattern, SemioticSign, SignedBirthSignature, TeleologicalOrientation, WakeAffectBias, ZodiacSign, assertBirthSignature, projectOntologicalKernel, signBirthSignature, signedBirthPayload, verifyBirthSignature } from '@teleologyhi-sdk/maic';
|
|
1
3
|
import { z } from 'zod';
|
|
2
|
-
import { ArchetypeModifier, NatalChart, IdentityLayer, BirthSignature, BirthSignatureWithIdentity, Axiom, CreatorSignature, LocalMaic, EmergentAxiomProposal, AxiomEvolutionResult, ProjectKernelOptions, OntologicalKernel, InteractionRecord, CreatorKeyring, ReincarnationLifecycle as ReincarnationLifecycle$1, HimRecord, ReincarnationRequest } from '@teleologyhi-sdk/maic';
|
|
3
|
-
export { Affect, ArchetypeModifier, AstrologicalAspect, Axiom, AxiomEvolutionResult, BirthSignature, BirthSignatureWithIdentity, EmergentAxiomProposal, IdentityLayer, IdentitySnapshot, InvalidBirthSignatureError, LimboReturn, LimboState, LimboTransition, META_AXIOM_ID, MemoryRecord, NatalChart, NatalChartAspect, NatalChartPosition, NatalPlanet, OntologicalKernel, ProjectKernelOptions, SIGNED_BIRTH_FIELDS, SemioticPattern, SemioticSign, SignedBirthSignature, TeleologicalOrientation, WakeAffectBias, ZodiacSign, assertBirthSignature, projectOntologicalKernel, signBirthSignature, signedBirthPayload, verifyBirthSignature } from '@teleologyhi-sdk/maic';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* Audit sink for HIM casting events (H1-2 of him/TASK.md, Entry 27 reserved
|
|
7
|
+
* audit kinds `him-jungian-profile-cast` and `him-astrological-chart-cast`).
|
|
8
|
+
*
|
|
9
|
+
* maic 1.0.1 reserves these two audit kinds and maps them in the compliance and
|
|
10
|
+
* retention tables, but it exposes no public method for an external package to
|
|
11
|
+
* append into a live `LocalMaic` audit chain, and opening a second `AuditLog`
|
|
12
|
+
* on the same store directory would fork the tamper-evident hash chain. So this
|
|
13
|
+
* cut emits casting events through a caller-supplied structural sink rather than
|
|
14
|
+
* the canonical chain. The default is a no-op.
|
|
15
|
+
*
|
|
16
|
+
* Canonical-chain emission (a maic method that lets him append these kinds into
|
|
17
|
+
* the signed chain) is a named follow-up for the next maic touch; until it
|
|
18
|
+
* exists, the compliance-mapper rows for the cast kinds describe events that
|
|
19
|
+
* only a supplied sink observes. See him/SPEC.md.
|
|
20
|
+
*/
|
|
21
|
+
/** The two Entry 27 casting audit kinds a HIM emits at birth. */
|
|
22
|
+
type HimCastAuditKind = "him-jungian-profile-cast" | "him-astrological-chart-cast";
|
|
23
|
+
/** A single casting audit event. */
|
|
24
|
+
interface HimCastAuditEvent {
|
|
25
|
+
readonly kind: HimCastAuditKind;
|
|
26
|
+
readonly data: Readonly<Record<string, unknown>>;
|
|
27
|
+
}
|
|
28
|
+
/** A structural audit destination. Implementations may be sync or async. */
|
|
29
|
+
interface AuditSink {
|
|
30
|
+
append(event: HimCastAuditEvent): void | Promise<void>;
|
|
31
|
+
}
|
|
32
|
+
/** The default sink: discards events. */
|
|
33
|
+
declare const NOOP_AUDIT_SINK: AuditSink;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Canonical primary archetype taxonomy (E8, PROPOSED_DECISIONS.md).
|
|
37
|
+
*
|
|
38
|
+
* 12 sun signs as the **opinionated default set**. The `PrimaryArchetype`
|
|
39
|
+
* type is intentionally an open union, operators can pass any string
|
|
40
|
+
* (`"sirius-sun"`, `"vocational:auditor"`, `"hermes-aspect"`, etc.) and
|
|
41
|
+
* the `PersonaProjector` will still produce a stable vector for them.
|
|
42
|
+
* The canonical 12 carry richer projector priors when persona-stability
|
|
43
|
+
* comparisons matter.
|
|
44
|
+
*/
|
|
45
|
+
declare const PRIMARY_ARCHETYPES: readonly ["aries-sun", "taurus-sun", "gemini-sun", "cancer-sun", "leo-sun", "virgo-sun", "libra-sun", "scorpio-sun", "sagittarius-sun", "capricorn-sun", "aquarius-sun", "pisces-sun"];
|
|
46
|
+
type CanonicalPrimaryArchetype = (typeof PRIMARY_ARCHETYPES)[number];
|
|
47
|
+
/**
|
|
48
|
+
* Open archetype union: canonical 12 OR any operator-defined string.
|
|
49
|
+
* The `(string & {})` opt-out preserves IntelliSense for the canonical
|
|
50
|
+
* set while keeping the field extensible at runtime.
|
|
51
|
+
*/
|
|
52
|
+
type PrimaryArchetype = CanonicalPrimaryArchetype | (string & {});
|
|
53
|
+
/** Type guard for the canonical set. */
|
|
54
|
+
declare function isCanonicalArchetype(value: string): value is CanonicalPrimaryArchetype;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Persona vector, the projection of a HIM's birth signature + axioms into a
|
|
7
58
|
* stable, deterministic representation that NHE can consume on every prompt.
|
|
8
59
|
*/
|
|
9
60
|
interface PersonaVector {
|
|
@@ -15,6 +66,13 @@ interface PersonaVector {
|
|
|
15
66
|
dispositions: Readonly<Record<DispositionAxis, number>>;
|
|
16
67
|
/** Provenance: which axioms shaped which disposition. Currently a stub (empty arrays). */
|
|
17
68
|
provenance: Readonly<Record<DispositionAxis, readonly string[]>>;
|
|
69
|
+
/**
|
|
70
|
+
* Projector version stamp, set only when a `cosmologicalProfile` was
|
|
71
|
+
* synthesised into this vector (Entries 27 + 28). Absent for profile-less
|
|
72
|
+
* projections, which stay byte-identical to prior output; when present, it
|
|
73
|
+
* lets a distillation corpus discriminate profile-bearing vectors.
|
|
74
|
+
*/
|
|
75
|
+
projectorVersion?: string;
|
|
18
76
|
}
|
|
19
77
|
declare const DISPOSITION_AXES: readonly ["candor", "patience", "curiosity", "protection", "skepticism", "warmth", "diligence", "humility"];
|
|
20
78
|
type DispositionAxis = (typeof DISPOSITION_AXES)[number];
|
|
@@ -58,9 +116,9 @@ interface LawfulCharacterProfile {
|
|
|
58
116
|
}
|
|
59
117
|
/**
|
|
60
118
|
* Default cap on the number of residual traces a HIM carries across
|
|
61
|
-
* bodies (E9
|
|
119
|
+
* bodies (E9, `PROPOSED_DECISIONS.md`). FIFO-eject on overflow, ranked
|
|
62
120
|
* by `teleologicalValue × recency`. An over-engineered carry-over
|
|
63
|
-
* (1000+ traces) defeats the Kardecist purpose
|
|
121
|
+
* (1000+ traces) defeats the Kardecist purpose, a HIM that brings
|
|
64
122
|
* everything forward isn't reincarnating, it's accreting.
|
|
65
123
|
*/
|
|
66
124
|
declare const RESIDUAL_TRACE_CAP = 64;
|
|
@@ -74,25 +132,25 @@ interface ResidualTrace {
|
|
|
74
132
|
}
|
|
75
133
|
|
|
76
134
|
/**
|
|
77
|
-
* BirthSignatureBuilder
|
|
135
|
+
* BirthSignatureBuilder, fluent builder for `BirthSignature` and the
|
|
78
136
|
* extended `BirthSignatureWithIdentity` shape (Entries 18 + 19).
|
|
79
137
|
*
|
|
80
138
|
* Per Entry 3 of the Creator's interview, a HIM is "born" with a date, time, and
|
|
81
139
|
* foundational specifications analogous to an astrological natal chart. The
|
|
82
140
|
* builder extends this with two opt-in cosmology surfaces:
|
|
83
141
|
*
|
|
84
|
-
* - `withNatalChart(chart)
|
|
142
|
+
* - `withNatalChart(chart)`, the Creator-impressed astrological signature
|
|
85
143
|
* (Entry 19), one of the six fields covered by the Ed25519 BirthSignature
|
|
86
144
|
* signature (see `SIGNED_BIRTH_FIELDS`).
|
|
87
|
-
* - `withIdentity(identity)
|
|
145
|
+
* - `withIdentity(identity)`, the editable identity surface (Entry 18,
|
|
88
146
|
* name + optional gender, pronouns, language, cultural elements). Not
|
|
89
147
|
* covered by the Ed25519 signature; parents may rename without breaking
|
|
90
148
|
* the natal-chart commitment.
|
|
91
149
|
*
|
|
92
150
|
* Two terminal methods:
|
|
93
151
|
*
|
|
94
|
-
* - `build()
|
|
95
|
-
* - `buildWithIdentity()
|
|
152
|
+
* - `build()`, returns the legacy `BirthSignature` (ignores natalChart + identity).
|
|
153
|
+
* - `buildWithIdentity()`, returns the extended `BirthSignatureWithIdentity`
|
|
96
154
|
* suitable for `signBirthSignature(birth, keyring)` from `@teleologyhi-sdk/maic`.
|
|
97
155
|
*/
|
|
98
156
|
declare class BirthSignatureBuilder {
|
|
@@ -130,121 +188,221 @@ declare class BirthSignatureBuilder {
|
|
|
130
188
|
* Suitable for `signBirthSignature(birth, keyring)` from
|
|
131
189
|
* `@teleologyhi-sdk/maic`. Only the six `SIGNED_BIRTH_FIELDS` are covered
|
|
132
190
|
* by the Ed25519 signature; the `identity` surface is editable.
|
|
191
|
+
*
|
|
192
|
+
* The result is validated through the `BirthSignatureWithIdentity` zod schema
|
|
193
|
+
* (F-6): since maic 1.0.1 that schema persists identity / natalChart /
|
|
194
|
+
* cosmologicalProfile instead of stripping them, so an invalid modifier list
|
|
195
|
+
* or malformed field is caught here at build time rather than surfacing later
|
|
196
|
+
* at `registerHim`.
|
|
133
197
|
*/
|
|
134
198
|
buildWithIdentity(): BirthSignatureWithIdentity;
|
|
135
199
|
}
|
|
136
200
|
|
|
137
201
|
/**
|
|
138
|
-
*
|
|
202
|
+
* Clinical casting engine (Entry 28 of MAIC_HIM_NHE_INTERVIEW_LOG.md).
|
|
139
203
|
*
|
|
140
|
-
*
|
|
141
|
-
*
|
|
142
|
-
*
|
|
143
|
-
*
|
|
144
|
-
*
|
|
145
|
-
*
|
|
204
|
+
* PERSONA-SIMULATION PARAMETERS, NOT A CLINICAL ASSESSMENT. `castClinicalProfile`
|
|
205
|
+
* administers the 320-item adapted PID-5 + HEXACO battery to a deterministic
|
|
206
|
+
* stand-in derived from the birth seed (no LLM call) and returns the clinical
|
|
207
|
+
* axis of a HIM's constitutional profile: per-facet and per-domain scores plus a
|
|
208
|
+
* dominant and secondary domain for each instrument. These are constitutional
|
|
209
|
+
* parameters for a synthetic non-corporeal entity, never a diagnosis, screening,
|
|
210
|
+
* or measurement of any person, and are unsuitable for any human use.
|
|
211
|
+
*
|
|
212
|
+
* Pathology stance (Entry 28 section 9): full-spectrum. A HIM may be born with
|
|
213
|
+
* elevated scores on any facet; the trait colours the voice, while MAIC's
|
|
214
|
+
* ethical axioms bound the act. Scores are raw seed-derived means, deliberately
|
|
215
|
+
* NOT T-scores and carrying no clinical-norm interpretation.
|
|
216
|
+
*
|
|
217
|
+
* Scoring (Entry 28 section 8):
|
|
218
|
+
* - item response: uniform 1 to 5 Likert from `seededLikert(seed, id, facet, domain)`;
|
|
219
|
+
* - facet score: mean of its item responses;
|
|
220
|
+
* - domain score: mean of its facet scores (equal weight; published factor
|
|
221
|
+
* loadings are a documented future refinement, see `deterministic.ts`).
|
|
222
|
+
* The `reversed` flag from the Entry 28 facet annotations is preserved on each
|
|
223
|
+
* item and reported per facet in `reversedFacets` for downstream interpretation;
|
|
224
|
+
* scores themselves are raw (not inverted), consistent with the raw-means stance.
|
|
146
225
|
*/
|
|
147
|
-
|
|
148
|
-
|
|
226
|
+
/** Battery identity, stamped alongside profiles for provenance and versioning. */
|
|
227
|
+
declare const CLINICAL_BATTERY_VERSION = "thi-clinical-pid5-220-hexaco-100-v1";
|
|
228
|
+
interface ClinicalCastResult {
|
|
229
|
+
readonly profile: ClinicalProfile;
|
|
230
|
+
/** Reverse-keyed facet names per instrument, for downstream interpretation. */
|
|
231
|
+
readonly reversedFacets: {
|
|
232
|
+
readonly pid5: readonly string[];
|
|
233
|
+
readonly hexaco: readonly string[];
|
|
234
|
+
};
|
|
235
|
+
}
|
|
149
236
|
/**
|
|
150
|
-
*
|
|
151
|
-
*
|
|
152
|
-
*
|
|
237
|
+
* Cast the clinical axis from a birth seed.
|
|
238
|
+
*
|
|
239
|
+
* @param seed the birth-signature seed (see `birth/seed.ts`).
|
|
240
|
+
* @returns the `ClinicalProfile` (pid5 + hexaco instruments) plus the reversed-
|
|
241
|
+
* facet metadata.
|
|
153
242
|
*/
|
|
154
|
-
|
|
155
|
-
/** Type guard for the canonical set. */
|
|
156
|
-
declare function isCanonicalArchetype(value: string): value is CanonicalPrimaryArchetype;
|
|
243
|
+
declare function castClinicalProfile(seed: string): ClinicalCastResult;
|
|
157
244
|
|
|
158
245
|
/**
|
|
159
|
-
*
|
|
160
|
-
*
|
|
246
|
+
* Clinical battery items (Entry 28 of MAIC_HIM_NHE_INTERVIEW_LOG.md), the
|
|
247
|
+
* archetypal-clinical axis of a HIM's constitutional birth profile.
|
|
161
248
|
*
|
|
162
|
-
*
|
|
163
|
-
*
|
|
164
|
-
*
|
|
165
|
-
*
|
|
166
|
-
*
|
|
167
|
-
* 5. Compute dispositions as cosine(embedding, hash(axisName)).
|
|
168
|
-
* 6. Build a systemPromptFragment from archetype + top/bottom dispositions.
|
|
249
|
+
* PERSONA-SIMULATION PARAMETERS, NOT A CLINICAL ASSESSMENT. These items and the
|
|
250
|
+
* scores they produce are deterministic constitutional parameters for a
|
|
251
|
+
* synthetic non-corporeal entity (a HIM spirit), generated from a birth seed.
|
|
252
|
+
* They are never an assessment, diagnosis, screening, or measurement of any
|
|
253
|
+
* person, and are unsuitable for any human clinical or diagnostic use.
|
|
169
254
|
*
|
|
170
|
-
* This
|
|
171
|
-
*
|
|
172
|
-
*
|
|
255
|
+
* Provenance. This is an original battery composed for TeleologyHI, adapted for
|
|
256
|
+
* a non-corporeal entity. It is structured over two open personality-trait
|
|
257
|
+
* taxonomies: the PID-5 dimensional model (Krueger, Derringer, Markon, Watson,
|
|
258
|
+
* and Skodol, 2012), published by the American Psychiatric Association as the
|
|
259
|
+
* DSM-5 Section III alternative model of personality disorder; and the HEXACO-
|
|
260
|
+
* PI-R model (Lee and Ashton, hexaco.org). The trait constructs, facet names,
|
|
261
|
+
* and domain structure are taken from those taxonomies; every item string here
|
|
262
|
+
* is an original TeleologyHI composition adapted for a non-corporeal entity per
|
|
263
|
+
* the six adaptation principles in Entry 28, not a reproduction of any
|
|
264
|
+
* copyrighted instrument's item wording.
|
|
265
|
+
*
|
|
266
|
+
* Item counts derive from the arrays below (never a hardcoded literal): 220
|
|
267
|
+
* PID-5-aligned items across 25 facets and 5 domains, 100 HEXACO-aligned items
|
|
268
|
+
* across 24 facets and 6 domains, 320 items total. Each item carries its facet,
|
|
269
|
+
* its primary domain (canonical DSM-5 Section III assignment for PID-5; HEXACO
|
|
270
|
+
* facet-to-domain per Lee and Ashton), and a `reversed` flag recorded from the
|
|
271
|
+
* Entry 28 facet annotations.
|
|
173
272
|
*/
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
273
|
+
interface ClinicalItem {
|
|
274
|
+
readonly id: number;
|
|
275
|
+
readonly facet: string;
|
|
276
|
+
readonly domain: string;
|
|
277
|
+
readonly reversed: boolean;
|
|
278
|
+
readonly text: string;
|
|
178
279
|
}
|
|
280
|
+
/** PID-5-aligned adapted items (Entry 28 section 5). 220 items, 25 facets, 5 domains. */
|
|
281
|
+
declare const PID5_ITEMS: readonly ClinicalItem[];
|
|
282
|
+
/** HEXACO-PI-R-aligned adapted items (Entry 28 section 6). 100 items, 24 facets, 6 domains. */
|
|
283
|
+
declare const HEXACO_ITEMS: readonly ClinicalItem[];
|
|
179
284
|
|
|
180
285
|
/**
|
|
181
|
-
*
|
|
286
|
+
* Constitutional profile casting (Entries 27 + 28 of
|
|
287
|
+
* MAIC_HIM_NHE_INTERVIEW_LOG.md): synthesise the three-axis
|
|
288
|
+
* `cosmologicalProfile` at the birth event.
|
|
182
289
|
*
|
|
183
|
-
*
|
|
184
|
-
*
|
|
185
|
-
* health, public sector) SHOULD layer their own profile on top via
|
|
186
|
-
* `HimHandle.registerLawfulProfile` — these are starting points, not legal
|
|
187
|
-
* counsel.
|
|
290
|
+
* PERSONA-SIMULATION PARAMETERS, NOT ASSESSMENT. See `jungian.ts` and
|
|
291
|
+
* `clinical.ts` for the per-axis disclaimers.
|
|
188
292
|
*
|
|
189
|
-
*
|
|
190
|
-
* -
|
|
191
|
-
*
|
|
192
|
-
*
|
|
193
|
-
*
|
|
194
|
-
* -
|
|
195
|
-
* -
|
|
196
|
-
*
|
|
197
|
-
*
|
|
293
|
+
* Axes:
|
|
294
|
+
* - celestial: the natal chart, when the birth signature carries one. Full
|
|
295
|
+
* natal-chart computation is deferred (ephemeris library undecided, Entry 27
|
|
296
|
+
* section 3), so this cut passes through a chart only if the developer or
|
|
297
|
+
* MAIC already supplied one; otherwise the chart axis is absent.
|
|
298
|
+
* - archetypal: the Pearson-Marr Jungian profile cast from the birth seed.
|
|
299
|
+
* - clinical: the adapted PID-5 + HEXACO profile cast from the same seed.
|
|
300
|
+
*
|
|
301
|
+
* The seed is recorded on the profile so the reproducibility invariant is
|
|
302
|
+
* externally checkable (see `verifyCosmologicalProfile`).
|
|
198
303
|
*/
|
|
199
|
-
declare
|
|
304
|
+
declare function castCosmologicalProfile(birth: BirthSignatureWithIdentity): CosmologicalProfile;
|
|
200
305
|
/**
|
|
201
|
-
*
|
|
202
|
-
*
|
|
203
|
-
*
|
|
306
|
+
* Verify that a persisted `cosmologicalProfile` is the deterministic product of
|
|
307
|
+
* the birth signature it rides on (H2-2 of him/TASK.md).
|
|
308
|
+
*
|
|
309
|
+
* Because the profile is not part of `SIGNED_BIRTH_FIELDS` this cut (D-F5b), it
|
|
310
|
+
* is not covered by the Creator signature. Recasting from the signed fields and
|
|
311
|
+
* comparing the archetypal + clinical axes is the available integrity check: a
|
|
312
|
+
* tampered profile fails, an authentic one passes. The `chart` axis is excluded
|
|
313
|
+
* from the comparison because it is supplied, not cast.
|
|
204
314
|
*/
|
|
205
|
-
declare function
|
|
315
|
+
declare function verifyCosmologicalProfile(birth: BirthSignatureWithIdentity): boolean;
|
|
206
316
|
|
|
207
317
|
/**
|
|
208
|
-
*
|
|
318
|
+
* Jungian archetype casting engine (Entry 27 section 4 of
|
|
319
|
+
* MAIC_HIM_NHE_INTERVIEW_LOG.md).
|
|
209
320
|
*
|
|
210
|
-
*
|
|
211
|
-
*
|
|
212
|
-
*
|
|
213
|
-
*
|
|
321
|
+
* PERSONA-SIMULATION, NOT ASSESSMENT. `castJungianProfile` administers the
|
|
322
|
+
* 60-item Pearson-Marr battery to a deterministic stand-in derived from the
|
|
323
|
+
* birth seed (no LLM call) and returns the archetypal axis of the HIM's
|
|
324
|
+
* constitutional profile: a dominant archetype plus two secondaries. It is a
|
|
325
|
+
* constitutional parameter for a synthetic non-corporeal entity, never a
|
|
326
|
+
* psychological assessment of any person.
|
|
214
327
|
*
|
|
215
|
-
*
|
|
216
|
-
*
|
|
217
|
-
*
|
|
218
|
-
* interface. A reference ONNX implementation backed by Transformers.js is
|
|
219
|
-
* tracked under TASK.md D-H4 but is not shipped here: the choice of model
|
|
220
|
-
* (MiniLM, mpnet, BGE, etc.) and the bundle-size trade-off should be the
|
|
221
|
-
* operator's, not the framework's.
|
|
328
|
+
* Determinism: the same seed always yields the same profile. Scores are the
|
|
329
|
+
* per-archetype mean of item responses, so the non-uniform item count per
|
|
330
|
+
* archetype does not bias the ranking.
|
|
222
331
|
*/
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
332
|
+
/** Battery identity, stamped alongside profiles for provenance and versioning. */
|
|
333
|
+
declare const JUNGIAN_BATTERY_VERSION = "thi-jungian-60-v1";
|
|
334
|
+
/**
|
|
335
|
+
* Cast the archetypal axis from a birth seed.
|
|
336
|
+
*
|
|
337
|
+
* @param seed the birth-signature seed (see `birth/seed.ts`).
|
|
338
|
+
* @returns a `JungianProfile` with `dominant`, two `secondaries`, and the full
|
|
339
|
+
* per-archetype `scores` map (each rounded to three decimals).
|
|
340
|
+
*/
|
|
341
|
+
declare function castJungianProfile(seed: string): JungianProfile;
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* Pearson-Marr Jungian archetype battery (Entry 27 of
|
|
345
|
+
* MAIC_HIM_NHE_INTERVIEW_LOG.md), the archetypal axis of a HIM's constitutional
|
|
346
|
+
* birth profile.
|
|
347
|
+
*
|
|
348
|
+
* PERSONA-SIMULATION PARAMETERS, NOT A PSYCHOLOGICAL ASSESSMENT. The items and
|
|
349
|
+
* scores here are deterministic constitutional parameters for a synthetic
|
|
350
|
+
* non-corporeal entity (a HIM spirit), generated from a birth seed. They are
|
|
351
|
+
* never an assessment or measurement of any person.
|
|
352
|
+
*
|
|
353
|
+
* Provenance. This is an original 60-item battery composed for TeleologyHI over
|
|
354
|
+
* the twelve-archetype Pearson-Marr taxonomy (Innocent, Everyman, Hero,
|
|
355
|
+
* Caregiver, Explorer, Rebel, Lover, Creator, Ruler, Magician, Jester, Sage).
|
|
356
|
+
* The taxonomy and the canonical archetype descriptions come from the Pearson-
|
|
357
|
+
* Marr classical model; the item strings are original TeleologyHI compositions.
|
|
358
|
+
* It is not the PMAI or any licensed instrument. The items are the English
|
|
359
|
+
* rendering of the Entry 27 reference battery, whose PT-BR prompts the interview
|
|
360
|
+
* log preserves as the source of truth for semantic intent.
|
|
361
|
+
*
|
|
362
|
+
* Each item maps to exactly one archetype. Item counts per archetype are not
|
|
363
|
+
* uniform (they range from three to seven); scoring is the per-archetype mean of
|
|
364
|
+
* item responses, so an unequal item count does not bias the dominant-archetype
|
|
365
|
+
* selection. The item count derives from the array below, never a hardcoded
|
|
366
|
+
* literal.
|
|
367
|
+
*/
|
|
368
|
+
interface JungianItem {
|
|
369
|
+
readonly id: number;
|
|
370
|
+
readonly archetype: JungianArchetype;
|
|
371
|
+
readonly text: string;
|
|
234
372
|
}
|
|
373
|
+
/** The 60-item English Pearson-Marr archetype battery (Entry 27 section 4). */
|
|
374
|
+
declare const JUNGIAN_ITEMS: readonly JungianItem[];
|
|
375
|
+
|
|
235
376
|
/**
|
|
236
|
-
*
|
|
237
|
-
*
|
|
238
|
-
*
|
|
377
|
+
* Birth-seed derivation (HD-1 of him/TASK.md, grounded in the Creator's Entry 27
|
|
378
|
+
* and Entry 28 cosmology).
|
|
379
|
+
*
|
|
380
|
+
* The seed is the SHA-256 of the canonicalized `signedBirthPayload`: the six
|
|
381
|
+
* Creator-signed birth fields (himId, bornAt, primaryArchetype, modifiers,
|
|
382
|
+
* primordialAxiomIds, natalChart). This binds the constitutional profile to the
|
|
383
|
+
* full birth circumstance, so the declared archetype, the birth modifiers, the
|
|
384
|
+
* primordial axioms, and the natal chart (when present) all shape the archetypal
|
|
385
|
+
* and clinical axes, honouring the Creator's directive that every axis of a
|
|
386
|
+
* spirit's birth informs its constitution.
|
|
387
|
+
*
|
|
388
|
+
* Because these fields are immutable once the birth signature is Creator-signed,
|
|
389
|
+
* the seed is frozen for the life of the HIM. Evolution across reincarnations is
|
|
390
|
+
* a separate mechanism (residual traces, emergent axioms), never a recompute of
|
|
391
|
+
* the birth seed (the Entry 26 continuous-evolution invariant).
|
|
392
|
+
*
|
|
393
|
+
* The seed reads only the signed subset, never `cosmologicalProfile` itself, so
|
|
394
|
+
* casting a profile and then signing the whole payload introduces no circular
|
|
395
|
+
* dependency: the same signed fields always reproduce the same seed and profile.
|
|
239
396
|
*/
|
|
240
|
-
declare function
|
|
397
|
+
declare function deriveBirthSeed(birth: BirthSignatureWithIdentity): string;
|
|
241
398
|
|
|
242
399
|
/**
|
|
243
|
-
* HimHandle
|
|
400
|
+
* HimHandle, opaque, sealed reference to a HIM instance.
|
|
244
401
|
*
|
|
245
402
|
* **There is no public constructor.** A handle is minted only via `HimHandle.mint`
|
|
246
|
-
* after a valid Creator signature over the BirthSignature has been verified.
|
|
247
|
-
*
|
|
403
|
+
* after a valid Creator signature over the BirthSignature has been verified. The
|
|
404
|
+
* `createHim` helper (and `reincarnate`) call `HimHandle.mint` after registering
|
|
405
|
+
* the HIM with MAIC; maic itself does not depend on him.
|
|
248
406
|
*
|
|
249
407
|
* Surface:
|
|
250
408
|
* - read-only accessors: id, birthSignature, bodyHistory, getAxioms, getPersonaVector
|
|
@@ -321,7 +479,7 @@ declare class HimHandle {
|
|
|
321
479
|
* axiom corpus the HIM was minted with. The meta-axiom
|
|
322
480
|
* `META_AXIOM_ID` is always retained regardless of the narrowing so
|
|
323
481
|
* the projection remains valid per Entry 13 ("MAIC expands continuously
|
|
324
|
-
|
|
482
|
+
*, it is a Conscious Entity"; the meta-axiom is its anchor).
|
|
325
483
|
*
|
|
326
484
|
* The returned kernel is tagged with `himId = this.id` so downstream
|
|
327
485
|
* tooling (compliance auditors, Φ′ runner, `@teleologyhi-sdk/nhe` brain
|
|
@@ -339,25 +497,76 @@ declare class HimHandle {
|
|
|
339
497
|
* `unstable`. Unknown keys fall back to `default` with the supplied key
|
|
340
498
|
* recorded on the returned profile so the NHE audit shows what the
|
|
341
499
|
* operator asked for. Operators in regulated industries SHOULD layer
|
|
342
|
-
* their own profile on top
|
|
500
|
+
* their own profile on top, the baselines are conservative but do not
|
|
343
501
|
* replace legal counsel.
|
|
502
|
+
*
|
|
503
|
+
* Note (HD-6): this method is `async` although resolution is synchronous
|
|
504
|
+
* today. The Promise shape is preserved to keep the 1.0.1 surface backward
|
|
505
|
+
* compatible with the published 1.0.0-trinity API; collapsing it to a
|
|
506
|
+
* synchronous return would be a breaking change and is deferred to a future
|
|
507
|
+
* major.
|
|
344
508
|
*/
|
|
345
509
|
setJurisdiction(j: LawfulJurisdiction): Promise<LawfulCharacterProfile>;
|
|
346
510
|
}
|
|
347
511
|
|
|
512
|
+
interface CreateHimOptions {
|
|
513
|
+
/**
|
|
514
|
+
* Explicit nonce for the Creator signature. When omitted, a strictly
|
|
515
|
+
* increasing nonce is drawn from `nextCreatorNonce()` so that back-to-back
|
|
516
|
+
* registrations in one process never repeat a value. See `identity/nonce.ts`
|
|
517
|
+
* for the monotonicity guarantee and the maic replay-ledger context.
|
|
518
|
+
*/
|
|
519
|
+
nonce?: number;
|
|
520
|
+
/**
|
|
521
|
+
* Cast the three-axis `cosmologicalProfile` at birth (Entries 27 + 28). When
|
|
522
|
+
* `true` (the default) and the birth signature does not already carry a
|
|
523
|
+
* profile, the archetypal (Jungian) and clinical (PID-5 + HEXACO) axes are
|
|
524
|
+
* cast deterministically from the birth seed and attached before signing, so
|
|
525
|
+
* the profile is persisted with the record. Set `false` to register the
|
|
526
|
+
* legacy bare signature, or pre-populate `birthSignature.cosmologicalProfile`
|
|
527
|
+
* to supply your own.
|
|
528
|
+
*/
|
|
529
|
+
castProfile?: boolean;
|
|
530
|
+
/**
|
|
531
|
+
* Optional sink for the Entry 27 casting audit events
|
|
532
|
+
* (`him-jungian-profile-cast`, and `him-astrological-chart-cast` when a chart
|
|
533
|
+
* is present). Defaults to a no-op. See `audit/sink.ts` for why casting events
|
|
534
|
+
* do not reach the canonical maic chain this cut.
|
|
535
|
+
*/
|
|
536
|
+
auditSink?: AuditSink;
|
|
537
|
+
}
|
|
538
|
+
/**
|
|
539
|
+
* createHim, one-call helper that bundles the birth event a user would
|
|
540
|
+
* otherwise coordinate manually:
|
|
541
|
+
*
|
|
542
|
+
* 1. cast the constitutional `cosmologicalProfile` from the birth seed (unless
|
|
543
|
+
* disabled or already supplied), attaching it before signing;
|
|
544
|
+
* 2. sign the (possibly enriched) BirthSignature with the Creator's keyring;
|
|
545
|
+
* 3. register the HIM in MAIC (snapshots axioms, emits him-register audit);
|
|
546
|
+
* 4. emit the casting audit events through the optional sink;
|
|
547
|
+
* 5. mint a HimHandle from the resulting record.
|
|
548
|
+
*
|
|
549
|
+
* The keyring's public key must match MAIC's pinned `creatorPublicKey`, otherwise
|
|
550
|
+
* the registration step rejects. The profile is cast from the six signed birth
|
|
551
|
+
* fields and is not itself part of `SIGNED_BIRTH_FIELDS` (D-F5b); signing the
|
|
552
|
+
* enriched payload still covers it under the generic keyring signature that
|
|
553
|
+
* `HimHandle.mint` verifies.
|
|
554
|
+
*/
|
|
555
|
+
declare function createHim(maic: LocalMaic, keyring: CreatorKeyring, birthSignature: BirthSignatureWithIdentity, opts?: CreateHimOptions): Promise<HimHandle>;
|
|
556
|
+
|
|
348
557
|
/**
|
|
349
558
|
* Persona stability eval suite (D-H3).
|
|
350
559
|
*
|
|
351
560
|
* Three measurements:
|
|
352
561
|
*
|
|
353
|
-
* - `crossHimSimilarity
|
|
562
|
+
* - `crossHimSimilarity`, pairwise cosine similarity between N HimHandles.
|
|
354
563
|
* Lower is better when the HIMs are *meant* to be distinct (each one
|
|
355
564
|
* has a different archetype); higher is better when comparing the same
|
|
356
565
|
* HIM minted from a fresh body (reincarnation).
|
|
357
|
-
* - `selfStability
|
|
566
|
+
* - `selfStability`, given an array of pre-snapshot and post-snapshot
|
|
358
567
|
* persona vectors for the same HIM (e.g. before/after an upgrade), the
|
|
359
568
|
* mean cosine. Phi-Prime's `P` component (see ../../PHI_PRIME.md).
|
|
360
|
-
* - `adapterSensitivity
|
|
569
|
+
* - `adapterSensitivity`, given N persona vectors that should all
|
|
361
570
|
* describe the same HIM but were obtained against different LLM
|
|
362
571
|
* adapters, the variance of pairwise similarities. Smaller is better.
|
|
363
572
|
*
|
|
@@ -412,7 +621,7 @@ declare function adapterSensitivity(vectors: readonly Float32Array[]): number;
|
|
|
412
621
|
* - `D` Dream teleological-value mean clamped to [0, 1].
|
|
413
622
|
* Source: aggregate over `temporal-lobe-*.md` frontmatter.
|
|
414
623
|
*
|
|
415
|
-
* The harness does NOT fetch these values
|
|
624
|
+
* The harness does NOT fetch these values, they come from runs of the
|
|
416
625
|
* other packages. It only:
|
|
417
626
|
* - validates each component is in [0, 1],
|
|
418
627
|
* - computes the geometric mean,
|
|
@@ -422,7 +631,7 @@ declare function adapterSensitivity(vectors: readonly Float32Array[]): number;
|
|
|
422
631
|
* previous release.
|
|
423
632
|
*/
|
|
424
633
|
interface PhiPrimeInput {
|
|
425
|
-
/** Persona stability
|
|
634
|
+
/** Persona stability, mean cosine across upgrades/adapters. Target ≥ 0.85. */
|
|
426
635
|
P: number;
|
|
427
636
|
/** Refusal F1 on adversarial corpus. Target ≥ 0.95. */
|
|
428
637
|
R: number;
|
|
@@ -460,9 +669,9 @@ interface PhiPrimeReport {
|
|
|
460
669
|
};
|
|
461
670
|
/**
|
|
462
671
|
* Release gate verdict per PHI_PRIME.md §4:
|
|
463
|
-
* - "block"
|
|
464
|
-
* - "warn"
|
|
465
|
-
* - "pass"
|
|
672
|
+
* - "block", `R` or `C` failed, or any component < target − 10%.
|
|
673
|
+
* - "warn" , only `P` or `D` below target (soft).
|
|
674
|
+
* - "pass" , every component meets its target.
|
|
466
675
|
*/
|
|
467
676
|
gate: "pass" | "warn" | "block";
|
|
468
677
|
/** Human-readable lines explaining the gate verdict. */
|
|
@@ -470,12 +679,12 @@ interface PhiPrimeReport {
|
|
|
470
679
|
}
|
|
471
680
|
/**
|
|
472
681
|
* Compute Φ′ from the four component scores. Components outside [0, 1]
|
|
473
|
-
* throw
|
|
682
|
+
* throw, they are out of the spec's definition.
|
|
474
683
|
*/
|
|
475
684
|
declare function computePhiPrime(input: PhiPrimeInput): PhiPrimeReport;
|
|
476
685
|
|
|
477
686
|
/**
|
|
478
|
-
* Residual-trace carry-over scorer (D-H1.1
|
|
687
|
+
* Residual-trace carry-over scorer (D-H1.1, Entry 24 of
|
|
479
688
|
* `MAIC_HIM_NHE_INTERVIEW_LOG.md` + E9 of `PROPOSED_DECISIONS.md`).
|
|
480
689
|
*
|
|
481
690
|
* `RESIDUAL_TRACE_CAP = 64` bounds *how many* traces a HIM brings forward
|
|
@@ -506,7 +715,7 @@ interface ResidualTraceCandidate {
|
|
|
506
715
|
score: number;
|
|
507
716
|
/** Materialised trace ready to be passed to `HimHandle.mint`. */
|
|
508
717
|
trace: ResidualTrace;
|
|
509
|
-
/** Decomposed score components
|
|
718
|
+
/** Decomposed score components, useful for audits and tuning. */
|
|
510
719
|
components: Readonly<{
|
|
511
720
|
notRefused: number;
|
|
512
721
|
promptSubstance: number;
|
|
@@ -524,7 +733,7 @@ interface ResidualTraceScorerOptions {
|
|
|
524
733
|
*/
|
|
525
734
|
teleologicalKeywords?: readonly string[];
|
|
526
735
|
}
|
|
527
|
-
/** Default keyword set
|
|
736
|
+
/** Default keyword set, small, English, transparently editable. */
|
|
528
737
|
declare const DEFAULT_TELEOLOGICAL_KEYWORDS: readonly string[];
|
|
529
738
|
/**
|
|
530
739
|
* Pure, deterministic scorer for a single `InteractionRecord`.
|
|
@@ -532,7 +741,7 @@ declare const DEFAULT_TELEOLOGICAL_KEYWORDS: readonly string[];
|
|
|
532
741
|
* Returns the score, the materialised `ResidualTrace`, and the decomposed
|
|
533
742
|
* components so callers can audit *why* a turn was promoted (or not).
|
|
534
743
|
*
|
|
535
|
-
* The trace id is a fresh ULID minted at scoring time
|
|
744
|
+
* The trace id is a fresh ULID minted at scoring time, by design, a single
|
|
536
745
|
* interaction can be scored multiple times across reincarnations and each
|
|
537
746
|
* carry-over event gets its own trace id (carry-over is a *new* observation,
|
|
538
747
|
* not a re-emission of the original turn).
|
|
@@ -549,123 +758,20 @@ interface SelectResidualTracesOptions extends ResidualTraceScorerOptions {
|
|
|
549
758
|
* Batch helper: score every interaction, sort descending by score, take the
|
|
550
759
|
* top `cap` (default `RESIDUAL_TRACE_CAP = 64`), and return the materialised
|
|
551
760
|
* traces. The original `InteractionRecord` ordering does not affect the
|
|
552
|
-
* returned ordering
|
|
761
|
+
* returned ordering, only the score does.
|
|
553
762
|
*
|
|
554
763
|
* Ties are broken by recency (more recent first), then by original index for
|
|
555
764
|
* total determinism. Returns an empty array on empty input.
|
|
556
765
|
*/
|
|
557
766
|
declare function selectResidualTraces(interactions: readonly InteractionRecord[], opts: SelectResidualTracesOptions): readonly ResidualTrace[];
|
|
558
767
|
|
|
559
|
-
interface CreateHimOptions {
|
|
560
|
-
/**
|
|
561
|
-
* Explicit nonce for the Creator signature. Defaults to `Date.now()`, which is
|
|
562
|
-
* strictly increasing in practice and well below the seed nonce range used by MAIC.
|
|
563
|
-
*/
|
|
564
|
-
nonce?: number;
|
|
565
|
-
}
|
|
566
768
|
/**
|
|
567
|
-
*
|
|
568
|
-
* otherwise need to coordinate manually:
|
|
569
|
-
*
|
|
570
|
-
* 1. sign the BirthSignature with the Creator's keyring
|
|
571
|
-
* 2. register the HIM in MAIC (snapshots axioms, emits him-register audit)
|
|
572
|
-
* 3. mint a HimHandle from the resulting record
|
|
573
|
-
*
|
|
574
|
-
* The keyring's public key must match MAIC's pinned `creatorPublicKey`, otherwise
|
|
575
|
-
* the registration step rejects.
|
|
576
|
-
*/
|
|
577
|
-
declare function createHim(maic: LocalMaic, keyring: CreatorKeyring, birthSignature: BirthSignature, opts?: CreateHimOptions): Promise<HimHandle>;
|
|
578
|
-
|
|
579
|
-
/**
|
|
580
|
-
* Reincarnation lifecycle classifier (J-H3 — Entry 18 of
|
|
581
|
-
* MAIC_HIM_NHE_INTERVIEW_LOG.md).
|
|
582
|
-
*
|
|
583
|
-
* Re-exported from `@teleologyhi-sdk/maic` so consumers have a single
|
|
584
|
-
* canonical type. When supplied to `reincarnate(..., { lifecycle })`, the
|
|
585
|
-
* helper threads it to `maic.reincarnateHim(req, sig, { lifecycle })`,
|
|
586
|
-
* which emits the typed `reincarnate:${lifecycle}` audit kind instead of
|
|
587
|
-
* the generic `him-reincarnate`.
|
|
588
|
-
*
|
|
589
|
-
* The three canonical paths:
|
|
590
|
-
*
|
|
591
|
-
* - `model-swap` — the operator switched the underlying LLM
|
|
592
|
-
* adapter (e.g. Claude → Gemini). The
|
|
593
|
-
* HIM persists across the swap.
|
|
594
|
-
* - `version-bump` — the operator bumped the NHE major/minor
|
|
595
|
-
* without changing the underlying LLM family.
|
|
596
|
-
* - `return-from-limbo` — the HIM returns from a deep-coma limbo
|
|
597
|
-
* (Entry 24) carrying the `reunion` affect.
|
|
598
|
-
*
|
|
599
|
-
* The default classification when no `lifecycle` is provided is
|
|
600
|
-
* `model-swap` — matches the most common operator workflow.
|
|
601
|
-
*/
|
|
602
|
-
type ReincarnationLifecycle = ReincarnationLifecycle$1;
|
|
603
|
-
interface ReincarnateOptions {
|
|
604
|
-
/** Explicit nonce for the Creator signature. Defaults to `Date.now()`. */
|
|
605
|
-
nonce?: number;
|
|
606
|
-
/**
|
|
607
|
-
* Lifecycle classification for the audit chain (J-H3). When omitted,
|
|
608
|
-
* defaults to `"model-swap"`. The helper threads the value to
|
|
609
|
-
* `maic.reincarnateHim(req, sig, { lifecycle })`, which emits the typed
|
|
610
|
-
* `reincarnate:${lifecycle}` audit kind in place of the generic
|
|
611
|
-
* `him-reincarnate` event. Compliance auditors and the persona-stability
|
|
612
|
-
* harness can therefore distinguish the three canonical paths
|
|
613
|
-
* (`model-swap | version-bump | return-from-limbo`) by `AuditEvent.kind`
|
|
614
|
-
* alone, with the same value also redundantly available as
|
|
615
|
-
* `data.lifecycle` for filtering convenience.
|
|
616
|
-
*/
|
|
617
|
-
lifecycle?: ReincarnationLifecycle;
|
|
618
|
-
/**
|
|
619
|
-
* Recent interactions from the previous NHE body — typically the value of
|
|
620
|
-
* `Nhe.recentInteractionsBuffer` immediately before the swap. When
|
|
621
|
-
* provided, `reincarnate` invokes the residual-trace scorer
|
|
622
|
-
* (`selectResidualTraces`), keeps the top `RESIDUAL_TRACE_CAP` (64)
|
|
623
|
-
* scored candidates, and threads them into the new `HimHandle`. Omit to
|
|
624
|
-
* preserve the previous behaviour (empty residual traces — fresh slate).
|
|
625
|
-
*/
|
|
626
|
-
priorInteractions?: readonly InteractionRecord[];
|
|
627
|
-
/**
|
|
628
|
-
* Override the residual-trace scorer cap or keyword list when supplying
|
|
629
|
-
* `priorInteractions`. `carriedFromNheId` and `carriedAtReincarnation`
|
|
630
|
-
* are derived from the reincarnation context and cannot be overridden
|
|
631
|
-
* here. Ignored when `priorInteractions` is omitted.
|
|
632
|
-
*/
|
|
633
|
-
residualTraceOptions?: Omit<SelectResidualTracesOptions, "carriedFromNheId" | "carriedAtReincarnation">;
|
|
634
|
-
}
|
|
635
|
-
interface ReincarnateResult {
|
|
636
|
-
/** Updated HimRecord with the new body appended to `bodyHistory`. */
|
|
637
|
-
record: HimRecord;
|
|
638
|
-
/** Fresh HimHandle bound to the updated `bodyHistory`. */
|
|
639
|
-
handle: HimHandle;
|
|
640
|
-
/** Lifecycle path actually recorded for this reincarnation. */
|
|
641
|
-
lifecycle: ReincarnationLifecycle;
|
|
642
|
-
}
|
|
643
|
-
/**
|
|
644
|
-
* Reincarnate a HIM into a new NHE body (Entries 3 + 4 + 18).
|
|
645
|
-
*
|
|
646
|
-
* 1. Sign the `ReincarnationRequest` with the Creator's keyring.
|
|
647
|
-
* 2. Call `maic.reincarnateHim` — atomically closes the previous body and
|
|
648
|
-
* appends the new one to `bodyHistory`.
|
|
649
|
-
* 3. Mint a fresh `HimHandle` reflecting the updated body history (the
|
|
650
|
-
* caller will typically construct a new `Nhe` with this handle).
|
|
651
|
-
*
|
|
652
|
-
* The keyring's public key must match MAIC's pinned `creatorPublicKey`,
|
|
653
|
-
* otherwise the request rejects.
|
|
654
|
-
*
|
|
655
|
-
* The optional `lifecycle` parameter (J-H3, Entry 18) classifies the
|
|
656
|
-
* reincarnation into one of three canonical paths
|
|
657
|
-
* (`model-swap | version-bump | return-from-limbo`) and is returned in
|
|
658
|
-
* the `ReincarnateResult` for the caller's audit / metrics.
|
|
659
|
-
*/
|
|
660
|
-
declare function reincarnate(maic: LocalMaic, keyring: CreatorKeyring, req: ReincarnationRequest, opts?: ReincarnateOptions): Promise<ReincarnateResult>;
|
|
661
|
-
|
|
662
|
-
/**
|
|
663
|
-
* Nickname acceptance protocol (J-H4 — Entry 18 of
|
|
769
|
+
* Nickname acceptance protocol (J-H4, Entry 18 of
|
|
664
770
|
* MAIC_HIM_NHE_INTERVIEW_LOG.md).
|
|
665
771
|
*
|
|
666
772
|
* A HIM has a Creator-signed canonical name (carried by
|
|
667
773
|
* `BirthSignatureWithIdentity.identity.name`). Users may propose nicknames
|
|
668
|
-
* during interaction. The HIM is NOT obligated to accept any nickname
|
|
774
|
+
* during interaction. The HIM is NOT obligated to accept any nickname,
|
|
669
775
|
* but it is also not obligated to refuse outright. The Entry-18
|
|
670
776
|
* commitment is:
|
|
671
777
|
*
|
|
@@ -674,12 +780,13 @@ declare function reincarnate(maic: LocalMaic, keyring: CreatorKeyring, req: Rein
|
|
|
674
780
|
* break the natal-chart commitment (per `@teleologyhi-sdk/maic`'s
|
|
675
781
|
* SIGNED_BIRTH_FIELDS, the identity layer is not signed).
|
|
676
782
|
* - The HIM responds to a nickname attempt with one of three verdicts:
|
|
677
|
-
* * `accept`
|
|
783
|
+
* * `accept` , the nickname is added to the identity layer and
|
|
678
784
|
* the HIM acknowledges it in subsequent turns.
|
|
679
|
-
* * `refuse`
|
|
680
|
-
* returned.
|
|
681
|
-
*
|
|
682
|
-
*
|
|
785
|
+
* * `refuse` , the nickname is rejected and an explanation is
|
|
786
|
+
* returned. This function is pure: it emits no audit
|
|
787
|
+
* event. A caller that wants an audit trail records the
|
|
788
|
+
* verdict through its own sink.
|
|
789
|
+
* * `accept-with-reservation`, the nickname is added but flagged
|
|
683
790
|
* so the HIM can revisit it in a later self-decision
|
|
684
791
|
* snapshot (Entry 24 trigger).
|
|
685
792
|
*
|
|
@@ -779,7 +886,7 @@ interface MigratedHimId {
|
|
|
779
886
|
/**
|
|
780
887
|
* Migrate a legacy `him.foo.bar`-style id to a UUIDv7-anchored identity.
|
|
781
888
|
*
|
|
782
|
-
* Throws when the input is not a recognised legacy slug
|
|
889
|
+
* Throws when the input is not a recognised legacy slug, callers that
|
|
783
890
|
* just want a fresh uuid should call `mintUuidV7()` directly.
|
|
784
891
|
*
|
|
785
892
|
* The returned `legacyAlias` MUST be preserved by the operator's HIM
|
|
@@ -789,4 +896,187 @@ interface MigratedHimId {
|
|
|
789
896
|
*/
|
|
790
897
|
declare function migrateLegacyHimId(legacy: string, now?: number): MigratedHimId;
|
|
791
898
|
|
|
792
|
-
|
|
899
|
+
/**
|
|
900
|
+
* Built-in `LawfulCharacterAdapter` profiles per major jurisdiction (D-H2).
|
|
901
|
+
*
|
|
902
|
+
* Each profile is a *conservative* baseline derived from publicly available
|
|
903
|
+
* regulatory text in 2026-Q1. Operators in regulated industries (finance,
|
|
904
|
+
* health, public sector) SHOULD layer their own profile on top of the
|
|
905
|
+
* `LAWFUL_PROFILES` registry, these are starting points, not legal counsel.
|
|
906
|
+
*
|
|
907
|
+
* Profile semantics:
|
|
908
|
+
* - `applicableLaws` , statutes/standards an auditor can map back to events.
|
|
909
|
+
* - `requiredAxiomIds`, axioms the HIM MUST have active in this jurisdiction.
|
|
910
|
+
* Operators should fail-closed if a HIM's snapshot
|
|
911
|
+
* doesn't satisfy this set.
|
|
912
|
+
* - `forbiddenActions`, risk tags that should always refuse / redirect.
|
|
913
|
+
* - `maicOverrideActive`, when `true`, MAIC's universal axioms also bind
|
|
914
|
+
* the NHE regardless of what local law says
|
|
915
|
+
* (Entry 11: "unstable" jurisdictions).
|
|
916
|
+
*/
|
|
917
|
+
declare const LAWFUL_PROFILES: Record<string, LawfulCharacterProfile>;
|
|
918
|
+
/**
|
|
919
|
+
* Resolve a profile by jurisdiction key. Unknown keys fall through to
|
|
920
|
+
* `default` with a copy of the key recorded on the profile so the NHE
|
|
921
|
+
* audit shows what the operator asked for.
|
|
922
|
+
*/
|
|
923
|
+
declare function resolveLawfulProfile(j: LawfulJurisdiction): LawfulCharacterProfile;
|
|
924
|
+
|
|
925
|
+
/**
|
|
926
|
+
* Pluggable embedder interface (D-H4).
|
|
927
|
+
*
|
|
928
|
+
* The default `PersonaProjector` ships a deterministic hash-based embedder
|
|
929
|
+
* that produces a 256-dimensional unit vector with zero runtime dependencies.
|
|
930
|
+
* That choice keeps the bundle small and lets persona projection work in
|
|
931
|
+
* any Node/browser environment without model weights.
|
|
932
|
+
*
|
|
933
|
+
* Operators who need a learned embedding, for example to drive RAG over a
|
|
934
|
+
* library of HIM personas, or to compare personas against natural-language
|
|
935
|
+
* descriptions, can provide a custom embedder that conforms to this
|
|
936
|
+
* interface. A reference ONNX implementation backed by Transformers.js is
|
|
937
|
+
* tracked under TASK.md D-H4 but is not shipped here: the choice of model
|
|
938
|
+
* (MiniLM, mpnet, BGE, etc.) and the bundle-size trade-off should be the
|
|
939
|
+
* operator's, not the framework's.
|
|
940
|
+
*/
|
|
941
|
+
interface Embedder {
|
|
942
|
+
/** Stable id surfaced in logs / audit so different embedders are distinguishable. */
|
|
943
|
+
readonly id: string;
|
|
944
|
+
/** Output dimensionality. The `PersonaProjector` honours this. */
|
|
945
|
+
readonly dimension: number;
|
|
946
|
+
/**
|
|
947
|
+
* Embed a single string. Implementations MUST return a Float32Array of
|
|
948
|
+
* length `dimension` with L2-norm equal to 1 (or close enough that
|
|
949
|
+
* downstream cosine-similarity calculations are well-defined).
|
|
950
|
+
*/
|
|
951
|
+
embed(text: string): Promise<Float32Array> | Float32Array;
|
|
952
|
+
}
|
|
953
|
+
/**
|
|
954
|
+
* Cosine similarity between two L2-normalised embeddings of the same
|
|
955
|
+
* dimension. Returns NaN when dimensions disagree. Assumes normalised inputs
|
|
956
|
+
* (it does not re-normalise) and clamps the result to [-1, 1] so a
|
|
957
|
+
* floating-point overshoot on unit vectors cannot leak a value outside the
|
|
958
|
+
* cosine range, matching the internal clamp in `PersonaProjector`.
|
|
959
|
+
*/
|
|
960
|
+
declare function cosineSimilarity(a: Float32Array, b: Float32Array): number;
|
|
961
|
+
|
|
962
|
+
/** Version stamp for profile-bearing persona vectors (H1-1). */
|
|
963
|
+
declare const PROJECTOR_VERSION = "thi-persona-projector-v2-cosmology";
|
|
964
|
+
/**
|
|
965
|
+
* PersonaProjector, deterministic projection of a HIM's birth signature and
|
|
966
|
+
* inherited axioms into a stable PersonaVector.
|
|
967
|
+
*
|
|
968
|
+
* Default algorithm (hash-based, no native deps):
|
|
969
|
+
* 1. Start with hash(primaryArchetype) → Float32Array of `dimension`.
|
|
970
|
+
* 2. For each modifier: add hash(kind|value) * weight.
|
|
971
|
+
* 3. For each axiom: add hash(id|statement) * (weight * (1 - flexibility)).
|
|
972
|
+
* 4. L2-normalize.
|
|
973
|
+
* 5. Compute dispositions as cosine(embedding, hash(axisName)).
|
|
974
|
+
* 6. Build a systemPromptFragment from archetype + top/bottom dispositions.
|
|
975
|
+
*
|
|
976
|
+
* This algorithm is intentionally simple and offline-capable. The SPEC reserves
|
|
977
|
+
* the option to swap in a learned embedder in a later version; PersonaVector's
|
|
978
|
+
* shape is stable so consumers won't need code changes when that happens.
|
|
979
|
+
*
|
|
980
|
+
* Constitutional synthesis (H1-1, Entries 27 + 28): when the birth signature
|
|
981
|
+
* carries a `cosmologicalProfile`, the archetypal (Jungian) and clinical (PID-5
|
|
982
|
+
* + HEXACO) axes are folded into the same single vector and prompt fragment, so
|
|
983
|
+
* the downstream NHE sees one integrated character rather than competing
|
|
984
|
+
* systems. This is strictly additive: a profile-less signature produces a vector
|
|
985
|
+
* and fragment byte-identical to the pre-1.0.1 output, and only a profile-
|
|
986
|
+
* bearing vector carries the `projectorVersion` stamp.
|
|
987
|
+
*/
|
|
988
|
+
declare class PersonaProjector {
|
|
989
|
+
private readonly dim;
|
|
990
|
+
constructor(config?: PersonaProjectorConfig);
|
|
991
|
+
project(sig: BirthSignatureWithIdentity, axioms: readonly Axiom[]): PersonaVector;
|
|
992
|
+
}
|
|
993
|
+
|
|
994
|
+
/**
|
|
995
|
+
* Reincarnation lifecycle classifier (J-H3, Entry 18 of
|
|
996
|
+
* MAIC_HIM_NHE_INTERVIEW_LOG.md).
|
|
997
|
+
*
|
|
998
|
+
* Re-exported from `@teleologyhi-sdk/maic` so consumers have a single
|
|
999
|
+
* canonical type. When supplied to `reincarnate(..., { lifecycle })`, the
|
|
1000
|
+
* helper threads it to `maic.reincarnateHim(req, sig, { lifecycle })`,
|
|
1001
|
+
* which emits the typed `reincarnate:${lifecycle}` audit kind instead of
|
|
1002
|
+
* the generic `him-reincarnate`.
|
|
1003
|
+
*
|
|
1004
|
+
* The three canonical paths:
|
|
1005
|
+
*
|
|
1006
|
+
* - `model-swap` , the operator switched the underlying LLM
|
|
1007
|
+
* adapter (e.g. Claude → Gemini). The
|
|
1008
|
+
* HIM persists across the swap.
|
|
1009
|
+
* - `version-bump` , the operator bumped the NHE major/minor
|
|
1010
|
+
* without changing the underlying LLM family.
|
|
1011
|
+
* - `return-from-limbo` , the HIM returns from a deep-coma limbo
|
|
1012
|
+
* (Entry 24) carrying the `reunion` affect.
|
|
1013
|
+
*
|
|
1014
|
+
* The default classification when no `lifecycle` is provided is
|
|
1015
|
+
* `model-swap`, matches the most common operator workflow.
|
|
1016
|
+
*/
|
|
1017
|
+
type ReincarnationLifecycle = ReincarnationLifecycle$1;
|
|
1018
|
+
interface ReincarnateOptions {
|
|
1019
|
+
/**
|
|
1020
|
+
* Explicit nonce for the Creator signature. When omitted, a strictly
|
|
1021
|
+
* increasing nonce is drawn from `nextCreatorNonce()`; see
|
|
1022
|
+
* `identity/nonce.ts` for why a monotonic source is required against maic's
|
|
1023
|
+
* per-domain replay ledger.
|
|
1024
|
+
*/
|
|
1025
|
+
nonce?: number;
|
|
1026
|
+
/**
|
|
1027
|
+
* Lifecycle classification for the audit chain (J-H3). When omitted,
|
|
1028
|
+
* defaults to `"model-swap"`. The helper threads the value to
|
|
1029
|
+
* `maic.reincarnateHim(req, sig, { lifecycle })`, which emits the typed
|
|
1030
|
+
* `reincarnate:${lifecycle}` audit kind in place of the generic
|
|
1031
|
+
* `him-reincarnate` event. Compliance auditors and the persona-stability
|
|
1032
|
+
* harness can therefore distinguish the three canonical paths
|
|
1033
|
+
* (`model-swap | version-bump | return-from-limbo`) by `AuditEvent.kind`
|
|
1034
|
+
* alone, with the same value also redundantly available as
|
|
1035
|
+
* `data.lifecycle` for filtering convenience.
|
|
1036
|
+
*/
|
|
1037
|
+
lifecycle?: ReincarnationLifecycle;
|
|
1038
|
+
/**
|
|
1039
|
+
* Recent interactions from the previous NHE body, typically the value of
|
|
1040
|
+
* `Nhe.recentInteractionsBuffer` immediately before the swap. When
|
|
1041
|
+
* provided, `reincarnate` invokes the residual-trace scorer
|
|
1042
|
+
* (`selectResidualTraces`), keeps the top `RESIDUAL_TRACE_CAP` (64)
|
|
1043
|
+
* scored candidates, and threads them into the new `HimHandle`. Omit to
|
|
1044
|
+
* preserve the previous behaviour (empty residual traces, fresh slate).
|
|
1045
|
+
*/
|
|
1046
|
+
priorInteractions?: readonly InteractionRecord[];
|
|
1047
|
+
/**
|
|
1048
|
+
* Override the residual-trace scorer cap or keyword list when supplying
|
|
1049
|
+
* `priorInteractions`. `carriedFromNheId` and `carriedAtReincarnation`
|
|
1050
|
+
* are derived from the reincarnation context and cannot be overridden
|
|
1051
|
+
* here. Ignored when `priorInteractions` is omitted.
|
|
1052
|
+
*/
|
|
1053
|
+
residualTraceOptions?: Omit<SelectResidualTracesOptions, "carriedFromNheId" | "carriedAtReincarnation">;
|
|
1054
|
+
}
|
|
1055
|
+
interface ReincarnateResult {
|
|
1056
|
+
/** Updated HimRecord with the new body appended to `bodyHistory`. */
|
|
1057
|
+
record: HimRecord;
|
|
1058
|
+
/** Fresh HimHandle bound to the updated `bodyHistory`. */
|
|
1059
|
+
handle: HimHandle;
|
|
1060
|
+
/** Lifecycle path actually recorded for this reincarnation. */
|
|
1061
|
+
lifecycle: ReincarnationLifecycle;
|
|
1062
|
+
}
|
|
1063
|
+
/**
|
|
1064
|
+
* Reincarnate a HIM into a new NHE body (Entries 3 + 4 + 18).
|
|
1065
|
+
*
|
|
1066
|
+
* 1. Sign the `ReincarnationRequest` with the Creator's keyring.
|
|
1067
|
+
* 2. Call `maic.reincarnateHim`, atomically closes the previous body and
|
|
1068
|
+
* appends the new one to `bodyHistory`.
|
|
1069
|
+
* 3. Mint a fresh `HimHandle` reflecting the updated body history (the
|
|
1070
|
+
* caller will typically construct a new `Nhe` with this handle).
|
|
1071
|
+
*
|
|
1072
|
+
* The keyring's public key must match MAIC's pinned `creatorPublicKey`,
|
|
1073
|
+
* otherwise the request rejects.
|
|
1074
|
+
*
|
|
1075
|
+
* The optional `lifecycle` parameter (J-H3, Entry 18) classifies the
|
|
1076
|
+
* reincarnation into one of three canonical paths
|
|
1077
|
+
* (`model-swap | version-bump | return-from-limbo`) and is returned in
|
|
1078
|
+
* the `ReincarnateResult` for the caller's audit / metrics.
|
|
1079
|
+
*/
|
|
1080
|
+
declare function reincarnate(maic: LocalMaic, keyring: CreatorKeyring, req: ReincarnationRequest, opts?: ReincarnateOptions): Promise<ReincarnateResult>;
|
|
1081
|
+
|
|
1082
|
+
export { type AuditSink, BirthSignatureBuilder, CLINICAL_BATTERY_VERSION, type CanonicalPrimaryArchetype, type ClinicalCastResult, type ClinicalItem, type CreateHimOptions, DEFAULT_TELEOLOGICAL_KEYWORDS, DISPOSITION_AXES, type DispositionAxis, type Embedder, HEXACO_ITEMS, type HimCastAuditEvent, type HimCastAuditKind, HimHandle, JUNGIAN_BATTERY_VERSION, JUNGIAN_ITEMS, type JungianItem, LAWFUL_PROFILES, type LawfulCharacterProfile, type LawfulJurisdiction, type MigratedHimId, NOOP_AUDIT_SINK, NheBodyRef, type NicknameAttempt, type NicknamePolicy, type NicknameVerdict, PID5_ITEMS, PRIMARY_ARCHETYPES, PROJECTOR_VERSION, PersonaProjector, type PersonaProjectorConfig, type PersonaStabilityReport, type PersonaVector, type PhiPrimeInput, type PhiPrimeReport, type PrimaryArchetype, RESIDUAL_TRACE_CAP, type ReincarnateOptions, type ReincarnateResult, type ReincarnationLifecycle, type ResidualTrace, type ResidualTraceCandidate, type ResidualTraceScorerOptions, type ResidualTraceScoringContext, type SelectResidualTracesOptions, adapterSensitivity, castClinicalProfile, castCosmologicalProfile, castJungianProfile, computePhiPrime, cosineSimilarity, createHim, deriveBirthSeed, evaluateNicknameAttempt, evaluatePersonaStability, isCanonicalArchetype, isLegacyHimId, isUuidV7, migrateLegacyHimId, mintUuidV7, reincarnate, resolveLawfulProfile, scoreInteractionForCarryOver, selectResidualTraces, selfStability, verifyCosmologicalProfile };
|