@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.
- package/LICENSE +190 -0
- package/README.md +1269 -0
- package/dist/client.d.ts +58 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +74 -0
- package/dist/client.js.map +1 -0
- package/dist/constants.d.ts +7 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +43 -0
- package/dist/constants.js.map +1 -0
- package/dist/errors.d.ts +16 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +41 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -0
- package/dist/lines-parser.d.ts +50 -0
- package/dist/lines-parser.d.ts.map +1 -0
- package/dist/lines-parser.js +211 -0
- package/dist/lines-parser.js.map +1 -0
- package/dist/ndjson-parser.d.ts +57 -0
- package/dist/ndjson-parser.d.ts.map +1 -0
- package/dist/ndjson-parser.js +245 -0
- package/dist/ndjson-parser.js.map +1 -0
- package/dist/resources/abac-policies.d.ts +1034 -0
- package/dist/resources/abac-policies.d.ts.map +1 -0
- package/dist/resources/abac-policies.js +1519 -0
- package/dist/resources/abac-policies.js.map +1 -0
- package/dist/resources/audit-log.d.ts +588 -0
- package/dist/resources/audit-log.d.ts.map +1 -0
- package/dist/resources/audit-log.js +629 -0
- package/dist/resources/audit-log.js.map +1 -0
- package/dist/resources/batch.d.ts +845 -0
- package/dist/resources/batch.d.ts.map +1 -0
- package/dist/resources/batch.js +1074 -0
- package/dist/resources/batch.js.map +1 -0
- package/dist/resources/chat.d.ts +151 -0
- package/dist/resources/chat.d.ts.map +1 -0
- package/dist/resources/chat.js +124 -0
- package/dist/resources/chat.js.map +1 -0
- package/dist/resources/check.d.ts +348 -0
- package/dist/resources/check.d.ts.map +1 -0
- package/dist/resources/check.js +543 -0
- package/dist/resources/check.js.map +1 -0
- package/dist/resources/compliance-check.d.ts +330 -0
- package/dist/resources/compliance-check.d.ts.map +1 -0
- package/dist/resources/compliance-check.js +402 -0
- package/dist/resources/compliance-check.js.map +1 -0
- package/dist/resources/decisions.d.ts +1208 -0
- package/dist/resources/decisions.d.ts.map +1 -0
- package/dist/resources/decisions.js +1362 -0
- package/dist/resources/decisions.js.map +1 -0
- package/dist/resources/evidence-pack.d.ts +1080 -0
- package/dist/resources/evidence-pack.d.ts.map +1 -0
- package/dist/resources/evidence-pack.js +1789 -0
- package/dist/resources/evidence-pack.js.map +1 -0
- package/dist/resources/gate.d.ts +613 -0
- package/dist/resources/gate.d.ts.map +1 -0
- package/dist/resources/gate.js +737 -0
- package/dist/resources/gate.js.map +1 -0
- package/dist/resources/incidents.d.ts +136 -0
- package/dist/resources/incidents.d.ts.map +1 -0
- package/dist/resources/incidents.js +229 -0
- package/dist/resources/incidents.js.map +1 -0
- package/dist/resources/regulatory-changes.d.ts +307 -0
- package/dist/resources/regulatory-changes.d.ts.map +1 -0
- package/dist/resources/regulatory-changes.js +365 -0
- package/dist/resources/regulatory-changes.js.map +1 -0
- package/dist/resources/safe-input-read.d.ts +21 -0
- package/dist/resources/safe-input-read.d.ts.map +1 -0
- package/dist/resources/safe-input-read.js +57 -0
- package/dist/resources/safe-input-read.js.map +1 -0
- package/dist/resources/ship-gate.d.ts +475 -0
- package/dist/resources/ship-gate.d.ts.map +1 -0
- package/dist/resources/ship-gate.js +727 -0
- package/dist/resources/ship-gate.js.map +1 -0
- package/dist/resources/vision.d.ts +540 -0
- package/dist/resources/vision.d.ts.map +1 -0
- package/dist/resources/vision.js +1036 -0
- package/dist/resources/vision.js.map +1 -0
- package/dist/retry.d.ts +103 -0
- package/dist/retry.d.ts.map +1 -0
- package/dist/retry.js +224 -0
- package/dist/retry.js.map +1 -0
- package/dist/sse-parser.d.ts +64 -0
- package/dist/sse-parser.d.ts.map +1 -0
- package/dist/sse-parser.js +271 -0
- package/dist/sse-parser.js.map +1 -0
- package/dist/transport.d.ts +142 -0
- package/dist/transport.d.ts.map +1 -0
- package/dist/transport.js +455 -0
- package/dist/transport.js.map +1 -0
- package/dist/types.d.ts +61 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/package.json +44 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ship-gate.js","sourceRoot":"","sources":["../../src/resources/ship-gate.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,EAAE;AACF,qEAAqE;AACrE,EAAE;AACF,4FAA4F;AAC5F,EAAE;AACF,gEAAgE;AAChE,4DAA4D;AAC5D,mDAAmD;AACnD,8DAA8D;AAC9D,sEAAsE;AACtE,oEAAoE;AACpE,mEAAmE;AACnE,kBAAkB;AAClB,EAAE;AACF,+DAA+D;AAC/D,iEAAiE;AACjE,qEAAqE;AACrE,sEAAsE;AACtE,oEAAoE;AACpE,EAAE;AACF,uEAAuE;AACvE,2EAA2E;AAC3E,wEAAwE;AACxE,sEAAsE;AACtE,iEAAiE;AACjE,iEAAiE;AACjE,mEAAmE;AACnE,4DAA4D;AAC5D,EAAE;AACF,mEAAmE;AACnE,yEAAyE;AACzE,sEAAsE;AACtE,qEAAqE;AACrE,mEAAmE;AACnE,kEAAkE;AAClE,oEAAoE;AACpE,mEAAmE;AACnE,mEAAmE;AACnE,oEAAoE;AACpE,oEAAoE;AACpE,0BAA0B;AAC1B,EAAE;AACF,gEAAgE;AAChE,2DAA2D;AAC3D,8BAA8B;AAC9B,gEAAgE;AAChE,oEAAoE;AACpE,wEAAwE;AACxE,mEAAmE;AACnE,qEAAqE;AACrE,oEAAoE;AACpE,iEAAiE;AACjE,8DAA8D;AAC9D,wBAAwB;AACxB,EAAE;AACF,0DAA0D;AAC1D,oEAAoE;AACpE,iEAAiE;AACjE,qDAAqD;AACrD,sEAAsE;AACtE,yCAAyC;AACzC,6DAA6D;AAC7D,wDAAwD;AACxD,mEAAmE;AACnE,8DAA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B,+DAA+D;gBAC7D,qBAAqB,YAAY,CAAC,WAAW,CAAC,GAAG,CACpD,CAAC;QACJ,CAAC;IACH,CAAC;IAED,gEAAgE;IAChE,IAAI,YAAY,CAAC,GAAG,EAAE,SAAS,CAAC,EAAE,CAAC;QACjC,MAAM,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC;QAC5B,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;YAChC,MAAM,IAAI,aAAa,CACrB,2DAA2D;gBACzD,qBAAqB,YAAY,CAAC,OAAO,CAAC,GAAG,CAChD,CAAC;QACJ,CAAC;IACH,CAAC;IAED,OAAO,MAA+B,CAAC;AACzC,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,SAAS,YAAY,CAAC,KAAc;IAClC,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,MAAM,CAAC;IAClC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,OAAO,CAAC;IACzC,OAAO,OAAO,KAAK,CAAC;AACtB,CAAC"}
|
|
@@ -0,0 +1,540 @@
|
|
|
1
|
+
import type { AttestryClient } from "../client.js";
|
|
2
|
+
import type { RequestOptions } from "../types.js";
|
|
3
|
+
/**
|
|
4
|
+
* The four image MIME types the kernel accepts via `mediaType`. Mirrors
|
|
5
|
+
* `src/lib/vision/types.ts:23-28` (kernel side). Frozen so consumer code can
|
|
6
|
+
* safely use `SUPPORTED_MEDIA_TYPES.includes(...)` without mutation risk.
|
|
7
|
+
*
|
|
8
|
+
* Drift-pinned in the spec-diff round (`sdk-drift.test.ts`) by text-comparing
|
|
9
|
+
* this declaration with the kernel's. An addition/removal on either side trips
|
|
10
|
+
* the test.
|
|
11
|
+
*/
|
|
12
|
+
export declare const SUPPORTED_MEDIA_TYPES: readonly ["image/jpeg", "image/png", "image/webp", "image/gif"];
|
|
13
|
+
export type VisionSupportedMediaType = (typeof SUPPORTED_MEDIA_TYPES)[number];
|
|
14
|
+
/**
|
|
15
|
+
* The five document-type keys registered in the kernel schema library. Mirrors
|
|
16
|
+
* `src/lib/vision/schemas/index.ts:140-146` (kernel side). Frozen; drift-
|
|
17
|
+
* pinned identically to `SUPPORTED_MEDIA_TYPES`.
|
|
18
|
+
*
|
|
19
|
+
* Schema additions (e.g. a new Annex IV section schema) bump the kernel tuple
|
|
20
|
+
* AND require a new `chore(sdk): bump` to keep the SDK in sync — the drift pin
|
|
21
|
+
* is the trip-wire.
|
|
22
|
+
*/
|
|
23
|
+
export declare const SUPPORTED_DOCUMENT_TYPES: readonly ["model-card", "validation-report", "certification-label", "schematic-extraction", "generic-tabular"];
|
|
24
|
+
export type VisionSupportedDocumentType = (typeof SUPPORTED_DOCUMENT_TYPES)[number];
|
|
25
|
+
/**
|
|
26
|
+
* Closed enum for the optional `model` field. Mirrors kernel
|
|
27
|
+
* `z.enum(["opus", "sonnet"])` in `src/app/api/v1/vision/extract/route.ts`.
|
|
28
|
+
*/
|
|
29
|
+
export declare const VISION_MODELS: readonly ["opus", "sonnet"];
|
|
30
|
+
export type VisionModelTier = (typeof VISION_MODELS)[number];
|
|
31
|
+
/**
|
|
32
|
+
* `packIntegration.status` closed enum. Mirrors `PackIntegrationResult.status`
|
|
33
|
+
* in kernel `src/lib/vision/pack-integration.ts:315`.
|
|
34
|
+
*
|
|
35
|
+
* Typed as a closed union at compile time; runtime check is `typeof ===
|
|
36
|
+
* "string"` only (faithful courier — same convention as
|
|
37
|
+
* `BulkFailedSummary.code` / `DecisionStreamEvent.eventType`). A future
|
|
38
|
+
* kernel-side `"partial"` would round-trip via the type system; consumers
|
|
39
|
+
* doing exhaustive narrowing should update the SDK type then.
|
|
40
|
+
*/
|
|
41
|
+
export declare const PACK_INTEGRATION_STATUSES: readonly ["wrapped", "failed"];
|
|
42
|
+
export type VisionPackIntegrationStatus = (typeof PACK_INTEGRATION_STATUSES)[number];
|
|
43
|
+
/**
|
|
44
|
+
* Input for `vision.extract`. Mirrors the request body of
|
|
45
|
+
* `POST /api/v1/vision/extract` (kernel `src/app/api/v1/vision/extract/route.ts`
|
|
46
|
+
* `extractBodySchema`).
|
|
47
|
+
*
|
|
48
|
+
* **`base64` XOR `imageUri`** — exactly one MUST be supplied (kernel
|
|
49
|
+
* `.refine` enforces this with 422; the SDK pre-validates synchronously).
|
|
50
|
+
*
|
|
51
|
+
* **`mediaType` is REQUIRED** (P5.4 DEV-10; REQ-04 spec amendment).
|
|
52
|
+
*
|
|
53
|
+
* **`packId` is OPTIONAL** (P5.5). When supplied, the response carries an
|
|
54
|
+
* additive `packIntegration` field. When omitted, the response is byte-
|
|
55
|
+
* identical to P5.4.
|
|
56
|
+
*/
|
|
57
|
+
export interface VisionExtractInput {
|
|
58
|
+
/**
|
|
59
|
+
* Base64-encoded image bytes. Length-capped at `ANTHROPIC_IMAGE_MAX_BASE64`
|
|
60
|
+
* (~6.99M chars ≈ 5 MB decoded). Mutually exclusive with `imageUri`.
|
|
61
|
+
*/
|
|
62
|
+
base64?: string;
|
|
63
|
+
/**
|
|
64
|
+
* HTTPS URL the kernel fetches with SSRF defense (5-second timeout,
|
|
65
|
+
* private-IP block, magic-byte MIME-spoof check). Length-capped at 2048.
|
|
66
|
+
* Mutually exclusive with `base64`.
|
|
67
|
+
*/
|
|
68
|
+
imageUri?: string;
|
|
69
|
+
/**
|
|
70
|
+
* Image MIME type. REQUIRED. Must be one of `SUPPORTED_MEDIA_TYPES`.
|
|
71
|
+
*/
|
|
72
|
+
mediaType: VisionSupportedMediaType;
|
|
73
|
+
/**
|
|
74
|
+
* Schema-registry key. REQUIRED. Must be one of `SUPPORTED_DOCUMENT_TYPES`.
|
|
75
|
+
*/
|
|
76
|
+
documentType: VisionSupportedDocumentType;
|
|
77
|
+
/**
|
|
78
|
+
* Schema-registry key override. When supplied, it (not `documentType`)
|
|
79
|
+
* determines which Zod validator the kernel applies to the extraction.
|
|
80
|
+
* Must be one of `SUPPORTED_DOCUMENT_TYPES`.
|
|
81
|
+
*/
|
|
82
|
+
extractionSchema?: VisionSupportedDocumentType;
|
|
83
|
+
/**
|
|
84
|
+
* Model tier preference. Defaults kernel-side to `"opus"` when omitted.
|
|
85
|
+
*/
|
|
86
|
+
model?: VisionModelTier;
|
|
87
|
+
/**
|
|
88
|
+
* P5.5 — optional evidence-pack wrap target. RFC 4122 hyphenated UUID. When
|
|
89
|
+
* supplied, the response carries `packIntegration` describing the wrap
|
|
90
|
+
* outcome (success or failure mode).
|
|
91
|
+
*/
|
|
92
|
+
packId?: string;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* One document in a `vision.extractBatch` submission. Mirrors
|
|
96
|
+
* `batchDocumentSchema` in `src/lib/vision/batch-submit.ts`.
|
|
97
|
+
*
|
|
98
|
+
* Same `base64` XOR `imageUri` rule as `vision.extract`. `mediaType` is
|
|
99
|
+
* REQUIRED. `sourceImageUri` (optional) is recorded on the per-document call
|
|
100
|
+
* row but NOT used to fetch — it's an audit-pointer URI for downstream
|
|
101
|
+
* reperformance.
|
|
102
|
+
*/
|
|
103
|
+
export interface VisionBatchDocument {
|
|
104
|
+
base64?: string;
|
|
105
|
+
imageUri?: string;
|
|
106
|
+
mediaType: VisionSupportedMediaType;
|
|
107
|
+
documentType: VisionSupportedDocumentType;
|
|
108
|
+
extractionSchema?: VisionSupportedDocumentType;
|
|
109
|
+
/**
|
|
110
|
+
* Audit-pointer URI persisted on the `vision_extraction_calls` row. Length-
|
|
111
|
+
* capped at 2048.
|
|
112
|
+
*/
|
|
113
|
+
sourceImageUri?: string;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Input for `vision.extractBatch`. Wraps the body of
|
|
117
|
+
* `POST /api/v1/vision/extract/batch` (kernel `batchExtractBodySchema`).
|
|
118
|
+
*
|
|
119
|
+
* **`documents.length >= 1`** — empty arrays reject SDK-side. The kernel
|
|
120
|
+
* upper-bound (`MAX_DOCS_PER_JOB`, currently 10) is NOT duplicated in the
|
|
121
|
+
* SDK (it lives in `src/lib/vision/cron-worker.ts` and is not part of the
|
|
122
|
+
* SDK's public API surface); an oversized batch surfaces as a kernel 422
|
|
123
|
+
* AFTER the full request payload is transmitted. For very large batches
|
|
124
|
+
* (1,000+ base64 documents in a single submission, multi-MB each) this
|
|
125
|
+
* is a bandwidth footgun — consumers should chunk client-side before
|
|
126
|
+
* submitting. (P5.6 R3 hostile note.)
|
|
127
|
+
*/
|
|
128
|
+
export interface VisionBatchExtractInput {
|
|
129
|
+
documents: VisionBatchDocument[];
|
|
130
|
+
model?: VisionModelTier;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* `packIntegration.schemaCompatibility` — advisory only; the kernel never
|
|
134
|
+
* gates on it. Mirrors `SchemaCompatibility` in kernel
|
|
135
|
+
* `src/lib/vision/pack-integration.ts:198-207`.
|
|
136
|
+
*/
|
|
137
|
+
export interface VisionSchemaCompatibility {
|
|
138
|
+
/** `false` when the pack declares no `framework_bindings` (nothing to assess). */
|
|
139
|
+
assessable: boolean;
|
|
140
|
+
/** The vision extraction's effective `documentType`. */
|
|
141
|
+
visionDocumentType: string;
|
|
142
|
+
/** The pack's declared framework bindings (`framework` + `identifier` echo). */
|
|
143
|
+
packFrameworkBindings: Array<{
|
|
144
|
+
framework: string;
|
|
145
|
+
identifier: string;
|
|
146
|
+
}>;
|
|
147
|
+
/** Human-readable advisory string. Open-spec; consumers SHOULD NOT pattern-match. */
|
|
148
|
+
advisory: string;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* `packIntegration.hashCollision` — present when `addBundleToPack` detected
|
|
152
|
+
* one or more prior bundles in the pack with the same `(inputs_hash,
|
|
153
|
+
* outputs_hash)` tuple. The kernel caps the colliding-bundle-id list at 10;
|
|
154
|
+
* the SDK exposes only `{detected, count}` (the count is the kernel-capped
|
|
155
|
+
* value).
|
|
156
|
+
*/
|
|
157
|
+
export interface VisionPackIntegrationHashCollision {
|
|
158
|
+
detected: boolean;
|
|
159
|
+
count: number;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* `extract` response's optional `packIntegration` field. Mirrors
|
|
163
|
+
* `PackIntegrationResult` in kernel `src/lib/vision/pack-integration.ts:315`.
|
|
164
|
+
*
|
|
165
|
+
* Present ONLY when the request supplied `packId`; the no-`packId` response
|
|
166
|
+
* has no `packIntegration` own-property at all (drift-pinned).
|
|
167
|
+
*/
|
|
168
|
+
export interface VisionPackIntegrationResult {
|
|
169
|
+
status: VisionPackIntegrationStatus;
|
|
170
|
+
/** The pack the extraction was wrapped into. UUID. */
|
|
171
|
+
packId: string;
|
|
172
|
+
/**
|
|
173
|
+
* The new bundle's UUID. PRESENT when `status === "wrapped"`; absent on
|
|
174
|
+
* failure (a race or a transient DB fault).
|
|
175
|
+
*/
|
|
176
|
+
bundleId?: string;
|
|
177
|
+
/**
|
|
178
|
+
* The pack's `content_hash` AFTER the bundle was appended. PRESENT when
|
|
179
|
+
* `status === "wrapped"`. `null` is permitted (the kernel emits `null`
|
|
180
|
+
* when the recomputation hadn't landed at the moment of the response).
|
|
181
|
+
*/
|
|
182
|
+
packContentHash?: string | null;
|
|
183
|
+
/** `sha256:` hash of the image input (decoded bytes OR uri string). */
|
|
184
|
+
inputsHash?: string;
|
|
185
|
+
/** `sha256:` hash of the canonical-JSON extraction-output projection. */
|
|
186
|
+
outputsHash?: string;
|
|
187
|
+
hashCollision?: VisionPackIntegrationHashCollision;
|
|
188
|
+
/**
|
|
189
|
+
* Advisory schema-compatibility echo. Always present (regardless of
|
|
190
|
+
* status).
|
|
191
|
+
*/
|
|
192
|
+
schemaCompatibility: VisionSchemaCompatibility;
|
|
193
|
+
/**
|
|
194
|
+
* Present when `status === "failed"`. Open-spec `code`; consumers can
|
|
195
|
+
* branch on known values (`"vision.pack_wrap_failed"`,
|
|
196
|
+
* `"evidence_pack.not_found"`, `"evidence_pack.invalid_state"`, ...) but
|
|
197
|
+
* the SDK does NOT close-enum on it (faithful courier — same convention
|
|
198
|
+
* as `BulkFailedSummary.code`).
|
|
199
|
+
*/
|
|
200
|
+
error?: {
|
|
201
|
+
code: string;
|
|
202
|
+
message: string;
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Token-usage breakdown returned by the `extract` response. Mirrors
|
|
207
|
+
* `TokensUsed` in kernel `src/lib/vision/types.ts:50-55`.
|
|
208
|
+
*/
|
|
209
|
+
export interface VisionTokensUsed {
|
|
210
|
+
input: number;
|
|
211
|
+
output: number;
|
|
212
|
+
cacheCreation: number;
|
|
213
|
+
cacheRead: number;
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Response for `vision.extract`. Mirrors the `successResponse(...)` body of
|
|
217
|
+
* `src/app/api/v1/vision/extract/route.ts` (lines 185-194).
|
|
218
|
+
*
|
|
219
|
+
* `structuredExtraction` is `null` when the Anthropic response did not parse
|
|
220
|
+
* to JSON (`parseError: 'parse_failed'` in the underlying call row). The
|
|
221
|
+
* extraction was still billed and persisted; consumers detect this by
|
|
222
|
+
* `result.structuredExtraction === null`.
|
|
223
|
+
*/
|
|
224
|
+
export interface VisionExtractResponse {
|
|
225
|
+
/** UUID of the persisted `vision_extraction_calls` row. */
|
|
226
|
+
callId: string;
|
|
227
|
+
/**
|
|
228
|
+
* The parsed JSON extraction OR `null` on a parse failure. Open-spec shape
|
|
229
|
+
* — varies per `documentType` (model-card, validation-report, etc.).
|
|
230
|
+
*/
|
|
231
|
+
structuredExtraction: Record<string, unknown> | null;
|
|
232
|
+
/** Per-field confidence scores from the extraction (0..1 floats). */
|
|
233
|
+
confidencePerField: Record<string, number>;
|
|
234
|
+
/** Per-field source-region descriptions (free-text). */
|
|
235
|
+
sourceRegions: Record<string, string>;
|
|
236
|
+
tokensUsed: VisionTokensUsed;
|
|
237
|
+
/** Cost in USD cents (integer). */
|
|
238
|
+
costUsdCents: number;
|
|
239
|
+
/** Wall-clock latency of the underlying Anthropic call, milliseconds. */
|
|
240
|
+
latencyMs: number;
|
|
241
|
+
/**
|
|
242
|
+
* Additive P5.5 surface. PRESENT only when the request supplied `packId`;
|
|
243
|
+
* the no-`packId` response has no `packIntegration` own-property.
|
|
244
|
+
*/
|
|
245
|
+
packIntegration?: VisionPackIntegrationResult;
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Response for `vision.extractBatch`. The route returns HTTP 202 with this
|
|
249
|
+
* body wrapped in `successResponse`. `status` is always literal `"queued"`
|
|
250
|
+
* at submission time; consumers poll `vision.getJobStatus(jobId)` to observe
|
|
251
|
+
* status transitions.
|
|
252
|
+
*/
|
|
253
|
+
export interface VisionBatchExtractResponse {
|
|
254
|
+
jobId: string;
|
|
255
|
+
status: "queued";
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Response for `vision.getJobStatus`. Mirrors the projection in
|
|
259
|
+
* `src/app/api/v1/vision/extract/jobs/[jobId]/route.ts:67-83`.
|
|
260
|
+
*
|
|
261
|
+
* `errorLog`, `resultPackId`, `startedAt`, `completedAt` are nullable (the
|
|
262
|
+
* job's terminal state determines which are non-null). `status` is the
|
|
263
|
+
* kernel enum `'queued' | 'processing' | 'completed' | 'failed' | 'partial'`
|
|
264
|
+
* but typed as `string` for forward-compat (a future kernel value would
|
|
265
|
+
* round-trip without an SDK bump — same forward-compat convention as
|
|
266
|
+
* `humanOversightState`).
|
|
267
|
+
*
|
|
268
|
+
* `costTokensInput` / `costTokensOutput` come from `bigint` Postgres columns;
|
|
269
|
+
* Drizzle may serialize them as `number` (in-range) or `string` (out-of-
|
|
270
|
+
* range Number.MAX_SAFE_INTEGER). The SDK accepts either at runtime.
|
|
271
|
+
*
|
|
272
|
+
* `config` (the raw batch request, which can hold base64 image payloads)
|
|
273
|
+
* is INTENTIONALLY NOT echoed back by the kernel (P5.4 audit concern #21
|
|
274
|
+
* + DEV-2) — payload-size privacy + anti-replay. The SDK type reflects
|
|
275
|
+
* this faithfully (no `config` field).
|
|
276
|
+
*/
|
|
277
|
+
export interface VisionJobStatus {
|
|
278
|
+
jobId: string;
|
|
279
|
+
/** `'queued' | 'processing' | 'completed' | 'failed' | 'partial'`. */
|
|
280
|
+
status: string;
|
|
281
|
+
documentCount: number;
|
|
282
|
+
documentsProcessed: number;
|
|
283
|
+
/** Echoed from the request's `model` (`"opus"` / `"sonnet"`). */
|
|
284
|
+
modelTier: string;
|
|
285
|
+
costUsdCents: number;
|
|
286
|
+
/** bigint column — `number` (in-range) or `string` (out-of-range). */
|
|
287
|
+
costTokensInput: number | string;
|
|
288
|
+
costTokensOutput: number | string;
|
|
289
|
+
/**
|
|
290
|
+
* jsonb column. Open-spec — entries are
|
|
291
|
+
* `{docIndex: number, error: string}` (P5.3 partial-failure schema), but
|
|
292
|
+
* the SDK does NOT enforce inner shape (faithful courier).
|
|
293
|
+
*/
|
|
294
|
+
errorLog: unknown[] | null;
|
|
295
|
+
/** UUID of the result evidence pack, IF the job's config wired one. */
|
|
296
|
+
resultPackId: string | null;
|
|
297
|
+
/** ISO-8601 timestamp. */
|
|
298
|
+
createdAt: string;
|
|
299
|
+
/** ISO-8601 timestamp; null when status === 'queued'. */
|
|
300
|
+
startedAt: string | null;
|
|
301
|
+
/** ISO-8601 timestamp; null until status is a terminal value. */
|
|
302
|
+
completedAt: string | null;
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* `vision` resource — sibling to `IncidentsResource`, `DecisionsResource`,
|
|
306
|
+
* `ChatResource`, `AuditLogResource`, `RegulatoryChangesResource`,
|
|
307
|
+
* `ComplianceCheckResource`, `CheckResource`, `GateResource`.
|
|
308
|
+
*
|
|
309
|
+
* Three methods today (`extract`, `extractBatch`, `getJobStatus`). All three
|
|
310
|
+
* are JSON request/response (no SSE / NDJSON). The class is also the landing
|
|
311
|
+
* pad for future vision methods (e.g. a `listSupportedSchemas` once a kernel
|
|
312
|
+
* route surfaces it — currently exposed only as an MCP tool).
|
|
313
|
+
*/
|
|
314
|
+
export declare class VisionResource {
|
|
315
|
+
private readonly client;
|
|
316
|
+
constructor(client: AttestryClient);
|
|
317
|
+
/**
|
|
318
|
+
* Synchronously extract structured data from a single regulatory document
|
|
319
|
+
* image. Wraps `POST /api/v1/vision/extract`.
|
|
320
|
+
*
|
|
321
|
+
* **Latency**: ~25.5s p50 with Opus 4.7 (`KE2-P5-VISION.md` §"Empirical
|
|
322
|
+
* findings"); tail latency approaches the kernel `maxDuration: 60s`. The
|
|
323
|
+
* SDK does NOT lower the default `timeoutMs: 30_000` for this method
|
|
324
|
+
* (resource methods do not override per-method timeouts in `@attestry/sdk`).
|
|
325
|
+
* Latency-sensitive consumers MAY raise it via `{timeoutMs: 60_000}` per
|
|
326
|
+
* call.
|
|
327
|
+
*
|
|
328
|
+
* **Cost**: ~$0.22 per Opus 4.7 call; Sonnet 4 is ~5–6× cheaper. The cost
|
|
329
|
+
* is returned in `response.costUsdCents` (integer).
|
|
330
|
+
*
|
|
331
|
+
* **`mediaType` is REQUIRED** (P5.4 DEV-10). The SDK rejects requests
|
|
332
|
+
* without it synchronously (`TypeError`), saving the network round-trip
|
|
333
|
+
* the kernel would otherwise 422.
|
|
334
|
+
*
|
|
335
|
+
* **`packId` is the P5.5 evidence-pack wrap target** — optional UUID.
|
|
336
|
+
* When supplied, the response carries `packIntegration` describing the
|
|
337
|
+
* wrap outcome:
|
|
338
|
+
* - success → `{status: "wrapped", packId, bundleId, packContentHash,
|
|
339
|
+
* inputsHash, outputsHash, hashCollision?, schemaCompatibility}`
|
|
340
|
+
* - post-extraction wrap failure (race / transient DB fault) →
|
|
341
|
+
* `{status: "failed", packId, schemaCompatibility, error}` —
|
|
342
|
+
* the extraction itself succeeded and is returned in the same response.
|
|
343
|
+
* - caller-error wrap target (unknown / cross-org / non-draft pack) →
|
|
344
|
+
* fails as `AttestryAPIError` BEFORE the billed extraction (the
|
|
345
|
+
* kernel's pre-flight catches these and returns 4xx; nothing is
|
|
346
|
+
* billed). The SDK does NOT pre-validate pack state; the kernel is
|
|
347
|
+
* the authority.
|
|
348
|
+
*
|
|
349
|
+
* Errors — ordered by kernel firing precedence (rate-limit → auth → body
|
|
350
|
+
* parse → pre-flight pack → vision extraction → wrap). A request with
|
|
351
|
+
* multiple problems surfaces ONLY the highest-precedence one.
|
|
352
|
+
*
|
|
353
|
+
* - `AttestryAPIError` (status 429) — rate limit FIRES FIRST (auto-
|
|
354
|
+
* retried by default — invariant #18; per-IP rate-limit key
|
|
355
|
+
* `vision-extract:${ip}`).
|
|
356
|
+
* - `AttestryAPIError` (status 401) — no API key OR invalid key.
|
|
357
|
+
* - `AttestryAPIError` (status 403) — authenticated key lacks
|
|
358
|
+
* `WRITE_ASSESSMENTS` permission.
|
|
359
|
+
* - `AttestryAPIError` (status 400) — JSON parse failure on the body
|
|
360
|
+
* OR a kernel-side vision-validation rejection (`vision.<code>`).
|
|
361
|
+
* - `AttestryAPIError` (status 422) — Zod validation failed (`details.code`
|
|
362
|
+
* === `"vision.validation_failed"`; `details.issues` carries the
|
|
363
|
+
* field paths).
|
|
364
|
+
* - `AttestryAPIError` (status 404) — `packId` does not exist OR
|
|
365
|
+
* belongs to another org (anti-enumeration collapse; per
|
|
366
|
+
* `mapEvidencePackError`).
|
|
367
|
+
* - `AttestryAPIError` (status 409) — `packId` is not in `draft`
|
|
368
|
+
* state (signed / superseded / revoked / expired).
|
|
369
|
+
* - `AttestryAPIError` (status 502) — upstream Anthropic / DNS /
|
|
370
|
+
* gateway fault (`vision.<code>`).
|
|
371
|
+
* - `AttestryAPIError` (status 503) — extraction completed but the
|
|
372
|
+
* call row failed to persist (`vision.persist_failed`).
|
|
373
|
+
* - `AttestryAPIError` (status 500) — internal kernel error.
|
|
374
|
+
* - `AttestryError` ("request aborted by caller") — caller-supplied
|
|
375
|
+
* `options.signal` fired (pre-aborted or mid-flight).
|
|
376
|
+
* - `AttestryError` (P2 hardening) — kernel response failed SDK-side
|
|
377
|
+
* shape validation (not an object, wrong type on any field).
|
|
378
|
+
* - `AttestryAPIError` (P3 hardening) — kernel response had a wrong
|
|
379
|
+
* `Content-Type` (transport-level guard at `transport.ts:271-291`,
|
|
380
|
+
* before body parsing).
|
|
381
|
+
* - `TypeError` (synchronous, no fetch issued) — input failed SDK-side
|
|
382
|
+
* validation (null / array / non-object input; missing or bad
|
|
383
|
+
* `mediaType` / `documentType`; bad `base64` / `imageUri` XOR;
|
|
384
|
+
* oversized `imageUri` / `base64`; bad `model` / `extractionSchema`
|
|
385
|
+
* enum; bad `packId` UUID).
|
|
386
|
+
*
|
|
387
|
+
* **SDK-side validation** (synchronous `TypeError`, no fetch issued):
|
|
388
|
+
* - `input` itself: required; must be a non-null, non-array object.
|
|
389
|
+
* - `input.mediaType`: required own-property; must be a member of
|
|
390
|
+
* `SUPPORTED_MEDIA_TYPES`.
|
|
391
|
+
* - `input.documentType`: required own-property; must be a member of
|
|
392
|
+
* `SUPPORTED_DOCUMENT_TYPES`.
|
|
393
|
+
* - `input.base64` XOR `input.imageUri`: exactly one own-property must
|
|
394
|
+
* be present with a non-empty string value.
|
|
395
|
+
* - `input.base64` (when present): non-empty string, length ≤
|
|
396
|
+
* ANTHROPIC_IMAGE_MAX_BASE64.
|
|
397
|
+
* - `input.imageUri` (when present): non-empty string, length ≤
|
|
398
|
+
* 2048.
|
|
399
|
+
* - `input.extractionSchema` (when own-present, value not undefined):
|
|
400
|
+
* must be a member of `SUPPORTED_DOCUMENT_TYPES`.
|
|
401
|
+
* - `input.model` (when own-present, value not undefined): must be a
|
|
402
|
+
* member of `VISION_MODELS`.
|
|
403
|
+
* - `input.packId` (when own-present, value not undefined): must be a
|
|
404
|
+
* non-empty string matching `UUID_REGEX`.
|
|
405
|
+
*
|
|
406
|
+
* **Response-shape validation** (P2 hardening; symmetric to input-side
|
|
407
|
+
* prototype-pollution defense): every documented response field is
|
|
408
|
+
* type-checked via the `objectHasOwn` snapshot. A hostile npm dep that
|
|
409
|
+
* pollutes `Object.prototype.<field>` cannot mask a kernel regression
|
|
410
|
+
* where the field is missing.
|
|
411
|
+
*
|
|
412
|
+
* @example Basic single-image extraction
|
|
413
|
+
* ```ts
|
|
414
|
+
* const result = await client.vision.extract({
|
|
415
|
+
* base64: "iVBORw0KGgoAAAANSUhEUgAA...",
|
|
416
|
+
* mediaType: "image/png",
|
|
417
|
+
* documentType: "model-card",
|
|
418
|
+
* });
|
|
419
|
+
* console.log(result.structuredExtraction);
|
|
420
|
+
* console.log(`cost: ${result.costUsdCents / 100} USD`);
|
|
421
|
+
* ```
|
|
422
|
+
*
|
|
423
|
+
* @example Extraction wrapped into an evidence pack (P5.5)
|
|
424
|
+
* ```ts
|
|
425
|
+
* const result = await client.vision.extract({
|
|
426
|
+
* imageUri: "https://example.com/cert.png",
|
|
427
|
+
* mediaType: "image/png",
|
|
428
|
+
* documentType: "certification-label",
|
|
429
|
+
* model: "sonnet", // cheaper tier for high-volume
|
|
430
|
+
* packId: "11111111-1111-1111-1111-111111111111",
|
|
431
|
+
* });
|
|
432
|
+
* if (result.packIntegration?.status === "wrapped") {
|
|
433
|
+
* console.log("bundle:", result.packIntegration.bundleId);
|
|
434
|
+
* }
|
|
435
|
+
* ```
|
|
436
|
+
*/
|
|
437
|
+
extract(input: VisionExtractInput, options?: RequestOptions): Promise<VisionExtractResponse>;
|
|
438
|
+
/**
|
|
439
|
+
* Submit a multi-document batch for asynchronous extraction. Wraps
|
|
440
|
+
* `POST /api/v1/vision/extract/batch`.
|
|
441
|
+
*
|
|
442
|
+
* Returns immediately with the new `jobId` and `status: "queued"`. The
|
|
443
|
+
* Vercel cron `vision-process-batch` (P5.3) drains the job over multiple
|
|
444
|
+
* 5-minute ticks; consumers poll progress via `vision.getJobStatus(jobId)`.
|
|
445
|
+
*
|
|
446
|
+
* **Enterprise plan-gate** — the kernel `requirePlan(org, 'hasBatchVision')`
|
|
447
|
+
* returns 403 with `details.code === "vision.batch.plan_required"` for
|
|
448
|
+
* non-entitled orgs. The SDK forwards the error faithfully.
|
|
449
|
+
*
|
|
450
|
+
* **Per-org active-job ceiling** — the kernel rejects with 429 + `details.
|
|
451
|
+
* code === "vision.batch.queue_limit"` when the org already has 5 jobs in
|
|
452
|
+
* `queued` or `processing` state. The SDK forwards (no client-side count).
|
|
453
|
+
*
|
|
454
|
+
* **`Idempotency-Key` HTTP header is NOT exposed in P5.6** (concern #9 in
|
|
455
|
+
* the audit doc; carry-forward documented). The kernel accepts the header
|
|
456
|
+
* for safe replay, but the SDK transport does not currently surface a
|
|
457
|
+
* way to thread arbitrary headers through JSON POSTs. A future small
|
|
458
|
+
* `chore(sdk):` will add `headers?: Record<string, string>` to
|
|
459
|
+
* `RequestOptions` and a corresponding method-arg here. Consumers needing
|
|
460
|
+
* idempotency today should retry with their own client-side dedupe.
|
|
461
|
+
*
|
|
462
|
+
* Errors — ordered by kernel firing precedence:
|
|
463
|
+
* - `AttestryAPIError` (status 429) — rate limit OR queue-limit
|
|
464
|
+
* (`details.code === "vision.batch.queue_limit"`). The rate-limit
|
|
465
|
+
* variant is auto-retried; the queue-limit variant is NOT (it
|
|
466
|
+
* indicates persistent backpressure).
|
|
467
|
+
* - `AttestryAPIError` (status 401) — no API key OR invalid key.
|
|
468
|
+
* - `AttestryAPIError` (status 403) — plan-gate denial
|
|
469
|
+
* (`details.code === "vision.batch.plan_required"`).
|
|
470
|
+
* - `AttestryAPIError` (status 400) — JSON parse failure on body.
|
|
471
|
+
* - `AttestryAPIError` (status 422) — Zod validation failed
|
|
472
|
+
* (`details.code === "vision.validation_failed"`); OR custom
|
|
473
|
+
* `BatchValidationError` (`details.code === "vision.batch.invalid"`).
|
|
474
|
+
* - `AttestryAPIError` (status 500) — internal kernel error
|
|
475
|
+
* (e.g. `vision_extraction_jobs` INSERT returned no id).
|
|
476
|
+
* - `AttestryError` — request abort / response shape failure / P3 guard.
|
|
477
|
+
* - `TypeError` (synchronous, no fetch issued) — input failed SDK-side
|
|
478
|
+
* validation.
|
|
479
|
+
*
|
|
480
|
+
* **SDK-side validation** (synchronous `TypeError`, no fetch issued):
|
|
481
|
+
* - `input` itself: required; non-null, non-array object.
|
|
482
|
+
* - `input.documents`: required; non-empty array (SDK enforces
|
|
483
|
+
* `length >= 1`; kernel's upper bound is NOT duplicated).
|
|
484
|
+
* - Each document mirrors `extract` validation: required `mediaType`
|
|
485
|
+
* (enum) + `documentType` (enum); `base64` XOR `imageUri`;
|
|
486
|
+
* `extractionSchema` / `sourceImageUri` optional with the same caps.
|
|
487
|
+
* - `input.model` (when own-present, value not undefined): must be a
|
|
488
|
+
* member of `VISION_MODELS`.
|
|
489
|
+
*
|
|
490
|
+
* @example
|
|
491
|
+
* ```ts
|
|
492
|
+
* const { jobId } = await client.vision.extractBatch({
|
|
493
|
+
* documents: [
|
|
494
|
+
* {
|
|
495
|
+
* imageUri: "https://example.com/cert1.png",
|
|
496
|
+
* mediaType: "image/png",
|
|
497
|
+
* documentType: "certification-label",
|
|
498
|
+
* },
|
|
499
|
+
* {
|
|
500
|
+
* imageUri: "https://example.com/cert2.png",
|
|
501
|
+
* mediaType: "image/png",
|
|
502
|
+
* documentType: "certification-label",
|
|
503
|
+
* },
|
|
504
|
+
* ],
|
|
505
|
+
* model: "sonnet",
|
|
506
|
+
* });
|
|
507
|
+
* // Poll: while (status !== "completed") { status = (await client.vision
|
|
508
|
+
* // .getJobStatus(jobId)).status; await new Promise(r => setTimeout(r, 5000)); }
|
|
509
|
+
* ```
|
|
510
|
+
*/
|
|
511
|
+
extractBatch(input: VisionBatchExtractInput, options?: RequestOptions): Promise<VisionBatchExtractResponse>;
|
|
512
|
+
/**
|
|
513
|
+
* Poll the status + cost rollup of an async batch job. Wraps
|
|
514
|
+
* `GET /api/v1/vision/extract/jobs/{jobId}`.
|
|
515
|
+
*
|
|
516
|
+
* **Anti-enumeration 404 collapse** — a job belonging to another org
|
|
517
|
+
* returns 404, identical to an unknown id. Consumers writing defensive
|
|
518
|
+
* error-handling logic must NOT use a 404 to infer "this job ID never
|
|
519
|
+
* existed". The raw `config` jsonb (which can hold base64 image
|
|
520
|
+
* payloads) is INTENTIONALLY NOT echoed back; only status/cost/error
|
|
521
|
+
* columns are projected.
|
|
522
|
+
*
|
|
523
|
+
* Errors:
|
|
524
|
+
* - `AttestryAPIError` (status 429) — rate limit (auto-retried).
|
|
525
|
+
* - `AttestryAPIError` (status 401) — no API key OR invalid key.
|
|
526
|
+
* - `AttestryAPIError` (status 403) — authenticated key lacks
|
|
527
|
+
* `READ_ASSESSMENTS`.
|
|
528
|
+
* - `AttestryAPIError` (status 400) — kernel-side malformed UUID
|
|
529
|
+
* ("Invalid job id."). Pre-validated by the SDK first, so reaches
|
|
530
|
+
* consumers only via UUID regex drift.
|
|
531
|
+
* - `AttestryAPIError` (status 404) — not found OR cross-org
|
|
532
|
+
* (deliberate conflation).
|
|
533
|
+
* - `AttestryAPIError` (status 500) — internal kernel error.
|
|
534
|
+
* - `AttestryError` — request abort / response shape failure / P3.
|
|
535
|
+
* - `TypeError` (synchronous, no fetch issued) — `jobId` empty,
|
|
536
|
+
* non-string, or not an RFC 4122 hyphenated UUID.
|
|
537
|
+
*/
|
|
538
|
+
getJobStatus(jobId: string, options?: RequestOptions): Promise<VisionJobStatus>;
|
|
539
|
+
}
|
|
540
|
+
//# sourceMappingURL=vision.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vision.d.ts","sourceRoot":"","sources":["../../src/resources/vision.ts"],"names":[],"mappings":"AAoEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAiClD;;;;;;;;GAQG;AACH,eAAO,MAAM,qBAAqB,iEAKvB,CAAC;AACZ,MAAM,MAAM,wBAAwB,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE9E;;;;;;;;GAQG;AACH,eAAO,MAAM,wBAAwB,gHAM1B,CAAC;AACZ,MAAM,MAAM,2BAA2B,GACrC,CAAC,OAAO,wBAAwB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE5C;;;GAGG;AACH,eAAO,MAAM,aAAa,6BAA6C,CAAC;AAC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