akribes 0.21.17

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 (100) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/LICENSE +21 -0
  3. package/README.md +160 -0
  4. package/dist/client.d.ts +240 -0
  5. package/dist/client.d.ts.map +1 -0
  6. package/dist/client.js +272 -0
  7. package/dist/client.js.map +1 -0
  8. package/dist/errors.d.ts +196 -0
  9. package/dist/errors.d.ts.map +1 -0
  10. package/dist/errors.js +274 -0
  11. package/dist/errors.js.map +1 -0
  12. package/dist/execution/index.d.ts +3 -0
  13. package/dist/execution/index.d.ts.map +1 -0
  14. package/dist/execution/index.js +3 -0
  15. package/dist/execution/index.js.map +1 -0
  16. package/dist/execution/replay.d.ts +37 -0
  17. package/dist/execution/replay.d.ts.map +1 -0
  18. package/dist/execution/replay.js +59 -0
  19. package/dist/execution/replay.js.map +1 -0
  20. package/dist/execution/steps.d.ts +327 -0
  21. package/dist/execution/steps.d.ts.map +1 -0
  22. package/dist/execution/steps.js +1068 -0
  23. package/dist/execution/steps.js.map +1 -0
  24. package/dist/http.d.ts +53 -0
  25. package/dist/http.d.ts.map +1 -0
  26. package/dist/http.js +141 -0
  27. package/dist/http.js.map +1 -0
  28. package/dist/index.d.ts +36 -0
  29. package/dist/index.d.ts.map +1 -0
  30. package/dist/index.js +38 -0
  31. package/dist/index.js.map +1 -0
  32. package/dist/runStream.d.ts +176 -0
  33. package/dist/runStream.d.ts.map +1 -0
  34. package/dist/runStream.js +408 -0
  35. package/dist/runStream.js.map +1 -0
  36. package/dist/sse.d.ts +46 -0
  37. package/dist/sse.d.ts.map +1 -0
  38. package/dist/sse.js +218 -0
  39. package/dist/sse.js.map +1 -0
  40. package/dist/sub/bench.d.ts +182 -0
  41. package/dist/sub/bench.d.ts.map +1 -0
  42. package/dist/sub/bench.js +420 -0
  43. package/dist/sub/bench.js.map +1 -0
  44. package/dist/sub/channels.d.ts +22 -0
  45. package/dist/sub/channels.d.ts.map +1 -0
  46. package/dist/sub/channels.js +32 -0
  47. package/dist/sub/channels.js.map +1 -0
  48. package/dist/sub/clients.d.ts +79 -0
  49. package/dist/sub/clients.d.ts.map +1 -0
  50. package/dist/sub/clients.js +190 -0
  51. package/dist/sub/clients.js.map +1 -0
  52. package/dist/sub/documents.d.ts +113 -0
  53. package/dist/sub/documents.d.ts.map +1 -0
  54. package/dist/sub/documents.js +329 -0
  55. package/dist/sub/documents.js.map +1 -0
  56. package/dist/sub/evals.d.ts +71 -0
  57. package/dist/sub/evals.d.ts.map +1 -0
  58. package/dist/sub/evals.js +86 -0
  59. package/dist/sub/evals.js.map +1 -0
  60. package/dist/sub/events.d.ts +65 -0
  61. package/dist/sub/events.d.ts.map +1 -0
  62. package/dist/sub/events.js +154 -0
  63. package/dist/sub/events.js.map +1 -0
  64. package/dist/sub/executions.d.ts +255 -0
  65. package/dist/sub/executions.d.ts.map +1 -0
  66. package/dist/sub/executions.js +322 -0
  67. package/dist/sub/executions.js.map +1 -0
  68. package/dist/sub/mcp.d.ts +51 -0
  69. package/dist/sub/mcp.d.ts.map +1 -0
  70. package/dist/sub/mcp.js +42 -0
  71. package/dist/sub/mcp.js.map +1 -0
  72. package/dist/sub/projects.d.ts +73 -0
  73. package/dist/sub/projects.d.ts.map +1 -0
  74. package/dist/sub/projects.js +101 -0
  75. package/dist/sub/projects.js.map +1 -0
  76. package/dist/sub/scripts.d.ts +58 -0
  77. package/dist/sub/scripts.d.ts.map +1 -0
  78. package/dist/sub/scripts.js +82 -0
  79. package/dist/sub/scripts.js.map +1 -0
  80. package/dist/sub/tokens.d.ts +126 -0
  81. package/dist/sub/tokens.d.ts.map +1 -0
  82. package/dist/sub/tokens.js +105 -0
  83. package/dist/sub/tokens.js.map +1 -0
  84. package/dist/sub/versions.d.ts +29 -0
  85. package/dist/sub/versions.d.ts.map +1 -0
  86. package/dist/sub/versions.js +52 -0
  87. package/dist/sub/versions.js.map +1 -0
  88. package/dist/tokenSafety.d.ts +15 -0
  89. package/dist/tokenSafety.d.ts.map +1 -0
  90. package/dist/tokenSafety.js +24 -0
  91. package/dist/tokenSafety.js.map +1 -0
  92. package/dist/types.d.ts +1147 -0
  93. package/dist/types.d.ts.map +1 -0
  94. package/dist/types.js +132 -0
  95. package/dist/types.js.map +1 -0
  96. package/dist/workflowEvents.d.ts +297 -0
  97. package/dist/workflowEvents.d.ts.map +1 -0
  98. package/dist/workflowEvents.js +612 -0
  99. package/dist/workflowEvents.js.map +1 -0
  100. package/package.json +57 -0
