Skip to main content
Type contracts exported by this package: interfaces, type aliases, and enums.

LafsExtensionParams

LAFS extension parameters declared in Agent Card
PropertyTypeRequiredDescription
supportsContextLedgerbooleanYesWhether the agent supports context ledger tracking
supportsTokenBudgetsbooleanYesWhether the agent supports token budget enforcement
envelopeSchemastringYesURL of the JSON Schema for the LAFS envelope
kindExtensionKind | undefinedNoClassification of the extension’s behavior.

ExtensionKind

Classification of an A2A extension’s behavior.
ExtensionKind

ExtensionNegotiationResult

Result of extension negotiation between client and agent
PropertyTypeRequiredDescription
requestedstring[]YesURIs requested by the client
activatedstring[]YesURIs that matched agent-declared extensions
unsupportedstring[]YesRequested URIs not declared by the agent (ignored per spec)
missingRequiredstring[]YesAgent-required URIs not present in client request
activatedByKindPartial<Record<ExtensionKind, string[]>>YesActivated extensions grouped by declared kind (when provided)

BuildLafsExtensionOptions

Options for building the LAFS extension declaration
PropertyTypeRequiredDescription
requiredboolean | undefinedNoWhether the LAFS extension is required for all requests.
supportsContextLedgerboolean | undefinedNoWhether the agent supports context ledger tracking.
supportsTokenBudgetsboolean | undefinedNoWhether the agent supports token budget enforcement.
envelopeSchemastring | undefinedNoURL of the JSON Schema for the LAFS envelope.

BuildExtensionOptions

Options for building a generic A2A extension declaration
PropertyTypeRequiredDescription
uristringYesCanonical URI identifying the extension
descriptionstringYesHuman-readable description of what the extension provides
requiredboolean | undefinedNoWhether the extension is required for all requests.
kindExtensionKindYesClassification of the extension’s behavior
paramsRecord<string, unknown> | undefinedNoAdditional parameters to include in the extension declaration.

ExtensionNegotiationMiddlewareOptions

Options for the extension negotiation middleware
PropertyTypeRequiredDescription
extensionsAgentExtension[]YesAgent-declared extensions to negotiate against
enforceRequiredboolean | undefinedNoReturn 400 if required extensions are missing.

AgentProvider

A2A Agent Provider information.
PropertyTypeRequiredDescription
urlstringYesOrganization URL (must be a valid HTTPS URL)
organizationstringYesOrganization name (human-readable label)

AgentCapabilities

A2A Agent Capabilities.
PropertyTypeRequiredDescription
streamingboolean | undefinedNoSupports streaming responses.
pushNotificationsboolean | undefinedNoSupports push notifications.
extendedAgentCardboolean | undefinedNoSupports extended agent card.
extensionsAgentExtension[] | undefinedNoSupported extensions declared by this agent.

AgentExtension

A2A Agent Extension declaration.
PropertyTypeRequiredDescription
uristringYesExtension URI (globally-unique identifier)
descriptionstringYesHuman-readable description of what the extension provides
requiredbooleanYesWhether the extension is required for interoperability
paramsRecord<string, unknown> | undefinedNoExtension-specific parameters.

AgentSkill

A2A Agent Skill.
PropertyTypeRequiredDescription
idstringYesSkill unique identifier (kebab-case recommended)
namestringYesHuman-readable display name
descriptionstringYesDetailed description of what the skill does
tagsstring[]YesKeywords/tags for discovery and categorization
examplesstring[] | undefinedNoExample prompts that demonstrate typical usage.
inputModesstring[] | undefinedNoSupported input modes (overrides agent-level AgentCard.defaultInputModes).
outputModesstring[] | undefinedNoSupported output modes (overrides agent-level AgentCard.defaultOutputModes).

SecurityScheme

Security scheme for authentication (OpenAPI 3.0 style).
PropertyTypeRequiredDescription
type"http" | "apiKey" | "oauth2" | "openIdConnect"YesAuthentication type per OpenAPI 3.0
descriptionstring | undefinedNoHuman-readable description of the scheme.
schemestring | undefinedNoHTTP auth scheme name (e.g., "bearer").
bearerFormatstring | undefinedNoBearer token format hint (e.g., "JWT").

AgentCard

A2A v1.0 Agent Card - Standard format for agent discovery.
PropertyTypeRequiredDescription
$schemastring | undefinedNoJSON Schema URL for validation.
namestringYesHuman-readable agent name
descriptionstringYesDetailed description of agent capabilities
versionstringYesAgent version (SemVer)
urlstringYesBase URL for A2A endpoints
providerAgentProvider | undefinedNoService provider information.
capabilitiesAgentCapabilitiesYesAgent capabilities declaration
defaultInputModesstring[]YesSupported input content types (MIME types)
defaultOutputModesstring[]YesSupported output content types (MIME types)
skillsAgentSkill[]YesAgent skills/capabilities for discovery
securitySchemesRecord<string, SecurityScheme> | undefinedNoSecurity authentication schemes (keyed by scheme name).
securityRecord<string, string[]>[] | undefinedNoRequired security scheme references (OpenAPI 3.0 format).
documentationUrlstring | undefinedNoDocumentation URL for the agent.
iconUrlstring | undefinedNoIcon URL for the agent.

