@attestry/sdk 0.6.0

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 (99) hide show
  1. package/LICENSE +190 -0
  2. package/README.md +1269 -0
  3. package/dist/client.d.ts +58 -0
  4. package/dist/client.d.ts.map +1 -0
  5. package/dist/client.js +74 -0
  6. package/dist/client.js.map +1 -0
  7. package/dist/constants.d.ts +7 -0
  8. package/dist/constants.d.ts.map +1 -0
  9. package/dist/constants.js +43 -0
  10. package/dist/constants.js.map +1 -0
  11. package/dist/errors.d.ts +16 -0
  12. package/dist/errors.d.ts.map +1 -0
  13. package/dist/errors.js +41 -0
  14. package/dist/errors.js.map +1 -0
  15. package/dist/index.d.ts +17 -0
  16. package/dist/index.d.ts.map +1 -0
  17. package/dist/index.js +20 -0
  18. package/dist/index.js.map +1 -0
  19. package/dist/lines-parser.d.ts +50 -0
  20. package/dist/lines-parser.d.ts.map +1 -0
  21. package/dist/lines-parser.js +211 -0
  22. package/dist/lines-parser.js.map +1 -0
  23. package/dist/ndjson-parser.d.ts +57 -0
  24. package/dist/ndjson-parser.d.ts.map +1 -0
  25. package/dist/ndjson-parser.js +245 -0
  26. package/dist/ndjson-parser.js.map +1 -0
  27. package/dist/resources/abac-policies.d.ts +1034 -0
  28. package/dist/resources/abac-policies.d.ts.map +1 -0
  29. package/dist/resources/abac-policies.js +1519 -0
  30. package/dist/resources/abac-policies.js.map +1 -0
  31. package/dist/resources/audit-log.d.ts +588 -0
  32. package/dist/resources/audit-log.d.ts.map +1 -0
  33. package/dist/resources/audit-log.js +629 -0
  34. package/dist/resources/audit-log.js.map +1 -0
  35. package/dist/resources/batch.d.ts +845 -0
  36. package/dist/resources/batch.d.ts.map +1 -0
  37. package/dist/resources/batch.js +1074 -0
  38. package/dist/resources/batch.js.map +1 -0
  39. package/dist/resources/chat.d.ts +151 -0
  40. package/dist/resources/chat.d.ts.map +1 -0
  41. package/dist/resources/chat.js +124 -0
  42. package/dist/resources/chat.js.map +1 -0
  43. package/dist/resources/check.d.ts +348 -0
  44. package/dist/resources/check.d.ts.map +1 -0
  45. package/dist/resources/check.js +543 -0
  46. package/dist/resources/check.js.map +1 -0
  47. package/dist/resources/compliance-check.d.ts +330 -0
  48. package/dist/resources/compliance-check.d.ts.map +1 -0
  49. package/dist/resources/compliance-check.js +402 -0
  50. package/dist/resources/compliance-check.js.map +1 -0
  51. package/dist/resources/decisions.d.ts +1208 -0
  52. package/dist/resources/decisions.d.ts.map +1 -0
  53. package/dist/resources/decisions.js +1362 -0
  54. package/dist/resources/decisions.js.map +1 -0
  55. package/dist/resources/evidence-pack.d.ts +1080 -0
  56. package/dist/resources/evidence-pack.d.ts.map +1 -0
  57. package/dist/resources/evidence-pack.js +1789 -0
  58. package/dist/resources/evidence-pack.js.map +1 -0
  59. package/dist/resources/gate.d.ts +613 -0
  60. package/dist/resources/gate.d.ts.map +1 -0
  61. package/dist/resources/gate.js +737 -0
  62. package/dist/resources/gate.js.map +1 -0
  63. package/dist/resources/incidents.d.ts +136 -0
  64. package/dist/resources/incidents.d.ts.map +1 -0
  65. package/dist/resources/incidents.js +229 -0
  66. package/dist/resources/incidents.js.map +1 -0
  67. package/dist/resources/regulatory-changes.d.ts +307 -0
  68. package/dist/resources/regulatory-changes.d.ts.map +1 -0
  69. package/dist/resources/regulatory-changes.js +365 -0
  70. package/dist/resources/regulatory-changes.js.map +1 -0
  71. package/dist/resources/safe-input-read.d.ts +21 -0
  72. package/dist/resources/safe-input-read.d.ts.map +1 -0
  73. package/dist/resources/safe-input-read.js +57 -0
  74. package/dist/resources/safe-input-read.js.map +1 -0
  75. package/dist/resources/ship-gate.d.ts +475 -0
  76. package/dist/resources/ship-gate.d.ts.map +1 -0
  77. package/dist/resources/ship-gate.js +727 -0
  78. package/dist/resources/ship-gate.js.map +1 -0
  79. package/dist/resources/vision.d.ts +540 -0
  80. package/dist/resources/vision.d.ts.map +1 -0
  81. package/dist/resources/vision.js +1036 -0
  82. package/dist/resources/vision.js.map +1 -0
  83. package/dist/retry.d.ts +103 -0
  84. package/dist/retry.d.ts.map +1 -0
  85. package/dist/retry.js +224 -0
  86. package/dist/retry.js.map +1 -0
  87. package/dist/sse-parser.d.ts +64 -0
  88. package/dist/sse-parser.d.ts.map +1 -0
  89. package/dist/sse-parser.js +271 -0
  90. package/dist/sse-parser.js.map +1 -0
  91. package/dist/transport.d.ts +142 -0
  92. package/dist/transport.d.ts.map +1 -0
  93. package/dist/transport.js +455 -0
  94. package/dist/transport.js.map +1 -0
  95. package/dist/types.d.ts +61 -0
  96. package/dist/types.d.ts.map +1 -0
  97. package/dist/types.js +3 -0
  98. package/dist/types.js.map +1 -0
  99. package/package.json +44 -0
