{"version":3,"file":"thought-CxSaF6Xf.mjs","names":["#identifier","#representation","#id","#content","#confidence","#importance","#createdAt","#updatedAt","#id","#role","#content","#attachments","#identity","#createdAt","#updatedAt","#id","#content","#identity","#payload","#replayCompatibility","#createdAt","#updatedAt"],"sources":["../src/lib/classes/identity.ts","../src/lib/classes/memory.ts","../src/lib/classes/message.ts","../src/lib/classes/thought.ts"],"sourcesContent":["import { Tokenizable } from './tokenizable'\nimport { validator } from '@nhtio/validation'\nimport { validateOrThrow } from '../utils/validation'\nimport { isInstanceOf, isError, isObject } from '../utils/guards'\nimport { ENCODE_METHOD, DECODE_METHOD } from '../utils/encoder_symbols'\nimport { E_INVALID_INITIAL_IDENTITY_VALUE } from '../exceptions/runtime'\nimport type { AdkEncodableSnapshot } from './encodable'\n\n/**\n * Plain input object supplied to {@link Identity} at construction time.\n *\n * @remarks\n * Validated against `rawIdentitySchema` before the `Identity` instance is created.\n */\nexport interface RawIdentity {\n  /**\n   * The system-facing identifier for this participant.\n   *\n   * @remarks\n   * Used internally to correlate messages to a specific participant — e.g. a database ID or\n   * a username. Never sent to the model directly; use `representation` for that.\n   */\n  identifier: string | number\n  /**\n   * How this participant should be presented to the model.\n   *\n   * @remarks\n   * Accepts a plain string or an existing {@link @nhtio/adk!Tokenizable} instance. This is what the model\n   * sees when it needs to distinguish between participants of the same role.\n   */\n  representation: string | Tokenizable\n}\n\n/**\n * A fully-resolved {@link RawIdentity} where `representation` has been normalised to a\n * {@link @nhtio/adk!Tokenizable} instance.\n *\n * @remarks\n * Used internally by the {@link Identity} constructor to assign private fields with\n * guaranteed types.\n */\ninterface ResolvedIdentity {\n  identifier: string | number\n  representation: Tokenizable\n}\n\n/**\n * Validator schema used to validate a {@link RawIdentity} before constructing an {@link Identity}.\n *\n * @remarks\n * Validates both fields of {@link RawIdentity}:\n * - `identifier` — required string or number.\n * - `representation` — required string or {@link @nhtio/adk!Tokenizable}, via {@link @nhtio/adk!Tokenizable.schema}.\n *\n * Throws {@link @nhtio/adk!E_INVALID_INITIAL_IDENTITY_VALUE} (via the {@link Identity} constructor) when\n * validation fails.\n */\nconst rawIdentitySchema = validator.object<RawIdentity>({\n  identifier: validator.alternatives(validator.string(), validator.number()).required(),\n  representation: Tokenizable.schema.required(),\n})\n\n/**\n * Registry of every {@link Identity} genuinely constructed by this module, in this realm.\n *\n * @remarks\n * The brand that {@link identityOrRawIdentitySchema} trusts to bypass raw-object validation. A\n * {@link WeakSet} keyed by the instance is unforgeable (unlike {@link Identity.isIdentity}, which\n * falls back to a `constructor.name` comparison for cross-realm reach and therefore also accepts a\n * hand-rolled look-alike) and holds no strong reference. Every instance adds itself in the\n * constructor; membership means the instance carries real, intact private fields.\n */\nconst liveIdentities = new WeakSet<object>()\n\n/**\n * Public schema fragment that accepts either a plain {@link RawIdentity} object or an existing\n * {@link Identity} instance.\n *\n * @remarks\n * A genuinely-constructed live {@link Identity} passes through the custom branch UNCHANGED — mirroring\n * {@link @nhtio/adk!Tokenizable.schema}. This matters because Joi's object schema *clones* any value it\n * validates, and cloning an `Identity` produces a look-alike with the right prototype but no private\n * `#identifier` / `#representation` fields (the constructor never ran), which then throws on\n * `[ENCODE_METHOD]`. Returning the live instance verbatim keeps its private state intact so it encodes\n * and re-wraps losslessly.\n *\n * Only a **branded** instance (one this module actually constructed — see {@link liveIdentities})\n * bypasses validation. A bare `constructor.name === 'Identity'` is NOT enough: a look-alike or a\n * cross-realm instance is not in the brand set, so it falls through to {@link rawIdentitySchema},\n * which validates its fields (rejecting a malformed `representation`) rather than retaining an\n * unvalidated husk that would later produce invalid serialized state. Plain {@link RawIdentity}\n * objects fall through the same way.\n */\nconst identityOrRawIdentitySchema = validator\n  .alternatives(\n    validator.custom((value, helpers) => {\n      if (isObject(value) && liveIdentities.has(value)) {\n        return value\n      }\n      return helpers.error('any.invalid')\n    }),\n    rawIdentitySchema\n  )\n  .custom((value) => {\n    // A genuinely-branded live instance passes through the first alternative untouched. Anything\n    // else — a plain RawIdentity, a hand-rolled look-alike, or a FOREIGN/cross-realm `Identity`\n    // (a second copy of the package in the dependency tree) — arrives here as the field-validated\n    // output of `rawIdentitySchema`. Joi cloned it, so a foreign instance is now a husk that still\n    // carries an `Identity`-named prototype but has NO private fields; `Identity.isIdentity` accepts\n    // it (name/prototype fallback) yet `[ENCODE_METHOD]` throws reading the missing privates.\n    // Rebuild any non-branded value into a genuine LOCAL Identity so every consumer stores real,\n    // encodable private state regardless of where the value originated.\n    if (isObject(value) && liveIdentities.has(value)) {\n      return value\n    }\n    return new Identity(value as RawIdentity)\n  })\n\n/**\n * An immutable, validated participant identity attached to a {@link @nhtio/adk!Message}.\n *\n * @remarks\n * Carries two distinct representations of the same participant: `identifier` is the\n * system-facing key (e.g. a database ID) used to correlate messages programmatically;\n * `representation` is what the model sees when it needs to distinguish between participants\n * sharing the same role. The `representation` is always a {@link @nhtio/adk!Tokenizable} so token cost\n * can be estimated inline.\n */\nexport class Identity {\n  /**\n   * Validator schema that accepts a {@link RawIdentity} object OR an existing {@link Identity} instance.\n   *\n   * @remarks\n   * Reusable fragment for any schema that needs to validate or nest an identity — for example,\n   * as a required field inside a message schema. A locally branded {@link Identity} passes through\n   * unchanged (its private state is preserved, so it still encodes losslessly); foreign/cross-realm\n   * identities and plain {@link RawIdentity} values are validated field-by-field and rebuilt locally.\n   * See {@link identityOrRawIdentitySchema}.\n   */\n  public static schema = identityOrRawIdentitySchema\n\n  /**\n   * Returns `true` if `value` is an {@link Identity} instance.\n   *\n   * @remarks\n   * Uses {@link @nhtio/adk!isInstanceOf} for cross-realm safety — `instanceof` would fail for instances\n   * created in a different module copy or VM context.\n   *\n   * @param value - The value to test.\n   * @returns `true` when `value` is an {@link Identity} instance.\n   */\n  public static isIdentity(value: unknown): value is Identity {\n    return isInstanceOf(value, 'Identity', Identity)\n  }\n\n  /**\n   * The system-facing identifier for this participant — never sent to the model directly.\n   */\n  declare readonly identifier: string | number\n\n  /**\n   * How this participant is presented to the model, as a {@link @nhtio/adk!Tokenizable} for inline\n   * token estimation.\n   */\n  declare readonly representation: Tokenizable\n\n  #identifier: string | number\n  #representation: Tokenizable\n\n  /**\n   * @param raw - The raw identity input validated against `rawIdentitySchema`.\n   * @throws {@link @nhtio/adk!E_INVALID_INITIAL_IDENTITY_VALUE} when `raw` does not satisfy the schema.\n   */\n  constructor(raw: RawIdentity) {\n    let resolved: ResolvedIdentity\n    try {\n      resolved = validateOrThrow<ResolvedIdentity>(rawIdentitySchema, raw, true)\n    } catch (err) {\n      throw new E_INVALID_INITIAL_IDENTITY_VALUE({ cause: isError(err) ? err : undefined })\n    }\n    this.#identifier = resolved.identifier\n    this.#representation = Tokenizable.isTokenizable(resolved.representation)\n      ? resolved.representation\n      : new Tokenizable(resolved.representation)\n\n    Object.defineProperties(this, {\n      identifier: {\n        get: () => this.#identifier,\n        enumerable: true,\n        configurable: false,\n      },\n      representation: {\n        get: () => this.#representation,\n        enumerable: true,\n        configurable: false,\n      },\n    })\n\n    // Brand this genuinely-constructed instance so `identityOrRawIdentitySchema` can trust it to\n    // bypass raw-object validation. A look-alike or cross-realm object is never in this set.\n    liveIdentities.add(this)\n  }\n\n  /**\n   * Serialise this Identity into an `@nhtio/encoder` snapshot.\n   *\n   * @remarks\n   * Emits a {@link RawIdentity}-shaped object; `representation` is the live {@link @nhtio/adk!Tokenizable}\n   * instance (the encoder recurses into it). Round-trips via {@link Identity.[DECODE_METHOD]}, which\n   * re-validates through the constructor.\n   *\n   * @returns A {@link RawIdentity}-shaped snapshot.\n   */\n  [ENCODE_METHOD](): AdkEncodableSnapshot {\n    return {\n      identifier: this.#identifier,\n      representation: this.#representation,\n    }\n  }\n\n  /**\n   * Reconstruct an {@link Identity} from an {@link Identity.[ENCODE_METHOD]} snapshot.\n   *\n   * @param data - The snapshot produced by {@link Identity.[ENCODE_METHOD]}.\n   * @returns A fully-validated {@link Identity}.\n   */\n  static [DECODE_METHOD](data: AdkEncodableSnapshot): Identity {\n    return new Identity(data as RawIdentity)\n  }\n}\n","import { Tokenizable } from './tokenizable'\nimport { validator } from '@nhtio/validation'\nimport { validateOrThrow } from '../utils/validation'\nimport { isInstanceOf, isError } from '../utils/guards'\nimport { E_INVALID_INITIAL_MEMORY_VALUE } from '../exceptions/runtime'\nimport { ENCODE_METHOD, DECODE_METHOD } from '../utils/encoder_symbols'\nimport type { DateTime } from 'luxon'\nimport type { AdkEncodableSnapshot } from './encodable'\n\n/**\n * Plain input object supplied to {@link Memory} at construction time.\n *\n * @remarks\n * Validated against `rawMemorySchema` before the `Memory` instance is created.\n * Temporal fields accept any value that Luxon can parse — ISO strings, Unix timestamps,\n * `Date` objects, or existing `DateTime` instances.\n */\nexport interface RawMemory {\n  /** Stable unique identifier for this memory entry. */\n  id: string\n  /** The memory content as a plain string or an existing {@link @nhtio/adk!Tokenizable} instance. */\n  content: string | Tokenizable\n  /** Confidence score in the range `[0, 1]` — how certain the agent is that this memory is accurate. */\n  confidence: number\n  /** Importance score in the range `[0, 1]` — how much weight this memory should carry during retrieval. */\n  importance: number\n  /** When this memory was first recorded. */\n  createdAt: string | number | Date | DateTime\n  /** When this memory was last modified. */\n  updatedAt: string | number | Date | DateTime\n}\n\n/**\n * A fully-resolved {@link RawMemory} where all fields have been validated and temporal values\n * normalised to Luxon `DateTime` instances.\n *\n * @remarks\n * This is the shape returned by `rawMemorySchema` after validation — used internally by the\n * {@link Memory} constructor to assign private fields with guaranteed types.\n */\ninterface ResolvedMemory {\n  id: string\n  content: Tokenizable\n  confidence: number\n  importance: number\n  createdAt: DateTime\n  updatedAt: DateTime\n}\n\n/**\n * Validator schema used to validate a {@link RawMemory} before constructing a {@link Memory}.\n *\n * @remarks\n * Validates all six fields of {@link RawMemory}:\n * - `id` — required non-empty string.\n * - `content` — required string or {@link @nhtio/adk!Tokenizable}, via {@link @nhtio/adk!Tokenizable.schema}.\n * - `confidence` — required number in `[0, 1]`.\n * - `importance` — required number in `[0, 1]`.\n * - `createdAt` / `updatedAt` — required datetime-parseable values, normalised to `DateTime`.\n *\n * Throws {@link @nhtio/adk!E_INVALID_INITIAL_MEMORY_VALUE} (via the {@link Memory} constructor) when\n * validation fails.\n */\nconst rawMemorySchema = validator.object<RawMemory>({\n  id: validator.string().required(),\n  content: Tokenizable.schema.required(),\n  confidence: validator.number().min(0).max(1).required(),\n  importance: validator.number().min(0).max(1).required(),\n  createdAt: validator.datetime().required(),\n  updatedAt: validator.datetime().required(),\n})\n\n/**\n * An immutable, validated memory entry held by the agent.\n *\n * @remarks\n * Constructed from a {@link RawMemory} via `rawMemorySchema`. All temporal fields are\n * normalised to Luxon `DateTime` instances at construction time. The `content` field is\n * always a {@link @nhtio/adk!Tokenizable} so callers can estimate token cost without an additional\n * wrapping step.\n */\nexport class Memory {\n  /**\n   * Validator schema that accepts a {@link RawMemory} object.\n   *\n   * @remarks\n   * Reusable fragment for any schema that needs to validate or nest a memory entry — for\n   * example, a collection schema that holds an array of memories.\n   */\n  public static schema = rawMemorySchema\n\n  /**\n   * Returns `true` if `value` is a {@link Memory} instance.\n   *\n   * @remarks\n   * Uses {@link @nhtio/adk!isInstanceOf} for cross-realm safety — `instanceof` would fail for instances\n   * created in a different module copy or VM context.\n   *\n   * @param value - The value to test.\n   * @returns `true` when `value` is a {@link Memory} instance.\n   */\n  public static isMemory(value: unknown): value is Memory {\n    return isInstanceOf(value, 'Memory', Memory)\n  }\n  /** Stable unique identifier for this memory entry. */\n  declare readonly id: string\n  /** The memory content as a {@link @nhtio/adk!Tokenizable} for inline token estimation. */\n  declare readonly content: Tokenizable\n  /** Confidence score in the range `[0, 1]`. */\n  declare readonly confidence: number\n  /** Importance score in the range `[0, 1]`. */\n  declare readonly importance: number\n  /** When this memory was first recorded. */\n  declare readonly createdAt: DateTime\n  /** When this memory was last modified. */\n  declare readonly updatedAt: DateTime\n\n  #id: string\n  #content: Tokenizable\n  #confidence: number\n  #importance: number\n  #createdAt: DateTime\n  #updatedAt: DateTime\n\n  /**\n   * @param raw - The raw memory input validated against `rawMemorySchema`.\n   * @throws {@link @nhtio/adk!E_INVALID_INITIAL_MEMORY_VALUE} when `raw` does not satisfy the schema.\n   */\n  constructor(raw: RawMemory) {\n    let resolved: ResolvedMemory\n    try {\n      resolved = validateOrThrow<ResolvedMemory>(rawMemorySchema, raw, true)\n    } catch (err) {\n      throw new E_INVALID_INITIAL_MEMORY_VALUE({ cause: isError(err) ? err : undefined })\n    }\n    this.#id = resolved.id\n    this.#content = Tokenizable.isTokenizable(resolved.content)\n      ? resolved.content\n      : new Tokenizable(resolved.content)\n    this.#confidence = resolved.confidence\n    this.#importance = resolved.importance\n    this.#createdAt = resolved.createdAt\n    this.#updatedAt = resolved.updatedAt\n\n    Object.defineProperties(this, {\n      id: {\n        get: () => this.#id,\n        enumerable: true,\n        configurable: false,\n      },\n      content: {\n        get: () => this.#content,\n        enumerable: true,\n        configurable: false,\n      },\n      confidence: {\n        get: () => this.#confidence,\n        enumerable: true,\n        configurable: false,\n      },\n      importance: {\n        get: () => this.#importance,\n        enumerable: true,\n        configurable: false,\n      },\n      createdAt: {\n        get: () => this.#createdAt,\n        enumerable: true,\n        configurable: false,\n      },\n      updatedAt: {\n        get: () => this.#updatedAt,\n        enumerable: true,\n        configurable: false,\n      },\n    })\n  }\n\n  /**\n   * Serialise this Memory into an `@nhtio/encoder` snapshot.\n   *\n   * @remarks\n   * Emits a {@link RawMemory}-shaped object; `content` is the live {@link @nhtio/adk!Tokenizable} and the\n   * temporal fields are live Luxon `DateTime` instances (the encoder recurses into both). Round-trips\n   * via {@link Memory.[DECODE_METHOD]}, which re-validates through the constructor.\n   *\n   * @returns A {@link RawMemory}-shaped snapshot.\n   */\n  [ENCODE_METHOD](): AdkEncodableSnapshot {\n    return {\n      id: this.#id,\n      content: this.#content,\n      confidence: this.#confidence,\n      importance: this.#importance,\n      createdAt: this.#createdAt,\n      updatedAt: this.#updatedAt,\n    }\n  }\n\n  /**\n   * Reconstruct a {@link Memory} from a {@link Memory.[ENCODE_METHOD]} snapshot.\n   *\n   * @param data - The snapshot produced by {@link Memory.[ENCODE_METHOD]}.\n   * @returns A fully-validated {@link Memory}.\n   */\n  static [DECODE_METHOD](data: AdkEncodableSnapshot): Memory {\n    return new Memory(data as RawMemory)\n  }\n}\n","import { Media } from './media'\nimport { Identity } from './identity'\nimport { Tokenizable } from './tokenizable'\nimport { validator } from '@nhtio/validation'\nimport { validateOrThrow } from '../utils/validation'\nimport { isInstanceOf, isError } from '../utils/guards'\nimport { ENCODE_METHOD, DECODE_METHOD } from '../utils/encoder_symbols'\nimport { E_INVALID_INITIAL_MESSAGE_VALUE } from '../exceptions/runtime'\nimport type { DateTime } from 'luxon'\nimport type { RawIdentity } from './identity'\nimport type { AdkEncodableSnapshot } from './encodable'\n\n/**\n * The roles a {@link Message} author can hold.\n *\n * @remarks\n * Restricted to `user` and `assistant` — system instructions, developer directives, and\n * tool results are handled separately and never appear in the persisted message history.\n */\nexport type MessageRole = 'user' | 'assistant'\n\n/**\n * Plain input object supplied to {@link Message} at construction time.\n *\n * @remarks\n * Validated against `rawMessageSchema` before the `Message` instance is created.\n * Temporal fields accept any value that Luxon can parse — ISO strings, Unix timestamps,\n * `Date` objects, or existing `DateTime` instances.\n *\n * At least one of `content` or `attachments` (non-empty) must be present — a message with\n * neither throws {@link @nhtio/adk!E_INVALID_INITIAL_MESSAGE_VALUE}.\n */\nexport interface RawMessage {\n  /** Stable unique identifier for this message. */\n  id: string\n  /** Whether this message is from the human participant or the model. */\n  role: MessageRole\n  /**\n   * The message content as a plain string or an existing {@link @nhtio/adk!Tokenizable} instance.\n   *\n   * @remarks\n   * Optional — but required when `attachments` is absent or empty. The cross-field rule on\n   * `rawMessageSchema` enforces that at least one of `content` or `attachments` is present.\n   */\n  content?: string | Tokenizable\n  /**\n   * Media attachments carried by this message — images, audio, video, documents.\n   *\n   * @remarks\n   * Optional and symmetric across roles: both `user` and `assistant` messages may carry\n   * attachments. Each attachment carries its own `trustTier` and `modalityHazard`, which the\n   * renderer uses to wrap the asset in its own trust envelope independent of the message\n   * envelope. How a renderer orders text vs attachments in the on-the-wire content array is\n   * a renderer-policy concern, not a contract of {@link Message}.\n   */\n  attachments?: Media[]\n  /**\n   * The identity of the participant who authored this message.\n   *\n   * @remarks\n   * Optional. When omitted, the `role` value is used as both the system-facing `identifier`\n   * and the model-facing `representation`. Three accepted forms when provided:\n   * - A plain `string` — used as both `identifier` and `representation`.\n   * - A {@link @nhtio/adk!RawIdentity} object — validated and wrapped into an {@link @nhtio/adk!Identity}.\n   * - An existing {@link @nhtio/adk!Identity} instance — passed through unchanged.\n   */\n  identity?: string | RawIdentity | Identity\n  /** When this message was created. */\n  createdAt: string | number | Date | DateTime\n  /** When this message was last modified. */\n  updatedAt: string | number | Date | DateTime\n}\n\n/**\n * A fully-resolved {@link RawMessage} where temporal fields have been normalised to Luxon\n * `DateTime` instances and `identity` is a validated {@link @nhtio/adk!Identity}.\n *\n * @remarks\n * Used internally by the {@link Message} constructor to assign private fields with\n * guaranteed types.\n */\ninterface ResolvedMessage {\n  id: string\n  role: MessageRole\n  content?: Tokenizable\n  attachments: Media[]\n  identity: string | RawIdentity | Identity\n  createdAt: DateTime\n  updatedAt: DateTime\n}\n\n/**\n * Validator schema used to validate a {@link RawMessage} before constructing a {@link Message}.\n *\n * @remarks\n * Validates all fields of {@link RawMessage}:\n * - `id` — required non-empty string.\n * - `role` — required; must be `'user'` or `'assistant'`.\n * - `content` — optional string or {@link @nhtio/adk!Tokenizable}, via {@link @nhtio/adk!Tokenizable.schema}.\n * - `attachments` — optional array of {@link @nhtio/adk!Media} instances. Defaults to `[]`.\n * - At least one of `content` or `attachments` must be present and non-empty; a message with\n *   neither is invalid.\n * - `identity` — required string, {@link @nhtio/adk!RawIdentity}, or {@link @nhtio/adk!Identity}; a plain string is\n *   mapped to both `identifier` and `representation` automatically.\n * - `createdAt` / `updatedAt` — required datetime-parseable values, normalised to `DateTime`.\n *\n * Throws {@link @nhtio/adk!E_INVALID_INITIAL_MESSAGE_VALUE} (via the {@link Message} constructor) when\n * validation fails.\n */\nconst rawMessageSchema = validator\n  .object<RawMessage>({\n    id: validator.string().required(),\n    role: validator.string().valid('user', 'assistant').required(),\n    content: Tokenizable.schema.optional(),\n    attachments: validator\n      .array()\n      .items(\n        validator\n          .any()\n          .required()\n          .custom((value, helpers) => {\n            if (Media.isMedia(value)) return value\n            return helpers.error('any.invalid')\n          })\n      )\n      .default([]),\n    identity: validator\n      .alternatives(validator.string(), Identity.schema)\n      .default(validator.ref('role')),\n    createdAt: validator.datetime().required(),\n    updatedAt: validator.datetime().required(),\n  })\n  .custom((value, helpers) => {\n    const resolved = value as ResolvedMessage\n    const hasContent = resolved.content !== undefined && resolved.content !== null\n    const hasAttachments = Array.isArray(resolved.attachments) && resolved.attachments.length > 0\n    if (!hasContent && !hasAttachments) {\n      return helpers.error('any.invalid')\n    }\n    return resolved\n  })\n\n/**\n * An immutable, validated conversation message from a human participant or the model.\n *\n * @remarks\n * Covers only `user` and `assistant` roles — system instructions, developer directives, and\n * tool results are not represented here. Constructed from a {@link RawMessage} via\n * `rawMessageSchema`. Temporal fields are normalised to Luxon `DateTime` instances at\n * construction time. Both `content` and `identity.representation` are {@link @nhtio/adk!Tokenizable} so\n * token cost can be estimated inline.\n *\n * A message may carry `content` (text), `attachments` (media), or both. The cross-field rule\n * on `rawMessageSchema` enforces that at least one is present. Downstream code that reaches\n * for `message.content` must handle the attachments-only case where `content` is `undefined`.\n */\nexport class Message {\n  /**\n   * Validator schema that accepts a {@link RawMessage} object.\n   *\n   * @remarks\n   * Reusable fragment for any schema that needs to validate or nest a message entry — for\n   * example, a collection schema that holds an array of messages.\n   */\n  public static schema = rawMessageSchema\n\n  /**\n   * Returns `true` if `value` is a {@link Message} instance.\n   *\n   * @remarks\n   * Uses {@link @nhtio/adk!isInstanceOf} for cross-realm safety — `instanceof` would fail for instances\n   * created in a different module copy or VM context.\n   *\n   * @param value - The value to test.\n   * @returns `true` when `value` is a {@link Message} instance.\n   */\n  public static isMessage(value: unknown): value is Message {\n    return isInstanceOf(value, 'Message', Message)\n  }\n\n  /** Stable unique identifier for this message. */\n  declare readonly id: string\n  /** Whether this message is from the human participant or the model. */\n  declare readonly role: MessageRole\n  /**\n   * The message content as a {@link @nhtio/adk!Tokenizable} for inline token estimation, or `undefined`\n   * for attachments-only messages.\n   *\n   * @remarks\n   * `undefined` when the message was constructed with only `attachments`. Render code that\n   * needs the text portion must guard for the missing case rather than blindly calling\n   * `message.content.toString()`.\n   */\n  declare readonly content: Tokenizable | undefined\n  /**\n   * Media attachments carried by this message.\n   *\n   * @remarks\n   * Always defined as a frozen array — empty when the message has no attachments. Both\n   * `user` and `assistant` messages may carry attachments. Each entry carries its own\n   * `trustTier` and `modalityHazard`; the renderer wraps each in its own trust envelope\n   * independent of the message envelope.\n   */\n  declare readonly attachments: ReadonlyArray<Media>\n  /** The identity of the participant who authored this message. */\n  declare readonly identity: Identity\n  /** When this message was created. */\n  declare readonly createdAt: DateTime\n  /** When this message was last modified. */\n  declare readonly updatedAt: DateTime\n\n  #id: string\n  #role: MessageRole\n  #content: Tokenizable | undefined\n  #attachments: ReadonlyArray<Media>\n  #identity: Identity\n  #createdAt: DateTime\n  #updatedAt: DateTime\n\n  /**\n   * @param raw - The raw message input validated against `rawMessageSchema`.\n   * @throws {@link @nhtio/adk!E_INVALID_INITIAL_MESSAGE_VALUE} when `raw` does not satisfy the schema —\n   *   including the cross-field rule that at least one of `content` or `attachments` must be\n   *   present and non-empty.\n   */\n  constructor(raw: RawMessage) {\n    let resolved: ResolvedMessage\n    try {\n      resolved = validateOrThrow<ResolvedMessage>(rawMessageSchema, raw, true)\n    } catch (err) {\n      throw new E_INVALID_INITIAL_MESSAGE_VALUE({ cause: isError(err) ? err : undefined })\n    }\n    this.#id = resolved.id\n    this.#role = resolved.role\n    this.#content =\n      resolved.content === undefined || resolved.content === null\n        ? undefined\n        : Tokenizable.isTokenizable(resolved.content)\n          ? resolved.content\n          : new Tokenizable(resolved.content)\n    this.#attachments = Object.freeze([...(resolved.attachments ?? [])])\n    const rawIdentity = resolved.identity\n    this.#identity = Identity.isIdentity(rawIdentity)\n      ? rawIdentity\n      : typeof rawIdentity === 'string'\n        ? new Identity({ identifier: rawIdentity, representation: rawIdentity })\n        : new Identity(rawIdentity)\n    this.#createdAt = resolved.createdAt\n    this.#updatedAt = resolved.updatedAt\n\n    Object.defineProperties(this, {\n      id: {\n        get: () => this.#id,\n        enumerable: true,\n        configurable: false,\n      },\n      role: {\n        get: () => this.#role,\n        enumerable: true,\n        configurable: false,\n      },\n      content: {\n        get: () => this.#content,\n        enumerable: true,\n        configurable: false,\n      },\n      attachments: {\n        get: () => this.#attachments,\n        enumerable: true,\n        configurable: false,\n      },\n      identity: {\n        get: () => this.#identity,\n        enumerable: true,\n        configurable: false,\n      },\n      createdAt: {\n        get: () => this.#createdAt,\n        enumerable: true,\n        configurable: false,\n      },\n      updatedAt: {\n        get: () => this.#updatedAt,\n        enumerable: true,\n        configurable: false,\n      },\n    })\n  }\n\n  /**\n   * Serialise this Message into an `@nhtio/encoder` snapshot.\n   *\n   * @remarks\n   * Emits a {@link RawMessage}-shaped object holding the live nested primitives — `content`\n   * ({@link @nhtio/adk!Tokenizable}), `attachments` ({@link @nhtio/adk!Media}[]), `identity`\n   * ({@link @nhtio/adk!Identity}), and Luxon temporal fields — which the encoder recurses into. A\n   * text-only message round-trips trivially; a message carrying {@link @nhtio/adk!Media} round-trips only\n   * if each attachment's reader is describable (a `fromWebFile`-backed attachment throws\n   * {@link @nhtio/adk!E_READER_NOT_DESCRIBABLE} at encode). The frozen attachments array is copied to a\n   * plain array for the snapshot. Round-trips via {@link Message.[DECODE_METHOD]}.\n   *\n   * @returns A {@link RawMessage}-shaped snapshot.\n   */\n  [ENCODE_METHOD](): AdkEncodableSnapshot {\n    return {\n      id: this.#id,\n      role: this.#role,\n      content: this.#content,\n      // Omit when empty: the schema's cross-field rule treats a present-but-empty `attachments`\n      // array as invalid (it must contain ≥1 entry when supplied). A text-only message has none.\n      ...(this.#attachments.length > 0 ? { attachments: [...this.#attachments] } : {}),\n      identity: this.#identity,\n      createdAt: this.#createdAt,\n      updatedAt: this.#updatedAt,\n    }\n  }\n\n  /**\n   * Reconstruct a {@link Message} from a {@link Message.[ENCODE_METHOD]} snapshot.\n   *\n   * @param data - The snapshot produced by {@link Message.[ENCODE_METHOD]}.\n   * @returns A fully-validated {@link Message}.\n   */\n  static [DECODE_METHOD](data: AdkEncodableSnapshot): Message {\n    return new Message(data as RawMessage)\n  }\n}\n","import { Identity } from './identity'\nimport { Tokenizable } from './tokenizable'\nimport { validator } from '@nhtio/validation'\nimport { validateOrThrow } from '../utils/validation'\nimport { isInstanceOf, isError } from '../utils/guards'\nimport { ENCODE_METHOD, DECODE_METHOD } from '../utils/encoder_symbols'\nimport { E_INVALID_INITIAL_THOUGHT_VALUE } from '../exceptions/runtime'\nimport type { DateTime } from 'luxon'\nimport type { RawIdentity } from './identity'\nimport type { AdkEncodableSnapshot } from './encodable'\n\n/**\n * Plain input object supplied to {@link Thought} at construction time.\n *\n * @remarks\n * Validated against `rawThoughtSchema` before the `Thought` instance is created.\n * Temporal fields accept any value that Luxon can parse — ISO strings, Unix timestamps,\n * `Date` objects, or existing `DateTime` instances.\n */\nexport interface RawThought {\n  /** Stable unique identifier for this thought. */\n  id: string\n  /**\n   * The reasoning content as a plain string or an existing {@link @nhtio/adk!Tokenizable} instance.\n   *\n   * @remarks\n   * Required and non-empty in plain-text mode. In opaque mode ({@link RawThought.payload} present) it\n   * may be empty or omitted — the payload carries the meaning — and resolves to an empty\n   * {@link @nhtio/adk!Tokenizable}. `Thought.content` is therefore ALWAYS a `Tokenizable`, never\n   * `undefined`, so readers need no guard.\n   */\n  content?: string | Tokenizable\n  /**\n   * The identity of the agent who produced this thought.\n   *\n   * @remarks\n   * Required in multi-agent conversations to attribute reasoning traces to a specific agent.\n   * Three accepted forms when provided:\n   * - A plain `string` — used as both `identifier` and `representation`.\n   * - A {@link @nhtio/adk!RawIdentity} object — validated and wrapped into an {@link @nhtio/adk!Identity}.\n   * - An existing {@link @nhtio/adk!Identity} instance — passed through unchanged.\n   *\n   * When omitted, defaults to `'assistant'` (both `identifier` and `representation`).\n   */\n  identity?: string | RawIdentity | Identity\n  /**\n   * Optional vendor-opaque payload that round-trips back to a matching model wire.\n   *\n   * @remarks\n   * Carries anything the ADK cannot interpret but a specific provider can — for example,\n   * an Anthropic Messages thinking-block `signature`, an OpenAI Responses\n   * `ResponseReasoningItem.encrypted_content` blob, a DeepSeek server-side reasoning handle,\n   * or an MCP-mediated reasoning item.\n   *\n   * When present, an LLM battery MUST treat the thought as **opaque-mode**: do NOT inline\n   * `content` through the plain `<thought>` envelope; serialise `payload` back to the wire in\n   * whichever shape the matching {@link RawThought.replayCompatibility} identifier specifies.\n   * The plain-text `content` is kept alongside for token-accounting and human/observer\n   * inspection — it is not the thing the model sees.\n   *\n   * Cross-field invariant: a present `payload` REQUIRES a present {@link RawThought.replayCompatibility}.\n   * A `payload` without `replayCompatibility` is malformed (the ADK has no way to know\n   * which adapter can consume it) and {@link Thought.schema} rejects with\n   * {@link @nhtio/adk!E_INVALID_INITIAL_THOUGHT_VALUE}.\n   *\n   * @defaultValue `undefined`\n   */\n  payload?: unknown\n  /**\n   * Optional free-form identifier describing which adapter wire-shape this thought can be\n   * safely replayed into.\n   *\n   * @remarks\n   * Examples (none of these are reserved by the ADK — they are consumer conventions):\n   *   - `'plain-text'` — replayable into every LLM battery\n   *   - `'anthropic-messages-thinking-v1'`\n   *   - `'openai-responses-reasoning-item-v1'`\n   *   - `'deepseek-reasoning-handle-v1'`\n   *\n   * LLM batteries declare via constructor option which tags they can safely replay; matching\n   * opaque thoughts are routed to the wire's typed reasoning channel where it exists, or to a\n   * documented side-channel key on the request body where the wire has none. Non-matching\n   * opaque thoughts are elided from the current dispatch but NOT removed from\n   * `ctx.turnThoughts` — they remain in context so a subsequent dispatch to a different\n   * adapter that DOES declare the matching tag can pick them up.\n   *\n   * Plain-text thoughts (`payload === undefined` AND `replayCompatibility === undefined`, or\n   * explicit `replayCompatibility: 'plain-text'`) are always replayable.\n   *\n   * A `replayCompatibility` without a `payload` is allowed — it documents intent (\"this\n   * plain-text thought is only meaningful to a specific fine-tuned variant\") without\n   * requiring an opaque blob.\n   *\n   * @defaultValue `undefined`\n   */\n  replayCompatibility?: string\n  /** When this thought was recorded. */\n  createdAt: string | number | Date | DateTime\n  /** When this thought was last modified. */\n  updatedAt: string | number | Date | DateTime\n}\n\n/**\n * A fully-resolved {@link RawThought} where temporal fields have been normalised to Luxon\n * `DateTime` instances.\n *\n * @remarks\n * Used internally by the {@link Thought} constructor to assign private fields with\n * guaranteed types.\n */\ninterface ResolvedThought {\n  id: string\n  content?: string | Tokenizable\n  identity: string | RawIdentity | Identity\n  payload?: unknown\n  replayCompatibility?: string\n  createdAt: DateTime\n  updatedAt: DateTime\n}\n\n/**\n * Validator schema used to validate a {@link RawThought} before constructing a {@link Thought}.\n *\n * @remarks\n * Validates all fields of {@link RawThought}:\n * - `id` — required non-empty string.\n * - `content` — string or {@link @nhtio/adk!Tokenizable}, via {@link @nhtio/adk!Tokenizable.emptyableSchema}.\n *   Required and non-empty in plain-text mode; may be empty or omitted in opaque mode (see the\n *   content-OR-payload rule below).\n * - `identity` — optional string, {@link @nhtio/adk!RawIdentity}, or {@link @nhtio/adk!Identity}; defaults to\n *   `'assistant'` when omitted.\n * - `createdAt` / `updatedAt` — required datetime-parseable values, normalised to `DateTime`.\n *\n * Cross-field rule — a thought must carry meaning through EITHER its prose OR an opaque replay\n * `payload`. A NULLISH payload (`undefined` or `null`) carries no replay data and so counts as ABSENT\n * for both halves of the rule:\n * - `payload` ABSENT (plain-text mode) — `content` is REQUIRED and must be non-empty. The prose is\n *   the only thing the thought has; an empty one is indistinguishable from a bug.\n * - `payload` PRESENT (opaque mode) — `content` may be empty or omitted, and resolves to an empty\n *   {@link @nhtio/adk!Tokenizable}. The payload is what round-trips to the wire; `content` is kept only\n *   for token-accounting and human/observer inspection (see {@link RawThought.payload}), so a\n *   signed-but-textless provider thinking block is legitimate. Rejecting it would discard the\n *   payload's replay data — strictly worse than storing a thought with no prose.\n *\n * A present `payload` additionally REQUIRES a present `replayCompatibility`.\n *\n * Throws {@link @nhtio/adk!E_INVALID_INITIAL_THOUGHT_VALUE} (via the {@link Thought} constructor) when\n * validation fails.\n */\nconst rawThoughtSchema = validator\n  .object<RawThought>({\n    id: validator.string().required(),\n    // Emptiness is adjudicated by the cross-field rule below, which needs to see `payload` to decide.\n    content: Tokenizable.emptyableSchema.optional(),\n    identity: validator.alternatives(validator.string(), Identity.schema).default('assistant'),\n    payload: validator.any().optional(),\n    replayCompatibility: validator.string().min(1).optional(),\n    createdAt: validator.datetime().required(),\n    updatedAt: validator.datetime().required(),\n  })\n  .custom((value, helpers) => {\n    const v = value as RawThought\n    // A NULLISH payload carries no replay data, so it is opaque mode in NEITHER rule below. `null`\n    // reaches here easily — JSON round-tripping, a serializer normalising absent fields, a provider\n    // mapper assigning a nullish thinking block — and treating it as \"present\" would both demand a\n    // pointless `replayCompatibility` and, worse, waive the content requirement for a thought that has\n    // no prose AND no payload: the exact state the either-or exists to forbid.\n    const hasPayload = v.payload !== undefined && v.payload !== null\n    if (hasPayload && (v.replayCompatibility === undefined || v.replayCompatibility === null)) {\n      return helpers.error('any.invalid')\n    }\n    // content-OR-payload: only an opaque thought may go without prose. A Tokenizable counts as\n    // present without being unwrapped — a dynamic one would evaluate its callback just to be measured,\n    // and its emptiness is not knowable until prompt-assembly anyway.\n    if (!hasPayload) {\n      const hasContent = Tokenizable.isTokenizable(v.content)\n        ? true\n        : typeof v.content === 'string' && v.content.length > 0\n      if (!hasContent) {\n        return helpers.error('any.invalid')\n      }\n    }\n    return value\n  })\n\n/**\n * An immutable, validated internal reasoning trace produced by an agent.\n *\n * @remarks\n * Represents an agent's internal thinking — distinct from {@link @nhtio/adk!Message} (which is part of\n * the visible conversation) and never shown to end users directly. Carries an `identity` so\n * reasoning traces can be attributed to a specific agent in multi-agent conversations.\n * Constructed from a {@link RawThought} via `rawThoughtSchema`. The `content` field is always\n * a {@link @nhtio/adk!Tokenizable} so token cost can be estimated inline — including when the raw input\n * omitted it or supplied `''`, which is legal in opaque-replay mode and resolves to an empty\n * {@link @nhtio/adk!Tokenizable}.\n */\nexport class Thought {\n  /**\n   * Validator schema that accepts a {@link RawThought} object.\n   *\n   * @remarks\n   * Reusable fragment for any schema that needs to validate or nest a thought entry.\n   */\n  public static schema = rawThoughtSchema\n\n  /**\n   * Returns `true` if `value` is a {@link Thought} instance.\n   *\n   * @remarks\n   * Uses {@link @nhtio/adk!isInstanceOf} for cross-realm safety — `instanceof` would fail for instances\n   * created in a different module copy or VM context.\n   *\n   * @param value - The value to test.\n   * @returns `true` when `value` is a {@link Thought} instance.\n   */\n  public static isThought(value: unknown): value is Thought {\n    return isInstanceOf(value, 'Thought', Thought)\n  }\n\n  /** Stable unique identifier for this thought. */\n  declare readonly id: string\n  /**\n   * The reasoning content as a {@link @nhtio/adk!Tokenizable} for inline token estimation.\n   *\n   * @remarks\n   * Never `undefined` — an opaque thought constructed without prose carries an empty\n   * {@link @nhtio/adk!Tokenizable} here, so readers need no presence guard.\n   */\n  declare readonly content: Tokenizable\n  /** The identity of the agent who produced this thought. */\n  declare readonly identity: Identity\n  /**\n   * Optional vendor-opaque payload that round-trips back to a matching model wire.\n   * See {@link RawThought.payload}.\n   */\n  declare readonly payload: unknown\n  /**\n   * Optional wire-shape identifier describing which adapter can safely replay this thought.\n   * See {@link RawThought.replayCompatibility}.\n   */\n  declare readonly replayCompatibility: string | undefined\n  /** When this thought was recorded. */\n  declare readonly createdAt: DateTime\n  /** When this thought was last modified. */\n  declare readonly updatedAt: DateTime\n\n  #id: string\n  #content: Tokenizable\n  #identity: Identity\n  #payload: unknown\n  #replayCompatibility: string | undefined\n  #createdAt: DateTime\n  #updatedAt: DateTime\n\n  /**\n   * @param raw - The raw thought input validated against `rawThoughtSchema`.\n   * @throws {@link @nhtio/adk!E_INVALID_INITIAL_THOUGHT_VALUE} when `raw` does not satisfy the schema.\n   */\n  constructor(raw: RawThought) {\n    let resolved: ResolvedThought\n    try {\n      resolved = validateOrThrow<ResolvedThought>(rawThoughtSchema, raw, true)\n    } catch (err) {\n      throw new E_INVALID_INITIAL_THOUGHT_VALUE({ cause: isError(err) ? err : undefined })\n    }\n    this.#id = resolved.id\n    // Absent content is legal only in opaque mode (enforced by rawThoughtSchema). Resolve it to an\n    // EMPTY Tokenizable rather than leaving it undefined so `content` stays a total field — every\n    // reader can call `.toString()` / measure it without a guard.\n    this.#content = Tokenizable.isTokenizable(resolved.content)\n      ? resolved.content\n      : new Tokenizable(resolved.content ?? '')\n    const rawIdentity = resolved.identity\n    this.#identity = Identity.isIdentity(rawIdentity)\n      ? rawIdentity\n      : typeof rawIdentity === 'string'\n        ? new Identity({ identifier: rawIdentity, representation: rawIdentity })\n        : new Identity(rawIdentity)\n    this.#payload = resolved.payload\n    this.#replayCompatibility = resolved.replayCompatibility\n    this.#createdAt = resolved.createdAt\n    this.#updatedAt = resolved.updatedAt\n\n    Object.defineProperties(this, {\n      id: {\n        get: () => this.#id,\n        enumerable: true,\n        configurable: false,\n      },\n      content: {\n        get: () => this.#content,\n        enumerable: true,\n        configurable: false,\n      },\n      identity: {\n        get: () => this.#identity,\n        enumerable: true,\n        configurable: false,\n      },\n      payload: {\n        get: () => this.#payload,\n        enumerable: true,\n        configurable: false,\n      },\n      replayCompatibility: {\n        get: () => this.#replayCompatibility,\n        enumerable: true,\n        configurable: false,\n      },\n      createdAt: {\n        get: () => this.#createdAt,\n        enumerable: true,\n        configurable: false,\n      },\n      updatedAt: {\n        get: () => this.#updatedAt,\n        enumerable: true,\n        configurable: false,\n      },\n    })\n  }\n\n  /**\n   * Serialise this Thought into an `@nhtio/encoder` snapshot.\n   *\n   * @remarks\n   * Emits a {@link RawThought}-shaped object; `content` is the live {@link @nhtio/adk!Tokenizable},\n   * `identity` the live {@link @nhtio/adk!Identity}, and the temporal fields live Luxon `DateTime`s (the\n   * encoder recurses into each). The vendor-opaque `payload` is passed through as-is — if it holds a\n   * value the encoder cannot serialise, encode throws (standard encoder behaviour). Round-trips via\n   * {@link Thought.[DECODE_METHOD]}, which re-validates through the constructor.\n   *\n   * @returns A {@link RawThought}-shaped snapshot.\n   */\n  [ENCODE_METHOD](): AdkEncodableSnapshot {\n    return {\n      id: this.#id,\n      content: this.#content,\n      identity: this.#identity,\n      payload: this.#payload,\n      replayCompatibility: this.#replayCompatibility,\n      createdAt: this.#createdAt,\n      updatedAt: this.#updatedAt,\n    }\n  }\n\n  /**\n   * Reconstruct a {@link Thought} from a {@link Thought.[ENCODE_METHOD]} snapshot.\n   *\n   * @param data - The snapshot produced by {@link Thought.[ENCODE_METHOD]}.\n   * @returns A fully-validated {@link Thought}.\n   */\n  static [DECODE_METHOD](data: AdkEncodableSnapshot): Thought {\n    return new Thought(data as RawThought)\n  }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAyDA,IAAM,oBAAoB,UAAU,OAAoB;CACtD,YAAY,UAAU,aAAa,UAAU,OAAO,GAAG,UAAU,OAAO,CAAC,EAAE,SAAS;CACpF,gBAAgB,YAAY,OAAO,SAAS;AAC9C,CAAC;;;;;;;;;;;AAYD,IAAM,iCAAiB,IAAI,QAAgB;;;;;;;;;;;;;;;;;;;;AAqB3C,IAAM,8BAA8B,UACjC,aACC,UAAU,QAAQ,OAAO,YAAY;CACnC,IAAI,SAAS,KAAK,KAAK,eAAe,IAAI,KAAK,GAC7C,OAAO;CAET,OAAO,QAAQ,MAAM,aAAa;AACpC,CAAC,GACD,iBACF,EACC,QAAQ,UAAU;CASjB,IAAI,SAAS,KAAK,KAAK,eAAe,IAAI,KAAK,GAC7C,OAAO;CAET,OAAO,IAAI,SAAS,KAAoB;AAC1C,CAAC;;;;;;;;;;;AAYH,IAAa,WAAb,MAAa,SAAS;;;;;;;;;;;CAWpB,OAAc,SAAS;;;;;;;;;;;CAYvB,OAAc,WAAW,OAAmC;EAC1D,OAAO,aAAa,OAAO,YAAY,QAAQ;CAC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