@agenticprimitives/a2a 0.0.0-alpha.4 → 0.0.0-alpha.40
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/CLAUDE.md +60 -21
- package/README.md +2 -0
- package/bin/a2a-conform.mjs +17 -0
- package/dist/agent.d.ts +170 -3
- package/dist/agent.d.ts.map +1 -1
- package/dist/agent.js +358 -66
- package/dist/agent.js.map +1 -1
- package/dist/auth.d.ts +72 -9
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +62 -19
- package/dist/auth.js.map +1 -1
- package/dist/authority-extension.d.ts +58 -0
- package/dist/authority-extension.d.ts.map +1 -0
- package/dist/authority-extension.js +70 -0
- package/dist/authority-extension.js.map +1 -0
- package/dist/card-audience.d.ts +87 -0
- package/dist/card-audience.d.ts.map +1 -0
- package/dist/card-audience.js +135 -0
- package/dist/card-audience.js.map +1 -0
- package/dist/client.d.ts +23 -8
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +74 -13
- package/dist/client.js.map +1 -1
- package/dist/cloudflare/index.d.ts.map +1 -1
- package/dist/cloudflare/index.js +10 -2
- package/dist/cloudflare/index.js.map +1 -1
- package/dist/conform/index.d.ts +36 -0
- package/dist/conform/index.d.ts.map +1 -0
- package/dist/conform/index.js +232 -0
- package/dist/conform/index.js.map +1 -0
- package/dist/discovery.d.ts +4 -0
- package/dist/discovery.d.ts.map +1 -1
- package/dist/discovery.js +6 -2
- package/dist/discovery.js.map +1 -1
- package/dist/engagement.d.ts +37 -0
- package/dist/engagement.d.ts.map +1 -0
- package/dist/engagement.js +83 -0
- package/dist/engagement.js.map +1 -0
- package/dist/grant.d.ts +4 -2
- package/dist/grant.d.ts.map +1 -1
- package/dist/grant.js +21 -13
- package/dist/grant.js.map +1 -1
- package/dist/handoff.d.ts +42 -0
- package/dist/handoff.d.ts.map +1 -0
- package/dist/handoff.js +28 -0
- package/dist/handoff.js.map +1 -0
- package/dist/index.d.ts +25 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +23 -3
- package/dist/index.js.map +1 -1
- package/dist/payment-gate.d.ts +17 -2
- package/dist/payment-gate.d.ts.map +1 -1
- package/dist/payment-gate.js +4 -2
- package/dist/payment-gate.js.map +1 -1
- package/dist/run-provenance-extension.d.ts +22 -0
- package/dist/run-provenance-extension.d.ts.map +1 -0
- package/dist/run-provenance-extension.js +23 -0
- package/dist/run-provenance-extension.js.map +1 -0
- package/dist/runtime.d.ts +13 -1
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +35 -10
- package/dist/runtime.js.map +1 -1
- package/dist/session-wire.d.ts +90 -0
- package/dist/session-wire.d.ts.map +1 -0
- package/dist/session-wire.js +226 -0
- package/dist/session-wire.js.map +1 -0
- package/dist/skill-handler.d.ts +21 -1
- package/dist/skill-handler.d.ts.map +1 -1
- package/dist/skill-handler.js.map +1 -1
- package/dist/standard/app-delegation.d.ts +60 -0
- package/dist/standard/app-delegation.d.ts.map +1 -0
- package/dist/standard/app-delegation.js +43 -0
- package/dist/standard/app-delegation.js.map +1 -0
- package/dist/standard/caller.d.ts +107 -0
- package/dist/standard/caller.d.ts.map +1 -0
- package/dist/standard/caller.js +176 -0
- package/dist/standard/caller.js.map +1 -0
- package/dist/standard/client.d.ts +53 -0
- package/dist/standard/client.d.ts.map +1 -0
- package/dist/standard/client.js +88 -0
- package/dist/standard/client.js.map +1 -0
- package/dist/standard/delegated.d.ts +121 -0
- package/dist/standard/delegated.d.ts.map +1 -0
- package/dist/standard/delegated.js +170 -0
- package/dist/standard/delegated.js.map +1 -0
- package/dist/standard/errors.d.ts +31 -0
- package/dist/standard/errors.d.ts.map +1 -0
- package/dist/standard/errors.js +75 -0
- package/dist/standard/errors.js.map +1 -0
- package/dist/standard/from-agent.d.ts +41 -0
- package/dist/standard/from-agent.d.ts.map +1 -0
- package/dist/standard/from-agent.js +133 -0
- package/dist/standard/from-agent.js.map +1 -0
- package/dist/standard/index.d.ts +10 -0
- package/dist/standard/index.d.ts.map +1 -0
- package/dist/standard/index.js +14 -0
- package/dist/standard/index.js.map +1 -0
- package/dist/standard/mount.d.ts +94 -0
- package/dist/standard/mount.d.ts.map +1 -0
- package/dist/standard/mount.js +186 -0
- package/dist/standard/mount.js.map +1 -0
- package/dist/standard/server.d.ts +130 -0
- package/dist/standard/server.d.ts.map +1 -0
- package/dist/standard/server.js +497 -0
- package/dist/standard/server.js.map +1 -0
- package/dist/standard/types.d.ts +186 -0
- package/dist/standard/types.d.ts.map +1 -0
- package/dist/standard/types.js +14 -0
- package/dist/standard/types.js.map +1 -0
- package/dist/subject-ask.d.ts +96 -0
- package/dist/subject-ask.d.ts.map +1 -0
- package/dist/subject-ask.js +45 -0
- package/dist/subject-ask.js.map +1 -0
- package/dist/subject-hop.d.ts +117 -0
- package/dist/subject-hop.d.ts.map +1 -0
- package/dist/subject-hop.js +187 -0
- package/dist/subject-hop.js.map +1 -0
- package/dist/task-store.d.ts +9 -3
- package/dist/task-store.d.ts.map +1 -1
- package/dist/task-store.js +12 -6
- package/dist/task-store.js.map +1 -1
- package/dist/wire-verify.d.ts +35 -0
- package/dist/wire-verify.d.ts.map +1 -0
- package/dist/wire-verify.js +51 -0
- package/dist/wire-verify.js.map +1 -0
- package/package.json +35 -12
- package/dist/jsonrpc.d.ts +0 -25
- package/dist/jsonrpc.d.ts.map +0 -1
- package/dist/jsonrpc.js +0 -52
- package/dist/jsonrpc.js.map +0 -1
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
// THE RUNTIME AS ITS OWN CALLER — spec 372 S3c.
|
|
2
|
+
//
|
|
3
|
+
// A person reaches the standard surface with a Home session bearer. An outside runtime — Claude Code, Goose,
|
|
4
|
+
// a deploy bot — has no Home session and must never be given one: it is not a person, and a bearer minted for
|
|
5
|
+
// a person is exactly the credential-sharing this estate exists to avoid. What it holds instead is what every
|
|
6
|
+
// agent here holds: a SESSION WIRE (spec 350 §8) — a narrow delegation from its own Smart Agent to a key it
|
|
7
|
+
// controls, timestamp-bounded, pinning the one skill it may exercise, signed by the agent's custody credential
|
|
8
|
+
// and revocable on chain by that custodian at any moment.
|
|
9
|
+
//
|
|
10
|
+
// So the runtime signs each request with that key and presents the wire beside it. The server verifies, per
|
|
11
|
+
// request and fail-closed: the wire's delegator IS the agent claimed; the wire's shape is sound (bounded,
|
|
12
|
+
// pinned, never the any-skill sentinel); the raw signature recovers to the wire's delegate; the wire itself
|
|
13
|
+
// verifies against the delegator on chain (ERC-1271) and is NOT revoked. Revoking the wire kills the caller
|
|
14
|
+
// at the next request, everywhere, with no list to update.
|
|
15
|
+
//
|
|
16
|
+
// TWO SCHEMES, NOT A FALLBACK (ADR-0013). `Bearer` is a person's Home session; `A2A-Session` is an agent's
|
|
17
|
+
// wire. The scheme token in the header selects ONE mechanism, and it fails closed on its own terms — neither
|
|
18
|
+
// is ever tried after the other fails. Which one arrived says WHO is asking. Neither says what they may do.
|
|
19
|
+
import { keccak256, toBytes } from 'viem';
|
|
20
|
+
import { parseSessionWrappedSignature, verifySessionWrappedSignature, wrapSessionSignature } from '../session-wire.js';
|
|
21
|
+
/** The Authorization scheme an agent presents its session wire under. */
|
|
22
|
+
export const SESSION_AUTH_SCHEME = 'A2A-Session';
|
|
23
|
+
/** The skill a session wire must pin to reach the standard surface: asking this agent, and nothing else.
|
|
24
|
+
* A wire that names other selectors and not this one is refused — pinning is the point. */
|
|
25
|
+
export const STANDARD_SURFACE_SKILL = 'harness.ask';
|
|
26
|
+
/** The digest a caller signs — keccak over stable JSON, the a2a body-hash convention. */
|
|
27
|
+
export function callerAssertionDigest(a) {
|
|
28
|
+
return keccak256(toBytes(JSON.stringify({
|
|
29
|
+
v: 'ap.a2a.caller-assertion.v1',
|
|
30
|
+
agent: a.agent.toLowerCase(),
|
|
31
|
+
method: a.method,
|
|
32
|
+
bodyHash: a.bodyHash.toLowerCase(),
|
|
33
|
+
issuedAt: a.issuedAt,
|
|
34
|
+
audience: a.audience.replace(/\/$/, '').toLowerCase(),
|
|
35
|
+
})));
|
|
36
|
+
}
|
|
37
|
+
/** keccak over the raw request body, exactly as it arrived — never over a re-serialized parse. */
|
|
38
|
+
export const requestBodyHash = (raw) => keccak256(toBytes(raw));
|
|
39
|
+
const b64urlDecode = (s) => {
|
|
40
|
+
const padded = s.replace(/-/g, '+').replace(/_/g, '/') + '='.repeat((4 - (s.length % 4)) % 4);
|
|
41
|
+
return atob(padded);
|
|
42
|
+
};
|
|
43
|
+
const b64urlEncode = (s) => btoa(s).replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, '');
|
|
44
|
+
/** Build the `Authorization` header value a runtime sends. */
|
|
45
|
+
export function sessionAuthorizationHeader(a) {
|
|
46
|
+
return `${SESSION_AUTH_SCHEME} ${b64urlEncode(JSON.stringify(a))}`;
|
|
47
|
+
}
|
|
48
|
+
/** Read an `A2A-Session` header. Returns null for any other scheme (a `Bearer` is a person's, not ours) and
|
|
49
|
+
* for anything malformed — never a partial assertion. */
|
|
50
|
+
export function parseSessionAuthorization(header) {
|
|
51
|
+
const m = new RegExp(`^${SESSION_AUTH_SCHEME}\\s+(.+)$`, 'i').exec((header ?? '').trim());
|
|
52
|
+
if (!m)
|
|
53
|
+
return null;
|
|
54
|
+
try {
|
|
55
|
+
const a = JSON.parse(b64urlDecode(m[1].trim()));
|
|
56
|
+
if (typeof a.agent !== 'string' || !/^0x[0-9a-fA-F]{40}$/.test(a.agent))
|
|
57
|
+
return null;
|
|
58
|
+
if (typeof a.method !== 'string' || !a.method)
|
|
59
|
+
return null;
|
|
60
|
+
if (typeof a.bodyHash !== 'string' || !/^0x[0-9a-fA-F]{64}$/.test(a.bodyHash))
|
|
61
|
+
return null;
|
|
62
|
+
if (typeof a.issuedAt !== 'number' || !Number.isFinite(a.issuedAt))
|
|
63
|
+
return null;
|
|
64
|
+
if (typeof a.audience !== 'string' || !a.audience)
|
|
65
|
+
return null;
|
|
66
|
+
if (typeof a.signature !== 'string' || !a.signature.startsWith('0x'))
|
|
67
|
+
return null;
|
|
68
|
+
return a;
|
|
69
|
+
}
|
|
70
|
+
catch {
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* The `principal` implementation for agents. Returns `{ agent, kind: 'agent' }` on every leg passing, and
|
|
76
|
+
* `null` otherwise — the server answers 401 and no method runs.
|
|
77
|
+
*
|
|
78
|
+
* SINGLE-USE. An accepted assertion's digest is SPENT: a captured request cannot be replayed while it is
|
|
79
|
+
* still fresh. With `claim` bound to the estate's single writer this holds everywhere; without it, only
|
|
80
|
+
* within this isolate — which on a fanned-out edge is no protection at all, and was observed live before
|
|
81
|
+
* the ledger existed. The claim happens AFTER the signature verifies, so an unauthenticated caller can
|
|
82
|
+
* spend nothing and write nothing.
|
|
83
|
+
*/
|
|
84
|
+
export function sessionWirePrincipal(deps) {
|
|
85
|
+
const maxAgeSec = deps.maxAgeSec ?? 120;
|
|
86
|
+
const skewSec = deps.skewSec ?? 30;
|
|
87
|
+
const now = deps.now ?? (() => Date.now());
|
|
88
|
+
const seen = new Map();
|
|
89
|
+
const refuse = (reason, agent) => { deps.onRefused?.(reason, agent); return null; };
|
|
90
|
+
return async (request) => {
|
|
91
|
+
const a = parseSessionAuthorization(request.headers.get('authorization'));
|
|
92
|
+
if (!a)
|
|
93
|
+
return null; // not our scheme — say nothing; another principal may own it
|
|
94
|
+
const nowSec = Math.floor(now() / 1000);
|
|
95
|
+
if (a.issuedAt > nowSec + skewSec)
|
|
96
|
+
return refuse('assertion is dated ahead', a.agent);
|
|
97
|
+
if (a.issuedAt < nowSec - maxAgeSec)
|
|
98
|
+
return refuse('assertion is stale', a.agent);
|
|
99
|
+
const audience = new URL(request.url).origin;
|
|
100
|
+
if (a.audience.replace(/\/$/, '').toLowerCase() !== audience.toLowerCase())
|
|
101
|
+
return refuse(`assertion is for ${a.audience}, not ${audience}`, a.agent);
|
|
102
|
+
let raw;
|
|
103
|
+
try {
|
|
104
|
+
raw = await request.clone().text();
|
|
105
|
+
}
|
|
106
|
+
catch {
|
|
107
|
+
return refuse('request body unreadable', a.agent);
|
|
108
|
+
}
|
|
109
|
+
if (requestBodyHash(raw).toLowerCase() !== a.bodyHash.toLowerCase())
|
|
110
|
+
return refuse('assertion does not bind this body', a.agent);
|
|
111
|
+
let method;
|
|
112
|
+
try {
|
|
113
|
+
method = JSON.parse(raw).method;
|
|
114
|
+
}
|
|
115
|
+
catch {
|
|
116
|
+
return refuse('body is not JSON', a.agent);
|
|
117
|
+
}
|
|
118
|
+
if (method !== a.method)
|
|
119
|
+
return refuse(`assertion is for ${a.method}, body calls ${String(method)}`, a.agent);
|
|
120
|
+
const digest = callerAssertionDigest(a);
|
|
121
|
+
// A cheap local reject first, so a replay landing on the isolate that served the original costs no
|
|
122
|
+
// chain read; the authoritative claim is below, after the signature verifies.
|
|
123
|
+
for (const [k, at] of seen)
|
|
124
|
+
if (at < nowSec - maxAgeSec - skewSec)
|
|
125
|
+
seen.delete(k);
|
|
126
|
+
if (seen.has(digest))
|
|
127
|
+
return refuse('assertion already used', a.agent);
|
|
128
|
+
const skill = typeof deps.skill === 'function' ? deps.skill(a.method) : (deps.skill ?? STANDARD_SURFACE_SKILL);
|
|
129
|
+
if (!skill)
|
|
130
|
+
return refuse(`no wire admits the method ${a.method} here`, a.agent);
|
|
131
|
+
const wrapped = parseSessionWrappedSignature(a.signature) !== null;
|
|
132
|
+
const ok = wrapped
|
|
133
|
+
? await verifySessionWrappedSignature({
|
|
134
|
+
signer: a.agent.toLowerCase(),
|
|
135
|
+
digest,
|
|
136
|
+
signature: a.signature,
|
|
137
|
+
enforcers: deps.enforcers,
|
|
138
|
+
verifyDelegationSig: deps.verifyDelegationSig,
|
|
139
|
+
isRevoked: deps.isRevoked,
|
|
140
|
+
skill,
|
|
141
|
+
now: now(),
|
|
142
|
+
}).catch(() => false)
|
|
143
|
+
: deps.verifyAgentSignature
|
|
144
|
+
? await deps.verifyAgentSignature(a.agent.toLowerCase(), digest, a.signature).catch(() => false)
|
|
145
|
+
: false;
|
|
146
|
+
if (!ok) {
|
|
147
|
+
return refuse(wrapped
|
|
148
|
+
? 'session wire did not verify (shape, signature, delegator or revocation)'
|
|
149
|
+
: deps.verifyAgentSignature ? 'the agent\'s own signature did not verify' : 'a direct agent signature is not admitted here', a.agent);
|
|
150
|
+
}
|
|
151
|
+
// SPENT, now that it is known to be genuine: the single writer decides who was first. A ledger that
|
|
152
|
+
// cannot be reached refuses the call — a replay window is not something to fail open into (ADR-0013).
|
|
153
|
+
if (deps.claim) {
|
|
154
|
+
const claimed = await deps.claim(digest, (a.issuedAt + maxAgeSec + skewSec) * 1000).catch(() => false);
|
|
155
|
+
if (!claimed)
|
|
156
|
+
return refuse('assertion already used', a.agent);
|
|
157
|
+
}
|
|
158
|
+
seen.set(digest, nowSec);
|
|
159
|
+
return { agent: a.agent.toLowerCase(), kind: 'agent' };
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
/** THE CLIENT HALF — what a runtime holds to speak as itself: its agent, its session wire, and a signer over the
|
|
163
|
+
* runtime's OWN key (a port: the private key never enters this package). Returns the per-request header builder
|
|
164
|
+
* `createStandardA2aClient({ signRequest })` takes; each request's assertion binds the method, the body hash, the
|
|
165
|
+
* audience and the moment, and is spent once at the addressed agent (S3c). The same code path the S3c gate drove. */
|
|
166
|
+
export function sessionWireSigner(o) {
|
|
167
|
+
return async (raw, method) => {
|
|
168
|
+
const base = {
|
|
169
|
+
agent: o.agent.toLowerCase(), method, bodyHash: requestBodyHash(raw),
|
|
170
|
+
issuedAt: Math.floor((o.now ?? Date.now)() / 1000), audience: o.audience,
|
|
171
|
+
};
|
|
172
|
+
const sig = await o.signDigest(callerAssertionDigest(base));
|
|
173
|
+
return { authorization: sessionAuthorizationHeader({ ...base, signature: wrapSessionSignature(o.wire, sig) }) };
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
//# sourceMappingURL=caller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"caller.js","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;QACzB,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,WAAW,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;IACzD,CAAC,CAAC;AACJ,CAAC;AAKD;;;sHAGsH;AACtH,MAAM,UAAU,iBAAiB,CAAC,CAQjC;IACC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE;QAC3B,MAAM,IAAI,GAAyC;YACjD,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,WAAW,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,eAAe,CAAC,GAAG,CAAC;YACpE,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,IAAI,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,QAAQ;SACzE,CAAC;QACF,MAAM,GAAG,GAAG,MAAM,CAAC,CAAC,UAAU,CAAC,qBAAqB,CAAC,IAAI,CAAC,CAAC,CAAC;QAC5D,OAAO,EAAE,aAAa,EAAE,0BAA0B,CAAC,EAAE,GAAG,IAAI,EAAE,SAAS,EAAE,oBAAoB,CAAC,CAAC,CAAC,IAAa,EAAE,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC;IAC3H,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { AgentCardV1, MessageV1, PartV1, TaskV1 } from './types.js';
|
|
2
|
+
export interface ResolvedAgentCard {
|
|
3
|
+
card: AgentCardV1;
|
|
4
|
+
/** SHA-256 over the card's bytes as served, hex — what a record pins and a later fetch is compared to. */
|
|
5
|
+
cardDigest: string;
|
|
6
|
+
/** The JSON-RPC 1.x interface the card publishes. */
|
|
7
|
+
endpoint: string;
|
|
8
|
+
cardUrl: string;
|
|
9
|
+
}
|
|
10
|
+
/** The A2A 1.0 JSON-RPC endpoint a card publishes (top-level `protocolVersion` covers a released card's interfaces). */
|
|
11
|
+
export declare function jsonRpcEndpointOf(card: AgentCardV1 & {
|
|
12
|
+
protocolVersion?: string;
|
|
13
|
+
}): string | null;
|
|
14
|
+
/** Fetch a card, digest its bytes, read its endpoint. A card without a 1.x JSON-RPC interface is refused. */
|
|
15
|
+
export declare function resolveAgentCard(cardUrl: string, fetchImpl?: typeof fetch, expectDigest?: string): Promise<ResolvedAgentCard>;
|
|
16
|
+
export interface StandardA2aClientOptions {
|
|
17
|
+
endpoint: string;
|
|
18
|
+
fetch?: typeof fetch;
|
|
19
|
+
/** Extra headers on every call — a bearer, a session wire. Never a mandate. */
|
|
20
|
+
headers?: Record<string, string>;
|
|
21
|
+
/** Headers computed PER REQUEST from the raw body — the runtime's `A2A-Session` assertion (`sessionWireSigner`),
|
|
22
|
+
* which binds the method, the body hash, the audience and the moment. Static `headers` cannot express that. */
|
|
23
|
+
signRequest?: (raw: string, method: string) => Promise<Record<string, string>>;
|
|
24
|
+
}
|
|
25
|
+
export interface SendResult {
|
|
26
|
+
task?: TaskV1;
|
|
27
|
+
message?: MessageV1;
|
|
28
|
+
}
|
|
29
|
+
export interface StandardA2aClient {
|
|
30
|
+
sendMessage(parts: PartV1[], opts?: {
|
|
31
|
+
metadata?: Record<string, unknown>;
|
|
32
|
+
extensions?: string[];
|
|
33
|
+
contextId?: string;
|
|
34
|
+
taskId?: string;
|
|
35
|
+
}): Promise<SendResult>;
|
|
36
|
+
getTask(id: string): Promise<TaskV1>;
|
|
37
|
+
/** Poll until the task is terminal or the deadline passes; the last task seen is returned either way. */
|
|
38
|
+
awaitTask(id: string, opts?: {
|
|
39
|
+
timeoutMs?: number;
|
|
40
|
+
everyMs?: number;
|
|
41
|
+
}): Promise<TaskV1>;
|
|
42
|
+
/** Send one text message and wait: the reply's text (status message + text artifacts) and the task. */
|
|
43
|
+
ask(text: string, opts?: {
|
|
44
|
+
metadata?: Record<string, unknown>;
|
|
45
|
+
timeoutMs?: number;
|
|
46
|
+
}): Promise<{
|
|
47
|
+
text: string;
|
|
48
|
+
task?: TaskV1;
|
|
49
|
+
message?: MessageV1;
|
|
50
|
+
}>;
|
|
51
|
+
}
|
|
52
|
+
export declare function createStandardA2aClient(o: StandardA2aClientOptions): StandardA2aClient;
|
|
53
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/standard/client.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAmB,MAAM,YAAY,CAAC;AAG1F,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,WAAW,CAAC;IAClB,0GAA0G;IAC1G,UAAU,EAAE,MAAM,CAAC;IACnB,qDAAqD;IACrD,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB;AAOD,wHAAwH;AACxH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,WAAW,GAAG;IAAE,eAAe,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,GAAG,IAAI,CAIjG;AAED,6GAA6G;AAC7G,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,GAAE,OAAO,KAAa,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAY1I;AAED,MAAM,WAAW,wBAAwB;IACvC,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;IACrB,+EAA+E;IAC/E,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC;oHACgH;IAChH,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CAChF;AAED,MAAM,WAAW,UAAU;IAAG,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,SAAS,CAAA;CAAE;AAIlE,MAAM,WAAW,iBAAiB;IAChC,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,IAAI,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAC7J,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACrC,yGAAyG;IACzG,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACxF,uGAAuG;IACvG,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,SAAS,CAAA;KAAE,CAAC,CAAC;CACrJ;AAED,wBAAgB,uBAAuB,CAAC,CAAC,EAAE,wBAAwB,GAAG,iBAAiB,CA4CtF"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { TERMINAL_STATES } from './types.js';
|
|
2
|
+
async function sha256Hex(text) {
|
|
3
|
+
const buf = await crypto.subtle.digest('SHA-256', new TextEncoder().encode(text));
|
|
4
|
+
return `0x${[...new Uint8Array(buf)].map((b) => b.toString(16).padStart(2, '0')).join('')}`;
|
|
5
|
+
}
|
|
6
|
+
/** The A2A 1.0 JSON-RPC endpoint a card publishes (top-level `protocolVersion` covers a released card's interfaces). */
|
|
7
|
+
export function jsonRpcEndpointOf(card) {
|
|
8
|
+
const top = /^1\./.test(String(card.protocolVersion ?? ''));
|
|
9
|
+
const hit = (card.supportedInterfaces ?? []).find((i) => i.protocolBinding === 'JSONRPC' && (/^1\./.test(String(i.protocolVersion ?? '')) || (i.protocolVersion === undefined && top)) && /^https:\/\//.test(String(i.url ?? '')));
|
|
10
|
+
return hit?.url ?? null;
|
|
11
|
+
}
|
|
12
|
+
/** Fetch a card, digest its bytes, read its endpoint. A card without a 1.x JSON-RPC interface is refused. */
|
|
13
|
+
export async function resolveAgentCard(cardUrl, fetchImpl = fetch, expectDigest) {
|
|
14
|
+
if (!/^https:\/\//.test(cardUrl))
|
|
15
|
+
throw new Error('an agent card is fetched over https only');
|
|
16
|
+
const res = await fetchImpl(cardUrl, { headers: { accept: 'application/json' } });
|
|
17
|
+
if (!res.ok)
|
|
18
|
+
throw new Error(`the card at ${cardUrl} answered ${res.status}`);
|
|
19
|
+
const text = await res.text();
|
|
20
|
+
let card;
|
|
21
|
+
try {
|
|
22
|
+
card = JSON.parse(text);
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
throw new Error(`the card at ${cardUrl} is not JSON`);
|
|
26
|
+
}
|
|
27
|
+
const cardDigest = await sha256Hex(text);
|
|
28
|
+
if (expectDigest && expectDigest.toLowerCase() !== cardDigest.toLowerCase())
|
|
29
|
+
throw new Error(`the card at ${cardUrl} is not the one pinned (${expectDigest.slice(0, 14)}… expected, ${cardDigest.slice(0, 14)}… served)`);
|
|
30
|
+
const endpoint = jsonRpcEndpointOf(card);
|
|
31
|
+
if (!endpoint)
|
|
32
|
+
throw new Error(`${card.name ?? cardUrl} publishes no A2A 1.x JSON-RPC interface`);
|
|
33
|
+
return { card, cardDigest, endpoint, cardUrl };
|
|
34
|
+
}
|
|
35
|
+
const hex32 = () => `0x${[...crypto.getRandomValues(new Uint8Array(32))].map((b) => b.toString(16).padStart(2, '0')).join('')}`;
|
|
36
|
+
export function createStandardA2aClient(o) {
|
|
37
|
+
const fetchImpl = o.fetch ?? fetch;
|
|
38
|
+
let seq = 0;
|
|
39
|
+
const rpc = async (method, params) => {
|
|
40
|
+
const raw = JSON.stringify({ jsonrpc: '2.0', id: ++seq, method, params });
|
|
41
|
+
const signed = o.signRequest ? await o.signRequest(raw, method) : {};
|
|
42
|
+
const res = await fetchImpl(o.endpoint, { method: 'POST', headers: { 'content-type': 'application/json', accept: 'application/json', 'a2a-version': '1.0', ...(o.headers ?? {}), ...signed }, body: raw });
|
|
43
|
+
const body = (await res.json().catch(() => null));
|
|
44
|
+
if (!body)
|
|
45
|
+
throw new Error(`${o.endpoint} answered ${res.status} with no JSON-RPC body`);
|
|
46
|
+
if ('error' in body)
|
|
47
|
+
throw new Error(`${o.endpoint} ${method}: ${body.error.code} ${body.error.message}`);
|
|
48
|
+
return body.result;
|
|
49
|
+
};
|
|
50
|
+
const textOf = (t, m) => {
|
|
51
|
+
const parts = [];
|
|
52
|
+
const take = (ps) => { for (const p of ps ?? [])
|
|
53
|
+
if (typeof p.text === 'string' && p.text.trim())
|
|
54
|
+
parts.push(p.text.trim()); };
|
|
55
|
+
take(m?.parts);
|
|
56
|
+
take(t?.status?.message?.parts);
|
|
57
|
+
for (const a of t?.artifacts ?? [])
|
|
58
|
+
take(a.parts);
|
|
59
|
+
return parts.join('\n');
|
|
60
|
+
};
|
|
61
|
+
const client = {
|
|
62
|
+
async sendMessage(parts, opts) {
|
|
63
|
+
const message = { messageId: hex32(), role: 'ROLE_USER', parts, ...(opts?.contextId ? { contextId: opts.contextId } : {}), ...(opts?.taskId ? { taskId: opts.taskId } : {}), ...(opts?.extensions ? { extensions: opts.extensions } : {}), ...(opts?.metadata ? { metadata: opts.metadata } : {}) };
|
|
64
|
+
return rpc('SendMessage', { message });
|
|
65
|
+
},
|
|
66
|
+
async getTask(id) { return rpc('GetTask', { id }); },
|
|
67
|
+
async awaitTask(id, opts) {
|
|
68
|
+
const deadline = Date.now() + (opts?.timeoutMs ?? 20_000);
|
|
69
|
+
let last = await client.getTask(id);
|
|
70
|
+
while (!TERMINAL_STATES.has(last.status.state) && last.status.state !== 'TASK_STATE_INPUT_REQUIRED' && last.status.state !== 'TASK_STATE_AUTH_REQUIRED' && Date.now() < deadline) {
|
|
71
|
+
await new Promise((r) => setTimeout(r, opts?.everyMs ?? 500));
|
|
72
|
+
last = await client.getTask(id);
|
|
73
|
+
}
|
|
74
|
+
return last;
|
|
75
|
+
},
|
|
76
|
+
async ask(text, opts) {
|
|
77
|
+
const sent = await client.sendMessage([{ text }], opts?.metadata ? { metadata: opts.metadata } : undefined);
|
|
78
|
+
if (sent.message)
|
|
79
|
+
return { text: textOf(undefined, sent.message), message: sent.message };
|
|
80
|
+
if (!sent.task)
|
|
81
|
+
throw new Error('the agent answered with neither a task nor a message');
|
|
82
|
+
const task = TERMINAL_STATES.has(sent.task.status.state) ? sent.task : await client.awaitTask(sent.task.id, { timeoutMs: opts?.timeoutMs });
|
|
83
|
+
return { text: textOf(task), task };
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
return client;
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/standard/client.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAW7C,KAAK,UAAU,SAAS,CAAC,IAAY;IACnC,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;IAClF,OAAO,KAAK,CAAC,GAAG,IAAI,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CA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AAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;YAC5G,IAAI,IAAI,CAAC,OAAO;gBAAE,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC,SAAS,EAAE,IAAI,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC;YAC1F,IAAI,CAAC,IAAI,CAAC,IAAI;gBAAE,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;YACxF,MAAM,IAAI,GAAG,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC;YAC5I,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC;QACtC,CAAC;KACF,CAAC;IACF,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import type { Hex } from 'viem';
|
|
2
|
+
import type { TaskState } from '@agenticprimitives/fulfillment';
|
|
3
|
+
import type { DelegationWireV1 } from '../session-wire.js';
|
|
4
|
+
import type { MessageV1, PartV1, TaskV1, TaskStateV1 } from './types.js';
|
|
5
|
+
export declare const AP_DELEGATED_TASK_EXTENSION = "https://agenticprimitives.org/a2a/delegated-task/v1";
|
|
6
|
+
/** What a `SendMessage` carries to create a delegation-authorized task. Rides in
|
|
7
|
+
* `message.metadata[AP_DELEGATED_TASK_EXTENSION]`, with the URI also listed in `message.extensions`. */
|
|
8
|
+
export interface DelegatedTaskV1 {
|
|
9
|
+
extension: typeof AP_DELEGATED_TASK_EXTENSION;
|
|
10
|
+
version: 1;
|
|
11
|
+
/** The grant that authorizes this task. Its delegate is the party the runtime checks against `requester`. */
|
|
12
|
+
delegation: DelegationWireV1;
|
|
13
|
+
/** The party the delegation was issued to — the principal's delegate, on whose behalf the task runs. */
|
|
14
|
+
requester: string;
|
|
15
|
+
/** The skill the receiving agent should run. Unknown ⇒ the task is rejected, as before. */
|
|
16
|
+
skill: string;
|
|
17
|
+
/** The SA that authored this message (signs the envelope). */
|
|
18
|
+
sender: string;
|
|
19
|
+
/** keccak over the input body — signed, and what binds `message.parts` to the signature. */
|
|
20
|
+
bodyHash: Hex;
|
|
21
|
+
/** Where the body will live in the assignee's vault. A placeholder the runtime overwrites with where it
|
|
22
|
+
* actually landed; not signed, because `bodyHash` is what binds the content. */
|
|
23
|
+
bodyRef: {
|
|
24
|
+
owner: string;
|
|
25
|
+
recordType: string;
|
|
26
|
+
};
|
|
27
|
+
/** The sender's signature over `hashA2aMessage(envelope)` — re-derived and re-checked by the runtime. */
|
|
28
|
+
signature: Hex;
|
|
29
|
+
/** Seconds since the epoch, as the sender wrote it into the signed envelope. */
|
|
30
|
+
createdAt: number;
|
|
31
|
+
/** An existing task to resubmit against (the auth-required loop): a fresh grant for a parked task. */
|
|
32
|
+
taskId?: Hex;
|
|
33
|
+
}
|
|
34
|
+
/** The exact envelope the runtime verifies — rebuilt from the 1.0 message plus the extension, so
|
|
35
|
+
* `hashA2aMessage` over it is byte-for-byte what the sender signed. */
|
|
36
|
+
export interface ProfileMessageV1 {
|
|
37
|
+
messageId: string;
|
|
38
|
+
threadId?: string;
|
|
39
|
+
sender: string;
|
|
40
|
+
skill: string;
|
|
41
|
+
bodyRef: {
|
|
42
|
+
owner: string;
|
|
43
|
+
recordType: string;
|
|
44
|
+
};
|
|
45
|
+
bodyHash: Hex;
|
|
46
|
+
signature: Hex;
|
|
47
|
+
createdAt: number;
|
|
48
|
+
}
|
|
49
|
+
/** Rebuild the signed envelope from what arrived on the 1.0 wire. */
|
|
50
|
+
export declare function toProfileMessage(message: MessageV1, ext: DelegatedTaskV1): ProfileMessageV1;
|
|
51
|
+
/** The declaration a card makes so a peer learns this agent takes delegated tasks before calling. */
|
|
52
|
+
export declare const DELEGATED_TASK_CARD_EXTENSION: {
|
|
53
|
+
readonly uri: "https://agenticprimitives.org/a2a/delegated-task/v1";
|
|
54
|
+
readonly required: false;
|
|
55
|
+
readonly description: "A task authorized by an ERC-7710 delegation carried on the message; the caller is authenticated by the Authorization header and must be the delegation's delegate. Adds the method GetTaskArtifact { id, artifactId } — a party reads an artifact BODY, which the task projection carries only as a ref and a hash (A2A-INV-04).";
|
|
56
|
+
};
|
|
57
|
+
/** The extension's one method beyond the core set: the artifact-body read a party is entitled to. */
|
|
58
|
+
export declare const GET_TASK_ARTIFACT_METHOD: "GetTaskArtifact";
|
|
59
|
+
/**
|
|
60
|
+
* Read the extension off a message. `null` when the message does not declare it — that is an ordinary
|
|
61
|
+
* conversational message, not an error. A message that DECLARES it and carries a malformed body is an
|
|
62
|
+
* error, and says which field: silently treating it as conversational would run the wrong executor under
|
|
63
|
+
* an authority the sender believed they had presented.
|
|
64
|
+
*/
|
|
65
|
+
export declare function readDelegatedTask(message: MessageV1 | null | undefined): DelegatedTaskV1 | {
|
|
66
|
+
error: string;
|
|
67
|
+
} | null;
|
|
68
|
+
/** Attach the extension to a message a client is about to send. */
|
|
69
|
+
export declare function withDelegatedTask(message: MessageV1, req: Omit<DelegatedTaskV1, 'extension' | 'version'>): MessageV1;
|
|
70
|
+
/** The input body a delegated task carries: one data part, so the raw body hash the caller signed binds it. */
|
|
71
|
+
export declare const delegatedInputPart: (input: unknown) => PartV1;
|
|
72
|
+
/** Read the input back off a delegated message. */
|
|
73
|
+
export declare function delegatedInput(message: MessageV1): unknown;
|
|
74
|
+
/** The profile's task states are the 1.0 states under other names — one for one, no remainder. */
|
|
75
|
+
export declare const TASK_STATE_V1: Readonly<Record<TaskState, TaskStateV1>>;
|
|
76
|
+
/** The runtime's name for a 1.0 state. `TASK_STATE_UNSPECIFIED` has no runtime name and is a `failed`
|
|
77
|
+
* reading — a task in no state is not a task anyone should act on. */
|
|
78
|
+
export declare function taskStateFromV1(state: TaskStateV1 | string): TaskState;
|
|
79
|
+
/** What the projection needs from the runtime's record — structural, so this file imports no runtime. */
|
|
80
|
+
export interface DelegatedTaskSourceV1 {
|
|
81
|
+
task: {
|
|
82
|
+
taskId: string;
|
|
83
|
+
state: TaskState;
|
|
84
|
+
assignee: string;
|
|
85
|
+
permissionGrantRef?: string;
|
|
86
|
+
};
|
|
87
|
+
principal: string;
|
|
88
|
+
sender: string;
|
|
89
|
+
skill: string;
|
|
90
|
+
inbound?: Array<{
|
|
91
|
+
messageId: string;
|
|
92
|
+
sender: string;
|
|
93
|
+
threadId?: string;
|
|
94
|
+
createdAt?: number;
|
|
95
|
+
bodyRef?: unknown;
|
|
96
|
+
bodyHash?: string;
|
|
97
|
+
}>;
|
|
98
|
+
artifacts?: Array<{
|
|
99
|
+
artifactId: string;
|
|
100
|
+
artifactKind?: string;
|
|
101
|
+
bodyRef?: unknown;
|
|
102
|
+
bodyHash?: string;
|
|
103
|
+
}>;
|
|
104
|
+
error?: string;
|
|
105
|
+
rev?: number;
|
|
106
|
+
updatedAt?: number;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Project a delegation-authorized task into the A2A 1.0 shape a client reads.
|
|
110
|
+
*
|
|
111
|
+
* BODIES DO NOT COME ALONG (A2A-INV-04). A message body and an artifact body live in the assignee's vault;
|
|
112
|
+
* what travels is the REF and the hash, in `metadata`, exactly as the profile's `tasks/get` returned refs
|
|
113
|
+
* only. A party reads a body with the artifact op it was already entitled to use — the projection widens
|
|
114
|
+
* nothing, and inlining here would have quietly turned a ref into a disclosure.
|
|
115
|
+
*/
|
|
116
|
+
export declare function delegatedTaskAsV1(src: DelegatedTaskSourceV1): TaskV1;
|
|
117
|
+
/** The parties to a delegated task: its sender, the principal they act for, and the assignee. A `GetTask`
|
|
118
|
+
* or `CancelTask` from anyone else is answered as though the task did not exist — telling a stranger that
|
|
119
|
+
* it does is itself a disclosure (the profile's own rule, kept). */
|
|
120
|
+
export declare function isPartyToDelegatedTask(task: TaskV1, agent: string | null | undefined): boolean;
|
|
121
|
+
//# sourceMappingURL=delegated.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delegated.d.ts","sourceRoot":"","sources":["../../src/standard/delegated.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAChC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAc,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAErF,eAAO,MAAM,2BAA2B,wDAAwD,CAAC;AAEjG;yGACyG;AACzG,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,OAAO,2BAA2B,CAAC;IAC9C,OAAO,EAAE,CAAC,CAAC;IACX,6GAA6G;IAC7G,UAAU,EAAE,gBAAgB,CAAC;IAC7B,wGAAwG;IACxG,SAAS,EAAE,MAAM,CAAC;IAClB,2FAA2F;IAC3F,KAAK,EAAE,MAAM,CAAC;IACd,8DAA8D;IAC9D,MAAM,EAAE,MAAM,CAAC;IACf,4FAA4F;IAC5F,QAAQ,EAAE,GAAG,CAAC;IACd;qFACiF;IACjF,OAAO,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC;IAC/C,yGAAyG;IACzG,SAAS,EAAE,GAAG,CAAC;IACf,gFAAgF;IAChF,SAAS,EAAE,MAAM,CAAC;IAClB,sGAAsG;IACtG,MAAM,CAAC,EAAE,GAAG,CAAC;CACd;AAED;wEACwE;AACxE,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,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