agentfootprint 9.67.0 → 9.69.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/dist/adapters/browser/agentcore.js +203 -0
  2. package/dist/adapters/browser/agentcore.js.map +1 -0
  3. package/dist/adapters/hosting/a2aWire.js +172 -0
  4. package/dist/adapters/hosting/a2aWire.js.map +1 -0
  5. package/dist/adapters/hosting/agentCoreA2A.js +173 -0
  6. package/dist/adapters/hosting/agentCoreA2A.js.map +1 -0
  7. package/dist/adapters/types.js.map +1 -1
  8. package/dist/doors/providers.js +9 -3
  9. package/dist/doors/providers.js.map +1 -1
  10. package/dist/esm/adapters/browser/agentcore.d.ts +141 -0
  11. package/dist/esm/adapters/browser/agentcore.js +199 -0
  12. package/dist/esm/adapters/browser/agentcore.js.map +1 -0
  13. package/dist/esm/adapters/hosting/a2aWire.d.ts +110 -0
  14. package/dist/esm/adapters/hosting/a2aWire.js +166 -0
  15. package/dist/esm/adapters/hosting/a2aWire.js.map +1 -0
  16. package/dist/esm/adapters/hosting/agentCoreA2A.d.ts +95 -0
  17. package/dist/esm/adapters/hosting/agentCoreA2A.js +168 -0
  18. package/dist/esm/adapters/hosting/agentCoreA2A.js.map +1 -0
  19. package/dist/esm/adapters/types.d.ts +82 -0
  20. package/dist/esm/adapters/types.js.map +1 -1
  21. package/dist/esm/doors/providers.d.ts +1 -0
  22. package/dist/esm/doors/providers.js +4 -0
  23. package/dist/esm/doors/providers.js.map +1 -1
  24. package/dist/esm/hosting-providers.d.ts +19 -0
  25. package/dist/esm/hosting-providers.js +19 -0
  26. package/dist/esm/hosting-providers.js.map +1 -1
  27. package/dist/hosting-providers.js +35 -1
  28. package/dist/hosting-providers.js.map +1 -1
  29. package/dist/types/adapters/browser/agentcore.d.ts +142 -0
  30. package/dist/types/adapters/browser/agentcore.d.ts.map +1 -0
  31. package/dist/types/adapters/hosting/a2aWire.d.ts +111 -0
  32. package/dist/types/adapters/hosting/a2aWire.d.ts.map +1 -0
  33. package/dist/types/adapters/hosting/agentCoreA2A.d.ts +96 -0
  34. package/dist/types/adapters/hosting/agentCoreA2A.d.ts.map +1 -0
  35. package/dist/types/adapters/types.d.ts +82 -0
  36. package/dist/types/adapters/types.d.ts.map +1 -1
  37. package/dist/types/doors/providers.d.ts +1 -0
  38. package/dist/types/doors/providers.d.ts.map +1 -1
  39. package/dist/types/hosting-providers.d.ts +19 -0
  40. package/dist/types/hosting-providers.d.ts.map +1 -1
  41. package/package.json +1 -1
