Skip to content
4 min read · 810 words

@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

ClassDescription
IdentityAn immutable, validated participant identity attached to a @nhtio/adk!Message.
MediaLazy, re-openable view over a binary asset (image, audio, video, document).
MemoryAn immutable, validated memory entry held by the agent.
MessageAn immutable, validated conversation message from a human participant or the model.
RegistryA controlled-mutation key-value store with dot-path access and deep-clone isolation.
RetrievableAn immutable, validated retrieved record (RAG content) held by the agent.
ThoughtAn immutable, validated internal reasoning trace produced by an agent.
TokenizableA mutable string with a built-in token counter.

Interfaces

InterfaceDescription
MediaReaderRe-openable byte source contract for a Media instance.
MediaStashEntryPer-entry shape stored in a Media's stash register.
MergeOptionsOptions accepted by ToolRegistry.merge.
RawIdentityPlain input object supplied to Identity at construction time.
RawMediaPlain input object supplied to Media at construction time.
RawMemoryPlain input object supplied to Memory at construction time.
RawMessagePlain input object supplied to Message at construction time.
RawRetrievablePlain input object supplied to Retrievable at construction time.
RawThoughtPlain input object supplied to Thought at construction time.
RawTurnGatePlain input object supplied to TurnGate at construction time.
SerializedMediaShape returned by Media.toJSON. Metadata-only — bytes and the reader are stripped so naive event/log serialisation never materialises bytes.
ToolMethodDescriptorMetadata table entry for one of the artifact's existing query methods, used by SpooledArtifact.forgeTools to surface that method as an @nhtio/adk!ArtifactTool.
TurnGateA cooperative suspension gate that blocks a turn's middleware pipeline until resolved, rejected, aborted, or timed out.

Type Aliases

Type AliasDescription
MediaKindThe set of supported media kinds.
MediaKindUnion of all recognised media kind identifier strings.
MediaModalityHazardModality-hazard axis. How dangerous is it to let the model decode these bytes?
MediaModalityHazardModality-hazard axis. How dangerous is it to let the model decode these bytes?
MediaTrustTierProvenance axis. Who is the framework willing to vouch for as the source of these bytes?
MediaTrustTierProvenance axis. Who is the framework willing to vouch for as the source of these bytes?
MessageRoleThe roles a Message author can hold.
RetrievableTrustTierTrust-tier discriminator declared by the retrieval middleware at construction time. Drives which envelope the LLM battery wraps the record in.
TokenEncodingUnion of all recognised token encoding identifier strings.
ToolCallResultsUnion of every shape a ToolCall.results field may carry.

Variables

VariableDescription
mediaReaderSchemaValidator schema used to validate a MediaReader value.
TokenEncodingThe set of supported token encoding identifiers.

Functions

FunctionDescription
fromFetchConstructs a @nhtio/adk!MediaReader backed by a fetch call.
fromWebFileConstructs a @nhtio/adk!MediaReader backed by a browser File or Blob.
implementsMediaReaderReturns true if value implements the MediaReader interface.
inMemoryMediaReaderConstructs a @nhtio/adk!MediaReader backed by an in-memory Uint8Array.
isMediaReturns true if value is a Media instance.

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