@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,340 +0,0 @@
1
- import { randomUUID } from "node:crypto";
2
- import {
3
- DeleteObjectCommand,
4
- GetBucketLifecycleConfigurationCommand,
5
- GetBucketPolicyStatusCommand,
6
- GetBucketVersioningCommand,
7
- GetObjectCommand,
8
- HeadBucketCommand,
9
- HeadObjectCommand,
10
- PutObjectCommand
11
- } from "@aws-sdk/client-s3";
12
- import { ReportingRowStoreError } from "../ledger/row-storage-errors.mjs";
13
- import {
14
- assertReportingRowLocationKeys,
15
- assertReportingRowReadBounds,
16
- readReportingRowStream,
17
- reportingRowClientMap,
18
- reportingRowPrefixFilterOverlaps,
19
- runReportingRowProviderOperation,
20
- selectReportingRowClient
21
- } from "../ledger/row-storage-provider-io.mjs";
22
- const BUCKET = /^[a-z0-9][a-z0-9.-]{1,61}[a-z0-9]$/;
23
- const REGION = /^[a-z0-9][a-z0-9-]{0,30}[a-z0-9]$/;
24
- const VERSION_ID = /^[\x21\x23-\x7e]{1,1024}$/;
25
- function statusOf(error) {
26
- const status = Number(error?.$metadata?.httpStatusCode);
27
- return Number.isInteger(status) ? status : void 0;
28
- }
29
- function nameOf(error) {
30
- const value = error?.name ?? error?.Code;
31
- return typeof value === "string" ? value : "";
32
- }
33
- const isPreconditionFailed = (error) => statusOf(error) === 412 || nameOf(error) === "PreconditionFailed";
34
- const isConditionalConflict = (error) => statusOf(error) === 409 || nameOf(error) === "ConditionalRequestConflict";
35
- const isNotFound = (error) => statusOf(error) === 404 || ["NoSuchKey", "NotFound", "NoSuchVersion", "NoSuchBucket"].includes(nameOf(error));
36
- const isNotImplemented = (error) => statusOf(error) === 501 || nameOf(error) === "NotImplemented";
37
- const isForbidden = (error) => statusOf(error) === 401 || statusOf(error) === 403;
38
- const isRangeError = (error) => statusOf(error) === 416 || nameOf(error) === "InvalidRange";
39
- function versionOf(output) {
40
- const id = output.VersionId;
41
- if (typeof id !== "string" || id === "null" || !VERSION_ID.test(id)) {
42
- throw new ReportingRowStoreError(
43
- "UNSAFE_BINDING",
44
- "store returned no object VersionId; S3 bucket versioning must be enabled so deletes are fenced to one write"
45
- );
46
- }
47
- return id;
48
- }
49
- function selectorOf(nativeVersionRef) {
50
- if (typeof nativeVersionRef !== "string" || nativeVersionRef === "null") return null;
51
- return VERSION_ID.test(nativeVersionRef) ? { VersionId: nativeVersionRef } : null;
52
- }
53
- function servedVersion(output, selector) {
54
- return output.VersionId === selector.VersionId;
55
- }
56
- function liveExpirationCovers(rule, prefix) {
57
- if (rule.Status !== "Enabled") return false;
58
- if (rule.Expiration?.Days === void 0 && rule.Expiration?.Date === void 0) return false;
59
- if (rule.Filter?.Tag !== void 0 || (rule.Filter?.And?.Tags?.length ?? 0) > 0) return false;
60
- const filter = rule.Filter?.Prefix ?? rule.Filter?.And?.Prefix ?? rule.Prefix;
61
- return reportingRowPrefixFilterOverlaps(filter, prefix);
62
- }
63
- function createS3ReportingRowObjectProviderV1(options) {
64
- if (!options || typeof options !== "object") {
65
- throw new ReportingRowStoreError("INVALID_INPUT", "S3 row provider options are required");
66
- }
67
- const clients = reportingRowClientMap(options.clients);
68
- const isClient = (value) => !!value && typeof value === "object" && typeof value.send === "function";
69
- if (options.client !== void 0 && !isClient(options.client) || [...clients.values()].some((client) => !isClient(client)) || options.client === void 0 && clients.size === 0) {
70
- throw new ReportingRowStoreError("INVALID_INPUT", "inject an official S3Client as client or clients");
71
- }
72
- const validateLocation = (location) => {
73
- assertReportingRowLocationKeys(location, ["bucket"], ["region"]);
74
- const bucket = location.bucket;
75
- if (!BUCKET.test(bucket) || bucket.includes("..") || /^\d+\.\d+\.\d+\.\d+$/.test(bucket)) {
76
- throw new ReportingRowStoreError("INVALID_INPUT", "S3 bucket name is invalid");
77
- }
78
- if (location.region !== void 0 && !REGION.test(location.region)) {
79
- throw new ReportingRowStoreError("INVALID_INPUT", "S3 region is invalid");
80
- }
81
- };
82
- const target = (input) => {
83
- validateLocation(input.location);
84
- return {
85
- client: selectReportingRowClient(options.client, clients, input.credentialRef),
86
- Bucket: input.location.bucket
87
- };
88
- };
89
- const assertKey = (key) => {
90
- if (typeof key !== "string" || key.length === 0 || Buffer.byteLength(key) > 1024) {
91
- throw new ReportingRowStoreError("INVALID_INPUT", "object key is invalid");
92
- }
93
- };
94
- async function putCreateOnly(client, params, signal) {
95
- for (let attempt = 0; ; attempt++) {
96
- try {
97
- return await client.send(new PutObjectCommand({ ...params, IfNoneMatch: "*" }), { abortSignal: signal });
98
- } catch (error) {
99
- if (attempt === 0 && isConditionalConflict(error) && !signal.aborted) continue;
100
- throw error;
101
- }
102
- }
103
- }
104
- async function assertVersioningEnabled(client, Bucket, signal) {
105
- let status;
106
- try {
107
- status = (await client.send(new GetBucketVersioningCommand({ Bucket }), { abortSignal: signal })).Status;
108
- } catch (error) {
109
- if (isForbidden(error) || isNotImplemented(error)) {
110
- throw new ReportingRowStoreError("UNSAFE_BINDING", "bucket versioning status cannot be verified");
111
- }
112
- throw error;
113
- }
114
- if (status !== "Enabled") {
115
- throw new ReportingRowStoreError(
116
- "UNSAFE_BINDING",
117
- "S3 bucket versioning must be enabled so row object deletes are fenced to one write"
118
- );
119
- }
120
- }
121
- async function assertCreateOnlyEnforced(client, Bucket, prefix, signal) {
122
- const Key = `${prefix}/.adcp-probe/${randomUUID()}`;
123
- const written = [];
124
- const put = async (body) => {
125
- const output = await putCreateOnly(
126
- client,
127
- { Bucket, Key, Body: Buffer.from(body), ContentType: "application/x-ndjson", CacheControl: "no-store" },
128
- signal
129
- );
130
- written.push(output);
131
- versionOf(output);
132
- };
133
- try {
134
- try {
135
- await put('{"probe":1}\n');
136
- } catch (error) {
137
- if (isNotImplemented(error) || isPreconditionFailed(error)) {
138
- throw new ReportingRowStoreError("UNSAFE_BINDING", "store does not support create-only writes");
139
- }
140
- throw error;
141
- }
142
- try {
143
- await put('{"probe":2}\n');
144
- } catch (error) {
145
- if (isPreconditionFailed(error)) return;
146
- if (isNotImplemented(error)) {
147
- throw new ReportingRowStoreError("UNSAFE_BINDING", "store does not support create-only writes");
148
- }
149
- throw error;
150
- }
151
- throw new ReportingRowStoreError("UNSAFE_BINDING", "store ignores If-None-Match and replaces objects");
152
- } finally {
153
- const versionIds = written.map((output) => output.VersionId).filter((id) => !!id);
154
- const deletes = versionIds.length > 0 ? versionIds.map((VersionId) => ({ VersionId })) : written.length ? [{}] : [];
155
- for (const selector of deletes) {
156
- if (signal.aborted) break;
157
- await client.send(new DeleteObjectCommand({ Bucket, Key, ...selector }), { abortSignal: signal }).catch(() => void 0);
158
- }
159
- }
160
- }
161
- return {
162
- name: "s3",
163
- rangedReads: true,
164
- validateLocation,
165
- probe(input, context) {
166
- return runReportingRowProviderOperation(context.signal, async () => {
167
- const { client, Bucket } = target(input);
168
- const signal = context.signal;
169
- try {
170
- await client.send(new HeadBucketCommand({ Bucket }), { abortSignal: signal });
171
- } catch (error) {
172
- if (isNotFound(error)) throw new ReportingRowStoreError("UNSAFE_BINDING", "bucket does not exist");
173
- if (isForbidden(error)) throw new ReportingRowStoreError("UNSAFE_BINDING", "bucket is not accessible");
174
- if (statusOf(error) === 301) {
175
- throw new ReportingRowStoreError("UNSAFE_BINDING", "bucket is in a different region");
176
- }
177
- throw error;
178
- }
179
- if (input.location.region !== void 0) {
180
- const configured = client.config?.region;
181
- const region = typeof configured === "function" ? await configured() : configured;
182
- if (region !== input.location.region) {
183
- throw new ReportingRowStoreError("UNSAFE_BINDING", "client region does not match the binding");
184
- }
185
- }
186
- const policy = await client.send(new GetBucketPolicyStatusCommand({ Bucket }), { abortSignal: signal }).catch(() => void 0);
187
- if (policy?.PolicyStatus?.IsPublic === true) {
188
- throw new ReportingRowStoreError("UNSAFE_BINDING", "bucket policy makes objects public");
189
- }
190
- let rules = [];
191
- try {
192
- const lifecycle = await client.send(new GetBucketLifecycleConfigurationCommand({ Bucket }), {
193
- abortSignal: signal
194
- });
195
- rules = lifecycle.Rules ?? [];
196
- } catch (error) {
197
- if (isForbidden(error)) {
198
- throw new ReportingRowStoreError("UNSAFE_BINDING", "bucket lifecycle cannot be read with this client");
199
- }
200
- if (!isNotFound(error) && !isNotImplemented(error) && nameOf(error) !== "NoSuchLifecycleConfiguration") {
201
- throw error;
202
- }
203
- }
204
- if (rules.some((rule) => liveExpirationCovers(rule, input.prefix))) {
205
- throw new ReportingRowStoreError("UNSAFE_BINDING", "a bucket lifecycle rule can expire live row objects");
206
- }
207
- await assertVersioningEnabled(client, Bucket, signal);
208
- await assertCreateOnlyEnforced(client, Bucket, input.prefix, signal);
209
- });
210
- },
211
- putIfAbsent(input, context) {
212
- return runReportingRowProviderOperation(context.signal, async () => {
213
- const { client, Bucket } = target(input);
214
- assertKey(input.objectRef);
215
- const bytes = Buffer.from(input.bytes);
216
- try {
217
- const output = await putCreateOnly(
218
- client,
219
- {
220
- Bucket,
221
- Key: input.objectRef,
222
- Body: bytes,
223
- ContentLength: bytes.byteLength,
224
- ContentType: input.contentType,
225
- CacheControl: "no-store",
226
- Metadata: { ...input.metadata }
227
- },
228
- context.signal
229
- );
230
- return { created: true, nativeVersionRef: versionOf(output) };
231
- } catch (error) {
232
- if (!isPreconditionFailed(error)) throw error;
233
- }
234
- const head = await client.send(new HeadObjectCommand({ Bucket, Key: input.objectRef }), {
235
- abortSignal: context.signal
236
- });
237
- return { created: false, nativeVersionRef: versionOf(head) };
238
- });
239
- },
240
- get(input, context) {
241
- return runReportingRowProviderOperation(context.signal, async () => {
242
- const { client, Bucket } = target(input);
243
- assertKey(input.objectRef);
244
- assertReportingRowReadBounds(input);
245
- const selector = selectorOf(input.nativeVersionRef);
246
- if (selector === null) return null;
247
- const Key = input.objectRef;
248
- try {
249
- if (input.range?.length === 0) {
250
- const head = await client.send(new HeadObjectCommand({ Bucket, Key, ...selector }), {
251
- abortSignal: context.signal
252
- });
253
- if (!servedVersion(head, selector)) return null;
254
- if (input.range.offset > Number(head.ContentLength ?? 0)) {
255
- throw new ReportingRowStoreError("ROWS_INTEGRITY_FAILED", "requested range exceeds the stored object");
256
- }
257
- return Buffer.alloc(0);
258
- }
259
- const output = await client.send(
260
- new GetObjectCommand({
261
- Bucket,
262
- Key,
263
- ...selector,
264
- ...input.range ? { Range: `bytes=${input.range.offset}-${input.range.offset + input.range.length - 1}` } : {}
265
- }),
266
- { abortSignal: context.signal }
267
- );
268
- const body = output.Body;
269
- if (!body || typeof body[Symbol.asyncIterator] !== "function") {
270
- throw new ReportingRowStoreError("PROVIDER_UNAVAILABLE", "object body is not a stream");
271
- }
272
- if (!servedVersion(output, selector)) {
273
- body.destroy?.();
274
- return null;
275
- }
276
- if (typeof output.ContentLength === "number" && output.ContentLength > input.maxBytes) {
277
- body.destroy?.();
278
- throw new ReportingRowStoreError("ROWS_INTEGRITY_FAILED", "stored object exceeds its recorded size");
279
- }
280
- return await readReportingRowStream(body, input.maxBytes, context.signal);
281
- } catch (error) {
282
- if (isNotFound(error) || isPreconditionFailed(error)) return null;
283
- if (statusOf(error) === 400 && nameOf(error) !== "InvalidRange") return null;
284
- if (isRangeError(error)) {
285
- throw new ReportingRowStoreError("ROWS_INTEGRITY_FAILED", "requested range exceeds the stored object");
286
- }
287
- throw error;
288
- }
289
- });
290
- },
291
- stat(input, context) {
292
- return runReportingRowProviderOperation(context.signal, async () => {
293
- const { client, Bucket } = target(input);
294
- assertKey(input.objectRef);
295
- const selector = selectorOf(input.nativeVersionRef);
296
- if (selector === null) return null;
297
- try {
298
- const head = await client.send(new HeadObjectCommand({ Bucket, Key: input.objectRef, ...selector }), {
299
- abortSignal: context.signal
300
- });
301
- if (!servedVersion(head, selector)) return null;
302
- const size = head.ContentLength;
303
- if (typeof size !== "number" || !Number.isSafeInteger(size) || size < 0) {
304
- throw new ReportingRowStoreError("PROVIDER_UNAVAILABLE", "object metadata is malformed");
305
- }
306
- return { nativeVersionRef: selector.VersionId, sizeBytes: size };
307
- } catch (error) {
308
- if (isNotFound(error) || isPreconditionFailed(error)) return null;
309
- if (statusOf(error) === 400 || statusOf(error) === 405) return null;
310
- throw error;
311
- }
312
- });
313
- },
314
- delete(input, context) {
315
- return runReportingRowProviderOperation(context.signal, async () => {
316
- const { client, Bucket } = target(input);
317
- assertKey(input.objectRef);
318
- const selector = selectorOf(input.nativeVersionRef);
319
- if (selector === null) return "absent";
320
- const Key = input.objectRef;
321
- const signal = context.signal;
322
- try {
323
- const head = await client.send(new HeadObjectCommand({ Bucket, Key, ...selector }), { abortSignal: signal });
324
- if (!servedVersion(head, selector)) return "absent";
325
- } catch (error) {
326
- if (isNotFound(error) || isPreconditionFailed(error)) return "absent";
327
- if (statusOf(error) === 400 || statusOf(error) === 405) return "absent";
328
- throw error;
329
- }
330
- await client.send(new DeleteObjectCommand({ Bucket, Key, VersionId: selector.VersionId }), {
331
- abortSignal: signal
332
- });
333
- return "deleted";
334
- });
335
- }
336
- };
337
- }
338
- export {
339
- createS3ReportingRowObjectProviderV1
340
- };
@@ -1,148 +0,0 @@
1
- import type { PostgresReportingLedgerStore } from '../ledger/index.mjs';
2
- /**
3
- * Period-aligned retention. Whole periods are retired once
4
- * `max(statusRetentionDays, recordRetentionDays)` has elapsed since both the
5
- * period end and its latest publication. `statusRetentionDays` always comes
6
- * from the service, so retention can never disagree with the commitment the
7
- * service advertises to buyers.
8
- *
9
- * @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
10
- */
11
- export interface ReportingRetentionOptionsV1 {
12
- enabled: true;
13
- recordRetentionDays?: number;
14
- limit?: number;
15
- }
16
- /**
17
- * Opt-in compaction of superseded snapshot revisions to metadata only, as
18
- * adcontextprotocol/adcp#8100 permits. Off unless `enabled: true`. Uses the
19
- * service's `statusRetentionDays` and `automatedRecoveryWindowSeconds`, so it
20
- * can never drop content earlier than the commitments advertised to buyers.
21
- *
22
- * Compaction takes effect in the AdCP release after November 20, 2026; do not
23
- * enable it in production before then. See `docs/guides/REPORTING-OPERATIONS.md`.
24
- *
25
- * @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
26
- */
27
- export interface ReportingCompactionOptionsV1 {
28
- enabled: true;
29
- /** Revisions compacted per pass. Defaults to 100. */
30
- limit?: number;
31
- }
32
- /**
33
- * Change-feed pruning window and the consumer hold shared with retention.
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 type ReportingChangeFeedMaintenanceOptionsV1 = boolean | {
38
- changeRetentionDays?: number;
39
- maxFeedHoldDays?: number;
40
- };
41
- /**
42
- * The ledger-store surface a maintenance pass drives.
43
- *
44
- * @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
45
- */
46
- export type ReportingLedgerMaintenanceStoreV1 = Pick<PostgresReportingLedgerStore, 'sweepRowWriteIntents' | 'pruneChanges' | 'retireExpiredPeriods'> & Partial<Pick<PostgresReportingLedgerStore, 'compactSupersededSnapshots'>>;
47
- interface ReportingLedgerMaintenanceTaskOutcomesV1 {
48
- 'snapshot sweep': Awaited<ReturnType<PostgresReportingLedgerStore['sweepExpiredState']>>;
49
- 'row upload sweep': Awaited<ReturnType<PostgresReportingLedgerStore['sweepRowWriteIntents']>>;
50
- 'change-feed pruning': Awaited<ReturnType<PostgresReportingLedgerStore['pruneChanges']>>;
51
- retention: Awaited<ReturnType<PostgresReportingLedgerStore['retireExpiredPeriods']>>;
52
- 'snapshot compaction': Awaited<ReturnType<PostgresReportingLedgerStore['compactSupersededSnapshots']>>;
53
- }
54
- /**
55
- * @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
56
- */
57
- export type ReportingLedgerMaintenanceTaskNameV1 = keyof ReportingLedgerMaintenanceTaskOutcomesV1;
58
- /**
59
- * A scheduled maintenance pass completed but could not process some items
60
- * (for example, a retention period whose objects could not be deleted). The
61
- * pass resumes them next time; repeated reports need operator attention.
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 declare class ReportingMaintenancePartialFailureError extends Error {
66
- readonly task: string;
67
- readonly failedCount: number;
68
- readonly failedIds: readonly string[];
69
- /**
70
- * Backlog the task is not reaching: items backing off, items this host cannot
71
- * handle, items that have failed persistently. Appended to the message so
72
- * `onError` and the logs carry them.
73
- */
74
- readonly warnings: readonly string[];
75
- constructor(task: string, failedCount: number, failedIds: readonly string[],
76
- /**
77
- * Backlog the task is not reaching: items backing off, items this host cannot
78
- * handle, items that have failed persistently. Appended to the message so
79
- * `onError` and the logs carry them.
80
- */
81
- warnings?: readonly string[]);
82
- }
83
- /**
84
- * Outcome of one maintenance task. A task that resolved but could not process
85
- * some items (a retention period whose objects would not delete, an upload that
86
- * would not sweep) is `completed` with `partialFailure` set; the pass resumes
87
- * those items next time.
88
- *
89
- * @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
90
- */
91
- export type ReportingLedgerMaintenanceTaskResultV1 = {
92
- [Task in ReportingLedgerMaintenanceTaskNameV1]: {
93
- readonly task: Task;
94
- readonly status: 'completed';
95
- readonly result: ReportingLedgerMaintenanceTaskOutcomesV1[Task];
96
- readonly partialFailure?: ReportingMaintenancePartialFailureError;
97
- } | {
98
- readonly task: Task;
99
- readonly status: 'failed';
100
- readonly error: unknown;
101
- };
102
- }[ReportingLedgerMaintenanceTaskNameV1];
103
- /**
104
- * @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
105
- */
106
- export interface RunReportingLedgerMaintenanceInputV1 {
107
- store: ReportingLedgerMaintenanceStoreV1;
108
- /**
109
- * Expired cursor snapshot and checkpoint sweep. Omitted when the caller has
110
- * no way to reach the database, in which case that task is not run.
111
- */
112
- sweepSnapshots?: (limit: number) => Promise<ReportingLedgerMaintenanceTaskOutcomesV1['snapshot sweep']>;
113
- statusRetentionDays: number;
114
- /** The service's advertised `automated_recovery_window_seconds`; required when `compaction` is enabled. */
115
- automatedRecoveryWindowSeconds?: number | undefined;
116
- retention?: ReportingRetentionOptionsV1 | undefined;
117
- compaction?: ReportingCompactionOptionsV1 | undefined;
118
- changeFeed?: ReportingChangeFeedMaintenanceOptionsV1 | undefined;
119
- signal?: AbortSignal | undefined;
120
- /**
121
- * Called, in task order and awaited, for every task that rejected or
122
- * partially failed, unless `signal` has aborted (an abort is shutdown, not a
123
- * fault).
124
- */
125
- report?: (error: unknown) => Promise<void>;
126
- }
127
- /**
128
- * The single ledger-maintenance pass shared by the Core service and the
129
- * production service, so partial-failure surfacing, the `maxFeedHoldDays` that
130
- * retention honours, per-task limits and abort handling cannot drift between
131
- * them. Tasks start together, in a fixed order, and are isolated: one task's
132
- * failure never prevents another from running.
133
- *
134
- * @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
135
- */
136
- export declare function runReportingLedgerMaintenance(input: RunReportingLedgerMaintenanceInputV1): Promise<ReportingLedgerMaintenanceTaskResultV1[]>;
137
- /**
138
- * Fail fast on maintenance options the store would otherwise reject on every
139
- * pass. Mirrors the checks `retireExpiredPeriods` and `pruneChanges` apply.
140
- *
141
- * @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
142
- */
143
- export declare function assertReportingLedgerMaintenanceOptions(input: {
144
- retention?: ReportingRetentionOptionsV1 | undefined;
145
- compaction?: ReportingCompactionOptionsV1 | undefined;
146
- changeFeed?: ReportingChangeFeedMaintenanceOptionsV1 | undefined;
147
- }, statusRetentionDays: number): void;
148
- export {};
@@ -1,148 +0,0 @@
1
- import type { PostgresReportingLedgerStore } from '../ledger';
2
- /**
3
- * Period-aligned retention. Whole periods are retired once
4
- * `max(statusRetentionDays, recordRetentionDays)` has elapsed since both the
5
- * period end and its latest publication. `statusRetentionDays` always comes
6
- * from the service, so retention can never disagree with the commitment the
7
- * service advertises to buyers.
8
- *
9
- * @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
10
- */
11
- export interface ReportingRetentionOptionsV1 {
12
- enabled: true;
13
- recordRetentionDays?: number;
14
- limit?: number;
15
- }
16
- /**
17
- * Opt-in compaction of superseded snapshot revisions to metadata only, as
18
- * adcontextprotocol/adcp#8100 permits. Off unless `enabled: true`. Uses the
19
- * service's `statusRetentionDays` and `automatedRecoveryWindowSeconds`, so it
20
- * can never drop content earlier than the commitments advertised to buyers.
21
- *
22
- * Compaction takes effect in the AdCP release after November 20, 2026; do not
23
- * enable it in production before then. See `docs/guides/REPORTING-OPERATIONS.md`.
24
- *
25
- * @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
26
- */
27
- export interface ReportingCompactionOptionsV1 {
28
- enabled: true;
29
- /** Revisions compacted per pass. Defaults to 100. */
30
- limit?: number;
31
- }
32
- /**
33
- * Change-feed pruning window and the consumer hold shared with retention.
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 type ReportingChangeFeedMaintenanceOptionsV1 = boolean | {
38
- changeRetentionDays?: number;
39
- maxFeedHoldDays?: number;
40
- };
41
- /**
42
- * The ledger-store surface a maintenance pass drives.
43
- *
44
- * @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
45
- */
46
- export type ReportingLedgerMaintenanceStoreV1 = Pick<PostgresReportingLedgerStore, 'sweepRowWriteIntents' | 'pruneChanges' | 'retireExpiredPeriods'> & Partial<Pick<PostgresReportingLedgerStore, 'compactSupersededSnapshots'>>;
47
- interface ReportingLedgerMaintenanceTaskOutcomesV1 {
48
- 'snapshot sweep': Awaited<ReturnType<PostgresReportingLedgerStore['sweepExpiredState']>>;
49
- 'row upload sweep': Awaited<ReturnType<PostgresReportingLedgerStore['sweepRowWriteIntents']>>;
50
- 'change-feed pruning': Awaited<ReturnType<PostgresReportingLedgerStore['pruneChanges']>>;
51
- retention: Awaited<ReturnType<PostgresReportingLedgerStore['retireExpiredPeriods']>>;
52
- 'snapshot compaction': Awaited<ReturnType<PostgresReportingLedgerStore['compactSupersededSnapshots']>>;
53
- }
54
- /**
55
- * @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
56
- */
57
- export type ReportingLedgerMaintenanceTaskNameV1 = keyof ReportingLedgerMaintenanceTaskOutcomesV1;
58
- /**
59
- * A scheduled maintenance pass completed but could not process some items
60
- * (for example, a retention period whose objects could not be deleted). The
61
- * pass resumes them next time; repeated reports need operator attention.
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 declare class ReportingMaintenancePartialFailureError extends Error {
66
- readonly task: string;
67
- readonly failedCount: number;
68
- readonly failedIds: readonly string[];
69
- /**
70
- * Backlog the task is not reaching: items backing off, items this host cannot
71
- * handle, items that have failed persistently. Appended to the message so
72
- * `onError` and the logs carry them.
73
- */
74
- readonly warnings: readonly string[];
75
- constructor(task: string, failedCount: number, failedIds: readonly string[],
76
- /**
77
- * Backlog the task is not reaching: items backing off, items this host cannot
78
- * handle, items that have failed persistently. Appended to the message so
79
- * `onError` and the logs carry them.
80
- */
81
- warnings?: readonly string[]);
82
- }
83
- /**
84
- * Outcome of one maintenance task. A task that resolved but could not process
85
- * some items (a retention period whose objects would not delete, an upload that
86
- * would not sweep) is `completed` with `partialFailure` set; the pass resumes
87
- * those items next time.
88
- *
89
- * @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
90
- */
91
- export type ReportingLedgerMaintenanceTaskResultV1 = {
92
- [Task in ReportingLedgerMaintenanceTaskNameV1]: {
93
- readonly task: Task;
94
- readonly status: 'completed';
95
- readonly result: ReportingLedgerMaintenanceTaskOutcomesV1[Task];
96
- readonly partialFailure?: ReportingMaintenancePartialFailureError;
97
- } | {
98
- readonly task: Task;
99
- readonly status: 'failed';
100
- readonly error: unknown;
101
- };
102
- }[ReportingLedgerMaintenanceTaskNameV1];
103
- /**
104
- * @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
105
- */
106
- export interface RunReportingLedgerMaintenanceInputV1 {
107
- store: ReportingLedgerMaintenanceStoreV1;
108
- /**
109
- * Expired cursor snapshot and checkpoint sweep. Omitted when the caller has
110
- * no way to reach the database, in which case that task is not run.
111
- */
112
- sweepSnapshots?: (limit: number) => Promise<ReportingLedgerMaintenanceTaskOutcomesV1['snapshot sweep']>;
113
- statusRetentionDays: number;
114
- /** The service's advertised `automated_recovery_window_seconds`; required when `compaction` is enabled. */
115
- automatedRecoveryWindowSeconds?: number | undefined;
116
- retention?: ReportingRetentionOptionsV1 | undefined;
117
- compaction?: ReportingCompactionOptionsV1 | undefined;
118
- changeFeed?: ReportingChangeFeedMaintenanceOptionsV1 | undefined;
119
- signal?: AbortSignal | undefined;
120
- /**
121
- * Called, in task order and awaited, for every task that rejected or
122
- * partially failed, unless `signal` has aborted (an abort is shutdown, not a
123
- * fault).
124
- */
125
- report?: (error: unknown) => Promise<void>;
126
- }
127
- /**
128
- * The single ledger-maintenance pass shared by the Core service and the
129
- * production service, so partial-failure surfacing, the `maxFeedHoldDays` that
130
- * retention honours, per-task limits and abort handling cannot drift between
131
- * them. Tasks start together, in a fixed order, and are isolated: one task's
132
- * failure never prevents another from running.
133
- *
134
- * @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
135
- */
136
- export declare function runReportingLedgerMaintenance(input: RunReportingLedgerMaintenanceInputV1): Promise<ReportingLedgerMaintenanceTaskResultV1[]>;
137
- /**
138
- * Fail fast on maintenance options the store would otherwise reject on every
139
- * pass. Mirrors the checks `retireExpiredPeriods` and `pruneChanges` apply.
140
- *
141
- * @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
142
- */
143
- export declare function assertReportingLedgerMaintenanceOptions(input: {
144
- retention?: ReportingRetentionOptionsV1 | undefined;
145
- compaction?: ReportingCompactionOptionsV1 | undefined;
146
- changeFeed?: ReportingChangeFeedMaintenanceOptionsV1 | undefined;
147
- }, statusRetentionDays: number): void;
148
- export {};