@@ -0,0 +1,141 @@
1
+ /**
2
+ * agentCoreBrowser — AWS Bedrock AgentCore **Browser** as a {@link BrowserRunner}.
3
+ *
4
+ * A managed Chrome in AWS's account that an agent can drive, a person can watch
5
+ * live, and — the part this adapter exists for — a person can TAKE OVER
6
+ * mid-session and hand back.
7
+ *
8
+ * ── Two channels, and only one of them is here ───────────────────────────────
9
+ * A browser session has two doors, and confusing them wastes a day:
10
+ *
11
+ * 1. **The automation stream** — a CDP WebSocket. Navigate, find an element,
12
+ * fill a form: everything page-shaped happens here, driven by Playwright
13
+ * or another CDP client. This adapter hands you
14
+ * {@link BrowserSession.automationEndpoint} and stays out of the way. It
15
+ * does not depend on Playwright and does not drive the page for you.
16
+ * 2. **`InvokeBrowser`** — the data-plane operation this adapter calls. It is
17
+ * OS-LEVEL input ABOVE the page: mouse, keyboard, screenshots. Its action
18
+ * union, read off the SDK rather than remembered, is exactly
19
+ * `mouseClick | mouseMove | mouseDrag | mouseScroll | keyType | keyPress |
20
+ * keyShortcut | screenshot`. **There is no navigate action**, and a reader
21
+ * expecting one is looking at the wrong door.
22
+ *
23
+ * ── The takeover ─────────────────────────────────────────────────────────────
24
+ * `UpdateBrowserStream` with `automationStreamUpdate.streamStatus` set to
25
+ * `DISABLED` stops the automation channel and leaves the live-view user in
26
+ * control; `ENABLED` gives it back. That is `handControlTo('person' | 'agent')`
27
+ * here, and it composes with this library's check-in: the agent pauses, a
28
+ * person finishes the login, the agent resumes on the page they left — and both
29
+ * handovers are ordinary events in the trace.
30
+ *
31
+ * ── How this talks to the SDK (the 9.4.0 law) ────────────────────────────────
32
+ * Through `client.send(new SomeCommand(input))`, never a method on the client —
33
+ * a bare `@aws-sdk/client-*` Client carries `send` and `destroy` and nothing
34
+ * else. Every command name and request shape below was read off a real install
35
+ * of `@aws-sdk/client-bedrock-agentcore` **3.1118.0**, including the action
36
+ * union above and `ScreenshotResult`'s `{ status, error?, data? }`.
37
+ *
38
+ * ── One documented contradiction, left as AWS wrote it ───────────────────────
39
+ * The devguide says a session defaults to 15 minutes; `StartBrowserSession`'s
40
+ * API reference says 3600 seconds. This adapter sends nothing unless you pass
41
+ * `sessionTimeoutSeconds`, so the default is whatever the service applies —
42
+ * rather than this file picking a side in somebody else's disagreement.
43
+ *
44
+ * Pattern: Adapter (GoF) + lazy peer-dep load — the SDK is required only when
45
+ * `start()` first runs, or never, if you inject `_client` / `_sdk`.
46
+ */
47
+ import type { BrowserRunner } from '../types.js';
48
+ /** AWS's managed browser. A custom `CreateBrowser` resource id goes here instead. */
49
+ export declare const AWS_SYSTEM_BROWSER = "aws.browser.v1";
50
+ export interface AgentCoreBrowserOptions {
51
+ /** AWS region. Falls back to the SDK's own resolution when omitted. */
52
+ readonly region?: string;
53
+ /** Which browser resource. Default {@link AWS_SYSTEM_BROWSER}. */
54
+ readonly browserIdentifier?: string;
55
+ /**
56
+ * Session lifetime in seconds. **Left unset by default on purpose** — AWS's
57
+ * own devguide (15 minutes) and API reference (3600 seconds) disagree, so
58
+ * sending nothing lets the service apply whichever it actually means.
59
+ */
60
+ readonly sessionTimeoutSeconds?: number;
61
+ /** Viewport for the session, when you want one that is not the default. */
62
+ readonly viewport?: {
63
+ readonly width: number;
64
+ readonly height: number;
65
+ };
66
+ /** Stable runner id (default `'agentcore-browser'`). */
67
+ readonly id?: string;
68
+ /** Test seam — inject a client implementing {@link AgentCoreBrowserClientLike}. */
69
+ readonly _client?: AgentCoreBrowserClientLike;
70
+ /** @internal Test injection — the AWS SDK module. */
71
+ readonly _sdk?: BedrockAgentCoreBrowserSdkModule;
72
+ }
73
+ /** The operation-semantic surface this adapter calls. */
74
+ export interface AgentCoreBrowserClientLike {
75
+ startBrowserSession(input: {
76
+ readonly browserIdentifier: string;
77
+ readonly name?: string;
78
+ readonly sessionTimeoutSeconds?: number;
79
+ readonly viewPort?: {
80
+ readonly width: number;
81
+ readonly height: number;
82
+ };
83
+ }): Promise<{
84
+ readonly sessionId?: string;
85
+ readonly streams?: {
86
+ readonly automationStream?: {
87
+ readonly streamEndpoint?: string;
88
+ };
89
+ readonly liveViewStream?: {
90
+ readonly streamEndpoint?: string;
91
+ };
92
+ };
93
+ }>;
94
+ invokeBrowser(input: {
95
+ readonly browserIdentifier: string;
96
+ readonly sessionId: string;
97
+ readonly action: Readonly<Record<string, unknown>>;
98
+ }): Promise<{
99
+ readonly result?: Readonly<Record<string, unknown>>;
100
+ }>;
101
+ updateBrowserStream(input: {
102
+ readonly browserIdentifier: string;
103
+ readonly sessionId: string;
104
+ readonly streamUpdate: {
105
+ readonly automationStreamUpdate: {
106
+ readonly streamStatus: 'ENABLED' | 'DISABLED';
107
+ };
108
+ };
109
+ }): Promise<void>;
110
+ stopBrowserSession(input: {
111
+ readonly browserIdentifier: string;
112
+ readonly sessionId: string;
113
+ }): Promise<void>;
114
+ }
115
+ /** The slice of `@aws-sdk/client-bedrock-agentcore` this shim touches. */
116
+ export interface BedrockAgentCoreBrowserSdkModule {
117
+ readonly BedrockAgentCoreClient?: new (config: {
118
+ region?: string;
119
+ }) => {
120
+ send(cmd: unknown): Promise<unknown>;
121
+ };
122
+ readonly StartBrowserSessionCommand?: new (input: unknown) => unknown;
123
+ readonly InvokeBrowserCommand?: new (input: unknown) => unknown;
124
+ readonly UpdateBrowserStreamCommand?: new (input: unknown) => unknown;
125
+ readonly StopBrowserSessionCommand?: new (input: unknown) => unknown;
126
+ }
127
+ /**
128
+ * Build a {@link BrowserRunner} backed by AgentCore Browser.
129
+ *
130
+ * @example A session, a person taking over, and the agent resuming
131
+ * const browser = agentCoreBrowser({ region: 'us-east-1' });
132
+ * const session = await browser.start({ key: toolSessionKey(ctx, 'run') });
133
+ *
134
+ * // Page work goes over CDP, not through this adapter:
135
+ * // const page = await chromium.connectOverCDP(session.automationEndpoint!)
136
+ *
137
+ * await session.handControlTo?.('person'); // they finish the login
138
+ * await session.handControlTo?.('agent'); // and the agent carries on
139
+ * await session.stop();
140
+ */
141
+ export declare function agentCoreBrowser(options?: AgentCoreBrowserOptions): BrowserRunner;
@@ -0,0 +1,199 @@
1
+ /**
2
+ * agentCoreBrowser — AWS Bedrock AgentCore **Browser** as a {@link BrowserRunner}.
3
+ *
4
+ * A managed Chrome in AWS's account that an agent can drive, a person can watch
5
+ * live, and — the part this adapter exists for — a person can TAKE OVER
6
+ * mid-session and hand back.
7
+ *
8
+ * ── Two channels, and only one of them is here ───────────────────────────────
9
+ * A browser session has two doors, and confusing them wastes a day:
10
+ *
11
+ * 1. **The automation stream** — a CDP WebSocket. Navigate, find an element,
12
+ * fill a form: everything page-shaped happens here, driven by Playwright
13
+ * or another CDP client. This adapter hands you
14
+ * {@link BrowserSession.automationEndpoint} and stays out of the way. It
15
+ * does not depend on Playwright and does not drive the page for you.
16
+ * 2. **`InvokeBrowser`** — the data-plane operation this adapter calls. It is
17
+ * OS-LEVEL input ABOVE the page: mouse, keyboard, screenshots. Its action
18
+ * union, read off the SDK rather than remembered, is exactly
19
+ * `mouseClick | mouseMove | mouseDrag | mouseScroll | keyType | keyPress |
20
+ * keyShortcut | screenshot`. **There is no navigate action**, and a reader
21
+ * expecting one is looking at the wrong door.
22
+ *
23
+ * ── The takeover ─────────────────────────────────────────────────────────────
24
+ * `UpdateBrowserStream` with `automationStreamUpdate.streamStatus` set to
25
+ * `DISABLED` stops the automation channel and leaves the live-view user in
26
+ * control; `ENABLED` gives it back. That is `handControlTo('person' | 'agent')`
27
+ * here, and it composes with this library's check-in: the agent pauses, a
28
+ * person finishes the login, the agent resumes on the page they left — and both
29
+ * handovers are ordinary events in the trace.
30
+ *
31
+ * ── How this talks to the SDK (the 9.4.0 law) ────────────────────────────────
32
+ * Through `client.send(new SomeCommand(input))`, never a method on the client —
33
+ * a bare `@aws-sdk/client-*` Client carries `send` and `destroy` and nothing
34
+ * else. Every command name and request shape below was read off a real install
35
+ * of `@aws-sdk/client-bedrock-agentcore` **3.1118.0**, including the action
36
+ * union above and `ScreenshotResult`'s `{ status, error?, data? }`.
37
+ *
38
+ * ── One documented contradiction, left as AWS wrote it ───────────────────────
39
+ * The devguide says a session defaults to 15 minutes; `StartBrowserSession`'s
40
+ * API reference says 3600 seconds. This adapter sends nothing unless you pass
41
+ * `sessionTimeoutSeconds`, so the default is whatever the service applies —
42
+ * rather than this file picking a side in somebody else's disagreement.
43
+ *
44
+ * Pattern: Adapter (GoF) + lazy peer-dep load — the SDK is required only when
45
+ * `start()` first runs, or never, if you inject `_client` / `_sdk`.
46
+ */
47
+ import { lazyRequire } from '../../lib/lazyRequire.js';
48
+ /** AWS's managed browser. A custom `CreateBrowser` resource id goes here instead. */
49
+ export const AWS_SYSTEM_BROWSER = 'aws.browser.v1';
50
+ const BUTTONS = { left: 'LEFT', middle: 'MIDDLE', right: 'RIGHT' };
51
+ function createBrowserClient(options) {
52
+ let mod;
53
+ if (options._sdk) {
54
+ mod = options._sdk;
55
+ }
56
+ else {
57
+ try {
58
+ mod = lazyRequire('@aws-sdk/client-bedrock-agentcore');
59
+ }
60
+ catch {
61
+ throw new Error('agentCoreBrowser requires the `@aws-sdk/client-bedrock-agentcore` peer dependency.\n' +
62
+ ' Install: npm install @aws-sdk/client-bedrock-agentcore\n' +
63
+ ' Or pass `_client` for a pre-built or mock client.');
64
+ }
65
+ }
66
+ if (!mod.BedrockAgentCoreClient) {
67
+ throw new Error('agentCoreBrowser: `@aws-sdk/client-bedrock-agentcore` is installed but ' +
68
+ '`BedrockAgentCoreClient` was not found. Update the SDK.');
69
+ }
70
+ const sdk = new mod.BedrockAgentCoreClient({ ...(options.region && { region: options.region }) });
71
+ const send = async (Ctor, name, input) => {
72
+ if (!Ctor) {
73
+ throw new Error(`agentCoreBrowser: \`@aws-sdk/client-bedrock-agentcore\` is missing ${name}. ` +
74
+ 'Upgrade the SDK, or pass `_client` with your own mapping.');
75
+ }
76
+ return sdk.send(new Ctor(input));
77
+ };
78
+ return {
79
+ async startBrowserSession(input) {
80
+ return (await send(mod.StartBrowserSessionCommand, 'StartBrowserSessionCommand', input));
81
+ },
82
+ async invokeBrowser(input) {
83
+ return (await send(mod.InvokeBrowserCommand, 'InvokeBrowserCommand', input));
84
+ },
85
+ async updateBrowserStream(input) {
86
+ await send(mod.UpdateBrowserStreamCommand, 'UpdateBrowserStreamCommand', input);
87
+ },
88
+ async stopBrowserSession(input) {
89
+ await send(mod.StopBrowserSessionCommand, 'StopBrowserSessionCommand', input);
90
+ },
91
+ };
92
+ }
93
+ /**
94
+ * Build a {@link BrowserRunner} backed by AgentCore Browser.
95
+ *
96
+ * @example A session, a person taking over, and the agent resuming
97
+ * const browser = agentCoreBrowser({ region: 'us-east-1' });
98
+ * const session = await browser.start({ key: toolSessionKey(ctx, 'run') });
99
+ *
100
+ * // Page work goes over CDP, not through this adapter:
101
+ * // const page = await chromium.connectOverCDP(session.automationEndpoint!)
102
+ *
103
+ * await session.handControlTo?.('person'); // they finish the login
104
+ * await session.handControlTo?.('agent'); // and the agent carries on
105
+ * await session.stop();
106
+ */
107
+ export function agentCoreBrowser(options = {}) {
108
+ const browserIdentifier = options.browserIdentifier ?? AWS_SYSTEM_BROWSER;
109
+ let client;
110
+ const getClient = () => {
111
+ client ??= options._client ?? createBrowserClient(options);
112
+ return client;
113
+ };
114
+ return {
115
+ id: options.id ?? 'agentcore-browser',
116
+ async start(req) {
117
+ const c = getClient();
118
+ const started = await c.startBrowserSession({
119
+ browserIdentifier,
120
+ name: req.key,
121
+ ...(options.sessionTimeoutSeconds !== undefined && {
122
+ sessionTimeoutSeconds: options.sessionTimeoutSeconds,
123
+ }),
124
+ ...(options.viewport !== undefined && { viewPort: options.viewport }),
125
+ });
126
+ const sessionId = started.sessionId;
127
+ if (!sessionId) {
128
+ throw new Error('agentCoreBrowser: StartBrowserSession returned no sessionId, so there is no session ' +
129
+ 'to drive. Check the browser identifier and the execution role.');
130
+ }
131
+ const act = async (action) => {
132
+ const answer = await c.invokeBrowser({ browserIdentifier, sessionId, action });
133
+ return answer.result;
134
+ };
135
+ const automationEndpoint = started.streams?.automationStream?.streamEndpoint;
136
+ const liveViewEndpoint = started.streams?.liveViewStream?.streamEndpoint;
137
+ const session = {
138
+ id: sessionId,
139
+ ...(automationEndpoint !== undefined && { automationEndpoint }),
140
+ ...(liveViewEndpoint !== undefined && { liveViewEndpoint }),
141
+ async click({ x, y, button, clicks }) {
142
+ await act({
143
+ mouseClick: {
144
+ x,
145
+ y,
146
+ ...(button !== undefined && { button: BUTTONS[button] }),
147
+ ...(clicks !== undefined && { clickCount: clicks }),
148
+ },
149
+ });
150
+ },
151
+ async type(text) {
152
+ await act({ keyType: { text } });
153
+ },
154
+ async press({ key, times }) {
155
+ await act({ keyPress: { key, ...(times !== undefined && { presses: times }) } });
156
+ },
157
+ async screenshot() {
158
+ const result = await act({ screenshot: { format: 'PNG' } });
159
+ const shot = result?.screenshot;
160
+ if (!shot?.data) {
161
+ // The result member carries its own status and error, so a failed
162
+ // screenshot says what the service said rather than answering with
163
+ // an empty image that reads as a blank page.
164
+ throw new Error(`agentCoreBrowser: the screenshot did not produce image data` +
165
+ `${shot?.status ? ` (status ${shot.status})` : ''}` +
166
+ `${shot?.error ? `: ${shot.error}` : '.'}`);
167
+ }
168
+ return { data: shot.data, format: 'png' };
169
+ },
170
+ async handControlTo(driver) {
171
+ // The person takes over by DISABLING automation: the live-view user
172
+ // is already connected, and stopping the automation stream is what
173
+ // lets their input through.
174
+ await c.updateBrowserStream({
175
+ browserIdentifier,
176
+ sessionId,
177
+ streamUpdate: {
178
+ automationStreamUpdate: {
179
+ streamStatus: driver === 'person' ? 'DISABLED' : 'ENABLED',
180
+ },
181
+ },
182
+ });
183
+ },
184
+ async stop() {
185
+ try {
186
+ await c.stopBrowserSession({ browserIdentifier, sessionId });
187
+ }
188
+ catch {
189
+ // A managed session reaped by its own idle timeout is the ordinary
190
+ // case, and stopping one that is already gone is a no-op — the port
191
+ // says so, and a throw here would fail a teardown that succeeded.
192
+ }
193
+ },
194
+ };
195
+ return session;
196
+ },
197
+ };
198
+ }
199
+ //# sourceMappingURL=agentcore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agentcore.js","sourceRoot":"","sources":["../../../../src/adapters/browser/agentcore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD,qFAAqF;AACrF,MAAM,CAAC,MAAM,kBAAkB,GAAG,gBAAgB,CAAC;AAkEnD,MAAM,OAAO,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAW,CAAC;AAE5E,SAAS,mBAAmB,CAAC,OAAgC;IAC3D,IAAI,GAAqC,CAAC;IAC1C,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;QACjB,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;IACrB,CAAC;SAAM,CAAC;QACN,IAAI,CAAC;YACH,GAAG,GAAG,WAAW,CAAmC,mCAAmC,CAAC,CAAC;QAC3F,CAAC;QAAC,MAAM,CAAC;YACP,MAAM,IAAI,KAAK,CACb,sFAAsF;gBACpF,6DAA6D;gBAC7D,qDAAqD,CACxD,CAAC;QACJ,CAAC;IACH,CAAC;IACD,IAAI,CAAC,GAAG,CAAC,sBAAsB,EAAE,CAAC;QAChC,MAAM,IAAI,KAAK,CACb,yEAAyE;YACvE,yDAAyD,CAC5D,CAAC;IACJ,CAAC;IACD,MAAM,GAAG,GAA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,MAAM,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;4BACnD,GAAG,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAC7C,CAAC;oBACJ,CAAC;oBACD,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;gBAC5C,CAAC;gBAED,KAAK,CAAC,aAAa,CAAC,MAAqB;oBACvC,oEAAoE;oBACpE,mEAAmE;oBACnE,4BAA4B;oBAC5B,MAAM,CAAC,CAAC,mBAAmB,CAAC;wBAC1B,iBAAiB;wBACjB,SAAS;wBACT,YAAY,EAAE;4BACZ,sBAAsB,EAAE;gCACtB,YAAY,EAAE,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS;6BAC3D;yBACF;qBACF,CAAC,CAAC;gBACL,CAAC;gBAED,KAAK,CAAC,IAAI;oBACR,IAAI,CAAC;wBACH,MAAM,CAAC,CAAC,kBAAkB,CAAC,EAAE,iBAAiB,EAAE,SAAS,EAAE,CAAC,CAAC;oBAC/D,CAAC;oBAAC,MAAM,CAAC;wBACP,mEAAmE;wBACnE,oEAAoE;wBACpE,kEAAkE;oBACpE,CAAC;gBACH,CAAC;aACF,CAAC;YACF,OAAO,OAAO,CAAC;QACjB,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,110 @@
1
+ /**
2
+ * adapters/hosting/a2aWire — the A2A protocol, as an `HttpWire`.
3
+ *
4
+ * ── What this is ─────────────────────────────────────────────────────────────
5
+ * **A2A** (agent-to-agent) is an open protocol for one agent calling another:
6
+ * JSON-RPC 2.0 over HTTP, a `message/send` method carrying text parts, a result
7
+ * carrying artifacts, and a discovery document — the **agent card** — that says
8
+ * what the agent is and what it can do. It is nobody's product; several
9
+ * runtimes speak it, so it lives here on its own and the runtimes that host it
10
+ * configure this rather than reimplement it.
11
+ *
12
+ * ── The subset, stated plainly ───────────────────────────────────────────────
13
+ * One method: `message/send`, text parts only. Deliberately NOT carried:
14
+ * `message/stream` and the rest of the task lifecycle (`tasks/get`,
15
+ * `tasks/cancel`, push notifications), non-text parts, and multi-turn task
16
+ * state. An agent card built here therefore declares `streaming: false` by
17
+ * default — advertising a capability this wire cannot honour is how a caller
18
+ * finds out by hanging.
19
+ *
20
+ * ── Why it fits `httpHost` without changing it ───────────────────────────────
21
+ * JSON-RPC's one hard requirement on a reply is that it ECHOES the request's
22
+ * `id`. That is possible here only because `HttpWire`'s body methods receive
23
+ * the request that produced them — a seam added for a different protocol
24
+ * entirely, and the reason this one needed no new machinery.
25
+ *
26
+ * @example A2A on paths of your own choosing
27
+ * httpHost({
28
+ * name: 'myA2AHost',
29
+ * wire: a2aWire({ card: { name: 'triage', description: '…', version: '1.0.0' } }),
30
+ * invokePath: '/',
31
+ * healthPath: '/health',
32
+ * });
33
+ */
34
+ import type { HttpWire } from '../../hosting/httpHost.js';
35
+ /** The A2A protocol revision this wire's documents declare. */
36
+ export declare const A2A_PROTOCOL_VERSION = "0.3.0";
37
+ /** Where the A2A specification puts an agent's discovery document. */
38
+ export declare const A2A_AGENT_CARD_PATH = "/.well-known/agent-card.json";
39
+ /** The one method this wire carries. */
40
+ export declare const A2A_SEND_METHOD = "message/send";
41
+ /**
42
+ * JSON-RPC's own reserved codes, the two this wire can raise.
43
+ *
44
+ * `-32601` is "method not found" and `-32602` is "invalid params" — both from
45
+ * the JSON-RPC specification rather than from A2A or any runtime, which is why
46
+ * they are the only numbers this neutral file knows. A runtime's own error
47
+ * codes belong to that runtime's adapter.
48
+ */
49
+ export declare const JSONRPC_METHOD_NOT_FOUND = -32601;
50
+ export declare const JSONRPC_INVALID_PARAMS = -32602;
51
+ export declare const JSONRPC_INTERNAL_ERROR = -32603;
52
+ /** One skill an agent card advertises. */
53
+ export interface A2ASkill {
54
+ readonly id: string;
55
+ readonly name: string;
56
+ readonly description: string;
57
+ readonly tags?: readonly string[];
58
+ }
59
+ /** The agent card this wire serves — what another agent reads to decide to call yours. */
60
+ export interface A2AAgentCard {
61
+ readonly name: string;
62
+ readonly description: string;
63
+ readonly version: string;
64
+ /** Where callers reach this agent. A runtime that mounts the agent behind its
65
+ * own URL fills this in; left out, the card simply omits it. */
66
+ readonly url?: string;
67
+ /** Default `false` — see the module note on why this wire does not claim it. */
68
+ readonly streaming?: boolean;
69
+ readonly defaultInputModes?: readonly string[];
70
+ readonly defaultOutputModes?: readonly string[];
71
+ readonly skills?: readonly A2ASkill[];
72
+ }
73
+ export interface A2AWireOptions {
74
+ /** The agent card. Required: A2A discovery is not optional in the protocol. */
75
+ readonly card: A2AAgentCard;
76
+ /** Body for the health probe. Default `{ status: 'ok' }`. */
77
+ readonly health?: unknown;
78
+ /**
79
+ * Map a refusal's stable code onto the numeric JSON-RPC code this deployment
80
+ * reports. Absent, everything that is not a malformed request is
81
+ * `-32603` (internal error) — the JSON-RPC catch-all.
82
+ *
83
+ * A runtime with its own published code table passes one; that table is the
84
+ * runtime's, and this file does not carry anybody's.
85
+ */
86
+ readonly errorCodeFor?: (code: string | undefined) => number;
87
+ /** Name used in refusal messages. Default `'a2aWire'`. */
88
+ readonly name?: string;
89
+ }
90
+ type JsonObject = Readonly<Record<string, unknown>>;
91
+ /**
92
+ * The text of one A2A message — every part concatenated, refusing what is not text.
93
+ *
94
+ * A non-text part is refused rather than skipped for the reason every dialect
95
+ * in this library refuses rather than skips: an answer produced from the parts
96
+ * that happened to be understood is a wrong answer delivered confidently.
97
+ */
98
+ export declare function readA2AMessageText(message: unknown): string;
99
+ /**
100
+ * The agent card document, as the protocol prints it.
101
+ *
102
+ * Exported on its own because a deployment often has to serve the card from
103
+ * somewhere this wire does not own — a CDN, a route in a framework, a runtime's
104
+ * own discovery API — and the document should be built once, here, rather than
105
+ * hand-copied into each of those places.
106
+ */
107
+ export declare function a2aAgentCardDocument(card: A2AAgentCard): JsonObject;
108
+ /** An `HttpWire` speaking A2A's `message/send`. */
109
+ export declare function a2aWire(options: A2AWireOptions): HttpWire;
110
+ export {};
@@ -0,0 +1,166 @@
1
+ /**
2
+ * adapters/hosting/a2aWire — the A2A protocol, as an `HttpWire`.
3
+ *
4
+ * ── What this is ─────────────────────────────────────────────────────────────
5
+ * **A2A** (agent-to-agent) is an open protocol for one agent calling another:
6
+ * JSON-RPC 2.0 over HTTP, a `message/send` method carrying text parts, a result
7
+ * carrying artifacts, and a discovery document — the **agent card** — that says
8
+ * what the agent is and what it can do. It is nobody's product; several
9
+ * runtimes speak it, so it lives here on its own and the runtimes that host it
10
+ * configure this rather than reimplement it.
11
+ *
12
+ * ── The subset, stated plainly ───────────────────────────────────────────────
13
+ * One method: `message/send`, text parts only. Deliberately NOT carried:
14
+ * `message/stream` and the rest of the task lifecycle (`tasks/get`,
15
+ * `tasks/cancel`, push notifications), non-text parts, and multi-turn task
16
+ * state. An agent card built here therefore declares `streaming: false` by
17
+ * default — advertising a capability this wire cannot honour is how a caller
18
+ * finds out by hanging.
19
+ *
20
+ * ── Why it fits `httpHost` without changing it ───────────────────────────────
21
+ * JSON-RPC's one hard requirement on a reply is that it ECHOES the request's
22
+ * `id`. That is possible here only because `HttpWire`'s body methods receive
23
+ * the request that produced them — a seam added for a different protocol
24
+ * entirely, and the reason this one needed no new machinery.
25
+ *
26
+ * @example A2A on paths of your own choosing
27
+ * httpHost({
28
+ * name: 'myA2AHost',
29
+ * wire: a2aWire({ card: { name: 'triage', description: '…', version: '1.0.0' } }),
30
+ * invokePath: '/',
31
+ * healthPath: '/health',
32
+ * });
33
+ */
34
+ import { WireRequestRefusal } from '../../hosting/errors.js';
35
+ /** The A2A protocol revision this wire's documents declare. */
36
+ export const A2A_PROTOCOL_VERSION = '0.3.0';
37
+ /** Where the A2A specification puts an agent's discovery document. */
38
+ export const A2A_AGENT_CARD_PATH = '/.well-known/agent-card.json';
39
+ /** The one method this wire carries. */
40
+ export const A2A_SEND_METHOD = 'message/send';
41
+ /**
42
+ * JSON-RPC's own reserved codes, the two this wire can raise.
43
+ *
44
+ * `-32601` is "method not found" and `-32602` is "invalid params" — both from
45
+ * the JSON-RPC specification rather than from A2A or any runtime, which is why
46
+ * they are the only numbers this neutral file knows. A runtime's own error
47
+ * codes belong to that runtime's adapter.
48
+ */
49
+ export const JSONRPC_METHOD_NOT_FOUND = -32601;
50
+ export const JSONRPC_INVALID_PARAMS = -32602;
51
+ export const JSONRPC_INTERNAL_ERROR = -32603;
52
+ function isRecord(value) {
53
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
54
+ }
55
+ /** The request's JSON-RPC id, echoed onto every reply. `null` is legal and distinct from absent. */
56
+ function requestId(facts) {
57
+ const id = facts?.body.id;
58
+ return typeof id === 'string' || typeof id === 'number' ? id : null;
59
+ }
60
+ /**
61
+ * The text of one A2A message — every part concatenated, refusing what is not text.
62
+ *
63
+ * A non-text part is refused rather than skipped for the reason every dialect
64
+ * in this library refuses rather than skips: an answer produced from the parts
65
+ * that happened to be understood is a wrong answer delivered confidently.
66
+ */
67
+ export function readA2AMessageText(message) {
68
+ if (!isRecord(message)) {
69
+ throw new WireRequestRefusal('invalid_params', 'params.message must be an object', 400);
70
+ }
71
+ const parts = message.parts;
72
+ if (!Array.isArray(parts) || parts.length === 0) {
73
+ throw new WireRequestRefusal('invalid_params', 'params.message.parts must be a non-empty array', 400);
74
+ }
75
+ const text = [];
76
+ for (const part of parts) {
77
+ if (!isRecord(part) || part.kind !== 'text' || typeof part.text !== 'string') {
78
+ const kind = isRecord(part) && typeof part.kind === 'string' ? part.kind : 'unknown';
79
+ throw new WireRequestRefusal('unsupported_part', `this agent carries text parts only; '${kind}' parts are not supported`, 400);
80
+ }
81
+ text.push(part.text);
82
+ }
83
+ return text.join('');
84
+ }
85
+ /**
86
+ * The agent card document, as the protocol prints it.
87
+ *
88
+ * Exported on its own because a deployment often has to serve the card from
89
+ * somewhere this wire does not own — a CDN, a route in a framework, a runtime's
90
+ * own discovery API — and the document should be built once, here, rather than
91
+ * hand-copied into each of those places.
92
+ */
93
+ export function a2aAgentCardDocument(card) {
94
+ return {
95
+ name: card.name,
96
+ description: card.description,
97
+ version: card.version,
98
+ ...(card.url !== undefined && { url: card.url }),
99
+ protocolVersion: A2A_PROTOCOL_VERSION,
100
+ preferredTransport: 'JSONRPC',
101
+ capabilities: { streaming: card.streaming === true },
102
+ defaultInputModes: card.defaultInputModes ?? ['text'],
103
+ defaultOutputModes: card.defaultOutputModes ?? ['text'],
104
+ skills: (card.skills ?? []).map((s) => ({
105
+ id: s.id,
106
+ name: s.name,
107
+ description: s.description,
108
+ tags: s.tags ?? [],
109
+ })),
110
+ };
111
+ }
112
+ /** An `HttpWire` speaking A2A's `message/send`. */
113
+ export function a2aWire(options) {
114
+ const health = options.health ?? { status: 'ok' };
115
+ const name = options.name ?? 'a2aWire';
116
+ const codeFor = options.errorCodeFor ?? (() => JSONRPC_INTERNAL_ERROR);
117
+ const envelope = (facts, body) => ({
118
+ jsonrpc: '2.0',
119
+ id: requestId(facts),
120
+ ...body,
121
+ });
122
+ return {
123
+ readRequest(facts) {
124
+ const { body } = facts;
125
+ if (body.jsonrpc !== '2.0') {
126
+ throw new WireRequestRefusal('invalid_request', `${name}: every request must carry "jsonrpc": "2.0"`, 400);
127
+ }
128
+ if (body.method !== A2A_SEND_METHOD) {
129
+ // Named rather than ignored: a caller using a method this agent does
130
+ // not implement learns which one it does, instead of receiving an
131
+ // empty answer to a question that was never asked.
132
+ throw new WireRequestRefusal('method_not_found', `${name}: only '${A2A_SEND_METHOD}' is implemented; received '${String(body.method)}'`, 404);
133
+ }
134
+ const params = isRecord(body.params) ? body.params : undefined;
135
+ const input = readA2AMessageText(params?.message);
136
+ if (input.trim() === '') {
137
+ throw new WireRequestRefusal('invalid_params', `${name}: message text must not be empty`, 400);
138
+ }
139
+ // A2A carries no session of its own — the transport hosting it does, and
140
+ // the runtime adapter reads it from wherever that transport puts it.
141
+ return { input };
142
+ },
143
+ health: () => health,
144
+ output: (output, facts) => envelope(facts, {
145
+ result: {
146
+ artifacts: [
147
+ {
148
+ artifactId: String(facts?.body.id ?? 'artifact'),
149
+ name: 'agent_response',
150
+ parts: [{ kind: 'text', text: output }],
151
+ },
152
+ ],
153
+ },
154
+ }),
155
+ chunk: (text) => ({ kind: 'text', text }),
156
+ failure: (message, code, facts, origin) => envelope(facts, {
157
+ error: {
158
+ code: codeFor(code),
159
+ // A thrown exception's words are the author's note to their own logs.
160
+ // A refusal this library authored was written to be read.
161
+ message: origin === 'threw' ? 'The agent could not complete this request.' : message,
162
+ },
163
+ }),
164
+ };
165
+ }
166
+ //# sourceMappingURL=a2aWire.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"a2aWire.js","sourceRoot":"","sources":["../../../../src/adapters/hosting/a2aWire.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAG7D,+DAA+D;AAC/D,MAAM,CAAC,MAAM,oBAAoB,GAAG,OAAO,CAAC;AAE5C,sEAAsE;AACtE,MAAM,CAAC,MAAM,mBAAmB,GAAG,8BAA8B,CAAC;AAElE,wCAAwC;AACxC,MAAM,CAAC,MAAM,eAAe,GAAG,cAAc,CAAC;AAE9C;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,KAAK,CAAC;AAC/C,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,KAAK,CAAC;AAC7C,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,KAAK,CAAC;AA6C7C,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC;AAED,oGAAoG;AACpG,SAAS,SAAS,CAAC,KAAmC;IACpD,MAAM,EAAE,GAAG,KAAK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