@agenticprimitives/a2a 0.0.0-alpha.19 → 0.0.0-alpha.20

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 (91) hide show
  1. package/CLAUDE.md +42 -38
  2. package/bin/a2a-conform.mjs +17 -0
  3. package/dist/agent.d.ts +9 -0
  4. package/dist/agent.d.ts.map +1 -1
  5. package/dist/agent.js +25 -8
  6. package/dist/agent.js.map +1 -1
  7. package/dist/client.d.ts +20 -11
  8. package/dist/client.d.ts.map +1 -1
  9. package/dist/client.js +69 -17
  10. package/dist/client.js.map +1 -1
  11. package/dist/conform/index.d.ts +36 -0
  12. package/dist/conform/index.d.ts.map +1 -0
  13. package/dist/conform/index.js +232 -0
  14. package/dist/conform/index.js.map +1 -0
  15. package/dist/discovery.d.ts +4 -0
  16. package/dist/discovery.d.ts.map +1 -1
  17. package/dist/discovery.js +6 -2
  18. package/dist/discovery.js.map +1 -1
  19. package/dist/engagement.d.ts +37 -0
  20. package/dist/engagement.d.ts.map +1 -0
  21. package/dist/engagement.js +83 -0
  22. package/dist/engagement.js.map +1 -0
  23. package/dist/handoff.d.ts +42 -0
  24. package/dist/handoff.d.ts.map +1 -0
  25. package/dist/handoff.js +28 -0
  26. package/dist/handoff.js.map +1 -0
  27. package/dist/index.d.ts +14 -3
  28. package/dist/index.d.ts.map +1 -1
  29. package/dist/index.js +13 -2
  30. package/dist/index.js.map +1 -1
  31. package/dist/session-wire.d.ts +69 -0
  32. package/dist/session-wire.d.ts.map +1 -0
  33. package/dist/session-wire.js +170 -0
  34. package/dist/session-wire.js.map +1 -0
  35. package/dist/standard/caller.d.ts +86 -0
  36. package/dist/standard/caller.d.ts.map +1 -0
  37. package/dist/standard/caller.js +159 -0
  38. package/dist/standard/caller.js.map +1 -0
  39. package/dist/standard/client.d.ts +50 -0
  40. package/dist/standard/client.d.ts.map +1 -0
  41. package/dist/standard/client.js +86 -0
  42. package/dist/standard/client.js.map +1 -0
  43. package/dist/standard/delegated.d.ts +119 -0
  44. package/dist/standard/delegated.d.ts.map +1 -0
  45. package/dist/standard/delegated.js +168 -0
  46. package/dist/standard/delegated.js.map +1 -0
  47. package/dist/standard/errors.d.ts +31 -0
  48. package/dist/standard/errors.d.ts.map +1 -0
  49. package/dist/standard/errors.js +75 -0
  50. package/dist/standard/errors.js.map +1 -0
  51. package/dist/standard/from-agent.d.ts +38 -0
  52. package/dist/standard/from-agent.d.ts.map +1 -0
  53. package/dist/standard/from-agent.js +109 -0
  54. package/dist/standard/from-agent.js.map +1 -0
  55. package/dist/standard/index.d.ts +9 -0
  56. package/dist/standard/index.d.ts.map +1 -0
  57. package/dist/standard/index.js +13 -0
  58. package/dist/standard/index.js.map +1 -0
  59. package/dist/standard/mount.d.ts +91 -0
  60. package/dist/standard/mount.d.ts.map +1 -0
  61. package/dist/standard/mount.js +181 -0
  62. package/dist/standard/mount.js.map +1 -0
  63. package/dist/standard/server.d.ts +105 -0
  64. package/dist/standard/server.d.ts.map +1 -0
  65. package/dist/standard/server.js +454 -0
  66. package/dist/standard/server.js.map +1 -0
  67. package/dist/standard/types.d.ts +186 -0
  68. package/dist/standard/types.d.ts.map +1 -0
  69. package/dist/standard/types.js +14 -0
  70. package/dist/standard/types.js.map +1 -0
  71. package/dist/subject-ask.d.ts +96 -0
  72. package/dist/subject-ask.d.ts.map +1 -0
  73. package/dist/subject-ask.js +45 -0
  74. package/dist/subject-ask.js.map +1 -0
  75. package/dist/subject-hop.d.ts +75 -0
  76. package/dist/subject-hop.d.ts.map +1 -0
  77. package/dist/subject-hop.js +170 -0
  78. package/dist/subject-hop.js.map +1 -0
  79. package/dist/task-store.d.ts +4 -0
  80. package/dist/task-store.d.ts.map +1 -1
  81. package/dist/task-store.js +4 -0
  82. package/dist/task-store.js.map +1 -1
  83. package/dist/wire-verify.d.ts +35 -0
  84. package/dist/wire-verify.d.ts.map +1 -0
  85. package/dist/wire-verify.js +51 -0
  86. package/dist/wire-verify.js.map +1 -0
  87. package/package.json +20 -7
  88. package/dist/jsonrpc.d.ts +0 -27
  89. package/dist/jsonrpc.d.ts.map +0 -1
  90. package/dist/jsonrpc.js +0 -81
  91. package/dist/jsonrpc.js.map +0 -1
