@adcp/sdk 16.0.0-beta.3 → 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 (182) hide show
  1. package/dist/lib/auth/oauth/diagnose.js +3 -11
  2. package/dist/lib/auth/oauth/diagnose.mjs +4 -12
  3. package/dist/lib/auth/oauth/diagnostics.d.mts +2 -1
  4. package/dist/lib/auth/oauth/diagnostics.d.ts +2 -1
  5. package/dist/lib/auth/oauth/diagnostics.js +8 -10
  6. package/dist/lib/auth/oauth/diagnostics.mjs +7 -10
  7. package/dist/lib/index.d.mts +1 -1
  8. package/dist/lib/index.d.ts +1 -1
  9. package/dist/lib/index.js +2 -0
  10. package/dist/lib/index.mjs +7 -1
  11. package/dist/lib/reporting/consumer-runtime.js +2 -1
  12. package/dist/lib/reporting/consumer-runtime.mjs +2 -1
  13. package/dist/lib/reporting/ledger/handler.js +50 -11
  14. package/dist/lib/reporting/ledger/handler.mjs +50 -12
  15. package/dist/lib/reporting/ledger/index.d.mts +17 -14
  16. package/dist/lib/reporting/ledger/index.d.ts +17 -14
  17. package/dist/lib/reporting/ledger/index.js +32 -20
  18. package/dist/lib/reporting/ledger/index.mjs +21 -10
  19. package/dist/lib/reporting/ledger/offering-validation.d.mts +9 -0
  20. package/dist/lib/reporting/ledger/offering-validation.d.ts +9 -0
  21. package/dist/lib/reporting/{gcs/bucket-policy.js → ledger/offering-validation.js} +9 -8
  22. package/dist/lib/reporting/ledger/offering-validation.mjs +8 -0
  23. package/dist/lib/reporting/ledger/receipts.d.mts +48 -0
  24. package/dist/lib/reporting/ledger/receipts.d.ts +48 -0
  25. package/dist/lib/reporting/ledger/receipts.js +186 -0
  26. package/dist/lib/reporting/ledger/receipts.mjs +161 -0
  27. package/dist/lib/reporting/ledger/status-ingest.js +3 -3
  28. package/dist/lib/reporting/ledger/status-ingest.mjs +4 -5
  29. package/dist/lib/reporting/ledger/types.d.mts +43 -0
  30. package/dist/lib/reporting/ledger/types.d.ts +43 -0
  31. package/dist/lib/reporting/ledger/types.js +31 -2
  32. package/dist/lib/reporting/ledger/types.mjs +26 -1
  33. package/dist/lib/reporting/pagination.d.mts +6 -0
  34. package/dist/lib/reporting/pagination.d.ts +6 -0
  35. package/dist/lib/reporting/{gcs/errors.js → pagination.js} +12 -17
  36. package/dist/lib/reporting/pagination.mjs +12 -0
  37. package/dist/lib/reporting/reconciliation.d.mts +1 -0
  38. package/dist/lib/reporting/reconciliation.d.ts +1 -0
  39. package/dist/lib/reporting/reconciliation.js +3 -2
  40. package/dist/lib/reporting/reconciliation.mjs +3 -2
  41. package/dist/lib/reporting/service/index.d.mts +79 -153
  42. package/dist/lib/reporting/service/index.d.ts +79 -153
  43. package/dist/lib/reporting/service/index.js +34 -491
  44. package/dist/lib/reporting/service/index.mjs +36 -510
  45. package/dist/lib/reporting/service/scheduler-support.d.mts +43 -0
  46. package/dist/lib/reporting/service/scheduler-support.d.ts +43 -0
  47. package/dist/lib/reporting/service/scheduler-support.js +125 -0
  48. package/dist/lib/reporting/service/scheduler-support.mjs +96 -0
  49. package/dist/lib/schemas-data/v2.5/_provenance.json +1 -1
  50. package/dist/lib/signing/canonicalize.d.mts +4 -0
  51. package/dist/lib/signing/canonicalize.d.ts +4 -0
  52. package/dist/lib/signing/canonicalize.js +14 -8
  53. package/dist/lib/signing/canonicalize.mjs +14 -8
  54. package/dist/lib/signing/content-digest.d.mts +8 -0
  55. package/dist/lib/signing/content-digest.d.ts +8 -0
  56. package/dist/lib/signing/content-digest.js +11 -5
  57. package/dist/lib/signing/content-digest.mjs +10 -5
  58. package/dist/lib/signing/signer.js +9 -6
  59. package/dist/lib/signing/signer.mjs +10 -7
  60. package/dist/lib/signing/web-bot-auth.js +103 -37
  61. package/dist/lib/signing/web-bot-auth.mjs +108 -37
  62. package/dist/lib/testing/storyboard/junit.js +16 -3
  63. package/dist/lib/testing/storyboard/junit.mjs +16 -3
  64. package/dist/lib/testing/storyboard/request-signing/builder.js +10 -9
  65. package/dist/lib/testing/storyboard/request-signing/builder.mjs +10 -9
  66. package/dist/lib/testing/storyboard/runner.js +94 -25
  67. package/dist/lib/testing/storyboard/runner.mjs +94 -25
  68. package/dist/lib/testing/storyboard/types.d.mts +6 -0
  69. package/dist/lib/testing/storyboard/types.d.ts +6 -0
  70. package/dist/lib/testing/storyboard/validations.d.mts +1 -1
  71. package/dist/lib/testing/storyboard/validations.d.ts +1 -1
  72. package/dist/lib/version.d.mts +3 -3
  73. package/dist/lib/version.d.ts +3 -3
  74. package/dist/lib/version.js +3 -3
  75. package/dist/lib/version.mjs +3 -3
  76. package/docs/TYPE-SUMMARY.md +23 -5
  77. package/docs/guides/REPORTING-GCS-FENCE.md +3 -3
  78. package/docs/guides/REPORTING-GCS-MANAGED.md +4 -4
  79. package/docs/guides/REPORTING-LEDGER-CUTOVER.md +7 -7
  80. package/docs/guides/REPORTING-LEDGER.md +107 -51
  81. package/docs/guides/REPORTING-OPERATIONS.md +66 -5
  82. package/docs/guides/REPORTING-STABILITY.md +36 -32
  83. package/docs/llms.txt +4 -3
  84. package/docs/migration-14.x-rc-worksheet.md +4 -7
  85. package/docs/migration-reporting-storage-package.md +186 -0
  86. package/examples/README.md +1 -1
  87. package/package.json +13 -78
  88. package/dist/lib/reporting/azure/index.d.mts +0 -31
  89. package/dist/lib/reporting/azure/index.d.ts +0 -31
  90. package/dist/lib/reporting/azure/index.js +0 -266
  91. package/dist/lib/reporting/azure/index.mjs +0 -249
  92. package/dist/lib/reporting/bigquery/index.d.mts +0 -246
  93. package/dist/lib/reporting/bigquery/index.d.ts +0 -246
  94. package/dist/lib/reporting/bigquery/index.js +0 -633
  95. package/dist/lib/reporting/bigquery/index.mjs +0 -594
  96. package/dist/lib/reporting/gcs/adapter.d.mts +0 -38
  97. package/dist/lib/reporting/gcs/adapter.d.ts +0 -38
  98. package/dist/lib/reporting/gcs/adapter.js +0 -342
  99. package/dist/lib/reporting/gcs/adapter.mjs +0 -325
  100. package/dist/lib/reporting/gcs/bucket-policy.d.mts +0 -3
  101. package/dist/lib/reporting/gcs/bucket-policy.d.ts +0 -3
  102. package/dist/lib/reporting/gcs/bucket-policy.mjs +0 -7
  103. package/dist/lib/reporting/gcs/errors.d.mts +0 -11
  104. package/dist/lib/reporting/gcs/errors.d.ts +0 -11
  105. package/dist/lib/reporting/gcs/errors.mjs +0 -16
  106. package/dist/lib/reporting/gcs/fence.d.mts +0 -41
  107. package/dist/lib/reporting/gcs/fence.d.ts +0 -41
  108. package/dist/lib/reporting/gcs/fence.js +0 -250
  109. package/dist/lib/reporting/gcs/fence.mjs +0 -230
  110. package/dist/lib/reporting/gcs/index.d.mts +0 -18
  111. package/dist/lib/reporting/gcs/index.d.ts +0 -18
  112. package/dist/lib/reporting/gcs/index.js +0 -44
  113. package/dist/lib/reporting/gcs/index.mjs +0 -14
  114. package/dist/lib/reporting/gcs/io.d.mts +0 -7
  115. package/dist/lib/reporting/gcs/io.d.ts +0 -7
  116. package/dist/lib/reporting/gcs/io.js +0 -95
  117. package/dist/lib/reporting/gcs/io.mjs +0 -69
  118. package/dist/lib/reporting/gcs/reader.d.mts +0 -67
  119. package/dist/lib/reporting/gcs/reader.d.ts +0 -67
  120. package/dist/lib/reporting/gcs/reader.js +0 -193
  121. package/dist/lib/reporting/gcs/reader.mjs +0 -169
  122. package/dist/lib/reporting/gcs/row-provider.d.mts +0 -39
  123. package/dist/lib/reporting/gcs/row-provider.d.ts +0 -39
  124. package/dist/lib/reporting/gcs/row-provider.js +0 -225
  125. package/dist/lib/reporting/gcs/row-provider.mjs +0 -208
  126. package/dist/lib/reporting/gcs/validation.d.mts +0 -5
  127. package/dist/lib/reporting/gcs/validation.d.ts +0 -5
  128. package/dist/lib/reporting/gcs/validation.js +0 -49
  129. package/dist/lib/reporting/gcs/validation.mjs +0 -25
  130. package/dist/lib/reporting/ledger/change-feed.d.mts +0 -69
  131. package/dist/lib/reporting/ledger/change-feed.d.ts +0 -69
  132. package/dist/lib/reporting/ledger/change-feed.js +0 -107
  133. package/dist/lib/reporting/ledger/change-feed.mjs +0 -80
  134. package/dist/lib/reporting/ledger/managed-postgres.d.mts +0 -293
  135. package/dist/lib/reporting/ledger/managed-postgres.d.ts +0 -293
  136. package/dist/lib/reporting/ledger/managed-postgres.js +0 -2346
  137. package/dist/lib/reporting/ledger/managed-postgres.mjs +0 -2332
  138. package/dist/lib/reporting/ledger/managed-router.d.mts +0 -148
  139. package/dist/lib/reporting/ledger/managed-router.d.ts +0 -148
  140. package/dist/lib/reporting/ledger/managed-router.js +0 -280
  141. package/dist/lib/reporting/ledger/managed-router.mjs +0 -258
  142. package/dist/lib/reporting/ledger/managed.d.mts +0 -535
  143. package/dist/lib/reporting/ledger/managed.d.ts +0 -535
  144. package/dist/lib/reporting/ledger/managed.js +0 -761
  145. package/dist/lib/reporting/ledger/managed.mjs +0 -729
  146. package/dist/lib/reporting/ledger/notification-activity.d.mts +0 -332
  147. package/dist/lib/reporting/ledger/notification-activity.d.ts +0 -332
  148. package/dist/lib/reporting/ledger/notification-activity.js +0 -1366
  149. package/dist/lib/reporting/ledger/notification-activity.mjs +0 -1337
  150. package/dist/lib/reporting/ledger/object-writes.d.mts +0 -128
  151. package/dist/lib/reporting/ledger/object-writes.d.ts +0 -128
  152. package/dist/lib/reporting/ledger/object-writes.js +0 -147
  153. package/dist/lib/reporting/ledger/object-writes.mjs +0 -114
  154. package/dist/lib/reporting/ledger/postgres.d.mts +0 -689
  155. package/dist/lib/reporting/ledger/postgres.d.ts +0 -689
  156. package/dist/lib/reporting/ledger/postgres.js +0 -4462
  157. package/dist/lib/reporting/ledger/postgres.mjs +0 -4462
  158. package/dist/lib/reporting/ledger/row-storage-migration.d.mts +0 -59
  159. package/dist/lib/reporting/ledger/row-storage-migration.d.ts +0 -59
  160. package/dist/lib/reporting/ledger/row-storage-migration.js +0 -365
  161. package/dist/lib/reporting/ledger/row-storage-migration.mjs +0 -339
  162. package/dist/lib/reporting/ledger/row-storage-object.d.mts +0 -203
  163. package/dist/lib/reporting/ledger/row-storage-object.d.ts +0 -203
  164. package/dist/lib/reporting/ledger/row-storage-object.js +0 -379
  165. package/dist/lib/reporting/ledger/row-storage-object.mjs +0 -335
  166. package/dist/lib/reporting/ledger/row-storage-provider-io.d.mts +0 -44
  167. package/dist/lib/reporting/ledger/row-storage-provider-io.d.ts +0 -44
  168. package/dist/lib/reporting/ledger/row-storage-provider-io.js +0 -142
  169. package/dist/lib/reporting/ledger/row-storage-provider-io.mjs +0 -111
  170. package/dist/lib/reporting/ledger/row-storage.d.mts +0 -316
  171. package/dist/lib/reporting/ledger/row-storage.d.ts +0 -316
  172. package/dist/lib/reporting/ledger/row-storage.js +0 -812
  173. package/dist/lib/reporting/ledger/row-storage.mjs +0 -802
  174. package/dist/lib/reporting/s3/index.d.mts +0 -34
  175. package/dist/lib/reporting/s3/index.d.ts +0 -34
  176. package/dist/lib/reporting/s3/index.js +0 -347
  177. package/dist/lib/reporting/s3/index.mjs +0 -340
  178. package/dist/lib/reporting/service/maintenance.d.mts +0 -148
  179. package/dist/lib/reporting/service/maintenance.d.ts +0 -148
  180. package/dist/lib/reporting/service/maintenance.js +0 -185
  181. package/dist/lib/reporting/service/maintenance.mjs +0 -159
  182. package/examples/reliable-reporting-service/README.md +0 -169
