@adcp/sdk 16.0.0-beta.2 → 16.0.0-beta.4

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 (248) hide show
  1. package/README.md +54 -0
  2. package/dist/lib/auth/oauth/diagnose.js +3 -11
  3. package/dist/lib/auth/oauth/diagnose.mjs +4 -12
  4. package/dist/lib/auth/oauth/diagnostics.d.mts +2 -1
  5. package/dist/lib/auth/oauth/diagnostics.d.ts +2 -1
  6. package/dist/lib/auth/oauth/diagnostics.js +8 -10
  7. package/dist/lib/auth/oauth/diagnostics.mjs +7 -10
  8. package/dist/lib/core/ConversationTypes.d.mts +8 -3
  9. package/dist/lib/core/ConversationTypes.d.ts +8 -3
  10. package/dist/lib/core/SingleAgentClient.d.mts +5 -3
  11. package/dist/lib/core/SingleAgentClient.d.ts +5 -3
  12. package/dist/lib/core/TaskExecutor.js +5 -1
  13. package/dist/lib/core/TaskExecutor.mjs +5 -1
  14. package/dist/lib/errors/index.d.mts +9 -4
  15. package/dist/lib/errors/index.d.ts +9 -4
  16. package/dist/lib/index.d.mts +3 -3
  17. package/dist/lib/index.d.ts +3 -3
  18. package/dist/lib/index.js +8 -0
  19. package/dist/lib/index.mjs +14 -2
  20. package/dist/lib/negotiation/types.d.mts +20 -39
  21. package/dist/lib/negotiation/types.d.ts +20 -39
  22. package/dist/lib/protocols/index.d.mts +60 -24
  23. package/dist/lib/protocols/index.d.ts +60 -24
  24. package/dist/lib/protocols/index.js +9 -4
  25. package/dist/lib/protocols/index.mjs +3 -0
  26. package/dist/lib/protocols/mcp-modern.js +1 -0
  27. package/dist/lib/protocols/mcp-modern.mjs +2 -1
  28. package/dist/lib/protocols/mcp.js +1 -0
  29. package/dist/lib/protocols/mcp.mjs +2 -1
  30. package/dist/lib/protocols/responseSizeLimit.d.mts +91 -5
  31. package/dist/lib/protocols/responseSizeLimit.d.ts +91 -5
  32. package/dist/lib/protocols/responseSizeLimit.js +195 -31
  33. package/dist/lib/protocols/responseSizeLimit.mjs +192 -31
  34. package/dist/lib/reporting/consumer-runtime.js +2 -1
  35. package/dist/lib/reporting/consumer-runtime.mjs +2 -1
  36. package/dist/lib/reporting/ledger/handler.js +50 -11
  37. package/dist/lib/reporting/ledger/handler.mjs +50 -12
  38. package/dist/lib/reporting/ledger/index.d.mts +17 -14
  39. package/dist/lib/reporting/ledger/index.d.ts +17 -14
  40. package/dist/lib/reporting/ledger/index.js +32 -20
  41. package/dist/lib/reporting/ledger/index.mjs +21 -10
  42. package/dist/lib/reporting/ledger/offering-validation.d.mts +9 -0
  43. package/dist/lib/reporting/ledger/offering-validation.d.ts +9 -0
  44. package/dist/lib/reporting/{gcs/bucket-policy.js → ledger/offering-validation.js} +9 -8
  45. package/dist/lib/reporting/ledger/offering-validation.mjs +8 -0
  46. package/dist/lib/reporting/ledger/receipts.d.mts +48 -0
  47. package/dist/lib/reporting/ledger/receipts.d.ts +48 -0
  48. package/dist/lib/reporting/ledger/receipts.js +186 -0
  49. package/dist/lib/reporting/ledger/receipts.mjs +161 -0
  50. package/dist/lib/reporting/ledger/status-ingest.js +3 -3
  51. package/dist/lib/reporting/ledger/status-ingest.mjs +4 -5
  52. package/dist/lib/reporting/ledger/types.d.mts +43 -0
  53. package/dist/lib/reporting/ledger/types.d.ts +43 -0
  54. package/dist/lib/reporting/ledger/types.js +31 -2
  55. package/dist/lib/reporting/ledger/types.mjs +26 -1
  56. package/dist/lib/reporting/pagination.d.mts +6 -0
  57. package/dist/lib/reporting/pagination.d.ts +6 -0
  58. package/dist/lib/reporting/{gcs/errors.js → pagination.js} +12 -17
  59. package/dist/lib/reporting/pagination.mjs +12 -0
  60. package/dist/lib/reporting/reconciliation.d.mts +1 -0
  61. package/dist/lib/reporting/reconciliation.d.ts +1 -0
  62. package/dist/lib/reporting/reconciliation.js +3 -2
  63. package/dist/lib/reporting/reconciliation.mjs +3 -2
  64. package/dist/lib/reporting/service/index.d.mts +79 -153
  65. package/dist/lib/reporting/service/index.d.ts +79 -153
  66. package/dist/lib/reporting/service/index.js +34 -491
  67. package/dist/lib/reporting/service/index.mjs +36 -510
  68. package/dist/lib/reporting/service/scheduler-support.d.mts +43 -0
  69. package/dist/lib/reporting/service/scheduler-support.d.ts +43 -0
  70. package/dist/lib/reporting/service/scheduler-support.js +125 -0
  71. package/dist/lib/reporting/service/scheduler-support.mjs +96 -0
  72. package/dist/lib/schemas-data/v2.5/_provenance.json +1 -1
  73. package/dist/lib/signing/canonicalize.d.mts +4 -0
  74. package/dist/lib/signing/canonicalize.d.ts +4 -0
  75. package/dist/lib/signing/canonicalize.js +14 -8
  76. package/dist/lib/signing/canonicalize.mjs +14 -8
  77. package/dist/lib/signing/content-digest.d.mts +8 -0
  78. package/dist/lib/signing/content-digest.d.ts +8 -0
  79. package/dist/lib/signing/content-digest.js +11 -5
  80. package/dist/lib/signing/content-digest.mjs +10 -5
  81. package/dist/lib/signing/crypto.d.mts +15 -0
  82. package/dist/lib/signing/crypto.d.ts +15 -0
  83. package/dist/lib/signing/crypto.js +75 -3
  84. package/dist/lib/signing/crypto.mjs +78 -3
  85. package/dist/lib/signing/server.d.mts +1 -1
  86. package/dist/lib/signing/server.d.ts +1 -1
  87. package/dist/lib/signing/server.js +2 -0
  88. package/dist/lib/signing/server.mjs +2 -1
  89. package/dist/lib/signing/signer.js +11 -14
  90. package/dist/lib/signing/signer.mjs +13 -16
  91. package/dist/lib/signing/testing.js +2 -6
  92. package/dist/lib/signing/testing.mjs +3 -7
  93. package/dist/lib/signing/verifier.js +2 -2
  94. package/dist/lib/signing/verifier.mjs +3 -3
  95. package/dist/lib/signing/web-bot-auth.js +122 -43
  96. package/dist/lib/signing/web-bot-auth.mjs +128 -44
  97. package/dist/lib/signing/webhook-verifier.js +2 -2
  98. package/dist/lib/signing/webhook-verifier.mjs +3 -3
  99. package/dist/lib/substitution/compile.js +2 -1
  100. package/dist/lib/substitution/compile.mjs +2 -1
  101. package/dist/lib/substitution/consent-macros.d.mts +4 -0
  102. package/dist/lib/substitution/consent-macros.d.ts +4 -0
  103. package/dist/lib/substitution/consent-macros.js +45 -0
  104. package/dist/lib/substitution/consent-macros.mjs +20 -0
  105. package/dist/lib/substitution/index.d.mts +1 -1
  106. package/dist/lib/substitution/index.d.ts +1 -1
  107. package/dist/lib/substitution/index.js +2 -0
  108. package/dist/lib/substitution/index.mjs +2 -1
  109. package/dist/lib/substitution/translate.d.mts +15 -2
  110. package/dist/lib/substitution/translate.d.ts +15 -2
  111. package/dist/lib/substitution/translate.js +148 -26
  112. package/dist/lib/substitution/translate.mjs +147 -26
  113. package/dist/lib/testing/client.js +2 -1
  114. package/dist/lib/testing/client.mjs +2 -1
  115. package/dist/lib/testing/scenarios/capabilities.js +1 -1
  116. package/dist/lib/testing/scenarios/capabilities.mjs +1 -1
  117. package/dist/lib/testing/storyboard/junit.js +16 -3
  118. package/dist/lib/testing/storyboard/junit.mjs +16 -3
  119. package/dist/lib/testing/storyboard/request-signing/builder.js +12 -14
  120. package/dist/lib/testing/storyboard/request-signing/builder.mjs +13 -15
  121. package/dist/lib/testing/storyboard/runner.js +94 -25
  122. package/dist/lib/testing/storyboard/runner.mjs +94 -25
  123. package/dist/lib/testing/storyboard/signer-grader/grader.js +2 -7
  124. package/dist/lib/testing/storyboard/signer-grader/grader.mjs +2 -7
  125. package/dist/lib/testing/storyboard/types.d.mts +6 -0
  126. package/dist/lib/testing/storyboard/types.d.ts +6 -0
  127. package/dist/lib/testing/storyboard/validations.d.mts +1 -1
  128. package/dist/lib/testing/storyboard/validations.d.ts +1 -1
  129. package/dist/lib/types/enums.generated.d.mts +3 -0
  130. package/dist/lib/types/enums.generated.d.ts +3 -0
  131. package/dist/lib/types/enums.generated.js +9 -0
  132. package/dist/lib/types/enums.generated.mjs +6 -0
  133. package/dist/lib/validation/schema-loader.js +25 -0
  134. package/dist/lib/validation/schema-loader.mjs +24 -0
  135. package/dist/lib/version.d.mts +3 -3
  136. package/dist/lib/version.d.ts +3 -3
  137. package/dist/lib/version.js +3 -3
  138. package/dist/lib/version.mjs +3 -3
  139. package/docs/TYPE-SUMMARY.md +28 -5
  140. package/docs/guides/DISCOVERY-CACHE-AND-SESSION-REUSE.md +3 -2
  141. package/docs/guides/REPORTING-GCS-FENCE.md +3 -3
  142. package/docs/guides/REPORTING-GCS-MANAGED.md +4 -4
  143. package/docs/guides/REPORTING-LEDGER-CUTOVER.md +7 -7
  144. package/docs/guides/REPORTING-LEDGER.md +107 -51
  145. package/docs/guides/REPORTING-OPERATIONS.md +66 -5
  146. package/docs/guides/REPORTING-STABILITY.md +36 -32
  147. package/docs/guides/UNIVERSAL-MACRO-COMPILATION.md +38 -0
  148. package/docs/guides/VALIDATE-YOUR-AGENT.md +12 -0
  149. package/docs/llms.txt +4 -3
  150. package/docs/migration-14.x-rc-worksheet.md +4 -7
  151. package/docs/migration-reporting-storage-package.md +186 -0
  152. package/examples/README.md +1 -1
  153. package/package.json +14 -78
  154. package/dist/lib/reporting/azure/index.d.mts +0 -31
  155. package/dist/lib/reporting/azure/index.d.ts +0 -31
  156. package/dist/lib/reporting/azure/index.js +0 -266
  157. package/dist/lib/reporting/azure/index.mjs +0 -249
  158. package/dist/lib/reporting/bigquery/index.d.mts +0 -246
  159. package/dist/lib/reporting/bigquery/index.d.ts +0 -246
  160. package/dist/lib/reporting/bigquery/index.js +0 -633
  161. package/dist/lib/reporting/bigquery/index.mjs +0 -594
  162. package/dist/lib/reporting/gcs/adapter.d.mts +0 -38
  163. package/dist/lib/reporting/gcs/adapter.d.ts +0 -38
  164. package/dist/lib/reporting/gcs/adapter.js +0 -342
  165. package/dist/lib/reporting/gcs/adapter.mjs +0 -325
  166. package/dist/lib/reporting/gcs/bucket-policy.d.mts +0 -3
  167. package/dist/lib/reporting/gcs/bucket-policy.d.ts +0 -3
  168. package/dist/lib/reporting/gcs/bucket-policy.mjs +0 -7
  169. package/dist/lib/reporting/gcs/errors.d.mts +0 -11
  170. package/dist/lib/reporting/gcs/errors.d.ts +0 -11
  171. package/dist/lib/reporting/gcs/errors.mjs +0 -16
  172. package/dist/lib/reporting/gcs/fence.d.mts +0 -41
  173. package/dist/lib/reporting/gcs/fence.d.ts +0 -41
  174. package/dist/lib/reporting/gcs/fence.js +0 -250
  175. package/dist/lib/reporting/gcs/fence.mjs +0 -230
  176. package/dist/lib/reporting/gcs/index.d.mts +0 -18
  177. package/dist/lib/reporting/gcs/index.d.ts +0 -18
  178. package/dist/lib/reporting/gcs/index.js +0 -44
  179. package/dist/lib/reporting/gcs/index.mjs +0 -14
  180. package/dist/lib/reporting/gcs/io.d.mts +0 -7
  181. package/dist/lib/reporting/gcs/io.d.ts +0 -7
  182. package/dist/lib/reporting/gcs/io.js +0 -95
  183. package/dist/lib/reporting/gcs/io.mjs +0 -69
  184. package/dist/lib/reporting/gcs/reader.d.mts +0 -67
  185. package/dist/lib/reporting/gcs/reader.d.ts +0 -67
  186. package/dist/lib/reporting/gcs/reader.js +0 -193
  187. package/dist/lib/reporting/gcs/reader.mjs +0 -169
  188. package/dist/lib/reporting/gcs/row-provider.d.mts +0 -39
  189. package/dist/lib/reporting/gcs/row-provider.d.ts +0 -39
  190. package/dist/lib/reporting/gcs/row-provider.js +0 -225
  191. package/dist/lib/reporting/gcs/row-provider.mjs +0 -208
  192. package/dist/lib/reporting/gcs/validation.d.mts +0 -5
  193. package/dist/lib/reporting/gcs/validation.d.ts +0 -5
  194. package/dist/lib/reporting/gcs/validation.js +0 -49
  195. package/dist/lib/reporting/gcs/validation.mjs +0 -25
  196. package/dist/lib/reporting/ledger/change-feed.d.mts +0 -69
  197. package/dist/lib/reporting/ledger/change-feed.d.ts +0 -69
  198. package/dist/lib/reporting/ledger/change-feed.js +0 -107
  199. package/dist/lib/reporting/ledger/change-feed.mjs +0 -80
  200. package/dist/lib/reporting/ledger/managed-postgres.d.mts +0 -293
  201. package/dist/lib/reporting/ledger/managed-postgres.d.ts +0 -293
  202. package/dist/lib/reporting/ledger/managed-postgres.js +0 -2346
  203. package/dist/lib/reporting/ledger/managed-postgres.mjs +0 -2332
  204. package/dist/lib/reporting/ledger/managed-router.d.mts +0 -148
  205. package/dist/lib/reporting/ledger/managed-router.d.ts +0 -148
  206. package/dist/lib/reporting/ledger/managed-router.js +0 -280
  207. package/dist/lib/reporting/ledger/managed-router.mjs +0 -258
  208. package/dist/lib/reporting/ledger/managed.d.mts +0 -535
  209. package/dist/lib/reporting/ledger/managed.d.ts +0 -535
  210. package/dist/lib/reporting/ledger/managed.js +0 -761
  211. package/dist/lib/reporting/ledger/managed.mjs +0 -729
  212. package/dist/lib/reporting/ledger/notification-activity.d.mts +0 -332
  213. package/dist/lib/reporting/ledger/notification-activity.d.ts +0 -332
  214. package/dist/lib/reporting/ledger/notification-activity.js +0 -1366
  215. package/dist/lib/reporting/ledger/notification-activity.mjs +0 -1337
  216. package/dist/lib/reporting/ledger/object-writes.d.mts +0 -128
  217. package/dist/lib/reporting/ledger/object-writes.d.ts +0 -128
  218. package/dist/lib/reporting/ledger/object-writes.js +0 -147
  219. package/dist/lib/reporting/ledger/object-writes.mjs +0 -114
  220. package/dist/lib/reporting/ledger/postgres.d.mts +0 -689
  221. package/dist/lib/reporting/ledger/postgres.d.ts +0 -689
  222. package/dist/lib/reporting/ledger/postgres.js +0 -4462
  223. package/dist/lib/reporting/ledger/postgres.mjs +0 -4462
  224. package/dist/lib/reporting/ledger/row-storage-migration.d.mts +0 -59
  225. package/dist/lib/reporting/ledger/row-storage-migration.d.ts +0 -59
  226. package/dist/lib/reporting/ledger/row-storage-migration.js +0 -365
  227. package/dist/lib/reporting/ledger/row-storage-migration.mjs +0 -339
  228. package/dist/lib/reporting/ledger/row-storage-object.d.mts +0 -203
  229. package/dist/lib/reporting/ledger/row-storage-object.d.ts +0 -203
  230. package/dist/lib/reporting/ledger/row-storage-object.js +0 -379
  231. package/dist/lib/reporting/ledger/row-storage-object.mjs +0 -335
  232. package/dist/lib/reporting/ledger/row-storage-provider-io.d.mts +0 -44
  233. package/dist/lib/reporting/ledger/row-storage-provider-io.d.ts +0 -44
  234. package/dist/lib/reporting/ledger/row-storage-provider-io.js +0 -142
  235. package/dist/lib/reporting/ledger/row-storage-provider-io.mjs +0 -111
  236. package/dist/lib/reporting/ledger/row-storage.d.mts +0 -316
  237. package/dist/lib/reporting/ledger/row-storage.d.ts +0 -316
  238. package/dist/lib/reporting/ledger/row-storage.js +0 -812
  239. package/dist/lib/reporting/ledger/row-storage.mjs +0 -802
  240. package/dist/lib/reporting/s3/index.d.mts +0 -34
  241. package/dist/lib/reporting/s3/index.d.ts +0 -34
  242. package/dist/lib/reporting/s3/index.js +0 -347
  243. package/dist/lib/reporting/s3/index.mjs +0 -340
  244. package/dist/lib/reporting/service/maintenance.d.mts +0 -148
  245. package/dist/lib/reporting/service/maintenance.d.ts +0 -148
  246. package/dist/lib/reporting/service/maintenance.js +0 -185
  247. package/dist/lib/reporting/service/maintenance.mjs +0 -159
  248. package/examples/reliable-reporting-service/README.md +0 -169
