@kindgi/client 0.1.4-rc.0 → 0.1.4-rc.2
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.cjs +458 -256
- package/dist/index.d.cts +2430 -238
- package/dist/index.d.ts +2430 -238
- package/dist/index.js +458 -257
- package/package.json +7 -7
package/dist/index.cjs
CHANGED
|
@@ -16,7 +16,13 @@ function notYetWired(method, reason) {
|
|
|
16
16
|
reason
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
|
-
function fromWire(body) {
|
|
19
|
+
function fromWire(body, status) {
|
|
20
|
+
const error = classify(body, status);
|
|
21
|
+
if (error.code === "server") return error;
|
|
22
|
+
const code = body !== null && typeof body === "object" && typeof body.code === "string" ? body.code : void 0;
|
|
23
|
+
return code === void 0 ? error : { ...error, serverCode: code };
|
|
24
|
+
}
|
|
25
|
+
function classify(body, status) {
|
|
20
26
|
if (!body || typeof body !== "object") {
|
|
21
27
|
return {
|
|
22
28
|
code: "server",
|
|
@@ -46,11 +52,7 @@ function fromWire(body) {
|
|
|
46
52
|
return { code: "auth", message, reason: "forbidden" };
|
|
47
53
|
case "rate-limited":
|
|
48
54
|
case "rate-limit-exceeded":
|
|
49
|
-
return
|
|
50
|
-
code: "rate-limited",
|
|
51
|
-
message,
|
|
52
|
-
...typeof obj.retryAfterSeconds === "number" ? { retryAfterSeconds: obj.retryAfterSeconds } : {}
|
|
53
|
-
};
|
|
55
|
+
return rateLimited(message, obj);
|
|
54
56
|
case "not-found":
|
|
55
57
|
case "run-not-found":
|
|
56
58
|
case "agent-not-found":
|
|
@@ -73,27 +75,9 @@ function fromWire(body) {
|
|
|
73
75
|
case "provider-not-found":
|
|
74
76
|
case "capability-not-found":
|
|
75
77
|
case "token-not-found":
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
resource: {
|
|
80
|
-
kind: code.replace(/-not-found$/u, "") || "unknown",
|
|
81
|
-
id: readStringField(
|
|
82
|
-
details,
|
|
83
|
-
"agentId",
|
|
84
|
-
"toolId",
|
|
85
|
-
"runId",
|
|
86
|
-
"adapterId",
|
|
87
|
-
"userId",
|
|
88
|
-
"providerId",
|
|
89
|
-
"capabilityId",
|
|
90
|
-
"tokenId",
|
|
91
|
-
"factId",
|
|
92
|
-
"guardrailId",
|
|
93
|
-
"id"
|
|
94
|
-
) ?? "unknown"
|
|
95
|
-
}
|
|
96
|
-
};
|
|
78
|
+
case "agent-version-not-found":
|
|
79
|
+
case "promotion-not-found":
|
|
80
|
+
return notFound(code, message, details);
|
|
97
81
|
case "conflict":
|
|
98
82
|
case "already-terminal":
|
|
99
83
|
case "run-already-terminal":
|
|
@@ -109,6 +93,26 @@ function fromWire(body) {
|
|
|
109
93
|
case "approval-not-decided":
|
|
110
94
|
case "slug-conflict":
|
|
111
95
|
case "project-default-already-exists":
|
|
96
|
+
case "registry-read-only":
|
|
97
|
+
case "policy-scope-taken":
|
|
98
|
+
case "policy-scope-changed":
|
|
99
|
+
case "nothing-to-roll-back":
|
|
100
|
+
case "not-pinned":
|
|
101
|
+
case "agent-version-live":
|
|
102
|
+
case "eval-suite-already-registered":
|
|
103
|
+
case "policy-already-registered":
|
|
104
|
+
case "mcp-endpoint-already-registered":
|
|
105
|
+
case "identity-provider-already-registered":
|
|
106
|
+
case "version-already-exists":
|
|
107
|
+
case "eval-run-already-terminal":
|
|
108
|
+
case "approval-already-decided":
|
|
109
|
+
case "judge-class-name-taken":
|
|
110
|
+
case "promotion-superseded":
|
|
111
|
+
case "gate-policy-already-registered":
|
|
112
|
+
case "gate-policy-scope-taken":
|
|
113
|
+
case "gate-policy-scope-changed":
|
|
114
|
+
case "gate-policy-scope-unpinned":
|
|
115
|
+
case "gate-policy-needs-pin":
|
|
112
116
|
return { code: "conflict", message, reason: code };
|
|
113
117
|
case "invalid-request":
|
|
114
118
|
case "validation-failed":
|
|
@@ -124,11 +128,8 @@ function fromWire(body) {
|
|
|
124
128
|
case "invalid-guardrail":
|
|
125
129
|
case "invalid-provider":
|
|
126
130
|
case "supervisor-header-missing":
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
message,
|
|
130
|
-
issues: obj.issues ?? details?.issues ?? []
|
|
131
|
-
};
|
|
131
|
+
case "scope-invalid":
|
|
132
|
+
return invalidRequest(message, obj, details);
|
|
132
133
|
case "guardrail-violation":
|
|
133
134
|
return {
|
|
134
135
|
code: "guardrail-violation",
|
|
@@ -136,6 +137,23 @@ function fromWire(body) {
|
|
|
136
137
|
violations: readGuardrailViolations(details?.violations),
|
|
137
138
|
evaluationErrors: readEvaluationErrors(details?.evaluationErrors)
|
|
138
139
|
};
|
|
140
|
+
default:
|
|
141
|
+
return byStatus(status, code, message, obj, details);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
function byStatus(status, code, message, obj, details) {
|
|
145
|
+
switch (status) {
|
|
146
|
+
case 404:
|
|
147
|
+
case 410:
|
|
148
|
+
return notFound(code, message, details);
|
|
149
|
+
case 400:
|
|
150
|
+
return invalidRequest(message, obj, details);
|
|
151
|
+
case 401:
|
|
152
|
+
return { code: "auth", message, reason: "unauthenticated" };
|
|
153
|
+
case 403:
|
|
154
|
+
return { code: "auth", message, reason: "forbidden" };
|
|
155
|
+
case 429:
|
|
156
|
+
return rateLimited(message, obj);
|
|
139
157
|
default:
|
|
140
158
|
return {
|
|
141
159
|
code: "server",
|
|
@@ -145,6 +163,43 @@ function fromWire(body) {
|
|
|
145
163
|
};
|
|
146
164
|
}
|
|
147
165
|
}
|
|
166
|
+
function notFound(code, message, details) {
|
|
167
|
+
return {
|
|
168
|
+
code: "not-found",
|
|
169
|
+
message,
|
|
170
|
+
resource: {
|
|
171
|
+
kind: code.replace(/-not-found$/u, "") || "unknown",
|
|
172
|
+
id: readStringField(
|
|
173
|
+
details,
|
|
174
|
+
"agentId",
|
|
175
|
+
"toolId",
|
|
176
|
+
"runId",
|
|
177
|
+
"adapterId",
|
|
178
|
+
"userId",
|
|
179
|
+
"providerId",
|
|
180
|
+
"capabilityId",
|
|
181
|
+
"tokenId",
|
|
182
|
+
"factId",
|
|
183
|
+
"guardrailId",
|
|
184
|
+
"id"
|
|
185
|
+
) ?? "unknown"
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
function invalidRequest(message, obj, details) {
|
|
190
|
+
return {
|
|
191
|
+
code: "invalid-request",
|
|
192
|
+
message,
|
|
193
|
+
issues: obj.issues ?? details?.issues ?? []
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
function rateLimited(message, obj) {
|
|
197
|
+
return {
|
|
198
|
+
code: "rate-limited",
|
|
199
|
+
message,
|
|
200
|
+
...typeof obj.retryAfterSeconds === "number" ? { retryAfterSeconds: obj.retryAfterSeconds } : {}
|
|
201
|
+
};
|
|
202
|
+
}
|
|
148
203
|
function readStringField(obj, ...keys) {
|
|
149
204
|
if (obj === void 0) return void 0;
|
|
150
205
|
for (const key of keys) {
|
|
@@ -194,6 +249,17 @@ var KindgiApiError = class extends Error {
|
|
|
194
249
|
}
|
|
195
250
|
};
|
|
196
251
|
|
|
252
|
+
// src/list-page.ts
|
|
253
|
+
function listPage(page) {
|
|
254
|
+
const result = {
|
|
255
|
+
data: page.data,
|
|
256
|
+
hasMore: page.hasMore,
|
|
257
|
+
...page.nextCursor !== void 0 && { nextCursor: page.nextCursor }
|
|
258
|
+
};
|
|
259
|
+
Object.defineProperty(result, "items", { get: () => result.data, enumerable: false });
|
|
260
|
+
return result;
|
|
261
|
+
}
|
|
262
|
+
|
|
197
263
|
// src/streaming.ts
|
|
198
264
|
async function* readSse(options) {
|
|
199
265
|
const fetchImpl = options.fetchImpl ?? fetch;
|
|
@@ -349,10 +415,7 @@ function makeAdaptersClient(transport) {
|
|
|
349
415
|
...filter?.status !== void 0 && { status: filter.status }
|
|
350
416
|
}
|
|
351
417
|
});
|
|
352
|
-
return
|
|
353
|
-
items: page.data,
|
|
354
|
-
...page.nextCursor !== void 0 && { nextCursor: page.nextCursor }
|
|
355
|
-
};
|
|
418
|
+
return listPage(page);
|
|
356
419
|
},
|
|
357
420
|
async get(adapterId) {
|
|
358
421
|
return transport.request({
|
|
@@ -409,6 +472,57 @@ function makeAdaptersClient(transport) {
|
|
|
409
472
|
// src/resources/agents.ts
|
|
410
473
|
function makeAgentsClient(transport) {
|
|
411
474
|
const seg = (s) => encodeURIComponent(s);
|
|
475
|
+
const versions = {
|
|
476
|
+
async list(agentId, filter) {
|
|
477
|
+
return transport.request({
|
|
478
|
+
method: "GET",
|
|
479
|
+
path: `/v1/agents/${seg(agentId)}/versions`,
|
|
480
|
+
query: {
|
|
481
|
+
...filter?.limit !== void 0 && { limit: filter.limit },
|
|
482
|
+
...filter?.cursor !== void 0 && { cursor: filter.cursor }
|
|
483
|
+
}
|
|
484
|
+
});
|
|
485
|
+
},
|
|
486
|
+
async get(agentId, version) {
|
|
487
|
+
return transport.request({
|
|
488
|
+
method: "GET",
|
|
489
|
+
path: `/v1/agents/${seg(agentId)}/versions/${seg(version)}`
|
|
490
|
+
});
|
|
491
|
+
},
|
|
492
|
+
async unregister(agentId, version, options) {
|
|
493
|
+
return transport.request({
|
|
494
|
+
method: "POST",
|
|
495
|
+
path: `/v1/agents/${seg(agentId)}/versions/${seg(version)}/unregister`,
|
|
496
|
+
...options?.idempotencyKey !== void 0 && {
|
|
497
|
+
idempotencyKey: options.idempotencyKey
|
|
498
|
+
}
|
|
499
|
+
});
|
|
500
|
+
},
|
|
501
|
+
async derive(agentId, input, options) {
|
|
502
|
+
return transport.request({
|
|
503
|
+
method: "POST",
|
|
504
|
+
path: `/v1/agents/${seg(agentId)}/versions`,
|
|
505
|
+
body: input,
|
|
506
|
+
...options?.idempotencyKey !== void 0 && {
|
|
507
|
+
idempotencyKey: options.idempotencyKey
|
|
508
|
+
}
|
|
509
|
+
});
|
|
510
|
+
},
|
|
511
|
+
async reinstate(agentId, version, options) {
|
|
512
|
+
const wire = await transport.request({
|
|
513
|
+
method: "POST",
|
|
514
|
+
path: `/v1/agents/${seg(agentId)}/versions/${seg(version)}/reinstate`,
|
|
515
|
+
...options?.idempotencyKey !== void 0 && {
|
|
516
|
+
idempotencyKey: options.idempotencyKey
|
|
517
|
+
}
|
|
518
|
+
});
|
|
519
|
+
return {
|
|
520
|
+
agentId: wire.agentId,
|
|
521
|
+
version: wire.version,
|
|
522
|
+
wasTombstoned: wire.wasTombstoned
|
|
523
|
+
};
|
|
524
|
+
}
|
|
525
|
+
};
|
|
412
526
|
return {
|
|
413
527
|
async define(spec, options) {
|
|
414
528
|
const result = await transport.request({
|
|
@@ -438,59 +552,106 @@ function makeAgentsClient(transport) {
|
|
|
438
552
|
path: `/v1/agents/${seg(agentId)}`
|
|
439
553
|
});
|
|
440
554
|
},
|
|
441
|
-
versions
|
|
442
|
-
|
|
555
|
+
versions,
|
|
556
|
+
reinstateVersion: (agentId, version, options) => versions.reinstate(agentId, version, options),
|
|
557
|
+
live: {
|
|
558
|
+
async resolve(agentId, where) {
|
|
443
559
|
return transport.request({
|
|
444
560
|
method: "GET",
|
|
445
|
-
path: `/v1/agents/${seg(agentId)}/
|
|
561
|
+
path: `/v1/agents/${seg(agentId)}/live`,
|
|
446
562
|
query: {
|
|
447
|
-
...
|
|
448
|
-
...
|
|
563
|
+
...where?.projectId !== void 0 && { projectId: where.projectId },
|
|
564
|
+
...where?.segments !== void 0 && { segment: where.segments.map(segmentParam) }
|
|
449
565
|
}
|
|
450
566
|
});
|
|
451
567
|
},
|
|
452
|
-
async
|
|
568
|
+
async list(agentId) {
|
|
453
569
|
return transport.request({
|
|
454
570
|
method: "GET",
|
|
455
|
-
path: `/v1/agents/${seg(agentId)}/versions
|
|
571
|
+
path: `/v1/agents/${seg(agentId)}/live-versions`
|
|
456
572
|
});
|
|
457
573
|
},
|
|
458
|
-
async
|
|
574
|
+
async rollback(agentId, input, options) {
|
|
459
575
|
return transport.request({
|
|
460
576
|
method: "POST",
|
|
461
|
-
path: `/v1/agents/${seg(agentId)}/
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
}
|
|
577
|
+
path: `/v1/agents/${seg(agentId)}/live/rollback`,
|
|
578
|
+
body: input,
|
|
579
|
+
...options?.idempotencyKey !== void 0 && { idempotencyKey: options.idempotencyKey }
|
|
465
580
|
});
|
|
466
581
|
},
|
|
467
|
-
async
|
|
582
|
+
async unpin(agentId, input, options) {
|
|
468
583
|
return transport.request({
|
|
469
584
|
method: "POST",
|
|
470
|
-
path: `/v1/agents/${seg(agentId)}/
|
|
585
|
+
path: `/v1/agents/${seg(agentId)}/live/unpin`,
|
|
471
586
|
body: input,
|
|
472
|
-
...options?.idempotencyKey !== void 0 && {
|
|
473
|
-
|
|
587
|
+
...options?.idempotencyKey !== void 0 && { idempotencyKey: options.idempotencyKey }
|
|
588
|
+
});
|
|
589
|
+
}
|
|
590
|
+
},
|
|
591
|
+
promotions: {
|
|
592
|
+
async create(agentId, input, options) {
|
|
593
|
+
return transport.request({
|
|
594
|
+
method: "POST",
|
|
595
|
+
path: `/v1/agents/${seg(agentId)}/promotions`,
|
|
596
|
+
body: input,
|
|
597
|
+
...options?.idempotencyKey !== void 0 && { idempotencyKey: options.idempotencyKey }
|
|
598
|
+
});
|
|
599
|
+
},
|
|
600
|
+
async check(agentId, input) {
|
|
601
|
+
return transport.request({
|
|
602
|
+
method: "POST",
|
|
603
|
+
path: `/v1/agents/${seg(agentId)}/promotions/check`,
|
|
604
|
+
body: input
|
|
605
|
+
});
|
|
606
|
+
},
|
|
607
|
+
async list(agentId, filter) {
|
|
608
|
+
return transport.request({
|
|
609
|
+
method: "GET",
|
|
610
|
+
path: `/v1/agents/${seg(agentId)}/promotions`,
|
|
611
|
+
query: {
|
|
612
|
+
...filter?.scope !== void 0 && scopeQuery(filter.scope),
|
|
613
|
+
...filter?.limit !== void 0 && { limit: filter.limit },
|
|
614
|
+
...filter?.cursor !== void 0 && { cursor: filter.cursor }
|
|
474
615
|
}
|
|
475
616
|
});
|
|
617
|
+
},
|
|
618
|
+
async get(agentId, promotionId) {
|
|
619
|
+
return transport.request({
|
|
620
|
+
method: "GET",
|
|
621
|
+
path: `/v1/agents/${seg(agentId)}/promotions/${seg(promotionId)}`
|
|
622
|
+
});
|
|
476
623
|
}
|
|
477
624
|
},
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
}
|
|
485
|
-
}
|
|
486
|
-
return {
|
|
487
|
-
agentId: wire.agentId,
|
|
488
|
-
version: wire.version,
|
|
489
|
-
wasTombstoned: wire.wasTombstoned
|
|
490
|
-
};
|
|
625
|
+
gatePolicy: {
|
|
626
|
+
async resolve(agentId, scope) {
|
|
627
|
+
return transport.request({
|
|
628
|
+
method: "GET",
|
|
629
|
+
path: `/v1/agents/${seg(agentId)}/gate-policy`,
|
|
630
|
+
query: scopeQuery(scope)
|
|
631
|
+
});
|
|
632
|
+
}
|
|
491
633
|
}
|
|
492
634
|
};
|
|
493
635
|
}
|
|
636
|
+
function segmentParam(s) {
|
|
637
|
+
return `${s.key}:${s.value}`;
|
|
638
|
+
}
|
|
639
|
+
function scopeQuery(scope) {
|
|
640
|
+
switch (scope.kind) {
|
|
641
|
+
case "tenant":
|
|
642
|
+
return { scopeKind: "tenant" };
|
|
643
|
+
case "org":
|
|
644
|
+
return { scopeKind: "org", scopeId: scope.orgId };
|
|
645
|
+
case "project":
|
|
646
|
+
return { scopeKind: "project", scopeId: scope.projectId };
|
|
647
|
+
case "segment":
|
|
648
|
+
return {
|
|
649
|
+
scopeKind: "segment",
|
|
650
|
+
scopeId: scope.projectId,
|
|
651
|
+
segment: scope.path.map(segmentParam)
|
|
652
|
+
};
|
|
653
|
+
}
|
|
654
|
+
}
|
|
494
655
|
|
|
495
656
|
// src/scope-wire.ts
|
|
496
657
|
function scopeForBody(scope) {
|
|
@@ -539,12 +700,7 @@ function makeApprovalsClient(transport) {
|
|
|
539
700
|
}
|
|
540
701
|
}
|
|
541
702
|
});
|
|
542
|
-
return
|
|
543
|
-
items: page.data,
|
|
544
|
-
...page.nextCursor !== void 0 && {
|
|
545
|
-
nextCursor: page.nextCursor
|
|
546
|
-
}
|
|
547
|
-
};
|
|
703
|
+
return listPage(page);
|
|
548
704
|
},
|
|
549
705
|
async get(id) {
|
|
550
706
|
return transport.request({
|
|
@@ -612,12 +768,7 @@ function makeApprovalsClient(transport) {
|
|
|
612
768
|
...filter?.role !== void 0 && { role: filter.role }
|
|
613
769
|
}
|
|
614
770
|
});
|
|
615
|
-
return
|
|
616
|
-
items: page.data,
|
|
617
|
-
...page.nextCursor !== void 0 && {
|
|
618
|
-
nextCursor: page.nextCursor
|
|
619
|
-
}
|
|
620
|
-
};
|
|
771
|
+
return listPage(page);
|
|
621
772
|
},
|
|
622
773
|
async get(id) {
|
|
623
774
|
return transport.request({
|
|
@@ -718,12 +869,7 @@ function makeArtifactsClient(transport) {
|
|
|
718
869
|
...filter?.contentType !== void 0 && { contentType: filter.contentType }
|
|
719
870
|
}
|
|
720
871
|
});
|
|
721
|
-
return
|
|
722
|
-
items: page.data,
|
|
723
|
-
...page.nextCursor !== void 0 && {
|
|
724
|
-
nextCursor: page.nextCursor
|
|
725
|
-
}
|
|
726
|
-
};
|
|
872
|
+
return listPage(page);
|
|
727
873
|
},
|
|
728
874
|
async delete(blobId, options) {
|
|
729
875
|
return transport.request({
|
|
@@ -771,7 +917,8 @@ function makeAuditClient(transport) {
|
|
|
771
917
|
...filter?.outcome !== void 0 && { outcome: filter.outcome },
|
|
772
918
|
...filter?.runId !== void 0 && { runId: filter.runId },
|
|
773
919
|
...filter?.from !== void 0 && { from: filter.from },
|
|
774
|
-
...filter?.to !== void 0 && { to: filter.to }
|
|
920
|
+
...filter?.to !== void 0 && { to: filter.to },
|
|
921
|
+
...filter?.order !== void 0 && { order: filter.order }
|
|
775
922
|
}
|
|
776
923
|
});
|
|
777
924
|
}
|
|
@@ -785,10 +932,11 @@ function makeAuthClient(transport) {
|
|
|
785
932
|
return {
|
|
786
933
|
providers: {
|
|
787
934
|
async list() {
|
|
788
|
-
|
|
935
|
+
const page = await transport.request({
|
|
789
936
|
method: "GET",
|
|
790
937
|
path: "/v1/auth/providers"
|
|
791
938
|
});
|
|
939
|
+
return { ...page, hasMore: page.hasMore ?? false };
|
|
792
940
|
},
|
|
793
941
|
async register(input, options) {
|
|
794
942
|
return transport.request({
|
|
@@ -917,12 +1065,7 @@ function makeCapabilitiesClient(transport) {
|
|
|
917
1065
|
...filter?.feature !== void 0 && { feature: filter.feature }
|
|
918
1066
|
}
|
|
919
1067
|
});
|
|
920
|
-
return
|
|
921
|
-
items: page.data,
|
|
922
|
-
...page.nextCursor !== void 0 && {
|
|
923
|
-
nextCursor: page.nextCursor
|
|
924
|
-
}
|
|
925
|
-
};
|
|
1068
|
+
return listPage(page);
|
|
926
1069
|
},
|
|
927
1070
|
async get(capabilityId) {
|
|
928
1071
|
return transport.request({
|
|
@@ -949,12 +1092,7 @@ function makeCapabilitiesClient(transport) {
|
|
|
949
1092
|
...filter?.feature !== void 0 && { feature: filter.feature }
|
|
950
1093
|
}
|
|
951
1094
|
});
|
|
952
|
-
return
|
|
953
|
-
items: page.data,
|
|
954
|
-
...page.nextCursor !== void 0 && {
|
|
955
|
-
nextCursor: page.nextCursor
|
|
956
|
-
}
|
|
957
|
-
};
|
|
1095
|
+
return listPage(page);
|
|
958
1096
|
},
|
|
959
1097
|
async get(id) {
|
|
960
1098
|
return transport.request({
|
|
@@ -1084,13 +1222,11 @@ function makeConversationsClient(transport) {
|
|
|
1084
1222
|
...filter?.cursor !== void 0 && { cursor: filter.cursor },
|
|
1085
1223
|
...statusParam !== void 0 && { status: statusParam },
|
|
1086
1224
|
...filter?.scope !== void 0 && scopeToQuery(filter.scope),
|
|
1087
|
-
...filter?.agent !== void 0 && { agentId: filter.agent }
|
|
1225
|
+
...filter?.agent !== void 0 && { agentId: filter.agent },
|
|
1226
|
+
...filter?.replays !== void 0 && { replays: filter.replays }
|
|
1088
1227
|
}
|
|
1089
1228
|
});
|
|
1090
|
-
return
|
|
1091
|
-
items: page.data,
|
|
1092
|
-
...page.nextCursor !== void 0 && { nextCursor: page.nextCursor }
|
|
1093
|
-
};
|
|
1229
|
+
return listPage(page);
|
|
1094
1230
|
},
|
|
1095
1231
|
async close(id, options) {
|
|
1096
1232
|
return transport.request({
|
|
@@ -1111,10 +1247,7 @@ function makeConversationsClient(transport) {
|
|
|
1111
1247
|
...filter?.cursor !== void 0 && { cursor: filter.cursor }
|
|
1112
1248
|
}
|
|
1113
1249
|
});
|
|
1114
|
-
return
|
|
1115
|
-
items: page.data,
|
|
1116
|
-
...page.nextCursor !== void 0 && { nextCursor: page.nextCursor }
|
|
1117
|
-
};
|
|
1250
|
+
return listPage(page);
|
|
1118
1251
|
}
|
|
1119
1252
|
};
|
|
1120
1253
|
}
|
|
@@ -1156,12 +1289,7 @@ function makeCostClient(transport) {
|
|
|
1156
1289
|
...filterQuery(filter ?? {})
|
|
1157
1290
|
}
|
|
1158
1291
|
});
|
|
1159
|
-
return
|
|
1160
|
-
items: page.data,
|
|
1161
|
-
...page.nextCursor !== void 0 && {
|
|
1162
|
-
nextCursor: page.nextCursor
|
|
1163
|
-
}
|
|
1164
|
-
};
|
|
1292
|
+
return listPage(page);
|
|
1165
1293
|
},
|
|
1166
1294
|
async get(recordId, options) {
|
|
1167
1295
|
return transport.request({
|
|
@@ -1171,7 +1299,7 @@ function makeCostClient(transport) {
|
|
|
1171
1299
|
});
|
|
1172
1300
|
},
|
|
1173
1301
|
async summary(input) {
|
|
1174
|
-
const { from, to, groupBy, ...filter } = input;
|
|
1302
|
+
const { from, to, groupBy, limit, ...filter } = input;
|
|
1175
1303
|
return transport.request({
|
|
1176
1304
|
method: "GET",
|
|
1177
1305
|
path: "/v1/cost/aggregate",
|
|
@@ -1179,7 +1307,8 @@ function makeCostClient(transport) {
|
|
|
1179
1307
|
...filterQuery(filter),
|
|
1180
1308
|
from,
|
|
1181
1309
|
to,
|
|
1182
|
-
...groupBy !== void 0 && { groupBy: groupBy.join(",") }
|
|
1310
|
+
...groupBy !== void 0 && { groupBy: groupBy.join(",") },
|
|
1311
|
+
...limit !== void 0 && { limit }
|
|
1183
1312
|
}
|
|
1184
1313
|
});
|
|
1185
1314
|
}
|
|
@@ -1274,6 +1403,7 @@ function makeEnvClient(transport) {
|
|
|
1274
1403
|
});
|
|
1275
1404
|
return {
|
|
1276
1405
|
data: page.data,
|
|
1406
|
+
hasMore: page.hasMore ?? page.nextCursor !== void 0,
|
|
1277
1407
|
...page.nextCursor !== void 0 && {
|
|
1278
1408
|
nextCursor: page.nextCursor
|
|
1279
1409
|
}
|
|
@@ -1368,6 +1498,10 @@ function tryReadRevisionConflict(err) {
|
|
|
1368
1498
|
}
|
|
1369
1499
|
|
|
1370
1500
|
// src/resources/eval-runs.ts
|
|
1501
|
+
function comparisonOf(run) {
|
|
1502
|
+
const result = run.result;
|
|
1503
|
+
return run.kind === "judged" && result?.summary !== void 0 && Array.isArray(result.perCase) ? result : void 0;
|
|
1504
|
+
}
|
|
1371
1505
|
function makeEvalRunsClient(transport) {
|
|
1372
1506
|
const seg = (s) => encodeURIComponent(s);
|
|
1373
1507
|
return {
|
|
@@ -1647,6 +1781,58 @@ function makeEventsClient(_transport) {
|
|
|
1647
1781
|
|
|
1648
1782
|
// src/resources/flows.ts
|
|
1649
1783
|
function makeFlowsClient(transport) {
|
|
1784
|
+
const list = async (id, filter) => {
|
|
1785
|
+
const page = await transport.request({
|
|
1786
|
+
method: "GET",
|
|
1787
|
+
path: `/v1/flows/${encodeURIComponent(id)}/versions`,
|
|
1788
|
+
query: {
|
|
1789
|
+
...filter?.limit !== void 0 && { limit: filter.limit },
|
|
1790
|
+
...filter?.cursor !== void 0 && { cursor: filter.cursor }
|
|
1791
|
+
}
|
|
1792
|
+
});
|
|
1793
|
+
return listPage(page);
|
|
1794
|
+
};
|
|
1795
|
+
const versions = Object.assign(
|
|
1796
|
+
(id, filter) => list(id, filter),
|
|
1797
|
+
{
|
|
1798
|
+
list,
|
|
1799
|
+
async get(id, version) {
|
|
1800
|
+
return transport.request({
|
|
1801
|
+
method: "GET",
|
|
1802
|
+
path: `/v1/flows/${encodeURIComponent(id)}/versions/${encodeURIComponent(version)}`
|
|
1803
|
+
});
|
|
1804
|
+
},
|
|
1805
|
+
async unregister(id, version, options) {
|
|
1806
|
+
const wire = await transport.request({
|
|
1807
|
+
method: "POST",
|
|
1808
|
+
path: `/v1/flows/${encodeURIComponent(id)}/versions/${encodeURIComponent(version)}/unregister`,
|
|
1809
|
+
body: {},
|
|
1810
|
+
...options?.idempotencyKey !== void 0 && {
|
|
1811
|
+
idempotencyKey: options.idempotencyKey
|
|
1812
|
+
}
|
|
1813
|
+
});
|
|
1814
|
+
return {
|
|
1815
|
+
flowId: wire.flowId,
|
|
1816
|
+
version: wire.version,
|
|
1817
|
+
unregistered: wire.unregistered
|
|
1818
|
+
};
|
|
1819
|
+
},
|
|
1820
|
+
async reinstate(id, version, options) {
|
|
1821
|
+
const wire = await transport.request({
|
|
1822
|
+
method: "POST",
|
|
1823
|
+
path: `/v1/flows/${encodeURIComponent(id)}/versions/${encodeURIComponent(version)}/reinstate`,
|
|
1824
|
+
...options?.idempotencyKey !== void 0 && {
|
|
1825
|
+
idempotencyKey: options.idempotencyKey
|
|
1826
|
+
}
|
|
1827
|
+
});
|
|
1828
|
+
return {
|
|
1829
|
+
flowId: wire.flowId,
|
|
1830
|
+
version: wire.version,
|
|
1831
|
+
wasTombstoned: wire.wasTombstoned
|
|
1832
|
+
};
|
|
1833
|
+
}
|
|
1834
|
+
}
|
|
1835
|
+
);
|
|
1650
1836
|
return {
|
|
1651
1837
|
async define(flow, options) {
|
|
1652
1838
|
const result = await transport.request({
|
|
@@ -1686,59 +1872,72 @@ function makeFlowsClient(transport) {
|
|
|
1686
1872
|
...filter?.name !== void 0 && { name: filter.name }
|
|
1687
1873
|
}
|
|
1688
1874
|
});
|
|
1689
|
-
return
|
|
1690
|
-
items: page.data,
|
|
1691
|
-
...page.nextCursor !== void 0 && {
|
|
1692
|
-
nextCursor: page.nextCursor
|
|
1693
|
-
}
|
|
1694
|
-
};
|
|
1875
|
+
return listPage(page);
|
|
1695
1876
|
},
|
|
1696
|
-
|
|
1697
|
-
|
|
1877
|
+
versions,
|
|
1878
|
+
getVersion: (id, version) => versions.get(id, version),
|
|
1879
|
+
async delete(id, version, options) {
|
|
1880
|
+
await versions.unregister(id, version, options);
|
|
1881
|
+
},
|
|
1882
|
+
reinstateVersion: (id, version, options) => versions.reinstate(id, version, options)
|
|
1883
|
+
};
|
|
1884
|
+
}
|
|
1885
|
+
|
|
1886
|
+
// src/resources/gate-policies.ts
|
|
1887
|
+
function makeGatePoliciesClient(transport) {
|
|
1888
|
+
const seg = (s) => encodeURIComponent(s);
|
|
1889
|
+
return {
|
|
1890
|
+
async list(filter) {
|
|
1891
|
+
return transport.request({
|
|
1698
1892
|
method: "GET",
|
|
1699
|
-
path:
|
|
1893
|
+
path: "/v1/gate-policies",
|
|
1700
1894
|
query: {
|
|
1895
|
+
...filter?.agentId !== void 0 && { agentId: filter.agentId },
|
|
1896
|
+
...filter?.scope !== void 0 && scopeQuery(filter.scope),
|
|
1701
1897
|
...filter?.limit !== void 0 && { limit: filter.limit },
|
|
1702
1898
|
...filter?.cursor !== void 0 && { cursor: filter.cursor }
|
|
1703
1899
|
}
|
|
1704
1900
|
});
|
|
1705
|
-
return {
|
|
1706
|
-
items: page.data,
|
|
1707
|
-
...page.nextCursor !== void 0 && {
|
|
1708
|
-
nextCursor: page.nextCursor
|
|
1709
|
-
}
|
|
1710
|
-
};
|
|
1711
1901
|
},
|
|
1712
|
-
async
|
|
1902
|
+
async get(policyId) {
|
|
1713
1903
|
return transport.request({
|
|
1714
1904
|
method: "GET",
|
|
1715
|
-
path: `/v1/
|
|
1905
|
+
path: `/v1/gate-policies/${seg(policyId)}`
|
|
1716
1906
|
});
|
|
1717
1907
|
},
|
|
1718
|
-
async
|
|
1719
|
-
|
|
1908
|
+
async publish(input, options) {
|
|
1909
|
+
return transport.request({
|
|
1720
1910
|
method: "POST",
|
|
1721
|
-
path:
|
|
1722
|
-
body:
|
|
1723
|
-
|
|
1724
|
-
...options?.idempotencyKey !== void 0 && {
|
|
1725
|
-
idempotencyKey: options.idempotencyKey
|
|
1726
|
-
}
|
|
1911
|
+
path: "/v1/gate-policies",
|
|
1912
|
+
body: input,
|
|
1913
|
+
...options?.idempotencyKey !== void 0 && { idempotencyKey: options.idempotencyKey }
|
|
1727
1914
|
});
|
|
1728
1915
|
},
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
}
|
|
1916
|
+
versions: {
|
|
1917
|
+
async list(policyId) {
|
|
1918
|
+
return transport.request({
|
|
1919
|
+
method: "GET",
|
|
1920
|
+
path: `/v1/gate-policies/${seg(policyId)}/versions`
|
|
1921
|
+
});
|
|
1922
|
+
},
|
|
1923
|
+
async get(policyId, version) {
|
|
1924
|
+
return transport.request({
|
|
1925
|
+
method: "GET",
|
|
1926
|
+
path: `/v1/gate-policies/${seg(policyId)}/versions/${seg(version)}`
|
|
1927
|
+
});
|
|
1928
|
+
},
|
|
1929
|
+
async unregister(policyId, version) {
|
|
1930
|
+
return transport.request({
|
|
1931
|
+
method: "POST",
|
|
1932
|
+
path: `/v1/gate-policies/${seg(policyId)}/versions/${seg(version)}/unregister`
|
|
1933
|
+
});
|
|
1934
|
+
},
|
|
1935
|
+
async reinstate(policyId, version) {
|
|
1936
|
+
return transport.request({
|
|
1937
|
+
method: "POST",
|
|
1938
|
+
path: `/v1/gate-policies/${seg(policyId)}/versions/${seg(version)}/reinstate`
|
|
1939
|
+
});
|
|
1940
|
+
}
|
|
1742
1941
|
}
|
|
1743
1942
|
};
|
|
1744
1943
|
}
|
|
@@ -1770,12 +1969,7 @@ function makeGuardrailsClient(transport) {
|
|
|
1770
1969
|
...filter?.name !== void 0 && { name: filter.name }
|
|
1771
1970
|
}
|
|
1772
1971
|
});
|
|
1773
|
-
return
|
|
1774
|
-
items: page.data,
|
|
1775
|
-
...page.nextCursor !== void 0 && {
|
|
1776
|
-
nextCursor: page.nextCursor
|
|
1777
|
-
}
|
|
1778
|
-
};
|
|
1972
|
+
return listPage(page);
|
|
1779
1973
|
},
|
|
1780
1974
|
async delete(id, options) {
|
|
1781
1975
|
return transport.request({
|
|
@@ -1858,7 +2052,7 @@ function makeIdentityClient(transport) {
|
|
|
1858
2052
|
}
|
|
1859
2053
|
|
|
1860
2054
|
// src/resources/judge-classes.ts
|
|
1861
|
-
function
|
|
2055
|
+
function scopeQuery2(scope) {
|
|
1862
2056
|
if (scope.kind === "tenant") return { scopeKind: "tenant" };
|
|
1863
2057
|
if (scope.kind === "project") return { scopeKind: "project", projectId: scope.projectId };
|
|
1864
2058
|
return { scopeKind: "agent", projectId: scope.projectId, agentId: scope.agentId };
|
|
@@ -1881,13 +2075,10 @@ function makeJudgeClassesClient(transport) {
|
|
|
1881
2075
|
query: {
|
|
1882
2076
|
...filter?.limit !== void 0 && { limit: filter.limit },
|
|
1883
2077
|
...filter?.cursor !== void 0 && { cursor: filter.cursor },
|
|
1884
|
-
...filter?.scope !== void 0 &&
|
|
2078
|
+
...filter?.scope !== void 0 && scopeQuery2(filter.scope)
|
|
1885
2079
|
}
|
|
1886
2080
|
});
|
|
1887
|
-
return
|
|
1888
|
-
items: page.data,
|
|
1889
|
-
...page.nextCursor !== void 0 && { nextCursor: page.nextCursor }
|
|
1890
|
-
};
|
|
2081
|
+
return listPage(page);
|
|
1891
2082
|
},
|
|
1892
2083
|
async get(judgeClassId) {
|
|
1893
2084
|
return transport.request({
|
|
@@ -1943,10 +2134,7 @@ function makeJudgmentsClient(transport) {
|
|
|
1943
2134
|
...filter?.scope !== void 0 && scopeToQuery(filter.scope)
|
|
1944
2135
|
}
|
|
1945
2136
|
});
|
|
1946
|
-
return
|
|
1947
|
-
items: page.data,
|
|
1948
|
-
...page.nextCursor !== void 0 && { nextCursor: page.nextCursor }
|
|
1949
|
-
};
|
|
2137
|
+
return listPage(page);
|
|
1950
2138
|
},
|
|
1951
2139
|
async get(judgmentId) {
|
|
1952
2140
|
return transport.request({
|
|
@@ -1980,12 +2168,7 @@ function makeMcpClient(transport) {
|
|
|
1980
2168
|
...filter?.transport !== void 0 && { transport: filter.transport }
|
|
1981
2169
|
}
|
|
1982
2170
|
});
|
|
1983
|
-
return
|
|
1984
|
-
items: page.data,
|
|
1985
|
-
...page.nextCursor !== void 0 && {
|
|
1986
|
-
nextCursor: page.nextCursor
|
|
1987
|
-
}
|
|
1988
|
-
};
|
|
2171
|
+
return listPage(page);
|
|
1989
2172
|
},
|
|
1990
2173
|
async register(input, options) {
|
|
1991
2174
|
const { scope, ...endpoint } = input;
|
|
@@ -2123,12 +2306,7 @@ function makeMemoryClient(transport) {
|
|
|
2123
2306
|
...filter?.scope !== void 0 && { scope: JSON.stringify(filter.scope) }
|
|
2124
2307
|
}
|
|
2125
2308
|
});
|
|
2126
|
-
return
|
|
2127
|
-
items: page.data,
|
|
2128
|
-
...page.nextCursor !== void 0 && {
|
|
2129
|
-
nextCursor: page.nextCursor
|
|
2130
|
-
}
|
|
2131
|
-
};
|
|
2309
|
+
return listPage(page);
|
|
2132
2310
|
},
|
|
2133
2311
|
async delete(id, options) {
|
|
2134
2312
|
return transport.request({
|
|
@@ -2209,10 +2387,7 @@ function makeObservationsClient(transport) {
|
|
|
2209
2387
|
...filter?.until !== void 0 && { until: filter.until }
|
|
2210
2388
|
}
|
|
2211
2389
|
});
|
|
2212
|
-
return
|
|
2213
|
-
items: page.data,
|
|
2214
|
-
...page.nextCursor !== void 0 && { nextCursor: page.nextCursor }
|
|
2215
|
-
};
|
|
2390
|
+
return listPage(page);
|
|
2216
2391
|
},
|
|
2217
2392
|
async patterns(_input) {
|
|
2218
2393
|
throw new KindgiApiError(
|
|
@@ -2325,8 +2500,9 @@ function makePacksClient(_transport) {
|
|
|
2325
2500
|
|
|
2326
2501
|
// src/resources/policies.ts
|
|
2327
2502
|
function makePoliciesClient(transport) {
|
|
2328
|
-
|
|
2329
|
-
|
|
2503
|
+
const client = {
|
|
2504
|
+
author: (spec, options) => client.publish(spec, options),
|
|
2505
|
+
async publish(spec, options) {
|
|
2330
2506
|
const result = await transport.request({
|
|
2331
2507
|
method: "POST",
|
|
2332
2508
|
path: "/v1/policies",
|
|
@@ -2363,12 +2539,7 @@ function makePoliciesClient(transport) {
|
|
|
2363
2539
|
...filter?.name !== void 0 && { name: filter.name }
|
|
2364
2540
|
}
|
|
2365
2541
|
});
|
|
2366
|
-
return
|
|
2367
|
-
items: page.data,
|
|
2368
|
-
...page.nextCursor !== void 0 && {
|
|
2369
|
-
nextCursor: page.nextCursor
|
|
2370
|
-
}
|
|
2371
|
-
};
|
|
2542
|
+
return listPage(page);
|
|
2372
2543
|
},
|
|
2373
2544
|
async versions(id, filter) {
|
|
2374
2545
|
const page = await transport.request({
|
|
@@ -2380,12 +2551,7 @@ function makePoliciesClient(transport) {
|
|
|
2380
2551
|
...filter?.includeTombstoned === true && { includeTombstoned: "true" }
|
|
2381
2552
|
}
|
|
2382
2553
|
});
|
|
2383
|
-
return
|
|
2384
|
-
items: page.data,
|
|
2385
|
-
...page.nextCursor !== void 0 && {
|
|
2386
|
-
nextCursor: page.nextCursor
|
|
2387
|
-
}
|
|
2388
|
-
};
|
|
2554
|
+
return listPage(page);
|
|
2389
2555
|
},
|
|
2390
2556
|
async getVersion(id, version) {
|
|
2391
2557
|
return transport.request({
|
|
@@ -2435,6 +2601,7 @@ function makePoliciesClient(transport) {
|
|
|
2435
2601
|
);
|
|
2436
2602
|
}
|
|
2437
2603
|
};
|
|
2604
|
+
return client;
|
|
2438
2605
|
}
|
|
2439
2606
|
|
|
2440
2607
|
// src/resources/projects.ts
|
|
@@ -2552,10 +2719,7 @@ function makeProvenanceClient(transport) {
|
|
|
2552
2719
|
}
|
|
2553
2720
|
}
|
|
2554
2721
|
});
|
|
2555
|
-
return
|
|
2556
|
-
items: page.data,
|
|
2557
|
-
...page.nextCursor !== void 0 && { nextCursor: page.nextCursor }
|
|
2558
|
-
};
|
|
2722
|
+
return listPage(page);
|
|
2559
2723
|
},
|
|
2560
2724
|
async export(input) {
|
|
2561
2725
|
return transport.request({
|
|
@@ -2624,6 +2788,40 @@ function makeProvidersClient(transport) {
|
|
|
2624
2788
|
};
|
|
2625
2789
|
}
|
|
2626
2790
|
|
|
2791
|
+
// src/resources/retention.ts
|
|
2792
|
+
function makeRetentionClient(transport) {
|
|
2793
|
+
return {
|
|
2794
|
+
async scheduled(filter) {
|
|
2795
|
+
const page = await transport.request({
|
|
2796
|
+
method: "GET",
|
|
2797
|
+
path: "/v1/retention/scheduled",
|
|
2798
|
+
query: {
|
|
2799
|
+
...filter?.domain !== void 0 && { domain: filter.domain },
|
|
2800
|
+
...filter?.pastGraceOnly === true && { pastGraceOnly: "true" },
|
|
2801
|
+
...filter?.limit !== void 0 && { limit: filter.limit },
|
|
2802
|
+
...filter?.cursor !== void 0 && { cursor: filter.cursor }
|
|
2803
|
+
}
|
|
2804
|
+
});
|
|
2805
|
+
return { ...page, hasMore: page.hasMore ?? page.nextCursor !== void 0 };
|
|
2806
|
+
},
|
|
2807
|
+
async sweep(input) {
|
|
2808
|
+
const body = input?.maxPerDomain !== void 0 ? { maxPerDomain: input.maxPerDomain } : {};
|
|
2809
|
+
if (input?.domain !== void 0) {
|
|
2810
|
+
return transport.request({
|
|
2811
|
+
method: "POST",
|
|
2812
|
+
path: `/v1/retention/sweep/${encodeURIComponent(input.domain)}`,
|
|
2813
|
+
body
|
|
2814
|
+
});
|
|
2815
|
+
}
|
|
2816
|
+
return transport.request({
|
|
2817
|
+
method: "POST",
|
|
2818
|
+
path: "/v1/retention/sweep",
|
|
2819
|
+
body
|
|
2820
|
+
});
|
|
2821
|
+
}
|
|
2822
|
+
};
|
|
2823
|
+
}
|
|
2824
|
+
|
|
2627
2825
|
// src/run-follow.ts
|
|
2628
2826
|
var MAX_REFRESHES_IN_A_ROW = 3;
|
|
2629
2827
|
var TERMINAL_KINDS = /* @__PURE__ */ new Set([
|
|
@@ -2702,12 +2900,14 @@ function makeRunsClient(transport) {
|
|
|
2702
2900
|
agent: input.agent,
|
|
2703
2901
|
...input.agentVersion !== void 0 && { agentVersion: input.agentVersion },
|
|
2704
2902
|
...input.projectId !== void 0 && { projectId: input.projectId },
|
|
2903
|
+
...input.segments !== void 0 && { segments: input.segments },
|
|
2705
2904
|
input: input.input,
|
|
2706
2905
|
...input.options !== void 0 && { options: input.options }
|
|
2707
2906
|
} : {
|
|
2708
2907
|
flow: input.flow,
|
|
2709
2908
|
...input.flowVersion !== void 0 && { flowVersion: input.flowVersion },
|
|
2710
2909
|
...input.projectId !== void 0 && { projectId: input.projectId },
|
|
2910
|
+
...input.segments !== void 0 && { segments: input.segments },
|
|
2711
2911
|
input: input.input,
|
|
2712
2912
|
...input.options !== void 0 && { options: input.options }
|
|
2713
2913
|
};
|
|
@@ -2959,6 +3159,7 @@ function makeSecretsClient(transport) {
|
|
|
2959
3159
|
});
|
|
2960
3160
|
return {
|
|
2961
3161
|
data: page.data,
|
|
3162
|
+
hasMore: page.hasMore ?? page.nextCursor !== void 0,
|
|
2962
3163
|
...page.nextCursor !== void 0 && {
|
|
2963
3164
|
nextCursor: page.nextCursor
|
|
2964
3165
|
}
|
|
@@ -3013,6 +3214,7 @@ function makeSecretsClient(transport) {
|
|
|
3013
3214
|
});
|
|
3014
3215
|
return {
|
|
3015
3216
|
data: page.data,
|
|
3217
|
+
hasMore: page.hasMore ?? page.nextCursor !== void 0,
|
|
3016
3218
|
...page.nextCursor !== void 0 && {
|
|
3017
3219
|
nextCursor: page.nextCursor
|
|
3018
3220
|
}
|
|
@@ -3253,12 +3455,7 @@ function makeSupervisorClient(transport) {
|
|
|
3253
3455
|
...input.tier !== void 0 && { tier: input.tier }
|
|
3254
3456
|
}
|
|
3255
3457
|
});
|
|
3256
|
-
return
|
|
3257
|
-
items: page.data,
|
|
3258
|
-
...page.nextCursor !== void 0 && {
|
|
3259
|
-
nextCursor: page.nextCursor
|
|
3260
|
-
}
|
|
3261
|
-
};
|
|
3458
|
+
return listPage(page);
|
|
3262
3459
|
},
|
|
3263
3460
|
async get(supervisorId, id) {
|
|
3264
3461
|
return transport.request({
|
|
@@ -3496,10 +3693,7 @@ function makeTokensClient(transport) {
|
|
|
3496
3693
|
...filter?.cursor !== void 0 && { cursor: filter.cursor }
|
|
3497
3694
|
}
|
|
3498
3695
|
});
|
|
3499
|
-
return {
|
|
3500
|
-
items: page.data.map(fromWire2),
|
|
3501
|
-
...page.nextCursor !== void 0 && { nextCursor: page.nextCursor }
|
|
3502
|
-
};
|
|
3696
|
+
return listPage({ ...page, data: page.data.map(fromWire2) });
|
|
3503
3697
|
},
|
|
3504
3698
|
async get(id) {
|
|
3505
3699
|
const wire = await transport.request({
|
|
@@ -3534,29 +3728,8 @@ function makeTokensClient(transport) {
|
|
|
3534
3728
|
|
|
3535
3729
|
// src/resources/tools.ts
|
|
3536
3730
|
function makeToolsClient(transport) {
|
|
3537
|
-
|
|
3538
|
-
async list(filter) {
|
|
3539
|
-
const page = await transport.request({
|
|
3540
|
-
method: "GET",
|
|
3541
|
-
path: "/v1/tools",
|
|
3542
|
-
query: {
|
|
3543
|
-
...filter?.limit !== void 0 && { limit: filter.limit },
|
|
3544
|
-
...filter?.cursor !== void 0 && { cursor: filter.cursor },
|
|
3545
|
-
...filter?.name !== void 0 && { name: filter.name }
|
|
3546
|
-
}
|
|
3547
|
-
});
|
|
3548
|
-
return {
|
|
3549
|
-
items: page.data,
|
|
3550
|
-
...page.nextCursor !== void 0 && { nextCursor: page.nextCursor }
|
|
3551
|
-
};
|
|
3552
|
-
},
|
|
3553
|
-
async get(id) {
|
|
3554
|
-
return transport.request({
|
|
3555
|
-
method: "GET",
|
|
3556
|
-
path: `/v1/tools/${encodeURIComponent(id)}`
|
|
3557
|
-
});
|
|
3558
|
-
},
|
|
3559
|
-
async listVersions(id, filter) {
|
|
3731
|
+
const versions = {
|
|
3732
|
+
async list(id, filter) {
|
|
3560
3733
|
const page = await transport.request({
|
|
3561
3734
|
method: "GET",
|
|
3562
3735
|
path: `/v1/tools/${encodeURIComponent(id)}/versions`,
|
|
@@ -3566,18 +3739,15 @@ function makeToolsClient(transport) {
|
|
|
3566
3739
|
...filter?.includeTombstoned === true && { includeTombstoned: "true" }
|
|
3567
3740
|
}
|
|
3568
3741
|
});
|
|
3569
|
-
return
|
|
3570
|
-
items: page.data,
|
|
3571
|
-
...page.nextCursor !== void 0 && { nextCursor: page.nextCursor }
|
|
3572
|
-
};
|
|
3742
|
+
return listPage(page);
|
|
3573
3743
|
},
|
|
3574
|
-
async
|
|
3744
|
+
async get(id, version) {
|
|
3575
3745
|
return transport.request({
|
|
3576
3746
|
method: "GET",
|
|
3577
3747
|
path: `/v1/tools/${encodeURIComponent(id)}/versions/${encodeURIComponent(version)}`
|
|
3578
3748
|
});
|
|
3579
3749
|
},
|
|
3580
|
-
async
|
|
3750
|
+
async reinstate(id, version, options) {
|
|
3581
3751
|
const wire = await transport.request({
|
|
3582
3752
|
method: "POST",
|
|
3583
3753
|
path: `/v1/tools/${encodeURIComponent(id)}/versions/${encodeURIComponent(version)}/reinstate`,
|
|
@@ -3591,7 +3761,7 @@ function makeToolsClient(transport) {
|
|
|
3591
3761
|
wasTombstoned: wire.wasTombstoned
|
|
3592
3762
|
};
|
|
3593
3763
|
},
|
|
3594
|
-
async
|
|
3764
|
+
async unregister(id, version, options) {
|
|
3595
3765
|
const wire = await transport.request({
|
|
3596
3766
|
method: "POST",
|
|
3597
3767
|
path: `/v1/tools/${encodeURIComponent(id)}/versions/${encodeURIComponent(version)}/unregister`,
|
|
@@ -3604,7 +3774,43 @@ function makeToolsClient(transport) {
|
|
|
3604
3774
|
version: wire.version,
|
|
3605
3775
|
unregistered: wire.unregistered
|
|
3606
3776
|
};
|
|
3777
|
+
}
|
|
3778
|
+
};
|
|
3779
|
+
return {
|
|
3780
|
+
async list(filter) {
|
|
3781
|
+
const page = await transport.request({
|
|
3782
|
+
method: "GET",
|
|
3783
|
+
path: "/v1/tools",
|
|
3784
|
+
query: {
|
|
3785
|
+
...filter?.limit !== void 0 && { limit: filter.limit },
|
|
3786
|
+
...filter?.cursor !== void 0 && { cursor: filter.cursor },
|
|
3787
|
+
...filter?.name !== void 0 && { name: filter.name }
|
|
3788
|
+
}
|
|
3789
|
+
});
|
|
3790
|
+
return listPage(page);
|
|
3791
|
+
},
|
|
3792
|
+
async get(id) {
|
|
3793
|
+
return transport.request({
|
|
3794
|
+
method: "GET",
|
|
3795
|
+
path: `/v1/tools/${encodeURIComponent(id)}`
|
|
3796
|
+
});
|
|
3607
3797
|
},
|
|
3798
|
+
versions,
|
|
3799
|
+
async register(manifest, options) {
|
|
3800
|
+
const result = await transport.request({
|
|
3801
|
+
method: "POST",
|
|
3802
|
+
path: "/v1/tools",
|
|
3803
|
+
body: { ...manifest, projectId: options.projectId },
|
|
3804
|
+
...options.idempotencyKey !== void 0 && {
|
|
3805
|
+
idempotencyKey: options.idempotencyKey
|
|
3806
|
+
}
|
|
3807
|
+
});
|
|
3808
|
+
return { toolId: result.toolId };
|
|
3809
|
+
},
|
|
3810
|
+
listVersions: (id, filter) => versions.list(id, filter),
|
|
3811
|
+
getVersion: (id, version) => versions.get(id, version),
|
|
3812
|
+
reinstateVersion: (id, version, options) => versions.reinstate(id, version, options),
|
|
3813
|
+
unregisterVersion: (id, version, options) => versions.unregister(id, version, options),
|
|
3608
3814
|
async invoke(_id, _input) {
|
|
3609
3815
|
throw new KindgiApiError(
|
|
3610
3816
|
notYetWired(
|
|
@@ -3657,12 +3863,7 @@ function makeUsersClient(transport) {
|
|
|
3657
3863
|
...filter?.query !== void 0 && { query: filter.query }
|
|
3658
3864
|
}
|
|
3659
3865
|
});
|
|
3660
|
-
return
|
|
3661
|
-
items: page.data,
|
|
3662
|
-
...page.nextCursor !== void 0 && {
|
|
3663
|
-
nextCursor: page.nextCursor
|
|
3664
|
-
}
|
|
3665
|
-
};
|
|
3866
|
+
return listPage(page);
|
|
3666
3867
|
},
|
|
3667
3868
|
async update(_id, _patch) {
|
|
3668
3869
|
throw new KindgiApiError(
|
|
@@ -3686,12 +3887,7 @@ function makeUsersClient(transport) {
|
|
|
3686
3887
|
method: "GET",
|
|
3687
3888
|
path: `/v1/identity/users/${encodeURIComponent(userId)}/sessions`
|
|
3688
3889
|
});
|
|
3689
|
-
return
|
|
3690
|
-
items: page.data,
|
|
3691
|
-
...page.nextCursor !== void 0 && {
|
|
3692
|
-
nextCursor: page.nextCursor
|
|
3693
|
-
}
|
|
3694
|
-
};
|
|
3890
|
+
return listPage(page);
|
|
3695
3891
|
},
|
|
3696
3892
|
async revokeAll(userId, options) {
|
|
3697
3893
|
return transport.request({
|
|
@@ -3922,7 +4118,9 @@ function createTransport(options) {
|
|
|
3922
4118
|
} catch {
|
|
3923
4119
|
body = void 0;
|
|
3924
4120
|
}
|
|
3925
|
-
throw new KindgiApiError(
|
|
4121
|
+
throw new KindgiApiError(
|
|
4122
|
+
fromWire(unwrapErrorEnvelope(body, response.status), response.status)
|
|
4123
|
+
);
|
|
3926
4124
|
}
|
|
3927
4125
|
};
|
|
3928
4126
|
}
|
|
@@ -3934,7 +4132,8 @@ function buildUrl(apiUrl, path, query) {
|
|
|
3934
4132
|
for (const key of Object.keys(query)) {
|
|
3935
4133
|
const value = query[key];
|
|
3936
4134
|
if (value === void 0) continue;
|
|
3937
|
-
|
|
4135
|
+
const values = typeof value === "object" ? value : [String(value)];
|
|
4136
|
+
for (const v of values) params.push(`${encodeURIComponent(key)}=${encodeURIComponent(v)}`);
|
|
3938
4137
|
}
|
|
3939
4138
|
return params.length === 0 ? base : `${base}?${params.join("&")}`;
|
|
3940
4139
|
}
|
|
@@ -3992,6 +4191,8 @@ function createClient(options) {
|
|
|
3992
4191
|
adapters: makeAdaptersClient(transport),
|
|
3993
4192
|
providers: makeProvidersClient(transport),
|
|
3994
4193
|
policies: makePoliciesClient(transport),
|
|
4194
|
+
gatePolicies: makeGatePoliciesClient(transport),
|
|
4195
|
+
retention: makeRetentionClient(transport),
|
|
3995
4196
|
projects: makeProjectsClient(transport),
|
|
3996
4197
|
env: makeEnvClient(transport),
|
|
3997
4198
|
secrets: makeSecretsClient(transport),
|
|
@@ -4022,6 +4223,7 @@ function createClient(options) {
|
|
|
4022
4223
|
|
|
4023
4224
|
exports.KindgiApiError = KindgiApiError;
|
|
4024
4225
|
exports.SseHttpError = SseHttpError;
|
|
4226
|
+
exports.comparisonOf = comparisonOf;
|
|
4025
4227
|
exports.createClient = createClient;
|
|
4026
4228
|
exports.followRun = followRun;
|
|
4027
4229
|
exports.fromWire = fromWire;
|