@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 @@
1
+ {"version":3,"file":"batch.js","sourceRoot":"","sources":["../../src/resources/batch.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,EAAE;AACF,mEAAmE;AACnE,EAAE;AACF,sEAAsE;AACtE,sEAAsE;AACtE,EAAE;AACF,8DAA8D;AAC9D,4DAA4D;AAC5D,mDAAmD;AACnD,8DAA8D;AAC9D,EAAE;AACF,mEAAmE;AACnE,mEAAmE;AACnE,iDAAiD;AACjD,qCAAqC;AACrC,sEAAsE;AACtE,qEAAqE;AACrE,sEAAsE;AACtE,2CAA2C;AAC3C,4CAA4C;AAC5C,iCAAiC;AACjC,qEAAqE;AACrE,iEAAiE;AACjE,sEAAsE;AACtE,4DAA4D;AAC5D,EAAE;AACF,8DAA8D;AAC9D,6CAA6C;AAC7C,qEAAqE;AACrE,iEAAiE;AACjE,8DAA8D;AAC9D,mEAAmE;AACnE,uDAAuD;AACvD,mEAAmE;AACnE,qEAAqE;AACrE,gCAAgC;AAChC,sBAAsB;AACtB,iEAAiE;AACjE,6CAA6C;AAC7C,gBAAgB;AAChB,oEAAoE;AACpE,sEAAsE;AACtE,8DAA8D;AAC9D,qEAAqE;AACrE,mEAAmE;AACnE,oEAAoE;AACpE,gEAAgE;AAChE,2CAA2C;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GAAG,CACrC,CAAC;IACJ,CAAC;IACD,MAAM,SAAS,GAAG,YAAY,CAAC,GAAG,EAAE,WAAW,CAAC;QAC9C,CAAC,CAAC,GAAG,CAAC,SAAS;QACf,CAAC,CAAC,SAAS,CAAC;IACd,IAAI,SAAS,KAAK,IAAI,IAAI,OAAO,SAAS,KAAK,QAAQ,EAAE,CAAC;QACxD,MAAM,IAAI,aAAa,CACrB,gEAAgE;YAC9D,QAAQ,YAAY,CAAC,SAAS,CAAC,GAAG,CACrC,CAAC;IACJ,CAAC;IACD,MAAM,WAAW,GAAG,YAAY,CAAC,GAAG,EAAE,aAAa,CAAC;QAClD,CAAC,CAAC,GAAG,CAAC,WAAW;QACjB,CAAC,CAAC,SAAS,CAAC;IACd,IAAI,WAAW,KAAK,IAAI,IAAI,OAAO,WAAW,KAAK,QAAQ,EAAE,CAAC;QAC5D,MAAM,IAAI,aAAa,CACrB,kEAAkE;YAChE,QAAQ,YAAY,CAAC,WAAW,CAAC,GAAG,CACvC,CAAC;IACJ,CAAC;IACD,OAAO,MAAwB,CAAC;AAClC,CAAC;AAED;;;;;;;;;;GAUG;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,151 @@
1
+ import type { AttestryClient } from "../client.js";
2
+ import type { RequestOptions } from "../types.js";
3
+ /**
4
+ * Public chat-message roles. Mirrors the kernel route's `z.enum(['user',
5
+ * 'assistant'])` at `src/app/api/ai/chat/route.ts`. `system` is reserved
6
+ * for the server-side prompt and is not a valid client role. Extracted
7
+ * as `as const` so consumers can iterate (`for (const r of
8
+ * CHAT_MESSAGE_ROLES)`) and so a future drift-detection pin can compare
9
+ * structurally against the kernel source.
10
+ */
11
+ export declare const CHAT_MESSAGE_ROLES: readonly ["user", "assistant"];
12
+ export type ChatMessageRole = (typeof CHAT_MESSAGE_ROLES)[number];
13
+ export interface ChatMessage {
14
+ /** `system` role is reserved for the server; clients send 'user' / 'assistant'. */
15
+ role: ChatMessageRole;
16
+ /** 1-4000 chars; server-side Zod hard-rejects out-of-range. */
17
+ content: string;
18
+ }
19
+ export interface ChatContextGap {
20
+ requirementKey: string;
21
+ priority: string;
22
+ description?: string;
23
+ }
24
+ /**
25
+ * Optional UI-side context that callers can attach to seed Reggie's
26
+ * answer. Mirrors the kernel's `chatSchema.context` exactly. Every
27
+ * field is optional — server validates each independently. Callers
28
+ * with no useful context just pass `undefined`.
29
+ *
30
+ * The server REJECTS unknown context fields per the route's Zod
31
+ * `.optional()` boundary; do not embed forward-compatible "extra"
32
+ * keys. Coordinate with the kernel team and bump the SDK on schema
33
+ * additions.
34
+ */
35
+ export interface ChatContext {
36
+ systemName?: string;
37
+ systemDescription?: string;
38
+ deploymentGeography?: string[];
39
+ riskLevel?: string;
40
+ frameworks?: string[];
41
+ assessmentScores?: Record<string, number>;
42
+ gaps?: ChatContextGap[];
43
+ jurisdictions?: string[];
44
+ orgName?: string;
45
+ /** Non-negative integer; server enforces `int().nonnegative()`. */
46
+ systemCount?: number;
47
+ systemNames?: string[];
48
+ /** 0-100 score; server enforces `min(0).max(100)`. */
49
+ overallComplianceScore?: number;
50
+ /** Non-negative integer. */
51
+ activeAttestationCount?: number;
52
+ /** Non-negative integer. */
53
+ pendingRemediationTasks?: number;
54
+ /** Non-negative integer. */
55
+ recentRegChangesCount?: number;
56
+ /** Up to 200 chars. */
57
+ currentPage?: string;
58
+ }
59
+ export interface ChatSendInput {
60
+ /** 1-50 entries; each content 1-4000 chars. Server rejects out-of-range. */
61
+ messages: ChatMessage[];
62
+ context?: ChatContext;
63
+ }
64
+ export interface ChatSendResponse {
65
+ /** The final assistant message text. */
66
+ message: string;
67
+ /** Always `"Reggie"` today; surfaced in case a future agent is added. */
68
+ agent: string;
69
+ }
70
+ /**
71
+ * One chunk emitted by `chat.stream`'s async iterator.
72
+ *
73
+ * Iterator contract:
74
+ * - Zero or more `{type: 'text', delta}` chunks (today: exactly one,
75
+ * since the kernel route is sync; tomorrow: many, when SSE lands).
76
+ * - Followed by EXACTLY ONE terminator: either `{type: 'done'}` on
77
+ * success or `{type: 'error', message}` on any failure.
78
+ * - After the terminator, the iterator ends (`next()` returns
79
+ * `{value: undefined, done: true}`).
80
+ *
81
+ * Errors are surfaced as `error` chunks rather than thrown so consumers
82
+ * have a uniform `for await` handling pattern — no per-iteration
83
+ * try/catch required. The original error-classification info lives in
84
+ * the message text plus, when relevant, the structured `AttestryAPIError`
85
+ * available via the equivalent `chat.send` method.
86
+ */
87
+ export type ChatStreamChunk = {
88
+ type: "text";
89
+ delta: string;
90
+ } | {
91
+ type: "done";
92
+ } | {
93
+ type: "error";
94
+ message: string;
95
+ };
96
+ export declare class ChatResource {
97
+ private readonly client;
98
+ constructor(client: AttestryClient);
99
+ /**
100
+ * Send messages to Reggie and receive a single response.
101
+ *
102
+ * Errors surface as `AttestryAPIError` with statuses:
103
+ * - 400 — schema rejection (e.g., too many messages, content too long)
104
+ * - 401 — auth missing / invalid (transport surfaces as AuthError on the
105
+ * kernel side; SDK consumers see AttestryAPIError 401)
106
+ * - 403 — plan limit (`details` carries `{upgradeRequired, feature,
107
+ * currentPlan}`; `feature` is the wire-stable `hasAttestor`
108
+ * rather than internal `hasReggie` per the B.1 rebrand pin)
109
+ * - 429 — rate limit (assessmentLimiter, 20/min/IP)
110
+ * - 503 — AI not configured server-side
111
+ */
112
+ send(input: ChatSendInput, options?: RequestOptions): Promise<ChatSendResponse>;
113
+ /**
114
+ * Stream Reggie's response as an async iterable of `ChatStreamChunk`.
115
+ *
116
+ * Iterator yields zero-or-more `{type:'text', delta}` chunks, then
117
+ * exactly one terminator: `{type:'done'}` on success OR
118
+ * `{type:'error', message}` on any failure. After the terminator the
119
+ * iterator ends.
120
+ *
121
+ * Today: backed by the sync POST endpoint (same as `send`). Yields
122
+ * one `text` chunk + `done` on success. When `/api/ai/chat` migrates
123
+ * to SSE — or when a sibling streaming endpoint lands — the underlying
124
+ * implementation swaps to an SSE parser without changing this method's
125
+ * public contract.
126
+ *
127
+ * Lazy: the request is NOT issued until the first iteration. Pass
128
+ * `options.signal` for cancellation — pre-aborted causes the first
129
+ * iteration to yield `error` and end with no fetch issued; mid-flight
130
+ * abort fires the underlying `AbortController` and surfaces as an
131
+ * `error` chunk.
132
+ *
133
+ * Errors NEVER throw from the iterator — they surface as `error`
134
+ * chunks. Consumer code can use a single `for await` loop without
135
+ * per-iteration try/catch.
136
+ *
137
+ * @example
138
+ * ```ts
139
+ * const stream = client.chat.stream({
140
+ * messages: [{ role: 'user', content: 'What changed in NIST AI RMF v2?' }],
141
+ * });
142
+ * let buffer = '';
143
+ * for await (const chunk of stream) {
144
+ * if (chunk.type === 'text') buffer += chunk.delta;
145
+ * if (chunk.type === 'error') console.error('chat failed:', chunk.message);
146
+ * }
147
+ * ```
148
+ */
149
+ stream(input: ChatSendInput, options?: RequestOptions): AsyncIterable<ChatStreamChunk>;
150
+ }
151
+ //# sourceMappingURL=chat.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../../src/resources/chat.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB,gCAAgD,CAAC;AAEhF,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC;AAElE,MAAM,WAAW,WAAW;IAC1B,mFAAmF;IACnF,IAAI,EAAE,eAAe,CAAC;IACtB,+DAA+D;IAC/D,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,cAAc;IAC7B,cAAc,EAAE,MAAM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AM,CAAA;CAAE,GAC/B;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAChB;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAyCvC,qBAAa,YAAY;IACX,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,cAAc;IAEnD;;;;;;;;;;;;OAYG;IACH,IAAI,CACF,KAAK,EAAE,aAAa,EACpB,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,gBAAgB,CAAC;IAS5B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAmCG;IACH,MAAM,CACJ,KAAK,EAAE,aAAa,EACpB,OAAO,CAAC,EAAE,cAAc,GACvB,aAAa,CAAC,eAAe,CAAC;CAGlC"}
@@ -0,0 +1,124 @@
1
+ // ─── Chat resource ──────────────────────────────────────────────────────────
2
+ //
3
+ // Wraps `POST /api/ai/chat` (Reggie) — the org's compliance copilot.
4
+ // Despite earlier handoff text suggesting an SSE / async-iterator
5
+ // design, the actual kernel route is a *synchronous* JSON endpoint:
6
+ // caller POSTs messages + optional context, server runs `chatWithReggie`
7
+ // and returns one final assistant message via `successResponse({...})`.
8
+ // No streaming, no chunking. The build doc covers this deviation.
9
+ //
10
+ // Server-side context injection (Prompt B.4): Reggie's system prompt
11
+ // is enriched server-side with crosswalk-row matches and the top
12
+ // unresolved gap. The SDK does NOT mirror that — those fields are
13
+ // computed from the auth context and the supplied `messages`, not the
14
+ // caller-supplied context. SDK callers send their own UI / page
15
+ // context; the server appends to it.
16
+ /**
17
+ * Public chat-message roles. Mirrors the kernel route's `z.enum(['user',
18
+ * 'assistant'])` at `src/app/api/ai/chat/route.ts`. `system` is reserved
19
+ * for the server-side prompt and is not a valid client role. Extracted
20
+ * as `as const` so consumers can iterate (`for (const r of
21
+ * CHAT_MESSAGE_ROLES)`) and so a future drift-detection pin can compare
22
+ * structurally against the kernel source.
23
+ */
24
+ export const CHAT_MESSAGE_ROLES = Object.freeze(["user", "assistant"]);
25
+ /**
26
+ * Internal — async generator backing `chat.stream`. Today calls the
27
+ * sync POST endpoint, buffers the single response, and emits one
28
+ * `text` chunk + `done`. Forward-compatible: when the kernel migrates
29
+ * `/api/ai/chat` to SSE (or a sibling streaming endpoint lands), swap
30
+ * the body for a `Response.body!.getReader()` + `TextDecoder` SSE
31
+ * parser per the F.1 handoff's option (a). The public `stream` API
32
+ * contract — chunks, ordering, terminators, abort semantics — stays.
33
+ *
34
+ * Lazy: the request is NOT issued until the first iteration. Tested.
35
+ */
36
+ async function* runChatStream(client, input, options) {
37
+ try {
38
+ const response = await client._request({
39
+ method: "POST",
40
+ path: "/api/ai/chat",
41
+ body: input,
42
+ options,
43
+ });
44
+ if (response &&
45
+ typeof response.message === "string" &&
46
+ response.message.length > 0) {
47
+ yield { type: "text", delta: response.message };
48
+ }
49
+ yield { type: "done" };
50
+ }
51
+ catch (err) {
52
+ yield {
53
+ type: "error",
54
+ message: err instanceof Error ? err.message : String(err),
55
+ };
56
+ }
57
+ }
58
+ export class ChatResource {
59
+ client;
60
+ constructor(client) {
61
+ this.client = client;
62
+ }
63
+ /**
64
+ * Send messages to Reggie and receive a single response.
65
+ *
66
+ * Errors surface as `AttestryAPIError` with statuses:
67
+ * - 400 — schema rejection (e.g., too many messages, content too long)
68
+ * - 401 — auth missing / invalid (transport surfaces as AuthError on the
69
+ * kernel side; SDK consumers see AttestryAPIError 401)
70
+ * - 403 — plan limit (`details` carries `{upgradeRequired, feature,
71
+ * currentPlan}`; `feature` is the wire-stable `hasAttestor`
72
+ * rather than internal `hasReggie` per the B.1 rebrand pin)
73
+ * - 429 — rate limit (assessmentLimiter, 20/min/IP)
74
+ * - 503 — AI not configured server-side
75
+ */
76
+ send(input, options) {
77
+ return this.client._request({
78
+ method: "POST",
79
+ path: "/api/ai/chat",
80
+ body: input,
81
+ options,
82
+ });
83
+ }
84
+ /**
85
+ * Stream Reggie's response as an async iterable of `ChatStreamChunk`.
86
+ *
87
+ * Iterator yields zero-or-more `{type:'text', delta}` chunks, then
88
+ * exactly one terminator: `{type:'done'}` on success OR
89
+ * `{type:'error', message}` on any failure. After the terminator the
90
+ * iterator ends.
91
+ *
92
+ * Today: backed by the sync POST endpoint (same as `send`). Yields
93
+ * one `text` chunk + `done` on success. When `/api/ai/chat` migrates
94
+ * to SSE — or when a sibling streaming endpoint lands — the underlying
95
+ * implementation swaps to an SSE parser without changing this method's
96
+ * public contract.
97
+ *
98
+ * Lazy: the request is NOT issued until the first iteration. Pass
99
+ * `options.signal` for cancellation — pre-aborted causes the first
100
+ * iteration to yield `error` and end with no fetch issued; mid-flight
101
+ * abort fires the underlying `AbortController` and surfaces as an
102
+ * `error` chunk.
103
+ *
104
+ * Errors NEVER throw from the iterator — they surface as `error`
105
+ * chunks. Consumer code can use a single `for await` loop without
106
+ * per-iteration try/catch.
107
+ *
108
+ * @example
109
+ * ```ts
110
+ * const stream = client.chat.stream({
111
+ * messages: [{ role: 'user', content: 'What changed in NIST AI RMF v2?' }],
112
+ * });
113
+ * let buffer = '';
114
+ * for await (const chunk of stream) {
115
+ * if (chunk.type === 'text') buffer += chunk.delta;
116
+ * if (chunk.type === 'error') console.error('chat failed:', chunk.message);
117
+ * }
118
+ * ```
119
+ */
120
+ stream(input, options) {
121
+ return runChatStream(this.client, input, options);
122
+ }
123
+ }
124
+ //# sourceMappingURL=chat.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chat.js","sourceRoot":"","sources":["../../src/resources/chat.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,EAAE;AACF,qEAAqE;AACrE,kEAAkE;AAClE,oEAAoE;AACpE,yEAAyE;AACzE,wEAAwE;AACxE,kEAAkE;AAClE,EAAE;AACF,qEAAqE;AACrE,iEAAiE;AACjE,kEAAkE;AAClE,sEAAsE;AACtE,gEAAgE;AAChE,qCAAqC;AAKrC;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CA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QAExB,OAAO,aAAa,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IACpD,CAAC;CACF"}
@@ -0,0 +1,348 @@
1
+ import type { AttestryClient } from "../client.js";
2
+ import type { RequestOptions } from "../types.js";
3
+ /**
4
+ * Input shape for `check.run`. Source-of-truth at kernel
5
+ * `src/app/api/v1/check/route.ts:21-24` (Zod schema).
6
+ *
7
+ * **`systemId`** — REQUIRED RFC 4122 hyphenated UUID. The SDK
8
+ * pre-validates the format synchronously (`TypeError` for malformed
9
+ * input — D2 deviation from `complianceCheck.check`'s defer-to-kernel
10
+ * stance). The SDK's runtime check always runs regardless of
11
+ * TypeScript types — `as any` casts do NOT bypass it. The kernel-side
12
+ * Zod validation (422 fallback) only fires for kernel rule changes
13
+ * the SDK hasn't synced to.
14
+ *
15
+ * **`frameworks`** — OPTIONAL array of up to 20 framework
16
+ * identifiers; each string of length 1-100. The kernel filters
17
+ * assessments to those whose `assessment.frameworks: string[]`
18
+ * intersects this list (OR-overlap semantics, NOT all-required —
19
+ * consumers expecting AND will be surprised). When omitted, the
20
+ * kernel considers all assessments. Empty array `[]` is accepted and
21
+ * SDK-side passes through (matches Zod's `.array(...).max(20)` which
22
+ * accepts empty arrays).
23
+ *
24
+ * Open-spec field — kernel does NOT enforce a closed enum of valid
25
+ * framework names; any string within the length bounds is accepted.
26
+ * Consumers should align their filter values with the framework
27
+ * identifiers they used when creating assessments.
28
+ */
29
+ export interface CheckInput {
30
+ /**
31
+ * UUID of the system to check. RFC 4122 hyphenated form
32
+ * (8-4-4-4-12 hex, case-insensitive). Required.
33
+ */
34
+ systemId: string;
35
+ /**
36
+ * Optional framework filter. Each element must be a non-empty
37
+ * string of length ≤100; the array length must be ≤20. SDK
38
+ * pre-validates all three rules.
39
+ *
40
+ * **OR-overlap semantics** (kernel filters with `aFrameworks.some`
41
+ * at route.ts:67-71) — an assessment matches if its frameworks
42
+ * intersect this list, not if it covers ALL of them. Consumers
43
+ * wanting AND-all-required semantics must apply that filter
44
+ * post-hoc by inspecting individual assessments.
45
+ */
46
+ frameworks?: string[];
47
+ }
48
+ /**
49
+ * Response shape returned by `check.run`. Source-of-truth at kernel
50
+ * `src/app/api/v1/check/route.ts:109-116` (the route's only
51
+ * `successResponse({...})` call). FLAT — no `systems[]` wrapper
52
+ * (unlike `complianceCheck.check`'s `{systems, checkedAt}` shape).
53
+ *
54
+ * Synthesized at handler-time, NOT a Drizzle row. The kernel
55
+ * iterates assessments + attestations for the system and emits
56
+ * these 6 fields inline. The drift pin in `sdk-drift.test.ts` reads
57
+ * the route source and asserts the literal property names match this
58
+ * interface.
59
+ */
60
+ export interface CheckResponse {
61
+ /**
62
+ * **Stricter-than-compliance-check threshold**: the kernel
63
+ * computes `activeAttestations.length > 0 && overallScore >= 70
64
+ * && issues.length === 0` against its internal filtered DB
65
+ * arrays (route.ts:107), then emits the count as
66
+ * `response.activeAttestations` and the score as
67
+ * `response.score`. From the consumer's perspective this is
68
+ * equivalent to `response.activeAttestations > 0 &&
69
+ * response.score >= 70 && response.issues.length === 0` (three
70
+ * conjuncts). The transcription difference is cosmetic — the
71
+ * `activeAttestations` array's `.length` IS what gets emitted as
72
+ * the response field.
73
+ *
74
+ * Because `score` defaults to 0 (NOT null) when no completed
75
+ * assessment exists, a system with no completed assessment AND
76
+ * active attestations still has `compliant: false` here —
77
+ * different from `complianceCheck.check` which treated null-score
78
+ * as "not failing". Consumers wanting different semantics should
79
+ * inspect `score`, `lastAssessedAt`, and `activeAttestations`
80
+ * directly.
81
+ */
82
+ compliant: boolean;
83
+ /**
84
+ * Overall score from the latest completed assessment's
85
+ * `scores.overallScore` jsonb field, IF that field is a `number`.
86
+ *
87
+ * **DEFAULTS TO 0 — NOT NULL** (route.ts:84 — `typeof
88
+ * scores?.overallScore === "number" ? scores.overallScore : 0`).
89
+ * Consumers CANNOT distinguish "scored zero / fails compliance"
90
+ * from "no completed assessment yet" via `score` alone — they
91
+ * MUST check `lastAssessedAt === null` to differentiate.
92
+ *
93
+ * **Asymmetric with `complianceCheck.check`** which used `null`
94
+ * for "no data" (preserving the distinction). Kernel surface gap;
95
+ * the SDK does NOT mask (faithful courier).
96
+ *
97
+ * Range is unbounded — kernel does not clamp 0..100.
98
+ */
99
+ score: number;
100
+ /**
101
+ * Up to 20 issue strings derived from
102
+ * `latestCompleted.gaps[].title ?? gap.description ?? "Compliance
103
+ * gap detected"` (route.ts:90-93).
104
+ *
105
+ * **SILENTLY TRUNCATED at 20** (`.slice(0, 20)` at route.ts:90).
106
+ * If the latest completed assessment has >20 gaps, the 21st+ are
107
+ * invisible — no `total` field, no `hasMore` cursor, no
108
+ * truncation indicator. Faithful courier; documented in JSDoc +
109
+ * README. New invariant candidate #50 (multi-silent-truncation
110
+ * enumeration).
111
+ *
112
+ * Each string is the gap's `title` (falling back to `description`,
113
+ * then to the literal `"Compliance gap detected"` if both are
114
+ * missing).
115
+ */
116
+ issues: string[];
117
+ /**
118
+ * Count of currently-active attestation rows — defined as
119
+ * `attestations.status === "active"` AND
120
+ * (`attestations.expiresAt === null` OR `attestations.expiresAt
121
+ * > now`). Non-negative integer.
122
+ *
123
+ * **SILENTLY CAPPED AT 50 ROWS-CONSIDERED** — the kernel reads up
124
+ * to 50 attestations (`.limit(50)` at route.ts:100) and counts
125
+ * active ones from that subset. A system with >50 attestations
126
+ * (rare but possible for long-lived production systems) may have
127
+ * an UNDERCOUNTED active total. Faithful courier; documented.
128
+ * Part of invariant candidate #50.
129
+ */
130
+ activeAttestations: number;
131
+ /**
132
+ * ISO-8601 from the latest completed assessment's `completedAt`,
133
+ * OR `null` if no completed assessment exists.
134
+ *
135
+ * **Use this field — NOT `score === 0` — to detect "no completed
136
+ * assessment yet"**. The kernel sorts completed assessments DESC
137
+ * by `completedAt` (in JS, not SQL) and takes the first; the
138
+ * pre-sort population is silently capped at 100 (see
139
+ * `assessments` silent-cap note below).
140
+ */
141
+ lastAssessedAt: string | null;
142
+ /**
143
+ * ISO-8601, server-generated at handler end via
144
+ * `new Date().toISOString()` (route.ts:115). Uniquely identifies
145
+ * this check's snapshot — consumers may use it as a freshness
146
+ * marker.
147
+ */
148
+ checkedAt: string;
149
+ }
150
+ /**
151
+ * `check` resource — sibling to `IncidentsResource`,
152
+ * `DecisionsResource`, `ChatResource`, `AuditLogResource`,
153
+ * `RegulatoryChangesResource`, `ComplianceCheckResource`. Today
154
+ * wraps a single endpoint (`run`); the class is the landing pad for
155
+ * future check methods if the kernel adds them
156
+ * (resource-class-per-kernel-resource convention, invariant #43).
157
+ */
158
+ export declare class CheckResource {
159
+ private readonly client;
160
+ constructor(client: AttestryClient);
161
+ /**
162
+ * Run a CI/CD compliance check for a single system. Returns a flat
163
+ * 6-field summary: `{compliant, score, issues, activeAttestations,
164
+ * lastAssessedAt, checkedAt}`. Sync JSON request/response — no
165
+ * pagination, no streaming.
166
+ *
167
+ * **Multi-permission UNION auth scope**: kernel uses
168
+ * `requireApiKeyWithPermission(req, READ_ASSESSMENTS, READ_SYSTEMS)`
169
+ * which is OR semantics (`Array.some()` at
170
+ * `permissions.ts:53-55`). A key with EITHER permission (or
171
+ * `ADMIN`, or null/empty permissions for backwards-compat)
172
+ * succeeds. **HTTP 401** for no/invalid API key, **HTTP 403** for
173
+ * an authenticated key that has NEITHER required permission. Pin
174
+ * BOTH branches separately. Carry-forward invariant #45 (same
175
+ * shape as `complianceCheck.check`).
176
+ *
177
+ * **Asymmetric cross-org error code** (carry-forward #47, partial):
178
+ * cross-org `systemId` returns **404** — the kernel's
179
+ * `and(eq id, eq orgId)` at route.ts:42-51 collapses
180
+ * cross-org to "System not found" (mirror of
181
+ * `decisions.retrieve`). Consumers writing defensive error-handling
182
+ * logic must recognize: a 404 may be "not your org" OR "genuine
183
+ * missing UUID". No 403-via-orgName twin here (no orgName input
184
+ * mode).
185
+ *
186
+ * **THREE silent kernel-side truncations** (faithful courier;
187
+ * documented as kernel surface gaps — JSDoc + README + drift
188
+ * pinned). New invariant candidate #50:
189
+ * 1. `issues` — `.slice(0, 20)` at route.ts:90. If the latest
190
+ * completed assessment has >20 gaps, the 21st+ are invisible.
191
+ * 2. `assessments` row-population — `.limit(100)` at route.ts:62.
192
+ * If the system has >100 assessments, the kernel's JS-side
193
+ * `.sort()` operates on the first 100 only; the "latest
194
+ * completed" may be missed.
195
+ * 3. `attestations` row-population — `.limit(50)` at
196
+ * route.ts:100. If the system has >50 attestation rows,
197
+ * `activeAttestations` may be undercounted.
198
+ *
199
+ * **`score` defaults to 0 (NOT null) — kernel surface gap**:
200
+ * route.ts:84 — `typeof scores?.overallScore === "number" ?
201
+ * scores.overallScore : 0`. Consumers MUST check `lastAssessedAt
202
+ * === null` to distinguish "no completed assessment yet" from
203
+ * "scored zero / fails compliance". Asymmetric with
204
+ * `complianceCheck.check`'s null-on-no-data.
205
+ *
206
+ * **`frameworks` filter is OR-overlap, NOT AND-all-required** —
207
+ * route.ts:67-71 uses `aFrameworks.some((fw) =>
208
+ * body.frameworks!.some(...))`. An assessment matches if its
209
+ * `frameworks` array intersects the filter (at least one in
210
+ * common), not if it covers ALL of them. Consumers wanting AND
211
+ * semantics must filter post-hoc.
212
+ *
213
+ * Errors — ordered by kernel firing precedence (rate-limit → auth
214
+ * → Zod body validation → DB lookup → internal). A request with
215
+ * multiple problems surfaces ONLY the highest-precedence one. For
216
+ * example: a request with bad auth AND a malformed body surfaces
217
+ * 401, not 422; a request with valid auth + bad body AND a cross-
218
+ * org systemId surfaces 422, not 404.
219
+ * - `AttestryAPIError` (status 429) — rate limit FIRES FIRST
220
+ * (auto-retried by default — invariant #18; per-IP rate-limit
221
+ * key `v1-check:${ip}`).
222
+ * - `AttestryAPIError` (status 401) — no API key OR invalid key.
223
+ * Fires AFTER rate-limit but BEFORE input validation.
224
+ * - `AttestryAPIError` (status 403) — authenticated key has
225
+ * NEITHER `READ_ASSESSMENTS` nor `READ_SYSTEMS` (the
226
+ * permission-check branch). Single test case — the union-auth
227
+ * pattern collapses three intuition-suggesting cases to one.
228
+ * - `AttestryAPIError` (status 422) — Zod schema rejection
229
+ * (kernel's `BodyParseError` surface — `parseBody(request,
230
+ * checkSchema)` failed). **Fires BEFORE the systemId/cross-
231
+ * org 404 lookup**, so a request with bad UUID format AND
232
+ * cross-org-correct UUID surfaces 422 (the kernel's Zod
233
+ * `.uuid()` reject), not 404. `apiErr.details` carries the
234
+ * full kernel error body verbatim (the transport does NOT
235
+ * strip the `{success:false, ...}` envelope on error responses
236
+ * — only the `{success:true, data}` envelope on success). The
237
+ * wire shape is: `{success: false, error: "Validation failed.",
238
+ * details: Array<{path: string; message: string}>}` — `error`
239
+ * is the literal string
240
+ * "Validation failed." (with trailing period), `details` is
241
+ * an array (NOT a keyed map) of `{path, message}` pairs
242
+ * derived from Zod's `result.error.errors`. Consumers
243
+ * reading field-by-field errors should iterate
244
+ * `apiErr.details.details` (the kernel's `details` array
245
+ * nested under the SDK's parsed-body wrapper). **The SDK
246
+ * pre-validates all closed-spec rules** (UUID format,
247
+ * framework element length 1-100, array length ≤20) AND the
248
+ * runtime checks always run regardless of TypeScript types —
249
+ * `as any` casts do NOT bypass them. So 422 reaches consumers
250
+ * ONLY via kernel rule changes the SDK hasn't synced to (e.g.,
251
+ * a future kernel tightening that adds a new Zod rule the SDK
252
+ * hasn't yet learned to pre-validate). New invariant candidate
253
+ * #51.
254
+ * - `AttestryAPIError` (status 404) — system not found OR
255
+ * cross-org systemId (kernel collapses to "System not found",
256
+ * route.ts:53-54). Fires AFTER Zod validation (422).
257
+ * - `AttestryAPIError` (status 500) — internal kernel error
258
+ * (scrubbed message via `internalErrorResponse`).
259
+ * - `AttestryError` ("request aborted by caller") — caller-
260
+ * supplied `options.signal` fired (pre-aborted or mid-flight).
261
+ * - `AttestryError` (P2 hardening) — kernel response failed
262
+ * SDK-side shape validation (not an object, wrong type on any
263
+ * of the 6 documented fields).
264
+ * - `AttestryAPIError` (P3 hardening) — kernel response had a
265
+ * wrong Content-Type (transport-level guard before body
266
+ * parsing).
267
+ * - `TypeError` (synchronous, no fetch issued) — input failed
268
+ * SDK-side validation (null / array / non-object input,
269
+ * missing systemId, invalid UUID format, frameworks array too
270
+ * long, frameworks element wrong type or length).
271
+ *
272
+ * **Notably ABSENT**:
273
+ * - **No 400** — all input validation is Zod (422). The "missing
274
+ * required field" 400 from compliance-check is irrelevant
275
+ * (single required field; SDK pre-rejects as TypeError).
276
+ * - **No 413** — body size limit not explicit; the kernel's
277
+ * `parseBody` may have one but it isn't documented and the
278
+ * SDK doesn't pin it.
279
+ * - **No 402** — read-only, doesn't count against
280
+ * decisionsPerMonth quota.
281
+ *
282
+ * **SDK-side validation** (synchronous `TypeError`, no fetch
283
+ * issued):
284
+ * - `input` itself: required; must be a non-null, non-array
285
+ * object.
286
+ * - `input.systemId`: required own-property (Object.hasOwn
287
+ * defends against prototype pollution lying about presence —
288
+ * generalization of invariant #48); must be a non-empty
289
+ * string; must match the RFC 4122 hyphenated UUID format
290
+ * (D2 — SDK pre-validates closed-spec rule). No
291
+ * lone-surrogate URIError defense (D4 — POST body uses
292
+ * JSON.stringify, not encodeURIComponent).
293
+ * - `input.frameworks` (when provided): must be an array of
294
+ * ≤20 strings, each of length 1-100. SDK pre-validates each
295
+ * rule (D3 — closed-spec rules mirror Zod). Array is
296
+ * snapshotted via `Array.from` for TOCTOU defense (Proxy /
297
+ * getter inputs can't yield different values across
298
+ * validate-vs-send).
299
+ *
300
+ * **Response-shape validation** (P2 hardening — D6, stricter than
301
+ * `complianceCheck.check`'s 3-field top-level):
302
+ * - Rejects with `AttestryError` if the kernel response isn't a
303
+ * non-null, non-array object.
304
+ * - Rejects if `compliant` isn't a boolean.
305
+ * - Rejects if `score` isn't a number.
306
+ * - Rejects if `issues` isn't an array.
307
+ * - Rejects if `activeAttestations` isn't a number.
308
+ * - Rejects if `lastAssessedAt` isn't a string OR null.
309
+ * - Rejects if `checkedAt` isn't a string.
310
+ * - Each response field read goes through the module-load
311
+ * `objectHasOwn` snapshot (symmetric to the input-side
312
+ * prototype-pollution defense — D5 generalized to the response
313
+ * boundary). A hostile npm dep that pollutes
314
+ * `Object.prototype.<field>` cannot mask a kernel regression
315
+ * where the field is missing — the SDK requires the field to
316
+ * be a kernel-emitted own property.
317
+ * - Per-issue-string shape (open string) is faithful-courier —
318
+ * NOT validated.
319
+ *
320
+ * **Transport-shape validation** (P3 hardening):
321
+ * - Rejects with `AttestryAPIError` if the kernel responds with
322
+ * a non-`application/json` Content-Type.
323
+ *
324
+ * @example Basic check
325
+ * ```ts
326
+ * const result = await client.check.run({
327
+ * systemId: "11111111-1111-1111-1111-111111111111",
328
+ * });
329
+ * if (result.compliant) {
330
+ * console.log("OK to deploy — score:", result.score);
331
+ * } else if (result.lastAssessedAt === null) {
332
+ * console.warn("No completed assessment yet — score=0 is the default, not a failing grade");
333
+ * } else {
334
+ * console.warn("Compliance gaps:", result.issues);
335
+ * }
336
+ * ```
337
+ *
338
+ * @example Filtered by frameworks (OR-overlap)
339
+ * ```ts
340
+ * const euOnly = await client.check.run({
341
+ * systemId: "11111111-1111-1111-1111-111111111111",
342
+ * frameworks: ["EU_AI_ACT", "ISO_42001"],
343
+ * });
344
+ * ```
345
+ */
346
+ run(input: CheckInput, options?: RequestOptions): Promise<CheckResponse>;
347
+ }
348
+ //# sourceMappingURL=check.d.ts.map