@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,293 +0,0 @@
1
- import type { ReportingMaterialization, SyncReportingReceiptsResponse } from '../../types/index.mjs';
2
- import type { ReportingPgPool } from './postgres.mjs';
3
- import type { ReportingLedgerNotificationActivityPortV1, ReportingLedgerTransactionV1, ReportingManagedDeliveryBindingV1, ReportingLedgerStore } from './types.mjs';
4
- import { type ReportingObjectWritePlanV1, type ReportingObjectWriteScopeV1, type ReportingObjectWriteCursorV1, type ReportingObjectWriteV1, type ReportingObjectWriteBindingV1, type ReportingObjectWriteContextV1, type ReportingObjectWriteStoreV1, type ReportingObjectWriteAuthorityStoreV1 } from './object-writes.mjs';
5
- import { type ReportingDestinationAuthorizationV1, type ReportingDestinationRevocationLeaseV1, type ReportingManagedDeliveryLeaseV1, type ReportingManagedDeliveryAdvertisedPoliciesV1, type ReportingManagedDeliveryStore, type ReportingReceiptBatchInputV1 } from './managed.mjs';
6
- /**
7
- * Additive migration owned by #2944. It intentionally does not alter the Core
8
- * tables so the #2943 notification/activity bridge can evolve that schema
9
- * independently. Apply after REPORTING_LEDGER_MIGRATION in the same schema.
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_MANAGED_DELIVERY_MIGRATION: string;
14
- /**
15
- * @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
16
- */
17
- export interface PostgresReportingManagedDeliveryStoreOptions {
18
- /** Transactional reporting outbox used for successful delivery-ready events. */
19
- notificationActivityPort?: ReportingLedgerNotificationActivityPortV1<ReportingLedgerTransactionV1>;
20
- /**
21
- * The `automated_recovery_window_seconds` this deployment advertises.
22
- *
23
- * The capability is agent-wide and immutable once published, while bindings
24
- * arrive over time, so validating only at startup leaves the window open:
25
- * an agent advertising 60s starts clean and a 900s binding installed an hour
26
- * later silently makes the published promise false until the next restart.
27
- * Set here, `installBinding` refuses any Core configuration whose recovery
28
- * window exceeds the advertised bound, inside the same transaction that
29
- * checks binding eligibility. `createReportingManagedDeliveryRuntime` adopts
30
- * its own advertised value into the store at wiring time, so setting it
31
- * explicitly is only needed when bindings are installed without a runtime.
32
- */
33
- advertisedRecoveryWindowSeconds?: number;
34
- /**
35
- * The `status_retention_days` this deployment advertises.
36
- *
37
- * Supply it together with `evidenceRetentionDays` so the store can refuse a
38
- * retention shorter than a horizon you have already promised. Pruning
39
- * evidence the capability document still says is queryable is a broken
40
- * promise, not a capacity optimisation.
41
- */
42
- statusRetentionDays?: number;
43
- /**
44
- * Days of managed evidence an account is still accountable for.
45
- *
46
- * MAX_MATERIALIZATIONS_PER_ACCOUNT and MAX_RECEIPTS_PER_CONSUMER are
47
- * lifetime counts. Left unbounded they are a one-way door: a long-lived
48
- * account eventually reaches them and then stops planning materializations
49
- * and refuses every receipt, permanently, with no operator-visible way back
50
- * — evidence is immutable, so nothing ever frees capacity.
51
- *
52
- * Setting this makes the caps active-scope: only evidence recorded inside
53
- * the window counts against them, and `pruneExpiredEvidence` can delete what
54
- * falls outside it. Choose a value at least as long as the
55
- * `status_retention_days` you advertise, since that is the period you
56
- * promised the metadata stays queryable. Omit it to keep the previous
57
- * lifetime accounting with no pruning.
58
- */
59
- evidenceRetentionDays?: number;
60
- }
61
- /**
62
- * @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
63
- */
64
- export declare class PostgresReportingManagedDeliveryStore implements ReportingManagedDeliveryStore, ReportingObjectWriteStoreV1, ReportingObjectWriteAuthorityStoreV1 {
65
- private readonly pool;
66
- private readonly evidenceRetentionDays;
67
- private readonly statusRetentionDays;
68
- private readonly pendingRecoveryWindowSeconds;
69
- private policyRegistered;
70
- private bindingAdmission;
71
- private readonly notificationActivityPort?;
72
- /**
73
- * Durably records the agent-wide advertised recovery window.
74
- *
75
- * Written to the database, not held in memory: the promise is agent-wide,
76
- * so a second store instance — in this process or another replica — must be
77
- * held to the same value, and `installBinding` must read it inside its own
78
- * transaction rather than trusting whatever the local object happens to
79
- * know. Multiple replicas monotonically retain the smallest registered
80
- * maximum: a shorter recovery promise is stronger and can never be widened
81
- * by a later runtime.
82
- */
83
- adoptAdvertisedRecoveryWindowSeconds(seconds: number): Promise<void>;
84
- /**
85
- * Durably records the advertised `status_retention_days`.
86
- *
87
- * Retention is enforced against the widest promise any runtime registered
88
- * over this database, so a store configured with a short evidence retention
89
- * cannot prune inside a horizon a differently configured runtime published.
90
- */
91
- adoptAdvertisedStatusRetentionDays(days: number): Promise<void>;
92
- /** Registers the complete capability policy under one lock and transaction. */
93
- adoptAdvertisedPolicies(policy: ReportingManagedDeliveryAdvertisedPoliciesV1): Promise<ReportingManagedDeliveryAdvertisedPoliciesV1>;
94
- /**
95
- * Flushes constructor-supplied promises into the durable registry.
96
- *
97
- * Called from every entry point that depends on them, so a store built with
98
- * options behaves identically to one a runtime adopted into.
99
- */
100
- private ensurePolicyRegistered;
101
- private upsertPolicy;
102
- private upsertPolicies;
103
- private validateRecoveryWindow;
104
- private readPolicyRow;
105
- private readPolicy;
106
- /** Read-only access to PostgreSQL row chunks for claim hydration. */
107
- private readonly rowStorage;
108
- constructor(pool: ReportingPgPool, options?: PostgresReportingManagedDeliveryStoreOptions);
109
- /** SQL fragment scoping a count to the active retention window, if one is set. */
110
- private activeScope;
111
- /**
112
- * Deletes managed evidence that has aged out of `evidenceRetentionDays`.
113
- *
114
- * Only ever removes evidence the deployment no longer promises: nothing
115
- * inside the retention window, nothing still `pending` or leased, and no
116
- * receipt batch inside its own replay retention. Immutable evidence stays
117
- * immutable while it is retained — this frees capacity at the far end of the
118
- * window rather than rewriting anything. Returns what it removed so a
119
- * scheduler can page through with `limit`.
120
- */
121
- pruneExpiredEvidence(input: {
122
- account_id: string;
123
- limit?: number;
124
- }): Promise<{
125
- materializations: number;
126
- receipts: number;
127
- batches: number;
128
- }>;
129
- probe(coreStore: ReportingLedgerStore): Promise<boolean>;
130
- listInstalledRecoveryWindowSeconds(): Promise<number[]>;
131
- authorizeDestination(input: Omit<ReportingDestinationAuthorizationV1, 'revoked_at' | 'cleanup_completed_at'>): Promise<void>;
132
- revokeDestination(input: {
133
- account_id: string;
134
- destination_ref: string;
135
- generation: number;
136
- revoked_at: string;
137
- }): Promise<boolean>;
138
- setBindingAdmission(admit: ((binding: ReportingManagedDeliveryBindingV1) => void) | undefined): void;
139
- installBinding(binding: ReportingManagedDeliveryBindingV1): Promise<{
140
- inserted: boolean;
141
- }>;
142
- planMaterializations(input?: {
143
- account_id?: string;
144
- limit?: number;
145
- }): Promise<number>;
146
- /**
147
- * Claims a bounded, durable round-robin page of accounts that currently
148
- * have at least one materialization candidate.
149
- *
150
- * The policy row serializes only the final cursor compare-and-set. Eligible
151
- * account discovery runs without that global lock so retained revision
152
- * history cannot block materialization settlement or revocation. The cursor
153
- * advances before provider work; a crash may defer a selected account until
154
- * the ring wraps, but can never pin every future sweep behind it.
155
- */
156
- private claimMaterializationPlanningAccounts;
157
- claimMaterialization(input: {
158
- owner: string;
159
- now: string;
160
- lease_milliseconds: number;
161
- account_id?: string;
162
- }): Promise<ReportingManagedDeliveryLeaseV1 | null>;
163
- /**
164
- * Fails materializations that have used every delivery attempt.
165
- *
166
- * The claim predicate stops handing them out, so without this they would
167
- * stay `pending` — invisible to the planner, which skips an obligation with
168
- * any pending row, and so never retried or replanned.
169
- */
170
- failExhaustedMaterializations(input?: {
171
- account_id?: string;
172
- limit?: number;
173
- }): Promise<number>;
174
- settleMaterialization(input: {
175
- lease: ReportingManagedDeliveryLeaseV1;
176
- now: string;
177
- /** Retention the database must see satisfied, not just the worker. */
178
- minimum_resource_retention_days?: number;
179
- outcome: {
180
- status: 'available' | 'delivered';
181
- resource: NonNullable<ReportingMaterialization['resource']>;
182
- verification: NonNullable<ReportingMaterialization['verification']>;
183
- } | {
184
- status: 'failed';
185
- failure_code: string;
186
- };
187
- }): Promise<boolean>;
188
- claimRevocation(input: {
189
- owner: string;
190
- now: string;
191
- lease_milliseconds: number;
192
- account_id?: string;
193
- authorization_revocation_seconds?: number;
194
- steal_after_milliseconds?: number;
195
- }): Promise<ReportingDestinationRevocationLeaseV1 | null>;
196
- completeRevocation(input: {
197
- lease: ReportingDestinationRevocationLeaseV1;
198
- completed_at: string;
199
- }): Promise<boolean>;
200
- releaseRevocation(input: {
201
- lease: ReportingDestinationRevocationLeaseV1;
202
- backoff_milliseconds?: number;
203
- }): Promise<boolean>;
204
- getReadableResource(input: {
205
- account_id: string;
206
- resource_ref: string;
207
- }): Promise<{
208
- materialization: {
209
- reporting_materialization_id: string;
210
- reporting_revision_id: string;
211
- reporting_obligation_id: string;
212
- delivery_config_id: string;
213
- delivery_config_version: number;
214
- destination_ref: string;
215
- feed_purpose: import("../../types/tools.generated.mjs").ReportingFeedPurpose;
216
- method: "file_transfer" | "dataset_share" | "warehouse_materialization";
217
- transport?: string;
218
- attempt: number;
219
- status: "pending" | "available" | "delivered" | "failed";
220
- ready_at?: string;
221
- failed_at?: string;
222
- failure_code?: string;
223
- resource?: import("../../types/index.mjs").ReportingResource;
224
- verification?: import("../../types/index.mjs").ReportingVerification;
225
- created_at: string;
226
- };
227
- binding: ReportingManagedDeliveryBindingV1;
228
- } | null>;
229
- /** Freeze all writable names under the same locks as revokeDestination. */
230
- registerObjectWritePlan(input: ReportingObjectWritePlanV1, context?: ReportingObjectWriteContextV1): Promise<'registered' | 'unchanged' | 'revoked'>;
231
- listRevokedObjectWrites(inputScope: ReportingObjectWriteScopeV1, inputOptions?: {
232
- after?: ReportingObjectWriteCursorV1;
233
- limit?: number;
234
- }, context?: ReportingObjectWriteContextV1): Promise<Array<ReportingObjectWriteV1 & ReportingObjectWriteCursorV1>>;
235
- markObjectWriteFenced(input: ReportingObjectWriteScopeV1 & ReportingObjectWriteCursorV1 & {
236
- tombstone_generation: string;
237
- }, context?: ReportingObjectWriteContextV1): Promise<void>;
238
- getObjectWriteBinding(input: ReportingObjectWriteScopeV1, context?: ReportingObjectWriteContextV1): Promise<ReportingObjectWriteBindingV1 | null>;
239
- probeObjectWriteAuthority(context?: ReportingObjectWriteContextV1): Promise<boolean>;
240
- getObjectWriteAuthorityId(context?: ReportingObjectWriteContextV1): Promise<string>;
241
- getAuthorizedObjectWriteBinding(input: ReportingObjectWriteScopeV1, context?: ReportingObjectWriteContextV1): Promise<ReportingObjectWriteBindingV1 | null>;
242
- getObjectWritePlan(input: ReportingObjectWriteScopeV1, planId: string, context?: ReportingObjectWriteContextV1): Promise<ReportingObjectWritePlanV1 | null>;
243
- /**
244
- * Generations that carry no recorded pattern/transport, with why the
245
- * migration backfill could not infer them. These are routed to a router's
246
- * `legacyDefault` (or fail revocation with a typed error) until the host
247
- * supplies the contract. Read-only; it never edits a row.
248
- *
249
- * `no_binding`: nothing to infer from. `binding_without_transport`: at least
250
- * one binding names no transport. `bindings_disagree`: the bindings name
251
- * different methods or transports. `not_recorded`: the bindings agree, but
252
- * the generation was created without a contract after the one-time backfill
253
- * ran, so nothing records it.
254
- */
255
- listDestinationAuthorizationsWithoutContract(input?: {
256
- account_id?: string;
257
- limit?: number;
258
- }): Promise<Array<{
259
- account_id: string;
260
- destination_ref: string;
261
- generation: number;
262
- reason: 'no_binding' | 'binding_without_transport' | 'bindings_disagree' | 'not_recorded';
263
- }>>;
264
- isAuthorizationCurrent(input: {
265
- account_id: string;
266
- destination_ref: string;
267
- generation: number;
268
- }): Promise<boolean>;
269
- syncReceiptBatch(input: ReportingReceiptBatchInputV1): Promise<SyncReportingReceiptsResponse['results']>;
270
- /**
271
- * Rebuilds a prior batch response from the compact replay record plus the
272
- * append-only receipt rows, re-checking authorization exactly as the first
273
- * call did so a revoked destination cannot be replayed back into disclosure.
274
- */
275
- /**
276
- * Replays a prior batch response exactly.
277
- *
278
- * An exact same-key replay is side-effect free and returns the caller its own
279
- * previously recorded verdict, so later revocation of the destination does
280
- * not change it. Downgrading a replay to `failed` once authorization ended
281
- * broke the protocol-wide rule that a replayed idempotency key returns the
282
- * same response, and bought nothing: the body is the caller's own receipt
283
- * echoed back with the verdict it already received, so a revoked caller
284
- * learns nothing it did not already hold. Fail-closed still governs every
285
- * path that *accepts* new evidence — `loadReceiptEvidence` joins
286
- * `revoked_at IS NULL` — and nothing here reads another consumer's rows.
287
- */
288
- private replayReceiptBatch;
289
- private recordReceipt;
290
- private loadReceiptEvidence;
291
- private transaction;
292
- private query;
293
- }
@@ -1,293 +0,0 @@
1
- import type { ReportingMaterialization, SyncReportingReceiptsResponse } from '../../types';
2
- import type { ReportingPgPool } from './postgres';
3
- import type { ReportingLedgerNotificationActivityPortV1, ReportingLedgerTransactionV1, ReportingManagedDeliveryBindingV1, ReportingLedgerStore } from './types';
4
- import { type ReportingObjectWritePlanV1, type ReportingObjectWriteScopeV1, type ReportingObjectWriteCursorV1, type ReportingObjectWriteV1, type ReportingObjectWriteBindingV1, type ReportingObjectWriteContextV1, type ReportingObjectWriteStoreV1, type ReportingObjectWriteAuthorityStoreV1 } from './object-writes';
5
- import { type ReportingDestinationAuthorizationV1, type ReportingDestinationRevocationLeaseV1, type ReportingManagedDeliveryLeaseV1, type ReportingManagedDeliveryAdvertisedPoliciesV1, type ReportingManagedDeliveryStore, type ReportingReceiptBatchInputV1 } from './managed';
6
- /**
7
- * Additive migration owned by #2944. It intentionally does not alter the Core
8
- * tables so the #2943 notification/activity bridge can evolve that schema
9
- * independently. Apply after REPORTING_LEDGER_MIGRATION in the same schema.
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_MANAGED_DELIVERY_MIGRATION: string;
14
- /**
15
- * @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
16
- */
17
- export interface PostgresReportingManagedDeliveryStoreOptions {
18
- /** Transactional reporting outbox used for successful delivery-ready events. */
19
- notificationActivityPort?: ReportingLedgerNotificationActivityPortV1<ReportingLedgerTransactionV1>;
20
- /**
21
- * The `automated_recovery_window_seconds` this deployment advertises.
22
- *
23
- * The capability is agent-wide and immutable once published, while bindings
24
- * arrive over time, so validating only at startup leaves the window open:
25
- * an agent advertising 60s starts clean and a 900s binding installed an hour
26
- * later silently makes the published promise false until the next restart.
27
- * Set here, `installBinding` refuses any Core configuration whose recovery
28
- * window exceeds the advertised bound, inside the same transaction that
29
- * checks binding eligibility. `createReportingManagedDeliveryRuntime` adopts
30
- * its own advertised value into the store at wiring time, so setting it
31
- * explicitly is only needed when bindings are installed without a runtime.
32
- */
33
- advertisedRecoveryWindowSeconds?: number;
34
- /**
35
- * The `status_retention_days` this deployment advertises.
36
- *
37
- * Supply it together with `evidenceRetentionDays` so the store can refuse a
38
- * retention shorter than a horizon you have already promised. Pruning
39
- * evidence the capability document still says is queryable is a broken
40
- * promise, not a capacity optimisation.
41
- */
42
- statusRetentionDays?: number;
43
- /**
44
- * Days of managed evidence an account is still accountable for.
45
- *
46
- * MAX_MATERIALIZATIONS_PER_ACCOUNT and MAX_RECEIPTS_PER_CONSUMER are
47
- * lifetime counts. Left unbounded they are a one-way door: a long-lived
48
- * account eventually reaches them and then stops planning materializations
49
- * and refuses every receipt, permanently, with no operator-visible way back
50
- * — evidence is immutable, so nothing ever frees capacity.
51
- *
52
- * Setting this makes the caps active-scope: only evidence recorded inside
53
- * the window counts against them, and `pruneExpiredEvidence` can delete what
54
- * falls outside it. Choose a value at least as long as the
55
- * `status_retention_days` you advertise, since that is the period you
56
- * promised the metadata stays queryable. Omit it to keep the previous
57
- * lifetime accounting with no pruning.
58
- */
59
- evidenceRetentionDays?: number;
60
- }
61
- /**
62
- * @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
63
- */
64
- export declare class PostgresReportingManagedDeliveryStore implements ReportingManagedDeliveryStore, ReportingObjectWriteStoreV1, ReportingObjectWriteAuthorityStoreV1 {
65
- private readonly pool;
66
- private readonly evidenceRetentionDays;
67
- private readonly statusRetentionDays;
68
- private readonly pendingRecoveryWindowSeconds;
69
- private policyRegistered;
70
- private bindingAdmission;
71
- private readonly notificationActivityPort?;
72
- /**
73
- * Durably records the agent-wide advertised recovery window.
74
- *
75
- * Written to the database, not held in memory: the promise is agent-wide,
76
- * so a second store instance — in this process or another replica — must be
77
- * held to the same value, and `installBinding` must read it inside its own
78
- * transaction rather than trusting whatever the local object happens to
79
- * know. Multiple replicas monotonically retain the smallest registered
80
- * maximum: a shorter recovery promise is stronger and can never be widened
81
- * by a later runtime.
82
- */
83
- adoptAdvertisedRecoveryWindowSeconds(seconds: number): Promise<void>;
84
- /**
85
- * Durably records the advertised `status_retention_days`.
86
- *
87
- * Retention is enforced against the widest promise any runtime registered
88
- * over this database, so a store configured with a short evidence retention
89
- * cannot prune inside a horizon a differently configured runtime published.
90
- */
91
- adoptAdvertisedStatusRetentionDays(days: number): Promise<void>;
92
- /** Registers the complete capability policy under one lock and transaction. */
93
- adoptAdvertisedPolicies(policy: ReportingManagedDeliveryAdvertisedPoliciesV1): Promise<ReportingManagedDeliveryAdvertisedPoliciesV1>;
94
- /**
95
- * Flushes constructor-supplied promises into the durable registry.
96
- *
97
- * Called from every entry point that depends on them, so a store built with
98
- * options behaves identically to one a runtime adopted into.
99
- */
100
- private ensurePolicyRegistered;
101
- private upsertPolicy;
102
- private upsertPolicies;
103
- private validateRecoveryWindow;
104
- private readPolicyRow;
105
- private readPolicy;
106
- /** Read-only access to PostgreSQL row chunks for claim hydration. */
107
- private readonly rowStorage;
108
- constructor(pool: ReportingPgPool, options?: PostgresReportingManagedDeliveryStoreOptions);
109
- /** SQL fragment scoping a count to the active retention window, if one is set. */
110
- private activeScope;
111
- /**
112
- * Deletes managed evidence that has aged out of `evidenceRetentionDays`.
113
- *
114
- * Only ever removes evidence the deployment no longer promises: nothing
115
- * inside the retention window, nothing still `pending` or leased, and no
116
- * receipt batch inside its own replay retention. Immutable evidence stays
117
- * immutable while it is retained — this frees capacity at the far end of the
118
- * window rather than rewriting anything. Returns what it removed so a
119
- * scheduler can page through with `limit`.
120
- */
121
- pruneExpiredEvidence(input: {
122
- account_id: string;
123
- limit?: number;
124
- }): Promise<{
125
- materializations: number;
126
- receipts: number;
127
- batches: number;
128
- }>;
129
- probe(coreStore: ReportingLedgerStore): Promise<boolean>;
130
- listInstalledRecoveryWindowSeconds(): Promise<number[]>;
131
- authorizeDestination(input: Omit<ReportingDestinationAuthorizationV1, 'revoked_at' | 'cleanup_completed_at'>): Promise<void>;
132
- revokeDestination(input: {
133
- account_id: string;
134
- destination_ref: string;
135
- generation: number;
136
- revoked_at: string;
137
- }): Promise<boolean>;
138
- setBindingAdmission(admit: ((binding: ReportingManagedDeliveryBindingV1) => void) | undefined): void;
139
- installBinding(binding: ReportingManagedDeliveryBindingV1): Promise<{
140
- inserted: boolean;
141
- }>;
142
- planMaterializations(input?: {
143
- account_id?: string;
144
- limit?: number;
145
- }): Promise<number>;
146
- /**
147
- * Claims a bounded, durable round-robin page of accounts that currently
148
- * have at least one materialization candidate.
149
- *
150
- * The policy row serializes only the final cursor compare-and-set. Eligible
151
- * account discovery runs without that global lock so retained revision
152
- * history cannot block materialization settlement or revocation. The cursor
153
- * advances before provider work; a crash may defer a selected account until
154
- * the ring wraps, but can never pin every future sweep behind it.
155
- */
156
- private claimMaterializationPlanningAccounts;
157
- claimMaterialization(input: {
158
- owner: string;
159
- now: string;
160
- lease_milliseconds: number;
161
- account_id?: string;
162
- }): Promise<ReportingManagedDeliveryLeaseV1 | null>;
163
- /**
164
- * Fails materializations that have used every delivery attempt.
165
- *
166
- * The claim predicate stops handing them out, so without this they would
167
- * stay `pending` — invisible to the planner, which skips an obligation with
168
- * any pending row, and so never retried or replanned.
169
- */
170
- failExhaustedMaterializations(input?: {
171
- account_id?: string;
172
- limit?: number;
173
- }): Promise<number>;
174
- settleMaterialization(input: {
175
- lease: ReportingManagedDeliveryLeaseV1;
176
- now: string;
177
- /** Retention the database must see satisfied, not just the worker. */
178
- minimum_resource_retention_days?: number;
179
- outcome: {
180
- status: 'available' | 'delivered';
181
- resource: NonNullable<ReportingMaterialization['resource']>;
182
- verification: NonNullable<ReportingMaterialization['verification']>;
183
- } | {
184
- status: 'failed';
185
- failure_code: string;
186
- };
187
- }): Promise<boolean>;
188
- claimRevocation(input: {
189
- owner: string;
190
- now: string;
191
- lease_milliseconds: number;
192
- account_id?: string;
193
- authorization_revocation_seconds?: number;
194
- steal_after_milliseconds?: number;
195
- }): Promise<ReportingDestinationRevocationLeaseV1 | null>;
196
- completeRevocation(input: {
197
- lease: ReportingDestinationRevocationLeaseV1;
198
- completed_at: string;
199
- }): Promise<boolean>;
200
- releaseRevocation(input: {
201
- lease: ReportingDestinationRevocationLeaseV1;
202
- backoff_milliseconds?: number;
203
- }): Promise<boolean>;
204
- getReadableResource(input: {
205
- account_id: string;
206
- resource_ref: string;
207
- }): Promise<{
208
- materialization: {
209
- reporting_materialization_id: string;
210
- reporting_revision_id: string;
211
- reporting_obligation_id: string;
212
- delivery_config_id: string;
213
- delivery_config_version: number;
214
- destination_ref: string;
215
- feed_purpose: import("../../types/tools.generated").ReportingFeedPurpose;
216
- method: "file_transfer" | "dataset_share" | "warehouse_materialization";
217
- transport?: string;
218
- attempt: number;
219
- status: "pending" | "available" | "delivered" | "failed";
220
- ready_at?: string;
221
- failed_at?: string;
222
- failure_code?: string;
223
- resource?: import("../../types").ReportingResource;
224
- verification?: import("../../types").ReportingVerification;
225
- created_at: string;
226
- };
227
- binding: ReportingManagedDeliveryBindingV1;
228
- } | null>;
229
- /** Freeze all writable names under the same locks as revokeDestination. */
230
- registerObjectWritePlan(input: ReportingObjectWritePlanV1, context?: ReportingObjectWriteContextV1): Promise<'registered' | 'unchanged' | 'revoked'>;
231
- listRevokedObjectWrites(inputScope: ReportingObjectWriteScopeV1, inputOptions?: {
232
- after?: ReportingObjectWriteCursorV1;
233
- limit?: number;
234
- }, context?: ReportingObjectWriteContextV1): Promise<Array<ReportingObjectWriteV1 & ReportingObjectWriteCursorV1>>;
235
- markObjectWriteFenced(input: ReportingObjectWriteScopeV1 & ReportingObjectWriteCursorV1 & {
236
- tombstone_generation: string;
237
- }, context?: ReportingObjectWriteContextV1): Promise<void>;
238
- getObjectWriteBinding(input: ReportingObjectWriteScopeV1, context?: ReportingObjectWriteContextV1): Promise<ReportingObjectWriteBindingV1 | null>;
239
- probeObjectWriteAuthority(context?: ReportingObjectWriteContextV1): Promise<boolean>;
240
- getObjectWriteAuthorityId(context?: ReportingObjectWriteContextV1): Promise<string>;
241
- getAuthorizedObjectWriteBinding(input: ReportingObjectWriteScopeV1, context?: ReportingObjectWriteContextV1): Promise<ReportingObjectWriteBindingV1 | null>;
242
- getObjectWritePlan(input: ReportingObjectWriteScopeV1, planId: string, context?: ReportingObjectWriteContextV1): Promise<ReportingObjectWritePlanV1 | null>;
243
- /**
244
- * Generations that carry no recorded pattern/transport, with why the
245
- * migration backfill could not infer them. These are routed to a router's
246
- * `legacyDefault` (or fail revocation with a typed error) until the host
247
- * supplies the contract. Read-only; it never edits a row.
248
- *
249
- * `no_binding`: nothing to infer from. `binding_without_transport`: at least
250
- * one binding names no transport. `bindings_disagree`: the bindings name
251
- * different methods or transports. `not_recorded`: the bindings agree, but
252
- * the generation was created without a contract after the one-time backfill
253
- * ran, so nothing records it.
254
- */
255
- listDestinationAuthorizationsWithoutContract(input?: {
256
- account_id?: string;
257
- limit?: number;
258
- }): Promise<Array<{
259
- account_id: string;
260
- destination_ref: string;
261
- generation: number;
262
- reason: 'no_binding' | 'binding_without_transport' | 'bindings_disagree' | 'not_recorded';
263
- }>>;
264
- isAuthorizationCurrent(input: {
265
- account_id: string;
266
- destination_ref: string;
267
- generation: number;
268
- }): Promise<boolean>;
269
- syncReceiptBatch(input: ReportingReceiptBatchInputV1): Promise<SyncReportingReceiptsResponse['results']>;
270
- /**
271
- * Rebuilds a prior batch response from the compact replay record plus the
272
- * append-only receipt rows, re-checking authorization exactly as the first
273
- * call did so a revoked destination cannot be replayed back into disclosure.
274
- */
275
- /**
276
- * Replays a prior batch response exactly.
277
- *
278
- * An exact same-key replay is side-effect free and returns the caller its own
279
- * previously recorded verdict, so later revocation of the destination does
280
- * not change it. Downgrading a replay to `failed` once authorization ended
281
- * broke the protocol-wide rule that a replayed idempotency key returns the
282
- * same response, and bought nothing: the body is the caller's own receipt
283
- * echoed back with the verdict it already received, so a revoked caller
284
- * learns nothing it did not already hold. Fail-closed still governs every
285
- * path that *accepts* new evidence — `loadReceiptEvidence` joins
286
- * `revoked_at IS NULL` — and nothing here reads another consumer's rows.
287
- */
288
- private replayReceiptBatch;
289
- private recordReceipt;
290
- private loadReceiptEvidence;
291
- private transaction;
292
- private query;
293
- }