@nhtio/adk/common
Core value classes, runtime primitives, media helpers, and their companion input types.
Remarks
A convenience barrel that re-exports the data primitives most consumers reach for: the value classes (@nhtio/adk!Tokenizable, @nhtio/adk!Registry, @nhtio/adk!Identity, @nhtio/adk!Memory, @nhtio/adk!Message, @nhtio/adk!Thought, @nhtio/adk!ToolCall, @nhtio/adk!Tool, @nhtio/adk!ToolRegistry, and the spooled artifact family) plus their Raw* constructor inputs and small companion types. @nhtio/adk!TurnGate is exported as a type only — it is constructed internally by the runner and only surfaced to observers, never instantiated by user code.
Use this barrel when you want one import for the everyday primitives without pulling the runners or context surfaces. Per-class barrels remain available when you want narrower imports.
Classes
| Class | Description |
|---|---|
| Identity | An immutable, validated participant identity attached to a @nhtio/adk!Message. |
| Media | Lazy, re-openable view over a binary asset (image, audio, video, document). |
| Memory | An immutable, validated memory entry held by the agent. |
| Message | An immutable, validated conversation message from a human participant or the model. |
| Registry | A controlled-mutation key-value store with dot-path access and deep-clone isolation. |
| Retrievable | An immutable, validated retrieved record (RAG content) held by the agent. |
| Thought | An immutable, validated internal reasoning trace produced by an agent. |
| Tokenizable | A mutable string with a built-in token counter. |
Interfaces
| Interface | Description |
|---|---|
| ByteStore | Unified "give bytes, get a reader" persistence contract. |
| MediaReader | Re-openable byte source contract for a Media instance. |
| MediaStashEntry | Per-entry shape stored in a Media's stash register. |
| MergeOptions | Options accepted by ToolRegistry.merge. |
| RawIdentity | Plain input object supplied to Identity at construction time. |
| RawMedia | Plain input object supplied to Media at construction time. |
| RawMemory | Plain input object supplied to Memory at construction time. |
| RawMessage | Plain input object supplied to Message at construction time. |
| RawRetrievable | Plain input object supplied to Retrievable at construction time. |
| RawThought | Plain input object supplied to Thought at construction time. |
| RawTurnGate | Plain input object supplied to TurnGate at construction time. |
| ReaderDescriptor | A tagged, serialisable description of where a reader's bytes live — never the bytes themselves. |
| SerializedMedia | The plain-object, JSON-safe form of a Media produced by Media.toJSON. |
| ToolMethodDescriptor | Metadata table entry for one of the artifact's existing query methods, used by SpooledArtifact.forgeTools to surface that method as an @nhtio/adk!ArtifactTool. |
| TurnGate | A cooperative suspension gate that blocks a turn's middleware pipeline until resolved, rejected, aborted, or timed out. |
Type Aliases
| Type Alias | Description |
|---|---|
| LocatorValue | A JSON-shaped value a reader descriptor's locator may carry. |
| MediaKind | The set of supported media kinds. |
| MediaKind | Union of all recognised media kind identifier strings. |
| MediaModalityHazard | Modality-hazard axis. How dangerous is it to let the model decode these bytes? |
| MediaModalityHazard | Modality-hazard axis. How dangerous is it to let the model decode these bytes? |
| MediaReaderResolver | A factory that re-binds a descriptor's locator to a live MediaReader. |
| MediaStore | A ByteStore that hands out binary-streamed readers (@nhtio/adk!MediaReader). |
| MediaTrustTier | Provenance axis. Who is the framework willing to vouch for as the source of these bytes? |
| MediaTrustTier | Provenance axis. Who is the framework willing to vouch for as the source of these bytes? |
| MessageRole | The roles a Message author can hold. |
| RetrievableTrustTier | Trust-tier discriminator declared by the retrieval middleware at construction time. Drives which envelope the LLM battery wraps the record in. |
| SpoolReaderResolver | A factory that re-binds a descriptor's locator to a live SpoolReader. |
| SpoolStore | A ByteStore that hands out line-indexed text readers (@nhtio/adk!SpoolReader). |
| TokenEncoding | Union of all recognised token encoding identifier strings. |
| ToolCallResults | Union of every shape a ToolCall.results field may carry. |
Variables
| Variable | Description |
|---|---|
| byteStoreSchema | Validator schema used to validate a ByteStore value. |
| MEDIA_READER_TAG_FETCH | Resolver tag for the fetch-backed media reader handle. The locator captures the URL (and any fetch init) so decode can re-issue the request — no live binding to re-inject. |
| MEDIA_READER_TAG_IN_MEMORY | Resolver tag for the in-memory media reader handle. The locator inlines the bytes as base64 because an in-memory reader owns its buffer outright — there is no external store to point at. |
| mediaReaderSchema | Validator schema used to validate a MediaReader value. |
| TokenEncoding | The set of supported token encoding identifiers. |
Functions
| Function | Description |
|---|---|
| decodeBase64 | Decode a base64 string back into a Uint8Array. |
| encodeBase64 | Encode a Uint8Array as a base64 string. |
| fromFetch | Constructs a @nhtio/adk!MediaReader backed by a fetch call. |
| fromWebFile | Constructs a @nhtio/adk!MediaReader backed by a browser File or Blob. |
| implementsByteStore | Returns true if value implements the ByteStore interface. |
| implementsMediaReader | Returns true if value implements the MediaReader interface. |
| inMemoryMediaReader | Constructs a @nhtio/adk!MediaReader backed by an in-memory Uint8Array. |
| isMedia | Returns true if value is a Media instance. |
| registerMediaReaderResolver | Register (or replace) the resolver that re-binds a media: reader handle on decode. |
| registerSpoolReaderResolver | Register (or replace) the resolver that re-binds a spool: reader handle on decode. |
| resolveMediaReader | Re-bind a media reader descriptor to a live MediaReader. |
| resolveSpoolReader | Re-bind a spool reader descriptor to a live SpoolReader. |
References
ArtifactTool
Re-exports ArtifactTool
ArtifactToolHandler
Re-exports ArtifactToolHandler
implementsSpoolReader
Re-exports implementsSpoolReader
JsonArtifactFormat
Re-exports JsonArtifactFormat
MarkdownCodeEntry
Re-exports MarkdownCodeEntry
MarkdownHeadingEntry
Re-exports MarkdownHeadingEntry
MarkdownSection
Re-exports MarkdownSection
RawArtifactTool
Re-exports RawArtifactTool
RawTool
Re-exports RawTool
RawToolCall
Re-exports RawToolCall
SpooledArtifact
Re-exports SpooledArtifact
SpooledArtifactConstructor
Re-exports SpooledArtifactConstructor
SpooledJsonArtifact
Re-exports SpooledJsonArtifact
SpooledMarkdownArtifact
Re-exports SpooledMarkdownArtifact
SpoolReader
Re-exports SpoolReader
Tool
Re-exports Tool
ToolCall
Re-exports ToolCall
ToolHandler
Re-exports ToolHandler
ToolRegistry
Re-exports ToolRegistry