@@ -1,332 +0,0 @@
1
- import type { NotificationDeliveryAttemptCheckpointInput, PersistentNotificationRuntime } from '../../server/notification-subscriptions/index.mjs';
2
- import type { WebhookAttemptSuppressionReason } from '../../server/webhook-emitter.mjs';
3
- import type { ReportingHealthV1, ReportingLedgerNotificationActivityPortV1, ReportingLedgerObligationV1, ReportingLedgerRevisionV1, ReportingLedgerTransactionV1, ReportingObservedFinalityV1 } from './types.mjs';
4
- interface ReportingAccountActivityBaseV1 {
5
- activityId: string;
6
- transitionId: string;
7
- tenantId: string;
8
- accountId: string;
9
- reporting_obligation_id: string;
10
- occurredAt: string;
11
- }
12
- /**
13
- * @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
14
- */
15
- export interface ReportingLifecycleActivityV1 extends ReportingAccountActivityBaseV1 {
16
- activityType: 'reporting.lifecycle_changed';
17
- notificationType?: 'reporting.status_changed';
18
- previousHealth: ReportingHealthV1;
19
- health: ReportingHealthV1;
20
- previousFinality: ReportingObservedFinalityV1;
21
- finality: ReportingObservedFinalityV1;
22
- issueIds: string[];
23
- correlation: {
24
- delivery_config_id: string;
25
- delivery_config_version: number;
26
- report_definition_id: string;
27
- feed_purpose: ReportingLedgerObligationV1['feedPurpose'];
28
- period: {
29
- start: string;
30
- end: string;
31
- };
32
- };
33
- }
34
- /**
35
- * @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
36
- */
37
- export interface ReportingLedgerChangedActivityV1 extends ReportingAccountActivityBaseV1 {
38
- activityType: 'reporting.ledger_changed';
39
- notificationType: 'reporting.ledger_changed';
40
- changeKind: 'revision_published' | 'adjustment_published';
41
- reporting_revision_id?: string;
42
- supersedes_reporting_revision_id?: string;
43
- finality?: ReportingLedgerRevisionV1['finality'];
44
- reporting_adjustment_id?: string;
45
- adjusts_reporting_revision_id?: string;
46
- }
47
- /**
48
- * @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
49
- */
50
- export interface ReportingDeliveryReadyActivityV1 extends ReportingAccountActivityBaseV1 {
51
- activityType: 'reporting.delivery_ready';
52
- notificationType: 'reporting.delivery_ready';
53
- delivery_config_id: string;
54
- delivery_config_version: number;
55
- feed_purpose: ReportingLedgerObligationV1['feedPurpose'];
56
- reporting_revision_id: string;
57
- reporting_materialization_id: string;
58
- readiness: 'available' | 'delivered';
59
- finality: ReportingLedgerRevisionV1['finality'];
60
- data_through: string | null;
61
- }
62
- /**
63
- * @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
64
- */
65
- export type ReportingNotificationActivityV1 = ReportingLifecycleActivityV1 | ReportingLedgerChangedActivityV1 | ReportingDeliveryReadyActivityV1;
66
- /**
67
- * Backwards-compatible lifecycle activity surface returned by listActivity().
68
- *
69
- * @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
70
- */
71
- export interface ReportingAccountActivityV1 extends ReportingLifecycleActivityV1 {
72
- }
73
- /**
74
- * @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
75
- */
76
- export interface ReportingAccountActivityRecordV1 extends ReportingAccountActivityV1 {
77
- recordedAt: string;
78
- notificationProjectedAt?: string;
79
- /** Set when the claim was bounded out of the pending set without delivering. */
80
- notificationAbandonedAt?: string;
81
- }
82
- /**
83
- * @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
84
- */
85
- export type ReportingNotificationActivityRecordV1 = ReportingNotificationActivityV1 & {
86
- recordedAt: string;
87
- notificationProjectedAt?: string;
88
- notificationAbandonedAt?: string;
89
- };
90
- /**
91
- * @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
92
- */
93
- export interface ReportingAccountActivityPageV1 {
94
- activities: ReportingAccountActivityRecordV1[];
95
- hasMore: boolean;
96
- nextCursor?: string;
97
- }
98
- /**
99
- * @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
100
- */
101
- export interface ReportingNotificationActivityPageV1 {
102
- activities: ReportingNotificationActivityRecordV1[];
103
- hasMore: boolean;
104
- nextCursor?: string;
105
- }
106
- /**
107
- * @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
108
- */
109
- export interface ReportingNotificationRecoveryMetricsV1 {
110
- claimed: number;
111
- matched: number;
112
- projected: number;
113
- retried: number;
114
- leaseLost: number;
115
- /** Claims bounded out of the pending set after `maxAttempts`; never delivered. */
116
- abandoned: number;
117
- }
118
- /**
119
- * Raised when live delivery authority failed closed for an operational reason
120
- * rather than a deliberate one. The claim is released and retried; the activity
121
- * is never projected as delivered.
122
- *
123
- * @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
124
- */
125
- export declare class ReportingNotificationRetryableSuppressionError extends Error {
126
- readonly reason: WebhookAttemptSuppressionReason;
127
- readonly name = "ReportingNotificationRetryableSuppressionError";
128
- constructor(reason: WebhookAttemptSuppressionReason);
129
- }
130
- /**
131
- * @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
132
- */
133
- export interface ReportingNotificationProjectionErrorV1 {
134
- transitionId: string;
135
- tenantId: string;
136
- accountId: string;
137
- attemptCount: number;
138
- }
139
- /**
140
- * @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
141
- */
142
- export interface PostgresReportingNotificationActivityOptions {
143
- db: ReportingLedgerTransactionV1;
144
- /**
145
- * Notification port. A custom `{ emit }` must also set
146
- * `hasDeliveryAttemptCheckpoint: true`, which asserts that it forwards the
147
- * event it is handed to a runtime that runs the durable pre-POST checkpoint.
148
- */
149
- notifications: Pick<PersistentNotificationRuntime, 'emit'> & Partial<Pick<PersistentNotificationRuntime, 'hasDeliveryAttemptCheckpoint' | 'deliveryAttemptCheckpoint'>>;
150
- /** Stable deployment namespace. Defaults to `adcp-reporting`. */
151
- namespace?: string;
152
- /** Assert that the supplied database/schema is isolated to this deployment. */
153
- acknowledgeIsolatedDatabase?: boolean;
154
- /** Defaults to `adcp_reporting_notification_activity`. */
155
- tableName?: string;
156
- /**
157
- * Pure trusted mapping from the authoritative internal ledger account to a
158
- * tenant. It runs while the ledger transaction is open and must not perform
159
- * I/O or consult caller-controlled transition data.
160
- */
161
- tenantScopeForAccount(accountId: string): string;
162
- /** Retention for projected operator activity. Defaults to 90 days. */
163
- retentionMs?: number;
164
- /** Atomic pending-intent backpressure per tenant. Defaults to 100,000. */
165
- maxPendingPerTenant?: number;
166
- /**
167
- * Acknowledge a notification port that cannot prove it runs the durable
168
- * pre-POST checkpoint. Without it a crash plus a destination replacement
169
- * re-addresses the same notification under a second generation and a second
170
- * idempotency key, so this is refused by default and exists only for tests
171
- * that deliberately demonstrate that hazard.
172
- */
173
- acknowledgeMissingAttemptCheckpoint?: boolean;
174
- /**
175
- * The very checkpoint wired into the notification runtime.
176
- *
177
- * Required, because the checkpoint writes to a `(queryable, namespace,
178
- * table)` triple of its own and a mismatch is otherwise undetectable at
179
- * runtime: its update would match no row, every attempt would be suppressed
180
- * as retryable, the delivery binding would eventually retire, the recipient
181
- * would settle terminal and the activity would project — losing the
182
- * notification silently. Passing the same object lets that be refused at
183
- * construction instead.
184
- */
185
- attemptCheckpoint?: ReportingNotificationAttemptCheckpointV1;
186
- /**
187
- * Largest recipient fanout whose frozen intent this runtime will store.
188
- *
189
- * Must be **at least** the notification runtime's `maxFanoutCandidates`, plus
190
- * headroom for the distinct subscribers one notification can accumulate as
191
- * destinations churn. Defaults to 10,000 — the ceiling that runtime enforces
192
- * on `maxFanoutCandidates` — so the default can never be exceeded by a valid
193
- * fanout. Setting it *below* `maxFanoutCandidates` is a misconfiguration: a
194
- * legitimate fanout then cannot be committed and the claim retries until
195
- * `maxAttempts` abandons it.
196
- */
197
- maxRecipients?: number;
198
- /**
199
- * Total recipient rows one notification may retain: the current fanout plus
200
- * the pinned identities of subscribers that were addressed and then replaced
201
- * or removed.
202
- *
203
- * Separate from `maxRecipients` because they bound different things. A
204
- * maximum fanout of 10,000 that also has one former subscriber pinned needs
205
- * 10,001 rows, which a single bound capped at the fanout ceiling could never
206
- * express — the claim would be unsatisfiable and abandon undelivered.
207
- * Defaults to twice `maxRecipients`, and must be at least `maxRecipients`.
208
- */
209
- maxRetainedRecipients?: number;
210
- /**
211
- * Attempts after which a claim that keeps failing is abandoned rather than
212
- * retried forever. Defaults to 100.
213
- *
214
- * Without a bound, a claim that can never succeed — an over-fanout
215
- * configuration, a permanently unreachable dependency — stays pending
216
- * indefinitely, and enough of them reach `maxPendingPerTenant` and start
217
- * refusing new activity writes for the whole tenant. An abandoned claim stops
218
- * consuming that capacity while staying visible for operators; it is never
219
- * recorded as delivered.
220
- */
221
- maxAttempts?: number;
222
- }
223
- /**
224
- * @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
225
- */
226
- export interface PostgresReportingNotificationActivityRuntime {
227
- readonly port: ReportingLedgerNotificationActivityPortV1<ReportingLedgerTransactionV1>;
228
- readonly migrations: {
229
- activity: string;
230
- all: readonly string[];
231
- };
232
- probe(): Promise<void>;
233
- recoverOnce(options?: {
234
- ownerToken?: string;
235
- leaseMs?: number;
236
- limit?: number;
237
- retryAfterMs?: number;
238
- /** Cancels new claims and propagates shutdown between deliveries. */
239
- signal?: AbortSignal;
240
- /** Operational observer; hook failures never change durable lease semantics. */
241
- onError?: (error: unknown, claim: Readonly<ReportingNotificationProjectionErrorV1>) => void | Promise<void>;
242
- }): Promise<ReportingNotificationRecoveryMetricsV1>;
243
- listActivity(input: {
244
- /** Trusted authenticated scope; never copy these values from an event payload. */
245
- tenantId: string;
246
- accountId: string;
247
- cursor?: string;
248
- limit?: number;
249
- }): Promise<ReportingAccountActivityPageV1>;
250
- /** All reporting notification activity, including ledger and delivery-ready events. */
251
- listNotificationActivity(input: {
252
- tenantId: string;
253
- accountId: string;
254
- cursor?: string;
255
- limit?: number;
256
- }): Promise<ReportingNotificationActivityPageV1>;
257
- pruneProjected(options?: {
258
- limit?: number;
259
- }): Promise<number>;
260
- }
261
- /**
262
- * @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
263
- */
264
- export declare function getReportingNotificationActivityMigration(options?: {
265
- tableName?: string;
266
- }): string;
267
- /**
268
- * Child table holding one row per frozen recipient.
269
- *
270
- * @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
271
- */
272
- export declare function recipientTableName(tableName?: string): string;
273
- /**
274
- * @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
275
- */
276
- export declare const REPORTING_NOTIFICATION_ACTIVITY_MIGRATION: string;
277
- /**
278
- * Builds the durable pre-POST attempt checkpoint for the reporting activity
279
- * recipient table.
280
- *
281
- * Pass the result to `createPostgresPersistentNotificationRuntime`'s
282
- * `checkpointDeliveryAttempt`. It is a standalone factory rather than a method
283
- * on the activity runtime so it can be constructed before the notification
284
- * runtime it has to be wired into, and it is keyed purely on the durable attempt
285
- * context so a recovered outbox attempt — the path most likely to produce an
286
- * ambiguous send — records the same checkpoint as the original emission.
287
- *
288
- * The write is monotonic and idempotent and deliberately takes no recovery
289
- * lease: a checkpoint only ever makes a recipient less revisable, which is the
290
- * safe direction, and an outbox worker legitimately holds no activity lease.
291
- */
292
- /**
293
- * Durable store a checkpoint is bound to, so a mismatched pairing cannot be silent.
294
- *
295
- * @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
296
- */
297
- export interface ReportingNotificationAttemptCheckpointV1 {
298
- (input: Readonly<NotificationDeliveryAttemptCheckpointInput>): Promise<void | number>;
299
- /**
300
- * Exact `(queryable, namespace, table)` this checkpoint writes to. Present on
301
- * anything this module builds; absent on an adopter's own forwarder, which is
302
- * then only acceptable when the runtime it is wired into exposes the
303
- * checkpoint it invokes so identity can be compared directly.
304
- */
305
- readonly activityStore?: Readonly<{
306
- db: ReportingLedgerTransactionV1;
307
- namespace: string;
308
- tableName: string;
309
- }>;
310
- }
311
- /**
312
- * @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
313
- */
314
- export declare function createPostgresReportingNotificationAttemptCheckpoint(options: {
315
- db: ReportingLedgerTransactionV1;
316
- namespace?: string;
317
- tableName?: string;
318
- /**
319
- * Additional event types this checkpoint owns, on top of all three Reliable
320
- * Reporting events. Anything it does not own is another
321
- * subsystem's notification and is passed through untouched — the runtime hook
322
- * is global, and failing closed on an event that was never frozen here would
323
- * suppress every attempt of that event until its retry horizon expired. This
324
- * extends the owned set; it can never remove the reporting event.
325
- */
326
- eventTypes?: readonly string[];
327
- }): ReportingNotificationAttemptCheckpointV1;
328
- /**
329
- * @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
330
- */
331
- export declare function createPostgresReportingNotificationActivityRuntime(options: PostgresReportingNotificationActivityOptions): PostgresReportingNotificationActivityRuntime;
332
- export {};
@@ -1,332 +0,0 @@
1
- import type { NotificationDeliveryAttemptCheckpointInput, PersistentNotificationRuntime } from '../../server/notification-subscriptions';
2
- import type { WebhookAttemptSuppressionReason } from '../../server/webhook-emitter';
3
- import type { ReportingHealthV1, ReportingLedgerNotificationActivityPortV1, ReportingLedgerObligationV1, ReportingLedgerRevisionV1, ReportingLedgerTransactionV1, ReportingObservedFinalityV1 } from './types';
4
- interface ReportingAccountActivityBaseV1 {
5
- activityId: string;
6
- transitionId: string;
7
- tenantId: string;
8
- accountId: string;
9
- reporting_obligation_id: string;
10
- occurredAt: string;
11
- }
12
- /**
13
- * @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
14
- */
15
- export interface ReportingLifecycleActivityV1 extends ReportingAccountActivityBaseV1 {
16
- activityType: 'reporting.lifecycle_changed';
17
- notificationType?: 'reporting.status_changed';
18
- previousHealth: ReportingHealthV1;
19
- health: ReportingHealthV1;
20
- previousFinality: ReportingObservedFinalityV1;
21
- finality: ReportingObservedFinalityV1;
22
- issueIds: string[];
23
- correlation: {
24
- delivery_config_id: string;
25
- delivery_config_version: number;
26
- report_definition_id: string;
27
- feed_purpose: ReportingLedgerObligationV1['feedPurpose'];
28
- period: {
29
- start: string;
30
- end: string;
31
- };
32
- };
33
- }
34
- /**
35
- * @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
36
- */
37
- export interface ReportingLedgerChangedActivityV1 extends ReportingAccountActivityBaseV1 {
38
- activityType: 'reporting.ledger_changed';
39
- notificationType: 'reporting.ledger_changed';
40
- changeKind: 'revision_published' | 'adjustment_published';
41
- reporting_revision_id?: string;
42
- supersedes_reporting_revision_id?: string;
43
- finality?: ReportingLedgerRevisionV1['finality'];
44
- reporting_adjustment_id?: string;
45
- adjusts_reporting_revision_id?: string;
46
- }
47
- /**
48
- * @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
49
- */
50
- export interface ReportingDeliveryReadyActivityV1 extends ReportingAccountActivityBaseV1 {
51
- activityType: 'reporting.delivery_ready';
52
- notificationType: 'reporting.delivery_ready';
53
- delivery_config_id: string;
54
- delivery_config_version: number;
55
- feed_purpose: ReportingLedgerObligationV1['feedPurpose'];
56
- reporting_revision_id: string;
57
- reporting_materialization_id: string;
58
- readiness: 'available' | 'delivered';
59
- finality: ReportingLedgerRevisionV1['finality'];
60
- data_through: string | null;
61
- }
62
- /**
63
- * @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
64
- */
65
- export type ReportingNotificationActivityV1 = ReportingLifecycleActivityV1 | ReportingLedgerChangedActivityV1 | ReportingDeliveryReadyActivityV1;
66
- /**
67
- * Backwards-compatible lifecycle activity surface returned by listActivity().
68
- *
69
- * @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
70
- */
71
- export interface ReportingAccountActivityV1 extends ReportingLifecycleActivityV1 {
72
- }
73
- /**
74
- * @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
75
- */
76
- export interface ReportingAccountActivityRecordV1 extends ReportingAccountActivityV1 {
77
- recordedAt: string;
78
- notificationProjectedAt?: string;
79
- /** Set when the claim was bounded out of the pending set without delivering. */
80
- notificationAbandonedAt?: string;
81
- }
82
- /**
83
- * @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
84
- */
85
- export type ReportingNotificationActivityRecordV1 = ReportingNotificationActivityV1 & {
86
- recordedAt: string;
87
- notificationProjectedAt?: string;
88
- notificationAbandonedAt?: string;
89
- };
90
- /**
91
- * @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
92
- */
93
- export interface ReportingAccountActivityPageV1 {
94
- activities: ReportingAccountActivityRecordV1[];
95
- hasMore: boolean;
96
- nextCursor?: string;
97
- }
98
- /**
99
- * @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
100
- */
101
- export interface ReportingNotificationActivityPageV1 {
102
- activities: ReportingNotificationActivityRecordV1[];
103
- hasMore: boolean;
104
- nextCursor?: string;
105
- }
106
- /**
107
- * @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
108
- */
109
- export interface ReportingNotificationRecoveryMetricsV1 {
110
- claimed: number;
111
- matched: number;
112
- projected: number;
113
- retried: number;
114
- leaseLost: number;
115
- /** Claims bounded out of the pending set after `maxAttempts`; never delivered. */
116
- abandoned: number;
117
- }
118
- /**
119
- * Raised when live delivery authority failed closed for an operational reason
120
- * rather than a deliberate one. The claim is released and retried; the activity
121
- * is never projected as delivered.
122
- *
123
- * @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
124
- */
125
- export declare class ReportingNotificationRetryableSuppressionError extends Error {
126
- readonly reason: WebhookAttemptSuppressionReason;
127
- readonly name = "ReportingNotificationRetryableSuppressionError";
128
- constructor(reason: WebhookAttemptSuppressionReason);
129
- }
130
- /**
131
- * @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
132
- */
133
- export interface ReportingNotificationProjectionErrorV1 {
134
- transitionId: string;
135
- tenantId: string;
136
- accountId: string;
137
- attemptCount: number;
138
- }
139
- /**
140
- * @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
141
- */
142
- export interface PostgresReportingNotificationActivityOptions {
143
- db: ReportingLedgerTransactionV1;
144
- /**
145
- * Notification port. A custom `{ emit }` must also set
146
- * `hasDeliveryAttemptCheckpoint: true`, which asserts that it forwards the
147
- * event it is handed to a runtime that runs the durable pre-POST checkpoint.
148
- */
149
- notifications: Pick<PersistentNotificationRuntime, 'emit'> & Partial<Pick<PersistentNotificationRuntime, 'hasDeliveryAttemptCheckpoint' | 'deliveryAttemptCheckpoint'>>;
150
- /** Stable deployment namespace. Defaults to `adcp-reporting`. */
151
- namespace?: string;
152
- /** Assert that the supplied database/schema is isolated to this deployment. */
153
- acknowledgeIsolatedDatabase?: boolean;
154
- /** Defaults to `adcp_reporting_notification_activity`. */
155
- tableName?: string;
156
- /**
157
- * Pure trusted mapping from the authoritative internal ledger account to a
158
- * tenant. It runs while the ledger transaction is open and must not perform
159
- * I/O or consult caller-controlled transition data.
160
- */
161
- tenantScopeForAccount(accountId: string): string;
162
- /** Retention for projected operator activity. Defaults to 90 days. */
163
- retentionMs?: number;
164
- /** Atomic pending-intent backpressure per tenant. Defaults to 100,000. */
165
- maxPendingPerTenant?: number;
166
- /**
167
- * Acknowledge a notification port that cannot prove it runs the durable
168
- * pre-POST checkpoint. Without it a crash plus a destination replacement
169
- * re-addresses the same notification under a second generation and a second
170
- * idempotency key, so this is refused by default and exists only for tests
171
- * that deliberately demonstrate that hazard.
172
- */
173
- acknowledgeMissingAttemptCheckpoint?: boolean;
174
- /**
175
- * The very checkpoint wired into the notification runtime.
176
- *
177
- * Required, because the checkpoint writes to a `(queryable, namespace,
178
- * table)` triple of its own and a mismatch is otherwise undetectable at
179
- * runtime: its update would match no row, every attempt would be suppressed
180
- * as retryable, the delivery binding would eventually retire, the recipient
181
- * would settle terminal and the activity would project — losing the
182
- * notification silently. Passing the same object lets that be refused at
183
- * construction instead.
184
- */
185
- attemptCheckpoint?: ReportingNotificationAttemptCheckpointV1;
186
- /**
187
- * Largest recipient fanout whose frozen intent this runtime will store.
188
- *
189
- * Must be **at least** the notification runtime's `maxFanoutCandidates`, plus
190
- * headroom for the distinct subscribers one notification can accumulate as
191
- * destinations churn. Defaults to 10,000 — the ceiling that runtime enforces
192
- * on `maxFanoutCandidates` — so the default can never be exceeded by a valid
193
- * fanout. Setting it *below* `maxFanoutCandidates` is a misconfiguration: a
194
- * legitimate fanout then cannot be committed and the claim retries until
195
- * `maxAttempts` abandons it.
196
- */
197
- maxRecipients?: number;
198
- /**
199
- * Total recipient rows one notification may retain: the current fanout plus
200
- * the pinned identities of subscribers that were addressed and then replaced
201
- * or removed.
202
- *
203
- * Separate from `maxRecipients` because they bound different things. A
204
- * maximum fanout of 10,000 that also has one former subscriber pinned needs
205
- * 10,001 rows, which a single bound capped at the fanout ceiling could never
206
- * express — the claim would be unsatisfiable and abandon undelivered.
207
- * Defaults to twice `maxRecipients`, and must be at least `maxRecipients`.
208
- */
209
- maxRetainedRecipients?: number;
210
- /**
211
- * Attempts after which a claim that keeps failing is abandoned rather than
212
- * retried forever. Defaults to 100.
213
- *
214
- * Without a bound, a claim that can never succeed — an over-fanout
215
- * configuration, a permanently unreachable dependency — stays pending
216
- * indefinitely, and enough of them reach `maxPendingPerTenant` and start
217
- * refusing new activity writes for the whole tenant. An abandoned claim stops
218
- * consuming that capacity while staying visible for operators; it is never
219
- * recorded as delivered.
220
- */
221
- maxAttempts?: number;
222
- }
223
- /**
224
- * @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
225
- */
226
- export interface PostgresReportingNotificationActivityRuntime {
227
- readonly port: ReportingLedgerNotificationActivityPortV1<ReportingLedgerTransactionV1>;
228
- readonly migrations: {
229
- activity: string;
230
- all: readonly string[];
231
- };
232
- probe(): Promise<void>;
233
- recoverOnce(options?: {
234
- ownerToken?: string;
235
- leaseMs?: number;
236
- limit?: number;
237
- retryAfterMs?: number;
238
- /** Cancels new claims and propagates shutdown between deliveries. */
239
- signal?: AbortSignal;
240
- /** Operational observer; hook failures never change durable lease semantics. */
241
- onError?: (error: unknown, claim: Readonly<ReportingNotificationProjectionErrorV1>) => void | Promise<void>;
242
- }): Promise<ReportingNotificationRecoveryMetricsV1>;
243
- listActivity(input: {
244
- /** Trusted authenticated scope; never copy these values from an event payload. */
245
- tenantId: string;
246
- accountId: string;
247
- cursor?: string;
248
- limit?: number;
249
- }): Promise<ReportingAccountActivityPageV1>;
250
- /** All reporting notification activity, including ledger and delivery-ready events. */
251
- listNotificationActivity(input: {
252
- tenantId: string;
253
- accountId: string;
254
- cursor?: string;
255
- limit?: number;
256
- }): Promise<ReportingNotificationActivityPageV1>;
257
- pruneProjected(options?: {
258
- limit?: number;
259
- }): Promise<number>;
260
- }
261
- /**
262
- * @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
263
- */
264
- export declare function getReportingNotificationActivityMigration(options?: {
265
- tableName?: string;
266
- }): string;
267
- /**
268
- * Child table holding one row per frozen recipient.
269
- *
270
- * @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
271
- */
272
- export declare function recipientTableName(tableName?: string): string;
273
- /**
274
- * @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
275
- */
276
- export declare const REPORTING_NOTIFICATION_ACTIVITY_MIGRATION: string;
277
- /**
278
- * Builds the durable pre-POST attempt checkpoint for the reporting activity
279
- * recipient table.
280
- *
281
- * Pass the result to `createPostgresPersistentNotificationRuntime`'s
282
- * `checkpointDeliveryAttempt`. It is a standalone factory rather than a method
283
- * on the activity runtime so it can be constructed before the notification
284
- * runtime it has to be wired into, and it is keyed purely on the durable attempt
285
- * context so a recovered outbox attempt — the path most likely to produce an
286
- * ambiguous send — records the same checkpoint as the original emission.
287
- *
288
- * The write is monotonic and idempotent and deliberately takes no recovery
289
- * lease: a checkpoint only ever makes a recipient less revisable, which is the
290
- * safe direction, and an outbox worker legitimately holds no activity lease.
291
- */
292
- /**
293
- * Durable store a checkpoint is bound to, so a mismatched pairing cannot be silent.
294
- *
295
- * @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
296
- */
297
- export interface ReportingNotificationAttemptCheckpointV1 {
298
- (input: Readonly<NotificationDeliveryAttemptCheckpointInput>): Promise<void | number>;
299
- /**
300
- * Exact `(queryable, namespace, table)` this checkpoint writes to. Present on
301
- * anything this module builds; absent on an adopter's own forwarder, which is
302
- * then only acceptable when the runtime it is wired into exposes the
303
- * checkpoint it invokes so identity can be compared directly.
304
- */
305
- readonly activityStore?: Readonly<{
306
- db: ReportingLedgerTransactionV1;
307
- namespace: string;
308
- tableName: string;
309
- }>;
310
- }
311
- /**
312
- * @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
313
- */
314
- export declare function createPostgresReportingNotificationAttemptCheckpoint(options: {
315
- db: ReportingLedgerTransactionV1;
316
- namespace?: string;
317
- tableName?: string;
318
- /**
319
- * Additional event types this checkpoint owns, on top of all three Reliable
320
- * Reporting events. Anything it does not own is another
321
- * subsystem's notification and is passed through untouched — the runtime hook
322
- * is global, and failing closed on an event that was never frozen here would
323
- * suppress every attempt of that event until its retry horizon expired. This
324
- * extends the owned set; it can never remove the reporting event.
325
- */
326
- eventTypes?: readonly string[];
327
- }): ReportingNotificationAttemptCheckpointV1;
328
- /**
329
- * @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
330
- */
331
- export declare function createPostgresReportingNotificationActivityRuntime(options: PostgresReportingNotificationActivityOptions): PostgresReportingNotificationActivityRuntime;
332
- export {};