Capability

Deprecated: Use AgentSkill instead.
Legacy capability descriptor.
PropertyTypeRequiredDescription
namestringYesCapability name
versionstringYesCapability version
descriptionstring | undefinedNoHuman-readable description.
operationsstring[]YesSupported operations
optionalboolean | undefinedNoWhether this capability is optional.

ServiceConfig

Deprecated: Use AgentCard instead.
Legacy service configuration.
PropertyTypeRequiredDescription
namestringYesService name
versionstringYesService version
descriptionstring | undefinedNoHuman-readable description.

EndpointConfig

Deprecated: Will be removed in v2.0.0.
Legacy endpoint configuration.
PropertyTypeRequiredDescription
envelopestringYesEnvelope endpoint URL
contextstring | undefinedNoContext endpoint URL.
discoverystringYesDiscovery endpoint URL

DiscoveryDocument

Deprecated: Use AgentCard instead.
Legacy discovery document format.
PropertyTypeRequiredDescription
$schemastringYesJSON Schema URL
lafs_versionstringYesLAFS specification version
serviceServiceConfigYesService configuration
capabilitiesCapability[]YesDeclared capabilities
endpointsEndpointConfigYesEndpoint configuration

DiscoveryConfig

Configuration for the discovery middleware (A2A v1.0 format).
PropertyTypeRequiredDescription
agentOmit<AgentCard, "$schema"> | undefinedNoAgent information (required for A2A v1.0; omit only with legacy service).
baseUrlstring | undefinedNoBase URL for constructing absolute URLs.
cacheMaxAgenumber | undefinedNoCache duration in seconds.
schemaUrlstring | undefinedNoSchema URL override.
headersRecord<string, string> | undefinedNoOptional custom response headers.
autoIncludeLafsExtensionboolean | { required?: boolean; supportsContextLedger?: boolean; supportsTokenBudgets?: boolean; } | undefinedNoAutomatically include LAFS as an A2A extension in Agent Card. Pass true for defaults, or an object to customize parameters.
serviceServiceConfig | undefinedNoLegacy service configuration.
capabilitiesCapability[] | undefinedNoLegacy capabilities list.
endpoints{ envelope: string; context?: string; discovery?: string; } | undefinedNoLegacy endpoint URLs.
lafsVersionstring | undefinedNoLegacy LAFS version override.

DiscoveryMiddlewareOptions

Discovery middleware options.
PropertyTypeRequiredDescription
pathstring | undefinedNoPrimary path to serve Agent Card.
legacyPathstring | undefinedNoLegacy path for backward compatibility.
enableLegacyPathboolean | undefinedNoEnable legacy path support.
enableHeadboolean | undefinedNoEnable HEAD requests.
enableEtagboolean | undefinedNoEnable ETag caching.

TokenEstimatorOptions

Configuration options for the token estimator.
PropertyTypeRequiredDescription
charsPerTokennumber | undefinedNoCharacters per token ratio.
maxDepthnumber | undefinedNoMaximum depth to traverse for circular reference detection.
maxStringLengthnumber | undefinedNoMaximum string length to process for Unicode grapheme counting.

LAFSTransport

Transport protocol used to deliver a LAFS envelope.
LAFSTransport

LAFSErrorCategory

Classification category for a LAFS error.
LAFSErrorCategory

Warning

A non-fatal warning attached to a LAFS envelope’s _meta.warnings array.
PropertyTypeRequiredDescription
codestringYesMachine-readable warning code (e.g. "W_DEPRECATED_FIELD").
messagestringYesHuman-readable description of the warning.
deprecatedstring | undefinedNoName of the deprecated field, parameter, or feature.
replacementstring | undefinedNoRecommended replacement for the deprecated item.
removeBystring | undefinedNoSemver version or ISO date after which the deprecated item will be removed.

MVILevel

Minimum Viable Information level controlling envelope verbosity.
MVILevel

LAFSMeta

Metadata block (_meta) embedded in every LAFS envelope.
PropertyTypeRequiredDescription
specVersionstringYesSemantic version of the LAFS protocol specification (e.g. "1.0.0").
schemaVersionstringYesSemantic version of the JSON Schema used for this envelope (e.g. "1.0.0").
timestampstringYesISO 8601 timestamp of when the envelope was created.
operationstringYesDot-delimited operation identifier (e.g. "tasks.list").
requestIdstringYesUnique identifier for correlating this request/response pair.
transportLAFSTransportYesTransport protocol through which this envelope is delivered.
strictbooleanYesWhen true, schema validation rejects unknown properties.
mviMVILevelYesMinimum Viable Information level controlling field inclusion.
contextVersionnumberYesMonotonically increasing version of the agent’s context ledger.
sessionIdstring | undefinedNoSession identifier for correlating multi-step agent workflows.
warningsWarning[] | undefinedNoNon-fatal warnings to surface to the consuming agent.