package/dist/client.js ADDED
@@ -0,0 +1,272 @@
1
+ import { HttpClient } from './http';
2
+ import { ProjectsClient } from './sub/projects';
3
+ import { ScriptsClient } from './sub/scripts';
4
+ import { VersionsClient } from './sub/versions';
5
+ import { ChannelsClient } from './sub/channels';
6
+ import { ExecutionsClient } from './sub/executions';
7
+ import { DEFAULT_INGEST_POLL_TIMEOUT_MS, DocumentsClient, ingestPollTimeoutMsFromEnv, } from './sub/documents';
8
+ import { ClientsClient } from './sub/clients';
9
+ import { TokensClient } from './sub/tokens';
10
+ import { EventsClient } from './sub/events';
11
+ import { EvalsClient } from './sub/evals';
12
+ import { BenchClient } from './sub/bench';
13
+ import { McpClient } from './sub/mcp';
14
+ import { AkribesError } from './errors';
15
+ import { connectSse } from './sse';
16
+ /**
17
+ * Akribes client.
18
+ *
19
+ * **Auth quickstart**:
20
+ *
21
+ * ```ts
22
+ * // Backend → talk to akribes-server with your service token
23
+ * const akribes = new AkribesClient({
24
+ * baseUrl: 'https://akribes.example.com',
25
+ * token: process.env.AKRIBES_SERVICE_TOKEN!, // <scope>:<secret>'s secret part
26
+ * onBehalfOf: 'customer@acme.com', // optional, for metrics
27
+ * projectId: 2,
28
+ * });
29
+ *
30
+ * // Browser → use a scoped token your backend minted via akribes.tokens.mint()
31
+ * const akribes = new AkribesClient({
32
+ * baseUrl: 'https://akribes.example.com',
33
+ * token: 'akribes_tk_xxxx', // expires, revokable
34
+ * projectId: 2,
35
+ * });
36
+ * ```
37
+ *
38
+ * See {@link TokensClient} for minting/listing/revoking scoped tokens.
39
+ */
40
+ export class AkribesClient {
41
+ options;
42
+ http;
43
+ token;
44
+ _projectId;
45
+ _projects;
46
+ _scripts;
47
+ _versions;
48
+ _channels;
49
+ _executions;
50
+ _documents;
51
+ _clients;
52
+ _tokens;
53
+ _events;
54
+ _evals;
55
+ _bench;
56
+ _mcp;
57
+ _state;
58
+ _adHocDisposers = new Set();
59
+ constructor(options) {
60
+ this.options = options;
61
+ this.token = options.token;
62
+ this._projectId = options.projectId;
63
+ const baseUrl = options.baseUrl.replace(/\/$/, '');
64
+ this.http = new HttpClient(baseUrl, () => this.token, options.onBehalfOf, options.propagator);
65
+ this._projects = new ProjectsClient(this.http);
66
+ this._state = new StateClient(this.http);
67
+ this._tokens = new TokensClient(this.http);
68
+ // Hub events live above the project scope — a client without a
69
+ // `projectId` still subscribes to the global stream (used by Studio's
70
+ // top-level editor, which surfaces events across the user's projects).
71
+ this._events = new EventsClient(this.http, options.projectId, () => this.token);
72
+ if (options.projectId != null) {
73
+ this.initProjectScoped(options.projectId);
74
+ }
75
+ }
76
+ initProjectScoped(projectId) {
77
+ this._scripts = new ScriptsClient(this.http, projectId);
78
+ this._versions = new VersionsClient(this.http, projectId, this.options.name);
79
+ this._channels = new ChannelsClient(this.http, projectId);
80
+ this._clients = new ClientsClient(this.http, projectId, this.options.id, this.options.name, { onHeartbeatStatus: this.options.onHeartbeatStatus });
81
+ // Wire the project-scoped contract state into the already-constructed
82
+ // events client so `onScriptSchemaChange` flips the broken flag for
83
+ // `validateContract`. Safe to mutate post-init — `_events` only reads
84
+ // `contractState` from inside subscription callbacks fired later.
85
+ this._events.setContractState(this._clients.contractState);
86
+ this._executions = new ExecutionsClient(this.http, projectId, this.options.name, this._clients.contractState, () => this._events);
87
+ this._documents = new DocumentsClient(this.http, projectId, this.options.ingestPollTimeoutMs
88
+ ?? ingestPollTimeoutMsFromEnv()
89
+ ?? DEFAULT_INGEST_POLL_TIMEOUT_MS);
90
+ this._evals = new EvalsClient(this.http, projectId);
91
+ this._bench = new BenchClient(this.http, projectId);
92
+ this._mcp = new McpClient(this.http, projectId);
93
+ }
94
+ requireProjectScoped(client, name) {
95
+ if (!client)
96
+ throw new AkribesError(`projectId is required for ${name} operations. Pass projectId to AkribesClient constructor.`);
97
+ return client;
98
+ }
99
+ get projects() { return this._projects; }
100
+ get scripts() { return this.requireProjectScoped(this._scripts, 'scripts'); }
101
+ get versions() { return this.requireProjectScoped(this._versions, 'versions'); }
102
+ get channels() { return this.requireProjectScoped(this._channels, 'channels'); }
103
+ get executions() { return this.requireProjectScoped(this._executions, 'executions'); }
104
+ get documents() { return this.requireProjectScoped(this._documents, 'documents'); }
105
+ get clients() { return this.requireProjectScoped(this._clients, 'clients'); }
106
+ get tokens() { return this._tokens; }
107
+ /** Hub event subscriptions. Always available — non-project-scoped clients
108
+ * receive the global stream (filtered to what the token can see). */
109
+ get events() { return this._events; }
110
+ get evals() { return this.requireProjectScoped(this._evals, 'evals'); }
111
+ get bench() { return this.requireProjectScoped(this._bench, 'bench'); }
112
+ get mcp() { return this.requireProjectScoped(this._mcp, 'mcp'); }
113
+ get state() { return this._state; }
114
+ /**
115
+ * @deprecated Prefer `client.documents.ingest(filename, bytes, opts)`, which
116
+ * hash-first-dedups against the server's blob cache and supports progress
117
+ * callbacks. The legacy `/convert` endpoint remains functional for now.
118
+ *
119
+ * Convert a document file to Markdown via Docling.
120
+ *
121
+ * When the client is constructed with a `projectId`, the persisted document
122
+ * is owned by that project and the returned `document_id` can be passed back
123
+ * as a document input on subsequent runs to skip re-upload + reconversion.
124
+ * Without a `projectId`, the document (if S3-persisted) has no project owner
125
+ * and can only be accessed by service tokens. */
126
+ async convert(file, opts) {
127
+ const form = new FormData();
128
+ form.append('file', file);
129
+ const path = this._projectId != null
130
+ ? `/projects/${this._projectId}/convert`
131
+ : '/convert';
132
+ return (await this.http.fetchOk(`${this.http.getBaseUrl()}${path}`, { method: 'POST', body: form, signal: opts?.signal })).json();
133
+ }
134
+ /** Fetch the caller's per-user sandbox project id (creates one on the
135
+ * server if missing). Use this to subscribe to ad-hoc events *before*
136
+ * calling `runAdHoc()` so the first engine events aren't missed. */
137
+ async getSandboxProjectId(opts) {
138
+ const res = await this.http.fetchOk(`${this.http.getBaseUrl()}/me/sandbox`, opts);
139
+ const body = await res.json();
140
+ return body.project_id;
141
+ }
142
+ /** Execute raw .akr source ad-hoc. Server runs it in the caller's
143
+ * per-user sandbox project and returns the execution_id + project_id.
144
+ *
145
+ * `channel` and `triggeredBy` (#1120) match the Python SDK's `run_adhoc`
146
+ * parameters: `channel` selects the published-version channel to resolve
147
+ * `use foo` references against (default: server's default channel);
148
+ * `triggeredBy` is an opaque identifier recorded with the execution. */
149
+ async runAdHoc(source, opts) {
150
+ const body = { source };
151
+ if (opts?.inputs !== undefined)
152
+ body.inputs = opts.inputs;
153
+ if (opts?.breakpointLines !== undefined)
154
+ body.breakpoint_lines = opts.breakpointLines;
155
+ if (opts?.channel !== undefined)
156
+ body.channel = opts.channel;
157
+ if (opts?.triggeredBy !== undefined)
158
+ body.triggered_by = opts.triggeredBy;
159
+ return (await this.http.fetchOk(`${this.http.getBaseUrl()}/execute`, {
160
+ method: 'POST',
161
+ headers: { 'Content-Type': 'application/json' },
162
+ body: JSON.stringify(body),
163
+ signal: opts?.signal,
164
+ })).json();
165
+ }
166
+ /** Stream events from ad-hoc executions in the given sandbox project.
167
+ *
168
+ * Pass the `project_id` returned from `runAdHoc()` (or
169
+ * `getSandboxProjectId()`). Returns an unsubscribe function.
170
+ *
171
+ * **Avoiding the subscribe-after-POST race.** A fast workflow
172
+ * (single-digit-millisecond mock providers) can emit `NodeStart`,
173
+ * `TaskStart`, … before a naive `runAdHoc().then(onAdHocExecution)` has
174
+ * the SSE subscriber attached on the server side, dropping those opening
175
+ * events on the broadcast channel. To eliminate the race, pass an
176
+ * `opts.onReady` callback — it fires once the SSE `GET /events` response
177
+ * is open (status 2xx) — and only POST `/execute` after it resolves:
178
+ *
179
+ * ```ts
180
+ * const projectId = await client.getSandboxProjectId();
181
+ * const ready = Promise.withResolvers<void>();
182
+ * const unsubscribe = client.onAdHocExecution(
183
+ * projectId,
184
+ * (ev) => { ... },
185
+ * { onReady: () => ready.resolve() },
186
+ * );
187
+ * await ready.promise; // SSE attached, safe to POST
188
+ * await client.runAdHoc(source);
189
+ * ```
190
+ *
191
+ * `onReady` is invoked at most once per call (transparent reconnects do
192
+ * not re-fire it). If the connection never establishes — bad token, wrong
193
+ * URL, server down — `onReady` is never called; pair the `await` with a
194
+ * timeout so a misconfigured callsite fails fast instead of hanging.
195
+ */
196
+ onAdHocExecution(projectId, callback, opts) {
197
+ // Token rides on the Authorization header (see connectSse below) so
198
+ // service-token secrets don't end up in reverse-proxy access logs or
199
+ // OTel `http.url` span attributes. sse.ts skips EventSource when
200
+ // an Authorization header is set and uses the fetch-fallback path.
201
+ const buildUrl = () => {
202
+ const url = new URL(`${this.http.getBaseUrl()}/events`);
203
+ url.searchParams.set('project_id', String(projectId));
204
+ url.searchParams.set('script_name', 'adhoc');
205
+ return url.toString();
206
+ };
207
+ let readyFired = false;
208
+ const fireReady = () => {
209
+ if (readyFired)
210
+ return;
211
+ readyFired = true;
212
+ try {
213
+ opts?.onReady?.();
214
+ }
215
+ catch { /* swallow caller errors */ }
216
+ };
217
+ const dispose = connectSse({
218
+ url: buildUrl,
219
+ headers: { ...this.http.authHeaders(), ...this.http.traceHeaders() },
220
+ onOpen: fireReady,
221
+ onMessage: (msg) => {
222
+ // Belt-and-braces: EventSource doesn't expose an onopen on every
223
+ // platform, but the first inbound message necessarily means the
224
+ // GET response is open. Fire ready here too so callers always
225
+ // receive it before the first `callback(...)` invocation.
226
+ fireReady();
227
+ if (msg.event !== 'batch' && msg.event !== '')
228
+ return;
229
+ try {
230
+ const batch = JSON.parse(msg.data);
231
+ for (const evt of batch) {
232
+ if (evt.type === 'Execution')
233
+ callback(evt.payload.event);
234
+ }
235
+ }
236
+ catch { /* malformed JSON, skip */ }
237
+ },
238
+ });
239
+ this._adHocDisposers.add(dispose);
240
+ return () => {
241
+ dispose();
242
+ this._adHocDisposers.delete(dispose);
243
+ };
244
+ }
245
+ /** Update the auth token at runtime (e.g. after refresh). */
246
+ setToken(token) {
247
+ this.token = token;
248
+ }
249
+ /** Update the X-Akribes-User header for metrics attribution. */
250
+ setOnBehalfOf(email) {
251
+ this.http.setOnBehalfOf(email);
252
+ }
253
+ /** Clean up heartbeat and SSE connections. */
254
+ destroy() {
255
+ this._clients?.destroy();
256
+ this._events.destroy();
257
+ for (const dispose of this._adHocDisposers)
258
+ dispose();
259
+ this._adHocDisposers.clear();
260
+ }
261
+ }
262
+ class StateClient {
263
+ http;
264
+ constructor(http) {
265
+ this.http = http;
266
+ }
267
+ async get(opts) {
268
+ return (await this.http.fetchOk(`${this.http.getBaseUrl()}/state`, opts)).json();
269
+ }
270
+ }
271
+ export { StateClient };
272
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAwB,MAAM,QAAQ,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EACL,8BAA8B,EAC9B,eAAe,EACf,0BAA0B,GAC3B,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,aAAa,EAAwB,MAAM,eAAe,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO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I,CAAC,IAAI,CAAC,UAAU,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC,IAAI,EAA8C,CAAC;IAC/H,CAAC;CACF;AAED,OAAO,EAAE,WAAW,EAAE,CAAC"}
@@ -0,0 +1,196 @@
1
+ /** Base error class for all Akribes SDK errors. */
2
+ export declare class AkribesError extends Error {
3
+ readonly name: string;
4
+ }
5
+ /** Structured HTTP error with status code and server message.
6
+ *
7
+ * `errorType` and `reason` are populated when the server returns a structured
8
+ * error body of the shape `{ error, error_type, reason, ... }` (currently
9
+ * used by the document conversion path). Callers that care about typed
10
+ * failures should branch on these instead of regex-matching `message`.
11
+ *
12
+ * As of #987, this is the abstract parent for typed HTTP-status subclasses
13
+ * (`AkribesAuthError`, `AkribesNotFoundError`, `AkribesRateLimitError`,
14
+ * `AkribesTransientHttpError`, `AkribesAlreadyExistsError`,
15
+ * `CaseTypeMismatchError`, `JudgeContractError`). `instanceof AkribesHttpError`
16
+ * still works as a catch-all for any non-2xx. */
17
+ export declare class AkribesHttpError extends AkribesError {
18
+ readonly status: number;
19
+ readonly body: string;
20
+ readonly serverMessage?: string | undefined;
21
+ readonly errorType?: string | undefined;
22
+ readonly reason?: string | undefined;
23
+ readonly name: string;
24
+ constructor(status: number, body: string, serverMessage?: string | undefined, errorType?: string | undefined, reason?: string | undefined);
25
+ }
26
+ /** Thrown on HTTP 401/403. Auth / authorization failure — do not retry; mint
27
+ * a fresh scoped token (or rotate the service-token secret) and try again. */
28
+ export declare class AkribesAuthError extends AkribesHttpError {
29
+ readonly name: string;
30
+ constructor(status: 401 | 403, body: string, serverMessage: string | undefined);
31
+ }
32
+ /** Thrown on HTTP 429. Carries `retryAfter` (parsed from the `Retry-After`
33
+ * header) in **seconds** when the server sent numeric-seconds form; `null`
34
+ * when the header is absent or in HTTP-date form (matching Python). */
35
+ export declare class AkribesRateLimitError extends AkribesHttpError {
36
+ readonly retryAfter: number | null;
37
+ readonly name: string;
38
+ constructor(body: string, serverMessage: string | undefined, retryAfter: number | null);
39
+ }
40
+ /** Recommended base backoff (in milliseconds) for a retriable HTTP status
41
+ * after #1296 split the umbrella `AkribesTransientHttpError` into one
42
+ * subclass per 5xx variant. Mirrors `ErrorKind::base_backoff_ms` on the
43
+ * Rust side so server + SDK retry cadences agree:
44
+ *
45
+ * - 500: maybe-transient origin error — start short (1s).
46
+ * - 502: edge fronted a failing origin — start short (1s).
47
+ * - 503: rate-limit-adjacent — honour `Retry-After`; default 2s.
48
+ * - 504: slow upstream — start longer (4s) before retrying.
49
+ * - 429: rate-limit — 2s default; honour `Retry-After` when present.
50
+ *
51
+ * Returned in milliseconds; callers convert to seconds with `/ 1000`.
52
+ * Returns `null` for non-transient statuses. */
53
+ export declare function recommendedBackoffMs(status: number): number | null;
54
+ /** Thrown on HTTP 500/502/503/504. Retriable server-side failure (#1296
55
+ * splits this into status-specific subclasses below). `retryAfter` (in
56
+ * seconds) is populated when the server sent a numeric `Retry-After`.
57
+ * Use `instanceof AkribesTransientHttpError` for the umbrella check, or
58
+ * branch on the specific subclass (`AkribesServerError500`,
59
+ * `AkribesBadGatewayError502`, `AkribesServiceUnavailableError503`,
60
+ * `AkribesGatewayTimeoutError504`) for per-status retry cadence. */
61
+ export declare class AkribesTransientHttpError extends AkribesHttpError {
62
+ readonly retryAfter: number | null;
63
+ readonly name: string;
64
+ constructor(status: 500 | 502 | 503 | 504, body: string, serverMessage: string | undefined, retryAfter: number | null);
65
+ /** Recommended base backoff in milliseconds for this transient status
66
+ * (#1296). Prefer `retryAfter * 1000` when the server sent the header;
67
+ * fall back to this when it didn't. */
68
+ recommendedBackoffMs(): number;
69
+ }
70
+ /** Thrown on HTTP 500 (internal server error). The origin reported a
71
+ * generic failure; retry with a short exponential backoff. (#1296) */
72
+ export declare class AkribesServerError500 extends AkribesTransientHttpError {
73
+ readonly name: string;
74
+ constructor(body: string, serverMessage: string | undefined, retryAfter: number | null);
75
+ }
76
+ /** Thrown on HTTP 502 (bad gateway). The provider's edge fronted a
77
+ * failing origin; retry with a short backoff. (#1296) */
78
+ export declare class AkribesBadGatewayError502 extends AkribesTransientHttpError {
79
+ readonly name: string;
80
+ constructor(body: string, serverMessage: string | undefined, retryAfter: number | null);
81
+ }
82
+ /** Thrown on HTTP 503 (service unavailable). Rate-limit-adjacent; honour
83
+ * `Retry-After` aggressively, otherwise back off at the rate-limit
84
+ * cadence. (#1296) */
85
+ export declare class AkribesServiceUnavailableError503 extends AkribesTransientHttpError {
86
+ readonly name: string;
87
+ constructor(body: string, serverMessage: string | undefined, retryAfter: number | null);
88
+ }
89
+ /** Thrown on HTTP 504 (gateway timeout). The upstream is slow or stuck;
90
+ * start with a longer base backoff than for 500/502. (#1296) */
91
+ export declare class AkribesGatewayTimeoutError504 extends AkribesTransientHttpError {
92
+ readonly name: string;
93
+ constructor(body: string, serverMessage: string | undefined, retryAfter: number | null);
94
+ }
95
+ /** Parse a `Retry-After` header value into a numeric **seconds** value.
96
+ * Returns `null` for missing, empty, or HTTP-date values (matching the
97
+ * Python SDK's `_parse_retry_after`). Exported for tests + reuse. */
98
+ export declare function parseRetryAfter(headerValue: string | null | undefined): number | null;
99
+ /** Thrown when the server returns 409 with `error_type: "suite_already_exists"`
100
+ * (or any other future "this resource already exists" condition). The
101
+ * `existingId` field carries the conflicting row's id so callers can
102
+ * redirect the operator to it. */
103
+ export declare class AkribesAlreadyExistsError extends AkribesHttpError {
104
+ readonly existingId: number;
105
+ readonly name: string;
106
+ constructor(status: number, body: string, serverMessage: string | undefined, existingId: number);
107
+ }
108
+ export declare class AkribesTransientError extends AkribesError {
109
+ executionId?: string | undefined;
110
+ readonly name = "AkribesTransientError";
111
+ constructor(message: string, executionId?: string | undefined);
112
+ }
113
+ export declare class AkribesFatalError extends AkribesError {
114
+ executionId?: string | undefined;
115
+ readonly name = "AkribesFatalError";
116
+ constructor(message: string, executionId?: string | undefined);
117
+ }
118
+ export declare class AkribesScriptError extends AkribesError {
119
+ executionId?: string | undefined;
120
+ readonly name = "AkribesScriptError";
121
+ constructor(message: string, executionId?: string | undefined);
122
+ }
123
+ /** Thrown by polling helpers (`waitFor` / `await`) when an execution does
124
+ * not reach a terminal state within the supplied timeout. Carries the
125
+ * execution id + elapsed budget so callers can route timeouts distinctly
126
+ * from script / transient failures. Mirrors Python's `AkribesTimeoutError`.
127
+ *
128
+ * The message still contains "timed out" verbatim for back-compat with
129
+ * pre-#109 callers that grep on it. */
130
+ export declare class AkribesTimeoutError extends AkribesError {
131
+ readonly executionId: string;
132
+ readonly timeoutMs: number;
133
+ readonly name = "AkribesTimeoutError";
134
+ constructor(message: string, executionId: string, timeoutMs: number);
135
+ }
136
+ /** Thrown when run() is called after a ScriptUpdated event with schema_changed=true. */
137
+ export declare class ScriptSchemaChangedError extends AkribesError {
138
+ scriptName: string;
139
+ readonly name = "ScriptSchemaChangedError";
140
+ constructor(scriptName: string);
141
+ }
142
+ /** One entry in the server's `input_validation_failed` payload. */
143
+ export type InputValidationErrorEntry = {
144
+ /** Dotted / bracketed path to the offending field: "payload.b", "items[2].qty". */
145
+ input: string;
146
+ code: 'missing' | 'wrong_type' | 'unknown_field' | 'unknown_input' | 'disallowed_type';
147
+ expected?: string;
148
+ got?: string;
149
+ };
150
+ /** Parse a 400 `input_validation_failed` body off an AkribesHttpError.
151
+ * Returns null when the error is something else or the body doesn't match. */
152
+ export declare function tryParseInputValidationErrors(err: unknown): InputValidationErrorEntry[] | null;
153
+ /** Thrown when run() is called with document keys that don't match the cached schema. */
154
+ export declare class ScriptInputMismatchError extends AkribesError {
155
+ scriptName: string;
156
+ missing: string[];
157
+ extra: string[];
158
+ readonly name = "ScriptInputMismatchError";
159
+ constructor(scriptName: string, missing: string[], extra: string[]);
160
+ }
161
+ /** Thrown when the server returns 404 with a structured `{"error": ...}`
162
+ * body. Carries the parsed `error` message so callers can distinguish
163
+ * "no bench configured" from "bench run not found" without regex-matching
164
+ * `message`. Status is always 404. */
165
+ export declare class AkribesNotFoundError extends AkribesHttpError {
166
+ readonly name = "AkribesNotFoundError";
167
+ constructor(body: string, serverMessage: string | undefined);
168
+ }
169
+ /** One entry in a `case_type_mismatch` 400 response's `field_errors` array.
170
+ * Mirrors `akribes_core::contracts::TypeMismatch`. The `path` uses the
171
+ * same dotted/bracketed convention as Studio's `ObjectInputForm`
172
+ * `errorsByPath` so a form layer can highlight the offending leaf inline. */
173
+ export type CaseFieldError = {
174
+ path: string;
175
+ message: string;
176
+ };
177
+ /** Thrown by case-create / promote-execution when the server rejects the
178
+ * payload with structured per-field violations (HTTP 400 +
179
+ * `error: "case_type_mismatch"`). Callers in the form layer catch this
180
+ * and populate `errorsByPath` from {@link CaseTypeMismatchError.fieldErrors}. */
181
+ export declare class CaseTypeMismatchError extends AkribesHttpError {
182
+ readonly fieldErrors: CaseFieldError[];
183
+ readonly name = "CaseTypeMismatchError";
184
+ constructor(body: string, serverMessage: string | undefined, fieldErrors: CaseFieldError[]);
185
+ }
186
+ /** Thrown by `bench.triggerRun()` when the workflow's outputs are
187
+ * incompatible with the judge's `inputs.{expected,actual}` slots. The
188
+ * server returns 400 with a `Judge contract mismatch: ...` message; the
189
+ * SDK parses the trailing `N field(s) incompatible: ...` fragment into a
190
+ * `breaks` list when present, leaving it empty otherwise. */
191
+ export declare class JudgeContractError extends AkribesHttpError {
192
+ readonly breaks: string[];
193
+ readonly name = "JudgeContractError";
194
+ constructor(body: string, serverMessage: string | undefined, breaks: string[]);
195
+ }
196
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,mDAAmD;AACnD,qBAAa,YAAa,SAAQ,KAAK;IACrC,SAAkB,IAAI,EAAE,MAAM,CAAkB;CACjD;AAED;;;;;;;;;;;kDAWkD;AAClD,qBAAa,gBAAiB,SAAQ,YAAY;IAI9C,QAAQ,CAAC,MAAM,EAAE,MAAM;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM;IACrB,QAAQ,CAAC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