@@ -1,535 +0,0 @@
1
- import type { ReportingAdjustmentReceipt, ReportingDeliveryCapabilities, ReportingMaterialization, ReportingReceipt, ReportingResource, ReportingVerification, SyncReportingReceiptsResponse } from '../../types';
2
- import type { AdcpToolMap } from '../../server/create-adcp-server';
3
- import { createReportingDeliveryHandler, createReportingStatusHandler } from './handler';
4
- import type { ReportingStatusConsumerScopeOptionsV1 } from './handler';
5
- import type { ReportingLedgerAdjustmentV1, ReportingLegacyRevisionReaderV1, ReportingLedgerObligationV1, ReportingLedgerRevisionV1, ReportingLedgerStore, ReportingManagedDeliveryBindingV1 } from './types';
6
- /**
7
- * Upper bound on an adapter's startup probe, so a hung provider cannot hang startup.
8
- * A router's per-route probe budget must stay under it, or this deadline fires
9
- * first and the failing route's id never reaches the startup error.
10
- *
11
- * @experimental Reliable Reporting storage surface: breaking changes may ship in minor releases. See https://github.com/adcontextprotocol/adcp-client/blob/main/docs/guides/REPORTING-STABILITY.md
12
- */
13
- export declare const REPORTING_ADAPTER_PROBE_DEADLINE_MILLISECONDS_V1 = 30000;
14
- /**
15
- * The delivery pattern a destination authorization generation serves.
16
- *
17
- * @experimental Reliable Reporting storage surface: breaking changes may ship in minor releases. See https://github.com/adcontextprotocol/adcp-client/blob/main/docs/guides/REPORTING-STABILITY.md
18
- */
19
- export type ReportingDestinationPatternV1 = ReportingManagedDeliveryBindingV1['method'];
20
- /**
21
- * Delivery patterns, in the order the protocol lists them.
22
- *
23
- * @experimental Reliable Reporting storage surface: breaking changes may ship in minor releases. See https://github.com/adcontextprotocol/adcp-client/blob/main/docs/guides/REPORTING-STABILITY.md
24
- */
25
- export declare const REPORTING_DESTINATION_PATTERNS_V1: readonly ReportingDestinationPatternV1[];
26
- /**
27
- * Same constraint the protocol puts on `method.transport`.
28
- *
29
- * @experimental Reliable Reporting storage surface: breaking changes may ship in minor releases. See https://github.com/adcontextprotocol/adcp-client/blob/main/docs/guides/REPORTING-STABILITY.md
30
- */
31
- export declare const REPORTING_DESTINATION_TRANSPORT_PATTERN_V1: RegExp;
32
- /**
33
- * @experimental Reliable Reporting storage surface: breaking changes may ship in minor releases. See https://github.com/adcontextprotocol/adcp-client/blob/main/docs/guides/REPORTING-STABILITY.md
34
- */
35
- export interface ReportingDestinationAuthorizationV1 {
36
- account_id: string;
37
- destination_ref: string;
38
- generation: number;
39
- authorized_at: string;
40
- /**
41
- * Delivery pattern this generation serves, recorded when the generation is
42
- * created. A destination has exactly one pattern, and a change to its
43
- * delivery contract mints a new `destination_ref` generation, so this never
44
- * changes for a generation. Absent on generations recorded before it
45
- * existed (and on ones whose bindings did not agree when backfilled).
46
- */
47
- pattern?: ReportingDestinationPatternV1;
48
- /**
49
- * Transport (`s3`, `gcs`, ...) that holds this generation's provider grant,
50
- * recorded and immutable like `pattern`. This is what lets `revoke()` be
51
- * routed to the transport that holds the grant. Absent for the same legacy
52
- * reasons as `pattern`.
53
- */
54
- transport?: string;
55
- revoked_at?: string;
56
- cleanup_completed_at?: string;
57
- }
58
- /**
59
- * @experimental Reliable Reporting storage surface: breaking changes may ship in minor releases. See https://github.com/adcontextprotocol/adcp-client/blob/main/docs/guides/REPORTING-STABILITY.md
60
- */
61
- export interface ReportingManagedDeliveryLeaseV1 {
62
- materialization: ReportingMaterialization;
63
- binding: ReportingManagedDeliveryBindingV1;
64
- obligation: ReportingLedgerObligationV1;
65
- revision: ReportingLedgerRevisionV1;
66
- owner: string;
67
- generation: number;
68
- expires_at: string;
69
- }
70
- /**
71
- * @experimental Reliable Reporting storage surface: breaking changes may ship in minor releases. See https://github.com/adcontextprotocol/adcp-client/blob/main/docs/guides/REPORTING-STABILITY.md
72
- */
73
- export interface ReportingDestinationRevocationLeaseV1 {
74
- authorization: ReportingDestinationAuthorizationV1;
75
- owner: string;
76
- generation: number;
77
- expires_at: string;
78
- /**
79
- * SLA facts as the ledger's own clock sees them.
80
- *
81
- * The advertised window is measured from the instant the revocation was
82
- * committed, so deciding whether a grant is still inside it on the worker's
83
- * host clock lets skew silently extend or collapse the promise. A store
84
- * that can compute them reports them here; `overdue` is true at the exact
85
- * boundary, because the window is elapsed once it has been reached.
86
- */
87
- revoked_at?: string;
88
- overdue?: boolean;
89
- remaining_milliseconds?: number;
90
- }
91
- /**
92
- * @experimental Reliable Reporting storage surface: breaking changes may ship in minor releases. See https://github.com/adcontextprotocol/adcp-client/blob/main/docs/guides/REPORTING-STABILITY.md
93
- */
94
- export type ReportingReceiptBatchEntryV1 = {
95
- kind: 'revision';
96
- receipt: ReportingReceipt;
97
- } | {
98
- kind: 'adjustment';
99
- receipt: ReportingAdjustmentReceipt;
100
- };
101
- /**
102
- * @experimental Reliable Reporting storage surface: breaking changes may ship in minor releases. See https://github.com/adcontextprotocol/adcp-client/blob/main/docs/guides/REPORTING-STABILITY.md
103
- */
104
- export interface ReportingReceiptBatchInputV1 {
105
- account_id: string;
106
- consumer_id: string;
107
- idempotency_key: string;
108
- request_fingerprint: string;
109
- entries: ReportingReceiptBatchEntryV1[];
110
- received_at: string;
111
- }
112
- /**
113
- * Agent-wide Managed Delivery promises durably shared by every replica.
114
- *
115
- * @experimental Reliable Reporting storage surface: breaking changes may ship in minor releases. See https://github.com/adcontextprotocol/adcp-client/blob/main/docs/guides/REPORTING-STABILITY.md
116
- */
117
- export interface ReportingManagedDeliveryAdvertisedPoliciesV1 {
118
- automatedRecoveryWindowSeconds: number;
119
- statusRetentionDays: number;
120
- resourceRetentionDays: number;
121
- authorizationRevocationSeconds: number;
122
- }
123
- /**
124
- * @experimental Reliable Reporting storage surface: breaking changes may ship in minor releases. See https://github.com/adcontextprotocol/adcp-client/blob/main/docs/guides/REPORTING-STABILITY.md
125
- */
126
- export interface ReportingManagedDeliveryStore {
127
- /**
128
- * Prove that this store shares the supplied Core authority and has its
129
- * durable schema installed. Throw an actionable configuration error when
130
- * either condition is false; return true only after an operational probe.
131
- */
132
- probe(coreStore: ReportingLedgerStore): Promise<boolean>;
133
- /**
134
- * Direct-store introspection of installed Core recovery windows.
135
- *
136
- * This is optional and non-authoritative for capability publication. Runtime
137
- * factories use `adoptAdvertisedPolicies`, whose store-side transaction must
138
- * validate binding compatibility while holding the policy fence.
139
- */
140
- listInstalledRecoveryWindowSeconds?(): Promise<number[]>;
141
- /**
142
- * Records the agent-wide advertised recovery window so the store can hold
143
- * later binding installs to it.
144
- *
145
- * Optional on the structural interface for source compatibility with
146
- * direct-store integrations. The runtime factory uses the combined atomic
147
- * hook below; this separate hook remains useful when bindings are installed
148
- * without a runtime.
149
- */
150
- adoptAdvertisedRecoveryWindowSeconds?(seconds: number): Promise<void>;
151
- /**
152
- * Durably registers the advertised `status_retention_days`.
153
- *
154
- * Direct-store integrations can use this separate hook when no runtime is
155
- * publishing the full capability policy. The runtime factory uses the
156
- * combined atomic hook below so a failed startup cannot partially register
157
- * its promises.
158
- */
159
- adoptAdvertisedStatusRetentionDays?(days: number): Promise<void>;
160
- /**
161
- * Atomically adopts every policy advertised by a Managed Delivery runtime
162
- * and returns the strongest values enforced across all replicas.
163
- *
164
- * Recovery and authorization-revocation windows are maximum-delay promises,
165
- * so the adopted value may only decrease. Status and resource retention are
166
- * minimum-duration promises, so the adopted value may only increase. The
167
- * operation must serialize with `installBinding`, validate every installed
168
- * binding against the adopted recovery bound while holding that fence, and
169
- * leave all four values unchanged if any validation or write fails. The
170
- * store must enforce the adopted resource and revocation values at its
171
- * settlement and revocation-claim boundaries.
172
- *
173
- * Optional on the base interface so direct-store integrations that use the
174
- * separate hooks remain source-compatible. Capability publication requires
175
- * this combined hook because two independent writes cannot prevent a failed
176
- * startup from leaving only one promise registered.
177
- */
178
- adoptAdvertisedPolicies?(policy: ReportingManagedDeliveryAdvertisedPoliciesV1): Promise<ReportingManagedDeliveryAdvertisedPoliciesV1>;
179
- authorizeDestination(input: Omit<ReportingDestinationAuthorizationV1, 'revoked_at' | 'cleanup_completed_at'>): Promise<void>;
180
- revokeDestination(input: {
181
- account_id: string;
182
- destination_ref: string;
183
- generation: number;
184
- revoked_at: string;
185
- }): Promise<boolean>;
186
- installBinding(binding: ReportingManagedDeliveryBindingV1): Promise<{
187
- inserted: boolean;
188
- }>;
189
- /**
190
- * Installs the check `installBinding` applies to every new binding before it
191
- * writes anything. A thrown error refuses the install and reaches the caller
192
- * as-is. Pass `undefined` to remove it.
193
- *
194
- * The runtime registers the adapter's `admitBinding` here, so a binding no
195
- * installed delivery route can serve is refused at install instead of
196
- * failing at its first delivery. Optional on the structural interface so
197
- * existing custom stores stay source-compatible; a runtime whose adapter
198
- * supplies `admitBinding` refuses a store that cannot enforce it.
199
- */
200
- setBindingAdmission?(admit: ((binding: ReportingManagedDeliveryBindingV1) => void) | undefined): void;
201
- planMaterializations(input?: {
202
- account_id?: string;
203
- limit?: number;
204
- }): Promise<number>;
205
- /**
206
- * Fails materializations that have used every delivery attempt.
207
- *
208
- * The claim predicate stops handing them out, so without a sweep they stay
209
- * `pending` forever — and the planner skips any obligation with a pending
210
- * row, so the revision is never retried or replanned either.
211
- */
212
- failExhaustedMaterializations?(input?: {
213
- account_id?: string;
214
- limit?: number;
215
- }): Promise<number>;
216
- claimMaterialization(input: {
217
- owner: string;
218
- now: string;
219
- lease_milliseconds: number;
220
- account_id?: string;
221
- }): Promise<ReportingManagedDeliveryLeaseV1 | null>;
222
- settleMaterialization(input: {
223
- lease: ReportingManagedDeliveryLeaseV1;
224
- now: string;
225
- /**
226
- * Retention the store must see satisfied on its own clock.
227
- *
228
- * The worker checks it too, but a worker running behind would otherwise
229
- * accept a resource the database already considers under-retained.
230
- */
231
- minimum_resource_retention_days?: number;
232
- outcome: {
233
- status: 'available' | 'delivered';
234
- resource: ReportingResource;
235
- verification: ReportingVerification;
236
- } | {
237
- status: 'failed';
238
- failure_code: string;
239
- };
240
- }): Promise<boolean>;
241
- claimRevocation(input: {
242
- owner: string;
243
- now: string;
244
- lease_milliseconds: number;
245
- account_id?: string;
246
- /** Advertised window, so the store can compute SLA facts on its own clock. */
247
- authorization_revocation_seconds?: number;
248
- }): Promise<ReportingDestinationRevocationLeaseV1 | null>;
249
- completeRevocation(input: {
250
- lease: ReportingDestinationRevocationLeaseV1;
251
- completed_at: string;
252
- }): Promise<boolean>;
253
- /**
254
- * Releases a cleanup lease after a failed attempt so the grant is
255
- * immediately reclaimable.
256
- *
257
- * Required, not optional: without it a failed attempt keeps its lease as
258
- * the retry delay, which defers the next attempt and hides an overdue grant
259
- * behind a lease that has not expired. `claimRevocation` orders by
260
- * `cleanup_lease_generation`, and a failed attempt has already incremented
261
- * it, so releasing cannot let one broken grant starve the queue.
262
- */
263
- releaseRevocation(input: {
264
- lease: ReportingDestinationRevocationLeaseV1;
265
- /** Holds the grant out of selection briefly so a retry is not a tight loop. */
266
- backoff_milliseconds?: number;
267
- }): Promise<boolean>;
268
- getReadableResource(input: {
269
- account_id: string;
270
- resource_ref: string;
271
- }): Promise<{
272
- materialization: ReportingMaterialization;
273
- binding: ReportingManagedDeliveryBindingV1;
274
- } | null>;
275
- isAuthorizationCurrent(input: {
276
- account_id: string;
277
- destination_ref: string;
278
- generation: number;
279
- }): Promise<boolean>;
280
- syncReceiptBatch(input: ReportingReceiptBatchInputV1): Promise<SyncReportingReceiptsResponse['results']>;
281
- }
282
- /**
283
- * @experimental Reliable Reporting storage surface: breaking changes may ship in minor releases. See https://github.com/adcontextprotocol/adcp-client/blob/main/docs/guides/REPORTING-STABILITY.md
284
- */
285
- export interface ReportingManagedDeliveryAdapterV1 {
286
- /** Profiles this installed adapter can actually verify through its consumer/destination path. */
287
- readonly verificationProfiles: readonly ReportingVerification['verification_profile'][];
288
- /** Provider revoke installs a generation tombstone that fences late writes. */
289
- readonly revocationFencesDeliveryGenerations: true;
290
- deliver(input: Readonly<{
291
- materialization: ReportingMaterialization;
292
- binding: ReportingManagedDeliveryBindingV1;
293
- obligation: ReportingLedgerObligationV1;
294
- revision: ReportingLedgerRevisionV1;
295
- maxBytes: number;
296
- }>, context: {
297
- signal: AbortSignal;
298
- }): Promise<{
299
- status: 'available' | 'delivered';
300
- resource: ReportingResource;
301
- verification: ReportingVerification;
302
- }>;
303
- read(input: Readonly<{
304
- materialization: ReportingMaterialization;
305
- binding: ReportingManagedDeliveryBindingV1;
306
- resource: ReportingResource;
307
- maxBytes: number;
308
- }>, context: {
309
- signal: AbortSignal;
310
- }): Promise<Uint8Array>;
311
- /** Remove seller-controlled provider grants. The durable deny is committed before this call. */
312
- revoke(input: Readonly<{
313
- authorization: ReportingDestinationAuthorizationV1;
314
- }>, context: {
315
- signal: AbortSignal;
316
- }): Promise<void>;
317
- /**
318
- * Optional startup check that the adapter can reach what it delivers to.
319
- * The runtime calls it once, before it adopts any durable policy, and
320
- * refuses to start if it rejects. It must not mutate provider state.
321
- */
322
- probe?(context: {
323
- signal: AbortSignal;
324
- }): Promise<void>;
325
- /**
326
- * Optional install-time admission. Throw to refuse a binding this adapter
327
- * could not deliver. The runtime wires it into the store's `installBinding`.
328
- * A single adapter has no reason to define it; the delivery router does.
329
- */
330
- admitBinding?(binding: ReportingManagedDeliveryBindingV1): void;
331
- /**
332
- * Optional startup admission for an advertised managed offering. Throw if
333
- * the adapter has no way to serve it. Called once per offering at runtime
334
- * construction.
335
- */
336
- admitOffering?(offering: {
337
- method: {
338
- pattern: string;
339
- transport: string;
340
- };
341
- reconciliation_mode?: string;
342
- }): void;
343
- /**
344
- * Optional observability hook: the id of the route a binding or an
345
- * authorization is dispatched to, or `undefined` if none. Only the id may be
346
- * returned. The worker keys its per-route counts on it, so it must never
347
- * carry credentials, locations or any other provider detail.
348
- */
349
- routeIdFor?(target: Readonly<{
350
- binding: ReportingManagedDeliveryBindingV1;
351
- } | {
352
- authorization: ReportingDestinationAuthorizationV1;
353
- }>): string | undefined;
354
- }
355
- /**
356
- * Per-route counts keyed by delivery route id. Present on a worker result only
357
- * when the installed adapter is a router, so a single-adapter runtime's result
358
- * shape is unchanged. Work that no route could take is counted under
359
- * `UNROUTED_REPORTING_ROUTE_KEY_V1`, which no route id can equal.
360
- *
361
- * @experimental Reliable Reporting storage surface: breaking changes may ship in minor releases. See https://github.com/adcontextprotocol/adcp-client/blob/main/docs/guides/REPORTING-STABILITY.md
362
- */
363
- export interface ReportingManagedDeliveryRouteCountsV1 {
364
- /** Materializations settled as delivered, by the route that delivered them. */
365
- deliveriesByRoute: Record<string, number>;
366
- /** Materializations that failed (including an unroutable binding), by route. */
367
- deliveryFailuresByRoute: Record<string, number>;
368
- /** Provider revocations completed, by the route that performed them. */
369
- revocationsByRoute: Record<string, number>;
370
- /** Revocation attempts that failed and were released for retry, by route. */
371
- revocationFailuresByRoute: Record<string, number>;
372
- /** Revocations that had already outlived the advertised window when claimed, by route. */
373
- overdueByRoute: Record<string, number>;
374
- }
375
- /**
376
- * Key for work no delivery route could take. Not a valid route id.
377
- *
378
- * @experimental Reliable Reporting storage surface: breaking changes may ship in minor releases. See https://github.com/adcontextprotocol/adcp-client/blob/main/docs/guides/REPORTING-STABILITY.md
379
- */
380
- export declare const UNROUTED_REPORTING_ROUTE_KEY_V1 = "~unrouted";
381
- /**
382
- * @experimental Reliable Reporting storage surface: breaking changes may ship in minor releases. See https://github.com/adcontextprotocol/adcp-client/blob/main/docs/guides/REPORTING-STABILITY.md
383
- */
384
- export interface ReportingManagedDeliveryWorkerResultV1 extends Partial<ReportingManagedDeliveryRouteCountsV1> {
385
- planned: number;
386
- claimed: number;
387
- delivered: number;
388
- failed: number;
389
- revocationsCompleted: number;
390
- revocationsOverdue: number;
391
- /** Materializations failed for using every delivery attempt. */
392
- exhausted: number;
393
- }
394
- /**
395
- * @experimental Reliable Reporting storage surface: breaking changes may ship in minor releases. See https://github.com/adcontextprotocol/adcp-client/blob/main/docs/guides/REPORTING-STABILITY.md
396
- */
397
- export interface ReportingManagedDeliveryWorkerOptionsV1 {
398
- signal?: AbortSignal;
399
- now?: () => Date;
400
- maxIterations?: number;
401
- leaseMilliseconds?: number;
402
- deliveryDeadlineMilliseconds?: number;
403
- resourceMaxBytes?: number;
404
- /** Capability minimum enforced in addition to each immutable binding. */
405
- minimumResourceRetentionDays?: number;
406
- /**
407
- * Mirror of the advertised `authorization_revocation_seconds`. Supplying it
408
- * makes the scheduler honour the promise instead of merely printing it: a
409
- * cleanup attempt is never given a budget that would run past
410
- * `revoked_at + authorizationRevocationSeconds`, a failed attempt never holds
411
- * a retry lease longer than the whole promised window, and a grant that has
412
- * already outlived the window is counted in `revocationsOverdue` so the
413
- * breach is observable rather than silent. Omit it only for a worker that is
414
- * not backing an advertised capability.
415
- */
416
- authorizationRevocationSeconds?: number;
417
- account_id?: string;
418
- /**
419
- * Loads verified rows for a claimed revision whose rows live in row storage
420
- * rather than in the ledger document. `createReportingManagedDeliveryRuntime`
421
- * supplies one backed by its Core store. PostgreSQL-kind chunks are
422
- * hydrated by the managed store's claim itself; a direct caller whose rows
423
- * live in an external binding must supply this, or the adapter receives a
424
- * revision without rows.
425
- */
426
- hydrateRevision?: (revision: ReportingManagedDeliveryLeaseV1['revision'], account_id: string, signal: AbortSignal | undefined) => Promise<ReportingManagedDeliveryLeaseV1['revision']>;
427
- }
428
- /**
429
- * @experimental Reliable Reporting storage surface: breaking changes may ship in minor releases. See https://github.com/adcontextprotocol/adcp-client/blob/main/docs/guides/REPORTING-STABILITY.md
430
- */
431
- export interface CreateReportingManagedDeliveryRuntimeOptionsV1<TContext extends {
432
- account?: unknown;
433
- } = {
434
- account?: unknown;
435
- }> {
436
- coreStore: ReportingLedgerStore;
437
- /** Exact-revision fallback for revisions the SDK ledger does not hold. */
438
- legacyRevisionReader?: ReportingLegacyRevisionReaderV1;
439
- store: ReportingManagedDeliveryStore & Required<Pick<ReportingManagedDeliveryStore, 'adoptAdvertisedPolicies'>>;
440
- adapter: ReportingManagedDeliveryAdapterV1;
441
- offerings: ReportingDeliveryCapabilities['offerings'];
442
- automatedRecoveryWindowSeconds: number;
443
- statusRetentionDays: number;
444
- resourceRetentionDays: number;
445
- authorizationRevocationSeconds: number;
446
- resolveConsumerId?: (context: TContext) => string | Promise<string>;
447
- consumerMismatchEscalation?: ReportingStatusConsumerScopeOptionsV1<TContext>['consumerMismatchEscalation'];
448
- }
449
- /**
450
- * @experimental Reliable Reporting storage surface: breaking changes may ship in minor releases. See https://github.com/adcontextprotocol/adcp-client/blob/main/docs/guides/REPORTING-STABILITY.md
451
- */
452
- export interface ReportingManagedDeliveryRuntimeV1<TContext extends {
453
- account?: unknown;
454
- } = {
455
- account?: unknown;
456
- }> {
457
- reportingDeliveryCapabilities: ReportingDeliveryCapabilities;
458
- getReportingStatus: ReturnType<typeof createReportingStatusHandler<TContext>>;
459
- getMediaBuyDelivery: ReturnType<typeof createReportingDeliveryHandler>;
460
- syncReportingReceipts?: (request: AdcpToolMap['sync_reporting_receipts']['params'], context: TContext & {
461
- account?: unknown;
462
- }) => Promise<SyncReportingReceiptsResponse>;
463
- runWorker(options?: ReportingManagedDeliveryWorkerOptionsV1): Promise<ReportingManagedDeliveryWorkerResultV1>;
464
- readResource(input: {
465
- account_id: string;
466
- resource_ref: string;
467
- signal?: AbortSignal;
468
- maxBytes?: number;
469
- deadlineMilliseconds?: number;
470
- }): Promise<Uint8Array | null>;
471
- }
472
- /**
473
- * Wires all operational components before returning any Managed Delivery
474
- * capability claim. A missing receipt principal resolver limits the runtime to
475
- * Managed Delivery even if a consumer-receipt offering was supplied.
476
- *
477
- * @experimental Reliable Reporting storage surface: breaking changes may ship in minor releases. See https://github.com/adcontextprotocol/adcp-client/blob/main/docs/guides/REPORTING-STABILITY.md
478
- */
479
- export declare function createReportingManagedDeliveryRuntime<TContext extends {
480
- account?: unknown;
481
- } = {
482
- account?: unknown;
483
- }>(options: CreateReportingManagedDeliveryRuntimeOptionsV1<TContext>): Promise<ReportingManagedDeliveryRuntimeV1<TContext>>;
484
- export declare function createSyncReportingReceiptsHandler<TContext extends {
485
- account?: unknown;
486
- }>(store: ReportingManagedDeliveryStore, resolveConsumerId: (context: TContext) => string | Promise<string>, now?: () => Date): (request: AdcpToolMap["sync_reporting_receipts"]["params"], context: TContext) => Promise<SyncReportingReceiptsResponse>;
487
- /**
488
- * @experimental Reliable Reporting storage surface: breaking changes may ship in minor releases. See https://github.com/adcontextprotocol/adcp-client/blob/main/docs/guides/REPORTING-STABILITY.md
489
- */
490
- export declare function runManagedDeliveryWorker(store: ReportingManagedDeliveryStore, adapter: ReportingManagedDeliveryAdapterV1, options?: ReportingManagedDeliveryWorkerOptionsV1): Promise<ReportingManagedDeliveryWorkerResultV1>;
491
- /**
492
- * @experimental Reliable Reporting storage surface: breaking changes may ship in minor releases. See https://github.com/adcontextprotocol/adcp-client/blob/main/docs/guides/REPORTING-STABILITY.md
493
- */
494
- export declare function readManagedReportingResource(store: ReportingManagedDeliveryStore, adapter: ReportingManagedDeliveryAdapterV1, input: {
495
- account_id: string;
496
- resource_ref: string;
497
- signal?: AbortSignal;
498
- maxBytes?: number;
499
- deadlineMilliseconds?: number;
500
- }): Promise<Uint8Array | null>;
501
- /**
502
- * @experimental Reliable Reporting storage surface: breaking changes may ship in minor releases. See https://github.com/adcontextprotocol/adcp-client/blob/main/docs/guides/REPORTING-STABILITY.md
503
- */
504
- export declare function assertMaterializationOutcome(lease: ReportingManagedDeliveryLeaseV1, outcome: {
505
- status: 'available' | 'delivered';
506
- resource: ReportingResource;
507
- verification: ReportingVerification;
508
- }, now: string, minimumResourceRetentionDays?: number): void;
509
- /**
510
- * @experimental Reliable Reporting storage surface: breaking changes may ship in minor releases. See https://github.com/adcontextprotocol/adcp-client/blob/main/docs/guides/REPORTING-STABILITY.md
511
- */
512
- export declare function receiptEvidenceMatches(receipt: ReportingReceipt, materialization: ReportingMaterialization): boolean;
513
- /**
514
- * @experimental Reliable Reporting storage surface: breaking changes may ship in minor releases. See https://github.com/adcontextprotocol/adcp-client/blob/main/docs/guides/REPORTING-STABILITY.md
515
- */
516
- export declare function adjustmentReceiptEvidenceMatches(receipt: ReportingAdjustmentReceipt, adjustment: ReportingLedgerAdjustmentV1): boolean;
517
- /**
518
- * Refuses a retained resource location that carries credential syntax.
519
- *
520
- * Exported because the worker is not the only way a resource reaches
521
- * storage: a caller driving `settleMaterialization` directly must be held to
522
- * the same rule, or a presigned location is persisted and then published in
523
- * `get_reporting_status`.
524
- *
525
- * @experimental Reliable Reporting storage surface: breaking changes may ship in minor releases. See https://github.com/adcontextprotocol/adcp-client/blob/main/docs/guides/REPORTING-STABILITY.md
526
- */
527
- export declare function assertCredentialFreeReportingResourceLocationV1(location: string): void;
528
- /**
529
- * Stable helper for immutable binding creation.
530
- *
531
- * @experimental Reliable Reporting storage surface: breaking changes may ship in minor releases. See https://github.com/adcontextprotocol/adcp-client/blob/main/docs/guides/REPORTING-STABILITY.md
532
- */
533
- export declare function reportingManagedDeliveryBindingV1(input: Omit<ReportingManagedDeliveryBindingV1, 'created_at' | 'semantic_fingerprint'> & {
534
- created_at?: string;
535
- }): ReportingManagedDeliveryBindingV1;