@kindgi/client 0.0.0-bootstrap.0 → 0.1.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/dist/index.js ADDED
@@ -0,0 +1,3800 @@
1
+ // src/errors.ts
2
+ function notImplementedInPreview(method) {
3
+ return {
4
+ code: "not-implemented-in-preview",
5
+ message: `${method}: transport not implemented in this preview`,
6
+ method
7
+ };
8
+ }
9
+ function notYetWired(method, reason) {
10
+ return {
11
+ code: "not-yet-wired",
12
+ message: `${method}: ${reason}`,
13
+ method,
14
+ reason
15
+ };
16
+ }
17
+ function fromWire(body) {
18
+ if (!body || typeof body !== "object") {
19
+ return {
20
+ code: "server",
21
+ serverCode: "unknown",
22
+ message: "Malformed error body from server"
23
+ };
24
+ }
25
+ const obj = body;
26
+ const code = typeof obj.code === "string" ? obj.code : "unknown";
27
+ const message = typeof obj.message === "string" ? obj.message : `Server error: ${code}`;
28
+ const details = obj.details && typeof obj.details === "object" ? obj.details : void 0;
29
+ switch (code) {
30
+ case "auth":
31
+ return {
32
+ code: "auth",
33
+ message,
34
+ reason: obj.reason ?? "unauthenticated"
35
+ };
36
+ // Wire-level auth codes per API-ROUTE-CONVENTIONS §4.3.
37
+ case "auth-missing":
38
+ return { code: "auth", message, reason: "unauthenticated" };
39
+ case "auth-expired":
40
+ return { code: "auth", message, reason: "token-expired" };
41
+ case "auth-revoked":
42
+ return { code: "auth", message, reason: "unauthenticated" };
43
+ case "permission-denied":
44
+ return { code: "auth", message, reason: "forbidden" };
45
+ case "rate-limited":
46
+ case "rate-limit-exceeded":
47
+ return {
48
+ code: "rate-limited",
49
+ message,
50
+ ...typeof obj.retryAfterSeconds === "number" ? { retryAfterSeconds: obj.retryAfterSeconds } : {}
51
+ };
52
+ case "not-found":
53
+ case "run-not-found":
54
+ case "agent-not-found":
55
+ case "tool-not-found":
56
+ case "guardrail-not-found":
57
+ case "flow-not-found":
58
+ case "conversation-not-found":
59
+ case "approval-not-found":
60
+ case "reviewer-not-found":
61
+ case "proposal-not-found":
62
+ case "provenance-not-found":
63
+ case "observation-not-found":
64
+ case "blob-not-found":
65
+ case "audit-bundle-not-found":
66
+ case "signing-not-configured":
67
+ case "signing-key-not-found":
68
+ case "adapter-not-found":
69
+ case "fact-not-found":
70
+ case "identity-user-not-found":
71
+ case "provider-not-found":
72
+ case "capability-not-found":
73
+ case "token-not-found":
74
+ return {
75
+ code: "not-found",
76
+ message,
77
+ resource: {
78
+ kind: code.replace(/-not-found$/u, "") || "unknown",
79
+ id: readStringField(
80
+ details,
81
+ "agentId",
82
+ "toolId",
83
+ "runId",
84
+ "adapterId",
85
+ "userId",
86
+ "providerId",
87
+ "capabilityId",
88
+ "tokenId",
89
+ "factId",
90
+ "guardrailId",
91
+ "id"
92
+ ) ?? "unknown"
93
+ }
94
+ };
95
+ case "conflict":
96
+ case "already-terminal":
97
+ case "run-already-terminal":
98
+ case "idempotency-key-body-mismatch":
99
+ case "hitl-required":
100
+ case "agent-already-registered":
101
+ case "tool-already-registered":
102
+ case "guardrail-already-registered":
103
+ case "flow-already-registered":
104
+ case "conversation-closed":
105
+ case "provider-already-registered":
106
+ case "proposal-invalid-state-transition":
107
+ case "approval-not-decided":
108
+ return { code: "conflict", message, reason: code };
109
+ case "invalid-request":
110
+ case "validation-failed":
111
+ case "unknown-field":
112
+ case "bad-input":
113
+ case "unresolved-tool":
114
+ case "unresolved-guardrail":
115
+ case "schema-validation-failed":
116
+ case "invalid-agent":
117
+ case "invalid-tool-definition":
118
+ case "invalid-schema":
119
+ case "unknown-effect":
120
+ case "invalid-guardrail":
121
+ case "invalid-provider":
122
+ case "supervisor-header-missing":
123
+ return {
124
+ code: "invalid-request",
125
+ message,
126
+ issues: obj.issues ?? details?.issues ?? []
127
+ };
128
+ case "guardrail-violation":
129
+ return {
130
+ code: "guardrail-violation",
131
+ message,
132
+ violations: readGuardrailViolations(details?.violations),
133
+ evaluationErrors: readEvaluationErrors(details?.evaluationErrors)
134
+ };
135
+ default:
136
+ return {
137
+ code: "server",
138
+ serverCode: code,
139
+ message,
140
+ ...details !== void 0 ? { fields: details } : {}
141
+ };
142
+ }
143
+ }
144
+ function readStringField(obj, ...keys) {
145
+ if (obj === void 0) return void 0;
146
+ for (const key of keys) {
147
+ const v = obj[key];
148
+ if (typeof v === "string" && v.length > 0) return v;
149
+ }
150
+ return void 0;
151
+ }
152
+ function asRecord(value) {
153
+ return value !== null && typeof value === "object" ? value : void 0;
154
+ }
155
+ function readGuardrailViolations(raw) {
156
+ if (!Array.isArray(raw)) return [];
157
+ const out = [];
158
+ for (const entry of raw) {
159
+ const v = asRecord(entry);
160
+ if (v === void 0 || typeof v.guardrailId !== "string") continue;
161
+ const reason = asRecord(v.result)?.reason;
162
+ out.push({
163
+ guardrailId: v.guardrailId,
164
+ severity: typeof v.severity === "string" ? v.severity : "unknown",
165
+ action: typeof v.action === "string" ? v.action : "unknown",
166
+ ...typeof reason === "string" && { reason }
167
+ });
168
+ }
169
+ return out;
170
+ }
171
+ function readEvaluationErrors(raw) {
172
+ if (!Array.isArray(raw)) return [];
173
+ const out = [];
174
+ for (const entry of raw) {
175
+ const e = asRecord(entry);
176
+ if (e === void 0 || typeof e.guardrailId !== "string") continue;
177
+ out.push({
178
+ guardrailId: e.guardrailId,
179
+ message: typeof e.message === "string" ? e.message : ""
180
+ });
181
+ }
182
+ return out;
183
+ }
184
+ var KindgiApiError = class extends Error {
185
+ error;
186
+ constructor(error) {
187
+ super(error.message);
188
+ this.name = "KindgiApiError";
189
+ this.error = error;
190
+ }
191
+ };
192
+
193
+ // src/streaming.ts
194
+ async function* readSse(options) {
195
+ const fetchImpl = options.fetchImpl ?? fetch;
196
+ const initialBackoff = options.initialBackoffMs ?? 500;
197
+ const maxBackoff = options.maxBackoffMs ?? 3e4;
198
+ const shouldRetry = options.shouldRetry ?? ((attempt2) => attempt2 < 10);
199
+ let lastEventId = options.lastEventId;
200
+ let attempt = 0;
201
+ while (!options.signal?.aborted) {
202
+ try {
203
+ const extra = typeof options.headers === "function" ? await options.headers() : options.headers ?? {};
204
+ const headers = {
205
+ Accept: "text/event-stream",
206
+ ...extra
207
+ };
208
+ if (lastEventId !== void 0) headers["Last-Event-Id"] = lastEventId;
209
+ const response = await fetchImpl(options.url, {
210
+ method: "GET",
211
+ headers,
212
+ ...options.signal ? { signal: options.signal } : {}
213
+ });
214
+ if (!response.ok || response.body === null) {
215
+ throw new SseHttpError(response.status);
216
+ }
217
+ attempt = 0;
218
+ for await (const event of parseSseStream(response.body)) {
219
+ if (event.id !== void 0) lastEventId = event.id;
220
+ yield event;
221
+ }
222
+ return;
223
+ } catch (err) {
224
+ if (options.signal?.aborted) return;
225
+ attempt += 1;
226
+ if (!shouldRetry(attempt, err)) throw err;
227
+ const backoff = Math.min(initialBackoff * 2 ** (attempt - 1), maxBackoff);
228
+ await sleep(backoff, options.signal);
229
+ }
230
+ }
231
+ }
232
+ var SseHttpError = class extends Error {
233
+ status;
234
+ constructor(status) {
235
+ super(`SSE upstream returned HTTP ${status}`);
236
+ this.name = "SseHttpError";
237
+ this.status = status;
238
+ }
239
+ };
240
+ async function* unwrapSseData(source) {
241
+ for await (const event of source) {
242
+ yield event.data;
243
+ }
244
+ }
245
+ async function* parseSseStream(body) {
246
+ const decoder = new TextDecoder();
247
+ const reader = body.getReader();
248
+ let buffer = "";
249
+ let eventName = "message";
250
+ let dataLines = [];
251
+ let eventId;
252
+ try {
253
+ while (true) {
254
+ const { done, value } = await reader.read();
255
+ if (done) break;
256
+ buffer += decoder.decode(value, { stream: true });
257
+ let newlineIdx = buffer.indexOf("\n");
258
+ while (newlineIdx !== -1) {
259
+ const line = buffer.slice(0, newlineIdx).replace(/\r$/, "");
260
+ buffer = buffer.slice(newlineIdx + 1);
261
+ newlineIdx = buffer.indexOf("\n");
262
+ if (line === "") {
263
+ if (dataLines.length > 0) {
264
+ const raw = dataLines.join("\n");
265
+ try {
266
+ const data = JSON.parse(raw);
267
+ yield { event: eventName, data, ...eventId !== void 0 ? { id: eventId } : {} };
268
+ } catch {
269
+ }
270
+ }
271
+ eventName = "message";
272
+ dataLines = [];
273
+ eventId = void 0;
274
+ continue;
275
+ }
276
+ if (line.startsWith(":")) continue;
277
+ const colonIdx = line.indexOf(":");
278
+ const field = colonIdx === -1 ? line : line.slice(0, colonIdx);
279
+ const rawVal = colonIdx === -1 ? "" : line.slice(colonIdx + 1);
280
+ const val = rawVal.startsWith(" ") ? rawVal.slice(1) : rawVal;
281
+ switch (field) {
282
+ case "event":
283
+ eventName = val;
284
+ break;
285
+ case "data":
286
+ dataLines.push(val);
287
+ break;
288
+ case "id":
289
+ eventId = val;
290
+ break;
291
+ default:
292
+ break;
293
+ }
294
+ }
295
+ }
296
+ } finally {
297
+ reader.releaseLock();
298
+ }
299
+ }
300
+ async function* postSse(options) {
301
+ const fetchImpl = options.fetchImpl ?? fetch;
302
+ const headers = {
303
+ Accept: "text/event-stream",
304
+ ...options.body !== void 0 && { "Content-Type": "application/json" },
305
+ ...options.headers ?? {}
306
+ };
307
+ const response = await fetchImpl(options.url, {
308
+ method: "POST",
309
+ headers,
310
+ ...options.body !== void 0 && { body: JSON.stringify(options.body) },
311
+ ...options.signal ? { signal: options.signal } : {}
312
+ });
313
+ if (!response.ok || response.body === null) {
314
+ throw new Error(`SSE upstream returned HTTP ${response.status}`);
315
+ }
316
+ for await (const event of parseSseStream(response.body)) {
317
+ yield event;
318
+ }
319
+ }
320
+ function sleep(ms, signal) {
321
+ return new Promise((resolve) => {
322
+ const t = setTimeout(resolve, ms);
323
+ signal?.addEventListener(
324
+ "abort",
325
+ () => {
326
+ clearTimeout(t);
327
+ resolve();
328
+ },
329
+ { once: true }
330
+ );
331
+ });
332
+ }
333
+
334
+ // src/resources/adapters.ts
335
+ function makeAdaptersClient(transport) {
336
+ return {
337
+ async list(filter) {
338
+ const page = await transport.request({
339
+ method: "GET",
340
+ path: "/v1/adapters",
341
+ query: {
342
+ ...filter?.limit !== void 0 && { limit: filter.limit },
343
+ ...filter?.cursor !== void 0 && { cursor: filter.cursor },
344
+ ...filter?.kind !== void 0 && { kind: filter.kind },
345
+ ...filter?.status !== void 0 && { status: filter.status }
346
+ }
347
+ });
348
+ return {
349
+ items: page.data,
350
+ ...page.nextCursor !== void 0 && { nextCursor: page.nextCursor }
351
+ };
352
+ },
353
+ async get(adapterId) {
354
+ return transport.request({
355
+ method: "GET",
356
+ path: `/v1/adapters/${encodeURIComponent(adapterId)}`
357
+ });
358
+ },
359
+ async test(input) {
360
+ return transport.request({
361
+ method: "POST",
362
+ path: `/v1/adapters/${encodeURIComponent(input.adapterId)}/test`,
363
+ body: input.probe ?? {},
364
+ ...input.idempotencyKey !== void 0 && { idempotencyKey: input.idempotencyKey }
365
+ });
366
+ },
367
+ prepare(input) {
368
+ const url = `${transport.apiUrl}/v1/adapters/${encodeURIComponent(input.adapterId)}/prepare`;
369
+ const source = postSse({
370
+ url,
371
+ headers: transport.authHeaders(),
372
+ fetchImpl: transport.fetchImpl,
373
+ ...input.params !== void 0 && { body: { params: input.params } },
374
+ ...input.signal !== void 0 && { signal: input.signal }
375
+ });
376
+ return unwrapSseData(source);
377
+ },
378
+ async candidates() {
379
+ throw new KindgiApiError(
380
+ notYetWired(
381
+ "adapters.candidates",
382
+ "no /v1/adapters/candidates route on the API \u2014 deployment-wired set is authoritative, no upstream catalog surface"
383
+ )
384
+ );
385
+ },
386
+ async configured() {
387
+ throw new KindgiApiError(
388
+ notYetWired(
389
+ "adapters.configured",
390
+ "use adapters.list() \u2014 the record-by-kind shape does not map to the wire paginated list"
391
+ )
392
+ );
393
+ },
394
+ async configure(_input) {
395
+ throw new KindgiApiError(
396
+ notYetWired(
397
+ "adapters.configure",
398
+ "adapters are wired at boot via config-as-code; runtime rebinding requires a platform capability that has not landed"
399
+ )
400
+ );
401
+ }
402
+ };
403
+ }
404
+
405
+ // src/resources/agents.ts
406
+ function makeAgentsClient(transport) {
407
+ const seg = (s) => encodeURIComponent(s);
408
+ return {
409
+ async define(spec, options) {
410
+ const result = await transport.request({
411
+ method: "POST",
412
+ path: "/v1/agents",
413
+ body: { ...spec, projectId: options.projectId },
414
+ ...options.idempotencyKey !== void 0 && {
415
+ idempotencyKey: options.idempotencyKey
416
+ }
417
+ });
418
+ return result.agentId;
419
+ },
420
+ async list(filter) {
421
+ return transport.request({
422
+ method: "GET",
423
+ path: "/v1/agents",
424
+ query: {
425
+ ...filter?.limit !== void 0 && { limit: filter.limit },
426
+ ...filter?.cursor !== void 0 && { cursor: filter.cursor },
427
+ ...filter?.name !== void 0 && { name: filter.name }
428
+ }
429
+ });
430
+ },
431
+ async get(agentId) {
432
+ return transport.request({
433
+ method: "GET",
434
+ path: `/v1/agents/${seg(agentId)}`
435
+ });
436
+ },
437
+ versions: {
438
+ async list(agentId, filter) {
439
+ return transport.request({
440
+ method: "GET",
441
+ path: `/v1/agents/${seg(agentId)}/versions`,
442
+ query: {
443
+ ...filter?.limit !== void 0 && { limit: filter.limit },
444
+ ...filter?.cursor !== void 0 && { cursor: filter.cursor }
445
+ }
446
+ });
447
+ },
448
+ async get(agentId, version) {
449
+ return transport.request({
450
+ method: "GET",
451
+ path: `/v1/agents/${seg(agentId)}/versions/${seg(version)}`
452
+ });
453
+ },
454
+ async unregister(agentId, version, options) {
455
+ return transport.request({
456
+ method: "POST",
457
+ path: `/v1/agents/${seg(agentId)}/versions/${seg(version)}/unregister`,
458
+ ...options?.idempotencyKey !== void 0 && {
459
+ idempotencyKey: options.idempotencyKey
460
+ }
461
+ });
462
+ }
463
+ },
464
+ async reinstateVersion(agentId, version, options) {
465
+ const wire = await transport.request({
466
+ method: "POST",
467
+ path: `/v1/agents/${seg(agentId)}/versions/${seg(version)}/reinstate`,
468
+ ...options?.idempotencyKey !== void 0 && {
469
+ idempotencyKey: options.idempotencyKey
470
+ }
471
+ });
472
+ return {
473
+ agentId: wire.agentId,
474
+ version: wire.version,
475
+ wasTombstoned: wire.wasTombstoned
476
+ };
477
+ }
478
+ };
479
+ }
480
+
481
+ // src/status-query.ts
482
+ function singleStatusQuery(method, status) {
483
+ if (status === void 0) return void 0;
484
+ if (!Array.isArray(status)) return status;
485
+ const statuses = status;
486
+ if (statuses.length <= 1) return statuses[0];
487
+ const error = {
488
+ code: "invalid-request",
489
+ message: `${method}: filter by one status at a time; the API accepts a single \`status\` value`,
490
+ issues: [{ path: "/status", message: "expected a single status" }]
491
+ };
492
+ throw new KindgiApiError(error);
493
+ }
494
+
495
+ // src/resources/approvals.ts
496
+ function makeApprovalsClient(transport) {
497
+ return {
498
+ async list(filter) {
499
+ const statusParam = singleStatusQuery("approvals.list", filter?.status);
500
+ const page = await transport.request({
501
+ method: "GET",
502
+ path: "/v1/approvals",
503
+ query: {
504
+ ...filter?.limit !== void 0 && { limit: filter.limit },
505
+ ...filter?.cursor !== void 0 && { cursor: filter.cursor },
506
+ ...statusParam !== void 0 && { status: statusParam },
507
+ ...filter?.requiredRole !== void 0 && { requiredRole: filter.requiredRole },
508
+ ...filter?.createdAfter !== void 0 && {
509
+ createdAfter: filter.createdAfter
510
+ }
511
+ }
512
+ });
513
+ return {
514
+ items: page.data,
515
+ ...page.nextCursor !== void 0 && {
516
+ nextCursor: page.nextCursor
517
+ }
518
+ };
519
+ },
520
+ async get(id) {
521
+ return transport.request({
522
+ method: "GET",
523
+ path: `/v1/approvals/${encodeURIComponent(id)}`
524
+ });
525
+ },
526
+ async decide(id, input) {
527
+ const body = { decision: input.decision };
528
+ if (input.rationale !== void 0) body.rationale = input.rationale;
529
+ if (input.value !== void 0) body.value = input.value;
530
+ return transport.request({
531
+ method: "POST",
532
+ path: `/v1/approvals/${encodeURIComponent(id)}/complete`,
533
+ body,
534
+ ...input.idempotencyKey !== void 0 && { idempotencyKey: input.idempotencyKey }
535
+ });
536
+ },
537
+ async batch(_input) {
538
+ throw new KindgiApiError(
539
+ notYetWired(
540
+ "approvals.batch",
541
+ "no bulk-decide route on the API \u2014 per-approval POST /v1/approvals/{id}/complete is the primitive; a bulk wrapper needs a design on partial-failure semantics"
542
+ )
543
+ );
544
+ },
545
+ async assign(_id, _reviewerId) {
546
+ throw new KindgiApiError(
547
+ notYetWired(
548
+ "approvals.assign",
549
+ "no per-approval assign route on the API \u2014 assignment happens at approval-creation time via HITL binding resolveReviewer, external re-assign is a planned follow-up"
550
+ )
551
+ );
552
+ },
553
+ async completeToken(_id, _input) {
554
+ throw new KindgiApiError(
555
+ notYetWired(
556
+ "approvals.completeToken",
557
+ "no standalone complete-token route on the API \u2014 wire fuses waitpoint resume into POST /v1/approvals/{id}/complete (any decide that terminates + carries a waitTokenId auto-resumes), use approvals.decide instead"
558
+ )
559
+ );
560
+ },
561
+ reviewers: {
562
+ async register(spec, options) {
563
+ return transport.request({
564
+ method: "POST",
565
+ path: "/v1/approvals/reviewers",
566
+ body: {
567
+ userId: spec.userId,
568
+ role: spec.role,
569
+ ...spec.displayName !== void 0 && { displayName: spec.displayName }
570
+ },
571
+ ...options?.idempotencyKey !== void 0 && {
572
+ idempotencyKey: options.idempotencyKey
573
+ }
574
+ });
575
+ },
576
+ async list(filter) {
577
+ const page = await transport.request({
578
+ method: "GET",
579
+ path: "/v1/approvals/reviewers",
580
+ query: {
581
+ ...filter?.limit !== void 0 && { limit: filter.limit },
582
+ ...filter?.cursor !== void 0 && { cursor: filter.cursor },
583
+ ...filter?.role !== void 0 && { role: filter.role }
584
+ }
585
+ });
586
+ return {
587
+ items: page.data,
588
+ ...page.nextCursor !== void 0 && {
589
+ nextCursor: page.nextCursor
590
+ }
591
+ };
592
+ },
593
+ async get(id) {
594
+ return transport.request({
595
+ method: "GET",
596
+ path: `/v1/approvals/reviewers/${encodeURIComponent(id)}`
597
+ });
598
+ },
599
+ async updateRole(_id, _role) {
600
+ throw new KindgiApiError(
601
+ notYetWired(
602
+ "approvals.reviewers.updateRole",
603
+ "no dedicated update-role route on the API \u2014 role rotation happens via re-register (idempotent per (tenantId, userId) rewrites the role), wire only if a bespoke audit-log entry for role changes is needed"
604
+ )
605
+ );
606
+ },
607
+ async deactivate(id, options) {
608
+ return transport.request({
609
+ method: "POST",
610
+ path: `/v1/approvals/reviewers/${encodeURIComponent(id)}/unregister`,
611
+ body: {},
612
+ ...options?.idempotencyKey !== void 0 && {
613
+ idempotencyKey: options.idempotencyKey
614
+ }
615
+ });
616
+ }
617
+ },
618
+ audit: {
619
+ async export(input) {
620
+ return transport.request({
621
+ method: "POST",
622
+ path: `/v1/approvals/${encodeURIComponent(input.approvalId)}/audit-bundle`,
623
+ body: {
624
+ signingKeyId: input.signingKeyId,
625
+ ...input.includeMessages !== void 0 && {
626
+ includeMessages: input.includeMessages
627
+ }
628
+ },
629
+ ...input.idempotencyKey !== void 0 && { idempotencyKey: input.idempotencyKey }
630
+ });
631
+ },
632
+ async get(_id) {
633
+ throw new KindgiApiError(
634
+ notYetWired(
635
+ "approvals.audit.get",
636
+ "no GET /v1/audit-bundles/{id} route on the API \u2014 wire ships the signed body inline from export (bundles are not durably stored server-side today)"
637
+ )
638
+ );
639
+ },
640
+ async list(_filter) {
641
+ throw new KindgiApiError(
642
+ notYetWired(
643
+ "approvals.audit.list",
644
+ "no GET /v1/audit-bundles route on the API \u2014 bundles are not durably stored server-side today"
645
+ )
646
+ );
647
+ },
648
+ async verify(_bundle, _publicKey) {
649
+ throw new KindgiApiError(
650
+ notYetWired(
651
+ "approvals.audit.verify",
652
+ "client-side verifier requires the crypto module reachability from the SDK bundle \u2014 not yet vendored (same constraint as provenance.verify + webhooks.verify)"
653
+ )
654
+ );
655
+ }
656
+ }
657
+ };
658
+ }
659
+
660
+ // src/resources/artifacts.ts
661
+ function makeArtifactsClient(transport) {
662
+ return {
663
+ async put(_input) {
664
+ throw new KindgiApiError(
665
+ notYetWired(
666
+ "artifacts.put",
667
+ "POST /v1/artifacts is a multipart-form upload; the SDK transport is JSON-only. Multipart / raw-stream body support is a planned follow-up"
668
+ )
669
+ );
670
+ },
671
+ async get(_ref) {
672
+ throw new KindgiApiError(
673
+ notYetWired(
674
+ "artifacts.get",
675
+ "GET /v1/artifacts/{blobId} streams binary bytes; the SDK transport hydrates JSON only. Raw-stream response support is a planned follow-up"
676
+ )
677
+ );
678
+ },
679
+ async list(filter) {
680
+ const page = await transport.request({
681
+ method: "GET",
682
+ path: "/v1/artifacts",
683
+ query: {
684
+ ...filter?.limit !== void 0 && { limit: filter.limit },
685
+ ...filter?.cursor !== void 0 && { cursor: filter.cursor },
686
+ ...filter?.ownerRunId !== void 0 && {
687
+ ownerRunId: filter.ownerRunId
688
+ },
689
+ ...filter?.contentType !== void 0 && { contentType: filter.contentType }
690
+ }
691
+ });
692
+ return {
693
+ items: page.data,
694
+ ...page.nextCursor !== void 0 && {
695
+ nextCursor: page.nextCursor
696
+ }
697
+ };
698
+ },
699
+ async delete(blobId, options) {
700
+ return transport.request({
701
+ method: "DELETE",
702
+ path: `/v1/artifacts/${encodeURIComponent(blobId)}`,
703
+ ...options?.idempotencyKey !== void 0 && {
704
+ idempotencyKey: options.idempotencyKey
705
+ }
706
+ });
707
+ },
708
+ async presign(_input) {
709
+ throw new KindgiApiError(
710
+ notYetWired(
711
+ "artifacts.presign",
712
+ "no POST /v1/artifacts/presign route on the API \u2014 presigned URLs are a per-backend concern (S3/GCS/R2 native)"
713
+ )
714
+ );
715
+ },
716
+ async setRetentionLock(_ref, _until) {
717
+ throw new KindgiApiError(
718
+ notYetWired(
719
+ "artifacts.setRetentionLock",
720
+ "no POST /v1/artifacts/{blobId}/retention-lock route on the API \u2014 retention locks are a per-backend concern (S3 Object Lock, MinIO retention)"
721
+ )
722
+ );
723
+ }
724
+ };
725
+ }
726
+
727
+ // src/resources/audit.ts
728
+ function makeAuditClient(transport) {
729
+ return {
730
+ authz: {
731
+ async list(filter) {
732
+ return transport.request({
733
+ method: "GET",
734
+ path: "/v1/audit/authz",
735
+ query: {
736
+ ...filter?.limit !== void 0 && { limit: filter.limit },
737
+ ...filter?.cursor !== void 0 && { cursor: filter.cursor },
738
+ ...filter?.actorSubject !== void 0 && { actorSubject: filter.actorSubject },
739
+ ...filter?.onBehalfOf !== void 0 && { onBehalfOf: filter.onBehalfOf },
740
+ ...filter?.action !== void 0 && { action: filter.action },
741
+ ...filter?.resource !== void 0 && { resource: filter.resource },
742
+ ...filter?.outcome !== void 0 && { outcome: filter.outcome },
743
+ ...filter?.runId !== void 0 && { runId: filter.runId },
744
+ ...filter?.from !== void 0 && { from: filter.from },
745
+ ...filter?.to !== void 0 && { to: filter.to }
746
+ }
747
+ });
748
+ }
749
+ }
750
+ };
751
+ }
752
+
753
+ // src/resources/auth.ts
754
+ function makeAuthClient(transport) {
755
+ const seg = (s) => encodeURIComponent(s);
756
+ return {
757
+ providers: {
758
+ async list() {
759
+ return transport.request({
760
+ method: "GET",
761
+ path: "/v1/auth/providers"
762
+ });
763
+ },
764
+ async register(input, options) {
765
+ return transport.request({
766
+ method: "POST",
767
+ path: "/v1/auth/providers",
768
+ body: input,
769
+ ...options?.idempotencyKey !== void 0 && { idempotencyKey: options.idempotencyKey }
770
+ });
771
+ },
772
+ async unregister(providerId, options) {
773
+ return transport.request({
774
+ method: "POST",
775
+ path: `/v1/auth/providers/${seg(providerId)}/unregister`,
776
+ ...options?.idempotencyKey !== void 0 && { idempotencyKey: options.idempotencyKey }
777
+ });
778
+ }
779
+ },
780
+ async login(providerId, input, options) {
781
+ return transport.request({
782
+ method: "POST",
783
+ path: `/v1/auth/login/${seg(providerId)}`,
784
+ ...input !== void 0 && { body: input },
785
+ ...options?.idempotencyKey !== void 0 && { idempotencyKey: options.idempotencyKey }
786
+ });
787
+ },
788
+ async callback(providerId, input) {
789
+ return transport.request({
790
+ method: "POST",
791
+ path: `/v1/auth/callback/${seg(providerId)}`,
792
+ body: input
793
+ });
794
+ },
795
+ async refresh(options) {
796
+ return transport.request({
797
+ method: "POST",
798
+ path: "/v1/auth/refresh",
799
+ ...options?.idempotencyKey !== void 0 && { idempotencyKey: options.idempotencyKey }
800
+ });
801
+ },
802
+ async logout(options) {
803
+ return transport.request({
804
+ method: "POST",
805
+ path: "/v1/auth/logout",
806
+ ...options?.idempotencyKey !== void 0 && { idempotencyKey: options.idempotencyKey }
807
+ });
808
+ }
809
+ };
810
+ }
811
+
812
+ // src/resources/capabilities.ts
813
+ function makeCapabilitiesClient(transport) {
814
+ return {
815
+ async list(filter) {
816
+ const page = await transport.request({
817
+ method: "GET",
818
+ path: "/v1/capabilities",
819
+ query: {
820
+ ...filter?.limit !== void 0 && { limit: filter.limit },
821
+ ...filter?.cursor !== void 0 && { cursor: filter.cursor },
822
+ ...filter?.feature !== void 0 && { feature: filter.feature }
823
+ }
824
+ });
825
+ return {
826
+ items: page.data,
827
+ ...page.nextCursor !== void 0 && {
828
+ nextCursor: page.nextCursor
829
+ }
830
+ };
831
+ },
832
+ async get(capabilityId) {
833
+ return transport.request({
834
+ method: "GET",
835
+ path: `/v1/capabilities/${encodeURIComponent(capabilityId)}`
836
+ });
837
+ },
838
+ async route(_needs) {
839
+ throw new KindgiApiError(
840
+ notYetWired(
841
+ "capabilities.route",
842
+ "no POST /v1/capabilities/route route on the API \u2014 preview routing is a runtime primitive without an HTTP surface yet"
843
+ )
844
+ );
845
+ },
846
+ providers: {
847
+ async list(filter) {
848
+ const page = await transport.request({
849
+ method: "GET",
850
+ path: "/v1/providers",
851
+ query: {
852
+ ...filter?.limit !== void 0 && { limit: filter.limit },
853
+ ...filter?.cursor !== void 0 && { cursor: filter.cursor },
854
+ ...filter?.feature !== void 0 && { feature: filter.feature }
855
+ }
856
+ });
857
+ return {
858
+ items: page.data,
859
+ ...page.nextCursor !== void 0 && {
860
+ nextCursor: page.nextCursor
861
+ }
862
+ };
863
+ },
864
+ async get(id) {
865
+ return transport.request({
866
+ method: "GET",
867
+ path: `/v1/providers/${encodeURIComponent(id)}`
868
+ });
869
+ },
870
+ async configure(spec, options) {
871
+ return transport.request({
872
+ method: "POST",
873
+ path: "/v1/providers",
874
+ body: spec,
875
+ ...options?.idempotencyKey !== void 0 && {
876
+ idempotencyKey: options.idempotencyKey
877
+ }
878
+ });
879
+ },
880
+ async capabilitiesFor(id) {
881
+ const envelope = await transport.request({
882
+ method: "GET",
883
+ path: `/v1/providers/${encodeURIComponent(id)}/capabilities`
884
+ });
885
+ return envelope.data;
886
+ },
887
+ async enable(_id) {
888
+ throw new KindgiApiError(
889
+ notYetWired(
890
+ "capabilities.providers.enable",
891
+ "no POST /v1/providers/{id}/enable route on the API \u2014 wire has no active/inactive state"
892
+ )
893
+ );
894
+ },
895
+ async disable(_id) {
896
+ throw new KindgiApiError(
897
+ notYetWired(
898
+ "capabilities.providers.disable",
899
+ "no POST /v1/providers/{id}/disable route on the API \u2014 wire has no active/inactive state"
900
+ )
901
+ );
902
+ },
903
+ async delete(id, options) {
904
+ return transport.request({
905
+ method: "POST",
906
+ path: `/v1/providers/${encodeURIComponent(id)}/unregister`,
907
+ body: {},
908
+ ...options?.idempotencyKey !== void 0 && {
909
+ idempotencyKey: options.idempotencyKey
910
+ }
911
+ });
912
+ }
913
+ }
914
+ };
915
+ }
916
+
917
+ // src/resources/compliance.ts
918
+ function makeComplianceClient(transport) {
919
+ return {
920
+ evidence: {
921
+ async list(filter) {
922
+ return transport.request({
923
+ method: "GET",
924
+ path: "/v1/compliance/evidence",
925
+ query: {
926
+ ...filter?.limit !== void 0 && { limit: filter.limit },
927
+ ...filter?.cursor !== void 0 && { cursor: filter.cursor },
928
+ ...filter?.runId !== void 0 && { runId: filter.runId },
929
+ ...filter?.agentId !== void 0 && { agentId: filter.agentId },
930
+ ...filter?.flowId !== void 0 && { flowId: filter.flowId },
931
+ ...filter?.kind !== void 0 && { kind: filter.kind },
932
+ ...filter?.from !== void 0 && { from: filter.from },
933
+ ...filter?.to !== void 0 && { to: filter.to }
934
+ }
935
+ });
936
+ },
937
+ async get(evidenceId) {
938
+ return transport.request({
939
+ method: "GET",
940
+ path: `/v1/compliance/evidence/${encodeURIComponent(evidenceId)}`
941
+ });
942
+ },
943
+ async export(input, options) {
944
+ return transport.request({
945
+ method: "POST",
946
+ path: "/v1/compliance/evidence/export",
947
+ body: input,
948
+ ...options?.idempotencyKey !== void 0 && { idempotencyKey: options.idempotencyKey }
949
+ });
950
+ }
951
+ }
952
+ };
953
+ }
954
+
955
+ // src/resources/conversations.ts
956
+ function makeConversationsClient(transport) {
957
+ return {
958
+ async open(input, options) {
959
+ return transport.request({
960
+ method: "POST",
961
+ path: "/v1/conversations",
962
+ body: {
963
+ agentId: input.agentId,
964
+ agentVersion: input.agentVersion,
965
+ ...input.title !== void 0 && { title: input.title },
966
+ ...input.scope !== void 0 && { scope: input.scope },
967
+ ...input.participantId !== void 0 && { participantId: input.participantId },
968
+ ...input.metadata !== void 0 && { metadata: input.metadata }
969
+ },
970
+ ...options?.idempotencyKey !== void 0 && {
971
+ idempotencyKey: options.idempotencyKey
972
+ }
973
+ });
974
+ },
975
+ async get(id) {
976
+ return transport.request({
977
+ method: "GET",
978
+ path: `/v1/conversations/${encodeURIComponent(id)}`
979
+ });
980
+ },
981
+ async list(filter) {
982
+ const statusParam = singleStatusQuery("conversations.list", filter?.status);
983
+ const page = await transport.request({
984
+ method: "GET",
985
+ path: "/v1/conversations",
986
+ query: {
987
+ ...filter?.limit !== void 0 && { limit: filter.limit },
988
+ ...filter?.cursor !== void 0 && { cursor: filter.cursor },
989
+ ...statusParam !== void 0 && { status: statusParam },
990
+ ...filter?.agent !== void 0 && { agentId: filter.agent }
991
+ }
992
+ });
993
+ return {
994
+ items: page.data,
995
+ ...page.nextCursor !== void 0 && { nextCursor: page.nextCursor }
996
+ };
997
+ },
998
+ async close(id, options) {
999
+ return transport.request({
1000
+ method: "POST",
1001
+ path: `/v1/conversations/${encodeURIComponent(id)}/close`,
1002
+ body: {},
1003
+ ...options?.idempotencyKey !== void 0 && {
1004
+ idempotencyKey: options.idempotencyKey
1005
+ }
1006
+ });
1007
+ },
1008
+ async messages(id, filter) {
1009
+ const page = await transport.request({
1010
+ method: "GET",
1011
+ path: `/v1/conversations/${encodeURIComponent(id)}/messages`,
1012
+ query: {
1013
+ ...filter?.limit !== void 0 && { limit: filter.limit },
1014
+ ...filter?.cursor !== void 0 && { cursor: filter.cursor }
1015
+ }
1016
+ });
1017
+ return {
1018
+ items: page.data,
1019
+ ...page.nextCursor !== void 0 && { nextCursor: page.nextCursor }
1020
+ };
1021
+ }
1022
+ };
1023
+ }
1024
+
1025
+ // src/resources/cost.ts
1026
+ function makeCostClient(transport) {
1027
+ return {
1028
+ usage: {
1029
+ async query(filter) {
1030
+ const page = await transport.request({
1031
+ method: "GET",
1032
+ path: "/v1/cost/records",
1033
+ query: {
1034
+ ...filter?.limit !== void 0 && { limit: filter.limit },
1035
+ ...filter?.cursor !== void 0 && { cursor: filter.cursor },
1036
+ ...filter?.runId !== void 0 && { runId: filter.runId },
1037
+ ...filter?.agentId !== void 0 && { agentId: filter.agentId },
1038
+ ...filter?.conversationId !== void 0 && {
1039
+ conversationId: filter.conversationId
1040
+ },
1041
+ ...filter?.category !== void 0 && { category: filter.category },
1042
+ ...filter?.providerId !== void 0 && {
1043
+ providerId: filter.providerId
1044
+ },
1045
+ ...filter?.from !== void 0 && { from: filter.from },
1046
+ ...filter?.to !== void 0 && { to: filter.to }
1047
+ }
1048
+ });
1049
+ return {
1050
+ items: page.data,
1051
+ ...page.nextCursor !== void 0 && {
1052
+ nextCursor: page.nextCursor
1053
+ }
1054
+ };
1055
+ },
1056
+ async get(recordId) {
1057
+ return transport.request({
1058
+ method: "GET",
1059
+ path: `/v1/cost/records/${encodeURIComponent(recordId)}`
1060
+ });
1061
+ },
1062
+ async summary(input) {
1063
+ return transport.request({
1064
+ method: "GET",
1065
+ path: "/v1/cost/aggregate",
1066
+ query: {
1067
+ from: input.from,
1068
+ to: input.to,
1069
+ ...input.groupBy !== void 0 && { groupBy: input.groupBy.join(",") },
1070
+ ...input.category !== void 0 && { category: input.category },
1071
+ ...input.providerId !== void 0 && {
1072
+ providerId: input.providerId
1073
+ },
1074
+ ...input.agentId !== void 0 && { agentId: input.agentId },
1075
+ ...input.runId !== void 0 && { runId: input.runId },
1076
+ ...input.conversationId !== void 0 && {
1077
+ conversationId: input.conversationId
1078
+ }
1079
+ }
1080
+ });
1081
+ }
1082
+ },
1083
+ budgets: {
1084
+ async get() {
1085
+ throw new KindgiApiError(
1086
+ notYetWired(
1087
+ "cost.budgets.get",
1088
+ "no GET /v1/tenant/budgets route on the API \u2014 budget enforcement primitive not surfaced on the wire"
1089
+ )
1090
+ );
1091
+ },
1092
+ async set(_input) {
1093
+ throw new KindgiApiError(
1094
+ notYetWired(
1095
+ "cost.budgets.set",
1096
+ "no PUT /v1/tenant/budgets route on the API \u2014 admin-scope budget writes not surfaced yet"
1097
+ )
1098
+ );
1099
+ },
1100
+ async getRemaining() {
1101
+ throw new KindgiApiError(
1102
+ notYetWired(
1103
+ "cost.budgets.getRemaining",
1104
+ "no GET /v1/tenant/budgets/remaining route on the API \u2014 window-remaining computation not surfaced yet"
1105
+ )
1106
+ );
1107
+ }
1108
+ }
1109
+ };
1110
+ }
1111
+
1112
+ // src/resources/deployments.ts
1113
+ function makeDeploymentsClient(transport) {
1114
+ return {
1115
+ async register(input, options) {
1116
+ return transport.request({
1117
+ method: "POST",
1118
+ path: "/v1/deployments",
1119
+ body: input,
1120
+ ...options?.idempotencyKey !== void 0 && { idempotencyKey: options.idempotencyKey }
1121
+ });
1122
+ },
1123
+ async list(filter) {
1124
+ return transport.request({
1125
+ method: "GET",
1126
+ path: "/v1/deployments",
1127
+ query: {
1128
+ ...filter?.limit !== void 0 && { limit: filter.limit },
1129
+ ...filter?.cursor !== void 0 && { cursor: filter.cursor },
1130
+ ...filter?.imageRefPrefix !== void 0 && { imageRefPrefix: filter.imageRefPrefix },
1131
+ ...filter?.signerKeyId !== void 0 && { signerKeyId: filter.signerKeyId }
1132
+ }
1133
+ });
1134
+ },
1135
+ async get(deploymentId) {
1136
+ return transport.request({
1137
+ method: "GET",
1138
+ path: `/v1/deployments/${encodeURIComponent(deploymentId)}`
1139
+ });
1140
+ },
1141
+ async syncSecrets(deploymentId, input, options) {
1142
+ return transport.request({
1143
+ method: "POST",
1144
+ path: `/v1/deployments/${encodeURIComponent(deploymentId)}/secrets`,
1145
+ body: input,
1146
+ ...options?.idempotencyKey !== void 0 && { idempotencyKey: options.idempotencyKey }
1147
+ });
1148
+ }
1149
+ };
1150
+ }
1151
+
1152
+ // src/scope-wire.ts
1153
+ function scopeForBody(scope) {
1154
+ if (scope.kind === "tenant") return { kind: "tenant" };
1155
+ if (scope.kind === "org") return { kind: "org", orgId: scope.orgId };
1156
+ return { kind: "project", projectId: scope.projectId };
1157
+ }
1158
+ function scopeToQuery(scope) {
1159
+ if (scope.kind === "tenant") return { scopeKind: "tenant" };
1160
+ if (scope.kind === "org") {
1161
+ return { scopeKind: "org", scopeId: scope.orgId };
1162
+ }
1163
+ return { scopeKind: "project", scopeId: scope.projectId };
1164
+ }
1165
+
1166
+ // src/resources/env.ts
1167
+ function makeEnvClient(transport) {
1168
+ return {
1169
+ async list(input) {
1170
+ const q = scopeToQuery(input.scope);
1171
+ const page = await transport.request({
1172
+ method: "GET",
1173
+ path: "/v1/env",
1174
+ query: {
1175
+ envName: input.envName,
1176
+ scopeKind: q.scopeKind,
1177
+ ...q.scopeId !== void 0 && { scopeId: q.scopeId },
1178
+ ...input.cursor !== void 0 && {
1179
+ cursor: input.cursor
1180
+ },
1181
+ ...input.namePrefix !== void 0 && { namePrefix: input.namePrefix },
1182
+ ...input.limit !== void 0 && { limit: input.limit }
1183
+ }
1184
+ });
1185
+ return {
1186
+ data: page.data,
1187
+ ...page.nextCursor !== void 0 && {
1188
+ nextCursor: page.nextCursor
1189
+ }
1190
+ };
1191
+ },
1192
+ async get(input) {
1193
+ const q = scopeToQuery(input.scope);
1194
+ try {
1195
+ return await transport.request({
1196
+ method: "GET",
1197
+ path: `/v1/env/${encodeURIComponent(input.name)}`,
1198
+ query: {
1199
+ envName: input.envName,
1200
+ scopeKind: q.scopeKind,
1201
+ ...q.scopeId !== void 0 && { scopeId: q.scopeId }
1202
+ }
1203
+ });
1204
+ } catch (err) {
1205
+ if (isEnvNotFound(err)) return null;
1206
+ throw err;
1207
+ }
1208
+ },
1209
+ async set(input) {
1210
+ const q = scopeToQuery(input.scope);
1211
+ try {
1212
+ const record = await transport.request({
1213
+ method: "PUT",
1214
+ path: `/v1/env/${encodeURIComponent(input.name)}`,
1215
+ query: {
1216
+ envName: input.envName,
1217
+ scopeKind: q.scopeKind,
1218
+ ...q.scopeId !== void 0 && { scopeId: q.scopeId }
1219
+ },
1220
+ body: {
1221
+ scope: scopeForBody(input.scope),
1222
+ envName: input.envName,
1223
+ name: input.name,
1224
+ value: input.value,
1225
+ ...input.ifRevision !== void 0 && { ifRevision: input.ifRevision },
1226
+ ...input.tags !== void 0 && { tags: input.tags }
1227
+ }
1228
+ });
1229
+ return { kind: "ok", record };
1230
+ } catch (err) {
1231
+ const conflict = tryReadRevisionConflict(err);
1232
+ if (conflict !== null) {
1233
+ return { kind: "revision-conflict", currentRevision: conflict };
1234
+ }
1235
+ throw err;
1236
+ }
1237
+ },
1238
+ async delete(input) {
1239
+ const q = scopeToQuery(input.scope);
1240
+ return transport.request({
1241
+ method: "DELETE",
1242
+ path: `/v1/env/${encodeURIComponent(input.name)}`,
1243
+ query: {
1244
+ envName: input.envName,
1245
+ scopeKind: q.scopeKind,
1246
+ ...q.scopeId !== void 0 && { scopeId: q.scopeId }
1247
+ }
1248
+ });
1249
+ }
1250
+ };
1251
+ }
1252
+ function isEnvNotFound(err) {
1253
+ if (err === null || typeof err !== "object") return false;
1254
+ const asAny = err;
1255
+ const inner = asAny.error;
1256
+ if (inner === void 0) return false;
1257
+ const code = inner.code;
1258
+ const serverCode = inner.serverCode;
1259
+ if (code === "env-not-found") return true;
1260
+ if (code === "not-found" && typeof inner.resource === "object" && inner.resource !== null && inner.resource.kind === "env") {
1261
+ return true;
1262
+ }
1263
+ if (code === "server" && serverCode === "env-not-found") return true;
1264
+ return false;
1265
+ }
1266
+ function tryReadRevisionConflict(err) {
1267
+ if (err === null || typeof err !== "object") return null;
1268
+ const asAny = err;
1269
+ const inner = asAny.error;
1270
+ if (inner === void 0) return null;
1271
+ const isConflict = inner.code === "env-write-conflict" || inner.code === "conflict" || inner.serverCode === "env-write-conflict";
1272
+ if (!isConflict) return null;
1273
+ const fromFields = inner.fields?.currentRevision;
1274
+ if (typeof fromFields === "number") return fromFields;
1275
+ const cur = inner.currentRevision;
1276
+ if (typeof cur !== "number") return null;
1277
+ return cur;
1278
+ }
1279
+
1280
+ // src/resources/eval-runs.ts
1281
+ function makeEvalRunsClient(transport) {
1282
+ const seg = (s) => encodeURIComponent(s);
1283
+ return {
1284
+ async start(suiteId, input, options) {
1285
+ return transport.request({
1286
+ method: "POST",
1287
+ path: `/v1/eval-suites/${seg(suiteId)}/runs`,
1288
+ body: { ...input, projectId: options.projectId },
1289
+ ...options.idempotencyKey !== void 0 && { idempotencyKey: options.idempotencyKey }
1290
+ });
1291
+ },
1292
+ async list(filter) {
1293
+ return transport.request({
1294
+ method: "GET",
1295
+ path: "/v1/eval-runs",
1296
+ query: {
1297
+ ...filter?.limit !== void 0 && { limit: filter.limit },
1298
+ ...filter?.cursor !== void 0 && { cursor: filter.cursor },
1299
+ ...filter?.suiteId !== void 0 && { suiteId: filter.suiteId },
1300
+ ...filter?.status !== void 0 && { status: filter.status },
1301
+ ...filter?.agentId !== void 0 && { agentId: filter.agentId }
1302
+ }
1303
+ });
1304
+ },
1305
+ async get(runId) {
1306
+ return transport.request({
1307
+ method: "GET",
1308
+ path: `/v1/eval-runs/${seg(runId)}`
1309
+ });
1310
+ },
1311
+ async cancel(runId) {
1312
+ return transport.request({
1313
+ method: "POST",
1314
+ path: `/v1/eval-runs/${seg(runId)}/cancel`
1315
+ });
1316
+ },
1317
+ events(runId, options) {
1318
+ const url = `${transport.apiUrl}/v1/eval-runs/${seg(runId)}/events`;
1319
+ const source = readSse({
1320
+ url,
1321
+ headers: transport.authHeaders(),
1322
+ fetchImpl: transport.fetchImpl,
1323
+ ...options?.signal !== void 0 && { signal: options.signal },
1324
+ ...options?.initialBackoffMs !== void 0 && {
1325
+ initialBackoffMs: options.initialBackoffMs
1326
+ },
1327
+ ...options?.maxBackoffMs !== void 0 && {
1328
+ maxBackoffMs: options.maxBackoffMs
1329
+ }
1330
+ });
1331
+ return unwrapSseData(source);
1332
+ }
1333
+ };
1334
+ }
1335
+
1336
+ // src/resources/eval-suites.ts
1337
+ function makeEvalSuitesClient(transport) {
1338
+ const seg = (s) => encodeURIComponent(s);
1339
+ return {
1340
+ async publish(input, options) {
1341
+ return transport.request({
1342
+ method: "POST",
1343
+ path: "/v1/eval-suites",
1344
+ body: { ...input, projectId: options.projectId },
1345
+ ...options.idempotencyKey !== void 0 && { idempotencyKey: options.idempotencyKey }
1346
+ });
1347
+ },
1348
+ async list(filter) {
1349
+ return transport.request({
1350
+ method: "GET",
1351
+ path: "/v1/eval-suites",
1352
+ query: {
1353
+ ...filter?.limit !== void 0 && { limit: filter.limit },
1354
+ ...filter?.cursor !== void 0 && { cursor: filter.cursor },
1355
+ ...filter?.kind !== void 0 && { kind: filter.kind },
1356
+ ...filter?.name !== void 0 && { name: filter.name },
1357
+ ...filter?.scopeKind !== void 0 && { scopeKind: filter.scopeKind },
1358
+ ...filter?.scopeId !== void 0 && { scopeId: filter.scopeId },
1359
+ ...filter?.inherit !== void 0 && { inherit: filter.inherit }
1360
+ }
1361
+ });
1362
+ },
1363
+ async get(suiteId) {
1364
+ return transport.request({
1365
+ method: "GET",
1366
+ path: `/v1/eval-suites/${seg(suiteId)}`
1367
+ });
1368
+ },
1369
+ versions: {
1370
+ async list(suiteId, filter) {
1371
+ return transport.request({
1372
+ method: "GET",
1373
+ path: `/v1/eval-suites/${seg(suiteId)}/versions`,
1374
+ query: {
1375
+ ...filter?.limit !== void 0 && { limit: filter.limit },
1376
+ ...filter?.cursor !== void 0 && { cursor: filter.cursor }
1377
+ }
1378
+ });
1379
+ },
1380
+ async get(suiteId, version) {
1381
+ return transport.request({
1382
+ method: "GET",
1383
+ path: `/v1/eval-suites/${seg(suiteId)}/versions/${seg(version)}`
1384
+ });
1385
+ },
1386
+ async unregister(suiteId, version, options) {
1387
+ return transport.request({
1388
+ method: "POST",
1389
+ path: `/v1/eval-suites/${seg(suiteId)}/versions/${seg(version)}/unregister`,
1390
+ ...options?.idempotencyKey !== void 0 && { idempotencyKey: options.idempotencyKey }
1391
+ });
1392
+ },
1393
+ async reinstate(suiteId, version, options) {
1394
+ return transport.request({
1395
+ method: "POST",
1396
+ path: `/v1/eval-suites/${seg(suiteId)}/versions/${seg(version)}/reinstate`,
1397
+ ...options?.idempotencyKey !== void 0 && { idempotencyKey: options.idempotencyKey }
1398
+ });
1399
+ }
1400
+ }
1401
+ };
1402
+ }
1403
+
1404
+ // src/resources/event-triggers.ts
1405
+ function makeEventTriggersClient(transport) {
1406
+ return {
1407
+ async register(input, options) {
1408
+ return transport.request({
1409
+ method: "POST",
1410
+ path: "/v1/event-triggers",
1411
+ body: input,
1412
+ ...options?.idempotencyKey !== void 0 && { idempotencyKey: options.idempotencyKey }
1413
+ });
1414
+ },
1415
+ async list(filter) {
1416
+ return transport.request({
1417
+ method: "GET",
1418
+ path: "/v1/event-triggers",
1419
+ query: {
1420
+ ...filter?.limit !== void 0 && { limit: filter.limit },
1421
+ ...filter?.cursor !== void 0 && { cursor: filter.cursor },
1422
+ ...filter?.status !== void 0 && { status: filter.status }
1423
+ }
1424
+ });
1425
+ },
1426
+ async get(triggerId) {
1427
+ return transport.request({
1428
+ method: "GET",
1429
+ path: `/v1/event-triggers/${encodeURIComponent(triggerId)}`
1430
+ });
1431
+ },
1432
+ async update(triggerId, input, options) {
1433
+ return transport.request({
1434
+ method: "PATCH",
1435
+ path: `/v1/event-triggers/${encodeURIComponent(triggerId)}`,
1436
+ body: input,
1437
+ ...options?.idempotencyKey !== void 0 && { idempotencyKey: options.idempotencyKey }
1438
+ });
1439
+ },
1440
+ async pause(triggerId, options) {
1441
+ return transport.request({
1442
+ method: "POST",
1443
+ path: `/v1/event-triggers/${encodeURIComponent(triggerId)}/pause`,
1444
+ ...options?.idempotencyKey !== void 0 && { idempotencyKey: options.idempotencyKey }
1445
+ });
1446
+ },
1447
+ async resume(triggerId, options) {
1448
+ return transport.request({
1449
+ method: "POST",
1450
+ path: `/v1/event-triggers/${encodeURIComponent(triggerId)}/resume`,
1451
+ ...options?.idempotencyKey !== void 0 && { idempotencyKey: options.idempotencyKey }
1452
+ });
1453
+ },
1454
+ async unregister(triggerId, options) {
1455
+ return transport.request({
1456
+ method: "POST",
1457
+ path: `/v1/event-triggers/${encodeURIComponent(triggerId)}/unregister`,
1458
+ ...options?.idempotencyKey !== void 0 && { idempotencyKey: options.idempotencyKey }
1459
+ });
1460
+ }
1461
+ };
1462
+ }
1463
+
1464
+ // src/resources/events.ts
1465
+ function makeEventsClient(_transport) {
1466
+ return {
1467
+ async emit(_spec) {
1468
+ throw new KindgiApiError(
1469
+ notYetWired(
1470
+ "events.emit",
1471
+ "no POST /v1/events route on the API \u2014 outbound event-emit surface has not landed (runtime event-bus primitive is live; HTTP surface pending)"
1472
+ )
1473
+ );
1474
+ },
1475
+ async subscribe(_spec) {
1476
+ throw new KindgiApiError(
1477
+ notYetWired(
1478
+ "events.subscribe",
1479
+ "no POST /v1/events/subscriptions route on the API \u2014 subscription registration surface has not landed"
1480
+ )
1481
+ );
1482
+ },
1483
+ subscriptions: {
1484
+ async list() {
1485
+ throw new KindgiApiError(
1486
+ notYetWired(
1487
+ "events.subscriptions.list",
1488
+ "no GET /v1/events/subscriptions route on the API"
1489
+ )
1490
+ );
1491
+ },
1492
+ async get(_id) {
1493
+ throw new KindgiApiError(
1494
+ notYetWired(
1495
+ "events.subscriptions.get",
1496
+ "no GET /v1/events/subscriptions/{id} route on the API"
1497
+ )
1498
+ );
1499
+ },
1500
+ async delete(_id) {
1501
+ throw new KindgiApiError(
1502
+ notYetWired(
1503
+ "events.subscriptions.delete",
1504
+ "no DELETE /v1/events/subscriptions/{id} route on the API"
1505
+ )
1506
+ );
1507
+ }
1508
+ },
1509
+ stream(_subscriptionId) {
1510
+ const iter = {
1511
+ // eslint-disable-next-line @typescript-eslint/require-await
1512
+ [Symbol.asyncIterator]() {
1513
+ return {
1514
+ next() {
1515
+ return Promise.reject(
1516
+ new KindgiApiError(
1517
+ notYetWired(
1518
+ "events.stream",
1519
+ "no GET /v1/events/subscriptions/{id}/stream route on the API \u2014 subscription-scoped SSE surface has not landed (runtime event bus is live; SDK-side SSE reader is ready via readSse; HTTP route pending). Use client.runs.stream(runId) for live run-scoped events."
1520
+ )
1521
+ )
1522
+ );
1523
+ }
1524
+ };
1525
+ }
1526
+ };
1527
+ return iter;
1528
+ },
1529
+ async query(_filter) {
1530
+ throw new KindgiApiError(
1531
+ notYetWired(
1532
+ "events.query",
1533
+ "no GET /v1/events route on the API \u2014 event-history query surface has not landed"
1534
+ )
1535
+ );
1536
+ }
1537
+ };
1538
+ }
1539
+
1540
+ // src/resources/flows.ts
1541
+ function makeFlowsClient(transport) {
1542
+ return {
1543
+ async define(flow, options) {
1544
+ const result = await transport.request({
1545
+ method: "POST",
1546
+ path: "/v1/flows",
1547
+ body: { ...flow, projectId: options.projectId },
1548
+ ...options.idempotencyKey !== void 0 && {
1549
+ idempotencyKey: options.idempotencyKey
1550
+ }
1551
+ });
1552
+ return {
1553
+ flowId: result.flowId,
1554
+ version: result.version
1555
+ };
1556
+ },
1557
+ async validate(_graph) {
1558
+ throw new KindgiApiError(
1559
+ notYetWired(
1560
+ "flows.validate",
1561
+ "no POST /v1/flows/validate route on the API \u2014 validation is inline on define() (server returns 400 validation-failed)"
1562
+ )
1563
+ );
1564
+ },
1565
+ async get(id) {
1566
+ return transport.request({
1567
+ method: "GET",
1568
+ path: `/v1/flows/${encodeURIComponent(id)}`
1569
+ });
1570
+ },
1571
+ async list(filter) {
1572
+ const page = await transport.request({
1573
+ method: "GET",
1574
+ path: "/v1/flows",
1575
+ query: {
1576
+ ...filter?.limit !== void 0 && { limit: filter.limit },
1577
+ ...filter?.cursor !== void 0 && { cursor: filter.cursor },
1578
+ ...filter?.name !== void 0 && { name: filter.name }
1579
+ }
1580
+ });
1581
+ return {
1582
+ items: page.data,
1583
+ ...page.nextCursor !== void 0 && {
1584
+ nextCursor: page.nextCursor
1585
+ }
1586
+ };
1587
+ },
1588
+ async versions(id, filter) {
1589
+ const page = await transport.request({
1590
+ method: "GET",
1591
+ path: `/v1/flows/${encodeURIComponent(id)}/versions`,
1592
+ query: {
1593
+ ...filter?.limit !== void 0 && { limit: filter.limit },
1594
+ ...filter?.cursor !== void 0 && { cursor: filter.cursor }
1595
+ }
1596
+ });
1597
+ return {
1598
+ items: page.data,
1599
+ ...page.nextCursor !== void 0 && {
1600
+ nextCursor: page.nextCursor
1601
+ }
1602
+ };
1603
+ },
1604
+ async getVersion(id, version) {
1605
+ return transport.request({
1606
+ method: "GET",
1607
+ path: `/v1/flows/${encodeURIComponent(id)}/versions/${encodeURIComponent(version)}`
1608
+ });
1609
+ },
1610
+ async delete(id, version, options) {
1611
+ await transport.request({
1612
+ method: "POST",
1613
+ path: `/v1/flows/${encodeURIComponent(id)}/versions/${encodeURIComponent(version)}/unregister`,
1614
+ body: {},
1615
+ discardResponse: true,
1616
+ ...options?.idempotencyKey !== void 0 && {
1617
+ idempotencyKey: options.idempotencyKey
1618
+ }
1619
+ });
1620
+ },
1621
+ async reinstateVersion(id, version, options) {
1622
+ const wire = await transport.request({
1623
+ method: "POST",
1624
+ path: `/v1/flows/${encodeURIComponent(id)}/versions/${encodeURIComponent(version)}/reinstate`,
1625
+ ...options?.idempotencyKey !== void 0 && {
1626
+ idempotencyKey: options.idempotencyKey
1627
+ }
1628
+ });
1629
+ return {
1630
+ flowId: wire.flowId,
1631
+ version: wire.version,
1632
+ wasTombstoned: wire.wasTombstoned
1633
+ };
1634
+ }
1635
+ };
1636
+ }
1637
+
1638
+ // src/resources/guardrails.ts
1639
+ function makeGuardrailsClient(transport) {
1640
+ return {
1641
+ async author(spec, options) {
1642
+ return transport.request({
1643
+ method: "POST",
1644
+ path: "/v1/guardrails",
1645
+ body: { ...spec, projectId: options.projectId },
1646
+ ...options.idempotencyKey !== void 0 && { idempotencyKey: options.idempotencyKey }
1647
+ });
1648
+ },
1649
+ async get(id) {
1650
+ return transport.request({
1651
+ method: "GET",
1652
+ path: `/v1/guardrails/${encodeURIComponent(id)}`
1653
+ });
1654
+ },
1655
+ async list(filter) {
1656
+ const page = await transport.request({
1657
+ method: "GET",
1658
+ path: "/v1/guardrails",
1659
+ query: {
1660
+ ...filter?.limit !== void 0 && { limit: filter.limit },
1661
+ ...filter?.cursor !== void 0 && { cursor: filter.cursor },
1662
+ ...filter?.name !== void 0 && { name: filter.name }
1663
+ }
1664
+ });
1665
+ return {
1666
+ items: page.data,
1667
+ ...page.nextCursor !== void 0 && {
1668
+ nextCursor: page.nextCursor
1669
+ }
1670
+ };
1671
+ },
1672
+ async delete(id, options) {
1673
+ return transport.request({
1674
+ method: "POST",
1675
+ path: `/v1/guardrails/${encodeURIComponent(id)}/unregister`,
1676
+ body: {},
1677
+ ...options?.idempotencyKey !== void 0 && { idempotencyKey: options.idempotencyKey }
1678
+ });
1679
+ },
1680
+ async versions(_id) {
1681
+ throw new KindgiApiError(
1682
+ notYetWired(
1683
+ "guardrails.versions",
1684
+ "no GET /v1/guardrails/{id}/versions route on the API \u2014 wire treats guardrails as flat metadata registrations, no version history"
1685
+ )
1686
+ );
1687
+ },
1688
+ async builtIns() {
1689
+ throw new KindgiApiError(
1690
+ notYetWired(
1691
+ "guardrails.builtIns",
1692
+ "no GET /v1/guardrails/built-ins route on the API \u2014 built-in catalog is a runtime discovery primitive without an HTTP surface yet"
1693
+ )
1694
+ );
1695
+ },
1696
+ async evaluate(_id, _trace) {
1697
+ throw new KindgiApiError(
1698
+ notYetWired(
1699
+ "guardrails.evaluate",
1700
+ "no POST /v1/guardrails/{id}/evaluate route on the API \u2014 direct evaluation is a runtime primitive; standalone HTTP evaluation has no wire surface yet"
1701
+ )
1702
+ );
1703
+ }
1704
+ };
1705
+ }
1706
+
1707
+ // src/resources/identity.ts
1708
+ function makeIdentityClient(transport) {
1709
+ const seg = (s) => encodeURIComponent(s);
1710
+ return {
1711
+ async whoami() {
1712
+ return transport.request({
1713
+ method: "GET",
1714
+ path: "/v1/identity/whoami"
1715
+ });
1716
+ },
1717
+ users: {
1718
+ async list(filter) {
1719
+ return transport.request({
1720
+ method: "GET",
1721
+ path: "/v1/identity/users",
1722
+ query: {
1723
+ ...filter?.limit !== void 0 && { limit: filter.limit },
1724
+ ...filter?.cursor !== void 0 && { cursor: filter.cursor },
1725
+ ...filter?.query !== void 0 && { query: filter.query }
1726
+ }
1727
+ });
1728
+ },
1729
+ async get(userId) {
1730
+ return transport.request({
1731
+ method: "GET",
1732
+ path: `/v1/identity/users/${seg(userId)}`
1733
+ });
1734
+ },
1735
+ async listSessions(userId) {
1736
+ return transport.request({
1737
+ method: "GET",
1738
+ path: `/v1/identity/users/${seg(userId)}/sessions`
1739
+ });
1740
+ },
1741
+ async revokeSessions(userId, options) {
1742
+ return transport.request({
1743
+ method: "POST",
1744
+ path: `/v1/identity/users/${seg(userId)}/revoke-sessions`,
1745
+ ...options?.idempotencyKey !== void 0 && { idempotencyKey: options.idempotencyKey }
1746
+ });
1747
+ }
1748
+ }
1749
+ };
1750
+ }
1751
+
1752
+ // src/resources/mcp.ts
1753
+ function makeMcpClient(transport) {
1754
+ return {
1755
+ endpoints: {
1756
+ async list(filter) {
1757
+ const page = await transport.request({
1758
+ method: "GET",
1759
+ path: "/v1/mcp/endpoints",
1760
+ query: {
1761
+ ...filter?.limit !== void 0 && { limit: filter.limit },
1762
+ ...filter?.cursor !== void 0 && { cursor: filter.cursor },
1763
+ ...filter?.transport !== void 0 && { transport: filter.transport }
1764
+ }
1765
+ });
1766
+ return {
1767
+ items: page.data,
1768
+ ...page.nextCursor !== void 0 && {
1769
+ nextCursor: page.nextCursor
1770
+ }
1771
+ };
1772
+ },
1773
+ async register(input, options) {
1774
+ const { scope, ...endpoint } = input;
1775
+ return transport.request({
1776
+ method: "POST",
1777
+ path: "/v1/mcp/endpoints",
1778
+ // The scope travels as the `scopeKind` + `scopeId` pair.
1779
+ body: { ...endpoint, ...scopeToQuery(scope) },
1780
+ ...options?.idempotencyKey !== void 0 && {
1781
+ idempotencyKey: options.idempotencyKey
1782
+ }
1783
+ });
1784
+ },
1785
+ async get(endpointId) {
1786
+ return transport.request({
1787
+ method: "GET",
1788
+ path: `/v1/mcp/endpoints/${encodeURIComponent(endpointId)}`
1789
+ });
1790
+ },
1791
+ async unregister(endpointId, options) {
1792
+ await transport.request({
1793
+ method: "POST",
1794
+ path: `/v1/mcp/endpoints/${encodeURIComponent(endpointId)}/unregister`,
1795
+ body: {},
1796
+ discardResponse: true,
1797
+ ...options?.idempotencyKey !== void 0 && {
1798
+ idempotencyKey: options.idempotencyKey
1799
+ }
1800
+ });
1801
+ },
1802
+ resources: {
1803
+ async list(endpointId) {
1804
+ return transport.request({
1805
+ method: "GET",
1806
+ path: `/v1/mcp/endpoints/${encodeURIComponent(endpointId)}/resources`
1807
+ });
1808
+ },
1809
+ async read(endpointId, uri) {
1810
+ return transport.request({
1811
+ method: "GET",
1812
+ path: `/v1/mcp/endpoints/${encodeURIComponent(endpointId)}/resources/${encodeURIComponent(uri)}`
1813
+ });
1814
+ }
1815
+ },
1816
+ prompts: {
1817
+ async list(endpointId) {
1818
+ return transport.request({
1819
+ method: "GET",
1820
+ path: `/v1/mcp/endpoints/${encodeURIComponent(endpointId)}/prompts`
1821
+ });
1822
+ },
1823
+ async get(endpointId, name, args, options) {
1824
+ return transport.request({
1825
+ method: "POST",
1826
+ path: `/v1/mcp/endpoints/${encodeURIComponent(endpointId)}/prompts/${encodeURIComponent(name)}`,
1827
+ body: args ?? {},
1828
+ ...options?.idempotencyKey !== void 0 && {
1829
+ idempotencyKey: options.idempotencyKey
1830
+ }
1831
+ });
1832
+ }
1833
+ }
1834
+ },
1835
+ async serverInfo() {
1836
+ throw new KindgiApiError(
1837
+ notYetWired(
1838
+ "mcp.serverInfo",
1839
+ "no GET /v1/mcp/server-info route on the API \u2014 inbound MCP-server surface (exposing the OS via MCP) not routed yet"
1840
+ )
1841
+ );
1842
+ },
1843
+ async tools() {
1844
+ throw new KindgiApiError(
1845
+ notYetWired(
1846
+ "mcp.tools",
1847
+ "no GET /v1/mcp/tools route on the API \u2014 use client.tools.list() (wire Tool IS the MCP manifest)"
1848
+ )
1849
+ );
1850
+ },
1851
+ async agents() {
1852
+ throw new KindgiApiError(
1853
+ notYetWired(
1854
+ "mcp.agents",
1855
+ "no GET /v1/mcp/agents route on the API \u2014 inbound-server exposure of agents not routed yet"
1856
+ )
1857
+ );
1858
+ },
1859
+ async invokeTool(_name, _input) {
1860
+ throw new KindgiApiError(
1861
+ notYetWired(
1862
+ "mcp.invokeTool",
1863
+ "no POST /v1/mcp/invoke-tool route on the API \u2014 MCP-transport tool invocation not surfaced yet"
1864
+ )
1865
+ );
1866
+ },
1867
+ async invokeAgent(_agentId, _input) {
1868
+ throw new KindgiApiError(
1869
+ notYetWired(
1870
+ "mcp.invokeAgent",
1871
+ "no POST /v1/mcp/invoke-agent route on the API \u2014 use client.runs.start({ agent }) for agent invocation"
1872
+ )
1873
+ );
1874
+ }
1875
+ };
1876
+ }
1877
+
1878
+ // src/resources/memory.ts
1879
+ function makeMemoryClient(transport) {
1880
+ return {
1881
+ facts: {
1882
+ async write(input, options) {
1883
+ return transport.request({
1884
+ method: "POST",
1885
+ path: "/v1/memory/facts",
1886
+ body: input,
1887
+ ...options?.idempotencyKey !== void 0 && {
1888
+ idempotencyKey: options.idempotencyKey
1889
+ }
1890
+ });
1891
+ },
1892
+ async read(id) {
1893
+ return transport.request({
1894
+ method: "GET",
1895
+ path: `/v1/memory/facts/${encodeURIComponent(id)}`
1896
+ });
1897
+ },
1898
+ async list(filter) {
1899
+ const page = await transport.request({
1900
+ method: "GET",
1901
+ path: "/v1/memory/facts",
1902
+ query: {
1903
+ ...filter?.limit !== void 0 && { limit: filter.limit },
1904
+ ...filter?.cursor !== void 0 && { cursor: filter.cursor },
1905
+ ...filter?.type !== void 0 && { type: filter.type },
1906
+ ...filter?.scope !== void 0 && { scope: JSON.stringify(filter.scope) }
1907
+ }
1908
+ });
1909
+ return {
1910
+ items: page.data,
1911
+ ...page.nextCursor !== void 0 && {
1912
+ nextCursor: page.nextCursor
1913
+ }
1914
+ };
1915
+ },
1916
+ async delete(id, options) {
1917
+ return transport.request({
1918
+ method: "POST",
1919
+ path: `/v1/memory/facts/${encodeURIComponent(id)}/supersede`,
1920
+ body: {},
1921
+ ...options?.idempotencyKey !== void 0 && {
1922
+ idempotencyKey: options.idempotencyKey
1923
+ }
1924
+ });
1925
+ }
1926
+ },
1927
+ logs: {
1928
+ async append(_input) {
1929
+ throw new KindgiApiError(
1930
+ notYetWired(
1931
+ "memory.logs.append",
1932
+ "no POST /v1/memory/logs route on the API \u2014 append-only log HTTP surface has not landed (runtime primitive exists in-process)"
1933
+ )
1934
+ );
1935
+ },
1936
+ async list(_filter) {
1937
+ throw new KindgiApiError(
1938
+ notYetWired(
1939
+ "memory.logs.list",
1940
+ "no GET /v1/memory/logs route on the API \u2014 log HTTP surface has not landed"
1941
+ )
1942
+ );
1943
+ },
1944
+ async verify(_entries) {
1945
+ throw new KindgiApiError(
1946
+ notYetWired(
1947
+ "memory.logs.verify",
1948
+ "no POST /v1/memory/logs/verify route on the API \u2014 log HTTP surface has not landed; verification is client-side callable in principle but requires logs.list first"
1949
+ )
1950
+ );
1951
+ }
1952
+ },
1953
+ async search(input) {
1954
+ const envelope = await transport.request({
1955
+ method: "POST",
1956
+ path: "/v1/memory/retrieve",
1957
+ body: input
1958
+ });
1959
+ return envelope.results;
1960
+ }
1961
+ };
1962
+ }
1963
+
1964
+ // src/resources/observations.ts
1965
+ function makeObservationsClient(transport) {
1966
+ return {
1967
+ async recordRun(_runId) {
1968
+ throw new KindgiApiError(
1969
+ notYetWired(
1970
+ "observations.recordRun",
1971
+ "no POST /v1/observations route on the API \u2014 supervisor runtime records observations server-internally"
1972
+ )
1973
+ );
1974
+ },
1975
+ async query(filter) {
1976
+ const page = await transport.request({
1977
+ method: "GET",
1978
+ path: "/v1/observations",
1979
+ query: {
1980
+ ...filter?.limit !== void 0 && { limit: filter.limit },
1981
+ ...filter?.cursor !== void 0 && { cursor: filter.cursor },
1982
+ ...filter?.status !== void 0 && { status: filter.status },
1983
+ ...filter?.supervisorId !== void 0 && {
1984
+ supervisorId: filter.supervisorId
1985
+ },
1986
+ ...filter?.agentId !== void 0 && { agentId: filter.agentId },
1987
+ ...filter?.agentVersion !== void 0 && { agentVersion: filter.agentVersion },
1988
+ ...filter?.conversationId !== void 0 && {
1989
+ conversationId: filter.conversationId
1990
+ },
1991
+ ...filter?.since !== void 0 && { since: filter.since },
1992
+ ...filter?.until !== void 0 && { until: filter.until }
1993
+ }
1994
+ });
1995
+ return {
1996
+ items: page.data,
1997
+ ...page.nextCursor !== void 0 && { nextCursor: page.nextCursor }
1998
+ };
1999
+ },
2000
+ async patterns(_input) {
2001
+ throw new KindgiApiError(
2002
+ notYetWired(
2003
+ "observations.patterns",
2004
+ "no /v1/observations/patterns route on the API \u2014 aggregation surface unrouted"
2005
+ )
2006
+ );
2007
+ }
2008
+ };
2009
+ }
2010
+
2011
+ // src/resources/orgs.ts
2012
+ function makeOrgsClient(transport) {
2013
+ const seg = (s) => encodeURIComponent(s);
2014
+ return {
2015
+ async create(input, options) {
2016
+ return transport.request({
2017
+ method: "POST",
2018
+ path: "/v1/orgs",
2019
+ body: input,
2020
+ ...options?.idempotencyKey !== void 0 && { idempotencyKey: options.idempotencyKey }
2021
+ });
2022
+ },
2023
+ async list(filter) {
2024
+ return transport.request({
2025
+ method: "GET",
2026
+ path: "/v1/orgs",
2027
+ query: {
2028
+ ...filter?.limit !== void 0 && { limit: filter.limit },
2029
+ ...filter?.cursor !== void 0 && { cursor: filter.cursor }
2030
+ }
2031
+ });
2032
+ },
2033
+ async get(orgId) {
2034
+ return transport.request({
2035
+ method: "GET",
2036
+ path: `/v1/orgs/${seg(orgId)}`
2037
+ });
2038
+ },
2039
+ async update(orgId, input, options) {
2040
+ return transport.request({
2041
+ method: "PATCH",
2042
+ path: `/v1/orgs/${seg(orgId)}`,
2043
+ body: input,
2044
+ ...options?.idempotencyKey !== void 0 && { idempotencyKey: options.idempotencyKey }
2045
+ });
2046
+ },
2047
+ async delete(orgId) {
2048
+ return transport.request({
2049
+ method: "DELETE",
2050
+ path: `/v1/orgs/${seg(orgId)}`,
2051
+ discardResponse: true
2052
+ });
2053
+ }
2054
+ };
2055
+ }
2056
+
2057
+ // src/resources/packs.ts
2058
+ var REASON_NO_PACK_API = "the API has no pack routes or wire schemas (Pack / InstalledPack / PackInstallInput) yet";
2059
+ function makePacksClient(_transport) {
2060
+ return {
2061
+ async install(_input) {
2062
+ throw new KindgiApiError(notYetWired("packs.install", REASON_NO_PACK_API));
2063
+ },
2064
+ async installed(_filter) {
2065
+ throw new KindgiApiError(notYetWired("packs.installed", REASON_NO_PACK_API));
2066
+ },
2067
+ async get(_id) {
2068
+ throw new KindgiApiError(notYetWired("packs.get", REASON_NO_PACK_API));
2069
+ },
2070
+ async versions(_id) {
2071
+ throw new KindgiApiError(notYetWired("packs.versions", REASON_NO_PACK_API));
2072
+ },
2073
+ async configure(_id, _config) {
2074
+ throw new KindgiApiError(notYetWired("packs.configure", REASON_NO_PACK_API));
2075
+ },
2076
+ async disable(_id) {
2077
+ throw new KindgiApiError(notYetWired("packs.disable", REASON_NO_PACK_API));
2078
+ },
2079
+ async enable(_id) {
2080
+ throw new KindgiApiError(notYetWired("packs.enable", REASON_NO_PACK_API));
2081
+ },
2082
+ async upgrade(_id, _newVersion) {
2083
+ throw new KindgiApiError(notYetWired("packs.upgrade", REASON_NO_PACK_API));
2084
+ },
2085
+ async uninstall(_id) {
2086
+ throw new KindgiApiError(notYetWired("packs.uninstall", REASON_NO_PACK_API));
2087
+ },
2088
+ registry: {
2089
+ async browse(_filter) {
2090
+ throw new KindgiApiError(
2091
+ notYetWired(
2092
+ "packs.registry.browse",
2093
+ "v2 pack registry (public + private catalog federation) builds on the pack authoring API \u2014 not implemented yet"
2094
+ )
2095
+ );
2096
+ },
2097
+ async configured() {
2098
+ throw new KindgiApiError(
2099
+ notYetWired(
2100
+ "packs.registry.configured",
2101
+ "v2 pack registry (public + private catalog federation) builds on the pack authoring API \u2014 not implemented yet"
2102
+ )
2103
+ );
2104
+ }
2105
+ }
2106
+ };
2107
+ }
2108
+
2109
+ // src/resources/policies.ts
2110
+ function makePoliciesClient(transport) {
2111
+ return {
2112
+ async author(spec, options) {
2113
+ const result = await transport.request({
2114
+ method: "POST",
2115
+ path: "/v1/policies",
2116
+ body: {
2117
+ id: spec.id,
2118
+ version: spec.version,
2119
+ kind: spec.kind,
2120
+ ...spec.description !== void 0 && { description: spec.description },
2121
+ spec: spec.spec
2122
+ },
2123
+ ...options?.idempotencyKey !== void 0 && {
2124
+ idempotencyKey: options.idempotencyKey
2125
+ }
2126
+ });
2127
+ return {
2128
+ policyId: result.policyId,
2129
+ version: result.version
2130
+ };
2131
+ },
2132
+ async get(id) {
2133
+ return transport.request({
2134
+ method: "GET",
2135
+ path: `/v1/policies/${encodeURIComponent(id)}`
2136
+ });
2137
+ },
2138
+ async list(filter) {
2139
+ const page = await transport.request({
2140
+ method: "GET",
2141
+ path: "/v1/policies",
2142
+ query: {
2143
+ ...filter?.limit !== void 0 && { limit: filter.limit },
2144
+ ...filter?.cursor !== void 0 && { cursor: filter.cursor },
2145
+ ...filter?.kind !== void 0 && { kind: filter.kind },
2146
+ ...filter?.name !== void 0 && { name: filter.name }
2147
+ }
2148
+ });
2149
+ return {
2150
+ items: page.data,
2151
+ ...page.nextCursor !== void 0 && {
2152
+ nextCursor: page.nextCursor
2153
+ }
2154
+ };
2155
+ },
2156
+ async versions(id, filter) {
2157
+ const page = await transport.request({
2158
+ method: "GET",
2159
+ path: `/v1/policies/${encodeURIComponent(id)}/versions`,
2160
+ query: {
2161
+ ...filter?.limit !== void 0 && { limit: filter.limit },
2162
+ ...filter?.cursor !== void 0 && { cursor: filter.cursor },
2163
+ ...filter?.includeTombstoned === true && { includeTombstoned: "true" }
2164
+ }
2165
+ });
2166
+ return {
2167
+ items: page.data,
2168
+ ...page.nextCursor !== void 0 && {
2169
+ nextCursor: page.nextCursor
2170
+ }
2171
+ };
2172
+ },
2173
+ async getVersion(id, version) {
2174
+ return transport.request({
2175
+ method: "GET",
2176
+ path: `/v1/policies/${encodeURIComponent(id)}/versions/${encodeURIComponent(version)}`
2177
+ });
2178
+ },
2179
+ async unregister(id, version, options) {
2180
+ await transport.request({
2181
+ method: "POST",
2182
+ path: `/v1/policies/${encodeURIComponent(id)}/versions/${encodeURIComponent(version)}/unregister`,
2183
+ body: {},
2184
+ discardResponse: true,
2185
+ ...options?.idempotencyKey !== void 0 && {
2186
+ idempotencyKey: options.idempotencyKey
2187
+ }
2188
+ });
2189
+ },
2190
+ async reinstateVersion(id, version, options) {
2191
+ const wire = await transport.request({
2192
+ method: "POST",
2193
+ path: `/v1/policies/${encodeURIComponent(id)}/versions/${encodeURIComponent(version)}/reinstate`,
2194
+ ...options?.idempotencyKey !== void 0 && {
2195
+ idempotencyKey: options.idempotencyKey
2196
+ }
2197
+ });
2198
+ return {
2199
+ policyId: wire.policyId,
2200
+ version: wire.version,
2201
+ wasTombstoned: wire.wasTombstoned
2202
+ };
2203
+ },
2204
+ async activate(_id) {
2205
+ throw new KindgiApiError(
2206
+ notYetWired(
2207
+ "policies.activate",
2208
+ "no POST /v1/policies/{policyId}/activate route on the API \u2014 the wire has no draft/active lifecycle; policies are active at publish"
2209
+ )
2210
+ );
2211
+ },
2212
+ async evaluate(_id, _input) {
2213
+ throw new KindgiApiError(
2214
+ notYetWired(
2215
+ "policies.evaluate",
2216
+ "no POST /v1/policies/{policyId}/evaluate route on the API \u2014 evaluation is a runtime primitive without an SDK surface yet"
2217
+ )
2218
+ );
2219
+ }
2220
+ };
2221
+ }
2222
+
2223
+ // src/resources/projects.ts
2224
+ function makeProjectsClient(transport) {
2225
+ const seg = (s) => encodeURIComponent(s);
2226
+ return {
2227
+ async create(input, options) {
2228
+ return transport.request({
2229
+ method: "POST",
2230
+ path: "/v1/projects",
2231
+ body: input,
2232
+ ...options?.idempotencyKey !== void 0 && { idempotencyKey: options.idempotencyKey }
2233
+ });
2234
+ },
2235
+ async list(filter) {
2236
+ return transport.request({
2237
+ method: "GET",
2238
+ path: "/v1/projects",
2239
+ query: {
2240
+ ...filter?.limit !== void 0 && { limit: filter.limit },
2241
+ ...filter?.cursor !== void 0 && { cursor: filter.cursor }
2242
+ }
2243
+ });
2244
+ },
2245
+ async getDefault() {
2246
+ return transport.request({
2247
+ method: "GET",
2248
+ path: "/v1/projects/default"
2249
+ });
2250
+ },
2251
+ async get(projectId) {
2252
+ return transport.request({
2253
+ method: "GET",
2254
+ path: `/v1/projects/${seg(projectId)}`
2255
+ });
2256
+ },
2257
+ async update(projectId, input, options) {
2258
+ return transport.request({
2259
+ method: "PATCH",
2260
+ path: `/v1/projects/${seg(projectId)}`,
2261
+ body: input,
2262
+ ...options?.idempotencyKey !== void 0 && { idempotencyKey: options.idempotencyKey }
2263
+ });
2264
+ },
2265
+ async delete(projectId) {
2266
+ return transport.request({
2267
+ method: "DELETE",
2268
+ path: `/v1/projects/${seg(projectId)}`,
2269
+ discardResponse: true
2270
+ });
2271
+ },
2272
+ memberships: {
2273
+ async list(projectId, filter) {
2274
+ return transport.request({
2275
+ method: "GET",
2276
+ path: `/v1/projects/${seg(projectId)}/memberships`,
2277
+ query: {
2278
+ ...filter?.limit !== void 0 && { limit: filter.limit },
2279
+ ...filter?.cursor !== void 0 && { cursor: filter.cursor }
2280
+ }
2281
+ });
2282
+ },
2283
+ async add(projectId, input, options) {
2284
+ return transport.request({
2285
+ method: "POST",
2286
+ path: `/v1/projects/${seg(projectId)}/memberships`,
2287
+ body: input,
2288
+ ...options?.idempotencyKey !== void 0 && { idempotencyKey: options.idempotencyKey }
2289
+ });
2290
+ },
2291
+ async updateRole(projectId, userId, role, options) {
2292
+ return transport.request({
2293
+ method: "PATCH",
2294
+ path: `/v1/projects/${seg(projectId)}/memberships/${seg(userId)}`,
2295
+ body: { role },
2296
+ discardResponse: true,
2297
+ ...options?.idempotencyKey !== void 0 && { idempotencyKey: options.idempotencyKey }
2298
+ });
2299
+ },
2300
+ async remove(projectId, userId, options) {
2301
+ return transport.request({
2302
+ method: "DELETE",
2303
+ path: `/v1/projects/${seg(projectId)}/memberships/${seg(userId)}`,
2304
+ discardResponse: true,
2305
+ ...options?.idempotencyKey !== void 0 && { idempotencyKey: options.idempotencyKey }
2306
+ });
2307
+ }
2308
+ }
2309
+ };
2310
+ }
2311
+
2312
+ // src/resources/provenance.ts
2313
+ function makeProvenanceClient(transport) {
2314
+ return {
2315
+ async get(runId) {
2316
+ return transport.request({
2317
+ method: "GET",
2318
+ path: `/v1/provenance/${encodeURIComponent(runId)}`
2319
+ });
2320
+ },
2321
+ async query(filter) {
2322
+ const page = await transport.request({
2323
+ method: "GET",
2324
+ path: "/v1/provenance",
2325
+ query: {
2326
+ ...filter?.limit !== void 0 && { limit: filter.limit },
2327
+ ...filter?.cursor !== void 0 && { cursor: filter.cursor },
2328
+ ...filter?.runId !== void 0 && { runId: filter.runId },
2329
+ ...filter?.agentId !== void 0 && {
2330
+ agentId: filter.agentId
2331
+ },
2332
+ ...filter?.createdAfter !== void 0 && {
2333
+ createdAfter: filter.createdAfter
2334
+ }
2335
+ }
2336
+ });
2337
+ return {
2338
+ items: page.data,
2339
+ ...page.nextCursor !== void 0 && { nextCursor: page.nextCursor }
2340
+ };
2341
+ },
2342
+ async export(input) {
2343
+ return transport.request({
2344
+ method: "POST",
2345
+ path: `/v1/provenance/${encodeURIComponent(input.runId)}/export`,
2346
+ body: {
2347
+ signingKeyId: input.signingKeyId,
2348
+ ...input.includeMessages !== void 0 && { includeMessages: input.includeMessages }
2349
+ },
2350
+ ...input.idempotencyKey !== void 0 && { idempotencyKey: input.idempotencyKey }
2351
+ });
2352
+ },
2353
+ async verify(_exported, _publicKey) {
2354
+ throw new KindgiApiError(
2355
+ notYetWired(
2356
+ "provenance.verify",
2357
+ "client-side ed25519 verification requires the crypto module subpackage to be reachable from the SDK"
2358
+ )
2359
+ );
2360
+ }
2361
+ };
2362
+ }
2363
+
2364
+ // src/resources/providers.ts
2365
+ function makeProvidersClient(transport) {
2366
+ const seg = (s) => encodeURIComponent(s);
2367
+ return {
2368
+ async register(input, options) {
2369
+ return transport.request({
2370
+ method: "POST",
2371
+ path: "/v1/providers",
2372
+ body: input,
2373
+ ...options?.idempotencyKey !== void 0 && { idempotencyKey: options.idempotencyKey }
2374
+ });
2375
+ },
2376
+ async list(filter) {
2377
+ return transport.request({
2378
+ method: "GET",
2379
+ path: "/v1/providers",
2380
+ query: {
2381
+ ...filter?.limit !== void 0 && { limit: filter.limit },
2382
+ ...filter?.cursor !== void 0 && { cursor: filter.cursor },
2383
+ ...filter?.feature !== void 0 && { feature: filter.feature }
2384
+ }
2385
+ });
2386
+ },
2387
+ async get(providerId) {
2388
+ return transport.request({
2389
+ method: "GET",
2390
+ path: `/v1/providers/${seg(providerId)}`
2391
+ });
2392
+ },
2393
+ async capabilities(providerId) {
2394
+ return transport.request({
2395
+ method: "GET",
2396
+ path: `/v1/providers/${seg(providerId)}/capabilities`
2397
+ });
2398
+ },
2399
+ async unregister(providerId, options) {
2400
+ return transport.request({
2401
+ method: "POST",
2402
+ path: `/v1/providers/${seg(providerId)}/unregister`,
2403
+ ...options?.idempotencyKey !== void 0 && { idempotencyKey: options.idempotencyKey }
2404
+ });
2405
+ }
2406
+ };
2407
+ }
2408
+
2409
+ // src/run-follow.ts
2410
+ var MAX_REFRESHES_IN_A_ROW = 3;
2411
+ var TERMINAL_KINDS = /* @__PURE__ */ new Set([
2412
+ "run.completed",
2413
+ "run.failed",
2414
+ "run.cancelled"
2415
+ ]);
2416
+ async function* followRun(options) {
2417
+ const state = { lastEventId: void 0, refreshesInARow: 0 };
2418
+ while (options.signal?.aborted !== true) {
2419
+ const outcome = yield* followOnce(options, state);
2420
+ if (outcome === "terminal" || outcome === "aborted") return;
2421
+ if (outcome === "empty") await sleep(options.initialBackoffMs ?? 500, options.signal);
2422
+ }
2423
+ }
2424
+ async function* followOnce(options, state) {
2425
+ let received = 0;
2426
+ try {
2427
+ for await (const event of readSse(connectionOptions(options, state.lastEventId))) {
2428
+ received += 1;
2429
+ state.refreshesInARow = 0;
2430
+ if (event.id !== void 0) state.lastEventId = event.id;
2431
+ yield event.data;
2432
+ if (TERMINAL_KINDS.has(event.data.kind)) return "terminal";
2433
+ }
2434
+ } catch (error) {
2435
+ if (options.signal?.aborted === true) return "aborted";
2436
+ if (!await refreshAfter(error, options, state.refreshesInARow)) throw error;
2437
+ state.refreshesInARow += 1;
2438
+ return "refreshed";
2439
+ }
2440
+ return received === 0 ? "empty" : "closed";
2441
+ }
2442
+ function connectionOptions(options, lastEventId) {
2443
+ return {
2444
+ url: options.url,
2445
+ headers: options.headers,
2446
+ ...lastEventId !== void 0 && { lastEventId },
2447
+ ...options.fetchImpl !== void 0 && { fetchImpl: options.fetchImpl },
2448
+ ...options.signal !== void 0 && { signal: options.signal },
2449
+ ...options.initialBackoffMs !== void 0 && { initialBackoffMs: options.initialBackoffMs },
2450
+ ...options.maxBackoffMs !== void 0 && { maxBackoffMs: options.maxBackoffMs },
2451
+ // Client errors (401 expired token, 403, 404) don't heal by retrying.
2452
+ shouldRetry: (attempt, error) => !(error instanceof SseHttpError && error.status >= 400 && error.status < 500) && attempt < 10
2453
+ };
2454
+ }
2455
+ async function refreshAfter(error, options, refreshesInARow) {
2456
+ if (!(error instanceof SseHttpError) || error.status !== 401) return false;
2457
+ if (options.onUnauthorized === void 0 || refreshesInARow >= MAX_REFRESHES_IN_A_ROW) {
2458
+ return false;
2459
+ }
2460
+ return options.onUnauthorized();
2461
+ }
2462
+ function subscribeToRun(options) {
2463
+ let token = options.accessToken;
2464
+ const refresh = options.refreshAccessToken;
2465
+ return followRun({
2466
+ url: `${options.apiUrl.replace(/\/+$/, "")}/v1/runs/${encodeURIComponent(options.runId)}/progress/stream`,
2467
+ headers: () => ({ Authorization: `Bearer ${token}` }),
2468
+ ...refresh !== void 0 && {
2469
+ onUnauthorized: async () => {
2470
+ token = await refresh();
2471
+ return true;
2472
+ }
2473
+ },
2474
+ ...options.fetch !== void 0 && { fetchImpl: options.fetch },
2475
+ ...options.signal !== void 0 && { signal: options.signal }
2476
+ });
2477
+ }
2478
+
2479
+ // src/resources/runs.ts
2480
+ function makeRunsClient(transport) {
2481
+ return {
2482
+ async start(input) {
2483
+ const body = "agent" in input ? {
2484
+ agent: input.agent,
2485
+ ...input.agentVersion !== void 0 && { agentVersion: input.agentVersion },
2486
+ ...input.projectId !== void 0 && { projectId: input.projectId },
2487
+ input: input.input,
2488
+ ...input.options !== void 0 && { options: input.options }
2489
+ } : {
2490
+ flow: input.flow,
2491
+ ...input.flowVersion !== void 0 && { flowVersion: input.flowVersion },
2492
+ ...input.projectId !== void 0 && { projectId: input.projectId },
2493
+ input: input.input,
2494
+ ...input.options !== void 0 && { options: input.options }
2495
+ };
2496
+ return transport.request({
2497
+ method: "POST",
2498
+ path: "/v1/runs",
2499
+ body,
2500
+ ...input.idempotencyKey !== void 0 && {
2501
+ idempotencyKey: input.idempotencyKey
2502
+ }
2503
+ });
2504
+ },
2505
+ async dryRun(_input) {
2506
+ throw new KindgiApiError(
2507
+ notYetWired(
2508
+ "runs.dryRun",
2509
+ "no dedicated dry-run route on the API \u2014 use runs.start({ ..., options: { dryRun: true } }); the design-drafted DryRunResult (planned nodes / cost estimate) is a distinct preview primitive that has no wire route yet"
2510
+ )
2511
+ );
2512
+ },
2513
+ async progress(runId) {
2514
+ return transport.request({
2515
+ method: "GET",
2516
+ path: `/v1/runs/${encodeURIComponent(runId)}/progress`
2517
+ });
2518
+ },
2519
+ streamProgress(runId, options) {
2520
+ return followRun({
2521
+ url: `${transport.apiUrl}/v1/runs/${encodeURIComponent(runId)}/progress/stream`,
2522
+ headers: () => transport.authHeaders(),
2523
+ fetchImpl: transport.fetchImpl,
2524
+ ...options?.signal !== void 0 && { signal: options.signal },
2525
+ ...options?.initialBackoffMs !== void 0 && {
2526
+ initialBackoffMs: options.initialBackoffMs
2527
+ },
2528
+ ...options?.maxBackoffMs !== void 0 && {
2529
+ maxBackoffMs: options.maxBackoffMs
2530
+ }
2531
+ });
2532
+ },
2533
+ stream(runId, options) {
2534
+ return followRun({
2535
+ url: `${transport.apiUrl}/v1/runs/${encodeURIComponent(runId)}/stream`,
2536
+ headers: () => transport.authHeaders(),
2537
+ fetchImpl: transport.fetchImpl,
2538
+ ...options?.signal !== void 0 && { signal: options.signal },
2539
+ ...options?.initialBackoffMs !== void 0 && {
2540
+ initialBackoffMs: options.initialBackoffMs
2541
+ },
2542
+ ...options?.maxBackoffMs !== void 0 && {
2543
+ maxBackoffMs: options.maxBackoffMs
2544
+ }
2545
+ });
2546
+ },
2547
+ async get(runId) {
2548
+ return transport.request({
2549
+ method: "GET",
2550
+ path: `/v1/runs/${encodeURIComponent(runId)}`
2551
+ });
2552
+ },
2553
+ async resume(input) {
2554
+ return transport.request({
2555
+ method: "POST",
2556
+ path: `/v1/runs/${encodeURIComponent(input.runId)}/resume`,
2557
+ body: {
2558
+ waitpointId: input.waitpointId,
2559
+ ...input.value !== void 0 && { value: input.value }
2560
+ },
2561
+ ...input.idempotencyKey !== void 0 && {
2562
+ idempotencyKey: input.idempotencyKey
2563
+ }
2564
+ });
2565
+ },
2566
+ async cancel(runId, options) {
2567
+ return transport.request({
2568
+ method: "POST",
2569
+ path: `/v1/runs/${encodeURIComponent(runId)}/cancel`,
2570
+ body: {},
2571
+ ...options?.idempotencyKey !== void 0 && {
2572
+ idempotencyKey: options.idempotencyKey
2573
+ }
2574
+ });
2575
+ },
2576
+ async list(filter) {
2577
+ return transport.request({
2578
+ method: "GET",
2579
+ path: "/v1/runs",
2580
+ query: {
2581
+ ...filter?.limit !== void 0 && { limit: filter.limit },
2582
+ ...filter?.cursor !== void 0 && { cursor: filter.cursor },
2583
+ ...filter?.parentRunId !== void 0 && {
2584
+ parentRunId: filter.parentRunId
2585
+ },
2586
+ ...filter?.topLevel !== void 0 && { topLevel: String(filter.topLevel) },
2587
+ ...filter?.includeOutput === true && { include: "output" }
2588
+ }
2589
+ });
2590
+ },
2591
+ async journal(runId, filter) {
2592
+ return transport.request({
2593
+ method: "GET",
2594
+ path: `/v1/runs/${encodeURIComponent(runId)}/journal`,
2595
+ query: {
2596
+ ...filter?.limit !== void 0 && { limit: filter.limit },
2597
+ ...filter?.cursor !== void 0 && { cursor: filter.cursor },
2598
+ ...filter?.since !== void 0 && { since: filter.since }
2599
+ }
2600
+ });
2601
+ }
2602
+ };
2603
+ }
2604
+
2605
+ // src/resources/schedules.ts
2606
+ function makeSchedulesClient(transport) {
2607
+ return {
2608
+ async register(input, options) {
2609
+ return transport.request({
2610
+ method: "POST",
2611
+ path: "/v1/schedules",
2612
+ body: input,
2613
+ ...options?.idempotencyKey !== void 0 && { idempotencyKey: options.idempotencyKey }
2614
+ });
2615
+ },
2616
+ async list(filter) {
2617
+ return transport.request({
2618
+ method: "GET",
2619
+ path: "/v1/schedules",
2620
+ query: {
2621
+ ...filter?.limit !== void 0 && { limit: filter.limit },
2622
+ ...filter?.cursor !== void 0 && { cursor: filter.cursor },
2623
+ ...filter?.status !== void 0 && { status: filter.status }
2624
+ }
2625
+ });
2626
+ },
2627
+ async get(triggerId) {
2628
+ return transport.request({
2629
+ method: "GET",
2630
+ path: `/v1/schedules/${encodeURIComponent(triggerId)}`
2631
+ });
2632
+ },
2633
+ async update(triggerId, input, options) {
2634
+ return transport.request({
2635
+ method: "PATCH",
2636
+ path: `/v1/schedules/${encodeURIComponent(triggerId)}`,
2637
+ body: input,
2638
+ ...options?.idempotencyKey !== void 0 && { idempotencyKey: options.idempotencyKey }
2639
+ });
2640
+ },
2641
+ async pause(triggerId, options) {
2642
+ return transport.request({
2643
+ method: "POST",
2644
+ path: `/v1/schedules/${encodeURIComponent(triggerId)}/pause`,
2645
+ ...options?.idempotencyKey !== void 0 && { idempotencyKey: options.idempotencyKey }
2646
+ });
2647
+ },
2648
+ async resume(triggerId, options) {
2649
+ return transport.request({
2650
+ method: "POST",
2651
+ path: `/v1/schedules/${encodeURIComponent(triggerId)}/resume`,
2652
+ ...options?.idempotencyKey !== void 0 && { idempotencyKey: options.idempotencyKey }
2653
+ });
2654
+ },
2655
+ async unregister(triggerId, options) {
2656
+ return transport.request({
2657
+ method: "POST",
2658
+ path: `/v1/schedules/${encodeURIComponent(triggerId)}/unregister`,
2659
+ ...options?.idempotencyKey !== void 0 && { idempotencyKey: options.idempotencyKey }
2660
+ });
2661
+ }
2662
+ };
2663
+ }
2664
+
2665
+ // src/resources/secrets.ts
2666
+ var DEFAULT_INITIAL_DELAY_MS = 1e3;
2667
+ var DEFAULT_MAX_DELAY_MS = 3e4;
2668
+ var DEFAULT_CEILING_MS = 15 * 60 * 1e3;
2669
+ var defaultSleep = (ms) => new Promise((resolve) => {
2670
+ setTimeout(resolve, ms);
2671
+ });
2672
+ async function pollForRotationTerminal(transport, input, rotationId) {
2673
+ const overrides = input.pollingOverrides;
2674
+ const initialDelay = overrides?.initialDelayMs ?? DEFAULT_INITIAL_DELAY_MS;
2675
+ const maxDelay = overrides?.maxDelayMs ?? DEFAULT_MAX_DELAY_MS;
2676
+ const ceiling = overrides?.ceilingMs ?? DEFAULT_CEILING_MS;
2677
+ const sleep2 = overrides?.sleep ?? defaultSleep;
2678
+ const q = scopeToQuery(input.scope);
2679
+ const startedAt = Date.now();
2680
+ let nextDelay = initialDelay;
2681
+ const query = {
2682
+ envName: input.envName,
2683
+ scopeKind: q.scopeKind,
2684
+ ...q.scopeId !== void 0 && { scopeId: q.scopeId }
2685
+ };
2686
+ const statusPath = `/v1/secrets/${encodeURIComponent(input.name)}/rotations/${encodeURIComponent(rotationId)}`;
2687
+ for (; ; ) {
2688
+ await sleep2(nextDelay);
2689
+ const elapsed = Date.now() - startedAt;
2690
+ if (elapsed >= ceiling) {
2691
+ const statusUrl = `${transport.apiUrl}${statusPath}`;
2692
+ return { kind: "timeout", rotationId, statusUrl };
2693
+ }
2694
+ const status = await transport.request({
2695
+ method: "GET",
2696
+ path: statusPath,
2697
+ query
2698
+ });
2699
+ if (status.status === "succeeded") {
2700
+ if (status.newVersionId === void 0 || status.oldVersionId === void 0) {
2701
+ return {
2702
+ kind: "failed",
2703
+ error: "succeeded status returned without newVersionId/oldVersionId"
2704
+ };
2705
+ }
2706
+ return {
2707
+ kind: "ok",
2708
+ newVersionId: status.newVersionId,
2709
+ oldVersionId: status.oldVersionId
2710
+ };
2711
+ }
2712
+ if (status.status === "failed") {
2713
+ return { kind: "failed", error: status.error ?? "rotation failed" };
2714
+ }
2715
+ if (status.status === "cancelled") {
2716
+ return { kind: "cancelled" };
2717
+ }
2718
+ nextDelay = Math.min(nextDelay * 2, maxDelay);
2719
+ }
2720
+ }
2721
+ function makeSecretsClient(transport) {
2722
+ return {
2723
+ async list(input) {
2724
+ const q = scopeToQuery(input.scope);
2725
+ const page = await transport.request({
2726
+ method: "GET",
2727
+ path: "/v1/secrets",
2728
+ query: {
2729
+ envName: input.envName,
2730
+ scopeKind: q.scopeKind,
2731
+ ...q.scopeId !== void 0 && { scopeId: q.scopeId },
2732
+ ...input.cursor !== void 0 && { cursor: input.cursor },
2733
+ ...input.namePrefix !== void 0 && { namePrefix: input.namePrefix },
2734
+ ...input.includeRevoked === true && { includeRevoked: true },
2735
+ ...input.limit !== void 0 && { limit: input.limit }
2736
+ }
2737
+ });
2738
+ return {
2739
+ data: page.data,
2740
+ ...page.nextCursor !== void 0 && {
2741
+ nextCursor: page.nextCursor
2742
+ }
2743
+ };
2744
+ },
2745
+ async get(input) {
2746
+ const q = scopeToQuery(input.scope);
2747
+ try {
2748
+ return await transport.request({
2749
+ method: "GET",
2750
+ path: `/v1/secrets/${encodeURIComponent(input.name)}`,
2751
+ query: {
2752
+ envName: input.envName,
2753
+ scopeKind: q.scopeKind,
2754
+ ...q.scopeId !== void 0 && { scopeId: q.scopeId }
2755
+ }
2756
+ });
2757
+ } catch (err) {
2758
+ if (isKindOfNotFound(err, "secret-not-found", "secret")) return null;
2759
+ throw err;
2760
+ }
2761
+ },
2762
+ async getVersion(input) {
2763
+ const q = scopeToQuery(input.scope);
2764
+ try {
2765
+ return await transport.request({
2766
+ method: "GET",
2767
+ path: `/v1/secrets/${encodeURIComponent(input.name)}/versions/${input.versionId}`,
2768
+ query: {
2769
+ envName: input.envName,
2770
+ scopeKind: q.scopeKind,
2771
+ ...q.scopeId !== void 0 && { scopeId: q.scopeId }
2772
+ }
2773
+ });
2774
+ } catch (err) {
2775
+ if (isKindOfNotFound(err, "secret-version-not-found", "secret-version")) return null;
2776
+ throw err;
2777
+ }
2778
+ },
2779
+ async listVersions(input) {
2780
+ const q = scopeToQuery(input.scope);
2781
+ const page = await transport.request({
2782
+ method: "GET",
2783
+ path: `/v1/secrets/${encodeURIComponent(input.name)}/versions`,
2784
+ query: {
2785
+ envName: input.envName,
2786
+ scopeKind: q.scopeKind,
2787
+ ...q.scopeId !== void 0 && { scopeId: q.scopeId },
2788
+ ...input.cursor !== void 0 && { cursor: input.cursor },
2789
+ ...input.limit !== void 0 && { limit: input.limit }
2790
+ }
2791
+ });
2792
+ return {
2793
+ data: page.data,
2794
+ ...page.nextCursor !== void 0 && {
2795
+ nextCursor: page.nextCursor
2796
+ }
2797
+ };
2798
+ },
2799
+ async set(input) {
2800
+ try {
2801
+ const ok = await transport.request({
2802
+ method: "POST",
2803
+ path: "/v1/secrets",
2804
+ body: {
2805
+ scope: scopeForBody(input.scope),
2806
+ envName: input.envName,
2807
+ name: input.name,
2808
+ value: input.value,
2809
+ writeMode: input.writeMode,
2810
+ ...input.ifVersion !== void 0 && { ifVersion: input.ifVersion },
2811
+ ...input.rotationDueAt !== void 0 && { rotationDueAt: input.rotationDueAt },
2812
+ ...input.tags !== void 0 && { tags: input.tags }
2813
+ },
2814
+ ...input.idempotencyKey !== void 0 && {
2815
+ idempotencyKey: input.idempotencyKey
2816
+ }
2817
+ });
2818
+ return { kind: "ok", record: ok.record, versionId: ok.versionId };
2819
+ } catch (err) {
2820
+ const conflict = tryReadVersionConflict(err);
2821
+ if (conflict !== null) return conflict;
2822
+ throw err;
2823
+ }
2824
+ },
2825
+ async rotate(input) {
2826
+ const q = scopeToQuery(input.scope);
2827
+ const response = await transport.request({
2828
+ method: "POST",
2829
+ path: `/v1/secrets/${encodeURIComponent(input.name)}/rotate`,
2830
+ query: {
2831
+ envName: input.envName,
2832
+ scopeKind: q.scopeKind,
2833
+ ...q.scopeId !== void 0 && { scopeId: q.scopeId }
2834
+ },
2835
+ body: {
2836
+ scope: scopeForBody(input.scope),
2837
+ envName: input.envName,
2838
+ ...input.newValue !== void 0 && { newValue: input.newValue },
2839
+ ...input.revokeOldAfterMs !== void 0 && {
2840
+ revokeOldAfterMs: input.revokeOldAfterMs
2841
+ }
2842
+ },
2843
+ ...input.idempotencyKey !== void 0 && {
2844
+ idempotencyKey: input.idempotencyKey
2845
+ }
2846
+ });
2847
+ const mode = input.mode ?? "wait-for-complete";
2848
+ if (mode === "raw") {
2849
+ return { kind: "raw", response };
2850
+ }
2851
+ if (response.kind === "sync") {
2852
+ return {
2853
+ kind: "ok",
2854
+ newVersionId: response.newVersionId,
2855
+ oldVersionId: response.oldVersionId,
2856
+ ...response.oldVersionRevokedAt !== void 0 && {
2857
+ oldVersionRevokedAt: response.oldVersionRevokedAt
2858
+ }
2859
+ };
2860
+ }
2861
+ return pollForRotationTerminal(transport, input, response.rotationId);
2862
+ },
2863
+ async revoke(input) {
2864
+ const q = scopeToQuery(input.scope);
2865
+ return transport.request({
2866
+ method: "DELETE",
2867
+ path: `/v1/secrets/${encodeURIComponent(input.name)}`,
2868
+ query: {
2869
+ envName: input.envName,
2870
+ scopeKind: q.scopeKind,
2871
+ ...q.scopeId !== void 0 && { scopeId: q.scopeId },
2872
+ ...input.hard === true && { hard: true },
2873
+ ...input.reason !== void 0 && { reason: input.reason }
2874
+ }
2875
+ });
2876
+ },
2877
+ rotations: {
2878
+ async get(input) {
2879
+ const q = scopeToQuery(input.scope);
2880
+ return transport.request({
2881
+ method: "GET",
2882
+ path: `/v1/secrets/${encodeURIComponent(input.name)}/rotations/${encodeURIComponent(input.rotationId)}`,
2883
+ query: {
2884
+ envName: input.envName,
2885
+ scopeKind: q.scopeKind,
2886
+ ...q.scopeId !== void 0 && { scopeId: q.scopeId }
2887
+ }
2888
+ });
2889
+ },
2890
+ events(input, options) {
2891
+ const q = scopeToQuery(input.scope);
2892
+ const params = new URLSearchParams();
2893
+ params.set("envName", input.envName);
2894
+ params.set("scopeKind", q.scopeKind);
2895
+ if (q.scopeId !== void 0) params.set("scopeId", q.scopeId);
2896
+ const url = `${transport.apiUrl}/v1/secrets/${encodeURIComponent(input.name)}/rotations/${encodeURIComponent(input.rotationId)}/events?${params.toString()}`;
2897
+ const source = readSse({
2898
+ url,
2899
+ headers: transport.authHeaders(),
2900
+ fetchImpl: transport.fetchImpl,
2901
+ ...options?.signal !== void 0 && { signal: options.signal },
2902
+ ...options?.initialBackoffMs !== void 0 && {
2903
+ initialBackoffMs: options.initialBackoffMs
2904
+ },
2905
+ ...options?.maxBackoffMs !== void 0 && {
2906
+ maxBackoffMs: options.maxBackoffMs
2907
+ }
2908
+ });
2909
+ return unwrapSseData(source);
2910
+ }
2911
+ }
2912
+ };
2913
+ }
2914
+ function isKindOfNotFound(err, wireCode, resourceKind) {
2915
+ if (err === null || typeof err !== "object") return false;
2916
+ const asAny = err;
2917
+ const inner = asAny.error;
2918
+ if (inner === void 0) return false;
2919
+ const code = inner.code;
2920
+ const serverCode = inner.serverCode;
2921
+ if (code === wireCode) return true;
2922
+ if (code === "server" && serverCode === wireCode) return true;
2923
+ if (code === "not-found" && typeof inner.resource === "object" && inner.resource !== null && inner.resource.kind === resourceKind) {
2924
+ return true;
2925
+ }
2926
+ return false;
2927
+ }
2928
+ function tryReadVersionConflict(err) {
2929
+ if (err === null || typeof err !== "object") return null;
2930
+ const asAny = err;
2931
+ const inner = asAny.error;
2932
+ if (inner === void 0) return null;
2933
+ const isConflict = inner.code === "secret-write-conflict" || inner.code === "conflict" || inner.serverCode === "secret-write-conflict";
2934
+ if (!isConflict) return null;
2935
+ const fromFields = inner.fields?.currentVersion;
2936
+ const current = typeof fromFields === "number" ? fromFields : inner.currentVersion;
2937
+ if (typeof current !== "number") return null;
2938
+ return { kind: "version-conflict", currentVersion: current };
2939
+ }
2940
+
2941
+ // src/resources/signing-keys.ts
2942
+ function makeSigningKeysClient(transport) {
2943
+ return {
2944
+ async trust(input, options) {
2945
+ return transport.request({
2946
+ method: "POST",
2947
+ path: "/v1/signing-keys",
2948
+ body: input,
2949
+ ...options?.idempotencyKey !== void 0 && { idempotencyKey: options.idempotencyKey }
2950
+ });
2951
+ },
2952
+ async list(filter) {
2953
+ return transport.request({
2954
+ method: "GET",
2955
+ path: "/v1/signing-keys",
2956
+ query: {
2957
+ ...filter?.limit !== void 0 && { limit: filter.limit },
2958
+ ...filter?.cursor !== void 0 && { cursor: filter.cursor },
2959
+ ...filter?.includeRevoked === true && { includeRevoked: "true" },
2960
+ ...filter?.label !== void 0 && { label: filter.label }
2961
+ }
2962
+ });
2963
+ },
2964
+ async get(keyId) {
2965
+ return transport.request({
2966
+ method: "GET",
2967
+ path: `/v1/signing-keys/${encodeURIComponent(keyId)}`
2968
+ });
2969
+ },
2970
+ async revoke(keyId, input, options) {
2971
+ return transport.request({
2972
+ method: "POST",
2973
+ path: `/v1/signing-keys/${encodeURIComponent(keyId)}/revoke`,
2974
+ body: input ?? {},
2975
+ ...options?.idempotencyKey !== void 0 && { idempotencyKey: options.idempotencyKey }
2976
+ });
2977
+ }
2978
+ };
2979
+ }
2980
+
2981
+ // src/resources/supervisor.ts
2982
+ var REASON_NO_SUPERVISOR_CRUD = "no /v1/supervisors CRUD routes on the API \u2014 supervisor persistence is caller-plugged via SupervisorBinding at deployment boot (framework does NOT own supervisor storage; analogous to the identity-directory pattern for users)";
2983
+ function makeSupervisorClient(transport) {
2984
+ const supervisorHeader = (supervisorId) => ({
2985
+ "X-Supervisor-Id": supervisorId
2986
+ });
2987
+ return {
2988
+ async define(_spec) {
2989
+ throw new KindgiApiError(notYetWired("supervisor.define", REASON_NO_SUPERVISOR_CRUD));
2990
+ },
2991
+ async get(_id) {
2992
+ throw new KindgiApiError(notYetWired("supervisor.get", REASON_NO_SUPERVISOR_CRUD));
2993
+ },
2994
+ async list(_filter) {
2995
+ throw new KindgiApiError(notYetWired("supervisor.list", REASON_NO_SUPERVISOR_CRUD));
2996
+ },
2997
+ async versions(_id) {
2998
+ throw new KindgiApiError(notYetWired("supervisor.versions", REASON_NO_SUPERVISOR_CRUD));
2999
+ },
3000
+ async delete(_id) {
3001
+ throw new KindgiApiError(notYetWired("supervisor.delete", REASON_NO_SUPERVISOR_CRUD));
3002
+ },
3003
+ proposals: {
3004
+ async draft(input) {
3005
+ return transport.request({
3006
+ method: "POST",
3007
+ path: "/v1/proposals",
3008
+ headers: supervisorHeader(input.supervisorId),
3009
+ body: {
3010
+ agentId: input.agentId,
3011
+ agentVersion: input.agentVersion,
3012
+ tier: input.tier,
3013
+ change: input.change,
3014
+ patternRefs: input.patternRefs,
3015
+ hypothesis: input.hypothesis,
3016
+ proposerRuleId: input.proposerRuleId
3017
+ },
3018
+ ...input.idempotencyKey !== void 0 && { idempotencyKey: input.idempotencyKey }
3019
+ });
3020
+ },
3021
+ async list(input) {
3022
+ const page = await transport.request({
3023
+ method: "GET",
3024
+ path: "/v1/proposals",
3025
+ headers: supervisorHeader(input.supervisorId),
3026
+ query: {
3027
+ ...input.limit !== void 0 && { limit: input.limit },
3028
+ ...input.cursor !== void 0 && { cursor: input.cursor },
3029
+ ...input.status !== void 0 && { status: input.status },
3030
+ ...input.agentId !== void 0 && { agentId: input.agentId },
3031
+ ...input.tier !== void 0 && { tier: input.tier }
3032
+ }
3033
+ });
3034
+ return {
3035
+ items: page.data,
3036
+ ...page.nextCursor !== void 0 && {
3037
+ nextCursor: page.nextCursor
3038
+ }
3039
+ };
3040
+ },
3041
+ async get(supervisorId, id) {
3042
+ return transport.request({
3043
+ method: "GET",
3044
+ path: `/v1/proposals/${encodeURIComponent(id)}`,
3045
+ headers: supervisorHeader(supervisorId)
3046
+ });
3047
+ },
3048
+ async dryRun(supervisorId, id, input) {
3049
+ return transport.request({
3050
+ method: "POST",
3051
+ path: `/v1/proposals/${encodeURIComponent(id)}/dry-run`,
3052
+ headers: supervisorHeader(supervisorId),
3053
+ body: {
3054
+ datasetId: input.datasetId,
3055
+ datasetVersion: input.datasetVersion,
3056
+ criterion: input.criterion
3057
+ },
3058
+ ...input.idempotencyKey !== void 0 && { idempotencyKey: input.idempotencyKey }
3059
+ });
3060
+ },
3061
+ async submitForReview(supervisorId, id, input) {
3062
+ const body = {};
3063
+ if (input?.requiredRole !== void 0) body.requiredRole = input.requiredRole;
3064
+ if (input?.expiresAt !== void 0) body.expiresAt = input.expiresAt;
3065
+ return transport.request({
3066
+ method: "POST",
3067
+ path: `/v1/proposals/${encodeURIComponent(id)}/submit-review`,
3068
+ headers: supervisorHeader(supervisorId),
3069
+ body,
3070
+ ...input?.idempotencyKey !== void 0 && { idempotencyKey: input.idempotencyKey }
3071
+ });
3072
+ },
3073
+ async reflectReview(_supervisorId, _id, _input) {
3074
+ throw new KindgiApiError(
3075
+ notYetWired(
3076
+ "supervisor.proposals.reflectReview",
3077
+ "no POST /v1/proposals/{id}/reflect-review route on the API \u2014 review reflection is atomic with POST /v1/approvals/{id}/complete (wire detects the linked proposal + updates status alongside the decision)"
3078
+ )
3079
+ );
3080
+ },
3081
+ async apply(supervisorId, id, input) {
3082
+ const body = {};
3083
+ if (input?.newVersion !== void 0) body.newVersion = input.newVersion;
3084
+ return transport.request({
3085
+ method: "POST",
3086
+ path: `/v1/proposals/${encodeURIComponent(id)}/apply`,
3087
+ headers: supervisorHeader(supervisorId),
3088
+ body,
3089
+ ...input?.idempotencyKey !== void 0 && { idempotencyKey: input.idempotencyKey }
3090
+ });
3091
+ },
3092
+ async rollback(supervisorId, id, input) {
3093
+ return transport.request({
3094
+ method: "POST",
3095
+ path: `/v1/proposals/${encodeURIComponent(id)}/rollback`,
3096
+ headers: supervisorHeader(supervisorId),
3097
+ body: { reason: input.reason },
3098
+ ...input.idempotencyKey !== void 0 && { idempotencyKey: input.idempotencyKey }
3099
+ });
3100
+ },
3101
+ async withdraw(supervisorId, id, input) {
3102
+ return transport.request({
3103
+ method: "POST",
3104
+ path: `/v1/proposals/${encodeURIComponent(id)}/withdraw`,
3105
+ headers: supervisorHeader(supervisorId),
3106
+ body: { reason: input.reason },
3107
+ ...input.idempotencyKey !== void 0 && { idempotencyKey: input.idempotencyKey }
3108
+ });
3109
+ }
3110
+ }
3111
+ };
3112
+ }
3113
+
3114
+ // src/resources/teams.ts
3115
+ function makeTeamsClient(transport) {
3116
+ const seg = (s) => encodeURIComponent(s);
3117
+ return {
3118
+ async create(input, options) {
3119
+ return transport.request({
3120
+ method: "POST",
3121
+ path: "/v1/teams",
3122
+ body: input,
3123
+ ...options?.idempotencyKey !== void 0 && { idempotencyKey: options.idempotencyKey }
3124
+ });
3125
+ },
3126
+ async list(filter) {
3127
+ return transport.request({
3128
+ method: "GET",
3129
+ path: "/v1/teams",
3130
+ query: {
3131
+ ...filter?.limit !== void 0 && { limit: filter.limit },
3132
+ ...filter?.cursor !== void 0 && { cursor: filter.cursor }
3133
+ }
3134
+ });
3135
+ },
3136
+ async get(teamId) {
3137
+ return transport.request({
3138
+ method: "GET",
3139
+ path: `/v1/teams/${seg(teamId)}`
3140
+ });
3141
+ },
3142
+ async update(teamId, input, options) {
3143
+ return transport.request({
3144
+ method: "PATCH",
3145
+ path: `/v1/teams/${seg(teamId)}`,
3146
+ body: input,
3147
+ ...options?.idempotencyKey !== void 0 && { idempotencyKey: options.idempotencyKey }
3148
+ });
3149
+ },
3150
+ async delete(teamId) {
3151
+ return transport.request({
3152
+ method: "DELETE",
3153
+ path: `/v1/teams/${seg(teamId)}`,
3154
+ discardResponse: true
3155
+ });
3156
+ },
3157
+ memberships: {
3158
+ async list(teamId, filter) {
3159
+ return transport.request({
3160
+ method: "GET",
3161
+ path: `/v1/teams/${seg(teamId)}/memberships`,
3162
+ query: {
3163
+ ...filter?.limit !== void 0 && { limit: filter.limit },
3164
+ ...filter?.cursor !== void 0 && { cursor: filter.cursor }
3165
+ }
3166
+ });
3167
+ },
3168
+ async add(teamId, input, options) {
3169
+ return transport.request({
3170
+ method: "POST",
3171
+ path: `/v1/teams/${seg(teamId)}/memberships`,
3172
+ body: input,
3173
+ ...options?.idempotencyKey !== void 0 && { idempotencyKey: options.idempotencyKey }
3174
+ });
3175
+ },
3176
+ async updateRole(teamId, userId, role, options) {
3177
+ return transport.request({
3178
+ method: "PATCH",
3179
+ path: `/v1/teams/${seg(teamId)}/memberships/${seg(userId)}`,
3180
+ body: { role },
3181
+ discardResponse: true,
3182
+ ...options?.idempotencyKey !== void 0 && { idempotencyKey: options.idempotencyKey }
3183
+ });
3184
+ },
3185
+ async remove(teamId, userId, options) {
3186
+ return transport.request({
3187
+ method: "DELETE",
3188
+ path: `/v1/teams/${seg(teamId)}/memberships/${seg(userId)}`,
3189
+ discardResponse: true,
3190
+ ...options?.idempotencyKey !== void 0 && { idempotencyKey: options.idempotencyKey }
3191
+ });
3192
+ }
3193
+ }
3194
+ };
3195
+ }
3196
+
3197
+ // src/resources/tenant.ts
3198
+ function makeTenantClient(transport) {
3199
+ return {
3200
+ async get() {
3201
+ return transport.request({
3202
+ method: "GET",
3203
+ path: "/v1/tenant"
3204
+ });
3205
+ },
3206
+ config: {
3207
+ async list(filter) {
3208
+ return transport.request({
3209
+ method: "GET",
3210
+ path: "/v1/tenant/config",
3211
+ query: {
3212
+ ...filter?.limit !== void 0 && { limit: filter.limit },
3213
+ ...filter?.cursor !== void 0 && { cursor: filter.cursor },
3214
+ ...filter?.kind !== void 0 && { kind: filter.kind },
3215
+ ...filter?.keyPrefix !== void 0 && { keyPrefix: filter.keyPrefix }
3216
+ }
3217
+ });
3218
+ },
3219
+ async upsert(input, options) {
3220
+ return transport.request({
3221
+ method: "PATCH",
3222
+ path: "/v1/tenant/config",
3223
+ body: input,
3224
+ ...options?.idempotencyKey !== void 0 && { idempotencyKey: options.idempotencyKey }
3225
+ });
3226
+ }
3227
+ }
3228
+ };
3229
+ }
3230
+
3231
+ // src/resources/tokens.ts
3232
+ function fromWire2(wire) {
3233
+ return {
3234
+ id: wire.tokenId,
3235
+ role: wire.role,
3236
+ capabilities: wire.capabilities,
3237
+ ...wire.label !== void 0 && { label: wire.label },
3238
+ ...wire.projectId !== void 0 && {
3239
+ projectId: wire.projectId
3240
+ },
3241
+ ...wire.createdBy !== void 0 && { createdBy: wire.createdBy },
3242
+ createdAt: wire.createdAt,
3243
+ ...wire.lastUsedAt !== void 0 && { lastUsedAt: wire.lastUsedAt },
3244
+ ...wire.expiresAt !== void 0 && { expiresAt: wire.expiresAt },
3245
+ ...wire.revokedAt !== void 0 && { revokedAt: wire.revokedAt }
3246
+ };
3247
+ }
3248
+ function makeTokensClient(transport) {
3249
+ return {
3250
+ async create(spec, options) {
3251
+ const body = {};
3252
+ if (spec?.role !== void 0) body.role = spec.role;
3253
+ if (spec?.capabilities !== void 0) body.capabilities = spec.capabilities;
3254
+ if (spec?.label !== void 0) body.label = spec.label;
3255
+ if (spec?.expiresAt !== void 0) body.expiresAt = spec.expiresAt;
3256
+ if (spec?.projectId !== void 0) body.projectId = spec.projectId;
3257
+ const wire = await transport.request({
3258
+ method: "POST",
3259
+ path: "/v1/tokens",
3260
+ body,
3261
+ ...options?.idempotencyKey !== void 0 && {
3262
+ idempotencyKey: options.idempotencyKey
3263
+ }
3264
+ });
3265
+ const { token, ...record } = wire;
3266
+ return { meta: fromWire2(record), secret: token };
3267
+ },
3268
+ async list(filter) {
3269
+ const page = await transport.request({
3270
+ method: "GET",
3271
+ path: "/v1/tokens",
3272
+ query: {
3273
+ ...filter?.limit !== void 0 && { limit: filter.limit },
3274
+ ...filter?.cursor !== void 0 && { cursor: filter.cursor }
3275
+ }
3276
+ });
3277
+ return {
3278
+ items: page.data.map(fromWire2),
3279
+ ...page.nextCursor !== void 0 && { nextCursor: page.nextCursor }
3280
+ };
3281
+ },
3282
+ async get(id) {
3283
+ const wire = await transport.request({
3284
+ method: "GET",
3285
+ path: `/v1/tokens/${encodeURIComponent(id)}`
3286
+ });
3287
+ return fromWire2(wire);
3288
+ },
3289
+ async createPublic(input, options) {
3290
+ return transport.request({
3291
+ method: "POST",
3292
+ path: "/v1/tokens/public",
3293
+ body: input,
3294
+ ...options?.idempotencyKey !== void 0 && {
3295
+ idempotencyKey: options.idempotencyKey
3296
+ }
3297
+ });
3298
+ },
3299
+ async revoke(id, options) {
3300
+ await transport.request({
3301
+ method: "POST",
3302
+ path: `/v1/tokens/${encodeURIComponent(id)}/revoke`,
3303
+ body: {},
3304
+ discardResponse: true,
3305
+ ...options?.idempotencyKey !== void 0 && {
3306
+ idempotencyKey: options.idempotencyKey
3307
+ }
3308
+ });
3309
+ }
3310
+ };
3311
+ }
3312
+
3313
+ // src/resources/tools.ts
3314
+ function makeToolsClient(transport) {
3315
+ return {
3316
+ async list(filter) {
3317
+ const page = await transport.request({
3318
+ method: "GET",
3319
+ path: "/v1/tools",
3320
+ query: {
3321
+ ...filter?.limit !== void 0 && { limit: filter.limit },
3322
+ ...filter?.cursor !== void 0 && { cursor: filter.cursor },
3323
+ ...filter?.name !== void 0 && { name: filter.name }
3324
+ }
3325
+ });
3326
+ return {
3327
+ items: page.data,
3328
+ ...page.nextCursor !== void 0 && { nextCursor: page.nextCursor }
3329
+ };
3330
+ },
3331
+ async get(id) {
3332
+ return transport.request({
3333
+ method: "GET",
3334
+ path: `/v1/tools/${encodeURIComponent(id)}`
3335
+ });
3336
+ },
3337
+ async listVersions(id, filter) {
3338
+ const page = await transport.request({
3339
+ method: "GET",
3340
+ path: `/v1/tools/${encodeURIComponent(id)}/versions`,
3341
+ query: {
3342
+ ...filter?.limit !== void 0 && { limit: filter.limit },
3343
+ ...filter?.cursor !== void 0 && { cursor: filter.cursor },
3344
+ ...filter?.includeTombstoned === true && { includeTombstoned: "true" }
3345
+ }
3346
+ });
3347
+ return {
3348
+ items: page.data,
3349
+ ...page.nextCursor !== void 0 && { nextCursor: page.nextCursor }
3350
+ };
3351
+ },
3352
+ async getVersion(id, version) {
3353
+ return transport.request({
3354
+ method: "GET",
3355
+ path: `/v1/tools/${encodeURIComponent(id)}/versions/${encodeURIComponent(version)}`
3356
+ });
3357
+ },
3358
+ async reinstateVersion(id, version, options) {
3359
+ const wire = await transport.request({
3360
+ method: "POST",
3361
+ path: `/v1/tools/${encodeURIComponent(id)}/versions/${encodeURIComponent(version)}/reinstate`,
3362
+ ...options?.idempotencyKey !== void 0 && {
3363
+ idempotencyKey: options.idempotencyKey
3364
+ }
3365
+ });
3366
+ return {
3367
+ toolId: wire.toolId,
3368
+ version: wire.version,
3369
+ wasTombstoned: wire.wasTombstoned
3370
+ };
3371
+ },
3372
+ async unregisterVersion(id, version, options) {
3373
+ const wire = await transport.request({
3374
+ method: "POST",
3375
+ path: `/v1/tools/${encodeURIComponent(id)}/versions/${encodeURIComponent(version)}/unregister`,
3376
+ ...options?.idempotencyKey !== void 0 && {
3377
+ idempotencyKey: options.idempotencyKey
3378
+ }
3379
+ });
3380
+ return {
3381
+ toolId: wire.toolId,
3382
+ version: wire.version,
3383
+ unregistered: wire.unregistered
3384
+ };
3385
+ },
3386
+ async invoke(_id, _input) {
3387
+ throw new KindgiApiError(
3388
+ notYetWired(
3389
+ "tools.invoke",
3390
+ "no POST /v1/tools/{toolId}/invoke route on the API \u2014 direct invocation surface unrouted"
3391
+ )
3392
+ );
3393
+ },
3394
+ async manifests(_filter) {
3395
+ throw new KindgiApiError(
3396
+ notYetWired(
3397
+ "tools.manifests",
3398
+ "the wire `Tool` is the manifest; the API has no separate manifests endpoint"
3399
+ )
3400
+ );
3401
+ }
3402
+ };
3403
+ }
3404
+
3405
+ // src/resources/users.ts
3406
+ function makeUsersClient(transport) {
3407
+ return {
3408
+ async create(_spec) {
3409
+ throw new KindgiApiError(
3410
+ notYetWired(
3411
+ "users.create",
3412
+ "no user-creation route on the wire \u2014 framework does NOT own user persistence (deployments plug LDAP / SCIM / bespoke stores via IdentityDirectoryBinding)"
3413
+ )
3414
+ );
3415
+ },
3416
+ async get(id) {
3417
+ return transport.request({
3418
+ method: "GET",
3419
+ path: `/v1/identity/users/${encodeURIComponent(id)}`
3420
+ });
3421
+ },
3422
+ async me() {
3423
+ return transport.request({
3424
+ method: "GET",
3425
+ path: "/v1/identity/whoami"
3426
+ });
3427
+ },
3428
+ async list(filter) {
3429
+ const page = await transport.request({
3430
+ method: "GET",
3431
+ path: "/v1/identity/users",
3432
+ query: {
3433
+ ...filter?.limit !== void 0 && { limit: filter.limit },
3434
+ ...filter?.cursor !== void 0 && { cursor: filter.cursor },
3435
+ ...filter?.query !== void 0 && { query: filter.query }
3436
+ }
3437
+ });
3438
+ return {
3439
+ items: page.data,
3440
+ ...page.nextCursor !== void 0 && {
3441
+ nextCursor: page.nextCursor
3442
+ }
3443
+ };
3444
+ },
3445
+ async update(_id, _patch) {
3446
+ throw new KindgiApiError(
3447
+ notYetWired(
3448
+ "users.update",
3449
+ "no user-update route on the wire \u2014 framework does NOT own user persistence"
3450
+ )
3451
+ );
3452
+ },
3453
+ async deactivate(_id) {
3454
+ throw new KindgiApiError(
3455
+ notYetWired(
3456
+ "users.deactivate",
3457
+ "no user-deactivate route on the wire \u2014 framework does NOT own user persistence"
3458
+ )
3459
+ );
3460
+ },
3461
+ sessions: {
3462
+ async list(userId) {
3463
+ const page = await transport.request({
3464
+ method: "GET",
3465
+ path: `/v1/identity/users/${encodeURIComponent(userId)}/sessions`
3466
+ });
3467
+ return {
3468
+ items: page.data,
3469
+ ...page.nextCursor !== void 0 && {
3470
+ nextCursor: page.nextCursor
3471
+ }
3472
+ };
3473
+ },
3474
+ async revokeAll(userId, options) {
3475
+ return transport.request({
3476
+ method: "POST",
3477
+ path: `/v1/identity/users/${encodeURIComponent(userId)}/revoke-sessions`,
3478
+ body: {},
3479
+ ...options?.idempotencyKey !== void 0 && {
3480
+ idempotencyKey: options.idempotencyKey
3481
+ }
3482
+ });
3483
+ },
3484
+ async revoke(_id) {
3485
+ throw new KindgiApiError(
3486
+ notYetWired(
3487
+ "users.sessions.revoke",
3488
+ "no per-session revoke route on the wire \u2014 wire revokes ALL sessions for a user via revokeAll(userId); per-session revoke has design merit but no route yet"
3489
+ )
3490
+ );
3491
+ }
3492
+ }
3493
+ };
3494
+ }
3495
+
3496
+ // src/resources/webhook-endpoints.ts
3497
+ function makeWebhookEndpointsClient(transport) {
3498
+ const idempotency = (options) => options?.idempotencyKey !== void 0 ? { idempotencyKey: options.idempotencyKey } : {};
3499
+ return {
3500
+ async create(input, options) {
3501
+ return transport.request({
3502
+ method: "POST",
3503
+ path: "/v1/webhook-endpoints",
3504
+ body: input,
3505
+ ...idempotency(options)
3506
+ });
3507
+ },
3508
+ async generateSecret() {
3509
+ return transport.request({
3510
+ method: "POST",
3511
+ path: "/v1/webhook-endpoints/generate-secret"
3512
+ });
3513
+ },
3514
+ async list(filter) {
3515
+ return transport.request({
3516
+ method: "GET",
3517
+ path: "/v1/webhook-endpoints",
3518
+ query: {
3519
+ ...filter?.limit !== void 0 && { limit: filter.limit },
3520
+ ...filter?.cursor !== void 0 && { cursor: filter.cursor }
3521
+ }
3522
+ });
3523
+ },
3524
+ async get(endpointId) {
3525
+ return transport.request({
3526
+ method: "GET",
3527
+ path: `/v1/webhook-endpoints/${encodeURIComponent(endpointId)}`
3528
+ });
3529
+ },
3530
+ async update(endpointId, input, options) {
3531
+ return transport.request({
3532
+ method: "PATCH",
3533
+ path: `/v1/webhook-endpoints/${encodeURIComponent(endpointId)}`,
3534
+ body: input,
3535
+ ...idempotency(options)
3536
+ });
3537
+ },
3538
+ async unregister(endpointId, options) {
3539
+ return transport.request({
3540
+ method: "POST",
3541
+ path: `/v1/webhook-endpoints/${encodeURIComponent(endpointId)}/unregister`,
3542
+ ...idempotency(options)
3543
+ });
3544
+ },
3545
+ async listDeliveries(endpointId, filter) {
3546
+ return transport.request({
3547
+ method: "GET",
3548
+ path: `/v1/webhook-endpoints/${encodeURIComponent(endpointId)}/deliveries`,
3549
+ query: {
3550
+ ...filter?.limit !== void 0 && { limit: filter.limit },
3551
+ ...filter?.cursor !== void 0 && { cursor: filter.cursor },
3552
+ ...filter?.status !== void 0 && { status: filter.status }
3553
+ }
3554
+ });
3555
+ },
3556
+ async redeliver(endpointId, deliveryId, options) {
3557
+ return transport.request({
3558
+ method: "POST",
3559
+ path: `/v1/webhook-endpoints/${encodeURIComponent(endpointId)}/deliveries/${encodeURIComponent(deliveryId)}/redeliver`,
3560
+ ...idempotency(options)
3561
+ });
3562
+ },
3563
+ async sendTest(endpointId, options) {
3564
+ return transport.request({
3565
+ method: "POST",
3566
+ path: `/v1/webhook-endpoints/${encodeURIComponent(endpointId)}/test`,
3567
+ ...idempotency(options)
3568
+ });
3569
+ }
3570
+ };
3571
+ }
3572
+
3573
+ // src/resources/webhooks.ts
3574
+ function makeWebhooksClient(transport) {
3575
+ return {
3576
+ async register(input, options) {
3577
+ return transport.request({
3578
+ method: "POST",
3579
+ path: "/v1/webhooks",
3580
+ body: input,
3581
+ ...options?.idempotencyKey !== void 0 && { idempotencyKey: options.idempotencyKey }
3582
+ });
3583
+ },
3584
+ async list(filter) {
3585
+ return transport.request({
3586
+ method: "GET",
3587
+ path: "/v1/webhooks",
3588
+ query: {
3589
+ ...filter?.limit !== void 0 && { limit: filter.limit },
3590
+ ...filter?.cursor !== void 0 && { cursor: filter.cursor },
3591
+ ...filter?.status !== void 0 && { status: filter.status }
3592
+ }
3593
+ });
3594
+ },
3595
+ async get(triggerId) {
3596
+ return transport.request({
3597
+ method: "GET",
3598
+ path: `/v1/webhooks/${encodeURIComponent(triggerId)}`
3599
+ });
3600
+ },
3601
+ async update(triggerId, input, options) {
3602
+ return transport.request({
3603
+ method: "PATCH",
3604
+ path: `/v1/webhooks/${encodeURIComponent(triggerId)}`,
3605
+ body: input,
3606
+ ...options?.idempotencyKey !== void 0 && { idempotencyKey: options.idempotencyKey }
3607
+ });
3608
+ },
3609
+ async pause(triggerId, options) {
3610
+ return transport.request({
3611
+ method: "POST",
3612
+ path: `/v1/webhooks/${encodeURIComponent(triggerId)}/pause`,
3613
+ ...options?.idempotencyKey !== void 0 && { idempotencyKey: options.idempotencyKey }
3614
+ });
3615
+ },
3616
+ async resume(triggerId, options) {
3617
+ return transport.request({
3618
+ method: "POST",
3619
+ path: `/v1/webhooks/${encodeURIComponent(triggerId)}/resume`,
3620
+ ...options?.idempotencyKey !== void 0 && { idempotencyKey: options.idempotencyKey }
3621
+ });
3622
+ },
3623
+ async unregister(triggerId, options) {
3624
+ return transport.request({
3625
+ method: "POST",
3626
+ path: `/v1/webhooks/${encodeURIComponent(triggerId)}/unregister`,
3627
+ ...options?.idempotencyKey !== void 0 && { idempotencyKey: options.idempotencyKey }
3628
+ });
3629
+ }
3630
+ };
3631
+ }
3632
+
3633
+ // src/transport.ts
3634
+ var DEFAULT_TIMEOUT_MS = 3e4;
3635
+ var MUTATING = /* @__PURE__ */ new Set([
3636
+ "POST",
3637
+ "PUT",
3638
+ "PATCH",
3639
+ "DELETE"
3640
+ ]);
3641
+ function createTransport(options) {
3642
+ const apiUrl = options.apiUrl.replace(/\/+$/u, "");
3643
+ const fetchImpl = options.fetch ?? fetch;
3644
+ const clientTimeoutMs = DEFAULT_TIMEOUT_MS;
3645
+ return {
3646
+ apiUrl,
3647
+ fetchImpl,
3648
+ authHeaders() {
3649
+ return { Authorization: `Bearer ${authTokenFor(options.auth)}` };
3650
+ },
3651
+ async request(input) {
3652
+ const url = buildUrl(apiUrl, input.path, input.query);
3653
+ const headers = buildHeaders(input, options.auth);
3654
+ const timeoutMs = input.timeoutMs ?? clientTimeoutMs;
3655
+ const ac = new AbortController();
3656
+ const timer = setTimeout(
3657
+ () => ac.abort(new Error("timeout")),
3658
+ timeoutMs
3659
+ );
3660
+ let response;
3661
+ try {
3662
+ response = await fetchImpl(url, {
3663
+ method: input.method,
3664
+ headers,
3665
+ ...input.body !== void 0 && { body: JSON.stringify(input.body) },
3666
+ signal: ac.signal
3667
+ });
3668
+ } catch (cause) {
3669
+ clearTimeout(timer);
3670
+ const err = {
3671
+ code: "network",
3672
+ message: cause instanceof Error ? cause.message : "network request failed",
3673
+ cause
3674
+ };
3675
+ throw new KindgiApiError(err);
3676
+ }
3677
+ clearTimeout(timer);
3678
+ if (response.ok) {
3679
+ if (input.discardResponse === true || response.status === 204) {
3680
+ try {
3681
+ await response.arrayBuffer();
3682
+ } catch {
3683
+ }
3684
+ return void 0;
3685
+ }
3686
+ try {
3687
+ return await response.json();
3688
+ } catch (cause) {
3689
+ const err = {
3690
+ code: "network",
3691
+ message: "Response body was not valid JSON",
3692
+ cause
3693
+ };
3694
+ throw new KindgiApiError(err);
3695
+ }
3696
+ }
3697
+ let body;
3698
+ try {
3699
+ body = await response.json();
3700
+ } catch {
3701
+ body = void 0;
3702
+ }
3703
+ throw new KindgiApiError(fromWire(unwrapErrorEnvelope(body, response.status)));
3704
+ }
3705
+ };
3706
+ }
3707
+ function buildUrl(apiUrl, path, query) {
3708
+ const normalizedPath = path.startsWith("/") ? path : `/${path}`;
3709
+ const base = `${apiUrl}${normalizedPath}`;
3710
+ if (query === void 0) return base;
3711
+ const params = [];
3712
+ for (const key of Object.keys(query)) {
3713
+ const value = query[key];
3714
+ if (value === void 0) continue;
3715
+ params.push(`${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`);
3716
+ }
3717
+ return params.length === 0 ? base : `${base}?${params.join("&")}`;
3718
+ }
3719
+ function buildHeaders(input, auth) {
3720
+ const headers = {
3721
+ Accept: "application/json",
3722
+ Authorization: `Bearer ${authTokenFor(auth)}`
3723
+ };
3724
+ if (input.body !== void 0) {
3725
+ headers["Content-Type"] = "application/json; charset=utf-8";
3726
+ }
3727
+ if (input.idempotencyKey !== void 0 && MUTATING.has(input.method)) {
3728
+ headers["Idempotency-Key"] = input.idempotencyKey;
3729
+ }
3730
+ if (input.headers !== void 0) {
3731
+ for (const key of Object.keys(input.headers)) {
3732
+ headers[key] = input.headers[key];
3733
+ }
3734
+ }
3735
+ return headers;
3736
+ }
3737
+ function authTokenFor(auth) {
3738
+ if (auth.kind === "apiToken") return auth.token;
3739
+ return auth.accessToken;
3740
+ }
3741
+ function unwrapErrorEnvelope(body, status) {
3742
+ if (body !== null && typeof body === "object" && !Array.isArray(body)) {
3743
+ const inner = body.error;
3744
+ if (inner !== null && typeof inner === "object" && !Array.isArray(inner)) {
3745
+ return inner;
3746
+ }
3747
+ }
3748
+ return { code: "unknown", message: `HTTP ${status} without recognizable error envelope` };
3749
+ }
3750
+
3751
+ // src/client.ts
3752
+ function createClient(options) {
3753
+ const transport = createTransport(options);
3754
+ return {
3755
+ agents: makeAgentsClient(transport),
3756
+ flows: makeFlowsClient(transport),
3757
+ tools: makeToolsClient(transport),
3758
+ guardrails: makeGuardrailsClient(transport),
3759
+ runs: makeRunsClient(transport),
3760
+ schedules: makeSchedulesClient(transport),
3761
+ conversations: makeConversationsClient(transport),
3762
+ memory: makeMemoryClient(transport),
3763
+ provenance: makeProvenanceClient(transport),
3764
+ supervisor: makeSupervisorClient(transport),
3765
+ observations: makeObservationsClient(transport),
3766
+ approvals: makeApprovalsClient(transport),
3767
+ tenant: makeTenantClient(transport),
3768
+ cost: makeCostClient(transport),
3769
+ capabilities: makeCapabilitiesClient(transport),
3770
+ adapters: makeAdaptersClient(transport),
3771
+ providers: makeProvidersClient(transport),
3772
+ policies: makePoliciesClient(transport),
3773
+ projects: makeProjectsClient(transport),
3774
+ env: makeEnvClient(transport),
3775
+ secrets: makeSecretsClient(transport),
3776
+ deployments: makeDeploymentsClient(transport),
3777
+ compliance: makeComplianceClient(transport),
3778
+ audit: makeAuditClient(transport),
3779
+ evalSuites: makeEvalSuitesClient(transport),
3780
+ evalRuns: makeEvalRunsClient(transport),
3781
+ users: makeUsersClient(transport),
3782
+ identity: makeIdentityClient(transport),
3783
+ auth: makeAuthClient(transport),
3784
+ teams: makeTeamsClient(transport),
3785
+ orgs: makeOrgsClient(transport),
3786
+ signingKeys: makeSigningKeysClient(transport),
3787
+ tokens: makeTokensClient(transport),
3788
+ mcp: makeMcpClient(transport),
3789
+ events: makeEventsClient(),
3790
+ eventTriggers: makeEventTriggersClient(transport),
3791
+ artifacts: makeArtifactsClient(transport),
3792
+ webhooks: makeWebhooksClient(transport),
3793
+ webhookEndpoints: makeWebhookEndpointsClient(transport),
3794
+ packs: makePacksClient()
3795
+ };
3796
+ }
3797
+
3798
+ export { KindgiApiError, SseHttpError, createClient, followRun, fromWire, notImplementedInPreview, notYetWired, readSse, subscribeToRun, unwrapSseData };
3799
+ //# sourceMappingURL=index.js.map
3800
+ //# sourceMappingURL=index.js.map