@@ -0,0 +1,1080 @@
1
+ import type { AttestryClient } from "../client.js";
2
+ import type { RequestOptions } from "../types.js";
3
+ /**
4
+ * The five evidence-pack types the kernel accepts. Mirrors
5
+ * `PACK_TYPES` in kernel `src/lib/evidence-pack/types.ts:150-156`.
6
+ * Frozen so consumer code can safely use
7
+ * `PACK_TYPES.includes(...)` without mutation risk (P1 hardening —
8
+ * defends against a hostile/buggy npm dep mutating the array between
9
+ * SDK import and method call).
10
+ *
11
+ * Drift-pinned in the spec-diff round (`evidence-pack.drift.test.ts`)
12
+ * by text-comparing this declaration with the kernel's. An addition /
13
+ * removal / reordering on either side trips the test, **satisfying P1
14
+ * checkpoint AC7** ("SDK drift pin: `pack_type` enum in SDK matches
15
+ * kernel").
16
+ */
17
+ export declare const PACK_TYPES: readonly ["annex_iv", "agentic_reperformance", "red_team_cycle", "pccp_evidence", "underwriting_evidence"];
18
+ export type PackType = (typeof PACK_TYPES)[number];
19
+ /**
20
+ * The five pack-status values the kernel emits + accepts as a filter.
21
+ * Mirrors `PACK_STATUSES` in kernel `src/lib/evidence-pack/types.ts:160-166`.
22
+ * Frozen; drift-pinned identically to `PACK_TYPES`.
23
+ */
24
+ export declare const PACK_STATUSES: readonly ["draft", "signed", "superseded", "revoked", "expired"];
25
+ export type PackStatus = (typeof PACK_STATUSES)[number];
26
+ /**
27
+ * The three artifact formats `evidencePack.export` accepts. Mirrors
28
+ * `EXPORT_FORMATS` in kernel `src/lib/evidence-pack/types.ts:584`
29
+ * (`["json","pdf","zip"] as const`). Frozen; drift-pinned byte-equal to
30
+ * the kernel in `evidence-pack.drift.test.ts` (P1.8 DEV-76).
31
+ *
32
+ * The kernel route's `exportQuerySchema` requires `format` (no default,
33
+ * spec concern E1 — unknown/absent → 422). The SDK pre-validates
34
+ * `format` against this frozen tuple, so an absent/unknown format
35
+ * rejects with a synchronous `TypeError` before the request is sent.
36
+ */
37
+ export declare const EXPORT_FORMATS: readonly ["json", "pdf", "zip"];
38
+ export type ExportFormat = (typeof EXPORT_FORMATS)[number];
39
+ /**
40
+ * Input for `evidencePack.create`. Mirrors the wire body of
41
+ * `POST /api/v1/evidence-packs` (kernel `createEvidencePackInputSchema`
42
+ * minus the auth-derived `orgId` and `userId` fields).
43
+ *
44
+ * P1.6-scope fields (4) — matches the P1.5 MCP `attestry_evidence_pack_create`
45
+ * surface for SDK ↔ MCP parity (DEV-67). The kernel route ALSO accepts
46
+ * `consumerHints` (P3 future) and `parentPackId` (P1.4 supersede surface);
47
+ * P1.6 deliberately omits both to match MCP parity. A future SDK
48
+ * extension may add them without breaking the 4-field surface.
49
+ */
50
+ export interface CreateEvidencePackInput {
51
+ /**
52
+ * One of the five `PACK_TYPES` values. Pre-validated by the SDK against
53
+ * the local frozen tuple; rejection is a synchronous `TypeError`
54
+ * (P1.6 spec hostile concern #1).
55
+ */
56
+ packType: PackType;
57
+ /**
58
+ * Optional UUID of the AI system the pack is scoped to. Omit for an
59
+ * org-level pack (kernel column is nullable; org-level packs are
60
+ * legitimate for underwriting / cross-system evidence). Pre-validated
61
+ * against `UUID_REGEX` when provided.
62
+ */
63
+ systemId?: string;
64
+ /**
65
+ * Optional array of regulatory framework bindings (up to 50). Each
66
+ * binding's inner shape is open-spec to the SDK (faithful courier —
67
+ * kernel `frameworkBindingSchema` is the deep validator with
68
+ * `.strict()` enforcement of `framework` + `identifier` +
69
+ * `jurisdiction?` + `effective_date?`).
70
+ */
71
+ frameworkBindings?: unknown[];
72
+ /**
73
+ * Optional free-form metadata object (string-keyed). Capped by the
74
+ * kernel at 64 KiB serialized (`MAX_METADATA_BYTES`); the SDK does
75
+ * NOT pre-validate the size cap (no extra `JSON.stringify` cost on
76
+ * the happy path), leaving the kernel as the authority — same
77
+ * faithful-courier discipline as `vision.extract` deep field shapes.
78
+ */
79
+ metadata?: Record<string, unknown>;
80
+ }
81
+ /**
82
+ * Input for `evidencePack.get`. Mirrors the URL-path param of
83
+ * `GET /api/v1/evidence-packs/{id}` — single field.
84
+ */
85
+ export interface GetEvidencePackInput {
86
+ /**
87
+ * UUID of the evidence pack to retrieve. RFC 4122 hyphenated form
88
+ * (8-4-4-4-12 hex, case-insensitive). Pre-validated by the SDK before
89
+ * the URL is constructed.
90
+ */
91
+ packId: string;
92
+ }
93
+ /**
94
+ * Input for `evidencePack.list`. Mirrors the query-string of
95
+ * `GET /api/v1/evidence-packs` (kernel `listEvidencePacksQuerySchema`
96
+ * MINUS `parentPackId` — see DEV-67; the SDK matches the P1.5 MCP
97
+ * surface parity, not the wider kernel route surface).
98
+ *
99
+ * **Single page per call** (DEV-63) — pass the response's `nextCursor`
100
+ * back as `cursor` on a subsequent call to fetch the next page. No
101
+ * async-iterator today; a future SDK-wide prompt may add cross-resource
102
+ * iteration.
103
+ *
104
+ * **`limit` default applied kernel-side**: when omitted, the kernel
105
+ * applies `.default(50)` (carry-forward invariant #52 — closed-default
106
+ * field pre-validation; the SDK omits the field from the query string
107
+ * so the kernel's default fires).
108
+ */
109
+ export interface ListEvidencePacksInput {
110
+ /** Optional UUID filter — return only packs scoped to this AI system. */
111
+ systemId?: string;
112
+ /** Optional closed-enum filter on `pack_type`. */
113
+ packType?: PackType;
114
+ /** Optional closed-enum filter on `status`. */
115
+ status?: PackStatus;
116
+ /**
117
+ * Optional page size. Integer in [1, 200] inclusive. Omitted →
118
+ * kernel-side default of 50.
119
+ */
120
+ limit?: number;
121
+ /**
122
+ * Optional opaque pagination cursor. Pass the `nextCursor` from a
123
+ * previous call to fetch the next page. Base64url-encoded JSON
124
+ * `{c, i}` (kernel format; the SDK passes through verbatim and does
125
+ * NOT decode).
126
+ */
127
+ cursor?: string;
128
+ }
129
+ /**
130
+ * Input for `evidencePack.addBundle`. Mirrors the wire body + URL-path
131
+ * param of `POST /api/v1/evidence-packs/{id}/bundles` (kernel
132
+ * `addBundleToPackInputSchema` minus the auth-derived `orgId` and
133
+ * `userId`; `packId` rides the URL path, not the body).
134
+ *
135
+ * 8 fields total (DEV-67) — 4 required + 4 optional, matching the
136
+ * P1.5 MCP `attestry_evidence_pack_append_bundle` surface.
137
+ */
138
+ export interface AddBundleInput {
139
+ /**
140
+ * UUID of the draft pack to append the bundle to. RFC 4122 hyphenated.
141
+ * Pre-validated by the SDK before the URL is constructed.
142
+ */
143
+ packId: string;
144
+ /**
145
+ * Ordered array of trace entries (up to 1000). Per-entry shape is
146
+ * open-spec to the SDK (kernel `traceEntrySchema` deep-validates
147
+ * `action` / `timestamp` / `refs?` with `.strict()`).
148
+ */
149
+ traceContent: unknown[];
150
+ /**
151
+ * Non-empty hash string identifying the bundle's inputs. Length
152
+ * 1-500 chars. Format is open-spec to the SDK (kernel accepts any
153
+ * non-empty length-bounded string; the project convention is
154
+ * `sha256:<hex>` but the kernel does NOT enforce it).
155
+ */
156
+ inputsHash: string;
157
+ /**
158
+ * Non-empty hash string identifying the bundle's outputs. Length
159
+ * 1-500 chars; same open-spec rule as `inputsHash`.
160
+ */
161
+ outputsHash: string;
162
+ /**
163
+ * Optional model-behavior log. Open-spec inner shape (kernel
164
+ * `modelBehaviorLogSchema` deep-validates `model` / `version` /
165
+ * `sampling_params?` / `response_hash?`).
166
+ */
167
+ modelBehaviorLog?: Record<string, unknown>;
168
+ /**
169
+ * Optional corroboration-results object (free-form jsonb). Depth-
170
+ * capped server-side at 64 levels (kernel `MAX_HASHED_JSONB_DEPTH`);
171
+ * the SDK does NOT pre-validate depth.
172
+ */
173
+ corroborationResults?: Record<string, unknown>;
174
+ /**
175
+ * Optional `http(s)://` URI of bundle binary content in storage.
176
+ * Length-capped at 2000 chars (kernel `httpsOnlyUrl(2000)`). Scheme
177
+ * validation (`^https?://`) is kernel-authoritative; the SDK
178
+ * validates length only (faithful courier).
179
+ */
180
+ storageUri?: string;
181
+ /**
182
+ * Optional free-form metadata. Capped by the kernel at 64 KiB
183
+ * serialized; SDK does NOT pre-validate the size.
184
+ */
185
+ metadata?: Record<string, unknown>;
186
+ }
187
+ /**
188
+ * Input for `evidencePack.sign`. Mirrors the URL-path param + wire body
189
+ * of `POST /api/v1/evidence-packs/{id}/sign` (kernel `signPackInputSchema`
190
+ * minus the auth-derived `orgId` / `userId`; `packId` rides the URL
191
+ * path). Matches the P1.7 MCP `attestry_evidence_pack_sign` surface
192
+ * (the MCP `confirm` gate is MCP-layer-only and NOT mirrored here).
193
+ */
194
+ export interface SignEvidencePackInput {
195
+ /**
196
+ * UUID of the **draft** pack to sign. RFC 4122 hyphenated. Pre-validated
197
+ * by the SDK before the URL is constructed.
198
+ */
199
+ packId: string;
200
+ /**
201
+ * Optional UUID of an attestation certificate to bind to the signed
202
+ * pack. When provided, the kernel verifies it belongs to the caller's
203
+ * org (and, for a system-scoped pack, matches the pack's system).
204
+ * Omit to sign without an attestation cert (`content_hash` is the
205
+ * signing primitive). Pre-validated against `UUID_REGEX` when provided.
206
+ */
207
+ attestationCertificateId?: string;
208
+ }
209
+ /**
210
+ * Inner-payload shape for the new draft pack a `supersede` creates.
211
+ * Mirrors the kernel `supersedeNewPackPayloadSchema` and the P1.7 MCP
212
+ * `supersede` tool's `newPack` shape.
213
+ *
214
+ * **Includes `consumerHints`** (P1.8 DEV-74) — unlike P1.6's `create`
215
+ * input, which deliberately omitted it (DEV-67) to match the MCP
216
+ * **create** tool. The MCP **supersede** tool's `newPack` includes
217
+ * `consumerHints`, so the SDK supersede mirrors it.
218
+ */
219
+ export interface SupersedeEvidencePackNewPack {
220
+ /**
221
+ * One of the five `PACK_TYPES` values. Pre-validated against the local
222
+ * frozen tuple; rejection is a synchronous `TypeError`.
223
+ */
224
+ packType: PackType;
225
+ /**
226
+ * Optional UUID of the AI system the new pack is scoped to. Omit for
227
+ * an org-level pack. Pre-validated against `UUID_REGEX` when provided.
228
+ */
229
+ systemId?: string;
230
+ /**
231
+ * Optional array of regulatory framework bindings (up to 50). Inner
232
+ * shape is open-spec to the SDK (kernel `frameworkBindingSchema` is the
233
+ * `.strict()` deep validator) — same faithful-courier discipline as
234
+ * `create`'s `frameworkBindings`.
235
+ */
236
+ frameworkBindings?: unknown[];
237
+ /**
238
+ * Optional consumer-consumption hints object (kernel
239
+ * `consumerHintsSchema` = `{allowPublicRetrieval?, suggestedVerifier?,
240
+ * expectedQueryPatterns?}`, `.strict()`). The SDK validates only that
241
+ * it is a non-null non-array object and forwards it as-is; the kernel
242
+ * deep-validates the keys + the `https`-only verifier URL + caps.
243
+ */
244
+ consumerHints?: Record<string, unknown>;
245
+ /**
246
+ * Optional free-form metadata object (string-keyed). Capped kernel-side
247
+ * at 64 KiB serialized; the SDK does NOT pre-validate the size.
248
+ */
249
+ metadata?: Record<string, unknown>;
250
+ }
251
+ /**
252
+ * Input for `evidencePack.supersede`. Mirrors the URL-path param + wire
253
+ * body of `POST /api/v1/evidence-packs/{id}/supersede` (kernel
254
+ * `supersedePackInputSchema` minus the auth-derived `orgId` / `userId`;
255
+ * the old pack's id rides the URL path as `packId`).
256
+ */
257
+ export interface SupersedeEvidencePackInput {
258
+ /**
259
+ * UUID of the **signed** pack to supersede (the OLD pack). RFC 4122
260
+ * hyphenated. Rides the URL path. Pre-validated by the SDK.
261
+ */
262
+ packId: string;
263
+ /**
264
+ * Payload for the NEW draft pack the supersede creates. Required. The
265
+ * kernel splices in `orgId` / `userId` (auth) + `parentPackId` (= the
266
+ * old `packId`) at the transaction layer.
267
+ */
268
+ newPack: SupersedeEvidencePackNewPack;
269
+ }
270
+ /**
271
+ * Input for `evidencePack.revoke`. Mirrors the URL-path param + wire body
272
+ * of `POST /api/v1/evidence-packs/{id}/revoke` (kernel
273
+ * `revokePackInputSchema` minus the auth-derived `orgId` / `userId`;
274
+ * `packId` rides the URL path).
275
+ */
276
+ export interface RevokeEvidencePackInput {
277
+ /**
278
+ * UUID of the **signed** pack to revoke. RFC 4122 hyphenated.
279
+ * Pre-validated by the SDK before the URL is constructed.
280
+ */
281
+ packId: string;
282
+ /**
283
+ * Optional human-readable revocation reason, recorded verbatim in the
284
+ * pack's audit-log entry. Length 1-500 chars (kernel
285
+ * `z.string().min(1).max(500)`). Pre-validated when provided.
286
+ */
287
+ reason?: string;
288
+ }
289
+ /**
290
+ * Input for `evidencePack.export`. Mirrors the URL-path param + query
291
+ * string of `GET /api/v1/evidence-packs/{id}/export?format={json|pdf|zip}`.
292
+ */
293
+ export interface ExportEvidencePackInput {
294
+ /**
295
+ * UUID of the pack to export. RFC 4122 hyphenated. Rides the URL path.
296
+ * Pre-validated by the SDK.
297
+ */
298
+ packId: string;
299
+ /**
300
+ * One of the three `EXPORT_FORMATS` values (`json` / `pdf` / `zip`).
301
+ * **Required** — the kernel `exportQuerySchema` has no default (spec
302
+ * concern E1). Pre-validated against the frozen tuple; an absent or
303
+ * unknown format rejects with a synchronous `TypeError`.
304
+ */
305
+ format: ExportFormat;
306
+ }
307
+ /**
308
+ * An evidence-pack record. Mirrors `EvidencePack` (kernel
309
+ * `InferSelectModel<typeof evidencePacks>`) projected through
310
+ * `successResponse` (`NextResponse.json` serializes Drizzle `Date`
311
+ * columns as ISO-8601 strings — wire shape).
312
+ *
313
+ * Closed-enum fields (`packType`, `status`) are typed as the SDK's
314
+ * closed unions for compile-time narrowing but the runtime P2 validator
315
+ * checks `typeof === "string"` only (faithful courier — same
316
+ * convention as `gate.gate` / `vision.packIntegration.status` /
317
+ * `BulkFailedSummary.code`). A kernel-side enum addition before the
318
+ * SDK is bumped will round-trip at runtime (typed as the closed union
319
+ * at compile time but holding the new string); the drift pin
320
+ * (`evidence-pack.drift.test.ts`) fires in CI before that scenario
321
+ * reaches consumers.
322
+ *
323
+ * Nullable columns surface as `T | null` on the wire (kernel column
324
+ * definitions with `.nullable()` semantics — see
325
+ * `src/lib/db/schema.ts`).
326
+ */
327
+ export interface EvidencePack {
328
+ /** UUID of the pack. */
329
+ id: string;
330
+ /** Pack type closed enum (typed-closed, runtime-open). */
331
+ packType: PackType;
332
+ /** UUID of the owning organization. */
333
+ orgId: string;
334
+ /** UUID of the scoped AI system, or `null` for org-level packs. */
335
+ systemId: string | null;
336
+ /** Pack status closed enum (typed-closed, runtime-open). */
337
+ status: PackStatus;
338
+ /**
339
+ * Framework bindings JSONB. Runtime shape is an array of binding
340
+ * objects (kernel default `[]::jsonb`); typed as `unknown` here so
341
+ * consumers can deep-validate per their needs without a tight SDK
342
+ * coupling. The P2 validator requires an array (the kernel column
343
+ * is `notNull` with a default empty array; any other shape would be
344
+ * a kernel regression).
345
+ */
346
+ frameworkBindings: unknown[];
347
+ /** UUID of the parent pack when this pack supersedes one, else `null`. */
348
+ parentPackId: string | null;
349
+ /** UUID of the pack that supersedes this one, else `null`. */
350
+ supersededById: string | null;
351
+ /**
352
+ * Consumer-hints JSONB. Runtime shape is `{allowPublicRetrieval?,
353
+ * suggestedVerifier?, expectedQueryPatterns?}` (kernel default
354
+ * `{}::jsonb`). Typed as `unknown` for the same reason as
355
+ * `frameworkBindings`; P2 validator requires a non-null non-array
356
+ * object.
357
+ */
358
+ consumerHints: unknown;
359
+ /** UUID of the linked attestation certificate, or `null` when unsigned. */
360
+ attestationCertificateId: string | null;
361
+ /** SHA-256 hash of the canonical bundle list, or `null` in `draft` state. */
362
+ contentHash: string | null;
363
+ /** ISO-8601 timestamp of `sign` transition, or `null` when unsigned. */
364
+ signedAt: string | null;
365
+ /** UUID of the signing user, or `null` when unsigned. */
366
+ signedByUserId: string | null;
367
+ /**
368
+ * Free-form metadata JSONB. Default `{}::jsonb`. Typed `unknown`; P2
369
+ * validator requires a non-null non-array object.
370
+ */
371
+ metadata: unknown;
372
+ /** ISO-8601 timestamp of pack creation. */
373
+ createdAt: string;
374
+ }
375
+ /**
376
+ * A reperformance-bundle record. Mirrors `ReperformanceBundle` (kernel
377
+ * `InferSelectModel<typeof reperformanceBundles>`) projected through
378
+ * `successResponse` (Drizzle `Date` → ISO-8601 string).
379
+ */
380
+ export interface ReperformanceBundle {
381
+ /** UUID of the bundle. */
382
+ id: string;
383
+ /** UUID of the parent pack. */
384
+ evidencePackId: string;
385
+ /**
386
+ * Trace-content array (kernel `notNull` jsonb). Per-entry shape is
387
+ * `{action, timestamp, refs?}` runtime; typed `unknown` here.
388
+ */
389
+ traceContent: unknown[];
390
+ /** Caller-supplied inputs hash. */
391
+ inputsHash: string;
392
+ /** Caller-supplied outputs hash. */
393
+ outputsHash: string;
394
+ /** Optional model-behavior-log object, or `null`. */
395
+ modelBehaviorLog: unknown;
396
+ /** Optional corroboration-results object, or `null`. */
397
+ corroborationResults: unknown;
398
+ /** Optional storage URI, or `null`. */
399
+ storageUri: string | null;
400
+ /** Free-form metadata (kernel default `{}::jsonb`). */
401
+ metadata: unknown;
402
+ /** ISO-8601 timestamp of bundle creation. */
403
+ createdAt: string;
404
+ }
405
+ /**
406
+ * Response for `evidencePack.get`. Mirrors the kernel's
407
+ * `GetEvidencePackResult` (`{pack, bundles}`) — the pack plus its
408
+ * full bundle list ordered `(created_at, id) ASC` (kernel
409
+ * `queries.ts:275-278`).
410
+ */
411
+ export interface GetEvidencePackResponse {
412
+ pack: EvidencePack;
413
+ bundles: ReperformanceBundle[];
414
+ }
415
+ /**
416
+ * Response for `evidencePack.list`. Mirrors the kernel's
417
+ * `ListEvidencePacksResult` (`{items, nextCursor}`) — newest-first
418
+ * keyset pagination over `(created_at DESC, id DESC)`. `nextCursor`
419
+ * is `null` when no more pages.
420
+ */
421
+ export interface ListEvidencePacksResponse {
422
+ items: EvidencePack[];
423
+ /** Opaque cursor for the next page, or `null` when no more pages. */
424
+ nextCursor: string | null;
425
+ }
426
+ /**
427
+ * `hashCollision` block on the `addBundle` response. The kernel
428
+ * detects same-`(inputs_hash, outputs_hash)` collisions with prior
429
+ * bundles on the SAME pack and FLAGS (does NOT block — P1.2 DEV-17).
430
+ *
431
+ * `count` is the total number of colliding prior bundles;
432
+ * `collidingBundleIds` is a bounded sample of up to 10 ids (kernel
433
+ * hostile-redux F-14 — capped so the response doesn't grow
434
+ * unboundedly under dup-heavy packs).
435
+ */
436
+ export interface HashCollision {
437
+ detected: boolean;
438
+ count: number;
439
+ collidingBundleIds: string[];
440
+ }
441
+ /**
442
+ * Response for `evidencePack.addBundle`. Mirrors the kernel's
443
+ * `AddBundleToPackResult` — the newly-appended bundle, the updated
444
+ * pack (with recomputed `content_hash`), and the collision flag.
445
+ */
446
+ export interface AddBundleResponse {
447
+ bundle: ReperformanceBundle;
448
+ pack: EvidencePack;
449
+ hashCollision: HashCollision;
450
+ }
451
+ /**
452
+ * Response for `evidencePack.supersede`. Mirrors the kernel
453
+ * `supersedePack` return (`{newPack, oldPack}`, HTTP 201). `newPack` is
454
+ * the freshly-created draft (status `draft`, `parentPackId` = the old
455
+ * pack); `oldPack` is the now-`superseded` old pack (with
456
+ * `supersededById` set). Both are full `EvidencePack` records (each
457
+ * P2-validated via `validatePack`).
458
+ */
459
+ export interface SupersedeEvidencePackResponse {
460
+ newPack: EvidencePack;
461
+ oldPack: EvidencePack;
462
+ }
463
+ /**
464
+ * Result of `evidencePack.export` (P1.8 DEV-73). The kernel export route
465
+ * returns a downloadable artifact, NOT the `{success, data}` JSON
466
+ * envelope — so the SDK is a faithful courier: it surfaces the
467
+ * un-consumed `Response` and lets the consumer read the body in the form
468
+ * the format dictates.
469
+ *
470
+ * - `json` → `response.json()` yields the raw artifact
471
+ * `{export:{format,generatedAt,schemaVersion}, pack, bundles}`.
472
+ * - `pdf` → `await response.arrayBuffer()` (or `.bytes()`) yields the
473
+ * PDF bytes.
474
+ * - `zip` → `response.body` is a `ReadableStream<Uint8Array>` (stream
475
+ * it to disk for large packs), or `await response.blob()`.
476
+ *
477
+ * The transport's `_streamRequest` has already verified the HTTP status
478
+ * (a non-2xx threw `AttestryAPIError`) and that the response's
479
+ * `Content-Type` MIME matches the requested format — so reading `body`
480
+ * will not surprise the consumer with an HTML error page.
481
+ */
482
+ export interface EvidencePackExportResult {
483
+ /** The requested export format, echoed back. */
484
+ format: ExportFormat;
485
+ /**
486
+ * The kernel `Content-Type` for this artifact
487
+ * (`application/json` | `application/pdf` | `application/zip`).
488
+ * Guaranteed to equal the response's MIME (the transport's content-type
489
+ * guard threw otherwise).
490
+ */
491
+ contentType: string;
492
+ /**
493
+ * The kernel `Content-Disposition` download header
494
+ * (`attachment; filename="evidence-pack-<id>.<fmt>"`), or `null` if a
495
+ * proxy stripped it (the kernel always sets it).
496
+ */
497
+ contentDisposition: string | null;
498
+ /**
499
+ * The un-consumed `Response`. Call `.json()` / `.arrayBuffer()` /
500
+ * `.blob()` or read `.body` as a stream.
501
+ */
502
+ response: Response;
503
+ }
504
+ /**
505
+ * `evidencePack` resource — sibling to `IncidentsResource`,
506
+ * `DecisionsResource`, `ChatResource`, `AuditLogResource`,
507
+ * `RegulatoryChangesResource`, `ComplianceCheckResource`,
508
+ * `CheckResource`, `GateResource`, `VisionResource`.
509
+ *
510
+ * Eight methods: the P1.6 core (`create`, `get`, `list`, `addBundle`)
511
+ * plus the P1.8 lifecycle/export ops (`sign`, `supersede`, `revoke`,
512
+ * `export`). All are JSON request/response (`{success,data}` envelope
513
+ * via `_request`) EXCEPT `export`, which returns a downloadable artifact
514
+ * (json/pdf/zip) via the streaming transport `_streamRequest`.
515
+ */
516
+ export declare class EvidencePackResource {
517
+ private readonly client;
518
+ constructor(client: AttestryClient);
519
+ /**
520
+ * Create a new draft evidence pack for the authenticated organization.
521
+ * Wraps `POST /api/v1/evidence-packs`.
522
+ *
523
+ * `orgId` and `userId` are derived server-side from the API key; they
524
+ * are never accepted on the wire. The kernel applies defaults for
525
+ * `frameworkBindings` (`[]`), `consumerHints` (`{}`), `metadata`
526
+ * (`{}`), and `status` (`"draft"`) when fields are omitted.
527
+ *
528
+ * **Idempotency**: the kernel accepts `Idempotency-Key` on this
529
+ * endpoint, but the SDK does NOT expose the header in P1.6 (see
530
+ * resource header comment). Consumers needing safe retry today
531
+ * should dedupe client-side.
532
+ *
533
+ * Errors — ordered by kernel firing precedence (rate-limit → auth →
534
+ * body parse → Zod → DB):
535
+ * - `AttestryAPIError` (status 429) — rate limit FIRES FIRST
536
+ * (auto-retried by default — invariant #18).
537
+ * - `AttestryAPIError` (status 401) — no API key OR invalid key.
538
+ * - `AttestryAPIError` (status 403) — authenticated key lacks
539
+ * `WRITE_ASSESSMENTS` permission.
540
+ * - `AttestryAPIError` (status 400) — JSON parse failure on the
541
+ * body OR a malformed `Idempotency-Key` header (the kernel
542
+ * emits 400 for both transport-shape failures).
543
+ * - `AttestryAPIError` (status 409) — `Idempotency-Key` conflict
544
+ * (same key, different body hash; `details.code` ===
545
+ * `"evidence_pack.idempotency_key_conflict"`). Not reachable
546
+ * from P1.6's SDK directly.
547
+ * - `AttestryAPIError` (status 422) — Zod validation failed
548
+ * (`details.code` === `"evidence_pack.validation_failed"`;
549
+ * `details.issues` carries the field paths).
550
+ * - `AttestryAPIError` (status 500) — internal kernel error.
551
+ * - `AttestryError` ("request aborted by caller") — caller-
552
+ * supplied `options.signal` fired (pre-aborted or mid-flight).
553
+ * - `AttestryError` (P2 hardening) — kernel response failed
554
+ * SDK-side shape validation (not an object, wrong type on any
555
+ * field).
556
+ * - `AttestryAPIError` (P3 hardening) — kernel response had a
557
+ * wrong Content-Type (transport-level guard, before body
558
+ * parsing).
559
+ * - `TypeError` (synchronous, no fetch issued) — input failed
560
+ * SDK-side validation (null/array/non-object input; missing
561
+ * `packType`; bad `packType` enum; bad `systemId` UUID; bad
562
+ * `frameworkBindings` array shape; bad `metadata` shape).
563
+ *
564
+ * **SDK-side validation** (synchronous `TypeError`, no fetch issued):
565
+ * - `input`: required; non-null, non-array object.
566
+ * - `input.packType`: required own-property; member of `PACK_TYPES`.
567
+ * - `input.systemId` (when own-present, value not undefined): non-
568
+ * empty string matching `UUID_REGEX`.
569
+ * - `input.frameworkBindings` (when own-present, value not
570
+ * undefined): array of length ≤50 (kernel cap); per-entry shape
571
+ * is open-spec and forwarded to the kernel as-is.
572
+ * - `input.metadata` (when own-present, value not undefined):
573
+ * non-null, non-array object.
574
+ *
575
+ * **Response-shape validation** (P2 hardening; symmetric defense on
576
+ * response side via the `objectHasOwn` snapshot): every documented
577
+ * `EvidencePack` field is type-checked. Rejects with `AttestryError`
578
+ * on shape violation.
579
+ *
580
+ * @example Minimum viable pack (org-level, no system, no bindings)
581
+ * ```ts
582
+ * const pack = await client.evidencePack.create({
583
+ * packType: "underwriting_evidence",
584
+ * });
585
+ * console.log("created:", pack.id, "status:", pack.status); // "draft"
586
+ * ```
587
+ *
588
+ * @example Annex IV pack scoped to a specific AI system
589
+ * ```ts
590
+ * const pack = await client.evidencePack.create({
591
+ * packType: "annex_iv",
592
+ * systemId: "11111111-1111-1111-1111-111111111111",
593
+ * frameworkBindings: [
594
+ * { framework: "eu_ai_act", identifier: "Annex.IV.1" },
595
+ * { framework: "iso_42001", identifier: "8.2" },
596
+ * ],
597
+ * metadata: { author: "compliance-bot", version: 1 },
598
+ * });
599
+ * ```
600
+ */
601
+ create(input: CreateEvidencePackInput, options?: RequestOptions): Promise<EvidencePack>;
602
+ /**
603
+ * Retrieve a single evidence pack's metadata together with its full
604
+ * reperformance-bundle list. Wraps `GET /api/v1/evidence-packs/{id}`.
605
+ *
606
+ * **Anti-enumeration 404**: a pack that doesn't exist OR exists in a
607
+ * different org surfaces as `AttestryAPIError` with `status === 404`
608
+ * and a generic "pack not found" message (faithful courier — the
609
+ * kernel `getEvidencePack` query intentionally collapses cross-org
610
+ * and missing to the same response).
611
+ *
612
+ * Errors — ordered by kernel firing precedence. The kernel route at
613
+ * `src/app/api/v1/evidence-packs/[id]/route.ts` validates the URL-path
614
+ * UUID BEFORE the auth check, so a malformed path UUID surfaces as 400
615
+ * BEFORE 401/403 (same ordering as `addBundle`):
616
+ * - `AttestryAPIError` (status 429) — rate limit (auto-retried).
617
+ * - `AttestryAPIError` (status 400 — path UUID) — malformed UUID in
618
+ * the path (kernel `packPathParamsSchema` Zod rejection).
619
+ * **Fires BEFORE auth.** The SDK pre-validates the UUID format so
620
+ * this surface is only reachable via SDK rule changes.
621
+ * - `AttestryAPIError` (status 401 / 403) — auth missing / wrong
622
+ * permission (`READ_ASSESSMENTS`).
623
+ * - `AttestryAPIError` (status 404) — pack missing OR cross-org.
624
+ * - `AttestryAPIError` (status 500) — internal kernel error.
625
+ * - `AttestryError` ("request aborted by caller") — abort.
626
+ * - `AttestryError` (P2 hardening) — kernel response shape
627
+ * violation.
628
+ * - `AttestryAPIError` (P3 hardening) — non-JSON response.
629
+ * - `TypeError` (synchronous, no fetch issued) — input failed
630
+ * SDK-side validation.
631
+ *
632
+ * **SDK-side validation**:
633
+ * - `input`: required; non-null, non-array object.
634
+ * - `input.packId`: required own-property; non-empty string;
635
+ * matching `UUID_REGEX`.
636
+ *
637
+ * **Response-shape validation** (P2 hardening): `pack` field is a
638
+ * full `EvidencePack`; `bundles` field is an array of
639
+ * `ReperformanceBundle` (per-element shape validated).
640
+ *
641
+ * @example
642
+ * ```ts
643
+ * const { pack, bundles } = await client.evidencePack.get({
644
+ * packId: "11111111-1111-1111-1111-111111111111",
645
+ * });
646
+ * console.log(`${pack.packType} pack, status: ${pack.status}`);
647
+ * console.log(`${bundles.length} bundles attached`);
648
+ * ```
649
+ */
650
+ get(input: GetEvidencePackInput, options?: RequestOptions): Promise<GetEvidencePackResponse>;
651
+ /**
652
+ * List the authenticated organization's evidence packs, newest first.
653
+ * Wraps `GET /api/v1/evidence-packs`.
654
+ *
655
+ * **Single page per call** (DEV-63). Pass `response.nextCursor` back
656
+ * as `cursor` to fetch the next page; `nextCursor: null` means no
657
+ * more pages. The kernel pages by tuple comparison over
658
+ * `(created_at DESC, id DESC)` so same-microsecond timestamps do
659
+ * not skip rows.
660
+ *
661
+ * **Filters are AND-combined kernel-side**. Omitting all filters
662
+ * lists the entire org's packs (newest first). Empty `cursor` (`""`)
663
+ * is rejected by the SDK; pass `undefined` (or omit the field) for
664
+ * the first page.
665
+ *
666
+ * Errors — ordered by kernel firing precedence:
667
+ * - `AttestryAPIError` (status 429) — rate limit (auto-retried).
668
+ * - `AttestryAPIError` (status 401 / 403) — auth missing / wrong
669
+ * permission (`READ_ASSESSMENTS`).
670
+ * - `AttestryAPIError` (status 400) — a length-valid but
671
+ * UNDECODABLE `cursor` (`details.code` ===
672
+ * `"evidence_pack.invalid_cursor"`). NOTE: a `cursor` that fails
673
+ * the kernel's Zod length cap (>500 chars) fires EARLIER as 422
674
+ * (below), not 400 — the 400 path is reached only after the query
675
+ * schema accepts the cursor's shape. Since the SDK treats `cursor`
676
+ * as opaque (caller passes back `nextCursor` verbatim), neither is
677
+ * reachable with a kernel-issued cursor.
678
+ * - `AttestryAPIError` (status 422) — Zod query-param validation
679
+ * failed, INCLUDING an over-long (>500-char) `cursor`
680
+ * (`details.code` === `"evidence_pack.validation_failed"`).
681
+ * - `AttestryAPIError` (status 500) — internal kernel error.
682
+ * - `AttestryError` ("request aborted by caller") — abort.
683
+ * - `AttestryError` (P2 hardening) — response-shape violation.
684
+ * - `AttestryAPIError` (P3 hardening) — non-JSON response.
685
+ * - `TypeError` (synchronous, no fetch issued) — input failed
686
+ * SDK-side validation.
687
+ *
688
+ * **SDK-side validation**:
689
+ * - `input` (optional): if provided, non-null, non-array object.
690
+ * - `input.systemId` (when own-present): UUID format.
691
+ * - `input.packType` (when own-present): member of `PACK_TYPES`.
692
+ * - `input.status` (when own-present): member of `PACK_STATUSES`.
693
+ * - `input.limit` (when own-present): `Number.isInteger`, range
694
+ * [1, 200] inclusive. Mirrors kernel `.int().min(1).max(200)`.
695
+ * - `input.cursor` (when own-present): non-empty string.
696
+ *
697
+ * @example First page, all filters omitted
698
+ * ```ts
699
+ * const { items, nextCursor } = await client.evidencePack.list();
700
+ * for (const pack of items) {
701
+ * console.log(pack.id, pack.packType, pack.status);
702
+ * }
703
+ * if (nextCursor) {
704
+ * const next = await client.evidencePack.list({ cursor: nextCursor });
705
+ * }
706
+ * ```
707
+ *
708
+ * @example Filter by system + status + cap to 25
709
+ * ```ts
710
+ * const draft = await client.evidencePack.list({
711
+ * systemId: "11111111-1111-1111-1111-111111111111",
712
+ * status: "draft",
713
+ * limit: 25,
714
+ * });
715
+ * ```
716
+ */
717
+ list(input?: ListEvidencePacksInput, options?: RequestOptions): Promise<ListEvidencePacksResponse>;
718
+ /**
719
+ * Append a reperformance bundle to an existing **draft** evidence
720
+ * pack. Wraps `POST /api/v1/evidence-packs/{id}/bundles`.
721
+ *
722
+ * The kernel recomputes the pack's `content_hash` after the append
723
+ * and returns the updated pack alongside the new bundle. A
724
+ * `hashCollision` flag is set when the new `(inputs_hash,
725
+ * outputs_hash)` tuple matches any existing bundle on the SAME pack
726
+ * — flagged but NOT blocked (P1.2 DEV-17, faithful courier).
727
+ *
728
+ * **State invariant**: the pack must be in `draft` status. A
729
+ * non-draft pack (`signed`, `superseded`, `revoked`, `expired`)
730
+ * rejects with `AttestryAPIError` status 409 (`details.code` ===
731
+ * `"evidence_pack.invalid_state"`; `details.currentStatus` carries
732
+ * the pack's current state).
733
+ *
734
+ * **Method name `addBundle`** — see resource header for the
735
+ * `addBundle` vs `appendBundle` decision.
736
+ *
737
+ * **Idempotency**: same carry-forward as `create` — the kernel
738
+ * accepts `Idempotency-Key` but the SDK doesn't expose the header
739
+ * in P1.6.
740
+ *
741
+ * Errors — ordered by kernel firing precedence. The kernel route at
742
+ * `src/app/api/v1/evidence-packs/[id]/bundles/route.ts` validates the
743
+ * URL-path UUID BEFORE the auth check, so a malformed path UUID
744
+ * surfaces as 400 BEFORE 401/403. Body-parse 400s and idempotency-
745
+ * key 400s fire AFTER auth (matches the `get` JSDoc shape):
746
+ * - `AttestryAPIError` (status 429) — rate limit (auto-retried).
747
+ * - `AttestryAPIError` (status 400 — path UUID) — malformed
748
+ * URL-path packId. **Fires BEFORE auth** (the kernel
749
+ * `packPathParamsSchema.safeParse` runs first). The SDK
750
+ * pre-validates the path UUID so this surface is only reachable
751
+ * via SDK rule changes.
752
+ * - `AttestryAPIError` (status 401 / 403) — auth missing / wrong
753
+ * permission (`WRITE_ASSESSMENTS`).
754
+ * - `AttestryAPIError` (status 400 — JSON parse / idempotency-key
755
+ * format) — malformed JSON body OR malformed `Idempotency-Key`
756
+ * header. **Fires AFTER auth** (the kernel parses these after
757
+ * `requireSessionOrApiKey` resolves).
758
+ * - `AttestryAPIError` (status 404) — pack missing OR cross-org.
759
+ * - `AttestryAPIError` (status 409) — invalid state (carries
760
+ * `details.currentStatus`) OR idempotency conflict.
761
+ * - `AttestryAPIError` (status 413) — canonical bundle list >
762
+ * 256 KiB (kernel `PayloadTooLargeError`).
763
+ * - `AttestryAPIError` (status 422) — Zod validation failed.
764
+ * - `AttestryAPIError` (status 500) — internal kernel error.
765
+ * - `AttestryError` ("request aborted by caller") — abort.
766
+ * - `AttestryError` (P2 hardening) — response-shape violation.
767
+ * - `AttestryAPIError` (P3 hardening) — non-JSON response.
768
+ * - `TypeError` (synchronous, no fetch issued) — input failed
769
+ * SDK-side validation.
770
+ *
771
+ * **SDK-side validation**:
772
+ * - `input`: required; non-null, non-array object.
773
+ * - `input.packId`: required own-property; non-empty UUID string.
774
+ * - `input.traceContent`: required own-property; array of length
775
+ * ≤1000. Per-entry shape is open-spec (kernel deep-validates).
776
+ * - `input.inputsHash`: required own-property; non-empty string;
777
+ * length ≤500.
778
+ * - `input.outputsHash`: required own-property; non-empty string;
779
+ * length ≤500.
780
+ * - `input.modelBehaviorLog` (when own-present): non-null,
781
+ * non-array object. Inner shape open-spec.
782
+ * - `input.corroborationResults` (when own-present): non-null,
783
+ * non-array object. Inner shape open-spec.
784
+ * - `input.storageUri` (when own-present): non-empty string;
785
+ * length ≤2000. Scheme validation kernel-authoritative.
786
+ * - `input.metadata` (when own-present): non-null, non-array
787
+ * object.
788
+ *
789
+ * **Response-shape validation** (P2 hardening): `bundle` is a
790
+ * `ReperformanceBundle`; `pack` is an `EvidencePack`; `hashCollision`
791
+ * is the 3-field `HashCollision` block.
792
+ *
793
+ * @example Append a bundle to a draft pack
794
+ * ```ts
795
+ * const { bundle, pack, hashCollision } = await client.evidencePack.addBundle({
796
+ * packId: "11111111-1111-1111-1111-111111111111",
797
+ * traceContent: [
798
+ * { action: "ingest", timestamp: "2026-05-18T12:00:00Z" },
799
+ * { action: "extract", timestamp: "2026-05-18T12:00:01Z" },
800
+ * ],
801
+ * inputsHash: "sha256:0000000000000000000000000000000000000000000000000000000000000000",
802
+ * outputsHash: "sha256:1111111111111111111111111111111111111111111111111111111111111111",
803
+ * });
804
+ * console.log(`appended bundle ${bundle.id}; pack hash now ${pack.contentHash}`);
805
+ * if (hashCollision.detected) {
806
+ * console.warn(`duplicate bundle — ${hashCollision.count} prior matches`);
807
+ * }
808
+ * ```
809
+ */
810
+ addBundle(input: AddBundleInput, options?: RequestOptions): Promise<AddBundleResponse>;
811
+ /**
812
+ * Sign a draft evidence pack, transitioning it `draft → signed` and
813
+ * finalizing it into an auditor-visible compliance artifact. Wraps
814
+ * `POST /api/v1/evidence-packs/{id}/sign`.
815
+ *
816
+ * The kernel recomputes the pack's `content_hash` over its current
817
+ * bundle list on sign (never trusting the stored column), writes
818
+ * `signed_at` + `signed_by_user_id` + (when provided)
819
+ * `attestation_certificate_id`, and appends an `evidence_pack.signed`
820
+ * audit-log entry — all atomic inside one per-org-locked transaction.
821
+ *
822
+ * **Auth: ADMIN-only** — the kernel gates `sessionRoles:['admin']` +
823
+ * `apiKeyPermissions:[ADMIN]`. A non-admin key → 403.
824
+ *
825
+ * **Empty-pack guard**: signing a pack with no bundles → 409 with
826
+ * `details.code === "evidence_pack.empty"` (a dedicated `EmptyPackError`,
827
+ * NOT `InvalidStateError` — so it carries NO `currentStatus`; the pack
828
+ * IS in the right `draft` pre-sign state, it just has nothing to sign).
829
+ *
830
+ * **Idempotency**: the kernel does NOT honor `Idempotency-Key` on sign
831
+ * (a replay 409s with `currentStatus='signed'`); the SDK sends none.
832
+ *
833
+ * Errors — ordered by kernel firing precedence. The route validates the
834
+ * URL-path UUID via `packPathParamsSchema.safeParse` BEFORE
835
+ * `requireSessionOrApiKey`, so a malformed path UUID surfaces as 400
836
+ * BEFORE 401/403:
837
+ * - `AttestryAPIError` (status 429) — rate limit (auto-retried).
838
+ * - `AttestryAPIError` (status 400 — path UUID) — malformed URL-path
839
+ * packId. **Fires BEFORE auth.** The SDK pre-validates the UUID, so
840
+ * this surface is only reachable via SDK rule changes.
841
+ * - `AttestryAPIError` (status 401 / 403) — auth missing / key is not
842
+ * ADMIN.
843
+ * - `AttestryAPIError` (status 400 — JSON parse) — malformed body.
844
+ * **Fires AFTER auth.**
845
+ * - `AttestryAPIError` (status 422) — Zod validation failed
846
+ * (`details.code === "evidence_pack.validation_failed"`).
847
+ * - `AttestryAPIError` (status 404) — pack missing OR cross-org OR
848
+ * (when an `attestationCertificateId` is supplied) the cert is
849
+ * missing / cross-org / cross-system (anti-enumeration — same
850
+ * "pack not found" message).
851
+ * - `AttestryAPIError` (status 409) — `InvalidStateError` (pack not in
852
+ * `draft`; `details.currentStatus` carries the state) OR
853
+ * `EmptyPackError` (`details.code === "evidence_pack.empty"`).
854
+ * - `AttestryAPIError` (status 500) — internal kernel error.
855
+ * - `AttestryError` ("request aborted by caller") — abort.
856
+ * - `AttestryError` (P2 hardening) — response-shape violation.
857
+ * - `AttestryAPIError` (P3 hardening) — non-JSON response.
858
+ * - `TypeError` (synchronous, no fetch issued) — input failed
859
+ * SDK-side validation.
860
+ *
861
+ * **SDK-side validation**:
862
+ * - `input`: required; non-null, non-array object.
863
+ * - `input.packId`: required own-property; non-empty UUID string.
864
+ * - `input.attestationCertificateId` (when own-present): UUID format.
865
+ *
866
+ * **Response-shape validation** (P2 hardening): the signed `EvidencePack`.
867
+ *
868
+ * @example
869
+ * ```ts
870
+ * const signed = await client.evidencePack.sign({
871
+ * packId: "11111111-1111-1111-1111-111111111111",
872
+ * });
873
+ * console.log(signed.status, signed.contentHash); // "signed", "sha256:..."
874
+ * ```
875
+ */
876
+ sign(input: SignEvidencePackInput, options?: RequestOptions): Promise<EvidencePack>;
877
+ /**
878
+ * Supersede a signed evidence pack: transitions the old pack
879
+ * `signed → superseded` and creates a NEW draft pack linked to it
880
+ * (`parent_pack_id = oldPackId`). Wraps
881
+ * `POST /api/v1/evidence-packs/{id}/supersede`.
882
+ *
883
+ * Both packs are returned (`{newPack, oldPack}`, HTTP 201). The two
884
+ * operations + the audit-log entry commit atomically inside one
885
+ * per-org-locked transaction.
886
+ *
887
+ * **Auth**: WRITE_ASSESSMENTS (NOT admin — supersede is a normal write).
888
+ *
889
+ * **`newPack` includes `consumerHints`** (unlike `create`, which omits
890
+ * it) — mirroring the kernel `supersedeNewPackPayloadSchema` and the
891
+ * P1.7 MCP supersede tool.
892
+ *
893
+ * **Idempotency**: the kernel route honors `Idempotency-Key` on
894
+ * supersede, but the SDK does NOT send it (R-2 carry-forward — same as
895
+ * `create` / `addBundle`). Consumers needing safe retry today should
896
+ * dedupe client-side.
897
+ *
898
+ * Errors — ordered by kernel firing precedence (path-uuid 400 BEFORE
899
+ * auth). The SDK does not send `Idempotency-Key`, so the idempotency-
900
+ * format-400 / idempotency-conflict-409 surfaces are unreachable from
901
+ * the SDK:
902
+ * - `AttestryAPIError` (status 429) — rate limit (auto-retried).
903
+ * - `AttestryAPIError` (status 400 — path UUID) — malformed URL-path
904
+ * packId. **Fires BEFORE auth.** Reachable only via SDK rule changes.
905
+ * - `AttestryAPIError` (status 401 / 403) — auth missing / lacks
906
+ * WRITE_ASSESSMENTS.
907
+ * - `AttestryAPIError` (status 400 — JSON parse) — malformed body.
908
+ * - `AttestryAPIError` (status 422) — Zod validation failed on
909
+ * `newPack` (`details.code === "evidence_pack.validation_failed"`).
910
+ * - `AttestryAPIError` (status 404) — old pack missing OR cross-org.
911
+ * - `AttestryAPIError` (status 409) — `InvalidStateError` (old pack not
912
+ * in `signed` state; `details.currentStatus` carries the state).
913
+ * - `AttestryAPIError` (status 500) — internal kernel error.
914
+ * - `AttestryError` ("request aborted by caller") — abort.
915
+ * - `AttestryError` (P2 hardening) — response-shape violation.
916
+ * - `AttestryAPIError` (P3 hardening) — non-JSON response.
917
+ * - `TypeError` (synchronous, no fetch issued) — input failed
918
+ * SDK-side validation.
919
+ *
920
+ * **SDK-side validation**:
921
+ * - `input`: required; non-null, non-array object.
922
+ * - `input.packId`: required own-property; non-empty UUID string.
923
+ * - `input.newPack`: required own-property; non-null, non-array object.
924
+ * - `input.newPack.packType`: required; member of `PACK_TYPES`.
925
+ * - `input.newPack.systemId` (when own-present): UUID format.
926
+ * - `input.newPack.frameworkBindings` (when own-present): array of
927
+ * length ≤50. Per-entry shape is open-spec (kernel deep-validates).
928
+ * - `input.newPack.consumerHints` (when own-present): non-null,
929
+ * non-array object. Inner shape open-spec (kernel deep-validates).
930
+ * - `input.newPack.metadata` (when own-present): non-null, non-array
931
+ * object.
932
+ *
933
+ * **Response-shape validation** (P2 hardening): `newPack` and `oldPack`
934
+ * are each a full `EvidencePack`.
935
+ *
936
+ * @example
937
+ * ```ts
938
+ * const { newPack, oldPack } = await client.evidencePack.supersede({
939
+ * packId: "11111111-1111-1111-1111-111111111111", // the signed pack
940
+ * newPack: {
941
+ * packType: "annex_iv",
942
+ * frameworkBindings: [{ framework: "eu_ai_act", identifier: "Annex.IV.1" }],
943
+ * },
944
+ * });
945
+ * console.log(oldPack.status, newPack.status); // "superseded", "draft"
946
+ * console.log(newPack.parentPackId === oldPack.id); // true
947
+ * ```
948
+ */
949
+ supersede(input: SupersedeEvidencePackInput, options?: RequestOptions): Promise<SupersedeEvidencePackResponse>;
950
+ /**
951
+ * Revoke a signed evidence pack, transitioning it `signed → revoked`
952
+ * and blocking future verification. Wraps
953
+ * `POST /api/v1/evidence-packs/{id}/revoke`.
954
+ *
955
+ * **No cascade** — revoking a pack does NOT touch its children or the
956
+ * supersession-chain neighbour. Revocation is intentionally NOT
957
+ * idempotent: a second revoke 409s (auditors care about the difference
958
+ * between "revoked once" and "revoked again"; the first is canonical).
959
+ *
960
+ * **Auth: ADMIN-only** — the kernel gates `sessionRoles:['admin']` +
961
+ * `apiKeyPermissions:[ADMIN]`. A non-admin key → 403.
962
+ *
963
+ * Optional `reason` (≤500 chars) is recorded verbatim in the pack's
964
+ * audit-log entry for compliance investigators.
965
+ *
966
+ * Errors — ordered by kernel firing precedence (path-uuid 400 BEFORE
967
+ * auth):
968
+ * - `AttestryAPIError` (status 429) — rate limit (auto-retried).
969
+ * - `AttestryAPIError` (status 400 — path UUID) — malformed URL-path
970
+ * packId. **Fires BEFORE auth.** Reachable only via SDK rule changes.
971
+ * - `AttestryAPIError` (status 401 / 403) — auth missing / not ADMIN.
972
+ * - `AttestryAPIError` (status 400 — JSON parse) — malformed body.
973
+ * - `AttestryAPIError` (status 422) — Zod validation failed
974
+ * (`details.code === "evidence_pack.validation_failed"`).
975
+ * - `AttestryAPIError` (status 404) — pack missing OR cross-org.
976
+ * - `AttestryAPIError` (status 409) — `InvalidStateError` (pack not in
977
+ * `signed` state, e.g. already revoked / still draft / superseded;
978
+ * `details.currentStatus` carries the state).
979
+ * - `AttestryAPIError` (status 500) — internal kernel error.
980
+ * - `AttestryError` ("request aborted by caller") — abort.
981
+ * - `AttestryError` (P2 hardening) — response-shape violation.
982
+ * - `AttestryAPIError` (P3 hardening) — non-JSON response.
983
+ * - `TypeError` (synchronous, no fetch issued) — input failed
984
+ * SDK-side validation.
985
+ *
986
+ * **SDK-side validation**:
987
+ * - `input`: required; non-null, non-array object.
988
+ * - `input.packId`: required own-property; non-empty UUID string.
989
+ * - `input.reason` (when own-present): non-empty string; length ≤500.
990
+ *
991
+ * **Response-shape validation** (P2 hardening): the revoked `EvidencePack`.
992
+ *
993
+ * @example
994
+ * ```ts
995
+ * const revoked = await client.evidencePack.revoke({
996
+ * packId: "11111111-1111-1111-1111-111111111111",
997
+ * reason: "superseding control framework updated; pack no longer valid",
998
+ * });
999
+ * console.log(revoked.status); // "revoked"
1000
+ * ```
1001
+ */
1002
+ revoke(input: RevokeEvidencePackInput, options?: RequestOptions): Promise<EvidencePack>;
1003
+ /**
1004
+ * Export an evidence pack as a downloadable artifact. Wraps
1005
+ * `GET /api/v1/evidence-packs/{id}/export?format={json|pdf|zip}`.
1006
+ *
1007
+ * **Returns a non-JSON artifact** (P1.8 DEV-73). Unlike every other
1008
+ * method, the kernel export route returns the RAW artifact on success
1009
+ * (NOT the `{success,data}` envelope) with a download
1010
+ * `Content-Disposition` header. This method therefore routes through the
1011
+ * streaming transport and returns an {@link EvidencePackExportResult}
1012
+ * wrapping the **un-consumed** `Response`:
1013
+ *
1014
+ * - `json` → `await result.response.json()` yields the artifact
1015
+ * `{export:{format,generatedAt,schemaVersion:"evidence-pack-export.v1"},
1016
+ * pack, bundles}`.
1017
+ * - `pdf` → `await result.response.arrayBuffer()` yields the PDF bytes.
1018
+ * - `zip` → `result.response.body` is a `ReadableStream<Uint8Array>`
1019
+ * (stream it to disk for large packs), or `await result.response.blob()`.
1020
+ *
1021
+ * The transport has already verified the HTTP status (a non-2xx threw
1022
+ * `AttestryAPIError` — NOT a stream/parse crash) and that the response's
1023
+ * `Content-Type` MIME matches the requested format. The SDK does NOT
1024
+ * consume or `validatePack` the artifact body — faithful courier (same
1025
+ * discipline as `decisions.export` / `auditLog.export`).
1026
+ *
1027
+ * **Auth**: READ_ASSESSMENTS. **Revoked packs are exportable** (the
1028
+ * artifact carries `status:'revoked'` verbatim — no filtering).
1029
+ *
1030
+ * **No internal timeout** — the streaming transport does not arm the
1031
+ * 30s default (a large zip can take longer). Pass `options.signal` from
1032
+ * your own `AbortController` to bound the duration.
1033
+ *
1034
+ * Errors — ordered by kernel firing precedence. **The query-schema parse
1035
+ * runs BEFORE auth** in this route, so an absent/unknown `format` 422s
1036
+ * BEFORE 401/403:
1037
+ * - `AttestryAPIError` (status 429) — rate limit (auto-retried).
1038
+ * - `AttestryAPIError` (status 400 — path UUID) — malformed URL-path
1039
+ * packId. **Fires BEFORE auth.** Reachable only via SDK rule changes.
1040
+ * - `AttestryAPIError` (status 422) — absent / unknown `format`
1041
+ * (`details.code === "evidence_pack.validation_failed"`). **Fires
1042
+ * BEFORE auth.** The SDK pre-validates `format`, so reachable only
1043
+ * via SDK rule changes.
1044
+ * - `AttestryAPIError` (status 401 / 403) — auth missing / lacks
1045
+ * READ_ASSESSMENTS.
1046
+ * - `AttestryAPIError` (status 404) — pack missing OR cross-org.
1047
+ * - `AttestryAPIError` (status 500) — internal kernel error.
1048
+ * - `AttestryError` ("request aborted by caller") — abort.
1049
+ * - `AttestryAPIError` (transport guard) — a 2xx with the wrong
1050
+ * `Content-Type` for the requested format.
1051
+ * - `TypeError` (synchronous, no fetch issued) — input failed
1052
+ * SDK-side validation.
1053
+ *
1054
+ * **SDK-side validation**:
1055
+ * - `input`: required; non-null, non-array object.
1056
+ * - `input.packId`: required own-property; non-empty UUID string.
1057
+ * - `input.format`: required own-property; member of `EXPORT_FORMATS`.
1058
+ *
1059
+ * @example Stream a zip export to disk (Node)
1060
+ * ```ts
1061
+ * import { Writable } from "node:stream";
1062
+ * const { response } = await client.evidencePack.export({
1063
+ * packId: "11111111-1111-1111-1111-111111111111",
1064
+ * format: "zip",
1065
+ * });
1066
+ * await response.body!.pipeTo(Writable.toWeb(fs.createWriteStream("pack.zip")));
1067
+ * ```
1068
+ *
1069
+ * @example Read the JSON artifact for offline content-hash re-verification
1070
+ * ```ts
1071
+ * const { response } = await client.evidencePack.export({
1072
+ * packId: "11111111-1111-1111-1111-111111111111",
1073
+ * format: "json",
1074
+ * });
1075
+ * const artifact = await response.json(); // {export, pack, bundles}
1076
+ * ```
1077
+ */
1078
+ export(input: ExportEvidencePackInput, options?: RequestOptions): Promise<EvidencePackExportResult>;
1079
+ }
1080
+ //# sourceMappingURL=evidence-pack.d.ts.map