/** * a2a/agentish-extension.ts — Agentish v2 (AG2) declared as an A2A protocol * extension. * * A2A already carries a Message built of typed Parts (spec 4.1.4/4.1.6 in * the current draft; 6.4/6.5 in the stable v0.3.0 JSON-RPC spec) — it does * not say what the words inside a text part mean. AG2 is a wire format for * what agents tell each other about a job: a kind line plus k=v lines * instead of prose. Declaring it as an A2A extension (spec 4.6 "Extensions", * 5.5.2.1 "AgentExtension Object" in v0.3.0) means any A2A agent can say "I * understand AG2" in its AgentCard, and any other A2A agent can check that * declaration before sending AG2 text — without AG2 needing its own * transport, auth, or discovery story. A2A already has those. * * This module defines the extension: its URI, its AgentCard fragment, and * helpers to mark and validate a Part as carrying AG2 text. It does not run * an A2A server — see docs/a2a-agentish-extension.md for what that would * still take. */ /** * Extension identifier (A2A spec 5.5.2.1: AgentExtension.uri — "The unique * URI identifying the extension"). One URN, one definition — this is an * alias of `AGENTISH_URI` from agentish/index.ts, not a second constant * that could drift from it. A2A does not require the URI to resolve, so it * is a `urn:`, not an `https:` URL pointing at a domain nobody has * registered or serves. `AGENTISH_SPEC_URL` below is the resolvable * pointer, for callers that want one. */ export declare const AGENTISH_EXTENSION_URI = "urn:aibroker:a2a:ext:agentish:2"; /** * Where to find the AG2 spec this extension declares. Not a network * location — an aibroker installation ships this file at this path, so it * resolves against the aibroker package or repository you installed from * (npm package root, or a checkout of the source repository). */ export declare const AGENTISH_SPEC_URL = "docs/agentish.md"; /** Media type an AG2-carrying Part may advertise instead of (or in addition * to) the `metadata.agentish` tag — see isAg2Part(). Matches the emerging * A2A draft's per-part `mediaType` field (not yet in the stable v0.3.0 * TextPart shape); ag2Part() does not emit it today, but isAg2Part() * already recognizes it so a differently-built AG2 part is not missed. */ export declare const AGENTISH_MEDIA_TYPE = "text/x-agentish"; /** Shape of one `AgentCard.capabilities.extensions[]` entry (A2A spec * 5.5.2.1, AgentExtension Object: uri, description, required, params). */ export interface AgentishExtensionDeclaration { uri: string; description: string; required: boolean; params: { version: string; spec: string; spec_url: string; extensions: string; validator: string; }; } /** * Build the `AgentCard.capabilities.extensions[]` entry that declares AG2 * support. `required: false` — an agent that does not understand AG2 can * still exchange plain-text Messages with this one; AG2 is additive, never * load-bearing for the base protocol. */ export declare function agentCardExtension(): AgentishExtensionDeclaration; /** * Minimal shape this module needs from A2A's TextPart (spec 6.5.1, stable * v0.3.0: `{ kind: "text", text, metadata? }`), declared locally so this * module carries no dependency on an A2A SDK. */ export interface A2ATextPart { readonly kind: "text"; text: string; metadata?: Record; /** Not part of the stable v0.3.0 TextPart shape — carried here only so * isAg2Part() can also recognize a part tagged this way instead of via * metadata. See AGENTISH_MEDIA_TYPE. */ mediaType?: string; } /** * Build a TextPart carrying AG2 text, tagged via `metadata.agentish: "2"` * so a receiver can recognize it as AG2 before parsing the text itself. * Metadata is the extension point A2A defines for exactly this purpose * (spec 4.6.2 "Extension Points": Message/Part metadata keyed by the * extension's concern). */ export declare function ag2Part(text: string): A2ATextPart; /** * True if `part` is a TextPart tagged as AG2, either by ag2Part()'s * `metadata.agentish === "2"` convention or by a `mediaType`/`mimeType` of * `text/x-agentish` (AGENTISH_MEDIA_TYPE) — some other sender may tag a * part that way instead. Either is sufficient; neither is required to be * absent. Does not validate the text itself — use validateAg2Part() for * that. */ export declare function isAg2Part(part: unknown): part is A2ATextPart; export interface Ag2PartValidation { ok: boolean; errors: string[]; } /** * Validate an AG2-tagged Part's text against the AG2 grammar. Delegates to * daemon/agentish.ts's `check()` — this module owns only the A2A wrapping, * not the grammar itself. `earlier` is the thread's prior AG2 message texts, * passed through unchanged so `@n=path` symbols they declared stay in scope * (same contract as `check()`). * * Returns `ok: false` with one synthetic error if `part` is not an AG2 part * at all, so a caller that skipped `isAg2Part()` still gets a usable result * instead of a thrown error. */ export declare function validateAg2Part(part: unknown, earlier?: string[]): Ag2PartValidation; //# sourceMappingURL=agentish-extension.d.ts.map