/// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// import * as golem_core_types_2_0_0 from 'golem:core/types@2.0.0'; import { Secret, QuotaToken, SchemaValueStream, SchemaValueTree, PermissionCard as PermissionCard$1, Uuid as Uuid$1, TypeId, NumericRestrictions, MetadataEnvelope, TextRestrictions, BinaryRestrictions, PathSpec, UrlRestrictions, QuantitySpec, DiscriminatorRule, SecretSpec, QuotaTokenSpec, PermissionCardSpec, Datetime, QuantityValue, ComponentId as ComponentId$1, SchemaValueNode, PathDirection, PathKind } from 'golem:core/types@2.0.0'; import { OidcPrincipal as OidcPrincipal$1, AgentPrincipal as AgentPrincipal$1, GolemUserPrincipal as GolemUserPrincipal$1 } from 'golem:agent/common@2.0.0'; import { PermissionError as PermissionError$1 } from 'golem:permissions/types@0.1.0'; import { Duration as Duration$1 } from 'golem:api/retry@1.5.0'; import { Quantifier, Doc, Repetition, DuplicateKeyPolicy, FlagSpec, StreamSpec, Formatter, ErrorKind, CommandAnnotations, TypedSchemaValue as TypedSchemaValue$1, ToolError, InvocationResult, Tool } from 'golem:tool/common@0.1.0'; import { ByteStreamItem, ToolOutputWriter } from 'golem:tool/streams@0.1.0'; declare abstract class BasePrincipal { private readonly _brand; abstract readonly tag: 'oidc' | 'agent' | 'golem-user' | 'anonymous'; } declare class OidcPrincipal extends BasePrincipal { readonly inner: OidcPrincipal$1; readonly tag: "oidc"; readonly val: OidcPrincipal$1; constructor(inner: OidcPrincipal$1); get sub(): string; get issuer(): string; get email(): string | undefined; get name(): string | undefined; get emailVerified(): boolean | undefined; get givenName(): string | undefined; get familyName(): string | undefined; get picture(): string | undefined; get preferredUsername(): string | undefined; get claims(): string; } declare class AgentPrincipal extends BasePrincipal { readonly inner: AgentPrincipal$1; readonly tag: "agent"; readonly val: AgentPrincipal$1; constructor(inner: AgentPrincipal$1); get agentId(): golem_core_types_2_0_0.AgentId; } declare class GolemUserPrincipal extends BasePrincipal { readonly inner: GolemUserPrincipal$1; readonly tag: "golem-user"; readonly val: GolemUserPrincipal$1; constructor(inner: GolemUserPrincipal$1); get accountId(): golem_core_types_2_0_0.AccountId; } declare class AnonymousPrincipal extends BasePrincipal { readonly tag: "anonymous"; } type Principal = OidcPrincipal | AgentPrincipal | GolemUserPrincipal | AnonymousPrincipal; interface StandardSchemaV1 { readonly '~standard': StandardSchemaV1.Props; } declare namespace StandardSchemaV1 { interface Props { readonly version: 1; readonly vendor: string; readonly validate: (value: unknown) => Result | Promise>; readonly types?: Types | undefined; } type Result = SuccessResult | FailureResult; interface SuccessResult { readonly value: Output; readonly issues?: undefined; } interface FailureResult { readonly issues: ReadonlyArray; } interface Issue { readonly message: string; readonly path?: ReadonlyArray | undefined; } interface PathSegment { readonly key: PropertyKey; } interface Types { readonly input: Input; readonly output: Output; } type InferInput = NonNullable['input']; type InferOutput = NonNullable['output']; } declare const SECRET_INTERNAL: unique symbol; type SecretInternal = typeof SECRET_INTERNAL; declare class GuestSecretHandle { constructor(key: SecretInternal, raw: Secret, onTake?: () => void, tracked?: boolean); toJSON(): never; } declare const QUOTA_INTERNAL: unique symbol; /** The type of the {@link QUOTA_INTERNAL} capability key. */ type QuotaInternal = typeof QUOTA_INTERNAL; declare class GuestQuotaTokenHandle { constructor(key: QuotaInternal, raw: QuotaToken, tracked?: boolean); /** * Quota-token handles are unforgeable capabilities, not data: serializing one * (e.g. via `JSON.stringify`) is always an error. Transfer them only by * passing the owning `QuotaToken` through a WIT `schema-value-tree`. */ toJSON(): never; } type GuestSchemaValueStream = { kind: 'wrapped'; value: SchemaValueStream; } | { kind: 'native'; value: AsyncIterable; }; declare const PERMISSION_CARD_INTERNAL: unique symbol; /** The type of the {@link PERMISSION_CARD_INTERNAL} capability key. */ type PermissionCardInternal = typeof PERMISSION_CARD_INTERNAL; /** Guest-side take-once carrier for an owned, opaque permission-card resource. */ declare class GuestPermissionCardHandle { constructor(key: PermissionCardInternal, raw: PermissionCard$1, tracked?: boolean, lifted?: boolean); toJSON(): never; } /** * Rich UUID class that is structurally compatible with the WIT binding type * `{ highBits: bigint; lowBits: bigint }` from `golem:core/types@2.0.0`. */ declare class Uuid { readonly highBits: bigint; readonly lowBits: bigint; constructor(highBits: bigint, lowBits: bigint); /** * Formats the UUID as a standard hyphenated string. */ toString(): string; /** * Parses a UUID string. */ static parse(value: string): Uuid; /** * Generates a random UUID. */ static generate(): Uuid; /** * Wraps a raw WIT UUID object in a Uuid instance. * If the value is already a Uuid, it is returned directly. */ static from(value: Uuid$1): Uuid; } /** A schema type node: a structural body plus its metadata envelope. */ interface SchemaType { readonly body: SchemaTypeBody; readonly metadata: MetadataEnvelope; } type SchemaTypeBody = { tag: 'ref'; id: TypeId; } | { tag: 'bool'; } | { tag: 's8'; restrictions?: NumericRestrictions; } | { tag: 's16'; restrictions?: NumericRestrictions; } | { tag: 's32'; restrictions?: NumericRestrictions; } | { tag: 's64'; restrictions?: NumericRestrictions; } | { tag: 'u8'; restrictions?: NumericRestrictions; } | { tag: 'u16'; restrictions?: NumericRestrictions; } | { tag: 'u32'; restrictions?: NumericRestrictions; } | { tag: 'u64'; restrictions?: NumericRestrictions; } | { tag: 'f32'; restrictions?: NumericRestrictions; } | { tag: 'f64'; restrictions?: NumericRestrictions; } | { tag: 'char'; } | { tag: 'string'; } | { tag: 'uuid'; } | { tag: 'record'; fields: NamedFieldType[]; } | { tag: 'variant'; cases: VariantCaseType[]; } | { tag: 'enum'; cases: string[]; } | { tag: 'flags'; names: string[]; } | { tag: 'tuple'; elements: SchemaType[]; } | { tag: 'list'; element: SchemaType; } | { tag: 'fixed-list'; element: SchemaType; length: number; } | { tag: 'map'; key: SchemaType; value: SchemaType; } | { tag: 'option'; element: SchemaType; } | { tag: 'result'; ok?: SchemaType; err?: SchemaType; } | { tag: 'text'; restrictions: TextRestrictions; } | { tag: 'binary'; restrictions: BinaryRestrictions; } | { tag: 'path'; spec: PathSpec; } | { tag: 'url'; restrictions: UrlRestrictions; } | { tag: 'datetime'; } | { tag: 'duration'; } | { tag: 'quantity'; spec: QuantitySpec; } | { tag: 'union'; branches: UnionBranch[]; } | { tag: 'secret'; spec: Omit; inner: SchemaType; } | { tag: 'quota-token'; spec: QuotaTokenSpec; } | { tag: 'permission-card'; spec: PermissionCardSpec; } | { tag: 'future'; element?: SchemaType; } | { tag: 'stream'; element?: SchemaType; }; interface NamedFieldType { name: string; body: SchemaType; metadata: MetadataEnvelope; } interface VariantCaseType { name: string; payload?: SchemaType; metadata: MetadataEnvelope; } interface UnionBranch { /** Logical branch name (carried in `union` values). */ tag: string; body: SchemaType; discriminator: DiscriminatorRule; metadata: MetadataEnvelope; } interface SchemaTypeDef { /** Optional human-readable qualified name (display only). */ readonly name?: string; readonly body: SchemaType; } /** * A self-contained schema graph: a registry of named definitions (keyed by * stable `type-id`) plus a root type. `ref` bodies reference entries in `defs`. */ interface SchemaGraph { readonly defs: ReadonlyMap; readonly root: SchemaType; } type SchemaValue = { tag: 'bool'; value: boolean; } | { tag: 's8'; value: number; } | { tag: 's16'; value: number; } | { tag: 's32'; value: number; } | { tag: 's64'; value: bigint; } | { tag: 'u8'; value: number; } | { tag: 'u16'; value: number; } | { tag: 'u32'; value: number; } | { tag: 'u64'; value: bigint; } | { tag: 'f32'; value: number; } | { tag: 'f64'; value: number; } | { tag: 'char'; value: string; } | { tag: 'string'; value: string; } | { tag: 'uuid'; value: Uuid; } | { tag: 'record'; fields: SchemaValue[]; } | { tag: 'variant'; caseIndex: number; payload?: SchemaValue; } | { tag: 'enum'; caseIndex: number; } | { tag: 'flags'; flags: boolean[]; } | { tag: 'tuple'; elements: SchemaValue[]; } | { tag: 'list'; elements: SchemaValue[]; } | { tag: 'fixed-list'; elements: SchemaValue[]; } | { tag: 'map'; entries: SchemaMapEntry[]; } | { tag: 'option'; value?: SchemaValue; } | { tag: 'result'; result: SchemaResult; } | { tag: 'text'; text: string; language?: string; } | { tag: 'binary'; bytes: Uint8Array; mimeType?: string; } | { tag: 'path'; value: string; } | { tag: 'url'; value: string; } | { tag: 'datetime'; value: Datetime; } | { tag: 'duration'; nanoseconds: bigint; } | { tag: 'quantity'; value: QuantityValue; } | { tag: 'union'; unionTag: string; body: SchemaValue; } | { tag: 'secret'; handle: GuestSecretHandle; } | { tag: 'quota-token'; handle: GuestQuotaTokenHandle; } | { tag: 'stream'; handle: SchemaValueStreamHandle; } | { tag: 'permission-card'; handle: GuestPermissionCardHandle; }; interface SchemaMapEntry { key: SchemaValue; value: SchemaValue; } interface SchemaValueStreamHandle { peek(): GuestSchemaValueStream | undefined; take(): GuestSchemaValueStream | undefined; close(): Promise; } type SchemaResult = { tag: 'ok'; value?: SchemaValue; } | { tag: 'err'; value?: SchemaValue; }; interface TypedSchemaValue { graph: SchemaGraph; value: SchemaValue; } declare class ComponentId { readonly uuid: Uuid; constructor(uuid: Uuid); toString(): string; static from(value: ComponentId$1): ComponentId; } /** * Represents a Golem agent, consisting of a component ID and the agent's string identifier. */ type AgentId = { componentId: ComponentId; agentId: string; }; declare const DURATION_BRAND: unique symbol; type DurationInput = Duration | Duration$1 | bigint | number; /** * A validated retry duration helper backed by raw nanoseconds. */ declare class Duration { private readonly nanoseconds; readonly [DURATION_BRAND] = true; private constructor(); static nanoseconds(value: bigint | number): Duration; static microseconds(value: bigint | number): Duration; static milliseconds(value: bigint | number): Duration; static seconds(value: bigint | number): Duration; static minutes(value: bigint | number): Duration; static hours(value: bigint | number): Duration; static from(value: DurationInput): Duration; toRaw(): Duration$1; asNanoseconds(): bigint; } declare const prototype: { /** * Returns `true` if the result is successful, `false` otherwise * @example. * Result.ok(123).isOk() // true * @example * Result.err('error').isOk() // false */ readonly isOk: typeof isOk; /** * Returns `true` if the result is an error, `false` otherwise * @example * Result.err('error').isOk() // false * @example. * Result.ok(123).isOk() // true */ readonly isErr: typeof isErr; /** * Returns the successful value of the result or throws the error value. * This should be used when returning from a component function that expects to receive a result. * @example Returns the payload of a successful result. * Result.ok(123).unwrapForWit() // 123 * @example Throws the payload of a failed result. * Result.err('error').unwrapForWit() // throws 'error' */ readonly unwrapForWit: typeof unwrapForWit; /** * Returns `this.value` if `this` is a successful result, otherwise throws a TypeError. * @example Returns the payload of a successful result. * Result.ok(123).unwrap() // 123 * @example Throws a TypeError for a failed result. * Result.err('error').unwrap() // throws TypeError */ readonly unwrap: typeof unwrap; /** * * Returns `this.error` if `this` is a failed result, otherwise throws a TypeError. * @example Throw a TypeError for a successful result. * Result.ok(123).unwrapErr() // throws TypeError * @example Returns the payload of a failed result * Result.err('error').unwrap() // 'error' */ readonly unwrapErr: typeof unwrapErr; /** * Returns the payload of the result. * @example Returns the payload of a successful result. * Result.ok(123).toUnion() // 123 * @example Returns the payload of a failed result. * Result.err('error').toUnion() // 'error' */ readonly toUnion: typeof toUnion; /** * Return the result of applying one of the given functions to the payload. * @example * Result.ok(123).match((x) => x * 2, (x: string) => x + '!') // 246 * Result.err('error').match((x: number) => x * 2, (x) => x + '!') // 'error!' */ readonly match: typeof match; /** * Creates a Result value by modifying the payload of the successful result using the given function. * @example * Result.ok(123).map((x) => x * 2) // Result.ok(246) * Result.err('error').map((x: number) => x * 2) // Result.err('error') */ readonly map: typeof map; /** * Creates a Result value by modifying the payload of the failed result using the given function. * @example * Result.ok(123).mapError((x: string) => x + '!') // Result.ok(123) * Result.err('error').mapError((x) => x + '!') // Result.err('error!') */ readonly mapError: typeof mapError; /** * Calls the given function with the payload of the result and returns the result unchanged. */ readonly tap: typeof tap; /** * Maps the payload of the successful result and flattens the nested Result type. * @example * Result.ok(123).flatMap((x) => Result.ok(x * 2)) // Result.ok(246) * Result.ok(123).flatMap((x) => Result.err('error')) // Result.err('error') * Result.err('error').flatMap((x: number) => Result.ok(x * 2)) // Result.err('error') * Result.err('error').flatMap((x) => Result.err('failure')) // Result.err('error') */ readonly flatMap: typeof flatMap; /** * Flattens the nested Result type. * @example * Result.ok(Result.ok(123)).flatten() // Result.ok(123) * Result.ok(Result.err('error')).flatten() // Result.err('error') * Result.err('error').flatten() // Result.err('error') */ readonly flatten: typeof flatten; /** * Perform a safe cast of the error type to the given class. If the payload of the failed result is not instance of constructor, throws TypeError. * @example * const result: Result = Result.tryCatch(() => { * if (Math.random() >= 0) { * throw new Error('error') * } else { * return 123 * } * }).assertErrorInstanceOf(Error) */ readonly assertErrorInstanceOf: typeof assertErrorInstanceOf; }; /** Type representing success or failure. */ type Result = Result.Ok | Result.Err; declare namespace Result { /** * The type of a successful result. * @example * const success: Result.ok = Result.ok(123) */ type Ok = typeof prototype & { readonly tag: 'ok'; readonly val: T; }; /** * A failed result. * @example * const failure: Result.err = Result.err('error') */ type Err = typeof prototype & { readonly tag: 'err'; readonly val: E; }; /** * Create a successful result. */ function ok(value: T): Result.Ok; /** * Create an error result. */ function err(error: E): Err; /** * Create a result from a function that may throw an error. */ function tryCatch(f: () => T): Result; function fromNullish(value: null): Result.Err; function fromNullish(value: undefined): Result.Err; function fromNullish(value: null | undefined): Result.Err; function fromNullish(value: T): Result.Ok; function fromNullish(value: T | null): Result; function fromNullish(value: T | undefined): Result; function fromNullish(value: T | null | undefined): Result; function all(results: readonly Result.Ok[]): Result.Ok; function all(results: readonly Result[]): Result; } declare function isOk(this: Result): this is Result.Ok; declare function isErr(this: Result): this is Result.Err; declare function unwrapForWit(this: Result.Ok): T; declare function unwrapForWit(this: Result.Err): never; declare function unwrapForWit(this: Result): T; declare function unwrap(this: Result.Ok): T; declare function unwrap(this: Result.Err): never; declare function unwrap(this: Result): T; declare function unwrapErr(this: Result.Ok): never; declare function unwrapErr(this: Result.Err): E; declare function unwrapErr(this: Result): E; declare function toUnion(this: Result.Ok): T; declare function toUnion(this: Result.Err): E; declare function toUnion(this: Result): T | E; declare function match(this: Result.Ok, f: (value: T) => T2, g: (error: E) => E2): T2; declare function match(this: Result.Err, f: (value: T) => T2, g: (error: E) => E2): E2; declare function match(this: Result, f: (value: T) => T2, g: (error: E) => E2): T2 | E2; declare function map(this: Result.Ok, f: (value: T) => T2): Result.Ok; declare function map(this: Result.Err, f: (value: T) => T2): Result.Err; declare function map(this: Result, f: (value: T) => T2): Result; declare function mapError(this: Result.Ok, f: (error: E) => E2): Result.Ok; declare function mapError(this: Result.Err, f: (error: E) => E2): Result.Err; declare function mapError(this: Result, f: (error: E) => E2): Result; declare function tap(this: Result.Err, f: (error: E) => void): Result.Err; declare function tap(this: Result.Ok, f: (value: T) => void): Result.Ok; declare function tap(this: Result, f: (value: T) => void): Result; declare function flatMap(this: Result.Ok, f: (value: T) => Result.Ok): Result.Ok; declare function flatMap(this: Result.Ok, f: (value: T) => Result.Err): Result.Err; declare function flatMap(this: Result.Ok, f: (value: T) => Result): Result; declare function flatMap(this: Result.Err, f: (value: T) => Result<_T2, E2>): Result.Err; declare function flatMap(this: Result, f: (value: T) => Result.Ok): Result; declare function flatMap(this: Result, f: (value: T) => Result.Err): Result.Err; declare function flatMap(this: Result, f: (value: T) => Result): Result; declare function flatten(this: Result.Err): Result.Err; declare function flatten(this: Result.Ok>): Result.Err; declare function flatten(this: Result.Ok>): Result.Ok; declare function flatten(this: Result.Ok>): Result; declare function flatten(this: Result, E>): Result; declare function flatten(this: Result, E2>): Result.Err; declare function flatten(this: Result, E2>): Result; declare function assertErrorInstanceOf unknown>(this: Result.Ok, constructor: C): Result.Ok; declare function assertErrorInstanceOf unknown>(this: Result.Err, constructor: C): Result.Err>; declare function assertErrorInstanceOf unknown>(this: Result, constructor: C): Result>; /** * One grant pattern: `class(owner) @ recipient : verb : resource-id`. * * Plain data. A grant never carries authority by itself; derive inputs are * requests that the host validates against the parent card or the wallet. */ interface PatternGrant { readonly class: string; readonly owner: string; readonly recipient: string; readonly verb: string; readonly resourceId: string; } /** The four grant lists of a card's bound lattice. */ interface CardView { readonly lowerPositive: readonly PatternGrant[]; readonly lowerNegative: readonly PatternGrant[]; readonly upperPositive: readonly PatternGrant[]; readonly upperNegative: readonly PatternGrant[]; } /** * The four grant lists of a derive request. An omitted list is empty. * * For {@link PermissionCard.derive} the positive lists name the parent grants * to retain and the negative lists name the denials to add. For * {@link deriveFromWallet} and {@link deriveScope} they are the full requested * lists. */ interface Bounds { readonly lowerPositive?: readonly PatternGrant[]; readonly lowerNegative?: readonly PatternGrant[]; readonly upperPositive?: readonly PatternGrant[]; readonly upperNegative?: readonly PatternGrant[]; } /** An instant: seconds and nanoseconds since the Unix epoch (UTC). */ interface Timestamp { readonly seconds: bigint; readonly nanoseconds: number; } /** * The lifespan of a derived card, as an ISO-8601 duration. * * The host accepts only the `PnDTnHnMnS` form (days, hours, minutes and * seconds; for example `"P1DT2H"` or `"PT30S"`) and rejects other values, * including year, month and week units, with `invalid-pattern`. */ declare class Lifespan { readonly iso8601: string; private constructor(); /** A lifespan from an ISO-8601 duration string such as `"PT1H"`. */ static iso8601(value: string): Lifespan; /** A lifespan from a positive SDK {@link Duration}. */ static of(duration: Duration): Lifespan; } declare const CARD_ID_INTERNAL: unique symbol; /** * An opaque permission-card identifier. * * Card IDs are host-private: a `CardId` has no public constructor and exposes * no UUID or string form. Printing or serializing one gives a redacted * placeholder. The SDK interns identifiers, so two `CardId` values for the same * card are the same object; compare them with `===` or {@link CardId.equals}, * and use them as `Map` / `Set` keys. */ declare class CardId { /** @internal */ constructor(key: typeof CARD_ID_INTERNAL, value: string); equals(other: CardId): boolean; toString(): string; toJSON(): string; } /** * The target of {@link PermissionCard.install}. * * The host currently installs cards only on agents; account and application * targets return `not-permitted`. */ declare class Holder { readonly tag: 'account' | 'app' | 'agent'; readonly val: Uuid | AgentId; private constructor(); static account(accountId: Uuid): Holder; static app(applicationId: Uuid): Holder; static agent(agentId: AgentId): Holder; } /** The case names of the WIT `permission-error` variant. */ type PermissionErrorKind = PermissionError$1['tag']; /** An expected failure of a permission-card operation, reported by the host. */ declare class PermissionError extends Error { readonly kind: PermissionErrorKind; readonly details: string; readonly _tag = "PermissionError"; constructor(kind: PermissionErrorKind, details: string); } /** * The operations shared by {@link PermissionCard} and * {@link PolymorphicPermissionCard}. It is not part of the public API: use one * of the two card types. */ declare abstract class PersistentCard { /** @internal */ constructor(key: PermissionCardInternal, handle: GuestPermissionCardHandle); /** The card's identifier. */ id(): CardId; /** The identifiers of the card's parents in the derivation DAG. */ parents(): CardId[]; /** The card's expiry, or `undefined` when its lifespan is unbounded. */ expiresAt(): Timestamp | undefined; /** The card's grant lattice. Requires `card:inspect` authority over the card. */ inspect(): Result; /** * Derive a narrower child card. The positive lists of `bounds` name the * grants of this card to retain and the negative lists name the denials to * add. Requires `card:derive` authority over the card. The host labels the child * concrete or template. Child slots name the eventual holder and are universally * validated. A template parent must be in this agent's wallet, * where the host resolves it for this agent; otherwise the host returns * `not-permitted`. */ derive(bounds: Bounds, lifespan?: Lifespan): Result; /** * Revoke this card and every card derived from it, returning the number of * revoked cards. Moves the card, even when the host reports an error. */ revoke(): Result; /** * Install this card on `target`. Moves the card, even when the host reports * an error. Only agent targets are supported. */ install(target: Holder): Result; /** Drop this agent's handle to the card without revoking it. Moves the card. */ release(): void; /** `true` after the card was moved; every other operation then throws. */ isMoved(): boolean; toJSON(): never; } /** * An unforgeable concrete permission card held by this agent: every grant * names concrete owners and resources. * * Cards come only from the host: from {@link wallet}, a derive call, or an * agent method or RPC result. A card has no public constructor and cannot be * serialized. Sending a card to another agent, {@link PermissionCard.revoke}, * {@link PermissionCard.install} and {@link PermissionCard.release} move it; * every later use of a moved card throws. * * {@link PermissionCard.id}, {@link PermissionCard.parents} and * {@link PermissionCard.expiresAt} trap when the host no longer knows the card, * or when the card is revoked or expired. The other operations on such a card * return a `card-revoked` or `card-expired` {@link PermissionError}. * * In an agent or tool schema, declare it with * `s.permissionCard({ polymorphic: false })`. */ declare class PermissionCard extends PersistentCard { private readonly permissionCardBrand; } /** * An unforgeable template permission card held by this agent: its grants may * contain slot variables (`?agent`, `?env`, ...), which resolve for each * holder. * * It has the operations and the move rules of {@link PermissionCard}, and * {@link PolymorphicPermissionCard.derive} returns the host-labelled concrete or template child. A * template card is a `derive` or {@link deriveScope} parent only while it is in * this agent's wallet. The SDK has no conversion API between the two types * other than encoding and decoding through a schema: a decoded card takes the * type that the schema declares, and the host keeps the card's real kind. * * In an agent or tool schema, declare it with * `s.permissionCard({ polymorphic: true })`. */ declare class PolymorphicPermissionCard extends PersistentCard { private readonly polymorphicPermissionCardBrand; } /** * A stable schema graph paired with deterministic value conversions. Codecs are * immutable once compiled: conversions must not mutate the codec, its graph, or * any codec reachable through structural child links. */ interface SchemaCodec { /** Immutable root SchemaType and the nominal definitions it references. */ readonly graph: SchemaGraph; readonly toValue: (value: unknown) => SchemaValue; readonly fromValue: (value: SchemaValue) => unknown; /** Direct flat-wire conversion. Absent when this codec can contain owned resources. */ readonly direct?: DirectSchemaCodec; /** Structural invocation conversion, with the ordinary leaf codec semantics. */ readonly invocationDirect?: DirectSchemaCodec; /** Source validator retained for metadata literals whose constraints are not representable in WIT. */ readonly sourceSchema?: StandardSchemaV1; /** * True for the unit/void type: the method's `returns` maps to WIT * `output-schema.unit`, so `graph` is a placeholder and is never encoded. */ readonly isUnit?: boolean; /** * For OBJECT codecs (a WIT `record` with named fields, e.g. `z.object({...})`): * the per-field child codecs, in declaration order. Set by the vendor object * walkers so the config surface can flatten nested config to leaf fields * (each fetched by its full multi-segment path). Absent for non-object codecs * (including `z.record(k, v)` maps, which are read whole). */ readonly fields?: ReadonlyArray<{ readonly name: string; readonly codec: SchemaCodec; }>; /** JavaScript absence convention for a codec whose root is a WIT `option`. */ readonly optionKind?: 'optional' | 'nullable' | 'nullish'; /** * For an OPTIONAL object group (`z.object({...}).optional()`): the codec's own * `graph` round-trips as `option`, but {@link fields} is ALSO exposed * (mirrored from the inner object) so the config surface can DESCEND the group * into per-leaf declarations. This flag tells the config surface that the * descended group is optional — its leaves are declared to the host as * `option` (so an unset leaf reads as option-none instead of trapping) * and its runtime presence is decided by its REQUIRED children. Absent for a * plain (non-optional) object group. */ readonly optionalGroup?: boolean; /** Inner codec for a WIT `option`, preserving the source-schema convention. */ readonly optionInner?: SchemaCodec; /** Item codec for a WIT `list` or `fixed-list`. */ readonly listItem?: SchemaCodec; /** Concrete typed-array constructor for a WIT list marker. */ readonly typedArrayConstructor?: { new (length: number): unknown; readonly name: string; }; /** Item codec for a typed schema-value stream. */ readonly streamItem?: SchemaCodec; /** Child codecs for a WIT `map`, when the source schema exposes them. */ readonly mapKey?: SchemaCodec; readonly mapValue?: SchemaCodec; readonly mapKind?: 'record' | 'map'; readonly tupleItems?: readonly SchemaCodec[]; /** Arms for a WIT result. */ readonly resultOk?: SchemaCodec; readonly resultErr?: SchemaCodec; /** * For SECRET markers (`s.secret(inner)`): the inner (revealed-value) codec — * the one that decodes the plaintext after `golem:secrets/reveal`. The * marker's own `graph` is `secret` and its own `fromValue` yields the * raw handle; the config surface uses this inner codec to decode a revealed * secret leaf. */ readonly secretInner?: SchemaCodec; /** * For the PRINCIPAL marker (`s.principal()`): the auto-injection kind. When a * method/constructor takes a bare `s.principal()` parameter, the caller does * NOT supply it — the host injects the caller's `Principal` (WIT * `field-source.auto-injected(principal)`). The runtime uses this to emit the * `auto-injected` source, decode the param from the separate invoke `principal` * arg (consuming no wire field), and exclude it from HTTP/RPC caller inputs. * A principal NESTED inside a record/return is ordinary user-supplied data and * is unaffected (only a top-level parameter codec is auto-injected). */ readonly autoInjected?: 'principal'; } /** Shared flat-value arena used while directly encoding child codecs. */ declare class SchemaValueWriter { readonly valueNodes: SchemaValueNode[]; readonly resources: Set; add(node: SchemaValueNode): number; /** Generated guest codecs retain ordinary scalar representability checks. */ scalar(tag: 'bool' | 's8' | 's16' | 's32' | 's64' | 'u8' | 'u16' | 'u32' | 'u64' | 'f32' | 'f64' | 'char' | 'string', value: unknown): number; } /** Shared flat-value arena used while directly decoding child codecs. */ declare class SchemaValueReader { readonly valueNodes: readonly SchemaValueNode[]; private readonly invocation; private readonly active; private readonly read; constructor(valueNodes: readonly SchemaValueNode[], invocation?: boolean); node(index: number | undefined, tag: SchemaValueNode['tag'], decode: (node: SchemaValueNode) => T): T; finish(): void; } interface DirectSchemaCodec { write(value: unknown, writer: SchemaValueWriter): number | undefined; read(reader: SchemaValueReader, index: number | undefined): unknown; } /** * A per-vendor schema walker. Given a schema (a Standard Schema value of a known * vendor) and a `recurse` callback for child schemas, it produces a `SchemaCodec`. * Only the walker is vendor-specific; `SchemaCodec` is vendor-neutral. */ type SchemaWalker = (schema: unknown, recurse: (child: unknown) => SchemaCodec) => SchemaCodec; /** * A demand-driven, single-reader stream for values nested anywhere in an agent method input or * output. * * Reading is lazy and non-concurrent: wait for each operation before starting another. Normal * completion returns `{ done: true, value: undefined }`. Encoding or forwarding an `AgentStream` * transfers its ownership; the original object cannot be used again. * * For a stream received through a connected P3 agent invocation, calling `return()`, including the * call made by an early exit from `for await`, closes its readable endpoint. Calling `throw()` also * closes it and rejects with the same local reason; the reason is not transmitted to the producer. * * When a stream created with {@link AgentStream.from} is sent through a connected P3 invocation, * each accepted downstream write gates the next source pull. If a subsequent write observes that * the remote reader was dropped, the runtime stops pulling and invokes and awaits the source * iterator's `return()` exactly once. P3 does not interrupt an arbitrary pending source `next()` or * guarantee cleanup before a later agent invocation. A source or cleanup rejection fails the * active producer, write, or invocation session rather than appearing as clean EOF. P3 streams do * not carry a recoverable terminal error; use an item type such as `Result` when errors must * be represented in the stream contract. */ declare class AgentStream implements AsyncIterable, AsyncIterator { private constructor(); /** * Create a stream from a synchronous or asynchronous iterable without pulling it eagerly. * * The source iterator's `return()` is used for cleanup when either the local stream is closed or * a connected remote reader is dropped. */ static from(source: Iterable | AsyncIterable): AgentStream; [Symbol.asyncIterator](): AsyncIterator; /** Read the next item, or `{ done: true, value: undefined }` after clean completion. */ next(): Promise>; /** * Close the stream and its underlying iterator. `for await` invokes this automatically on an * early `break` or `return`. */ return(value?: unknown): Promise>; /** * Fail local iteration and close a connected readable endpoint. * * Connected P3 streams reject with the same local reason, but do not transfer that reason to the * producer. Streams created with {@link AgentStream.from} delegate to the source iterator's * `throw()` when it provides one, but the `AgentStream` is consumed regardless of its result. */ throw(error?: unknown): Promise>; } /** * Hidden brand key carried by every marker schema. The value is a * {@link MarkerDescriptor} the adapter uses to build the {@link SchemaCodec}. * A unique, unexported `Symbol` cannot be forged or guessed, so only this module * mints markers and only the adapter reads the brand. */ declare const WIT_MARKER: unique symbol; /** * Build a {@link SchemaCodec} from a marker. `recurse` compiles an inner * Standard Schema (the same `compileSchema` callback the vendor walkers use), so * capability wrappers (e.g. `s.secret(inner)`) can descend into their payload. */ type MarkerDescriptor = (recurse: (child: unknown) => SchemaCodec) => SchemaCodec; /** * Type-level classification of a marker. `'scalar'` covers everything that can * be bound from a string source (numeric pins, `char`, `datetime`, `url`, * `secret`, …); the other three tag the rich payload markers that can NOT be * bound from a path / query / header variable and therefore must be excluded * from HTTP variable binding (see {@link MarkerKindOf} / `BindableKeys`). */ type MarkerKind = 'scalar' | 'multimodal' | 'unstructured-text' | 'unstructured-binary' | 'secret' | 'result' | 'option' | 'typed-array' | 'principal' | 'stream'; /** Pure phantom key carrying a marker's {@link MarkerKind} at the type level. */ declare const MARKER_KIND: unique symbol; /** A Standard Schema that additionally carries a {@link WIT_MARKER} brand. */ interface MarkerSchema extends StandardSchemaV1 { readonly [WIT_MARKER]: MarkerDescriptor; /** * PURE PHANTOM: never assigned at runtime (no runtime object carries it), so * marker values are structurally unchanged. It exists only so the marker's * {@link MarkerKind} is recoverable at the type level via {@link MarkerKindOf}. */ readonly [MARKER_KIND]?: Kind; } /** * Runtime brand key carried by every secret marker; its value is the marker's * INNER Standard Schema (describing the revealed plaintext). It doubles as the * type-level carrier of the inner type — {@link SecretInnerOf} recovers it — so * no separate phantom field is needed. Symbol-keyed, so it is invisible to * `JSON.stringify` / `Object.keys` and does not disturb the codec build. */ declare const SECRET_INNER: unique symbol; /** * A secret marker: a {@link MarkerSchema} of kind `'secret'` that additionally * carries its inner (revealed) schema under {@link SECRET_INNER}. The static * `Inner` type is recoverable via {@link SecretInnerOf}. */ interface SecretMarkerSchema extends MarkerSchema { readonly [SECRET_INNER]: StandardSchemaV1; } /** Options for pinning a numeric with inline min/max/unit restrictions. */ interface NumericOpts { min?: number | bigint; max?: number | bigint; unit?: string; } interface PathOptions { direction?: PathDirection; kind?: PathKind; allowedMimeTypes?: string[]; allowedExtensions?: string[]; } interface QuantityOptions { baseUnit: string; allowedSuffixes?: string[]; min?: QuantityValue; max?: QuantityValue; } interface KeyValueOptions { keySchema?: StandardSchemaV1; } /** A filesystem path value backed by the rich WIT `path` schema node. */ declare function Path(options?: PathOptions): MarkerSchema; /** A fixed-point quantity backed by the rich WIT `quantity` schema node. */ declare function Quantity(options: QuantityOptions): MarkerSchema; /** A key-value collection backed by a real WIT `map` node. */ declare function KeyValue(valueSchema: StandardSchemaV1): MarkerSchema>; declare function KeyValue(valueSchema: StandardSchemaV1, options: KeyValueOptions & { keySchema: StandardSchemaV1; }): MarkerSchema>; /** Binary data backed by the rich WIT `binary` node, not `list`. */ declare function Bytes(options?: BinaryRestrictions): MarkerSchema; interface PermissionCardOptions { /** * `true` for a template card, whose grants may contain slot variables; * `false` for a concrete card. `s.permissionCard` needs a literal value. */ polymorphic: Polymorphic; } /** * A `permission-card` schema node. `polymorphic: false` declares a concrete * {@link PermissionCard}; `polymorphic: true` declares a template * {@link PolymorphicPermissionCard}. A received card is decoded into the * declared type; the host keeps the card's real kind. */ declare function permissionCardMarker(options: PermissionCardOptions): MarkerSchema; declare function permissionCardMarker(options: PermissionCardOptions): MarkerSchema; /** Domain value of an unstructured-text parameter: `url` or `inline` text. */ type TextReferenceValue = { tag: 'url'; val: string; } | { tag: 'inline'; val: string; languageCode?: string; }; /** Domain value of an unstructured-binary parameter: `url` or `inline` bytes. */ type BinaryReferenceValue = { tag: 'url'; val: string; } | { tag: 'inline'; val: Uint8Array; mimeType?: string; }; interface UnstructuredTextOpts { languages?: string[]; } interface UnstructuredBinaryOpts { mimeTypes?: string[]; } /** Domain value element of a multimodal payload: `{ tag, value }`. */ interface MultimodalElement { tag: string; value: unknown; } /** One named multimodal case: a name plus the marker / Standard Schema for it. */ interface MultimodalCase { name: string; schema: unknown; } /** * Vendor-neutral marker schemas for WIT kinds Standard Schema can't express on * its own: numeric pins, `char`, `datetime`, `duration`, `url`, `bytes`, plus * the capability / rich nodes (`secret`, `quota-token`, `permission-card`, `multimodal`, * `unstructured*`) and the `option` / `result` wrappers. Each returns a * {@link MarkerSchema} usable anywhere a Standard Schema is accepted; `stream` * is restricted to agent method inputs and outputs by the agent schema validator. */ declare const s: { u8: (opts?: NumericOpts) => MarkerSchema; u16: (opts?: NumericOpts) => MarkerSchema; u32: (opts?: NumericOpts) => MarkerSchema; u64: (opts?: NumericOpts) => MarkerSchema; s8: (opts?: NumericOpts) => MarkerSchema; s16: (opts?: NumericOpts) => MarkerSchema; s32: (opts?: NumericOpts) => MarkerSchema; s64: (opts?: NumericOpts) => MarkerSchema; f32: (opts?: NumericOpts) => MarkerSchema; char: () => MarkerSchema; uuid: () => MarkerSchema; datetime: () => MarkerSchema; duration: () => MarkerSchema; url: () => MarkerSchema; text: (opts?: TextRestrictions) => MarkerSchema; bytes: () => MarkerSchema, "typed-array">; binary: (opts?: BinaryRestrictions) => MarkerSchema, "scalar">; int8Array: () => MarkerSchema, "typed-array">; uint8Array: () => MarkerSchema, "typed-array">; int16Array: () => MarkerSchema, "typed-array">; uint16Array: () => MarkerSchema, "typed-array">; int32Array: () => MarkerSchema, "typed-array">; uint32Array: () => MarkerSchema, "typed-array">; float32Array: () => MarkerSchema, "typed-array">; float64Array: () => MarkerSchema, "typed-array">; bigInt64Array: () => MarkerSchema, "typed-array">; bigUint64Array: () => MarkerSchema, "typed-array">; secret: (inner: StandardSchemaV1) => SecretMarkerSchema; quotaToken: () => MarkerSchema; stream: (inner: StandardSchemaV1) => MarkerSchema, "stream">; permissionCard: typeof permissionCardMarker; principal: () => MarkerSchema; multimodal: (cases: MultimodalCase[]) => MarkerSchema; unstructuredText: (opts?: UnstructuredTextOpts) => MarkerSchema; unstructuredBinary: (opts?: UnstructuredBinaryOpts) => MarkerSchema; option: (innerSchema: StandardSchemaV1) => MarkerSchema; result: (okSchema: StandardSchemaV1, errSchema: StandardSchemaV1) => MarkerSchema, "result">; }; declare function registerSchemaWalker(vendor: string, walker: SchemaWalker): void; /** Registered vendors (for diagnostics). */ declare function registeredVendors(): string[]; /** * Compile a Standard Schema value into a {@link SchemaCodec} via its vendor * walker. Seeds a fresh {@link RecursionRegistry} so self- and mutually-recursive * schemas (e.g. a `Tree`) close to a named `ref` def instead of infinite-looping; * the registry is threaded through the recursive walk (see {@link compileSchemaWith}). */ declare function compileSchema(schema: unknown): SchemaCodec; type ToolInputStream = ReadableStream; type SettledToolResult = { readonly status: 'fulfilled'; readonly value: Result; } | { readonly status: 'rejected'; readonly reason: unknown; }; interface CollectedToolInvocation { readonly result: SettledToolResult; readonly stdout: SettledToolResult; readonly stderr: SettledToolResult; } interface StartedToolInvocation { readonly stdout?: ReadableStream; readonly stderr?: ReadableStream; readonly result: Promise; cancel(): void; /** Stop result delivery without cancelling the invocation or either output. */ detachResult(): void; collect(): Promise>; } /** A metadata-time value kept with the codec that gives it its wire meaning. */ interface CodecValue { readonly codec: SchemaCodec; readonly value: T; } interface ExtendedCommandNode { readonly name: string; readonly aliases: readonly string[]; readonly doc: Doc; readonly globals: ExtendedGlobals; readonly subcommands: readonly ExtendedCommandNode[]; readonly body?: ExtendedCommandBody; /** Reconcile this independently built subtree root against strict ancestor globals. */ readonly reconcileInheritedGlobals?: true; } interface ExtendedGlobals { readonly options: readonly ExtendedOptionSpec[]; readonly flags: readonly FlagSpec[]; } interface ExtendedCommandBody { readonly positionals: ExtendedPositionals; readonly options: readonly ExtendedOptionSpec[]; readonly flags: readonly FlagSpec[]; readonly constraints: readonly ExtendedConstraint[]; readonly stdin?: StreamSpec; readonly stdout?: StreamSpec; readonly stderr?: StreamSpec; readonly result?: ExtendedResultSpec; readonly errors: readonly ExtendedErrorCase[]; readonly annotations?: CommandAnnotations; } interface ExtendedPositionals { readonly fixed: readonly ExtendedPositional[]; readonly tail?: ExtendedTailPositional; } interface ExtendedPositional { readonly name: string; readonly doc: Doc; readonly valueName?: string; readonly codec: SchemaCodec; readonly default?: CodecValue; readonly required: boolean; readonly acceptsStdio: boolean; } interface ExtendedTailPositional { readonly name: string; readonly doc: Doc; readonly valueName?: string; readonly itemCodec: SchemaCodec; readonly min: number; readonly max?: number; readonly separator?: string; readonly verbatim: boolean; readonly acceptsStdio: boolean; } interface ExtendedOptionSpec { readonly long: string; readonly short?: string; readonly aliases: readonly string[]; readonly doc: Doc; readonly valueName?: string; readonly shape: ExtendedOptionShape; readonly default?: CodecValue; readonly required: boolean; readonly envVar?: string; } type ExtendedOptionShape = { readonly tag: 'scalar'; readonly codec: SchemaCodec; } | { readonly tag: 'optional-scalar'; readonly codec: SchemaCodec; } | { readonly tag: 'repeatable-list'; readonly repetition: Repetition; readonly itemCodec: SchemaCodec; } | { readonly tag: 'repeatable-map'; readonly repetition: Repetition; readonly mapCodec: SchemaCodec; readonly valueCodec: SchemaCodec; readonly duplicateKeyPolicy: DuplicateKeyPolicy; }; interface ExtendedResultSpec { readonly codec: SchemaCodec; readonly doc: Doc; readonly formatters: readonly Formatter[]; readonly defaultFormatter: string; } interface ExtendedErrorCase { readonly name: string; readonly doc: Doc; readonly kind: ErrorKind; readonly exitCode: number; readonly payloadCodec?: SchemaCodec; } type ExtendedValueIsLiteral = { readonly tag: 'deferred'; readonly value: unknown; } | { readonly tag: 'resolved'; readonly codec: SchemaCodec; readonly value: unknown; readonly schemaValue: SchemaValue; }; type ExtendedRef = { readonly tag: 'present'; readonly name: string; } | { readonly tag: 'value-is'; readonly name: string; readonly value: ExtendedValueIsLiteral; }; type ExtendedConstraint = { readonly tag: 'requires-all'; readonly refs: readonly ExtendedRef[]; } | { readonly tag: 'all-or-none'; readonly refs: readonly ExtendedRef[]; } | { readonly tag: 'requires-any'; readonly refs: readonly ExtendedRef[]; } | { readonly tag: 'mutex-groups'; readonly groups: readonly (readonly ExtendedRef[])[]; } | { readonly tag: 'implies'; readonly lhsQuant: Quantifier; readonly lhs: readonly ExtendedRef[]; readonly rhsQuant: Quantifier; readonly rhs: readonly ExtendedRef[]; } | { readonly tag: 'forbids'; readonly lhsQuant: Quantifier; readonly lhs: readonly ExtendedRef[]; readonly rhs: readonly ExtendedRef[]; }; type EffectiveCommandField = { readonly tag: 'option'; readonly option: ExtendedOptionSpec; } | { readonly tag: 'flag'; readonly flag: FlagSpec; }; interface CanonicalInputField { readonly name: string; readonly aliases: readonly string[]; readonly codec: SchemaCodec; readonly optionalCarrier?: true; } interface CanonicalInputValue { readonly name: string; readonly aliases: readonly string[]; readonly codec: SchemaCodec; readonly optionalCarrier?: true; readonly value: unknown; readonly schemaValue: SchemaValue; } /** Ordered canonical record codec shared by invocation and typed clients. */ declare class CanonicalInputModel { readonly fields: readonly CanonicalInputField[]; readonly codec: SchemaCodec; constructor(fields: readonly CanonicalInputField[]); encode(input: Record): SchemaValue; encodeTyped(input: Record): TypedSchemaValue; /** Encode the ordinary invocation carrier without allocating the owned schema-value model. */ encodeWire(input: Record): { graph: golem_core_types_2_0_0.SchemaGraph; value: golem_core_types_2_0_0.SchemaValueTree; }; encodeWireForStartedInvocation(input: Record): { graph: golem_core_types_2_0_0.SchemaGraph; value: golem_core_types_2_0_0.SchemaValueTree; } | Promise; encodeWireAsync(input: Record): Promise<{ graph: golem_core_types_2_0_0.SchemaGraph; value: golem_core_types_2_0_0.SchemaValueTree; }>; decode(input: SchemaValue): Record; decodeValues(input: SchemaValue): CanonicalInputValue[]; /** * Project fields decoded by another canonical model into this model's field * identities. Schema values cross ownership boundaries and are decoded with * the target codec so each independently registered tool receives its native * value representation. */ projectValues(input: readonly CanonicalInputValue[]): CanonicalInputValue[]; /** Rebuild this model's positional record from fields decoded by another canonical model. */ forwardValues(input: readonly CanonicalInputValue[]): TypedSchemaValue; } type ToolHelpArgumentKind = 'global-option' | 'global-flag' | 'positional' | 'tail' | 'option' | 'flag'; interface ToolHelpArgument { readonly kind: ToolHelpArgumentKind; readonly name: string; readonly short?: string; readonly aliases: readonly string[]; readonly doc: Doc; readonly required?: boolean; readonly valueName?: string; readonly default?: CodecValue; readonly envVar?: string; readonly acceptsStdio?: boolean; readonly min?: number; readonly max?: number; readonly separator?: string; readonly verbatim?: boolean; readonly flagDefault?: boolean; readonly negatable?: boolean; readonly countMax?: number; } interface ToolHelpProjection { readonly command: ExtendedCommandNode; readonly commandPath: readonly string[]; readonly arguments: readonly ToolHelpArgument[]; readonly subcommands: readonly ExtendedCommandNode[]; } declare class ExtendedToolType { readonly version: string; readonly root: ExtendedCommandNode; readonly requiresFilesystem: boolean; constructor(version: string, root: ExtendedCommandNode, requiresFilesystem?: boolean); get toolName(): string; /** Resolve a root-excluded command path by canonical name or alias. */ commandByPath(commandPath: readonly string[], requireBody?: boolean): ExtendedCommandNode | undefined; /** Return the root-to-node object path, guarding against malformed cycles. */ pathTo(target: ExtendedCommandNode): readonly ExtendedCommandNode[] | undefined; commandPath(target: ExtendedCommandNode): readonly string[] | undefined; effectiveGlobals(target: ExtendedCommandNode): EffectiveCommandField[]; canonicalInputFields(target: ExtendedCommandNode): CanonicalInputField[]; canonicalInputModel(target: ExtendedCommandNode): CanonicalInputModel; projectHelp(commandPath: readonly string[]): ToolHelpProjection | undefined; } interface ToolClientOptions { readonly transport?: ToolClientTransport; /** Stable leaf registration name when the definition describes an adapted presented surface. */ readonly lookupName?: string; } type CamelCase = Name extends `${infer Head}-${infer Tail}` ? `${Head}${Capitalize>}` : Name; type Simplify = { [Key in keyof Value]: Value[Key]; } & {}; type SchemaOutput = StandardSchemaV1.InferOutput; type SuccessOutput = [SchemaOutput] extends [void] ? undefined : SchemaOutput; type StreamPresence = 'none' | 'optional' | 'required'; declare const TAIL_ARGUMENT: unique symbol; declare const GLOBAL_SURFACES: unique symbol; declare const BODY_SURFACES: unique symbol; type AddArgument = Args & (Required extends true ? { [Key in CamelCase]: Value; } : { [Key in CamelCase]?: Value; }); interface ArgumentSurface { readonly name: Name; readonly aliases: Aliases; } type GlobalEntries = Globals extends { readonly [GLOBAL_SURFACES]: infer Entries; } ? Entries : never; type GlobalArguments = Omit; type OptionAliases = Options extends { readonly aliases: readonly (infer Alias)[]; } ? Extract : never; type AddGlobalArgument = AddArgument, Name, Value, Required> & { readonly [GLOBAL_SURFACES]: GlobalEntries | ArgumentSurface>; }; type SurfaceIdentifiers = Entry extends ArgumentSurface ? Name | Aliases : never; type CapturedGlobalNames = GlobalEntries extends infer Entry ? Entry extends ArgumentSurface ? Extract, SurfaceIdentifiers>> extends never ? never : CamelCase : never : never; type UncapturedGlobalEntries = GlobalEntries extends infer Entry ? Entry extends ArgumentSurface ? Extract, SurfaceIdentifiers>> extends never ? Entry : never : never : never; type ReconcileGlobalArguments = Omit, CapturedGlobalNames> & { readonly [GLOBAL_SURFACES]: UncapturedGlobalEntries; }; type MergeGlobalArguments = GlobalArguments & GlobalArguments & { readonly [GLOBAL_SURFACES]: GlobalEntries | GlobalEntries; }; type BodySurfaceEntries = Args extends { readonly [BODY_SURFACES]: infer Entries; } ? Entries : never; type BodyArguments = Omit; type AddBodyArgument = AddArgument, Name, Value, Required> & { readonly [BODY_SURFACES]: BodySurfaceEntries | ArgumentSurface; }; type CapturedBodyNames = BodySurfaceEntries extends infer Entry ? Entry extends ArgumentSurface ? Extract, SurfaceIdentifiers>> extends never ? never : CamelCase : never : never; type UncapturedBodyEntries = BodySurfaceEntries extends infer Entry ? Entry extends ArgumentSurface ? Extract, SurfaceIdentifiers>> extends never ? Entry : never : never : never; type ReconcileBodyArguments = Omit | typeof BODY_SURFACES> & { readonly [BODY_SURFACES]: UncapturedBodyEntries; }; type TailArgumentKey = Args extends { readonly [TAIL_ARGUMENT]: infer Key; } ? Extract : never; type NonTailBodyEntries = BodySurfaceEntries extends infer Entry ? Entry extends ArgumentSurface ? CamelCase extends TailArgumentKey ? never : Entry : never : never; type ReplaceTailArgument = Omit | typeof TAIL_ARGUMENT | typeof BODY_SURFACES> & { [Key in CamelCase]: Value; } & { readonly [TAIL_ARGUMENT]: CamelCase; readonly [BODY_SURFACES]: NonTailBodyEntries | ArgumentSurface; }; type PublicArguments = Omit; type HasDefault = Options extends { readonly default: unknown; } ? true : false; type IsRequired = Options extends { readonly required: infer Required; } ? Required extends true ? true : Required extends false ? false : Default : Default; type IsRepeatable = Options extends { readonly repeatable: RepeatableMode; } ? true : false; type OptionIsRequired = IsRepeatable extends true ? true : HasDefault extends true ? true : IsRequired; type PositionalIsRequired = HasDefault extends true ? true : IsRequired; type FlagValue = Options extends { readonly kind: 'count-flag'; } ? number : boolean; type SchemaProducesMap = SchemaOutput extends ReadonlyMap ? true : Schema extends { readonly keyType: unknown; readonly valueType: unknown; } ? true : false; type OptionValue = IsRepeatable extends true ? SchemaProducesMap extends true ? SchemaOutput : SchemaOutput[] : Options extends { readonly optionalScalar: true; } ? HasDefault extends true ? SchemaOutput : SchemaOutput | undefined : SchemaOutput; type StreamState = Options extends { readonly required: true; } ? 'required' : 'optional'; interface ToolBodyModel { readonly args: Args; readonly success: Success; readonly errors: Errors; readonly stdin: Stdin; readonly stdout: Stdout; readonly stderr: Stderr; } type AnyToolBodyModel = ToolBodyModel; interface ToolCommandModel { readonly name: Name; readonly globals: Globals; readonly body: Body; readonly children: Children; } interface ToolSubtreeModel { readonly ownership: 'subtree'; readonly command: Command; } type BodyModelOf = Builder extends BodyBuilder ? ToolBodyModel : never; type ToolCommandModelOf = Builder extends CommandBuilder ? ToolCommandModel : never; type BodyArgs = Body extends ToolBodyModel ? PublicArguments : {}; type BodySuccess = Body extends ToolBodyModel ? Success : never; type BodyErrors = Body extends ToolBodyModel ? Errors : never; type BodyStdin = Body extends ToolBodyModel ? Stdin : 'none'; type BodyStdout = Body extends ToolBodyModel ? Stdout : 'none'; type BodyStderr = Body extends ToolBodyModel ? Stderr : 'none'; type ReconcileBodyModel = Body extends ToolBodyModel ? ToolBodyModel, Success, Errors, Stdin, Stdout, Stderr> : Body; type StreamContextField = Presence extends 'required' ? { readonly [Key in Name]: Stream; } : Presence extends 'optional' ? { readonly [Key in Name]?: Stream; } : {}; type ToolInvocationContext = Simplify<{ readonly principal: Principal; } & StreamContextField<'stdin', Stdin, ReadableStream> & StreamContextField<'stdout', Stdout, WritableStream> & StreamContextField<'stderr', Stderr, WritableStream>>; interface ToolOk { readonly tag: 'ok'; readonly value: Value; } type ToolErr = [Payload] extends [never] ? { readonly tag: 'err'; readonly name: Name; readonly hasPayload: false; readonly payload?: never; } : { readonly tag: 'err'; readonly name: Name; readonly hasPayload: true; readonly payload: Payload; }; type ToolResult = ToolOk | Errors; declare function ok(value: Value): ToolOk; declare function err(name: Name): ToolErr; declare function err(name: Name, payload: Payload): ToolErr; type ToolHandler = (args: Simplify, context: Context) => ToolResult | Promise>; declare const COMMAND_IMPLEMENTATION: unique symbol; type NestedCommandImplementation = Children & { readonly [COMMAND_IMPLEMENTATION]: { readonly body: Body; readonly receiver: Children; }; }; declare function command(children: Children): NestedCommandImplementation; declare function command(body: Body, children: Children): NestedCommandImplementation; type HandlerFor = Model extends ToolCommandModel ? Body extends AnyToolBodyModel ? ToolHandler> & BodyArgs, BodySuccess, BodyErrors, ToolInvocationContext, BodyStdout, BodyStderr>> : never : never; type ChildImplementations = { [Name in keyof Children as Children[Name] extends ToolSubtreeModel ? never : Name]: NodeImplementation; } & { [Name in keyof Children as Children[Name] extends ToolSubtreeModel ? Name : never]?: never; }; type NodeImplementation = Model extends ToolCommandModel ? keyof Children extends never ? Body extends AnyToolBodyModel ? HandlerFor : NestedCommandImplementation : Body extends AnyToolBodyModel ? NestedCommandImplementation, ChildImplementations>> : NestedCommandImplementation>> : never; type RootImplementation = Model extends ToolCommandModel ? Simplify<(Body extends AnyToolBodyModel ? { [Key in Name]: HandlerFor; } : {}) & ChildImplementations> : never; type ToolImplementation = RootImplementation>; declare const TOOL_CLIENT_ERRORS: unique symbol; interface ToolClientMethod { (args: Simplify): Result; readonly [TOOL_CLIENT_ERRORS]: Errors; } type ToolClientErrors = Method extends { readonly [TOOL_CLIENT_ERRORS]: infer Errors; } ? Errors : never; type ClientStdin = StreamContextField<'stdin', BodyStdin, ToolInputStream>; type ClientResult = BodyStdout extends 'required' | 'optional' ? StartedToolInvocation> : BodyStderr extends 'required' | 'optional' ? StartedToolInvocation> : [BodySuccess] extends [undefined] ? Promise : Promise>; type ClientMethodFor = Model extends ToolCommandModel ? Body extends AnyToolBodyModel ? ToolClientMethod> & BodyArgs & ClientStdin, ClientResult, BodyErrors> : never : never; type ChildClients = { [Name in keyof Children]: NodeClient; }; type NodeClient = Model extends ToolSubtreeModel ? NodeClient : Model extends ToolCommandModel ? NodeClientWithGlobals : Globals, Reconcile extends true ? ReconcileBodyModel : Body, Children> : never; type NodeClientWithGlobals = Model extends ToolCommandModel ? Body extends AnyToolBodyModel ? ClientMethodFor, Inherited> & ChildClients> : ChildClients> : never; type RootClient = Model extends ToolCommandModel ? (Body extends AnyToolBodyModel ? { [Key in Name]: ClientMethodFor; } : {}) & ChildClients : never; type ToolClient = Simplify>>; type UnderlyingStdin = StreamContextField<'stdin', BodyStdin, AsyncIterable>; type ToolUnderlyingInvocation = { readonly result: Promise; cancel(): void; }; type UnderlyingInvocation = ToolUnderlyingInvocation> & (BodyStdout extends 'required' ? { readonly stdout: AsyncIterable; } : BodyStdout extends 'optional' ? { readonly stdout?: AsyncIterable; } : { readonly stdout?: never; }) & (BodyStderr extends 'required' ? { readonly stderr: AsyncIterable; } : BodyStderr extends 'optional' ? { readonly stderr?: AsyncIterable; } : { readonly stderr?: never; }); type UnderlyingOutputField = Presence extends 'required' ? { readonly [Key in Name]: AsyncIterable; } : Presence extends 'optional' ? { readonly [Key in Name]?: AsyncIterable; } : {}; type UnderlyingResult = BodyStderr extends 'required' | 'optional' ? ([BodySuccess] extends [undefined] ? {} : { result: BodySuccess; }) & UnderlyingOutputField<'stdout', BodyStdout> & UnderlyingOutputField<'stderr', BodyStderr> : BodyStdout extends 'required' ? [BodySuccess] extends [undefined] ? AsyncIterable : { result: BodySuccess; stdout: AsyncIterable; } : BodyStdout extends 'optional' ? [BodySuccess] extends [undefined] ? AsyncIterable | undefined : { result: BodySuccess; stdout?: AsyncIterable; } : [BodySuccess] extends [undefined] ? void : BodySuccess; type ToolUnderlyingMethod = { start(args: Simplify): Promise>; readonly [TOOL_CLIENT_ERRORS]: Errors; } & (BodyStdout extends 'none' ? BodyStderr extends 'none' ? (args: Simplify) => Promise> : {} : {}); type UnderlyingMethodFor = Model extends ToolCommandModel ? Body extends AnyToolBodyModel ? ToolUnderlyingMethod> & BodyArgs & UnderlyingStdin, Body, BodyErrors> : never : never; type UnderlyingChildClients = { [Name in keyof Children]: UnderlyingNodeClient; }; type UnderlyingNodeClient = Model extends ToolSubtreeModel ? UnderlyingNodeClient : Model extends ToolCommandModel ? UnderlyingNodeClientWithGlobals : Globals, Reconcile extends true ? ReconcileBodyModel : Body, Children> : never; type UnderlyingNodeClientWithGlobals = Model extends ToolCommandModel ? Body extends AnyToolBodyModel ? UnderlyingMethodFor, Inherited> & UnderlyingChildClients> : UnderlyingChildClients> : never; type RootUnderlyingClient = Model extends ToolCommandModel ? (Body extends AnyToolBodyModel ? { [Key in Name]: UnderlyingMethodFor; } : {}) & UnderlyingChildClients : never; type ToolUnderlying = Simplify>>; type ToolUnderlyingErrors = ToolClientErrors; type ToolMiddlewareInvocationContext = Simplify<{ readonly principal: Principal; readonly underlying: ToolUnderlying; readonly parameters: Parameters; } & StreamContextField<'stdin', Stdin, AsyncIterable>>; type ToolMiddlewareHandler = (args: Simplify, context: Context) => Result | Promise; type MiddlewareHandlerFor = Model extends ToolCommandModel ? Body extends AnyToolBodyModel ? ToolMiddlewareHandler> & BodyArgs, UnderlyingResult, ToolMiddlewareInvocationContext, Params>> : never : never; type MiddlewareChildImplementations = { [Name in keyof Children]: MiddlewareNodeImplementation; }; type MiddlewareNodeImplementation = Model extends ToolSubtreeModel ? MiddlewareNodeImplementation : Model extends ToolCommandModel ? MiddlewareNodeImplementationWithGlobals : Globals, Reconcile extends true ? ReconcileBodyModel : Body, Children, Params> : never; type MiddlewareNodeImplementationWithGlobals = Model extends ToolCommandModel ? keyof Children extends never ? Body extends AnyToolBodyModel ? MiddlewareHandlerFor, Inherited, UnderlyingDefinition, Params> : NestedCommandImplementation : Body extends AnyToolBodyModel ? NestedCommandImplementation, Inherited, UnderlyingDefinition, Params>, MiddlewareChildImplementations, UnderlyingDefinition, Params>> : NestedCommandImplementation, UnderlyingDefinition, Params>> : never; type RootMiddlewareImplementation = Model extends ToolCommandModel ? Simplify<(Body extends AnyToolBodyModel ? { [Key in Name]: MiddlewareHandlerFor; } : {}) & MiddlewareChildImplementations> : never; type ToolMiddlewareImplementation = RootMiddlewareImplementation, ExpectedDefinition, Parameters>; interface ImplementedToolMiddleware { readonly name: Name; } interface ToolMiddlewareMetadataOptions { readonly name: Name; readonly version?: string; readonly aliases?: readonly string[]; readonly doc?: DocInput; readonly parameterSchema?: StandardSchemaV1; } type ToolMiddlewareOptions> = TransparentToolMiddlewareOptions | AdapterToolMiddlewareOptions; type TransparentToolMiddlewareOptions> = ToolMiddlewareMetadataOptions & { readonly parameterSchema?: ParameterSchema; readonly wraps?: undefined; readonly implementation: ToolMiddlewareImplementation>; }; type AdapterToolMiddlewareOptions> = ToolMiddlewareMetadataOptions & { readonly parameterSchema?: ParameterSchema; readonly wraps: ExpectedDefinition; readonly implementation: ToolMiddlewareImplementation>; }; interface UniversalToolUnderlying { readonly invoke: UniversalToolUnderlyingInvoke; invokeAndAwait(commandPath: readonly string[], input: TypedSchemaValue$1, stdin: AsyncIterable | undefined): Promise; } interface UniversalToolUnderlyingInvoke { (commandPath: readonly string[], input: TypedSchemaValue$1, stdin: AsyncIterable | undefined): Promise & { readonly stdout?: AsyncIterable; readonly stderr?: AsyncIterable; }>; readonly [TOOL_CLIENT_ERRORS]: TypedSchemaValue$1; } interface UniversalToolMiddlewareInvocation { readonly toolName: string; readonly toolMetadata: Tool; readonly commandPath: readonly string[]; readonly input: TypedSchemaValue$1; readonly stdin?: AsyncIterable; readonly stdout?: ToolOutputWriter; readonly stderr?: ToolOutputWriter; readonly principal: Principal; } interface UniversalToolMiddlewareContext { readonly underlying: UniversalToolUnderlying; readonly parameters: Parameters; } type UniversalToolMiddlewareInvoke = (invocation: UniversalToolMiddlewareInvocation, context: UniversalToolMiddlewareContext) => InvocationResult | Promise; interface UniversalToolMiddlewareOptions> { readonly name: Name; readonly version?: string; readonly aliases?: readonly string[]; readonly doc?: DocInput; readonly parameterSchema?: ParameterSchema; readonly invoke: UniversalToolMiddlewareInvoke>; } interface ToolClientInvocationResult { readonly stdout?: AsyncIterable; readonly stderr?: AsyncIterable; readonly settledResult: Promise>; cancel(): void; } /** Raw WIT invocation seam used by typed tool clients. */ interface ToolClientTransport { start(commandPath: readonly string[], input: TypedSchemaValue$1, stdin: ToolInputStream | undefined, stdout: boolean, stderr: boolean): ToolClientInvocationResult; } type ToolInvokeErrorCause = Exclude | { readonly tag: 'protocol-error'; readonly val: string; } | { readonly tag: 'denied'; readonly val: string; } | { readonly tag: 'internal-error'; readonly val: string; } | { readonly tag: 'cancelled'; } | { readonly tag: 'resource-exhausted'; readonly val: string; } | { readonly tag: 'tool'; readonly error: Errors; } | { readonly tag: 'unknown-error'; readonly name: string; readonly payload: TypedSchemaValue$1; }; declare class ToolInvokeError extends Error { readonly cause: ToolInvokeErrorCause; constructor(cause: ToolInvokeErrorCause); static tool(error: Errors): ToolInvokeError; mapTool(map: (error: Errors) => Mapped): ToolInvokeError; } interface ImplementedTool { readonly name: Name; } type ToolHelpError = { readonly tag: 'invalid-command-path'; readonly commandPath: readonly string[]; } | { readonly tag: 'invalid-argument-name'; readonly commandPath: readonly string[]; readonly argumentName: string; }; type ToolHelpResult = { readonly tag: 'ok'; readonly value: string; } | { readonly tag: 'err'; readonly error: ToolHelpError; }; type DocInput = string | Partial; type RepeatableMode = 'repeated' | 'delimited' | 'either'; interface SurfaceOptions { readonly short?: string; readonly aliases?: readonly string[]; readonly doc?: DocInput; readonly env?: string; } interface ValueOptions extends SurfaceOptions { readonly valueName?: string; readonly required?: boolean; } type RepeatableDefault = MapLike extends true ? Value : Value[]; type OptionOptions ? true : false> = (ValueOptions & { readonly repeatable?: undefined; readonly delim?: never; readonly default?: Value; readonly optionalScalar?: boolean; readonly duplicateKeyPolicy?: never; }) | (ValueOptions & { readonly repeatable: 'repeated'; readonly delim?: never; readonly default?: RepeatableDefault; readonly optionalScalar?: never; readonly duplicateKeyPolicy?: DuplicateKeyPolicy; }) | (ValueOptions & { readonly repeatable: 'delimited' | 'either'; readonly delim: string; readonly default?: RepeatableDefault; readonly optionalScalar?: never; readonly duplicateKeyPolicy?: DuplicateKeyPolicy; }); interface PositionalOptions { readonly doc?: DocInput; readonly valueName?: string; readonly required?: boolean; readonly default?: Value; readonly acceptsStdio?: boolean; } interface TailOptions { readonly doc?: DocInput; readonly valueName?: string; readonly min?: number; readonly max?: number; readonly separator?: string; readonly verbatim?: boolean; readonly acceptsStdio?: boolean; } interface BooleanFlagOptions extends SurfaceOptions { readonly kind?: 'flag'; readonly default?: boolean; readonly negatable?: boolean; readonly max?: never; } interface CountFlagOptions extends SurfaceOptions { readonly kind: 'count-flag'; readonly max?: number; readonly default?: never; readonly negatable?: never; } type FlagOptions = BooleanFlagOptions | CountFlagOptions; type GlobalValueOptions = OptionOptions & { readonly kind?: 'option'; }; type GlobalFlagOptions = Omit & { readonly kind: 'flag'; }; type GlobalCountFlagOptions = CountFlagOptions; interface StreamOptions { readonly doc?: DocInput; readonly mime?: readonly string[]; readonly required?: boolean; } type FormatterInput = string | ({ readonly name: string; } & Partial>); interface ReturnsOptions { readonly doc?: DocInput; readonly formatters?: readonly FormatterInput[]; readonly defaultFormatter?: string; } interface ErrorOptionsBase { readonly kind: 'usage' | 'runtime'; readonly exitCode: number; readonly doc?: DocInput; } type ErrorOptions = ErrorOptionsBase & { readonly payload?: Payload; }; type ConstraintRef = ExtendedRef; type ToolConstraint = ExtendedConstraint; type ConstraintSide = ConstraintRef | readonly ConstraintRef[]; declare const c: { readonly present: (name: string) => ConstraintRef; readonly valueIs: (name: string, value: unknown) => ConstraintRef; readonly requiresAll: (values: readonly ConstraintRef[]) => ToolConstraint; readonly allOrNone: (values: readonly ConstraintRef[]) => ToolConstraint; readonly requiresAny: (values: readonly ConstraintRef[]) => ToolConstraint; readonly mutexGroups: (groups: readonly (readonly ConstraintRef[])[]) => ToolConstraint; readonly implies: (options: { readonly lhs: ConstraintSide; readonly rhs: ConstraintSide; readonly lhsQuant?: Quantifier; readonly rhsQuant?: Quantifier; }) => ToolConstraint; readonly forbids: (options: { readonly lhs: ConstraintSide; readonly rhs: ConstraintSide; readonly lhsQuant?: Quantifier; }) => ToolConstraint; }; declare class BodyBuilder { private readonly value; private constructor(); static start(): BodyBuilder; positional> = {}>(name: Name, schema: Schema, options?: Options): BodyBuilder, PositionalIsRequired>, Success, Errors, Stdin, Stdout, Stderr>; tail(name: Name, schema: Schema, options?: TailOptions): BodyBuilder[]>, Success, Errors, Stdin, Stdout, Stderr>; option, SchemaProducesMap> = {}>(name: Name, schema: Schema, options?: Options): BodyBuilder, OptionIsRequired, OptionAliases>, Success, Errors, Stdin, Stdout, Stderr>; flag(name: Name, options?: Options): BodyBuilder, true, OptionAliases>, Success, Errors, Stdin, Stdout, Stderr>; constraint(constraint: ToolConstraint): BodyBuilder; stdin(options: Options): BodyBuilder, Stdout, Stderr>; stdout(options: Options): BodyBuilder, Stderr>; stderr(options: Options): BodyBuilder>; returns(schema: Schema, options?: ReturnsOptions): BodyBuilder, Errors, Stdin, Stdout, Stderr>; error(name: Name, options: ErrorOptions): BodyBuilder, Stdin, Stdout, Stderr>; error(name: Name, options: ErrorOptions & { readonly payload: Payload; }): BodyBuilder>, Stdin, Stdout, Stderr>; private next; build(): ExtendedCommandBody; } declare const BUILD_TOOL: unique symbol; type AnyToolDefinition = CommandBuilder; declare class CommandBuilder { readonly name: Name; private readonly node; private readonly toolVersion; private readonly commandAnnotations?; private readonly subtreeForwards; private readonly requiresFilesystem; private implemented; private compiled?; private constructor(); static root(name: Name, requiresFilesystem?: boolean): CommandBuilder; /** Construct the exact typed client owned by this tool definition. */ client(this: CommandBuilder, options?: ToolClientOptions): ToolClient>; private static child; version(this: CommandBuilder, version: string): CommandBuilder; doc(doc: DocInput): CommandBuilder; aliases(...aliases: readonly string[]): CommandBuilder; annotations(annotations: Partial): CommandBuilder; global, SchemaProducesMap> = {}>(name: ArgumentName, schema: Schema, options?: Options): CommandBuilder, OptionIsRequired, Options>, Body, Children, Root>; global, const Options extends GlobalFlagOptions>(name: ArgumentName, schema: Schema, options: Options): CommandBuilder, Body, Children, Root>; global(name: ArgumentName, options: Options): CommandBuilder, Body, Children, Root>; body>(build: (body: BodyBuilder) => Built): CommandBuilder, Children, Root>; command(name: ChildName, subtree: ToolDefinition): CommandBuilder>; }, Root>; command>(name: ChildName, build: (command: CommandBuilder) => Built): CommandBuilder; }, Root>; middleware>(this: CommandBuilder, options: TransparentToolMiddlewareOptions, ParameterSchema>): ImplementedToolMiddleware; middleware>(this: CommandBuilder, options: AdapterToolMiddlewareOptions, ExpectedDefinition, ParameterSchema>): ImplementedToolMiddleware; implement(this: CommandBuilder, implementation: ToolImplementation>): ImplementedTool; private next; private finalizeNode; [BUILD_TOOL](this: CommandBuilder): ExtendedToolType; } type ToolDefinition = CommandBuilder; declare function toolDefinition(name: Name, options?: { requiresFilesystem?: boolean; }): ToolDefinition; declare function universalToolMiddleware>(options: UniversalToolMiddlewareOptions): ImplementedToolMiddleware; /** Render descriptor-based help for the root or a nested command. */ declare function renderHelp(definition: AnyToolDefinition, commandPath?: readonly string[]): ToolHelpResult; /** Render descriptor-based help for one argument at the selected command. */ declare function renderArgumentHelp(definition: AnyToolDefinition, commandPath: readonly string[], argumentName: string): ToolHelpResult; export { Bytes, KeyValue, Path, Quantity, StandardSchemaV1, ToolInvokeError, c, command, compileSchema, err, ok, registerSchemaWalker, registeredVendors, renderArgumentHelp, renderHelp, s, toolDefinition, universalToolMiddleware }; export type { CamelCase, ConstraintRef, DocInput, ErrorOptions, FlagOptions, FormatterInput, GlobalCountFlagOptions, GlobalFlagOptions, GlobalValueOptions, ImplementedToolMiddleware, KeyValueOptions, NestedCommandImplementation, OptionOptions, PathOptions, PermissionCardOptions, PositionalOptions, Principal, QuantityOptions, RepeatableMode, ReturnsOptions, SchemaCodec, SchemaWalker, StreamOptions, TailOptions, ToolBodyModel, ToolClient, ToolClientErrors, ToolClientMethod, ToolCommandModel, ToolCommandModelOf, ToolConstraint, ToolDefinition, ToolErr, ToolHelpError, ToolHelpResult, ToolInvokeErrorCause, ToolMiddlewareHandler, ToolMiddlewareImplementation, ToolMiddlewareInvocationContext, ToolMiddlewareOptions, ToolOk, ToolSubtreeModel, ToolUnderlying, ToolUnderlyingErrors, UniversalToolMiddlewareContext, UniversalToolMiddlewareInvocation, UniversalToolMiddlewareInvoke, UniversalToolMiddlewareOptions, UniversalToolUnderlying, UniversalToolUnderlyingInvoke };