Skip to main content
All usage examples from the package, aggregated for quick reference.

parseExtensionsHeader()

Parse A2A-Extensions header value into URI array. View in API reference

negotiateExtensions()

Negotiate extensions between client-requested and agent-declared sets. View in API reference

formatExtensionsHeader()

Format activated extension URIs into header value. View in API reference

buildLafsExtension()

Build an A2A AgentExtension object declaring LAFS support. View in API reference

buildExtension()

Build a generic A2A AgentExtension object. View in API reference

isValidExtensionKind()

Check whether a string is a valid extension kind. View in API reference

validateExtensionDeclaration()

Validate an A2A extension declaration for correctness. View in API reference

extensionNegotiationMiddleware()

Express middleware for A2A extension negotiation. View in API reference

AgentProvider

A2A Agent Provider information. View in API reference

AgentCapabilities

A2A Agent Capabilities. View in API reference

AgentExtension

A2A Agent Extension declaration. View in API reference

AgentSkill

A2A Agent Skill. View in API reference

SecurityScheme

Security scheme for authentication (OpenAPI 3.0 style). View in API reference

AgentCard

A2A v1.0 Agent Card - Standard format for agent discovery. View in API reference

DiscoveryConfig

Configuration for the discovery middleware (A2A v1.0 format). View in API reference

DiscoveryMiddlewareOptions

Discovery middleware options. View in API reference

discoveryMiddleware()

Create Express middleware for serving A2A Agent Card. View in API reference

discoveryFastifyPlugin()

Fastify plugin for A2A Agent Card discovery. View in API reference

TokenEstimatorOptions

Configuration options for the token estimator. View in API reference

TokenEstimator

Character-based token estimator for JSON payloads. View in API reference

estimateTokens()

Convenience function to estimate tokens for a value. View in API reference

estimateTokensJSON()

Convenience function to estimate tokens from a JSON string. View in API reference

MVI_LEVELS

Immutable set of all valid MVILevel values. View in API reference

isMVILevel()

Type guard that checks whether an unknown value is a valid MVILevel. View in API reference

AGENT_ACTIONS

Immutable set of all valid LAFSAgentAction values. View in API reference

isAgentAction()

Type guard that checks whether an unknown value is a valid LAFSAgentAction. View in API reference

applyBudgetEnforcement()

Apply budget enforcement to an envelope. View in API reference

withBudget()

Create a budget enforcement middleware function. View in API reference

checkBudget()

Check if an envelope has exceeded its budget without modifying it. View in API reference

withBudgetSync()

Synchronous version of withBudget for non-async contexts. View in API reference

wrapWithBudget()

Higher-order function that wraps a handler with budget enforcement. View in API reference

composeMiddleware()

Compose multiple middleware functions into a single middleware. View in API reference

getConformanceProfiles()

Loads the conformance profiles from the bundled JSON schema. View in API reference

getChecksForTier()

Returns the list of check names that belong to the given conformance tier. View in API reference

validateConformanceProfiles()

Validates that the conformance profiles are internally consistent and reference only known checks. View in API reference

getErrorRegistry()

Loads the full LAFS error registry from the bundled JSON. View in API reference

isRegisteredErrorCode()

Checks whether a given error code exists in the LAFS error registry. View in API reference

getRegistryCode()

Retrieves the full registry entry for a given error code. View in API reference

getAgentAction()

Returns the default agent action for a given error code. View in API reference

getTypeUri()

Returns the RFC 9457 type URI for a given error code. View in API reference

getDocUrl()

Returns the documentation URL for a given error code. View in API reference

getTransportMapping()

Resolves the transport-specific status value for a given error code and transport. View in API reference

resolveOutputFormat()

Resolve the output format from flag inputs using the LAFS precedence chain. View in API reference

validateEnvelope()

Validates an unknown input against the LAFS envelope JSON Schema (Draft-07). View in API reference

assertEnvelope()

Validates input and throws on schema failure, returning a typed envelope on success. View in API reference

runEnvelopeConformance()

Runs the full suite of LAFS envelope conformance checks. View in API reference

runFlagConformance()

Runs LAFS flag-semantics conformance checks against a set of flag inputs. View in API reference

ComplianceError

Error thrown when assertCompliance or withCompliance detects failures. View in API reference

enforceCompliance()

Runs the full LAFS compliance pipeline against an unknown input value. View in API reference

assertCompliance()

Validates input and throws ComplianceError on any failure. View in API reference

withCompliance()

Wraps an envelope-producing function with automatic compliance enforcement. View in API reference

createComplianceMiddleware()

Creates a ComplianceMiddleware that enforces LAFS compliance on the next handler’s output. View in API reference

DeprecationEntry

A single deprecation rule in the registry. View in API reference

getDeprecationRegistry()

Retrieve all registered deprecation entries. View in API reference

detectDeprecatedEnvelopeFields()