LAFSAgentAction

Recommended action an LLM agent should take in response to an error.
LAFSAgentAction

LAFSError

Structured error payload returned in a failing LAFS envelope.
PropertyTypeRequiredDescription
codestringYesStable, machine-readable error code (e.g. "E_NOT_FOUND").
messagestringYesHuman-readable description of the error.
categoryLAFSErrorCategoryYesHigh-level classification of the error.
retryablebooleanYesWhether the operation can be retried without modification.
retryAfterMsnumber | nullYesSuggested delay in milliseconds before retrying, or null if not applicable.
detailsRecord<string, unknown>YesArbitrary key-value pairs with additional context about the error.
agentActionLAFSAgentAction | undefinedNoRecommended action for the consuming agent to take.
escalationRequiredboolean | undefinedNoWhen true, the error requires human intervention or a higher-privilege agent.
suggestedActionstring | undefinedNoFree-text description of a suggested recovery action for the agent.
docUrlstring | undefinedNoURL pointing to documentation about this error code.

LAFSPageCursor

Cursor-based pagination metadata.
PropertyTypeRequiredDescription
mode"cursor"YesDiscriminant identifying cursor-based pagination.
nextCursorstring | nullYesOpaque cursor for fetching the next page, or null when at the end.
hasMorebooleanYesWhether additional pages exist beyond the current one.
limitnumber | undefinedNoMaximum number of items per page.
totalnumber | null | undefinedNoTotal number of items across all pages, or null if unknown.

LAFSPageOffset

Offset-based pagination metadata.
PropertyTypeRequiredDescription
mode"offset"YesDiscriminant identifying offset-based pagination.
limitnumberYesMaximum number of items per page.
offsetnumberYesZero-based index of the first item in this page.
hasMorebooleanYesWhether additional pages exist beyond the current one.
totalnumber | null | undefinedNoTotal number of items across all pages, or null if unknown.

LAFSPageNone

Sentinel pagination mode indicating no pagination is applied.
PropertyTypeRequiredDescription
mode"none"YesDiscriminant indicating no pagination.

LAFSPage

Discriminated union of all supported pagination modes.
LAFSPage

ContextLedgerEntry

A single entry in the context ledger recording one state mutation.
PropertyTypeRequiredDescription
entryIdstringYesUnique identifier for this ledger entry.
timestampstringYesISO 8601 timestamp of when the mutation occurred.
operationstringYesOperation that produced this context change.
contextDeltaRecord<string, unknown>YesKey-value delta describing the context fields that changed.
requestIdstring | undefinedNoRequest identifier that triggered this entry, for tracing.

ContextLedger

Append-only ledger tracking context mutations across agent interactions.
PropertyTypeRequiredDescription
ledgerIdstringYesUnique identifier for this ledger instance.
versionnumberYesMonotonically increasing version incremented on each mutation.
createdAtstringYesISO 8601 timestamp of when the ledger was created.
updatedAtstringYesISO 8601 timestamp of the most recent mutation.
entriesContextLedgerEntry[]YesOrdered list of context mutations from oldest to newest.
checksumstringYesIntegrity checksum of the current ledger state.
maxEntriesnumberYesMaximum number of entries retained before oldest entries are pruned.

LAFSEnvelope

Top-level LAFS response envelope wrapping every operation result.
PropertyTypeRequiredDescription
$schema"https://lafs.dev/schemas/v1/envelope.schema.json"YesJSON Schema URL identifying the envelope schema version.
_metaLAFSMetaYesProtocol and request metadata.
successbooleanYesWhether the operation completed successfully.
resultRecord<string, unknown> | Record<string, unknown>[] | nullYesOperation result payload, or null on failure.
errorLAFSError | null | undefinedNoStructured error payload, or null on success.
pageLAFSPage | null | undefinedNoPagination metadata when the result is a paginated collection.
_extensionsRecord<string, unknown> | undefinedNoVendor or protocol extension data keyed by extension identifier.

FlagInput

Input parameters for resolving the output format via flag semantics.
PropertyTypeRequiredDescription
requestedFormat"json" | "human" | undefinedNoExplicitly requested output format string.
jsonFlagboolean | undefinedNoWhether the --json CLI flag was provided.
humanFlagboolean | undefinedNoWhether the --human CLI flag was provided.
projectDefault"json" | "human" | undefinedNoProject-level default output format from configuration.
userDefault"json" | "human" | undefinedNoUser-level default output format from configuration.
ttyboolean | undefinedNoWhen true, indicates the output is connected to an interactive terminal. If no explicit format flag or project/user default is set, TTY terminals default to "human" format while non-TTY (piped, CI, agents) defaults to "json" per the LAFS protocol. CLI tools should pass process.stdout.isTTY ?? false here.
quietboolean | undefinedNoSuppress non-essential output for scripting. When true, only essential data is returned.

