@kindgi/client 0.1.4-rc.1 → 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 +452 -256
- package/dist/index.d.cts +1725 -138
- package/dist/index.d.ts +1725 -138
- package/dist/index.js +452 -256
- 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":
|
|
@@ -110,6 +94,25 @@ function fromWire(body) {
|
|
|
110
94
|
case "slug-conflict":
|
|
111
95
|
case "project-default-already-exists":
|
|
112
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":
|
|
113
116
|
return { code: "conflict", message, reason: code };
|
|
114
117
|
case "invalid-request":
|
|
115
118
|
case "validation-failed":
|
|
@@ -125,11 +128,8 @@ function fromWire(body) {
|
|
|
125
128
|
case "invalid-guardrail":
|
|
126
129
|
case "invalid-provider":
|
|
127
130
|
case "supervisor-header-missing":
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
message,
|
|
131
|
-
issues: obj.issues ?? details?.issues ?? []
|
|
132
|
-
};
|
|
131
|
+
case "scope-invalid":
|
|
132
|
+
return invalidRequest(message, obj, details);
|
|
133
133
|
case "guardrail-violation":
|
|
134
134
|
return {
|
|
135
135
|
code: "guardrail-violation",
|
|
@@ -137,6 +137,23 @@ function fromWire(body) {
|
|
|
137
137
|
violations: readGuardrailViolations(details?.violations),
|
|
138
138
|
evaluationErrors: readEvaluationErrors(details?.evaluationErrors)
|
|
139
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);
|
|
140
157
|
default:
|
|
141
158
|
return {
|
|
142
159
|
code: "server",
|
|
@@ -146,6 +163,43 @@ function fromWire(body) {
|
|
|
146
163
|
};
|
|
147
164
|
}
|
|
148
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
|
+
}
|
|
149
203
|
function readStringField(obj, ...keys) {
|
|
150
204
|
if (obj === void 0) return void 0;
|
|
151
205
|
for (const key of keys) {
|
|
@@ -195,6 +249,17 @@ var KindgiApiError = class extends Error {
|
|
|
195
249
|
}
|
|
196
250
|
};
|
|
197
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
|
+
|
|
198
263
|
// src/streaming.ts
|
|
199
264
|
async function* readSse(options) {
|
|
200
265
|
const fetchImpl = options.fetchImpl ?? fetch;
|
|
@@ -350,10 +415,7 @@ function makeAdaptersClient(transport) {
|
|
|
350
415
|
...filter?.status !== void 0 && { status: filter.status }
|
|
351
416
|
}
|
|
352
417
|
});
|
|
353
|
-
return
|
|
354
|
-
items: page.data,
|
|
355
|
-
...page.nextCursor !== void 0 && { nextCursor: page.nextCursor }
|
|
356
|
-
};
|
|
418
|
+
return listPage(page);
|
|
357
419
|
},
|
|
358
420
|
async get(adapterId) {
|
|
359
421
|
return transport.request({
|
|
@@ -410,6 +472,57 @@ function makeAdaptersClient(transport) {
|
|
|
410
472
|
// src/resources/agents.ts
|
|
411
473
|
function makeAgentsClient(transport) {
|
|
412
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
|
+
};
|
|
413
526
|
return {
|
|
414
527
|
async define(spec, options) {
|
|
415
528
|
const result = await transport.request({
|
|
@@ -439,59 +552,106 @@ function makeAgentsClient(transport) {
|
|
|
439
552
|
path: `/v1/agents/${seg(agentId)}`
|
|
440
553
|
});
|
|
441
554
|
},
|
|
442
|
-
versions
|
|
443
|
-
|
|
555
|
+
versions,
|
|
556
|
+
reinstateVersion: (agentId, version, options) => versions.reinstate(agentId, version, options),
|
|
557
|
+
live: {
|
|
558
|
+
async resolve(agentId, where) {
|
|
444
559
|
return transport.request({
|
|
445
560
|
method: "GET",
|
|
446
|
-
path: `/v1/agents/${seg(agentId)}/
|
|
561
|
+
path: `/v1/agents/${seg(agentId)}/live`,
|
|
447
562
|
query: {
|
|
448
|
-
...
|
|
449
|
-
...
|
|
563
|
+
...where?.projectId !== void 0 && { projectId: where.projectId },
|
|
564
|
+
...where?.segments !== void 0 && { segment: where.segments.map(segmentParam) }
|
|
450
565
|
}
|
|
451
566
|
});
|
|
452
567
|
},
|
|
453
|
-
async
|
|
568
|
+
async list(agentId) {
|
|
454
569
|
return transport.request({
|
|
455
570
|
method: "GET",
|
|
456
|
-
path: `/v1/agents/${seg(agentId)}/versions
|
|
571
|
+
path: `/v1/agents/${seg(agentId)}/live-versions`
|
|
457
572
|
});
|
|
458
573
|
},
|
|
459
|
-
async
|
|
574
|
+
async rollback(agentId, input, options) {
|
|
460
575
|
return transport.request({
|
|
461
576
|
method: "POST",
|
|
462
|
-
path: `/v1/agents/${seg(agentId)}/
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
}
|
|
577
|
+
path: `/v1/agents/${seg(agentId)}/live/rollback`,
|
|
578
|
+
body: input,
|
|
579
|
+
...options?.idempotencyKey !== void 0 && { idempotencyKey: options.idempotencyKey }
|
|
466
580
|
});
|
|
467
581
|
},
|
|
468
|
-
async
|
|
582
|
+
async unpin(agentId, input, options) {
|
|
469
583
|
return transport.request({
|
|
470
584
|
method: "POST",
|
|
471
|
-
path: `/v1/agents/${seg(agentId)}/
|
|
585
|
+
path: `/v1/agents/${seg(agentId)}/live/unpin`,
|
|
472
586
|
body: input,
|
|
473
|
-
...options?.idempotencyKey !== void 0 && {
|
|
474
|
-
|
|
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 }
|
|
475
615
|
}
|
|
476
616
|
});
|
|
617
|
+
},
|
|
618
|
+
async get(agentId, promotionId) {
|
|
619
|
+
return transport.request({
|
|
620
|
+
method: "GET",
|
|
621
|
+
path: `/v1/agents/${seg(agentId)}/promotions/${seg(promotionId)}`
|
|
622
|
+
});
|
|
477
623
|
}
|
|
478
624
|
},
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
}
|
|
486
|
-
}
|
|
487
|
-
return {
|
|
488
|
-
agentId: wire.agentId,
|
|
489
|
-
version: wire.version,
|
|
490
|
-
wasTombstoned: wire.wasTombstoned
|
|
491
|
-
};
|
|
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
|
+
}
|
|
492
633
|
}
|
|
493
634
|
};
|
|
494
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
|
+
}
|
|
495
655
|
|
|
496
656
|
// src/scope-wire.ts
|
|
497
657
|
function scopeForBody(scope) {
|
|
@@ -540,12 +700,7 @@ function makeApprovalsClient(transport) {
|
|
|
540
700
|
}
|
|
541
701
|
}
|
|
542
702
|
});
|
|
543
|
-
return
|
|
544
|
-
items: page.data,
|
|
545
|
-
...page.nextCursor !== void 0 && {
|
|
546
|
-
nextCursor: page.nextCursor
|
|
547
|
-
}
|
|
548
|
-
};
|
|
703
|
+
return listPage(page);
|
|
549
704
|
},
|
|
550
705
|
async get(id) {
|
|
551
706
|
return transport.request({
|
|
@@ -613,12 +768,7 @@ function makeApprovalsClient(transport) {
|
|
|
613
768
|
...filter?.role !== void 0 && { role: filter.role }
|
|
614
769
|
}
|
|
615
770
|
});
|
|
616
|
-
return
|
|
617
|
-
items: page.data,
|
|
618
|
-
...page.nextCursor !== void 0 && {
|
|
619
|
-
nextCursor: page.nextCursor
|
|
620
|
-
}
|
|
621
|
-
};
|
|
771
|
+
return listPage(page);
|
|
622
772
|
},
|
|
623
773
|
async get(id) {
|
|
624
774
|
return transport.request({
|
|
@@ -719,12 +869,7 @@ function makeArtifactsClient(transport) {
|
|
|
719
869
|
...filter?.contentType !== void 0 && { contentType: filter.contentType }
|
|
720
870
|
}
|
|
721
871
|
});
|
|
722
|
-
return
|
|
723
|
-
items: page.data,
|
|
724
|
-
...page.nextCursor !== void 0 && {
|
|
725
|
-
nextCursor: page.nextCursor
|
|
726
|
-
}
|
|
727
|
-
};
|
|
872
|
+
return listPage(page);
|
|
728
873
|
},
|
|
729
874
|
async delete(blobId, options) {
|
|
730
875
|
return transport.request({
|
|
@@ -772,7 +917,8 @@ function makeAuditClient(transport) {
|
|
|
772
917
|
...filter?.outcome !== void 0 && { outcome: filter.outcome },
|
|
773
918
|
...filter?.runId !== void 0 && { runId: filter.runId },
|
|
774
919
|
...filter?.from !== void 0 && { from: filter.from },
|
|
775
|
-
...filter?.to !== void 0 && { to: filter.to }
|
|
920
|
+
...filter?.to !== void 0 && { to: filter.to },
|
|
921
|
+
...filter?.order !== void 0 && { order: filter.order }
|
|
776
922
|
}
|
|
777
923
|
});
|
|
778
924
|
}
|
|
@@ -786,10 +932,11 @@ function makeAuthClient(transport) {
|
|
|
786
932
|
return {
|
|
787
933
|
providers: {
|
|
788
934
|
async list() {
|
|
789
|
-
|
|
935
|
+
const page = await transport.request({
|
|
790
936
|
method: "GET",
|
|
791
937
|
path: "/v1/auth/providers"
|
|
792
938
|
});
|
|
939
|
+
return { ...page, hasMore: page.hasMore ?? false };
|
|
793
940
|
},
|
|
794
941
|
async register(input, options) {
|
|
795
942
|
return transport.request({
|
|
@@ -918,12 +1065,7 @@ function makeCapabilitiesClient(transport) {
|
|
|
918
1065
|
...filter?.feature !== void 0 && { feature: filter.feature }
|
|
919
1066
|
}
|
|
920
1067
|
});
|
|
921
|
-
return
|
|
922
|
-
items: page.data,
|
|
923
|
-
...page.nextCursor !== void 0 && {
|
|
924
|
-
nextCursor: page.nextCursor
|
|
925
|
-
}
|
|
926
|
-
};
|
|
1068
|
+
return listPage(page);
|
|
927
1069
|
},
|
|
928
1070
|
async get(capabilityId) {
|
|
929
1071
|
return transport.request({
|
|
@@ -950,12 +1092,7 @@ function makeCapabilitiesClient(transport) {
|
|
|
950
1092
|
...filter?.feature !== void 0 && { feature: filter.feature }
|
|
951
1093
|
}
|
|
952
1094
|
});
|
|
953
|
-
return
|
|
954
|
-
items: page.data,
|
|
955
|
-
...page.nextCursor !== void 0 && {
|
|
956
|
-
nextCursor: page.nextCursor
|
|
957
|
-
}
|
|
958
|
-
};
|
|
1095
|
+
return listPage(page);
|
|
959
1096
|
},
|
|
960
1097
|
async get(id) {
|
|
961
1098
|
return transport.request({
|
|
@@ -1085,13 +1222,11 @@ function makeConversationsClient(transport) {
|
|
|
1085
1222
|
...filter?.cursor !== void 0 && { cursor: filter.cursor },
|
|
1086
1223
|
...statusParam !== void 0 && { status: statusParam },
|
|
1087
1224
|
...filter?.scope !== void 0 && scopeToQuery(filter.scope),
|
|
1088
|
-
...filter?.agent !== void 0 && { agentId: filter.agent }
|
|
1225
|
+
...filter?.agent !== void 0 && { agentId: filter.agent },
|
|
1226
|
+
...filter?.replays !== void 0 && { replays: filter.replays }
|
|
1089
1227
|
}
|
|
1090
1228
|
});
|
|
1091
|
-
return
|
|
1092
|
-
items: page.data,
|
|
1093
|
-
...page.nextCursor !== void 0 && { nextCursor: page.nextCursor }
|
|
1094
|
-
};
|
|
1229
|
+
return listPage(page);
|
|
1095
1230
|
},
|
|
1096
1231
|
async close(id, options) {
|
|
1097
1232
|
return transport.request({
|
|
@@ -1112,10 +1247,7 @@ function makeConversationsClient(transport) {
|
|
|
1112
1247
|
...filter?.cursor !== void 0 && { cursor: filter.cursor }
|
|
1113
1248
|
}
|
|
1114
1249
|
});
|
|
1115
|
-
return
|
|
1116
|
-
items: page.data,
|
|
1117
|
-
...page.nextCursor !== void 0 && { nextCursor: page.nextCursor }
|
|
1118
|
-
};
|
|
1250
|
+
return listPage(page);
|
|
1119
1251
|
}
|
|
1120
1252
|
};
|
|
1121
1253
|
}
|
|
@@ -1157,12 +1289,7 @@ function makeCostClient(transport) {
|
|
|
1157
1289
|
...filterQuery(filter ?? {})
|
|
1158
1290
|
}
|
|
1159
1291
|
});
|
|
1160
|
-
return
|
|
1161
|
-
items: page.data,
|
|
1162
|
-
...page.nextCursor !== void 0 && {
|
|
1163
|
-
nextCursor: page.nextCursor
|
|
1164
|
-
}
|
|
1165
|
-
};
|
|
1292
|
+
return listPage(page);
|
|
1166
1293
|
},
|
|
1167
1294
|
async get(recordId, options) {
|
|
1168
1295
|
return transport.request({
|
|
@@ -1172,7 +1299,7 @@ function makeCostClient(transport) {
|
|
|
1172
1299
|
});
|
|
1173
1300
|
},
|
|
1174
1301
|
async summary(input) {
|
|
1175
|
-
const { from, to, groupBy, ...filter } = input;
|
|
1302
|
+
const { from, to, groupBy, limit, ...filter } = input;
|
|
1176
1303
|
return transport.request({
|
|
1177
1304
|
method: "GET",
|
|
1178
1305
|
path: "/v1/cost/aggregate",
|
|
@@ -1180,7 +1307,8 @@ function makeCostClient(transport) {
|
|
|
1180
1307
|
...filterQuery(filter),
|
|
1181
1308
|
from,
|
|
1182
1309
|
to,
|
|
1183
|
-
...groupBy !== void 0 && { groupBy: groupBy.join(",") }
|
|
1310
|
+
...groupBy !== void 0 && { groupBy: groupBy.join(",") },
|
|
1311
|
+
...limit !== void 0 && { limit }
|
|
1184
1312
|
}
|
|
1185
1313
|
});
|
|
1186
1314
|
}
|
|
@@ -1275,6 +1403,7 @@ function makeEnvClient(transport) {
|
|
|
1275
1403
|
});
|
|
1276
1404
|
return {
|
|
1277
1405
|
data: page.data,
|
|
1406
|
+
hasMore: page.hasMore ?? page.nextCursor !== void 0,
|
|
1278
1407
|
...page.nextCursor !== void 0 && {
|
|
1279
1408
|
nextCursor: page.nextCursor
|
|
1280
1409
|
}
|
|
@@ -1652,6 +1781,58 @@ function makeEventsClient(_transport) {
|
|
|
1652
1781
|
|
|
1653
1782
|
// src/resources/flows.ts
|
|
1654
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
|
+
);
|
|
1655
1836
|
return {
|
|
1656
1837
|
async define(flow, options) {
|
|
1657
1838
|
const result = await transport.request({
|
|
@@ -1691,59 +1872,72 @@ function makeFlowsClient(transport) {
|
|
|
1691
1872
|
...filter?.name !== void 0 && { name: filter.name }
|
|
1692
1873
|
}
|
|
1693
1874
|
});
|
|
1694
|
-
return
|
|
1695
|
-
items: page.data,
|
|
1696
|
-
...page.nextCursor !== void 0 && {
|
|
1697
|
-
nextCursor: page.nextCursor
|
|
1698
|
-
}
|
|
1699
|
-
};
|
|
1875
|
+
return listPage(page);
|
|
1700
1876
|
},
|
|
1701
|
-
|
|
1702
|
-
|
|
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({
|
|
1703
1892
|
method: "GET",
|
|
1704
|
-
path:
|
|
1893
|
+
path: "/v1/gate-policies",
|
|
1705
1894
|
query: {
|
|
1895
|
+
...filter?.agentId !== void 0 && { agentId: filter.agentId },
|
|
1896
|
+
...filter?.scope !== void 0 && scopeQuery(filter.scope),
|
|
1706
1897
|
...filter?.limit !== void 0 && { limit: filter.limit },
|
|
1707
1898
|
...filter?.cursor !== void 0 && { cursor: filter.cursor }
|
|
1708
1899
|
}
|
|
1709
1900
|
});
|
|
1710
|
-
return {
|
|
1711
|
-
items: page.data,
|
|
1712
|
-
...page.nextCursor !== void 0 && {
|
|
1713
|
-
nextCursor: page.nextCursor
|
|
1714
|
-
}
|
|
1715
|
-
};
|
|
1716
1901
|
},
|
|
1717
|
-
async
|
|
1902
|
+
async get(policyId) {
|
|
1718
1903
|
return transport.request({
|
|
1719
1904
|
method: "GET",
|
|
1720
|
-
path: `/v1/
|
|
1905
|
+
path: `/v1/gate-policies/${seg(policyId)}`
|
|
1721
1906
|
});
|
|
1722
1907
|
},
|
|
1723
|
-
async
|
|
1724
|
-
|
|
1908
|
+
async publish(input, options) {
|
|
1909
|
+
return transport.request({
|
|
1725
1910
|
method: "POST",
|
|
1726
|
-
path:
|
|
1727
|
-
body:
|
|
1728
|
-
|
|
1729
|
-
...options?.idempotencyKey !== void 0 && {
|
|
1730
|
-
idempotencyKey: options.idempotencyKey
|
|
1731
|
-
}
|
|
1911
|
+
path: "/v1/gate-policies",
|
|
1912
|
+
body: input,
|
|
1913
|
+
...options?.idempotencyKey !== void 0 && { idempotencyKey: options.idempotencyKey }
|
|
1732
1914
|
});
|
|
1733
1915
|
},
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
}
|
|
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
|
+
}
|
|
1747
1941
|
}
|
|
1748
1942
|
};
|
|
1749
1943
|
}
|
|
@@ -1775,12 +1969,7 @@ function makeGuardrailsClient(transport) {
|
|
|
1775
1969
|
...filter?.name !== void 0 && { name: filter.name }
|
|
1776
1970
|
}
|
|
1777
1971
|
});
|
|
1778
|
-
return
|
|
1779
|
-
items: page.data,
|
|
1780
|
-
...page.nextCursor !== void 0 && {
|
|
1781
|
-
nextCursor: page.nextCursor
|
|
1782
|
-
}
|
|
1783
|
-
};
|
|
1972
|
+
return listPage(page);
|
|
1784
1973
|
},
|
|
1785
1974
|
async delete(id, options) {
|
|
1786
1975
|
return transport.request({
|
|
@@ -1863,7 +2052,7 @@ function makeIdentityClient(transport) {
|
|
|
1863
2052
|
}
|
|
1864
2053
|
|
|
1865
2054
|
// src/resources/judge-classes.ts
|
|
1866
|
-
function
|
|
2055
|
+
function scopeQuery2(scope) {
|
|
1867
2056
|
if (scope.kind === "tenant") return { scopeKind: "tenant" };
|
|
1868
2057
|
if (scope.kind === "project") return { scopeKind: "project", projectId: scope.projectId };
|
|
1869
2058
|
return { scopeKind: "agent", projectId: scope.projectId, agentId: scope.agentId };
|
|
@@ -1886,13 +2075,10 @@ function makeJudgeClassesClient(transport) {
|
|
|
1886
2075
|
query: {
|
|
1887
2076
|
...filter?.limit !== void 0 && { limit: filter.limit },
|
|
1888
2077
|
...filter?.cursor !== void 0 && { cursor: filter.cursor },
|
|
1889
|
-
...filter?.scope !== void 0 &&
|
|
2078
|
+
...filter?.scope !== void 0 && scopeQuery2(filter.scope)
|
|
1890
2079
|
}
|
|
1891
2080
|
});
|
|
1892
|
-
return
|
|
1893
|
-
items: page.data,
|
|
1894
|
-
...page.nextCursor !== void 0 && { nextCursor: page.nextCursor }
|
|
1895
|
-
};
|
|
2081
|
+
return listPage(page);
|
|
1896
2082
|
},
|
|
1897
2083
|
async get(judgeClassId) {
|
|
1898
2084
|
return transport.request({
|
|
@@ -1948,10 +2134,7 @@ function makeJudgmentsClient(transport) {
|
|
|
1948
2134
|
...filter?.scope !== void 0 && scopeToQuery(filter.scope)
|
|
1949
2135
|
}
|
|
1950
2136
|
});
|
|
1951
|
-
return
|
|
1952
|
-
items: page.data,
|
|
1953
|
-
...page.nextCursor !== void 0 && { nextCursor: page.nextCursor }
|
|
1954
|
-
};
|
|
2137
|
+
return listPage(page);
|
|
1955
2138
|
},
|
|
1956
2139
|
async get(judgmentId) {
|
|
1957
2140
|
return transport.request({
|
|
@@ -1985,12 +2168,7 @@ function makeMcpClient(transport) {
|
|
|
1985
2168
|
...filter?.transport !== void 0 && { transport: filter.transport }
|
|
1986
2169
|
}
|
|
1987
2170
|
});
|
|
1988
|
-
return
|
|
1989
|
-
items: page.data,
|
|
1990
|
-
...page.nextCursor !== void 0 && {
|
|
1991
|
-
nextCursor: page.nextCursor
|
|
1992
|
-
}
|
|
1993
|
-
};
|
|
2171
|
+
return listPage(page);
|
|
1994
2172
|
},
|
|
1995
2173
|
async register(input, options) {
|
|
1996
2174
|
const { scope, ...endpoint } = input;
|
|
@@ -2128,12 +2306,7 @@ function makeMemoryClient(transport) {
|
|
|
2128
2306
|
...filter?.scope !== void 0 && { scope: JSON.stringify(filter.scope) }
|
|
2129
2307
|
}
|
|
2130
2308
|
});
|
|
2131
|
-
return
|
|
2132
|
-
items: page.data,
|
|
2133
|
-
...page.nextCursor !== void 0 && {
|
|
2134
|
-
nextCursor: page.nextCursor
|
|
2135
|
-
}
|
|
2136
|
-
};
|
|
2309
|
+
return listPage(page);
|
|
2137
2310
|
},
|
|
2138
2311
|
async delete(id, options) {
|
|
2139
2312
|
return transport.request({
|
|
@@ -2214,10 +2387,7 @@ function makeObservationsClient(transport) {
|
|
|
2214
2387
|
...filter?.until !== void 0 && { until: filter.until }
|
|
2215
2388
|
}
|
|
2216
2389
|
});
|
|
2217
|
-
return
|
|
2218
|
-
items: page.data,
|
|
2219
|
-
...page.nextCursor !== void 0 && { nextCursor: page.nextCursor }
|
|
2220
|
-
};
|
|
2390
|
+
return listPage(page);
|
|
2221
2391
|
},
|
|
2222
2392
|
async patterns(_input) {
|
|
2223
2393
|
throw new KindgiApiError(
|
|
@@ -2330,8 +2500,9 @@ function makePacksClient(_transport) {
|
|
|
2330
2500
|
|
|
2331
2501
|
// src/resources/policies.ts
|
|
2332
2502
|
function makePoliciesClient(transport) {
|
|
2333
|
-
|
|
2334
|
-
|
|
2503
|
+
const client = {
|
|
2504
|
+
author: (spec, options) => client.publish(spec, options),
|
|
2505
|
+
async publish(spec, options) {
|
|
2335
2506
|
const result = await transport.request({
|
|
2336
2507
|
method: "POST",
|
|
2337
2508
|
path: "/v1/policies",
|
|
@@ -2368,12 +2539,7 @@ function makePoliciesClient(transport) {
|
|
|
2368
2539
|
...filter?.name !== void 0 && { name: filter.name }
|
|
2369
2540
|
}
|
|
2370
2541
|
});
|
|
2371
|
-
return
|
|
2372
|
-
items: page.data,
|
|
2373
|
-
...page.nextCursor !== void 0 && {
|
|
2374
|
-
nextCursor: page.nextCursor
|
|
2375
|
-
}
|
|
2376
|
-
};
|
|
2542
|
+
return listPage(page);
|
|
2377
2543
|
},
|
|
2378
2544
|
async versions(id, filter) {
|
|
2379
2545
|
const page = await transport.request({
|
|
@@ -2385,12 +2551,7 @@ function makePoliciesClient(transport) {
|
|
|
2385
2551
|
...filter?.includeTombstoned === true && { includeTombstoned: "true" }
|
|
2386
2552
|
}
|
|
2387
2553
|
});
|
|
2388
|
-
return
|
|
2389
|
-
items: page.data,
|
|
2390
|
-
...page.nextCursor !== void 0 && {
|
|
2391
|
-
nextCursor: page.nextCursor
|
|
2392
|
-
}
|
|
2393
|
-
};
|
|
2554
|
+
return listPage(page);
|
|
2394
2555
|
},
|
|
2395
2556
|
async getVersion(id, version) {
|
|
2396
2557
|
return transport.request({
|
|
@@ -2440,6 +2601,7 @@ function makePoliciesClient(transport) {
|
|
|
2440
2601
|
);
|
|
2441
2602
|
}
|
|
2442
2603
|
};
|
|
2604
|
+
return client;
|
|
2443
2605
|
}
|
|
2444
2606
|
|
|
2445
2607
|
// src/resources/projects.ts
|
|
@@ -2557,10 +2719,7 @@ function makeProvenanceClient(transport) {
|
|
|
2557
2719
|
}
|
|
2558
2720
|
}
|
|
2559
2721
|
});
|
|
2560
|
-
return
|
|
2561
|
-
items: page.data,
|
|
2562
|
-
...page.nextCursor !== void 0 && { nextCursor: page.nextCursor }
|
|
2563
|
-
};
|
|
2722
|
+
return listPage(page);
|
|
2564
2723
|
},
|
|
2565
2724
|
async export(input) {
|
|
2566
2725
|
return transport.request({
|
|
@@ -2629,6 +2788,40 @@ function makeProvidersClient(transport) {
|
|
|
2629
2788
|
};
|
|
2630
2789
|
}
|
|
2631
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
|
+
|
|
2632
2825
|
// src/run-follow.ts
|
|
2633
2826
|
var MAX_REFRESHES_IN_A_ROW = 3;
|
|
2634
2827
|
var TERMINAL_KINDS = /* @__PURE__ */ new Set([
|
|
@@ -2707,12 +2900,14 @@ function makeRunsClient(transport) {
|
|
|
2707
2900
|
agent: input.agent,
|
|
2708
2901
|
...input.agentVersion !== void 0 && { agentVersion: input.agentVersion },
|
|
2709
2902
|
...input.projectId !== void 0 && { projectId: input.projectId },
|
|
2903
|
+
...input.segments !== void 0 && { segments: input.segments },
|
|
2710
2904
|
input: input.input,
|
|
2711
2905
|
...input.options !== void 0 && { options: input.options }
|
|
2712
2906
|
} : {
|
|
2713
2907
|
flow: input.flow,
|
|
2714
2908
|
...input.flowVersion !== void 0 && { flowVersion: input.flowVersion },
|
|
2715
2909
|
...input.projectId !== void 0 && { projectId: input.projectId },
|
|
2910
|
+
...input.segments !== void 0 && { segments: input.segments },
|
|
2716
2911
|
input: input.input,
|
|
2717
2912
|
...input.options !== void 0 && { options: input.options }
|
|
2718
2913
|
};
|
|
@@ -2964,6 +3159,7 @@ function makeSecretsClient(transport) {
|
|
|
2964
3159
|
});
|
|
2965
3160
|
return {
|
|
2966
3161
|
data: page.data,
|
|
3162
|
+
hasMore: page.hasMore ?? page.nextCursor !== void 0,
|
|
2967
3163
|
...page.nextCursor !== void 0 && {
|
|
2968
3164
|
nextCursor: page.nextCursor
|
|
2969
3165
|
}
|
|
@@ -3018,6 +3214,7 @@ function makeSecretsClient(transport) {
|
|
|
3018
3214
|
});
|
|
3019
3215
|
return {
|
|
3020
3216
|
data: page.data,
|
|
3217
|
+
hasMore: page.hasMore ?? page.nextCursor !== void 0,
|
|
3021
3218
|
...page.nextCursor !== void 0 && {
|
|
3022
3219
|
nextCursor: page.nextCursor
|
|
3023
3220
|
}
|
|
@@ -3258,12 +3455,7 @@ function makeSupervisorClient(transport) {
|
|
|
3258
3455
|
...input.tier !== void 0 && { tier: input.tier }
|
|
3259
3456
|
}
|
|
3260
3457
|
});
|
|
3261
|
-
return
|
|
3262
|
-
items: page.data,
|
|
3263
|
-
...page.nextCursor !== void 0 && {
|
|
3264
|
-
nextCursor: page.nextCursor
|
|
3265
|
-
}
|
|
3266
|
-
};
|
|
3458
|
+
return listPage(page);
|
|
3267
3459
|
},
|
|
3268
3460
|
async get(supervisorId, id) {
|
|
3269
3461
|
return transport.request({
|
|
@@ -3501,10 +3693,7 @@ function makeTokensClient(transport) {
|
|
|
3501
3693
|
...filter?.cursor !== void 0 && { cursor: filter.cursor }
|
|
3502
3694
|
}
|
|
3503
3695
|
});
|
|
3504
|
-
return {
|
|
3505
|
-
items: page.data.map(fromWire2),
|
|
3506
|
-
...page.nextCursor !== void 0 && { nextCursor: page.nextCursor }
|
|
3507
|
-
};
|
|
3696
|
+
return listPage({ ...page, data: page.data.map(fromWire2) });
|
|
3508
3697
|
},
|
|
3509
3698
|
async get(id) {
|
|
3510
3699
|
const wire = await transport.request({
|
|
@@ -3539,29 +3728,8 @@ function makeTokensClient(transport) {
|
|
|
3539
3728
|
|
|
3540
3729
|
// src/resources/tools.ts
|
|
3541
3730
|
function makeToolsClient(transport) {
|
|
3542
|
-
|
|
3543
|
-
async list(filter) {
|
|
3544
|
-
const page = await transport.request({
|
|
3545
|
-
method: "GET",
|
|
3546
|
-
path: "/v1/tools",
|
|
3547
|
-
query: {
|
|
3548
|
-
...filter?.limit !== void 0 && { limit: filter.limit },
|
|
3549
|
-
...filter?.cursor !== void 0 && { cursor: filter.cursor },
|
|
3550
|
-
...filter?.name !== void 0 && { name: filter.name }
|
|
3551
|
-
}
|
|
3552
|
-
});
|
|
3553
|
-
return {
|
|
3554
|
-
items: page.data,
|
|
3555
|
-
...page.nextCursor !== void 0 && { nextCursor: page.nextCursor }
|
|
3556
|
-
};
|
|
3557
|
-
},
|
|
3558
|
-
async get(id) {
|
|
3559
|
-
return transport.request({
|
|
3560
|
-
method: "GET",
|
|
3561
|
-
path: `/v1/tools/${encodeURIComponent(id)}`
|
|
3562
|
-
});
|
|
3563
|
-
},
|
|
3564
|
-
async listVersions(id, filter) {
|
|
3731
|
+
const versions = {
|
|
3732
|
+
async list(id, filter) {
|
|
3565
3733
|
const page = await transport.request({
|
|
3566
3734
|
method: "GET",
|
|
3567
3735
|
path: `/v1/tools/${encodeURIComponent(id)}/versions`,
|
|
@@ -3571,18 +3739,15 @@ function makeToolsClient(transport) {
|
|
|
3571
3739
|
...filter?.includeTombstoned === true && { includeTombstoned: "true" }
|
|
3572
3740
|
}
|
|
3573
3741
|
});
|
|
3574
|
-
return
|
|
3575
|
-
items: page.data,
|
|
3576
|
-
...page.nextCursor !== void 0 && { nextCursor: page.nextCursor }
|
|
3577
|
-
};
|
|
3742
|
+
return listPage(page);
|
|
3578
3743
|
},
|
|
3579
|
-
async
|
|
3744
|
+
async get(id, version) {
|
|
3580
3745
|
return transport.request({
|
|
3581
3746
|
method: "GET",
|
|
3582
3747
|
path: `/v1/tools/${encodeURIComponent(id)}/versions/${encodeURIComponent(version)}`
|
|
3583
3748
|
});
|
|
3584
3749
|
},
|
|
3585
|
-
async
|
|
3750
|
+
async reinstate(id, version, options) {
|
|
3586
3751
|
const wire = await transport.request({
|
|
3587
3752
|
method: "POST",
|
|
3588
3753
|
path: `/v1/tools/${encodeURIComponent(id)}/versions/${encodeURIComponent(version)}/reinstate`,
|
|
@@ -3596,7 +3761,7 @@ function makeToolsClient(transport) {
|
|
|
3596
3761
|
wasTombstoned: wire.wasTombstoned
|
|
3597
3762
|
};
|
|
3598
3763
|
},
|
|
3599
|
-
async
|
|
3764
|
+
async unregister(id, version, options) {
|
|
3600
3765
|
const wire = await transport.request({
|
|
3601
3766
|
method: "POST",
|
|
3602
3767
|
path: `/v1/tools/${encodeURIComponent(id)}/versions/${encodeURIComponent(version)}/unregister`,
|
|
@@ -3609,7 +3774,43 @@ function makeToolsClient(transport) {
|
|
|
3609
3774
|
version: wire.version,
|
|
3610
3775
|
unregistered: wire.unregistered
|
|
3611
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
|
+
});
|
|
3612
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),
|
|
3613
3814
|
async invoke(_id, _input) {
|
|
3614
3815
|
throw new KindgiApiError(
|
|
3615
3816
|
notYetWired(
|
|
@@ -3662,12 +3863,7 @@ function makeUsersClient(transport) {
|
|
|
3662
3863
|
...filter?.query !== void 0 && { query: filter.query }
|
|
3663
3864
|
}
|
|
3664
3865
|
});
|
|
3665
|
-
return
|
|
3666
|
-
items: page.data,
|
|
3667
|
-
...page.nextCursor !== void 0 && {
|
|
3668
|
-
nextCursor: page.nextCursor
|
|
3669
|
-
}
|
|
3670
|
-
};
|
|
3866
|
+
return listPage(page);
|
|
3671
3867
|
},
|
|
3672
3868
|
async update(_id, _patch) {
|
|
3673
3869
|
throw new KindgiApiError(
|
|
@@ -3691,12 +3887,7 @@ function makeUsersClient(transport) {
|
|
|
3691
3887
|
method: "GET",
|
|
3692
3888
|
path: `/v1/identity/users/${encodeURIComponent(userId)}/sessions`
|
|
3693
3889
|
});
|
|
3694
|
-
return
|
|
3695
|
-
items: page.data,
|
|
3696
|
-
...page.nextCursor !== void 0 && {
|
|
3697
|
-
nextCursor: page.nextCursor
|
|
3698
|
-
}
|
|
3699
|
-
};
|
|
3890
|
+
return listPage(page);
|
|
3700
3891
|
},
|
|
3701
3892
|
async revokeAll(userId, options) {
|
|
3702
3893
|
return transport.request({
|
|
@@ -3927,7 +4118,9 @@ function createTransport(options) {
|
|
|
3927
4118
|
} catch {
|
|
3928
4119
|
body = void 0;
|
|
3929
4120
|
}
|
|
3930
|
-
throw new KindgiApiError(
|
|
4121
|
+
throw new KindgiApiError(
|
|
4122
|
+
fromWire(unwrapErrorEnvelope(body, response.status), response.status)
|
|
4123
|
+
);
|
|
3931
4124
|
}
|
|
3932
4125
|
};
|
|
3933
4126
|
}
|
|
@@ -3939,7 +4132,8 @@ function buildUrl(apiUrl, path, query) {
|
|
|
3939
4132
|
for (const key of Object.keys(query)) {
|
|
3940
4133
|
const value = query[key];
|
|
3941
4134
|
if (value === void 0) continue;
|
|
3942
|
-
|
|
4135
|
+
const values = typeof value === "object" ? value : [String(value)];
|
|
4136
|
+
for (const v of values) params.push(`${encodeURIComponent(key)}=${encodeURIComponent(v)}`);
|
|
3943
4137
|
}
|
|
3944
4138
|
return params.length === 0 ? base : `${base}?${params.join("&")}`;
|
|
3945
4139
|
}
|
|
@@ -3997,6 +4191,8 @@ function createClient(options) {
|
|
|
3997
4191
|
adapters: makeAdaptersClient(transport),
|
|
3998
4192
|
providers: makeProvidersClient(transport),
|
|
3999
4193
|
policies: makePoliciesClient(transport),
|
|
4194
|
+
gatePolicies: makeGatePoliciesClient(transport),
|
|
4195
|
+
retention: makeRetentionClient(transport),
|
|
4000
4196
|
projects: makeProjectsClient(transport),
|
|
4001
4197
|
env: makeEnvClient(transport),
|
|
4002
4198
|
secrets: makeSecretsClient(transport),
|