agentfootprint 9.67.0 → 9.68.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.
- package/dist/adapters/hosting/a2aWire.js +172 -0
- package/dist/adapters/hosting/a2aWire.js.map +1 -0
- package/dist/adapters/hosting/agentCoreA2A.js +173 -0
- package/dist/adapters/hosting/agentCoreA2A.js.map +1 -0
- package/dist/esm/adapters/hosting/a2aWire.d.ts +110 -0
- package/dist/esm/adapters/hosting/a2aWire.js +166 -0
- package/dist/esm/adapters/hosting/a2aWire.js.map +1 -0
- package/dist/esm/adapters/hosting/agentCoreA2A.d.ts +95 -0
- package/dist/esm/adapters/hosting/agentCoreA2A.js +168 -0
- package/dist/esm/adapters/hosting/agentCoreA2A.js.map +1 -0
- package/dist/esm/hosting-providers.d.ts +19 -0
- package/dist/esm/hosting-providers.js +19 -0
- package/dist/esm/hosting-providers.js.map +1 -1
- package/dist/hosting-providers.js +35 -1
- package/dist/hosting-providers.js.map +1 -1
- package/dist/types/adapters/hosting/a2aWire.d.ts +111 -0
- package/dist/types/adapters/hosting/a2aWire.d.ts.map +1 -0
- package/dist/types/adapters/hosting/agentCoreA2A.d.ts +96 -0
- package/dist/types/adapters/hosting/agentCoreA2A.d.ts.map +1 -0
- package/dist/types/hosting-providers.d.ts +19 -0
- package/dist/types/hosting-providers.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* adapters/hosting/agentCoreA2A — an agentfootprint agent as an AWS Bedrock
|
|
3
|
+
* **AgentCore A2A** server, callable by other agents.
|
|
4
|
+
*
|
|
5
|
+
* ── The split, again ─────────────────────────────────────────────────────────
|
|
6
|
+
* Two different things are needed, and only one is Amazon's:
|
|
7
|
+
*
|
|
8
|
+
* • The **A2A protocol** — JSON-RPC 2.0, `message/send`, artifacts, the agent
|
|
9
|
+
* card. An open protocol several runtimes speak, so it lives in
|
|
10
|
+
* `a2aWire.ts` with no vendor in it.
|
|
11
|
+
* • The **container contract** — port 9000 (not 8080, and not 8000: each
|
|
12
|
+
* protocol gets its own), the agent mounted at `/`, `GET /ping` answering
|
|
13
|
+
* `{"status":"Healthy"}`, the session id arriving in
|
|
14
|
+
* `X-Amzn-Bedrock-AgentCore-Runtime-Session-Id`, and a table of JSON-RPC
|
|
15
|
+
* error codes that are this runtime's exceptions rather than A2A's. That
|
|
16
|
+
* IS Amazon's, and it is what this file supplies.
|
|
17
|
+
*
|
|
18
|
+
* ── One deviation you must know about ────────────────────────────────────────
|
|
19
|
+
* The A2A specification delivers JSON-RPC errors over HTTP 200. **AgentCore
|
|
20
|
+
* does not** — it returns the real status code (409, 404, …) with the JSON-RPC
|
|
21
|
+
* error body. That is a fact about the platform in front of your container, so
|
|
22
|
+
* a CLIENT must parse the error body even on a non-2xx response; see
|
|
23
|
+
* `agentCoreA2AErrorCode` for the table this host mirrors on the way out.
|
|
24
|
+
*
|
|
25
|
+
* ── What is NOT provided ─────────────────────────────────────────────────────
|
|
26
|
+
* `message/stream` and the task lifecycle. The agent card this host serves
|
|
27
|
+
* therefore declares `streaming: false` unless you overrule it, because a card
|
|
28
|
+
* that advertises streaming to a wire that cannot stream is a caller left
|
|
29
|
+
* waiting. AWS's own sample card says `true`; ours says what is true of ours.
|
|
30
|
+
*
|
|
31
|
+
* @example An agent other agents can call
|
|
32
|
+
* import { agentCoreA2AHost, memorySessions, standingAgent } from 'agentfootprint/hosting';
|
|
33
|
+
*
|
|
34
|
+
* const handle = await standingAgent({
|
|
35
|
+
* agent,
|
|
36
|
+
* sessions: memorySessions(),
|
|
37
|
+
* host: agentCoreA2AHost({
|
|
38
|
+
* card: { name: 'triage', description: 'Triages SAN alerts.', version: '1.0.0' },
|
|
39
|
+
* }),
|
|
40
|
+
* });
|
|
41
|
+
* process.on('SIGTERM', () => void handle.close());
|
|
42
|
+
*/
|
|
43
|
+
/// <reference types="node" />
|
|
44
|
+
import type { IncomingMessage, Server, ServerResponse } from 'node:http';
|
|
45
|
+
import { type HttpHost } from '../../hosting/httpHost.js';
|
|
46
|
+
import { type A2AAgentCard } from './a2aWire.js';
|
|
47
|
+
/** The port an AgentCore A2A server is expected on — its own, not HTTP's or MCP's. */
|
|
48
|
+
export declare const DEFAULT_AGENTCORE_A2A_PORT = 9000;
|
|
49
|
+
/** A2A mounts the agent at the root. */
|
|
50
|
+
export declare const AGENTCORE_A2A_INVOKE_PATH = "/";
|
|
51
|
+
/** The runtime's health path for every protocol. */
|
|
52
|
+
export declare const AGENTCORE_PING_PATH = "/ping";
|
|
53
|
+
/** Where the platform puts the caller's session. */
|
|
54
|
+
export declare const AGENTCORE_SESSION_HEADER = "X-Amzn-Bedrock-AgentCore-Runtime-Session-Id";
|
|
55
|
+
/**
|
|
56
|
+
* AgentCore's own JSON-RPC error codes, mapped from this library's refusal codes.
|
|
57
|
+
*
|
|
58
|
+
* These numbers are the RUNTIME's exception table, not A2A's: `-32051`
|
|
59
|
+
* ResourceNotFound, `-32052` Validation, `-32053` Throttling and
|
|
60
|
+
* ServiceQuotaExceeded, `-32054` Conflict and RetryableConflict, `-32055`
|
|
61
|
+
* RuntimeClientError, `-32603` anything else. A client reads them to decide
|
|
62
|
+
* whether to retry — `-32054` with "Session operation in progress" is the one
|
|
63
|
+
* that must be retried with backoff, and A2A clients do not do that on their
|
|
64
|
+
* own.
|
|
65
|
+
*
|
|
66
|
+
* Exported so a client built against this host can share one table with it
|
|
67
|
+
* rather than keep a second copy that drifts.
|
|
68
|
+
*/
|
|
69
|
+
export declare function agentCoreA2AErrorCode(code: string | undefined): number;
|
|
70
|
+
export interface AgentCoreA2AHostOptions {
|
|
71
|
+
/** The agent card other agents read. Required — discovery is not optional in A2A. */
|
|
72
|
+
readonly card: A2AAgentCard;
|
|
73
|
+
/** Port to bind. Default {@link DEFAULT_AGENTCORE_A2A_PORT}. Pass `0` in tests. */
|
|
74
|
+
readonly port?: number;
|
|
75
|
+
/** Interface to bind. Default `'0.0.0.0'` — a container's door must be reachable. */
|
|
76
|
+
readonly hostname?: string;
|
|
77
|
+
/** Ceiling on a request body. Default one mebibyte. */
|
|
78
|
+
readonly maxBodyBytes?: number;
|
|
79
|
+
/** A `node:http` server you own. Refused together with `port`/`hostname`. */
|
|
80
|
+
readonly server?: Server;
|
|
81
|
+
/**
|
|
82
|
+
* Answer a path this host does not own. The agent card is served BEFORE this
|
|
83
|
+
* runs, and everything else falls through to you unchanged — so supplying one
|
|
84
|
+
* costs you nothing the card was not already going to take.
|
|
85
|
+
*/
|
|
86
|
+
readonly onUnhandled?: (req: IncomingMessage, res: ServerResponse) => void;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* An {@link HttpHost} serving AgentCore's A2A container contract.
|
|
90
|
+
*
|
|
91
|
+
* `httpHost` keeps its own promises — draining, aborting on disconnect, failing
|
|
92
|
+
* a handler that throws or answers nothing — and this supplies the protocol,
|
|
93
|
+
* the paths, the port, the session header and the error table.
|
|
94
|
+
*/
|
|
95
|
+
export declare function agentCoreA2AHost(options: AgentCoreA2AHostOptions): HttpHost;
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* adapters/hosting/agentCoreA2A — an agentfootprint agent as an AWS Bedrock
|
|
3
|
+
* **AgentCore A2A** server, callable by other agents.
|
|
4
|
+
*
|
|
5
|
+
* ── The split, again ─────────────────────────────────────────────────────────
|
|
6
|
+
* Two different things are needed, and only one is Amazon's:
|
|
7
|
+
*
|
|
8
|
+
* • The **A2A protocol** — JSON-RPC 2.0, `message/send`, artifacts, the agent
|
|
9
|
+
* card. An open protocol several runtimes speak, so it lives in
|
|
10
|
+
* `a2aWire.ts` with no vendor in it.
|
|
11
|
+
* • The **container contract** — port 9000 (not 8080, and not 8000: each
|
|
12
|
+
* protocol gets its own), the agent mounted at `/`, `GET /ping` answering
|
|
13
|
+
* `{"status":"Healthy"}`, the session id arriving in
|
|
14
|
+
* `X-Amzn-Bedrock-AgentCore-Runtime-Session-Id`, and a table of JSON-RPC
|
|
15
|
+
* error codes that are this runtime's exceptions rather than A2A's. That
|
|
16
|
+
* IS Amazon's, and it is what this file supplies.
|
|
17
|
+
*
|
|
18
|
+
* ── One deviation you must know about ────────────────────────────────────────
|
|
19
|
+
* The A2A specification delivers JSON-RPC errors over HTTP 200. **AgentCore
|
|
20
|
+
* does not** — it returns the real status code (409, 404, …) with the JSON-RPC
|
|
21
|
+
* error body. That is a fact about the platform in front of your container, so
|
|
22
|
+
* a CLIENT must parse the error body even on a non-2xx response; see
|
|
23
|
+
* `agentCoreA2AErrorCode` for the table this host mirrors on the way out.
|
|
24
|
+
*
|
|
25
|
+
* ── What is NOT provided ─────────────────────────────────────────────────────
|
|
26
|
+
* `message/stream` and the task lifecycle. The agent card this host serves
|
|
27
|
+
* therefore declares `streaming: false` unless you overrule it, because a card
|
|
28
|
+
* that advertises streaming to a wire that cannot stream is a caller left
|
|
29
|
+
* waiting. AWS's own sample card says `true`; ours says what is true of ours.
|
|
30
|
+
*
|
|
31
|
+
* @example An agent other agents can call
|
|
32
|
+
* import { agentCoreA2AHost, memorySessions, standingAgent } from 'agentfootprint/hosting';
|
|
33
|
+
*
|
|
34
|
+
* const handle = await standingAgent({
|
|
35
|
+
* agent,
|
|
36
|
+
* sessions: memorySessions(),
|
|
37
|
+
* host: agentCoreA2AHost({
|
|
38
|
+
* card: { name: 'triage', description: 'Triages SAN alerts.', version: '1.0.0' },
|
|
39
|
+
* }),
|
|
40
|
+
* });
|
|
41
|
+
* process.on('SIGTERM', () => void handle.close());
|
|
42
|
+
*/
|
|
43
|
+
import { headerValue, httpHost } from '../../hosting/httpHost.js';
|
|
44
|
+
import { a2aAgentCardDocument, a2aWire, A2A_AGENT_CARD_PATH, } from './a2aWire.js';
|
|
45
|
+
/** The port an AgentCore A2A server is expected on — its own, not HTTP's or MCP's. */
|
|
46
|
+
export const DEFAULT_AGENTCORE_A2A_PORT = 9000;
|
|
47
|
+
/** A2A mounts the agent at the root. */
|
|
48
|
+
export const AGENTCORE_A2A_INVOKE_PATH = '/';
|
|
49
|
+
/** The runtime's health path for every protocol. */
|
|
50
|
+
export const AGENTCORE_PING_PATH = '/ping';
|
|
51
|
+
/** Where the platform puts the caller's session. */
|
|
52
|
+
export const AGENTCORE_SESSION_HEADER = 'X-Amzn-Bedrock-AgentCore-Runtime-Session-Id';
|
|
53
|
+
/**
|
|
54
|
+
* AgentCore's own JSON-RPC error codes, mapped from this library's refusal codes.
|
|
55
|
+
*
|
|
56
|
+
* These numbers are the RUNTIME's exception table, not A2A's: `-32051`
|
|
57
|
+
* ResourceNotFound, `-32052` Validation, `-32053` Throttling and
|
|
58
|
+
* ServiceQuotaExceeded, `-32054` Conflict and RetryableConflict, `-32055`
|
|
59
|
+
* RuntimeClientError, `-32603` anything else. A client reads them to decide
|
|
60
|
+
* whether to retry — `-32054` with "Session operation in progress" is the one
|
|
61
|
+
* that must be retried with backoff, and A2A clients do not do that on their
|
|
62
|
+
* own.
|
|
63
|
+
*
|
|
64
|
+
* Exported so a client built against this host can share one table with it
|
|
65
|
+
* rather than keep a second copy that drifts.
|
|
66
|
+
*/
|
|
67
|
+
export function agentCoreA2AErrorCode(code) {
|
|
68
|
+
switch (code) {
|
|
69
|
+
case 'ERR_SESSION_NOT_FOUND':
|
|
70
|
+
case 'ERR_ARTIFACT_NOT_FOUND':
|
|
71
|
+
return -32051;
|
|
72
|
+
case 'ERR_INVALID_WIRE_OP':
|
|
73
|
+
case 'ERR_DECISION_REQUIRED':
|
|
74
|
+
case 'ERR_ARTIFACT_SESSION_REQUIRED':
|
|
75
|
+
case 'invalid_request':
|
|
76
|
+
case 'invalid_params':
|
|
77
|
+
case 'unsupported_part':
|
|
78
|
+
return -32052;
|
|
79
|
+
case 'ERR_ADMISSION_REFUSED':
|
|
80
|
+
case 'ERR_REQUEST_TOO_LARGE':
|
|
81
|
+
return -32053;
|
|
82
|
+
case 'ERR_CONCURRENT_RUN':
|
|
83
|
+
case 'ERR_HOST_CLOSED':
|
|
84
|
+
case 'ERR_AWAITING_DECISION':
|
|
85
|
+
case 'ERR_PAUSE_NOT_CARRIED':
|
|
86
|
+
return -32054;
|
|
87
|
+
case 'method_not_found':
|
|
88
|
+
// JSON-RPC's own "method not found" is -32601, but this runtime reports a
|
|
89
|
+
// route it cannot resolve as ResourceNotFound. The platform's table wins
|
|
90
|
+
// inside the platform's container.
|
|
91
|
+
return -32051;
|
|
92
|
+
default:
|
|
93
|
+
return -32603;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
const DEFAULT_MAX_BODY_BYTES = 1_048_576;
|
|
97
|
+
/**
|
|
98
|
+
* An {@link HttpHost} serving AgentCore's A2A container contract.
|
|
99
|
+
*
|
|
100
|
+
* `httpHost` keeps its own promises — draining, aborting on disconnect, failing
|
|
101
|
+
* a handler that throws or answers nothing — and this supplies the protocol,
|
|
102
|
+
* the paths, the port, the session header and the error table.
|
|
103
|
+
*/
|
|
104
|
+
export function agentCoreA2AHost(options) {
|
|
105
|
+
const { server, onUnhandled, hostname, card } = options;
|
|
106
|
+
const cardDocument = JSON.stringify(a2aAgentCardDocument(card));
|
|
107
|
+
/** The discovery document, served before anything falls through to the caller. */
|
|
108
|
+
const serveCard = (req, res) => {
|
|
109
|
+
const path = (req.url ?? '').split('?')[0];
|
|
110
|
+
if (req.method === 'GET' && path === A2A_AGENT_CARD_PATH) {
|
|
111
|
+
res.writeHead(200, {
|
|
112
|
+
'content-type': 'application/json',
|
|
113
|
+
'content-length': Buffer.byteLength(cardDocument),
|
|
114
|
+
});
|
|
115
|
+
res.end(cardDocument);
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
// Not the card: the caller's own routes, if they have any. Chaining rather
|
|
119
|
+
// than consuming the slot — an adapter that took `onUnhandled` for itself
|
|
120
|
+
// would silently remove a seam the host documents as the consumer's.
|
|
121
|
+
if (onUnhandled) {
|
|
122
|
+
onUnhandled(req, res);
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
res.writeHead(404, { 'content-type': 'application/json' });
|
|
126
|
+
res.end(JSON.stringify({ error: `no route for ${req.method ?? '?'} ${path}` }));
|
|
127
|
+
};
|
|
128
|
+
const socket = server
|
|
129
|
+
? { server }
|
|
130
|
+
: {
|
|
131
|
+
port: options.port ?? DEFAULT_AGENTCORE_A2A_PORT,
|
|
132
|
+
...(hostname === undefined ? {} : { hostname }),
|
|
133
|
+
onUnhandled: serveCard,
|
|
134
|
+
};
|
|
135
|
+
const protocol = a2aWire({
|
|
136
|
+
card,
|
|
137
|
+
// The runtime's health contract, not A2A's — A2A has no /ping at all.
|
|
138
|
+
health: { status: 'Healthy' },
|
|
139
|
+
errorCodeFor: agentCoreA2AErrorCode,
|
|
140
|
+
name: 'agentCoreA2AHost',
|
|
141
|
+
});
|
|
142
|
+
return httpHost({
|
|
143
|
+
name: 'agentCoreA2AHost',
|
|
144
|
+
wire: {
|
|
145
|
+
...protocol,
|
|
146
|
+
// The one thing the protocol does not carry and the platform does: which
|
|
147
|
+
// conversation this call belongs to, in a header of the runtime's own.
|
|
148
|
+
readRequest(facts) {
|
|
149
|
+
const base = protocol.readRequest(facts);
|
|
150
|
+
const sessionId = headerValue(facts, AGENTCORE_SESSION_HEADER);
|
|
151
|
+
return { ...base, ...(sessionId !== undefined && { sessionId }) };
|
|
152
|
+
},
|
|
153
|
+
},
|
|
154
|
+
invokePath: AGENTCORE_A2A_INVOKE_PATH,
|
|
155
|
+
healthPath: AGENTCORE_PING_PATH,
|
|
156
|
+
// NOT `['streaming']`, which is this file's default. `message/send` has
|
|
157
|
+
// nowhere to put a chunk: a caller gets one JSON-RPC reply and nothing
|
|
158
|
+
// before it. Declaring streaming anyway would make `requireCapability`
|
|
159
|
+
// pass for a host that cannot honour it, and would contradict the agent
|
|
160
|
+
// card, which says `streaming: false` for the same reason. The host
|
|
161
|
+
// conformance suite catches exactly this — it asserts chunks IF AND ONLY IF
|
|
162
|
+
// the capability is declared, and it caught it here.
|
|
163
|
+
capabilities: [],
|
|
164
|
+
maxBodyBytes: options.maxBodyBytes ?? DEFAULT_MAX_BODY_BYTES,
|
|
165
|
+
...socket,
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
//# sourceMappingURL=agentCoreA2A.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agentCoreA2A.js","sourceRoot":"","sources":["../../../../src/adapters/hosting/agentCoreA2A.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAIH,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAiB,MAAM,2BAA2B,CAAC;AACjF,OAAO,EACL,oBAAoB,EACpB,OAAO,EACP,mBAAmB,GAEpB,MAAM,cAAc,CAAC;AAEtB,sFAAsF;AACtF,MAAM,CAAC,MAAM,0BAA0B,GAAG,IAAI,CAAC;AAE/C,wCAAwC;AACxC,MAAM,CAAC,MAAM,yBAAyB,GAAG,GAAG,CAAC;AAE7C,oDAAoD;AACpD,MAAM,CAAC,MAAM,mBAAmB,GAAG,OAAO,CAAC;AAE3C,oDAAoD;AACpD,MAAM,CAAC,MAAM,wBAAwB,GAAG,6CAA6C,CAAC;AAEtF;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,qBAAqB,CAAC,IAAwB;IAC5D,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,uBAAuB,CAAC;QAC7B,KAAK,wBAAwB;YAC3B,OAAO,CAAC,KAAK,CAAC;QAChB,KAAK,qBAAqB,CAAC;QAC3B,KAAK,uBAAuB,CAAC;QAC7B,KAAK,+BAA+B,CAAC;QACrC,KAAK,iBAAiB,CAAC;QACvB,KAAK,gBAAgB,CAAC;QACtB,KAAK,kBAAkB;YACrB,OAAO,CAAC,KAAK,CAAC;QAChB,KAAK,uBAAuB,CAAC;QAC7B,KAAK,uBAAuB;YAC1B,OAAO,CAAC,KAAK,CAAC;QAChB,KAAK,oBAAoB,CAAC;QAC1B,KAAK,iBAAiB,CAAC;QACv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O,CAAC,YAAY,IAAI,sBAAsB;QAC5D,GAAG,MAAM;KACV,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -25,6 +25,21 @@
|
|
|
25
25
|
* idleMs: 900000 }` declared, session affinity readable from header or
|
|
26
26
|
* query, and a `Sec-WebSocket-Protocol` bearer mapped into
|
|
27
27
|
* `headers.authorization`.
|
|
28
|
+
* • `agentCoreA2AHost({ card, port?, hostname?, maxBodyBytes? })` — an
|
|
29
|
+
* `AgentHost` for AgentCore's **A2A** container contract, so OTHER AGENTS
|
|
30
|
+
* can call yours: JSON-RPC 2.0 at `POST /` on port 9000, the agent card at
|
|
31
|
+
* `/.well-known/agent-card.json`, `GET /ping` answering
|
|
32
|
+
* `{"status":"Healthy"}`, and the session read from
|
|
33
|
+
* `X-Amzn-Bedrock-AgentCore-Runtime-Session-Id`. It declares NO streaming
|
|
34
|
+
* capability and its card says `streaming: false`, because `message/send`
|
|
35
|
+
* has nowhere to put a chunk — the two agree on purpose. Errors carry a
|
|
36
|
+
* REAL HTTP status alongside the JSON-RPC error body (the platform's
|
|
37
|
+
* documented deviation from the A2A spec); `agentCoreA2AErrorCode` is the
|
|
38
|
+
* table, exported so a client shares it rather than keeping a copy.
|
|
39
|
+
* • `a2aWire({ card, health?, errorCodeFor? })` — the A2A PROTOCOL as an
|
|
40
|
+
* `HttpWire`, with no vendor in it, for the next runtime that speaks it.
|
|
41
|
+
* `a2aAgentCardDocument(card)` builds the discovery document on its own,
|
|
42
|
+
* for deployments that must serve it from somewhere else.
|
|
28
43
|
* • `foundryResponsesHost({ port?, hostname?, model?, maxBodyBytes? })` — an
|
|
29
44
|
* `AgentHost` for Microsoft Foundry's hosted-agent contract: `POST
|
|
30
45
|
* /responses`, a `HEAD` capability probe on the same path, `GET /readiness`
|
|
@@ -100,6 +115,10 @@
|
|
|
100
115
|
* symbols, one door. Import from the door.
|
|
101
116
|
*/
|
|
102
117
|
export { agentCoreRuntimeHost, agentCoreRuntimeWire, readAgentCoreConversation, agentCoreSessions, DEFAULT_SESSION_STORAGE_PATH, } from './adapters/hosting/agentcore.js';
|
|
118
|
+
export { agentCoreA2AHost, agentCoreA2AErrorCode, DEFAULT_AGENTCORE_A2A_PORT, AGENTCORE_A2A_INVOKE_PATH, AGENTCORE_PING_PATH, AGENTCORE_SESSION_HEADER, } from './adapters/hosting/agentCoreA2A.js';
|
|
119
|
+
export type { AgentCoreA2AHostOptions } from './adapters/hosting/agentCoreA2A.js';
|
|
120
|
+
export { a2aWire, a2aAgentCardDocument, readA2AMessageText, A2A_PROTOCOL_VERSION, A2A_AGENT_CARD_PATH, A2A_SEND_METHOD, JSONRPC_METHOD_NOT_FOUND, JSONRPC_INVALID_PARAMS, JSONRPC_INTERNAL_ERROR, } from './adapters/hosting/a2aWire.js';
|
|
121
|
+
export type { A2AWireOptions, A2AAgentCard, A2ASkill } from './adapters/hosting/a2aWire.js';
|
|
103
122
|
export { foundryResponsesHost, DEFAULT_FOUNDRY_PORT, FOUNDRY_INVOKE_PATH, FOUNDRY_READINESS_PATH, FOUNDRY_SESSION_FIELDS, } from './adapters/hosting/foundryResponses.js';
|
|
104
123
|
export type { FoundryResponsesHostOptions } from './adapters/hosting/foundryResponses.js';
|
|
105
124
|
export { responsesWire, readResponsesInput, readResponsesSession, DEFAULT_SESSION_FIELDS, PUBLIC_FAILURE_MESSAGE, } from './adapters/hosting/responsesWire.js';
|
|
@@ -25,6 +25,21 @@
|
|
|
25
25
|
* idleMs: 900000 }` declared, session affinity readable from header or
|
|
26
26
|
* query, and a `Sec-WebSocket-Protocol` bearer mapped into
|
|
27
27
|
* `headers.authorization`.
|
|
28
|
+
* • `agentCoreA2AHost({ card, port?, hostname?, maxBodyBytes? })` — an
|
|
29
|
+
* `AgentHost` for AgentCore's **A2A** container contract, so OTHER AGENTS
|
|
30
|
+
* can call yours: JSON-RPC 2.0 at `POST /` on port 9000, the agent card at
|
|
31
|
+
* `/.well-known/agent-card.json`, `GET /ping` answering
|
|
32
|
+
* `{"status":"Healthy"}`, and the session read from
|
|
33
|
+
* `X-Amzn-Bedrock-AgentCore-Runtime-Session-Id`. It declares NO streaming
|
|
34
|
+
* capability and its card says `streaming: false`, because `message/send`
|
|
35
|
+
* has nowhere to put a chunk — the two agree on purpose. Errors carry a
|
|
36
|
+
* REAL HTTP status alongside the JSON-RPC error body (the platform's
|
|
37
|
+
* documented deviation from the A2A spec); `agentCoreA2AErrorCode` is the
|
|
38
|
+
* table, exported so a client shares it rather than keeping a copy.
|
|
39
|
+
* • `a2aWire({ card, health?, errorCodeFor? })` — the A2A PROTOCOL as an
|
|
40
|
+
* `HttpWire`, with no vendor in it, for the next runtime that speaks it.
|
|
41
|
+
* `a2aAgentCardDocument(card)` builds the discovery document on its own,
|
|
42
|
+
* for deployments that must serve it from somewhere else.
|
|
28
43
|
* • `foundryResponsesHost({ port?, hostname?, model?, maxBodyBytes? })` — an
|
|
29
44
|
* `AgentHost` for Microsoft Foundry's hosted-agent contract: `POST
|
|
30
45
|
* /responses`, a `HEAD` capability probe on the same path, `GET /readiness`
|
|
@@ -100,6 +115,10 @@
|
|
|
100
115
|
* symbols, one door. Import from the door.
|
|
101
116
|
*/
|
|
102
117
|
export { agentCoreRuntimeHost, agentCoreRuntimeWire, readAgentCoreConversation, agentCoreSessions, DEFAULT_SESSION_STORAGE_PATH, } from './adapters/hosting/agentcore.js';
|
|
118
|
+
export { agentCoreA2AHost, agentCoreA2AErrorCode, DEFAULT_AGENTCORE_A2A_PORT, AGENTCORE_A2A_INVOKE_PATH, AGENTCORE_PING_PATH, AGENTCORE_SESSION_HEADER, } from './adapters/hosting/agentCoreA2A.js';
|
|
119
|
+
// The protocol under it, on the barrel in its own right — A2A is an open
|
|
120
|
+
// protocol, and reaching it should not mean importing a vendor's module.
|
|
121
|
+
export { a2aWire, a2aAgentCardDocument, readA2AMessageText, A2A_PROTOCOL_VERSION, A2A_AGENT_CARD_PATH, A2A_SEND_METHOD, JSONRPC_METHOD_NOT_FOUND, JSONRPC_INVALID_PARAMS, JSONRPC_INTERNAL_ERROR, } from './adapters/hosting/a2aWire.js';
|
|
103
122
|
export { foundryResponsesHost, DEFAULT_FOUNDRY_PORT, FOUNDRY_INVOKE_PATH, FOUNDRY_READINESS_PATH, FOUNDRY_SESSION_FIELDS, } from './adapters/hosting/foundryResponses.js';
|
|
104
123
|
// The protocol under it, on the barrel in its own right: a deployment that
|
|
105
124
|
// speaks Responses on paths of its own is a `httpHost` away, and having to
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hosting-providers.js","sourceRoot":"","sources":["../../src/hosting-providers.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"hosting-providers.js","sourceRoot":"","sources":["../../src/hosting-providers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmHG;AAEH,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACpB,yBAAyB,EACzB,iBAAiB,EACjB,4BAA4B,GAC7B,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EACL,gBAAgB,EAChB,qBAAqB,EACrB,0BAA0B,EAC1B,yBAAyB,EACzB,mBAAmB,EACnB,wBAAwB,GACzB,MAAM,oCAAoC,CAAC;AAI5C,yEAAyE;AACzE,yEAAyE;AACzE,OAAO,EACL,OAAO,EACP,oBAAoB,EACpB,kBAAkB,EAClB,oBAAoB,EACpB,mBAAmB,EACnB,eAAe,EACf,wBAAwB,EACxB,sBAAsB,EACtB,sBAAsB,GACvB,MAAM,+BAA+B,CAAC;AAIvC,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,EACnB,sBAAsB,EACtB,sBAAsB,GACvB,MAAM,wCAAwC,CAAC;AAIhD,2EAA2E;AAC3E,2EAA2E;AAC3E,8EAA8E;AAC9E,kCAAkC;AAClC,OAAO,EACL,aAAa,EACb,kBAAkB,EAClB,oBAAoB,EACpB,sBAAsB,EACtB,sBAAsB,GACvB,MAAM,qCAAqC,CAAC;AAI7C,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,iBAAiB,EACjB,oBAAoB,GACrB,MAAM,yCAAyC,CAAC;AAOjD,gFAAgF;AAChF,+EAA+E;AAC/E,gFAAgF;AAChF,4EAA4E;AAC5E,6EAA6E;AAC7E,mBAAmB;AACnB,OAAO,EACL,iBAAiB,EACjB,0BAA0B;AAC1B,uEAAuE;AACvE,2EAA2E;AAC3E,0EAA0E;AAC1E,6EAA6E;AAC7E,yEAAyE;AACzE,gBAAgB,EAChB,4BAA4B,EAC5B,4BAA4B,EAC5B,qBAAqB,EACrB,0BAA0B,GAC3B,MAAM,yCAAyC,CAAC"}
|
|
@@ -26,6 +26,21 @@
|
|
|
26
26
|
* idleMs: 900000 }` declared, session affinity readable from header or
|
|
27
27
|
* query, and a `Sec-WebSocket-Protocol` bearer mapped into
|
|
28
28
|
* `headers.authorization`.
|
|
29
|
+
* • `agentCoreA2AHost({ card, port?, hostname?, maxBodyBytes? })` — an
|
|
30
|
+
* `AgentHost` for AgentCore's **A2A** container contract, so OTHER AGENTS
|
|
31
|
+
* can call yours: JSON-RPC 2.0 at `POST /` on port 9000, the agent card at
|
|
32
|
+
* `/.well-known/agent-card.json`, `GET /ping` answering
|
|
33
|
+
* `{"status":"Healthy"}`, and the session read from
|
|
34
|
+
* `X-Amzn-Bedrock-AgentCore-Runtime-Session-Id`. It declares NO streaming
|
|
35
|
+
* capability and its card says `streaming: false`, because `message/send`
|
|
36
|
+
* has nowhere to put a chunk — the two agree on purpose. Errors carry a
|
|
37
|
+
* REAL HTTP status alongside the JSON-RPC error body (the platform's
|
|
38
|
+
* documented deviation from the A2A spec); `agentCoreA2AErrorCode` is the
|
|
39
|
+
* table, exported so a client shares it rather than keeping a copy.
|
|
40
|
+
* • `a2aWire({ card, health?, errorCodeFor? })` — the A2A PROTOCOL as an
|
|
41
|
+
* `HttpWire`, with no vendor in it, for the next runtime that speaks it.
|
|
42
|
+
* `a2aAgentCardDocument(card)` builds the discovery document on its own,
|
|
43
|
+
* for deployments that must serve it from somewhere else.
|
|
29
44
|
* • `foundryResponsesHost({ port?, hostname?, model?, maxBodyBytes? })` — an
|
|
30
45
|
* `AgentHost` for Microsoft Foundry's hosted-agent contract: `POST
|
|
31
46
|
* /responses`, a `HEAD` capability probe on the same path, `GET /readiness`
|
|
@@ -101,13 +116,32 @@
|
|
|
101
116
|
* symbols, one door. Import from the door.
|
|
102
117
|
*/
|
|
103
118
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
104
|
-
exports.FirestoreIndexMissingError = exports.EnvelopeTooLargeError = exports.FIRESTORE_MAX_ENVELOPE_BYTES = exports.FIRESTORE_MAX_DOCUMENT_BYTES = exports.EXPIRES_AT_FIELD = exports.DEFAULT_SESSION_COLLECTION = exports.firestoreSessions = exports.SESSION_EVENT_AUTHOR = exports.SESSION_STATE_KEY = exports.DEFAULT_USER_ID = exports.agentEngineSessions = exports.PUBLIC_FAILURE_MESSAGE = exports.DEFAULT_SESSION_FIELDS = exports.readResponsesSession = exports.readResponsesInput = exports.responsesWire = exports.FOUNDRY_SESSION_FIELDS = exports.FOUNDRY_READINESS_PATH = exports.FOUNDRY_INVOKE_PATH = exports.DEFAULT_FOUNDRY_PORT = exports.foundryResponsesHost = exports.DEFAULT_SESSION_STORAGE_PATH = exports.agentCoreSessions = exports.readAgentCoreConversation = exports.agentCoreRuntimeWire = exports.agentCoreRuntimeHost = void 0;
|
|
119
|
+
exports.FirestoreIndexMissingError = exports.EnvelopeTooLargeError = exports.FIRESTORE_MAX_ENVELOPE_BYTES = exports.FIRESTORE_MAX_DOCUMENT_BYTES = exports.EXPIRES_AT_FIELD = exports.DEFAULT_SESSION_COLLECTION = exports.firestoreSessions = exports.SESSION_EVENT_AUTHOR = exports.SESSION_STATE_KEY = exports.DEFAULT_USER_ID = exports.agentEngineSessions = exports.PUBLIC_FAILURE_MESSAGE = exports.DEFAULT_SESSION_FIELDS = exports.readResponsesSession = exports.readResponsesInput = exports.responsesWire = exports.FOUNDRY_SESSION_FIELDS = exports.FOUNDRY_READINESS_PATH = exports.FOUNDRY_INVOKE_PATH = exports.DEFAULT_FOUNDRY_PORT = exports.foundryResponsesHost = exports.JSONRPC_INTERNAL_ERROR = exports.JSONRPC_INVALID_PARAMS = exports.JSONRPC_METHOD_NOT_FOUND = exports.A2A_SEND_METHOD = exports.A2A_AGENT_CARD_PATH = exports.A2A_PROTOCOL_VERSION = exports.readA2AMessageText = exports.a2aAgentCardDocument = exports.a2aWire = exports.AGENTCORE_SESSION_HEADER = exports.AGENTCORE_PING_PATH = exports.AGENTCORE_A2A_INVOKE_PATH = exports.DEFAULT_AGENTCORE_A2A_PORT = exports.agentCoreA2AErrorCode = exports.agentCoreA2AHost = exports.DEFAULT_SESSION_STORAGE_PATH = exports.agentCoreSessions = exports.readAgentCoreConversation = exports.agentCoreRuntimeWire = exports.agentCoreRuntimeHost = void 0;
|
|
105
120
|
var agentcore_js_1 = require("./adapters/hosting/agentcore.js");
|
|
106
121
|
Object.defineProperty(exports, "agentCoreRuntimeHost", { enumerable: true, get: function () { return agentcore_js_1.agentCoreRuntimeHost; } });
|
|
107
122
|
Object.defineProperty(exports, "agentCoreRuntimeWire", { enumerable: true, get: function () { return agentcore_js_1.agentCoreRuntimeWire; } });
|
|
108
123
|
Object.defineProperty(exports, "readAgentCoreConversation", { enumerable: true, get: function () { return agentcore_js_1.readAgentCoreConversation; } });
|
|
109
124
|
Object.defineProperty(exports, "agentCoreSessions", { enumerable: true, get: function () { return agentcore_js_1.agentCoreSessions; } });
|
|
110
125
|
Object.defineProperty(exports, "DEFAULT_SESSION_STORAGE_PATH", { enumerable: true, get: function () { return agentcore_js_1.DEFAULT_SESSION_STORAGE_PATH; } });
|
|
126
|
+
var agentCoreA2A_js_1 = require("./adapters/hosting/agentCoreA2A.js");
|
|
127
|
+
Object.defineProperty(exports, "agentCoreA2AHost", { enumerable: true, get: function () { return agentCoreA2A_js_1.agentCoreA2AHost; } });
|
|
128
|
+
Object.defineProperty(exports, "agentCoreA2AErrorCode", { enumerable: true, get: function () { return agentCoreA2A_js_1.agentCoreA2AErrorCode; } });
|
|
129
|
+
Object.defineProperty(exports, "DEFAULT_AGENTCORE_A2A_PORT", { enumerable: true, get: function () { return agentCoreA2A_js_1.DEFAULT_AGENTCORE_A2A_PORT; } });
|
|
130
|
+
Object.defineProperty(exports, "AGENTCORE_A2A_INVOKE_PATH", { enumerable: true, get: function () { return agentCoreA2A_js_1.AGENTCORE_A2A_INVOKE_PATH; } });
|
|
131
|
+
Object.defineProperty(exports, "AGENTCORE_PING_PATH", { enumerable: true, get: function () { return agentCoreA2A_js_1.AGENTCORE_PING_PATH; } });
|
|
132
|
+
Object.defineProperty(exports, "AGENTCORE_SESSION_HEADER", { enumerable: true, get: function () { return agentCoreA2A_js_1.AGENTCORE_SESSION_HEADER; } });
|
|
133
|
+
// The protocol under it, on the barrel in its own right — A2A is an open
|
|
134
|
+
// protocol, and reaching it should not mean importing a vendor's module.
|
|
135
|
+
var a2aWire_js_1 = require("./adapters/hosting/a2aWire.js");
|
|
136
|
+
Object.defineProperty(exports, "a2aWire", { enumerable: true, get: function () { return a2aWire_js_1.a2aWire; } });
|
|
137
|
+
Object.defineProperty(exports, "a2aAgentCardDocument", { enumerable: true, get: function () { return a2aWire_js_1.a2aAgentCardDocument; } });
|
|
138
|
+
Object.defineProperty(exports, "readA2AMessageText", { enumerable: true, get: function () { return a2aWire_js_1.readA2AMessageText; } });
|
|
139
|
+
Object.defineProperty(exports, "A2A_PROTOCOL_VERSION", { enumerable: true, get: function () { return a2aWire_js_1.A2A_PROTOCOL_VERSION; } });
|
|
140
|
+
Object.defineProperty(exports, "A2A_AGENT_CARD_PATH", { enumerable: true, get: function () { return a2aWire_js_1.A2A_AGENT_CARD_PATH; } });
|
|
141
|
+
Object.defineProperty(exports, "A2A_SEND_METHOD", { enumerable: true, get: function () { return a2aWire_js_1.A2A_SEND_METHOD; } });
|
|
142
|
+
Object.defineProperty(exports, "JSONRPC_METHOD_NOT_FOUND", { enumerable: true, get: function () { return a2aWire_js_1.JSONRPC_METHOD_NOT_FOUND; } });
|
|
143
|
+
Object.defineProperty(exports, "JSONRPC_INVALID_PARAMS", { enumerable: true, get: function () { return a2aWire_js_1.JSONRPC_INVALID_PARAMS; } });
|
|
144
|
+
Object.defineProperty(exports, "JSONRPC_INTERNAL_ERROR", { enumerable: true, get: function () { return a2aWire_js_1.JSONRPC_INTERNAL_ERROR; } });
|
|
111
145
|
var foundryResponses_js_1 = require("./adapters/hosting/foundryResponses.js");
|
|
112
146
|
Object.defineProperty(exports, "foundryResponsesHost", { enumerable: true, get: function () { return foundryResponses_js_1.foundryResponsesHost; } });
|
|
113
147
|
Object.defineProperty(exports, "DEFAULT_FOUNDRY_PORT", { enumerable: true, get: function () { return foundryResponses_js_1.DEFAULT_FOUNDRY_PORT; } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hosting-providers.js","sourceRoot":"","sources":["../src/hosting-providers.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"hosting-providers.js","sourceRoot":"","sources":["../src/hosting-providers.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmHG;;;AAEH,gEAMyC;AALvC,oHAAA,oBAAoB,OAAA;AACpB,oHAAA,oBAAoB,OAAA;AACpB,yHAAA,yBAAyB,OAAA;AACzB,iHAAA,iBAAiB,OAAA;AACjB,4HAAA,4BAA4B,OAAA;AAG9B,sEAO4C;AAN1C,mHAAA,gBAAgB,OAAA;AAChB,wHAAA,qBAAqB,OAAA;AACrB,6HAAA,0BAA0B,OAAA;AAC1B,4HAAA,yBAAyB,OA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0,0 +1,111 @@
|
|
|
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 {};
|
|
111
|
+
//# sourceMappingURL=a2aWire.d.ts.map
|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E,SAAS,QAAQ,EAAE,CAAC;CACvC;AAED,MAAM,WAAW,cAAc;IAC7B,+EAA+E;IAC/E,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAC5B,6DAA6D;IAC7D,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAC1B;;;;;;;OAOG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,KAAK,MAAM,CAAC;IAC7D,0DAA0D;IAC1D,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,KAAK,UAAU,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AAYpD;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAyB3D;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,YAAY,GAAG,UAAU,CAkBnE;AAED,mDAAmD;AACnD,wBAAgB,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,QAAQ,CAwEzD"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* adapters/hosting/agentCoreA2A — an agentfootprint agent as an AWS Bedrock
|
|
3
|
+
* **AgentCore A2A** server, callable by other agents.
|
|
4
|
+
*
|
|
5
|
+
* ── The split, again ─────────────────────────────────────────────────────────
|
|
6
|
+
* Two different things are needed, and only one is Amazon's:
|
|
7
|
+
*
|
|
8
|
+
* • The **A2A protocol** — JSON-RPC 2.0, `message/send`, artifacts, the agent
|
|
9
|
+
* card. An open protocol several runtimes speak, so it lives in
|
|
10
|
+
* `a2aWire.ts` with no vendor in it.
|
|
11
|
+
* • The **container contract** — port 9000 (not 8080, and not 8000: each
|
|
12
|
+
* protocol gets its own), the agent mounted at `/`, `GET /ping` answering
|
|
13
|
+
* `{"status":"Healthy"}`, the session id arriving in
|
|
14
|
+
* `X-Amzn-Bedrock-AgentCore-Runtime-Session-Id`, and a table of JSON-RPC
|
|
15
|
+
* error codes that are this runtime's exceptions rather than A2A's. That
|
|
16
|
+
* IS Amazon's, and it is what this file supplies.
|
|
17
|
+
*
|
|
18
|
+
* ── One deviation you must know about ────────────────────────────────────────
|
|
19
|
+
* The A2A specification delivers JSON-RPC errors over HTTP 200. **AgentCore
|
|
20
|
+
* does not** — it returns the real status code (409, 404, …) with the JSON-RPC
|
|
21
|
+
* error body. That is a fact about the platform in front of your container, so
|
|
22
|
+
* a CLIENT must parse the error body even on a non-2xx response; see
|
|
23
|
+
* `agentCoreA2AErrorCode` for the table this host mirrors on the way out.
|
|
24
|
+
*
|
|
25
|
+
* ── What is NOT provided ─────────────────────────────────────────────────────
|
|
26
|
+
* `message/stream` and the task lifecycle. The agent card this host serves
|
|
27
|
+
* therefore declares `streaming: false` unless you overrule it, because a card
|
|
28
|
+
* that advertises streaming to a wire that cannot stream is a caller left
|
|
29
|
+
* waiting. AWS's own sample card says `true`; ours says what is true of ours.
|
|
30
|
+
*
|
|
31
|
+
* @example An agent other agents can call
|
|
32
|
+
* import { agentCoreA2AHost, memorySessions, standingAgent } from 'agentfootprint/hosting';
|
|
33
|
+
*
|
|
34
|
+
* const handle = await standingAgent({
|
|
35
|
+
* agent,
|
|
36
|
+
* sessions: memorySessions(),
|
|
37
|
+
* host: agentCoreA2AHost({
|
|
38
|
+
* card: { name: 'triage', description: 'Triages SAN alerts.', version: '1.0.0' },
|
|
39
|
+
* }),
|
|
40
|
+
* });
|
|
41
|
+
* process.on('SIGTERM', () => void handle.close());
|
|
42
|
+
*/
|
|
43
|
+
/// <reference types="node" />
|
|
44
|
+
import type { IncomingMessage, Server, ServerResponse } from 'node:http';
|
|
45
|
+
import { type HttpHost } from '../../hosting/httpHost.js';
|
|
46
|
+
import { type A2AAgentCard } from './a2aWire.js';
|
|
47
|
+
/** The port an AgentCore A2A server is expected on — its own, not HTTP's or MCP's. */
|
|
48
|
+
export declare const DEFAULT_AGENTCORE_A2A_PORT = 9000;
|
|
49
|
+
/** A2A mounts the agent at the root. */
|
|
50
|
+
export declare const AGENTCORE_A2A_INVOKE_PATH = "/";
|
|
51
|
+
/** The runtime's health path for every protocol. */
|
|
52
|
+
export declare const AGENTCORE_PING_PATH = "/ping";
|
|
53
|
+
/** Where the platform puts the caller's session. */
|
|
54
|
+
export declare const AGENTCORE_SESSION_HEADER = "X-Amzn-Bedrock-AgentCore-Runtime-Session-Id";
|
|
55
|
+
/**
|
|
56
|
+
* AgentCore's own JSON-RPC error codes, mapped from this library's refusal codes.
|
|
57
|
+
*
|
|
58
|
+
* These numbers are the RUNTIME's exception table, not A2A's: `-32051`
|
|
59
|
+
* ResourceNotFound, `-32052` Validation, `-32053` Throttling and
|
|
60
|
+
* ServiceQuotaExceeded, `-32054` Conflict and RetryableConflict, `-32055`
|
|
61
|
+
* RuntimeClientError, `-32603` anything else. A client reads them to decide
|
|
62
|
+
* whether to retry — `-32054` with "Session operation in progress" is the one
|
|
63
|
+
* that must be retried with backoff, and A2A clients do not do that on their
|
|
64
|
+
* own.
|
|
65
|
+
*
|
|
66
|
+
* Exported so a client built against this host can share one table with it
|
|
67
|
+
* rather than keep a second copy that drifts.
|
|
68
|
+
*/
|
|
69
|
+
export declare function agentCoreA2AErrorCode(code: string | undefined): number;
|
|
70
|
+
export interface AgentCoreA2AHostOptions {
|
|
71
|
+
/** The agent card other agents read. Required — discovery is not optional in A2A. */
|
|
72
|
+
readonly card: A2AAgentCard;
|
|
73
|
+
/** Port to bind. Default {@link DEFAULT_AGENTCORE_A2A_PORT}. Pass `0` in tests. */
|
|
74
|
+
readonly port?: number;
|
|
75
|
+
/** Interface to bind. Default `'0.0.0.0'` — a container's door must be reachable. */
|
|
76
|
+
readonly hostname?: string;
|
|
77
|
+
/** Ceiling on a request body. Default one mebibyte. */
|
|
78
|
+
readonly maxBodyBytes?: number;
|
|
79
|
+
/** A `node:http` server you own. Refused together with `port`/`hostname`. */
|
|
80
|
+
readonly server?: Server;
|
|
81
|
+
/**
|
|
82
|
+
* Answer a path this host does not own. The agent card is served BEFORE this
|
|
83
|
+
* runs, and everything else falls through to you unchanged — so supplying one
|
|
84
|
+
* costs you nothing the card was not already going to take.
|
|
85
|
+
*/
|
|
86
|
+
readonly onUnhandled?: (req: IncomingMessage, res: ServerResponse) => void;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* An {@link HttpHost} serving AgentCore's A2A container contract.
|
|
90
|
+
*
|
|
91
|
+
* `httpHost` keeps its own promises — draining, aborting on disconnect, failing
|
|
92
|
+
* a handler that throws or answers nothing — and this supplies the protocol,
|
|
93
|
+
* the paths, the port, the session header and the error table.
|
|
94
|
+
*/
|
|
95
|
+
export declare function agentCoreA2AHost(options: AgentCoreA2AHostOptions): HttpHost;
|
|
96
|
+
//# sourceMappingURL=agentCoreA2A.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agentCoreA2A.d.ts","sourceRoot":"","sources":["../../../../src/adapters/hosting/agentCoreA2A.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAEzE,OAAO,EAAyB,KAAK,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACjF,OAAO,EAIL,KAAK,YAAY,EAClB,MAAM,cAAc,CAAC;AAEtB,sFAAsF;AACtF,eAAO,MAAM,0BAA0B,OAAO,CAAC;AAE/C,wCAAwC;AACxC,eAAO,MAAM,yBAAyB,MAAM,CAAC;AAE7C,oDAAoD;AACpD,eAAO,MAAM,mBAAmB,UAAU,CAAC;AAE3C,oDAAoD;AACpD,eAAO,MAAM,wBAAwB,gDAAgD,CAAC;AAEtF;;;;;;;;;;;;;GAaG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAA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