@@ -8,6 +8,10 @@ export interface TaskStore extends MessageIdReserver {
8
8
  get(taskId: Hex): Promise<TaskRecord | null>;
9
9
  /** Task ids in a non-terminal state that are due for processing (drives the alarm loop). */
10
10
  listDue(now: number): Promise<Hex[]>;
11
+ /** Every record this store holds, newest first, for enumerating tasks (spec 372 S4 — A2A 1.0's
12
+ * `ListTasks`). Optional: a store that cannot enumerate says so by omitting it, and a caller that
13
+ * needs a list must not pretend an empty one is an answer. */
14
+ list?(limit?: number): Promise<TaskRecord[]>;
11
15
  /** Single-use message-id reservation (FR-4.3 inbound replay guard); two-phase per spec 290 §3.
12
16
  * Returns `null` if already in-flight/consumed, else a reservation to commit (durable) / release. */
13
17
  reserveMessageId(messageId: Hex, ttlSec: number): Promise<MessageIdReservation | null>;
@@ -1 +1 @@
1
- {"version":3,"file":"task-store.d.ts","sourceRoot":"","sources":["../src/task-store.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAEzE,MAAM,WAAW,SAAU,SAAQ,iBAAiB;IAClD,iDAAiD;IACjD,GAAG,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACvC,8CAA8C;IAC9C,GAAG,CAAC,MAAM,EAAE,GAAG,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAAC;IAC7C,4FAA4F;IAC5F,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IACrC;0GACsG;IACtG,gBAAgB,CAAC,SAAS,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC,CAAC;CACxF;AAED;8FAC8F;AAC9F,wBAAgB,uBAAuB,IAAI,SAAS,CA6BnD"}
1
+ {"version":3,"file":"task-store.d.ts","sourceRoot":"","sources":["../src/task-store.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAEzE,MAAM,WAAW,SAAU,SAAQ,iBAAiB;IAClD,iDAAiD;IACjD,GAAG,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACvC,8CAA8C;IAC9C,GAAG,CAAC,MAAM,EAAE,GAAG,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAAC;IAC7C,4FAA4F;IAC5F,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IACrC;;mEAE+D;IAC/D,IAAI,CAAC,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC;IAC7C;0GACsG;IACtG,gBAAgB,CAAC,SAAS,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC,CAAC;CACxF;AAED;8FAC8F;AAC9F,wBAAgB,uBAAuB,IAAI,SAAS,CAiCnD"}
@@ -19,6 +19,10 @@ export function createInMemoryTaskStore() {
19
19
  async listDue() {
20
20
  return [...due];
21
21
  },
22
+ async list(limit) {
23
+ const all = [...tasks.values()].sort((a, b) => (b.updatedAt ?? 0) - (a.updatedAt ?? 0));
24
+ return limit ? all.slice(0, limit) : all;
25
+ },
22
26
  async reserveMessageId(messageId, ttlSec) {
23
27
  const key = messageId.toLowerCase();
24
28
  // A present entry means in-flight OR consumed — either way a replay (deny). Otherwise mark in-flight.
@@ -1 +1 @@
1
- {"version":3,"file":"task-store.js","sourceRoot":"","sources":["../src/task-store.ts"],"names":[],"mappings":"AAmBA;8FAC8F;AAC9F,MAAM,UAAU,uBAAuB;IACrC,MAAM,KAAK,GAAG,IAAI,GAAG,EAAsB,CAAC;IAC5C,MAAM,IAAI,GAAG,IAAI,GAAG,EAAkB,CAAC,CAAC,4BAA4B;IACpE,MAAM,GAAG,GAAG,IAAI,GAAG,EAAU,CAAC;IAC9B,OAAO;QACL,KAAK,CAAC,GAAG,CAAC,MAAM;YACd,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,EAAE,MAAM,CAAC,CAAC;YACpD,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC;YAC7C,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,KAAK,WAAW,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,KAAK,SAAS;gBAAE,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;;gBAClF,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACvB,CAAC;QACD,KAAK,CAAC,GAAG,CAAC,MAAM;YACd,OAAO,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,IAAI,IAAI,CAAC;QACjD,CAAC;QACD,KAAK,CAAC,OAAO;YACX,OAAO,CAAC,GAAG,GAAG,CAAU,CAAC;QAC3B,CAAC;QACD,KAAK,CAAC,gBAAgB,CAAC,SAAS,EAAE,MAAM;YACtC,MAAM,GAAG,GAAG,SAAS,CAAC,WAAW,EAAE,CAAC;YACpC,sGAAsG;YACtG,qGAAqG;YACrG,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;gBAAE,OAAO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AAG,GAAG,CAAU,CAAC;QAC3B,CAAC;QACD,KAAK,CAAC,IAAI,CAAC,KAAK;YACd,MAAM,GAAG,GAAG,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,IAAI,CAAC,CAAC,CAAC,CAAC;YACxF,OAAO,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;QAC3C,CAAC;QACD,KAAK,CAAC,gBAAgB,CAAC,SAAS,EAAE,MAAM;YACtC,MAAM,GAAG,GAAG,SAAS,CAAC,WAAW,EAAE,CAAC;YACpC,sGAAsG;YACtG,qGAAqG;YACrG,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;gBAAE,OAAO,IAAI,CAAC;YAC/B,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;YACtB,OAAO;gBACL,KAAK,CAAC,MAAM,KAAK,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,uCAAuC;gBAClF,KAAK,CAAC,OAAO,KAAK,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAM,0DAA0D;aACtG,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,35 @@
1
+ import { type Delegation, type EnforcerAddressMap } from '@agenticprimitives/delegation';
2
+ import type { Address, Hex } from '@agenticprimitives/types';
3
+ /** A delegation as it arrives over JSON: addresses as strings, the bigint salt as a decimal string. The
4
+ * typed `DelegationWireV1` is assignable to it; an untrusted body is checked here before it becomes one. */
5
+ export interface DelegationWireLike {
6
+ delegator: string;
7
+ delegate: string;
8
+ authority: Hex;
9
+ caveats: {
10
+ enforcer: string;
11
+ terms: Hex;
12
+ args?: Hex;
13
+ }[];
14
+ salt: string;
15
+ signature: Hex;
16
+ }
17
+ export interface WireChecks {
18
+ /** EIP-712 delegation digest. */
19
+ digest: (d: Delegation) => Hex;
20
+ /** ERC-1271 / 6492 / ECDSA against the delegator. */
21
+ erc1271: (signer: Address, digest: Hex, sig: Hex) => Promise<boolean>;
22
+ /** `DelegationManager.isRevoked`. */
23
+ isRevoked: (digest: Hex) => Promise<boolean>;
24
+ }
25
+ /** Wire → `Delegation`. Throws on a salt that is not a number; callers that must not throw catch it. */
26
+ export declare function delegationOfWire(wire: DelegationWireLike): Delegation;
27
+ export declare function verifyDelegationWire(input: {
28
+ wire: DelegationWireLike | undefined;
29
+ expectedDelegator: string;
30
+ expectedDelegate: Address;
31
+ enforcers: EnforcerAddressMap;
32
+ checks: WireChecks;
33
+ now?: number;
34
+ }): Promise<boolean>;
35
+ //# sourceMappingURL=wire-verify.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wire-verify.d.ts","sourceRoot":"","sources":["../src/wire-verify.ts"],"names":[],"mappings":"AAaA,OAAO,EAAwB,KAAK,UAAU,EAAE,KAAK,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAC/G,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,0BAA0B,CAAC;AAE7D;6GAC6G;AAC7G,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,GAAG,CAAC;IACf,OAAO,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,GAAG,CAAC;QAAC,IAAI,CAAC,EAAE,GAAG,CAAA;KAAE,EAAE,CAAC;IACxD,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,GAAG,CAAC;CAChB;AAED,MAAM,WAAW,UAAU;IACzB,iCAAiC;IACjC,MAAM,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,GAAG,CAAC;IAC/B,qDAAqD;IACrD,OAAO,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IACtE,qCAAqC;IACrC,SAAS,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;CAC9C;AAED,wGAAwG;AACxG,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,kBAAkB,GAAG,UAAU,CASrE;AAED,wBAAsB,oBAAoB,CAAC,KAAK,EAAE;IAChD,IAAI,EAAE,kBAAkB,GAAG,SAAS,CAAC;IACrC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,gBAAgB,EAAE,OAAO,CAAC;IAC1B,SAAS,EAAE,kBAAkB,CAAC;IAC9B,MAAM,EAAE,UAAU,CAAC;IACnB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,GAAG,OAAO,CAAC,OAAO,CAAC,CAwBnB"}
@@ -0,0 +1,51 @@
1
+ // A DELEGATION WIRE, VERIFIED LIVE — the tail every A2A service repeats when a grant arrives over the wire
2
+ // (spec 350 §8; the `service-agent-signing` rule). Promoted from the runtime app in spec 399 W0 (§4), where
3
+ // four call sites had each written it: delegator/delegate identity, caveat evaluation, revocation, signature.
4
+ //
5
+ // WHAT THIS DECIDES AND WHAT IT DOES NOT. `delegation.verifyLiveDelegation` decides all of it — this is the
6
+ // wire-shaped door to that one decision. It says the wire is live and authentic FROM `expectedDelegator` TO
7
+ // `expectedDelegate`; it says nothing about whether the caveat SHAPE is the one the caller's policy wants
8
+ // (member access vs stewardship, which contracts a wire must pin). That is the product's authorization
9
+ // policy — a positive identity test no generic "required enforcers" list can express. Call this AFTER the
10
+ // shape test, never instead of it.
11
+ //
12
+ // Returns false on every failure path — the callers are boolean gates and must not learn why (the reason
13
+ // would tell a prober which of several wires it is missing).
14
+ import { verifyLiveDelegation } from '@agenticprimitives/delegation';
15
+ /** Wire → `Delegation`. Throws on a salt that is not a number; callers that must not throw catch it. */
16
+ export function delegationOfWire(wire) {
17
+ return {
18
+ delegator: wire.delegator,
19
+ delegate: wire.delegate,
20
+ authority: wire.authority,
21
+ caveats: wire.caveats.map((c) => ({ enforcer: c.enforcer, terms: c.terms, args: (c.args ?? '0x') })),
22
+ salt: BigInt(wire.salt),
23
+ signature: wire.signature,
24
+ };
25
+ }
26
+ export async function verifyDelegationWire(input) {
27
+ const w = input.wire;
28
+ if (!w?.signature || !w.delegator || !w.delegate)
29
+ return false;
30
+ let delegation;
31
+ try {
32
+ delegation = delegationOfWire(w);
33
+ }
34
+ catch {
35
+ return false; // BigInt(salt) on garbage
36
+ }
37
+ const r = await verifyLiveDelegation({
38
+ delegation,
39
+ expectedDelegator: input.expectedDelegator,
40
+ expectedDelegate: input.expectedDelegate,
41
+ enforcers: input.enforcers,
42
+ now: input.now ?? Math.floor(Date.now() / 1000),
43
+ checks: {
44
+ delegationDigest: input.checks.digest,
45
+ isRevoked: async (d) => input.checks.isRevoked(input.checks.digest(d)),
46
+ verifySignature: async ({ signer, digest, signature }) => input.checks.erc1271(signer, digest, signature),
47
+ },
48
+ });
49
+ return r.ok;
50
+ }
51
+ //# sourceMappingURL=wire-verify.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wire-verify.js","sourceRoot":"","sources":["../src/wire-verify.ts"],"names":[],"mappings":"AAAA,2GAA2G;AAC3G,4GAA4G;AAC5G,8GAA8G;AAC9G,EAAE;AACF,4GAA4G;AAC5G,4GAA4G;AAC5G,0GAA0G;AAC1G,uGAAuG;AACvG,0GAA0G;AAC1G,mCAAmC;AACnC,EAAE;AACF,yGAAyG;AACzG,6DAA6D;AAC7D,OAAO,EAAE,oBAAoB,EAA4C,MAAM,+BAA+B,CAAC;AAuB/G,wGAAwG;AACxG,MAAM,UAAU,gBAAgB,CAAC,IAAwB;IACvD,OAAO;QACL,SAAS,EAAE,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,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;YACtE,eAAe,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC;SAC1G;KACF,CAAC,CAAC;IACH,OAAO,CAAC,CAAC,EAAE,CAAC;AACd,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agenticprimitives/a2a",
3
- "version": "0.0.0-alpha.19",
3
+ "version": "0.0.0-alpha.20",
4
4
  "description": "Async, delegation-authorized Agent-to-Agent (A2A) task transport: Task/Message/Artifact runtime over a TaskStore port, JSON-RPC method handlers, SkillHandler dispatch, the A2aWireAdapter client, and scoped-grant caveat builders. Transport-agnostic core (spec 269 / ADR-0034); the Cloudflare TaskStoreDO ships as the ./cloudflare adapter subpath.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -23,6 +23,14 @@
23
23
  "./cloudflare": {
24
24
  "types": "./dist/cloudflare/index.d.ts",
25
25
  "import": "./dist/cloudflare/index.js"
26
+ },
27
+ "./standard": {
28
+ "types": "./dist/standard/index.d.ts",
29
+ "import": "./dist/standard/index.js"
30
+ },
31
+ "./conform": {
32
+ "types": "./dist/conform/index.d.ts",
33
+ "import": "./dist/conform/index.js"
26
34
  }
27
35
  },
28
36
  "files": [
@@ -30,7 +38,8 @@
30
38
  "dist",
31
39
  "spec.md",
32
40
  "README.md",
33
- "CLAUDE.md"
41
+ "CLAUDE.md",
42
+ "bin"
34
43
  ],
35
44
  "publishConfig": {
36
45
  "access": "public"
@@ -52,10 +61,13 @@
52
61
  "agentic"
53
62
  ],
54
63
  "dependencies": {
55
- "@agenticprimitives/delegation": "1.0.0-alpha.22",
56
- "@agenticprimitives/fulfillment": "0.0.0-alpha.19",
57
- "@agenticprimitives/types": "1.0.0-alpha.22",
58
- "@agenticprimitives/verification-receipts": "0.0.0-alpha.3"
64
+ "@agenticprimitives/delegation": "1.0.0-alpha.23",
65
+ "@agenticprimitives/fulfillment": "0.0.0-alpha.20",
66
+ "@agenticprimitives/types": "1.0.0-alpha.23",
67
+ "@agenticprimitives/verification-receipts": "0.0.0-alpha.4"
68
+ },
69
+ "bin": {
70
+ "a2a-conform": "./bin/a2a-conform.mjs"
59
71
  },
60
72
  "scripts": {
61
73
  "build": "tsc -p tsconfig.build.json",
@@ -63,6 +75,7 @@
63
75
  "test": "vitest run",
64
76
  "test:unit": "vitest run --passWithNoTests",
65
77
  "test:watch": "vitest",
66
- "clean": "rm -rf dist"
78
+ "clean": "rm -rf dist",
79
+ "tck:sut": "tsx tck/sut.mts"
67
80
  }
68
81
  }
package/dist/jsonrpc.d.ts DELETED
@@ -1,27 +0,0 @@
1
- import type { A2aAgent } from './agent.js';
2
- export interface JsonRpcRequest {
3
- jsonrpc?: string;
4
- id?: string | number | null;
5
- method?: string;
6
- params?: unknown;
7
- }
8
- export type JsonRpcResponse = {
9
- jsonrpc: '2.0';
10
- id: string | number | null;
11
- result: unknown;
12
- } | {
13
- jsonrpc: '2.0';
14
- id: string | number | null;
15
- error: {
16
- code: number;
17
- message: string;
18
- };
19
- };
20
- /** Dispatch a single JSON-RPC request to the agent. `message/stream` is rejected here (handled by the
21
- * SSE transport). AUDIT NEW-A2A-2: tasks/get|cancel|pushNotificationConfig/set carry `caller` + `signature`;
22
- * the agent verifies the signature (ERC-1271) against the request digest, so `caller` can't be spoofed —
23
- * an attacker passing a victim's address but no/own signature is rejected. */
24
- export declare function dispatchA2aRpc(agent: A2aAgent, req: JsonRpcRequest): Promise<JsonRpcResponse>;
25
- /** Parse a raw JSON body + dispatch. Used by the HTTP/Cloudflare transport. */
26
- export declare function handleA2aRpcBody(agent: A2aAgent, rawBody: string): Promise<JsonRpcResponse>;
27
- //# sourceMappingURL=jsonrpc.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"jsonrpc.d.ts","sourceRoot":"","sources":["../src/jsonrpc.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,QAAQ,EAAqC,MAAM,YAAY,CAAC;AAE9E,MAAM,WAAW,cAAc;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AACD,MAAM,MAAM,eAAe,GACvB;IAAE,OAAO,EAAE,KAAK,CAAC;IAAC,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAAC,MAAM,EAAE,OAAO,CAAA;CAAE,GAC/D;IAAE,OAAO,EAAE,KAAK,CAAC;IAAC,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAAC,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,CAAC;AAU7F;;;+EAG+E;AAC/E,wBAAsB,cAAc,CAAC,KAAK,EAAE,QAAQ,EAAE,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,eAAe,CAAC,CAgBnG;AA6CD,+EAA+E;AAC/E,wBAAsB,gBAAgB,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CAIjG"}
package/dist/jsonrpc.js DELETED
@@ -1,81 +0,0 @@
1
- const PARSE_ERROR = -32700;
2
- const INVALID_REQUEST = -32600;
3
- const METHOD_NOT_FOUND = -32601;
4
- const INTERNAL_ERROR = -32603;
5
- const err = (id, code, message) => ({ jsonrpc: '2.0', id, error: { code, message } });
6
- const ok = (id, result) => ({ jsonrpc: '2.0', id, result });
7
- /** Dispatch a single JSON-RPC request to the agent. `message/stream` is rejected here (handled by the
8
- * SSE transport). AUDIT NEW-A2A-2: tasks/get|cancel|pushNotificationConfig/set carry `caller` + `signature`;
9
- * the agent verifies the signature (ERC-1271) against the request digest, so `caller` can't be spoofed —
10
- * an attacker passing a victim's address but no/own signature is rejected. */
11
- export async function dispatchA2aRpc(agent, req) {
12
- const id = req.id ?? null;
13
- try {
14
- return await dispatch(agent, req, id);
15
- }
16
- catch {
17
- // A THROW IS NOT A PROTOCOL RESPONSE. Handlers read `params` positionally off untrusted JSON, so a
18
- // caller omitting a field reaches `undefined.toLowerCase()` and the exception escapes the wire
19
- // entry — surfacing as a 500 with a stack rather than a JSON-RPC error. That is the same class of
20
- // bug `demo-a2a`'s `validate.ts` exists to prevent, on a PUBLIC surface (`message/send` takes
21
- // caller-supplied params), and it was reachable until spec 340's task-DO coverage hit it.
22
- //
23
- // The message is deliberately generic: the caller learns the request failed, never why internally.
24
- // A rejected-but-valid request still gets its own typed code from the handler below; this only
25
- // catches what nothing else answered.
26
- return err(id, INTERNAL_ERROR, 'internal error');
27
- }
28
- }
29
- async function dispatch(agent, req, id) {
30
- if (req.jsonrpc !== '2.0' || typeof req.method !== 'string') {
31
- return err(id, INVALID_REQUEST, 'not a JSON-RPC 2.0 request');
32
- }
33
- const p = (req.params ?? {});
34
- switch (req.method) {
35
- case 'message/send': {
36
- const r = await agent.messageSend(p);
37
- return r.ok ? ok(id, r.result) : err(id, r.code, r.message);
38
- }
39
- case 'tasks/resubmit': {
40
- const r = await agent.resubmit(p);
41
- return r.ok ? ok(id, r.result) : err(id, r.code, r.message);
42
- }
43
- // a2a-issuedat-dropped-in-dispatch (2026-07-04 self-audit): the caller-signature FRESHNESS field
44
- // (N-2 issuedAt) MUST be forwarded here — this dispatcher is the only wire entry, so dropping it left the
45
- // digest computed with issuedAt=0 (a signed tasks/get replays for the task's life) AND made
46
- // callerSigMaxAgeSec unusable (verifyCaller rejects every wire call with "issuedAt required"). The client
47
- // mints it into the signed digest; thread it through unchanged.
48
- case 'tasks/get': {
49
- const r = await agent.tasksGet({ taskId: p.taskId, caller: p.caller, signature: (p.signature ?? '0x'), issuedAt: p.issuedAt });
50
- return r.ok ? ok(id, r.result) : err(id, r.code, r.message);
51
- }
52
- case 'tasks/artifact': {
53
- const r = await agent.tasksArtifact({ taskId: p.taskId, artifactId: p.artifactId, caller: p.caller, signature: (p.signature ?? '0x'), issuedAt: p.issuedAt });
54
- return r.ok ? ok(id, r.result) : err(id, r.code, r.message);
55
- }
56
- case 'tasks/cancel': {
57
- const r = await agent.tasksCancel({ taskId: p.taskId, caller: p.caller, signature: (p.signature ?? '0x'), issuedAt: p.issuedAt });
58
- return r.ok ? ok(id, r.result) : err(id, r.code, r.message);
59
- }
60
- case 'tasks/pushNotificationConfig/set': {
61
- const r = await agent.pushConfigSet({ taskId: p.taskId, caller: p.caller, signature: (p.signature ?? '0x'), url: p.url, token: p.token, issuedAt: p.issuedAt });
62
- return r.ok ? ok(id, r.result) : err(id, r.code, r.message);
63
- }
64
- case 'message/stream':
65
- return err(id, INVALID_REQUEST, 'message/stream must use the SSE transport, not the JSON-RPC body');
66
- default:
67
- return err(id, METHOD_NOT_FOUND, `unknown method: ${req.method}`);
68
- }
69
- }
70
- /** Parse a raw JSON body + dispatch. Used by the HTTP/Cloudflare transport. */
71
- export async function handleA2aRpcBody(agent, rawBody) {
72
- let req;
73
- try {
74
- req = JSON.parse(rawBody);
75
- }
76
- catch {
77
- return err(null, PARSE_ERROR, 'invalid JSON');
78
- }
79
- return dispatchA2aRpc(agent, req);
80
- }
81
- //# sourceMappingURL=jsonrpc.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"jsonrpc.js","sourceRoot":"","sources":["../src/jsonrpc.ts"],"names":[],"mappings":"AAiBA,MAAM,WAAW,GAAG,CAAC,KAAK,CAAC;AAC3B,MAAM,eAAe,GAAG,CAAC,KAAK,CAAC;AAC/B,MAAM,gBAAgB,GAAG,CAAC,KAAK,CAAC;AAChC,MAAM,cAAc,GAAG,CAAC,K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