Class: Identity
An immutable, validated participant identity attached to a @nhtio/adk!Message.
Remarks
Carries two distinct representations of the same participant: identifier is the system-facing key (e.g. a database ID) used to correlate messages programmatically; representation is what the model sees when it needs to distinguish between participants sharing the same role. The representation is always a @nhtio/adk!Tokenizable so token cost can be estimated inline.
Constructors
Constructor
new Identity(raw: RawIdentity): Identity;Parameters
| Parameter | Type | Description |
|---|---|---|
raw | RawIdentity | The raw identity input validated against rawIdentitySchema. |
Returns
Identity
Throws
@nhtio/adk!E_INVALID_INITIAL_IDENTITY_VALUE when raw does not satisfy the schema.
Properties
| Property | Modifier | Type | Default value | Description |
|---|---|---|---|---|
identifier | readonly | string | number | undefined | The system-facing identifier for this participant — never sent to the model directly. |
representation | readonly | Tokenizable | undefined | How this participant is presented to the model, as a @nhtio/adk!Tokenizable for inline token estimation. |
schema | static | ObjectSchema<RawIdentity> | rawIdentitySchema | Validator schema that accepts a RawIdentity object. Remarks Reusable fragment for any schema that needs to validate or nest an identity — for example, as a required field inside a message schema. |
Methods
isIdentity()
static isIdentity(value: unknown): value is Identity;Returns true if value is an Identity instance.
Parameters
| Parameter | Type | Description |
|---|---|---|
value | unknown | The value to test. |
Returns
value is Identity
true when value is an Identity instance.
Remarks
Uses @nhtio/adk!isInstanceOf for cross-realm safety — instanceof would fail for instances created in a different module copy or VM context.