ConformanceReport

Result of a LAFS conformance test run.
PropertyTypeRequiredDescription
okbooleanYestrue if all checks passed; false if any check failed.
checks{ name: string; pass: boolean; detail?: string; }[]NoIndividual conformance check results.

BudgetEnforcementOptions

Options controlling token-budget enforcement behaviour.
BudgetEnforcementOptions

TokenEstimate

Token-count estimate attached to a budget-aware envelope.
PropertyTypeRequiredDescription
estimatednumberYesEstimated token count of the envelope after any truncation.
truncatedboolean | undefinedNoWhether the result was truncated to fit within the budget.
originalEstimatenumber | undefinedNoOriginal estimated token count before truncation, if truncation occurred.

LAFSMetaWithBudget

Extended metadata block that includes an optional token-budget estimate.
PropertyTypeRequiredDescription
_tokenEstimateTokenEstimate | undefinedNoToken-count estimate for budget tracking.

LAFSEnvelopeWithBudget

LAFS envelope variant whose metadata includes token-budget estimates.
PropertyTypeRequiredDescription
_metaLAFSMetaWithBudgetYesMetadata block extended with token-budget estimation.

MiddlewareFunction

Middleware function that transforms a LAFS envelope.
MiddlewareFunction

NextFunction

Continuation function passed to BudgetMiddleware to invoke the next middleware in the chain.
NextFunction

BudgetMiddleware

Middleware function for token-budget enforcement with chain delegation.
BudgetMiddleware

BudgetEnforcementResult

Outcome of running budget enforcement on a LAFS envelope.
PropertyTypeRequiredDescription
envelopeLAFSEnvelopeYesThe envelope after budget enforcement (possibly truncated).
withinBudgetbooleanYestrue if the estimated token count is within the allowed budget.
estimatedTokensnumberYesEstimated token count of the final envelope.
budgetnumberYesMaximum allowed token count that was enforced.
truncatedbooleanYesWhether the envelope’s result was truncated to fit the budget.

ConformanceTier

Named conformance tier indicating the breadth of checks applied.
ConformanceTier

ConformanceProfiles

Schema for the conformance-profiles JSON file.
PropertyTypeRequiredDescription
versionstringYesSemantic version of the conformance-profiles schema.
tiersRecord<ConformanceTier, string[]>YesMapping from tier name to the ordered list of check names in that tier.

RegistryCode

A single entry in the LAFS error-code registry.
PropertyTypeRequiredDescription
codestringYesThe canonical LAFS error code (e.g., "E_FORMAT_CONFLICT").
categorystringYesBroad error category (e.g., "client", "server", "auth").
descriptionstringYesHuman-readable description of when this error occurs.
retryablebooleanYesWhether the operation that produced this error is safe to retry.
httpStatusnumberYesHTTP status code mapped to this error.
grpcStatusstringYesgRPC status string mapped to this error.
cliExitnumberYesCLI exit code mapped to this error.
agentActionstring | undefinedNoSuggested agent action from the registry (e.g., "retry", "abort").
typeUristring | undefinedNoRFC 9457 type URI for this error, used in Problem Details responses.
docUrlstring | undefinedNoURL pointing to human-readable documentation for this error.

ErrorRegistry

Top-level shape of the LAFS error-registry JSON file.
PropertyTypeRequiredDescription
versionstringYesSemantic version of the error-registry schema.
codesRegistryCode[]YesAll registered LAFS error codes.

TransportMapping

A transport-specific status value resolved from the error registry.
TransportMapping

FlagResolution

Result of resolving output format flags.
PropertyTypeRequiredDescription
format"json" | "human"YesThe resolved output format: 'json' for machine-readable or 'human' for human-readable.
source"project" | "default" | "flag" | "user"YesWhich configuration layer determined the format value.
quietbooleanYesWhen true, suppress non-essential output for scripting.

NativeValidationResult

Shape of the validation result from the native binding.
PropertyTypeRequiredDescription
validbooleanYesWhether the envelope conforms to the schema.
errorsstring[]YesFlattened human-readable error messages.
structuredErrorsNativeValidationError[]YesStructured error objects.

StructuredValidationError

Structured representation of a single schema validation error.
PropertyTypeRequiredDescription
pathstringYesJSON Pointer path to the property that failed validation (e.g., "/_meta/mvi").
keywordstringYesThe JSON Schema keyword that triggered the error (e.g., "required", "type").
messagestringYesHuman-readable description of the validation failure.
paramsRecord<string, unknown>YesKeyword-specific parameters (e.g., { missingProperty: "success" }).

EnvelopeValidationResult

Result of validating a value against the LAFS envelope JSON Schema.
PropertyTypeRequiredDescription
validbooleanYesTrue when the input fully conforms to the envelope schema.
errorsstring[]YesFlattened human-readable error messages (empty when valid).
structuredErrorsStructuredValidationError[]YesStructured error objects with path, keyword, and params (empty when valid).