Detect deprecated field usage in a LAFS envelope. View in API reference

emitDeprecationWarnings()

Emit deprecation warnings by attaching them to the envelope metadata. View in API reference

LAFS_SCHEMA_URL

Canonical JSON Schema URL for the LAFS v1 envelope. View in API reference

CATEGORY_ACTION_MAP

Default agent action for each error category. View in API reference

createEnvelope()

Create a fully validated LAFS envelope from a success or error input. View in API reference

LafsError

Error subclass that carries the full LAFSError payload. View in API reference

parseLafsResponse()

Parse and unwrap a raw LAFS envelope, returning the result or throwing on error. View in API reference

resolveFieldExtraction()

Resolve field extraction flags into a validated configuration. View in API reference

extractFieldFromResult()

Extract a named field from a LAFS result object. View in API reference

extractFieldFromEnvelope()

Extract a named field from an envelope’s result. View in API reference

applyFieldFilter()

Filter result fields in a LAFS envelope to the requested subset. View in API reference

resolveFlags()

Resolve all flags across both layers and validate cross-layer semantics. View in API reference

createLafsArtifact()

Create a LAFS envelope artifact for A2A. View in API reference

createTextArtifact()

Create a text artifact. View in API reference

createFileArtifact()

Create a file artifact. View in API reference

isExtensionRequired()

Check if an extension is required in an Agent Card. View in API reference

getExtensionParams()

Get extension parameters from an Agent Card. View in API reference

isValidTransition()

Check if a transition from one state to another is valid. View in API reference

isTerminalState()

Check if a state is terminal (no further transitions allowed). View in API reference

isInterruptedState()

Check if a state is interrupted (paused awaiting input). View in API reference

attachLafsEnvelope()

Attach a LAFS envelope as an artifact to an A2A task. View in API reference

streamTaskEvents()

Build an async iterator for real-time task stream events. View in API reference

createJsonRpcRequest()

Create a JSON-RPC 2.0 request object. View in API reference

createJsonRpcResponse()

Create a JSON-RPC 2.0 success response. View in API reference

createJsonRpcErrorResponse()

Create a JSON-RPC 2.0 error response. View in API reference

createA2AErrorResponse()

Create an A2A-specific JSON-RPC error response by error type name. View in API reference

validateJsonRpcRequest()

Validate the structure of a JSON-RPC request. View in API reference

isA2AError()

Check if a numeric error code is an A2A-specific error. View in API reference

createGrpcStatus()

Create a gRPC Status object for an A2A error type. View in API reference

createProblemDetails()

Create an RFC 9457 Problem Details object for an A2A error. View in API reference

createLafsProblemDetails()

Create an RFC 9457 Problem Details object bridging A2A error types with LAFS error data. View in API reference

buildUrl()

Build a URL by substituting path parameters. View in API reference

parseListTasksQuery()

Parse camelCase query parameters for the ListTasks endpoint. View in API reference

getErrorCodeMapping()

Get the complete error code mapping for a given A2A error type. View in API reference

parseA2AVersionHeader()

Parse the a2a-version header into an array of version strings. View in API reference

negotiateA2AVersion()

Negotiate an A2A protocol version from the client’s requested versions. View in API reference

CircuitBreakerError

Error thrown when a circuit breaker rejects a call. View in API reference

CircuitBreaker

Circuit breaker for protecting against cascading failures. View in API reference

CircuitBreakerRegistry

Registry for managing multiple named circuit breakers. View in API reference

circuitBreakerMiddleware()

Create an Express middleware that wraps downstream handlers with a circuit breaker. View in API reference

healthCheck()

Health check middleware for Express applications. View in API reference

createDatabaseHealthCheck()

Create a health check function that verifies database connectivity. View in API reference

createExternalServiceHealthCheck()

Create a health check function that probes an external HTTP service. View in API reference

livenessProbe()

Liveness probe — a minimal check confirming the process is running. View in API reference

readinessProbe()

Readiness probe — verifies the service can accept traffic. View in API reference

projectEnvelope()

Project an envelope to the declared MVI verbosity level. View in API reference

estimateProjectedTokens()

Estimate token count for a projected envelope. View in API reference

LafsProblemDetails

RFC 9457 Problem Details with LAFS extensions. View in API reference

lafsErrorToProblemDetails()

Convert a LAFSError to an RFC 9457 Problem Details object. View in API reference

gracefulShutdown()

Enable graceful shutdown for an HTTP server. View in API reference

isShuttingDown()

Check whether a shutdown sequence is currently in progress. View in API reference

getShutdownState()

Get a snapshot of the current shutdown state. View in API reference

forceShutdown()

Terminate the process immediately without waiting for connections to drain. View in API reference

shutdownMiddleware()

Express middleware that rejects requests with 503 while the server is shutting down. View in API reference

waitForShutdown()

Wait until a shutdown sequence begins. View in API reference