EnvelopeConformanceOptions

Options for configuring envelope conformance checking.
PropertyTypeRequiredDescription
tierConformanceTier | undefinedNoThe conformance tier to filter checks by.

ComplianceStage

Identifies which stage of the compliance pipeline produced an issue.
ComplianceStage

ComplianceIssue

Describes a single compliance failure detected during enforcement.
PropertyTypeRequiredDescription
stageComplianceStageYesThe pipeline stage that produced this issue.
messagestringYesA short, human-readable description of the failure.
detailstring | undefinedNoAdditional diagnostic information about the failure.

EnforceComplianceOptions

Options controlling which compliance stages are executed.
PropertyTypeRequiredDescription
checkConformanceboolean | undefinedNoWhether to run envelope conformance checks after schema validation.
checkFlagsboolean | undefinedNoWhether to run flag conformance checks.
flagsFlagInput | undefinedNoFlag input to validate when checkFlags is enabled.
requireJsonOutputboolean | undefinedNoWhen true, asserts that the resolved output format is JSON.

ComplianceResult

Aggregated result of a full LAFS compliance run.
PropertyTypeRequiredDescription
okbooleanYesTrue when every executed stage passes with zero issues.
envelopeLAFSEnvelope | undefinedNoThe parsed envelope, present only when schema validation succeeds.
validationEnvelopeValidationResultYesSchema validation result from the native validator (or AJV fallback).
envelopeConformanceConformanceReport | undefinedNoEnvelope conformance report, present when EnforceComplianceOptions.checkConformance is true.
flagConformanceConformanceReport | undefinedNoFlag conformance report, present when EnforceComplianceOptions.checkFlags is true.
issuesComplianceIssue[]YesAll issues collected across every executed stage.

ComplianceMiddleware

Middleware signature for intercepting LAFS envelopes in a pipeline.
ComplianceMiddleware

DeprecationEntry

A single deprecation rule in the registry.
PropertyTypeRequiredDescription
idstringYesUnique identifier for this deprecation rule
codestringYesWarning code emitted when detected
messagestringYesHuman-readable deprecation message
deprecatedstringYesVersion where the feature was deprecated
replacementstring | undefinedNoSuggested replacement or migration path.
removeBystringYesVersion where the deprecated feature will be removed
detector(envelope: LAFSEnvelope) => booleanYesPredicate that returns true when the envelope uses the deprecated feature

CreateEnvelopeMetaInput

Input for constructing the _meta block of a LAFS envelope.
PropertyTypeRequiredDescription
operationstringYesDot-delimited operation identifier (e.g. "tasks.list").
requestIdstringYesUnique identifier for correlating this request/response pair.
transportLAFSTransport | undefinedNoTransport protocol for this envelope.
specVersionstring | undefinedNoLAFS spec version to stamp on the envelope.
schemaVersionstring | undefinedNoJSON Schema version to stamp on the envelope.
timestampstring | undefinedNoISO 8601 timestamp; auto-generated when omitted.
strictboolean | undefinedNoWhether strict schema validation should be applied.
mviboolean | MVILevel | undefinedNoMVI level as a string, or true for 'minimal' / false for 'standard'.
contextVersionnumber | undefinedNoContext ledger version the caller is operating against.
sessionIdstring | undefinedNoSession identifier for multi-step workflow correlation.
warningsimport("/mnt/projects/cleocode/packages/lafs/src/types").Warning[] | undefinedNoNon-fatal warnings to attach to the envelope metadata.

CreateEnvelopeSuccessInput

Input for creating a successful LAFS envelope.
PropertyTypeRequiredDescription
successtrueYesDiscriminant marking this as a success input.
resultRecord<string, unknown> | Record<string, unknown>[] | nullYesOperation result payload (object, array, or null).
pageimport("/mnt/projects/cleocode/packages/lafs/src/types").LAFSPage | null | undefinedNoPagination metadata for collection results.
errornull | undefinedNoMust be null for success inputs; exists for type uniformity with error inputs.
_extensionsRecord<string, unknown> | undefinedNoVendor or protocol extension data.
metaCreateEnvelopeMetaInputYesMetadata input for constructing the envelope’s _meta block.

CreateEnvelopeErrorInput

Input for creating a failing LAFS envelope.
PropertyTypeRequiredDescription
successfalseYesDiscriminant marking this as an error input.
errorPartial<LAFSError> & Pick<LAFSError, "message" | "code">YesPartial error object; at minimum code and message are required.
resultRecord<string, unknown> | Record<string, unknown>[] | null | undefinedNoOptional result payload to include alongside the error. For validation tools (linters, type checkers), the actionable data (what to fix, suggested fixes) IS the result even when the operation “fails”. Setting this allows agents to access both the error metadata and the detailed result in a single response. When omitted or null, the envelope emits result: null (default behavior).
pageimport("/mnt/projects/cleocode/packages/lafs/src/types").LAFSPage | null | undefinedNoPagination metadata, if applicable even in error scenarios.
_extensionsRecord<string, unknown> | undefinedNoVendor or protocol extension data.
metaCreateEnvelopeMetaInputYesMetadata input for constructing the envelope’s _meta block.

CreateEnvelopeInput

Discriminated union of success and error inputs for createEnvelope.
CreateEnvelopeInput

ParseLafsResponseOptions

Options for parseLafsResponse.
PropertyTypeRequiredDescription
requireRegisteredErrorCodeboolean | undefinedNoWhen true, unregistered error codes cause an additional Error to be thrown instead of the normal LafsError.

FieldExtractionInput

Input flags for the field extraction layer.
PropertyTypeRequiredDescription
fieldFlagstring | undefinedNo--field <name>: extract a single field as plain text, discarding the envelope.
fieldsFlagstring | string[] | undefinedNo--fields <a,b,c>: filter result to these fields while preserving the envelope. Accepts a comma-separated string or an array of field names.
mviFlagstring | undefinedNo--mvi <level>: requested envelope verbosity level (client-requestable levels only). The 'custom' level is server-set and not valid here.

FieldExtractionResolution

Resolved field extraction configuration.
PropertyTypeRequiredDescription
fieldstring | undefinedNoWhen set, extract this field as plain text, discarding the envelope.
fieldsstring[] | undefinedNoWhen set, filter the result to these fields (envelope is preserved).
mviMVILevelYesResolved MVI level. Falls back to 'minimal' when no valid flag is provided.
mviSource"default" | "flag"YesWhich input determined the mvi value: 'flag' when mviFlag was valid, 'default' otherwise.
expectsCustomMvibooleanYesTrue when fields are requested, indicating the server SHOULD set _meta.mvi = 'custom' in the response per section 9.1. Separate from the client-resolved mvi level.

UnifiedFlagInput

Combined input for both format and field extraction layers.
PropertyTypeRequiredDescription
humanboolean | undefinedNoRequest human-readable output (--human flag).
jsonboolean | undefinedNoRequest JSON output (--json flag).
quietboolean | undefinedNoSuppress non-essential output for scripting (--quiet flag).
requestedFormat"json" | "human" | undefinedNoExplicit format override, taking highest precedence in the format layer.
projectDefault"json" | "human" | undefinedNoProject-level default format from configuration.
userDefault"json" | "human" | undefinedNoUser-level default format from configuration.
ttyboolean | undefinedNoTTY detection hint. When true, defaults to human format if no explicit format flag or project/user default is set. CLI tools should pass process.stdout.isTTY ?? false.
fieldstring | undefinedNoExtract a single field as plain text, discarding the envelope (--field flag).
fieldsstring | string[] | undefinedNoFilter result to these fields while preserving the envelope (--fields flag). Accepts a comma-separated string or an array of field names.
mvistring | undefinedNoRequested MVI verbosity level (--mvi flag).

UnifiedFlagResolution

Combined resolution result with cross-layer warnings.
PropertyTypeRequiredDescription
formatFlagResolutionYesResolved format layer from the format precedence chain.
fieldsFieldExtractionResolutionYesResolved field extraction layer from field/fields/mvi flags.
warningsstring[]YesWarnings for cross-layer interactions (non-fatal, informational only).

LafsA2AConfig

Configuration for LAFS A2A integration.
PropertyTypeRequiredDescription
defaultBudget{ maxTokens?: number; maxItems?: number; maxBytes?: number; } | undefinedNoDefault token budget for all operations.
envelopeResponsesboolean | undefinedNoWhether to automatically wrap responses in LAFS envelopes.
protocolVersionstring | undefinedNoA2A protocol version to use.
defaultExtensionsstring[] | undefinedNoExtension URIs to activate for all requests.

LafsSendMessageParams

Request parameters for sending messages.
PropertyTypeRequiredDescription
message{ role: "user" | "agent"; parts: Part[]; metadata?: Record<string, unknown>; }NoMessage content including role, parts, and optional metadata
configurationMessageSendConfiguration | undefinedNoA2A configuration for this request.
budget{ maxTokens?: number; maxItems?: number; maxBytes?: number; } | undefinedNoToken budget override for this request.
extensionsstring[] | undefinedNoExtensions to activate for this request.
contextIdstring | undefinedNoContext ID for multi-turn conversations.
taskIdstring | undefinedNoTask ID for continuing existing task.

CreateTaskOptions

Options for creating a new task
PropertyTypeRequiredDescription
contextIdstring | undefinedNoContext ID for grouping related tasks.
metadataRecord<string, unknown> | undefinedNoArbitrary metadata to attach to the task.
referenceTaskIdsstring[] | undefinedNoIDs of parent tasks this task refines or follows up on.
parallelFollowUpboolean | undefinedNoWhether this follow-up can run in parallel with its references.

ListTasksOptions

Options for listing tasks
PropertyTypeRequiredDescription
contextIdstring | undefinedNoFilter tasks by context ID.
stateTaskState | undefinedNoFilter tasks by current state.
limitnumber | undefinedNoMaximum number of tasks to return.
pageTokenstring | undefinedNoCursor token for pagination (last seen task ID).

ListTasksResult

Paginated result from listTasks
PropertyTypeRequiredDescription
tasksTask[]YesArray of tasks matching the query
nextPageTokenstring | undefinedNoToken for fetching the next page of results.

TaskStreamEvent

Union type of task stream events emitted by the event bus.
TaskStreamEvent

StreamIteratorOptions

Options for the stream task events async iterator
PropertyTypeRequiredDescription
timeoutMsnumber | undefinedNoTimeout in milliseconds before the iterator yields control.

PushNotificationDeliveryResult

Result of delivering a push notification to a single webhook
PropertyTypeRequiredDescription
configIdstringYesIdentifier of the config that was dispatched to
okbooleanYesWhether the delivery succeeded
statusnumber | undefinedNoHTTP status code from the webhook response.
errorstring | undefinedNoError message if delivery failed.

PushTransport

Transport function for sending HTTP requests to push-notification webhooks.
PushTransport

JsonRpcMethod

Union of all valid JSON-RPC method string values from JSONRPC_METHODS
JsonRpcMethod

A2AErrorType

Union of A2A error type key names from JSONRPC_A2A_ERROR_CODES
"TaskNotFound" | "TaskNotCancelable" | "PushNotificationNotSupported" | "UnsupportedOperation" | "ContentTypeNotSupported" | "InvalidAgentResponse" | "AuthenticatedExtendedCardNotConfigured" | "ExtensionSupportRequired" | "VersionNotSupported"

JsonRpcRequest

A JSON-RPC 2.0 request object.
PropertyTypeRequiredDescription
jsonrpc"2.0"YesJSON-RPC protocol version, always "2.0"
idstring | numberYesClient-assigned request identifier
methodstringYesThe RPC method name to invoke
paramsRecord<string, unknown> | undefinedNoNamed parameters for the method call.

JsonRpcResponse

A JSON-RPC 2.0 success response object.
PropertyTypeRequiredDescription
jsonrpc"2.0"YesJSON-RPC protocol version, always "2.0"
idstring | number | nullYesIdentifier matching the originating request, or null for notifications
resultunknownYesThe return value of the invoked method

JsonRpcErrorResponse

A JSON-RPC 2.0 error response object.
PropertyTypeRequiredDescription
jsonrpc"2.0"YesJSON-RPC protocol version, always "2.0"
idstring | number | nullYesIdentifier matching the originating request, or null for notifications
error{ code: number; message: string; data?: Record<string, unknown>; }NoError descriptor containing code, message, and optional data

GrpcStatusCode

Numeric gRPC status code value (0-16)
GrpcStatusCode

GrpcStatusName

String name of a gRPC status code (e.g. "OK", "NOT_FOUND")
"NOT_FOUND" | "INTERNAL" | "FAILED_PRECONDITION" | "INVALID_ARGUMENT" | "ABORTED" | "RESOURCE_EXHAUSTED" | "UNAVAILABLE" | "OK" | "CANCELLED" | "UNKNOWN" | "DEADLINE_EXCEEDED" | "ALREADY_EXISTS" | "PERMISSION_DENIED" | "OUT_OF_RANGE" | "UNIMPLEMENTED" | "DATA_LOSS" | "UNAUTHENTICATED"

GrpcServiceMethod

Descriptor for a single gRPC service method.
PropertyTypeRequiredDescription
requeststringYesProtobuf request message type name
responsestringYesProtobuf response message type name
streamingbooleanYesWhether the method uses server-side streaming

GrpcStatus

gRPC Status object for A2A errors.
PropertyTypeRequiredDescription
codeGrpcStatusCodeYesNumeric gRPC status code
messagestringYesHuman-readable error message
detailsGrpcErrorInfo[] | undefinedNoStructured error details (typically google.rpc.ErrorInfo entries).

GrpcErrorInfo

Equivalent of google.rpc.ErrorInfo for structured gRPC error details.
PropertyTypeRequiredDescription
reasonstringYesUPPER_SNAKE_CASE reason string identifying the error
domainstringYesError domain (e.g. "a2a-protocol.org")
metadataRecord<string, string> | undefinedNoAdditional key-value metadata for the error.

HttpEndpoint

Union of all HTTP endpoint descriptor objects from HTTP_ENDPOINTS
HttpEndpoint

ProblemDetails

RFC 9457 Problem Details object.
PropertyTypeRequiredDescription
typestringYesURI reference identifying the problem type
titlestringYesShort human-readable summary of the problem
statusnumberYesHTTP status code for this occurrence
detailstringYesHuman-readable explanation specific to this occurrence

ListTasksQueryParams

Parsed query parameters for the ListTasks endpoint.
PropertyTypeRequiredDescription
contextIdstring | undefinedNoFilter tasks by context identifier.
statestring | undefinedNoFilter tasks by state (e.g. "submitted", "working").
limitnumber | undefinedNoMaximum number of tasks to return.
pageTokenstring | undefinedNoPagination token from a previous response.

ErrorCodeMapping

Complete error code mapping across all three transports.
PropertyTypeRequiredDescription
jsonRpcCodenumberYesJSON-RPC numeric error code (e.g. -32001)
httpStatusnumberYesHTTP response status code (e.g. 404)
httpTypeUristringYesRFC 9457 Problem Details type URI
grpcStatusstringYesgRPC status name (e.g. "NOT_FOUND")
grpcCodenumberYesgRPC numeric status code (e.g. 5)

CircuitState

Represents the three possible states of a circuit breaker.
CircuitState

CircuitBreakerConfig

Configuration options for a CircuitBreaker instance.
PropertyTypeRequiredDescription
namestringYesUnique identifier for this circuit breaker, used in log messages and metrics.
failureThresholdnumber | undefinedNoNumber of failures required to trip the circuit from CLOSED to OPEN.
resetTimeoutnumber | undefinedNoMilliseconds to wait before transitioning from OPEN to HALF_OPEN.
halfOpenMaxCallsnumber | undefinedNoMaximum number of trial calls allowed while in the HALF_OPEN state.
successThresholdnumber | undefinedNoConsecutive successes required in HALF_OPEN to close the circuit.

CircuitBreakerMetrics

Snapshot of runtime metrics for a CircuitBreaker.
PropertyTypeRequiredDescription
stateCircuitStateYesCurrent state of the circuit breaker.
failuresnumberYesTotal number of recorded failures since the last reset.
successesnumberYesTotal number of recorded successes since the last reset.
lastFailureTimeDate | undefinedNoTimestamp of the most recent failure, if any.
consecutiveSuccessesnumberYesNumber of consecutive successes since the last failure.
totalCallsnumberYesTotal number of calls made through this circuit breaker.

HealthCheckConfig

Configuration for the healthCheck middleware.
PropertyTypeRequiredDescription
pathstring | undefinedNoURL path at which the health endpoint is mounted.
checksHealthCheckFunction[] | undefinedNoArray of custom health check functions to run on each request.

HealthCheckFunction

A function that performs a single health check.
HealthCheckFunction

HealthCheckResult

Result of an individual health check.
PropertyTypeRequiredDescription
namestringYesHuman-readable name identifying this check.
status"error" | "warning" | "ok"YesOutcome status of the check.
messagestring | undefinedNoOptional descriptive message providing additional detail.
durationnumber | undefinedNoExecution duration of the check in milliseconds.

HealthStatus

Aggregated health status returned by the health endpoint.
PropertyTypeRequiredDescription
status"healthy" | "degraded" | "unhealthy"YesOverall service health derived from individual check results.
timestampstringYesISO-8601 timestamp of when the health check was performed.
versionstringYesLAFS package version.
uptimenumberYesServer uptime in seconds since the middleware was initialised.
checksHealthCheckResult[]YesIndividual check results.

LafsProblemDetails

RFC 9457 Problem Details with LAFS extensions.
PropertyTypeRequiredDescription
typestringYesURI reference identifying the problem type
titlestringYesShort human-readable summary (typically the error code)
statusnumberYesHTTP status code for this error
detailstringYesHuman-readable explanation of the specific occurrence
instancestring | undefinedNoURI reference identifying the specific occurrence (typically the request ID).
retryablebooleanYesWhether the operation that caused this error can be retried
agentActionstring | undefinedNoRecommended agent action (e.g., "retry", "escalate").
retryAfterMsnumber | undefinedNoSuggested delay in milliseconds before retrying.
escalationRequiredboolean | undefinedNoWhether the error requires human escalation.
suggestedActionstring | undefinedNoHuman-readable suggestion for resolving the error.
docUrlstring | undefinedNoDocumentation URL for more information.

GracefulShutdownConfig

Configuration for the gracefulShutdown handler.
PropertyTypeRequiredDescription
timeoutnumber | undefinedNoMaximum time in milliseconds to wait for in-flight requests before forcing exit.
signalsNodeJS.Signals[] | undefinedNoPOSIX signals that trigger a graceful shutdown.
onShutdown(() => Promise<void> | void) | undefinedNoCallback invoked at the start of shutdown, before the server stops accepting connections.
onClose(() => Promise<void> | void) | undefinedNoCallback invoked after all connections have closed (or the timeout elapsed).

ShutdownState

Snapshot of the current shutdown state.
PropertyTypeRequiredDescription
isShuttingDownbooleanYesWhether a shutdown sequence is currently in progress.
activeConnectionsnumberYesNumber of TCP connections still open.
shutdownStartTimeDate | undefinedNoTimestamp when the shutdown sequence began.