@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.js
CHANGED
|
@@ -14,7 +14,13 @@ function notYetWired(method, reason) {
|
|
|
14
14
|
reason
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
|
-
function fromWire(body) {
|
|
17
|
+
function fromWire(body, status) {
|
|
18
|
+
const error = classify(body, status);
|
|
19
|
+
if (error.code === "server") return error;
|
|
20
|
+
const code = body !== null && typeof body === "object" && typeof body.code === "string" ? body.code : void 0;
|
|
21
|
+
return code === void 0 ? error : { ...error, serverCode: code };
|
|
22
|
+
}
|
|
23
|
+
function classify(body, status) {
|
|
18
24
|
if (!body || typeof body !== "object") {
|
|
19
25
|
return {
|
|
20
26
|
code: "server",
|
|
@@ -44,11 +50,7 @@ function fromWire(body) {
|
|
|
44
50
|
return { code: "auth", message, reason: "forbidden" };
|
|
45
51
|
case "rate-limited":
|
|
46
52
|
case "rate-limit-exceeded":
|
|
47
|
-
return
|
|
48
|
-
code: "rate-limited",
|
|
49
|
-
message,
|
|
50
|
-
...typeof obj.retryAfterSeconds === "number" ? { retryAfterSeconds: obj.retryAfterSeconds } : {}
|
|
51
|
-
};
|
|
53
|
+
return rateLimited(message, obj);
|
|
52
54
|
case "not-found":
|
|
53
55
|
case "run-not-found":
|
|
54
56
|
case "agent-not-found":
|
|
@@ -71,27 +73,9 @@ function fromWire(body) {
|
|
|
71
73
|
case "provider-not-found":
|
|
72
74
|
case "capability-not-found":
|
|
73
75
|
case "token-not-found":
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
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
|
-
};
|
|
76
|
+
case "agent-version-not-found":
|
|
77
|
+
case "promotion-not-found":
|
|
78
|
+
return notFound(code, message, details);
|
|
95
79
|
case "conflict":
|
|
96
80
|
case "already-terminal":
|
|
97
81
|
case "run-already-terminal":
|
|
@@ -108,6 +92,25 @@ function fromWire(body) {
|
|
|
108
92
|
case "slug-conflict":
|
|
109
93
|
case "project-default-already-exists":
|
|
110
94
|
case "registry-read-only":
|
|
95
|
+
case "policy-scope-taken":
|
|
96
|
+
case "policy-scope-changed":
|
|
97
|
+
case "nothing-to-roll-back":
|
|
98
|
+
case "not-pinned":
|
|
99
|
+
case "agent-version-live":
|
|
100
|
+
case "eval-suite-already-registered":
|
|
101
|
+
case "policy-already-registered":
|
|
102
|
+
case "mcp-endpoint-already-registered":
|
|
103
|
+
case "identity-provider-already-registered":
|
|
104
|
+
case "version-already-exists":
|
|
105
|
+
case "eval-run-already-terminal":
|
|
106
|
+
case "approval-already-decided":
|
|
107
|
+
case "judge-class-name-taken":
|
|
108
|
+
case "promotion-superseded":
|
|
109
|
+
case "gate-policy-already-registered":
|
|
110
|
+
case "gate-policy-scope-taken":
|
|
111
|
+
case "gate-policy-scope-changed":
|
|
112
|
+
case "gate-policy-scope-unpinned":
|
|
113
|
+
case "gate-policy-needs-pin":
|
|
111
114
|
return { code: "conflict", message, reason: code };
|
|
112
115
|
case "invalid-request":
|
|
113
116
|
case "validation-failed":
|
|
@@ -123,11 +126,8 @@ function fromWire(body) {
|
|
|
123
126
|
case "invalid-guardrail":
|
|
124
127
|
case "invalid-provider":
|
|
125
128
|
case "supervisor-header-missing":
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
message,
|
|
129
|
-
issues: obj.issues ?? details?.issues ?? []
|
|
130
|
-
};
|
|
129
|
+
case "scope-invalid":
|
|
130
|
+
return invalidRequest(message, obj, details);
|
|
131
131
|
case "guardrail-violation":
|
|
132
132
|
return {
|
|
133
133
|
code: "guardrail-violation",
|
|
@@ -135,6 +135,23 @@ function fromWire(body) {
|
|
|
135
135
|
violations: readGuardrailViolations(details?.violations),
|
|
136
136
|
evaluationErrors: readEvaluationErrors(details?.evaluationErrors)
|
|
137
137
|
};
|
|
138
|
+
default:
|
|
139
|
+
return byStatus(status, code, message, obj, details);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
function byStatus(status, code, message, obj, details) {
|
|
143
|
+
switch (status) {
|
|
144
|
+
case 404:
|
|
145
|
+
case 410:
|
|
146
|
+
return notFound(code, message, details);
|
|
147
|
+
case 400:
|
|
148
|
+
return invalidRequest(message, obj, details);
|
|
149
|
+
case 401:
|
|
150
|
+
return { code: "auth", message, reason: "unauthenticated" };
|
|
151
|
+
case 403:
|
|
152
|
+
return { code: "auth", message, reason: "forbidden" };
|
|
153
|
+
case 429:
|
|
154
|
+
return rateLimited(message, obj);
|
|
138
155
|
default:
|
|
139
156
|
return {
|
|
140
157
|
code: "server",
|
|
@@ -144,6 +161,43 @@ function fromWire(body) {
|
|
|
144
161
|
};
|
|
145
162
|
}
|
|
146
163
|
}
|
|
164
|
+
function notFound(code, message, details) {
|
|
165
|
+
return {
|
|
166
|
+
code: "not-found",
|
|
167
|
+
message,
|
|
168
|
+
resource: {
|
|
169
|
+
kind: code.replace(/-not-found$/u, "") || "unknown",
|
|
170
|
+
id: readStringField(
|
|
171
|
+
details,
|
|
172
|
+
"agentId",
|
|
173
|
+
"toolId",
|
|
174
|
+
"runId",
|
|
175
|
+
"adapterId",
|
|
176
|
+
"userId",
|
|
177
|
+
"providerId",
|
|
178
|
+
"capabilityId",
|
|
179
|
+
"tokenId",
|
|
180
|
+
"factId",
|
|
181
|
+
"guardrailId",
|
|
182
|
+
"id"
|
|
183
|
+
) ?? "unknown"
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
function invalidRequest(message, obj, details) {
|
|
188
|
+
return {
|
|
189
|
+
code: "invalid-request",
|
|
190
|
+
message,
|
|
191
|
+
issues: obj.issues ?? details?.issues ?? []
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
function rateLimited(message, obj) {
|
|
195
|
+
return {
|
|
196
|
+
code: "rate-limited",
|
|
197
|
+
message,
|
|
198
|
+
...typeof obj.retryAfterSeconds === "number" ? { retryAfterSeconds: obj.retryAfterSeconds } : {}
|
|
199
|
+
};
|
|
200
|
+
}
|
|
147
201
|
function readStringField(obj, ...keys) {
|
|
148
202
|
if (obj === void 0) return void 0;
|
|
149
203
|
for (const key of keys) {
|
|
@@ -193,6 +247,17 @@ var KindgiApiError = class extends Error {
|
|
|
193
247
|
}
|
|
194
248
|
};
|
|
195
249
|
|
|
250
|
+
// src/list-page.ts
|
|
251
|
+
function listPage(page) {
|
|
252
|
+
const result = {
|
|
253
|
+
data: page.data,
|
|
254
|
+
hasMore: page.hasMore,
|
|
255
|
+
...page.nextCursor !== void 0 && { nextCursor: page.nextCursor }
|
|
256
|
+
};
|
|
257
|
+
Object.defineProperty(result, "items", { get: () => result.data, enumerable: false });
|
|
258
|
+
return result;
|
|
259
|
+
}
|
|
260
|
+
|
|
196
261
|
// src/streaming.ts
|
|
197
262
|
async function* readSse(options) {
|
|
198
263
|
const fetchImpl = options.fetchImpl ?? fetch;
|
|
@@ -348,10 +413,7 @@ function makeAdaptersClient(transport) {
|
|
|
348
413
|
...filter?.status !== void 0 && { status: filter.status }
|
|
349
414
|
}
|
|
350
415
|
});
|
|
351
|
-
return
|
|
352
|
-
items: page.data,
|
|
353
|
-
...page.nextCursor !== void 0 && { nextCursor: page.nextCursor }
|
|
354
|
-
};
|
|
416
|
+
return listPage(page);
|
|
355
417
|
},
|
|
356
418
|
async get(adapterId) {
|
|
357
419
|
return transport.request({
|
|
@@ -408,6 +470,57 @@ function makeAdaptersClient(transport) {
|
|
|
408
470
|
// src/resources/agents.ts
|
|
409
471
|
function makeAgentsClient(transport) {
|
|
410
472
|
const seg = (s) => encodeURIComponent(s);
|
|
473
|
+
const versions = {
|
|
474
|
+
async list(agentId, filter) {
|
|
475
|
+
return transport.request({
|
|
476
|
+
method: "GET",
|
|
477
|
+
path: `/v1/agents/${seg(agentId)}/versions`,
|
|
478
|
+
query: {
|
|
479
|
+
...filter?.limit !== void 0 && { limit: filter.limit },
|
|
480
|
+
...filter?.cursor !== void 0 && { cursor: filter.cursor }
|
|
481
|
+
}
|
|
482
|
+
});
|
|
483
|
+
},
|
|
484
|
+
async get(agentId, version) {
|
|
485
|
+
return transport.request({
|
|
486
|
+
method: "GET",
|
|
487
|
+
path: `/v1/agents/${seg(agentId)}/versions/${seg(version)}`
|
|
488
|
+
});
|
|
489
|
+
},
|
|
490
|
+
async unregister(agentId, version, options) {
|
|
491
|
+
return transport.request({
|
|
492
|
+
method: "POST",
|
|
493
|
+
path: `/v1/agents/${seg(agentId)}/versions/${seg(version)}/unregister`,
|
|
494
|
+
...options?.idempotencyKey !== void 0 && {
|
|
495
|
+
idempotencyKey: options.idempotencyKey
|
|
496
|
+
}
|
|
497
|
+
});
|
|
498
|
+
},
|
|
499
|
+
async derive(agentId, input, options) {
|
|
500
|
+
return transport.request({
|
|
501
|
+
method: "POST",
|
|
502
|
+
path: `/v1/agents/${seg(agentId)}/versions`,
|
|
503
|
+
body: input,
|
|
504
|
+
...options?.idempotencyKey !== void 0 && {
|
|
505
|
+
idempotencyKey: options.idempotencyKey
|
|
506
|
+
}
|
|
507
|
+
});
|
|
508
|
+
},
|
|
509
|
+
async reinstate(agentId, version, options) {
|
|
510
|
+
const wire = await transport.request({
|
|
511
|
+
method: "POST",
|
|
512
|
+
path: `/v1/agents/${seg(agentId)}/versions/${seg(version)}/reinstate`,
|
|
513
|
+
...options?.idempotencyKey !== void 0 && {
|
|
514
|
+
idempotencyKey: options.idempotencyKey
|
|
515
|
+
}
|
|
516
|
+
});
|
|
517
|
+
return {
|
|
518
|
+
agentId: wire.agentId,
|
|
519
|
+
version: wire.version,
|
|
520
|
+
wasTombstoned: wire.wasTombstoned
|
|
521
|
+
};
|
|
522
|
+
}
|
|
523
|
+
};
|
|
411
524
|
return {
|
|
412
525
|
async define(spec, options) {
|
|
413
526
|
const result = await transport.request({
|
|
@@ -437,59 +550,106 @@ function makeAgentsClient(transport) {
|
|
|
437
550
|
path: `/v1/agents/${seg(agentId)}`
|
|
438
551
|
});
|
|
439
552
|
},
|
|
440
|
-
versions
|
|
441
|
-
|
|
553
|
+
versions,
|
|
554
|
+
reinstateVersion: (agentId, version, options) => versions.reinstate(agentId, version, options),
|
|
555
|
+
live: {
|
|
556
|
+
async resolve(agentId, where) {
|
|
442
557
|
return transport.request({
|
|
443
558
|
method: "GET",
|
|
444
|
-
path: `/v1/agents/${seg(agentId)}/
|
|
559
|
+
path: `/v1/agents/${seg(agentId)}/live`,
|
|
445
560
|
query: {
|
|
446
|
-
...
|
|
447
|
-
...
|
|
561
|
+
...where?.projectId !== void 0 && { projectId: where.projectId },
|
|
562
|
+
...where?.segments !== void 0 && { segment: where.segments.map(segmentParam) }
|
|
448
563
|
}
|
|
449
564
|
});
|
|
450
565
|
},
|
|
451
|
-
async
|
|
566
|
+
async list(agentId) {
|
|
452
567
|
return transport.request({
|
|
453
568
|
method: "GET",
|
|
454
|
-
path: `/v1/agents/${seg(agentId)}/versions
|
|
569
|
+
path: `/v1/agents/${seg(agentId)}/live-versions`
|
|
455
570
|
});
|
|
456
571
|
},
|
|
457
|
-
async
|
|
572
|
+
async rollback(agentId, input, options) {
|
|
458
573
|
return transport.request({
|
|
459
574
|
method: "POST",
|
|
460
|
-
path: `/v1/agents/${seg(agentId)}/
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
}
|
|
575
|
+
path: `/v1/agents/${seg(agentId)}/live/rollback`,
|
|
576
|
+
body: input,
|
|
577
|
+
...options?.idempotencyKey !== void 0 && { idempotencyKey: options.idempotencyKey }
|
|
464
578
|
});
|
|
465
579
|
},
|
|
466
|
-
async
|
|
580
|
+
async unpin(agentId, input, options) {
|
|
467
581
|
return transport.request({
|
|
468
582
|
method: "POST",
|
|
469
|
-
path: `/v1/agents/${seg(agentId)}/
|
|
583
|
+
path: `/v1/agents/${seg(agentId)}/live/unpin`,
|
|
470
584
|
body: input,
|
|
471
|
-
...options?.idempotencyKey !== void 0 && {
|
|
472
|
-
|
|
585
|
+
...options?.idempotencyKey !== void 0 && { idempotencyKey: options.idempotencyKey }
|
|
586
|
+
});
|
|
587
|
+
}
|
|
588
|
+
},
|
|
589
|
+
promotions: {
|
|
590
|
+
async create(agentId, input, options) {
|
|
591
|
+
return transport.request({
|
|
592
|
+
method: "POST",
|
|
593
|
+
path: `/v1/agents/${seg(agentId)}/promotions`,
|
|
594
|
+
body: input,
|
|
595
|
+
...options?.idempotencyKey !== void 0 && { idempotencyKey: options.idempotencyKey }
|
|
596
|
+
});
|
|
597
|
+
},
|
|
598
|
+
async check(agentId, input) {
|
|
599
|
+
return transport.request({
|
|
600
|
+
method: "POST",
|
|
601
|
+
path: `/v1/agents/${seg(agentId)}/promotions/check`,
|
|
602
|
+
body: input
|
|
603
|
+
});
|
|
604
|
+
},
|
|
605
|
+
async list(agentId, filter) {
|
|
606
|
+
return transport.request({
|
|
607
|
+
method: "GET",
|
|
608
|
+
path: `/v1/agents/${seg(agentId)}/promotions`,
|
|
609
|
+
query: {
|
|
610
|
+
...filter?.scope !== void 0 && scopeQuery(filter.scope),
|
|
611
|
+
...filter?.limit !== void 0 && { limit: filter.limit },
|
|
612
|
+
...filter?.cursor !== void 0 && { cursor: filter.cursor }
|
|
473
613
|
}
|
|
474
614
|
});
|
|
615
|
+
},
|
|
616
|
+
async get(agentId, promotionId) {
|
|
617
|
+
return transport.request({
|
|
618
|
+
method: "GET",
|
|
619
|
+
path: `/v1/agents/${seg(agentId)}/promotions/${seg(promotionId)}`
|
|
620
|
+
});
|
|
475
621
|
}
|
|
476
622
|
},
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
}
|
|
484
|
-
}
|
|
485
|
-
return {
|
|
486
|
-
agentId: wire.agentId,
|
|
487
|
-
version: wire.version,
|
|
488
|
-
wasTombstoned: wire.wasTombstoned
|
|
489
|
-
};
|
|
623
|
+
gatePolicy: {
|
|
624
|
+
async resolve(agentId, scope) {
|
|
625
|
+
return transport.request({
|
|
626
|
+
method: "GET",
|
|
627
|
+
path: `/v1/agents/${seg(agentId)}/gate-policy`,
|
|
628
|
+
query: scopeQuery(scope)
|
|
629
|
+
});
|
|
630
|
+
}
|
|
490
631
|
}
|
|
491
632
|
};
|
|
492
633
|
}
|
|
634
|
+
function segmentParam(s) {
|
|
635
|
+
return `${s.key}:${s.value}`;
|
|
636
|
+
}
|
|
637
|
+
function scopeQuery(scope) {
|
|
638
|
+
switch (scope.kind) {
|
|
639
|
+
case "tenant":
|
|
640
|
+
return { scopeKind: "tenant" };
|
|
641
|
+
case "org":
|
|
642
|
+
return { scopeKind: "org", scopeId: scope.orgId };
|
|
643
|
+
case "project":
|
|
644
|
+
return { scopeKind: "project", scopeId: scope.projectId };
|
|
645
|
+
case "segment":
|
|
646
|
+
return {
|
|
647
|
+
scopeKind: "segment",
|
|
648
|
+
scopeId: scope.projectId,
|
|
649
|
+
segment: scope.path.map(segmentParam)
|
|
650
|
+
};
|
|
651
|
+
}
|
|
652
|
+
}
|
|
493
653
|
|
|
494
654
|
// src/scope-wire.ts
|
|
495
655
|
function scopeForBody(scope) {
|
|
@@ -538,12 +698,7 @@ function makeApprovalsClient(transport) {
|
|
|
538
698
|
}
|
|
539
699
|
}
|
|
540
700
|
});
|
|
541
|
-
return
|
|
542
|
-
items: page.data,
|
|
543
|
-
...page.nextCursor !== void 0 && {
|
|
544
|
-
nextCursor: page.nextCursor
|
|
545
|
-
}
|
|
546
|
-
};
|
|
701
|
+
return listPage(page);
|
|
547
702
|
},
|
|
548
703
|
async get(id) {
|
|
549
704
|
return transport.request({
|
|
@@ -611,12 +766,7 @@ function makeApprovalsClient(transport) {
|
|
|
611
766
|
...filter?.role !== void 0 && { role: filter.role }
|
|
612
767
|
}
|
|
613
768
|
});
|
|
614
|
-
return
|
|
615
|
-
items: page.data,
|
|
616
|
-
...page.nextCursor !== void 0 && {
|
|
617
|
-
nextCursor: page.nextCursor
|
|
618
|
-
}
|
|
619
|
-
};
|
|
769
|
+
return listPage(page);
|
|
620
770
|
},
|
|
621
771
|
async get(id) {
|
|
622
772
|
return transport.request({
|
|
@@ -717,12 +867,7 @@ function makeArtifactsClient(transport) {
|
|
|
717
867
|
...filter?.contentType !== void 0 && { contentType: filter.contentType }
|
|
718
868
|
}
|
|
719
869
|
});
|
|
720
|
-
return
|
|
721
|
-
items: page.data,
|
|
722
|
-
...page.nextCursor !== void 0 && {
|
|
723
|
-
nextCursor: page.nextCursor
|
|
724
|
-
}
|
|
725
|
-
};
|
|
870
|
+
return listPage(page);
|
|
726
871
|
},
|
|
727
872
|
async delete(blobId, options) {
|
|
728
873
|
return transport.request({
|
|
@@ -770,7 +915,8 @@ function makeAuditClient(transport) {
|
|
|
770
915
|
...filter?.outcome !== void 0 && { outcome: filter.outcome },
|
|
771
916
|
...filter?.runId !== void 0 && { runId: filter.runId },
|
|
772
917
|
...filter?.from !== void 0 && { from: filter.from },
|
|
773
|
-
...filter?.to !== void 0 && { to: filter.to }
|
|
918
|
+
...filter?.to !== void 0 && { to: filter.to },
|
|
919
|
+
...filter?.order !== void 0 && { order: filter.order }
|
|
774
920
|
}
|
|
775
921
|
});
|
|
776
922
|
}
|
|
@@ -784,10 +930,11 @@ function makeAuthClient(transport) {
|
|
|
784
930
|
return {
|
|
785
931
|
providers: {
|
|
786
932
|
async list() {
|
|
787
|
-
|
|
933
|
+
const page = await transport.request({
|
|
788
934
|
method: "GET",
|
|
789
935
|
path: "/v1/auth/providers"
|
|
790
936
|
});
|
|
937
|
+
return { ...page, hasMore: page.hasMore ?? false };
|
|
791
938
|
},
|
|
792
939
|
async register(input, options) {
|
|
793
940
|
return transport.request({
|
|
@@ -916,12 +1063,7 @@ function makeCapabilitiesClient(transport) {
|
|
|
916
1063
|
...filter?.feature !== void 0 && { feature: filter.feature }
|
|
917
1064
|
}
|
|
918
1065
|
});
|
|
919
|
-
return
|
|
920
|
-
items: page.data,
|
|
921
|
-
...page.nextCursor !== void 0 && {
|
|
922
|
-
nextCursor: page.nextCursor
|
|
923
|
-
}
|
|
924
|
-
};
|
|
1066
|
+
return listPage(page);
|
|
925
1067
|
},
|
|
926
1068
|
async get(capabilityId) {
|
|
927
1069
|
return transport.request({
|
|
@@ -948,12 +1090,7 @@ function makeCapabilitiesClient(transport) {
|
|
|
948
1090
|
...filter?.feature !== void 0 && { feature: filter.feature }
|
|
949
1091
|
}
|
|
950
1092
|
});
|
|
951
|
-
return
|
|
952
|
-
items: page.data,
|
|
953
|
-
...page.nextCursor !== void 0 && {
|
|
954
|
-
nextCursor: page.nextCursor
|
|
955
|
-
}
|
|
956
|
-
};
|
|
1093
|
+
return listPage(page);
|
|
957
1094
|
},
|
|
958
1095
|
async get(id) {
|
|
959
1096
|
return transport.request({
|
|
@@ -1083,13 +1220,11 @@ function makeConversationsClient(transport) {
|
|
|
1083
1220
|
...filter?.cursor !== void 0 && { cursor: filter.cursor },
|
|
1084
1221
|
...statusParam !== void 0 && { status: statusParam },
|
|
1085
1222
|
...filter?.scope !== void 0 && scopeToQuery(filter.scope),
|
|
1086
|
-
...filter?.agent !== void 0 && { agentId: filter.agent }
|
|
1223
|
+
...filter?.agent !== void 0 && { agentId: filter.agent },
|
|
1224
|
+
...filter?.replays !== void 0 && { replays: filter.replays }
|
|
1087
1225
|
}
|
|
1088
1226
|
});
|
|
1089
|
-
return
|
|
1090
|
-
items: page.data,
|
|
1091
|
-
...page.nextCursor !== void 0 && { nextCursor: page.nextCursor }
|
|
1092
|
-
};
|
|
1227
|
+
return listPage(page);
|
|
1093
1228
|
},
|
|
1094
1229
|
async close(id, options) {
|
|
1095
1230
|
return transport.request({
|
|
@@ -1110,10 +1245,7 @@ function makeConversationsClient(transport) {
|
|
|
1110
1245
|
...filter?.cursor !== void 0 && { cursor: filter.cursor }
|
|
1111
1246
|
}
|
|
1112
1247
|
});
|
|
1113
|
-
return
|
|
1114
|
-
items: page.data,
|
|
1115
|
-
...page.nextCursor !== void 0 && { nextCursor: page.nextCursor }
|
|
1116
|
-
};
|
|
1248
|
+
return listPage(page);
|
|
1117
1249
|
}
|
|
1118
1250
|
};
|
|
1119
1251
|
}
|
|
@@ -1155,12 +1287,7 @@ function makeCostClient(transport) {
|
|
|
1155
1287
|
...filterQuery(filter ?? {})
|
|
1156
1288
|
}
|
|
1157
1289
|
});
|
|
1158
|
-
return
|
|
1159
|
-
items: page.data,
|
|
1160
|
-
...page.nextCursor !== void 0 && {
|
|
1161
|
-
nextCursor: page.nextCursor
|
|
1162
|
-
}
|
|
1163
|
-
};
|
|
1290
|
+
return listPage(page);
|
|
1164
1291
|
},
|
|
1165
1292
|
async get(recordId, options) {
|
|
1166
1293
|
return transport.request({
|
|
@@ -1170,7 +1297,7 @@ function makeCostClient(transport) {
|
|
|
1170
1297
|
});
|
|
1171
1298
|
},
|
|
1172
1299
|
async summary(input) {
|
|
1173
|
-
const { from, to, groupBy, ...filter } = input;
|
|
1300
|
+
const { from, to, groupBy, limit, ...filter } = input;
|
|
1174
1301
|
return transport.request({
|
|
1175
1302
|
method: "GET",
|
|
1176
1303
|
path: "/v1/cost/aggregate",
|
|
@@ -1178,7 +1305,8 @@ function makeCostClient(transport) {
|
|
|
1178
1305
|
...filterQuery(filter),
|
|
1179
1306
|
from,
|
|
1180
1307
|
to,
|
|
1181
|
-
...groupBy !== void 0 && { groupBy: groupBy.join(",") }
|
|
1308
|
+
...groupBy !== void 0 && { groupBy: groupBy.join(",") },
|
|
1309
|
+
...limit !== void 0 && { limit }
|
|
1182
1310
|
}
|
|
1183
1311
|
});
|
|
1184
1312
|
}
|
|
@@ -1273,6 +1401,7 @@ function makeEnvClient(transport) {
|
|
|
1273
1401
|
});
|
|
1274
1402
|
return {
|
|
1275
1403
|
data: page.data,
|
|
1404
|
+
hasMore: page.hasMore ?? page.nextCursor !== void 0,
|
|
1276
1405
|
...page.nextCursor !== void 0 && {
|
|
1277
1406
|
nextCursor: page.nextCursor
|
|
1278
1407
|
}
|
|
@@ -1650,6 +1779,58 @@ function makeEventsClient(_transport) {
|
|
|
1650
1779
|
|
|
1651
1780
|
// src/resources/flows.ts
|
|
1652
1781
|
function makeFlowsClient(transport) {
|
|
1782
|
+
const list = async (id, filter) => {
|
|
1783
|
+
const page = await transport.request({
|
|
1784
|
+
method: "GET",
|
|
1785
|
+
path: `/v1/flows/${encodeURIComponent(id)}/versions`,
|
|
1786
|
+
query: {
|
|
1787
|
+
...filter?.limit !== void 0 && { limit: filter.limit },
|
|
1788
|
+
...filter?.cursor !== void 0 && { cursor: filter.cursor }
|
|
1789
|
+
}
|
|
1790
|
+
});
|
|
1791
|
+
return listPage(page);
|
|
1792
|
+
};
|
|
1793
|
+
const versions = Object.assign(
|
|
1794
|
+
(id, filter) => list(id, filter),
|
|
1795
|
+
{
|
|
1796
|
+
list,
|
|
1797
|
+
async get(id, version) {
|
|
1798
|
+
return transport.request({
|
|
1799
|
+
method: "GET",
|
|
1800
|
+
path: `/v1/flows/${encodeURIComponent(id)}/versions/${encodeURIComponent(version)}`
|
|
1801
|
+
});
|
|
1802
|
+
},
|
|
1803
|
+
async unregister(id, version, options) {
|
|
1804
|
+
const wire = await transport.request({
|
|
1805
|
+
method: "POST",
|
|
1806
|
+
path: `/v1/flows/${encodeURIComponent(id)}/versions/${encodeURIComponent(version)}/unregister`,
|
|
1807
|
+
body: {},
|
|
1808
|
+
...options?.idempotencyKey !== void 0 && {
|
|
1809
|
+
idempotencyKey: options.idempotencyKey
|
|
1810
|
+
}
|
|
1811
|
+
});
|
|
1812
|
+
return {
|
|
1813
|
+
flowId: wire.flowId,
|
|
1814
|
+
version: wire.version,
|
|
1815
|
+
unregistered: wire.unregistered
|
|
1816
|
+
};
|
|
1817
|
+
},
|
|
1818
|
+
async reinstate(id, version, options) {
|
|
1819
|
+
const wire = await transport.request({
|
|
1820
|
+
method: "POST",
|
|
1821
|
+
path: `/v1/flows/${encodeURIComponent(id)}/versions/${encodeURIComponent(version)}/reinstate`,
|
|
1822
|
+
...options?.idempotencyKey !== void 0 && {
|
|
1823
|
+
idempotencyKey: options.idempotencyKey
|
|
1824
|
+
}
|
|
1825
|
+
});
|
|
1826
|
+
return {
|
|
1827
|
+
flowId: wire.flowId,
|
|
1828
|
+
version: wire.version,
|
|
1829
|
+
wasTombstoned: wire.wasTombstoned
|
|
1830
|
+
};
|
|
1831
|
+
}
|
|
1832
|
+
}
|
|
1833
|
+
);
|
|
1653
1834
|
return {
|
|
1654
1835
|
async define(flow, options) {
|
|
1655
1836
|
const result = await transport.request({
|
|
@@ -1689,59 +1870,72 @@ function makeFlowsClient(transport) {
|
|
|
1689
1870
|
...filter?.name !== void 0 && { name: filter.name }
|
|
1690
1871
|
}
|
|
1691
1872
|
});
|
|
1692
|
-
return
|
|
1693
|
-
items: page.data,
|
|
1694
|
-
...page.nextCursor !== void 0 && {
|
|
1695
|
-
nextCursor: page.nextCursor
|
|
1696
|
-
}
|
|
1697
|
-
};
|
|
1873
|
+
return listPage(page);
|
|
1698
1874
|
},
|
|
1699
|
-
|
|
1700
|
-
|
|
1875
|
+
versions,
|
|
1876
|
+
getVersion: (id, version) => versions.get(id, version),
|
|
1877
|
+
async delete(id, version, options) {
|
|
1878
|
+
await versions.unregister(id, version, options);
|
|
1879
|
+
},
|
|
1880
|
+
reinstateVersion: (id, version, options) => versions.reinstate(id, version, options)
|
|
1881
|
+
};
|
|
1882
|
+
}
|
|
1883
|
+
|
|
1884
|
+
// src/resources/gate-policies.ts
|
|
1885
|
+
function makeGatePoliciesClient(transport) {
|
|
1886
|
+
const seg = (s) => encodeURIComponent(s);
|
|
1887
|
+
return {
|
|
1888
|
+
async list(filter) {
|
|
1889
|
+
return transport.request({
|
|
1701
1890
|
method: "GET",
|
|
1702
|
-
path:
|
|
1891
|
+
path: "/v1/gate-policies",
|
|
1703
1892
|
query: {
|
|
1893
|
+
...filter?.agentId !== void 0 && { agentId: filter.agentId },
|
|
1894
|
+
...filter?.scope !== void 0 && scopeQuery(filter.scope),
|
|
1704
1895
|
...filter?.limit !== void 0 && { limit: filter.limit },
|
|
1705
1896
|
...filter?.cursor !== void 0 && { cursor: filter.cursor }
|
|
1706
1897
|
}
|
|
1707
1898
|
});
|
|
1708
|
-
return {
|
|
1709
|
-
items: page.data,
|
|
1710
|
-
...page.nextCursor !== void 0 && {
|
|
1711
|
-
nextCursor: page.nextCursor
|
|
1712
|
-
}
|
|
1713
|
-
};
|
|
1714
1899
|
},
|
|
1715
|
-
async
|
|
1900
|
+
async get(policyId) {
|
|
1716
1901
|
return transport.request({
|
|
1717
1902
|
method: "GET",
|
|
1718
|
-
path: `/v1/
|
|
1903
|
+
path: `/v1/gate-policies/${seg(policyId)}`
|
|
1719
1904
|
});
|
|
1720
1905
|
},
|
|
1721
|
-
async
|
|
1722
|
-
|
|
1906
|
+
async publish(input, options) {
|
|
1907
|
+
return transport.request({
|
|
1723
1908
|
method: "POST",
|
|
1724
|
-
path:
|
|
1725
|
-
body:
|
|
1726
|
-
|
|
1727
|
-
...options?.idempotencyKey !== void 0 && {
|
|
1728
|
-
idempotencyKey: options.idempotencyKey
|
|
1729
|
-
}
|
|
1909
|
+
path: "/v1/gate-policies",
|
|
1910
|
+
body: input,
|
|
1911
|
+
...options?.idempotencyKey !== void 0 && { idempotencyKey: options.idempotencyKey }
|
|
1730
1912
|
});
|
|
1731
1913
|
},
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
}
|
|
1914
|
+
versions: {
|
|
1915
|
+
async list(policyId) {
|
|
1916
|
+
return transport.request({
|
|
1917
|
+
method: "GET",
|
|
1918
|
+
path: `/v1/gate-policies/${seg(policyId)}/versions`
|
|
1919
|
+
});
|
|
1920
|
+
},
|
|
1921
|
+
async get(policyId, version) {
|
|
1922
|
+
return transport.request({
|
|
1923
|
+
method: "GET",
|
|
1924
|
+
path: `/v1/gate-policies/${seg(policyId)}/versions/${seg(version)}`
|
|
1925
|
+
});
|
|
1926
|
+
},
|
|
1927
|
+
async unregister(policyId, version) {
|
|
1928
|
+
return transport.request({
|
|
1929
|
+
method: "POST",
|
|
1930
|
+
path: `/v1/gate-policies/${seg(policyId)}/versions/${seg(version)}/unregister`
|
|
1931
|
+
});
|
|
1932
|
+
},
|
|
1933
|
+
async reinstate(policyId, version) {
|
|
1934
|
+
return transport.request({
|
|
1935
|
+
method: "POST",
|
|
1936
|
+
path: `/v1/gate-policies/${seg(policyId)}/versions/${seg(version)}/reinstate`
|
|
1937
|
+
});
|
|
1938
|
+
}
|
|
1745
1939
|
}
|
|
1746
1940
|
};
|
|
1747
1941
|
}
|
|
@@ -1773,12 +1967,7 @@ function makeGuardrailsClient(transport) {
|
|
|
1773
1967
|
...filter?.name !== void 0 && { name: filter.name }
|
|
1774
1968
|
}
|
|
1775
1969
|
});
|
|
1776
|
-
return
|
|
1777
|
-
items: page.data,
|
|
1778
|
-
...page.nextCursor !== void 0 && {
|
|
1779
|
-
nextCursor: page.nextCursor
|
|
1780
|
-
}
|
|
1781
|
-
};
|
|
1970
|
+
return listPage(page);
|
|
1782
1971
|
},
|
|
1783
1972
|
async delete(id, options) {
|
|
1784
1973
|
return transport.request({
|
|
@@ -1861,7 +2050,7 @@ function makeIdentityClient(transport) {
|
|
|
1861
2050
|
}
|
|
1862
2051
|
|
|
1863
2052
|
// src/resources/judge-classes.ts
|
|
1864
|
-
function
|
|
2053
|
+
function scopeQuery2(scope) {
|
|
1865
2054
|
if (scope.kind === "tenant") return { scopeKind: "tenant" };
|
|
1866
2055
|
if (scope.kind === "project") return { scopeKind: "project", projectId: scope.projectId };
|
|
1867
2056
|
return { scopeKind: "agent", projectId: scope.projectId, agentId: scope.agentId };
|
|
@@ -1884,13 +2073,10 @@ function makeJudgeClassesClient(transport) {
|
|
|
1884
2073
|
query: {
|
|
1885
2074
|
...filter?.limit !== void 0 && { limit: filter.limit },
|
|
1886
2075
|
...filter?.cursor !== void 0 && { cursor: filter.cursor },
|
|
1887
|
-
...filter?.scope !== void 0 &&
|
|
2076
|
+
...filter?.scope !== void 0 && scopeQuery2(filter.scope)
|
|
1888
2077
|
}
|
|
1889
2078
|
});
|
|
1890
|
-
return
|
|
1891
|
-
items: page.data,
|
|
1892
|
-
...page.nextCursor !== void 0 && { nextCursor: page.nextCursor }
|
|
1893
|
-
};
|
|
2079
|
+
return listPage(page);
|
|
1894
2080
|
},
|
|
1895
2081
|
async get(judgeClassId) {
|
|
1896
2082
|
return transport.request({
|
|
@@ -1946,10 +2132,7 @@ function makeJudgmentsClient(transport) {
|
|
|
1946
2132
|
...filter?.scope !== void 0 && scopeToQuery(filter.scope)
|
|
1947
2133
|
}
|
|
1948
2134
|
});
|
|
1949
|
-
return
|
|
1950
|
-
items: page.data,
|
|
1951
|
-
...page.nextCursor !== void 0 && { nextCursor: page.nextCursor }
|
|
1952
|
-
};
|
|
2135
|
+
return listPage(page);
|
|
1953
2136
|
},
|
|
1954
2137
|
async get(judgmentId) {
|
|
1955
2138
|
return transport.request({
|
|
@@ -1983,12 +2166,7 @@ function makeMcpClient(transport) {
|
|
|
1983
2166
|
...filter?.transport !== void 0 && { transport: filter.transport }
|
|
1984
2167
|
}
|
|
1985
2168
|
});
|
|
1986
|
-
return
|
|
1987
|
-
items: page.data,
|
|
1988
|
-
...page.nextCursor !== void 0 && {
|
|
1989
|
-
nextCursor: page.nextCursor
|
|
1990
|
-
}
|
|
1991
|
-
};
|
|
2169
|
+
return listPage(page);
|
|
1992
2170
|
},
|
|
1993
2171
|
async register(input, options) {
|
|
1994
2172
|
const { scope, ...endpoint } = input;
|
|
@@ -2126,12 +2304,7 @@ function makeMemoryClient(transport) {
|
|
|
2126
2304
|
...filter?.scope !== void 0 && { scope: JSON.stringify(filter.scope) }
|
|
2127
2305
|
}
|
|
2128
2306
|
});
|
|
2129
|
-
return
|
|
2130
|
-
items: page.data,
|
|
2131
|
-
...page.nextCursor !== void 0 && {
|
|
2132
|
-
nextCursor: page.nextCursor
|
|
2133
|
-
}
|
|
2134
|
-
};
|
|
2307
|
+
return listPage(page);
|
|
2135
2308
|
},
|
|
2136
2309
|
async delete(id, options) {
|
|
2137
2310
|
return transport.request({
|
|
@@ -2212,10 +2385,7 @@ function makeObservationsClient(transport) {
|
|
|
2212
2385
|
...filter?.until !== void 0 && { until: filter.until }
|
|
2213
2386
|
}
|
|
2214
2387
|
});
|
|
2215
|
-
return
|
|
2216
|
-
items: page.data,
|
|
2217
|
-
...page.nextCursor !== void 0 && { nextCursor: page.nextCursor }
|
|
2218
|
-
};
|
|
2388
|
+
return listPage(page);
|
|
2219
2389
|
},
|
|
2220
2390
|
async patterns(_input) {
|
|
2221
2391
|
throw new KindgiApiError(
|
|
@@ -2328,8 +2498,9 @@ function makePacksClient(_transport) {
|
|
|
2328
2498
|
|
|
2329
2499
|
// src/resources/policies.ts
|
|
2330
2500
|
function makePoliciesClient(transport) {
|
|
2331
|
-
|
|
2332
|
-
|
|
2501
|
+
const client = {
|
|
2502
|
+
author: (spec, options) => client.publish(spec, options),
|
|
2503
|
+
async publish(spec, options) {
|
|
2333
2504
|
const result = await transport.request({
|
|
2334
2505
|
method: "POST",
|
|
2335
2506
|
path: "/v1/policies",
|
|
@@ -2366,12 +2537,7 @@ function makePoliciesClient(transport) {
|
|
|
2366
2537
|
...filter?.name !== void 0 && { name: filter.name }
|
|
2367
2538
|
}
|
|
2368
2539
|
});
|
|
2369
|
-
return
|
|
2370
|
-
items: page.data,
|
|
2371
|
-
...page.nextCursor !== void 0 && {
|
|
2372
|
-
nextCursor: page.nextCursor
|
|
2373
|
-
}
|
|
2374
|
-
};
|
|
2540
|
+
return listPage(page);
|
|
2375
2541
|
},
|
|
2376
2542
|
async versions(id, filter) {
|
|
2377
2543
|
const page = await transport.request({
|
|
@@ -2383,12 +2549,7 @@ function makePoliciesClient(transport) {
|
|
|
2383
2549
|
...filter?.includeTombstoned === true && { includeTombstoned: "true" }
|
|
2384
2550
|
}
|
|
2385
2551
|
});
|
|
2386
|
-
return
|
|
2387
|
-
items: page.data,
|
|
2388
|
-
...page.nextCursor !== void 0 && {
|
|
2389
|
-
nextCursor: page.nextCursor
|
|
2390
|
-
}
|
|
2391
|
-
};
|
|
2552
|
+
return listPage(page);
|
|
2392
2553
|
},
|
|
2393
2554
|
async getVersion(id, version) {
|
|
2394
2555
|
return transport.request({
|
|
@@ -2438,6 +2599,7 @@ function makePoliciesClient(transport) {
|
|
|
2438
2599
|
);
|
|
2439
2600
|
}
|
|
2440
2601
|
};
|
|
2602
|
+
return client;
|
|
2441
2603
|
}
|
|
2442
2604
|
|
|
2443
2605
|
// src/resources/projects.ts
|
|
@@ -2555,10 +2717,7 @@ function makeProvenanceClient(transport) {
|
|
|
2555
2717
|
}
|
|
2556
2718
|
}
|
|
2557
2719
|
});
|
|
2558
|
-
return
|
|
2559
|
-
items: page.data,
|
|
2560
|
-
...page.nextCursor !== void 0 && { nextCursor: page.nextCursor }
|
|
2561
|
-
};
|
|
2720
|
+
return listPage(page);
|
|
2562
2721
|
},
|
|
2563
2722
|
async export(input) {
|
|
2564
2723
|
return transport.request({
|
|
@@ -2627,6 +2786,40 @@ function makeProvidersClient(transport) {
|
|
|
2627
2786
|
};
|
|
2628
2787
|
}
|
|
2629
2788
|
|
|
2789
|
+
// src/resources/retention.ts
|
|
2790
|
+
function makeRetentionClient(transport) {
|
|
2791
|
+
return {
|
|
2792
|
+
async scheduled(filter) {
|
|
2793
|
+
const page = await transport.request({
|
|
2794
|
+
method: "GET",
|
|
2795
|
+
path: "/v1/retention/scheduled",
|
|
2796
|
+
query: {
|
|
2797
|
+
...filter?.domain !== void 0 && { domain: filter.domain },
|
|
2798
|
+
...filter?.pastGraceOnly === true && { pastGraceOnly: "true" },
|
|
2799
|
+
...filter?.limit !== void 0 && { limit: filter.limit },
|
|
2800
|
+
...filter?.cursor !== void 0 && { cursor: filter.cursor }
|
|
2801
|
+
}
|
|
2802
|
+
});
|
|
2803
|
+
return { ...page, hasMore: page.hasMore ?? page.nextCursor !== void 0 };
|
|
2804
|
+
},
|
|
2805
|
+
async sweep(input) {
|
|
2806
|
+
const body = input?.maxPerDomain !== void 0 ? { maxPerDomain: input.maxPerDomain } : {};
|
|
2807
|
+
if (input?.domain !== void 0) {
|
|
2808
|
+
return transport.request({
|
|
2809
|
+
method: "POST",
|
|
2810
|
+
path: `/v1/retention/sweep/${encodeURIComponent(input.domain)}`,
|
|
2811
|
+
body
|
|
2812
|
+
});
|
|
2813
|
+
}
|
|
2814
|
+
return transport.request({
|
|
2815
|
+
method: "POST",
|
|
2816
|
+
path: "/v1/retention/sweep",
|
|
2817
|
+
body
|
|
2818
|
+
});
|
|
2819
|
+
}
|
|
2820
|
+
};
|
|
2821
|
+
}
|
|
2822
|
+
|
|
2630
2823
|
// src/run-follow.ts
|
|
2631
2824
|
var MAX_REFRESHES_IN_A_ROW = 3;
|
|
2632
2825
|
var TERMINAL_KINDS = /* @__PURE__ */ new Set([
|
|
@@ -2705,12 +2898,14 @@ function makeRunsClient(transport) {
|
|
|
2705
2898
|
agent: input.agent,
|
|
2706
2899
|
...input.agentVersion !== void 0 && { agentVersion: input.agentVersion },
|
|
2707
2900
|
...input.projectId !== void 0 && { projectId: input.projectId },
|
|
2901
|
+
...input.segments !== void 0 && { segments: input.segments },
|
|
2708
2902
|
input: input.input,
|
|
2709
2903
|
...input.options !== void 0 && { options: input.options }
|
|
2710
2904
|
} : {
|
|
2711
2905
|
flow: input.flow,
|
|
2712
2906
|
...input.flowVersion !== void 0 && { flowVersion: input.flowVersion },
|
|
2713
2907
|
...input.projectId !== void 0 && { projectId: input.projectId },
|
|
2908
|
+
...input.segments !== void 0 && { segments: input.segments },
|
|
2714
2909
|
input: input.input,
|
|
2715
2910
|
...input.options !== void 0 && { options: input.options }
|
|
2716
2911
|
};
|
|
@@ -2962,6 +3157,7 @@ function makeSecretsClient(transport) {
|
|
|
2962
3157
|
});
|
|
2963
3158
|
return {
|
|
2964
3159
|
data: page.data,
|
|
3160
|
+
hasMore: page.hasMore ?? page.nextCursor !== void 0,
|
|
2965
3161
|
...page.nextCursor !== void 0 && {
|
|
2966
3162
|
nextCursor: page.nextCursor
|
|
2967
3163
|
}
|
|
@@ -3016,6 +3212,7 @@ function makeSecretsClient(transport) {
|
|
|
3016
3212
|
});
|
|
3017
3213
|
return {
|
|
3018
3214
|
data: page.data,
|
|
3215
|
+
hasMore: page.hasMore ?? page.nextCursor !== void 0,
|
|
3019
3216
|
...page.nextCursor !== void 0 && {
|
|
3020
3217
|
nextCursor: page.nextCursor
|
|
3021
3218
|
}
|
|
@@ -3256,12 +3453,7 @@ function makeSupervisorClient(transport) {
|
|
|
3256
3453
|
...input.tier !== void 0 && { tier: input.tier }
|
|
3257
3454
|
}
|
|
3258
3455
|
});
|
|
3259
|
-
return
|
|
3260
|
-
items: page.data,
|
|
3261
|
-
...page.nextCursor !== void 0 && {
|
|
3262
|
-
nextCursor: page.nextCursor
|
|
3263
|
-
}
|
|
3264
|
-
};
|
|
3456
|
+
return listPage(page);
|
|
3265
3457
|
},
|
|
3266
3458
|
async get(supervisorId, id) {
|
|
3267
3459
|
return transport.request({
|
|
@@ -3499,10 +3691,7 @@ function makeTokensClient(transport) {
|
|
|
3499
3691
|
...filter?.cursor !== void 0 && { cursor: filter.cursor }
|
|
3500
3692
|
}
|
|
3501
3693
|
});
|
|
3502
|
-
return {
|
|
3503
|
-
items: page.data.map(fromWire2),
|
|
3504
|
-
...page.nextCursor !== void 0 && { nextCursor: page.nextCursor }
|
|
3505
|
-
};
|
|
3694
|
+
return listPage({ ...page, data: page.data.map(fromWire2) });
|
|
3506
3695
|
},
|
|
3507
3696
|
async get(id) {
|
|
3508
3697
|
const wire = await transport.request({
|
|
@@ -3537,29 +3726,8 @@ function makeTokensClient(transport) {
|
|
|
3537
3726
|
|
|
3538
3727
|
// src/resources/tools.ts
|
|
3539
3728
|
function makeToolsClient(transport) {
|
|
3540
|
-
|
|
3541
|
-
async list(filter) {
|
|
3542
|
-
const page = await transport.request({
|
|
3543
|
-
method: "GET",
|
|
3544
|
-
path: "/v1/tools",
|
|
3545
|
-
query: {
|
|
3546
|
-
...filter?.limit !== void 0 && { limit: filter.limit },
|
|
3547
|
-
...filter?.cursor !== void 0 && { cursor: filter.cursor },
|
|
3548
|
-
...filter?.name !== void 0 && { name: filter.name }
|
|
3549
|
-
}
|
|
3550
|
-
});
|
|
3551
|
-
return {
|
|
3552
|
-
items: page.data,
|
|
3553
|
-
...page.nextCursor !== void 0 && { nextCursor: page.nextCursor }
|
|
3554
|
-
};
|
|
3555
|
-
},
|
|
3556
|
-
async get(id) {
|
|
3557
|
-
return transport.request({
|
|
3558
|
-
method: "GET",
|
|
3559
|
-
path: `/v1/tools/${encodeURIComponent(id)}`
|
|
3560
|
-
});
|
|
3561
|
-
},
|
|
3562
|
-
async listVersions(id, filter) {
|
|
3729
|
+
const versions = {
|
|
3730
|
+
async list(id, filter) {
|
|
3563
3731
|
const page = await transport.request({
|
|
3564
3732
|
method: "GET",
|
|
3565
3733
|
path: `/v1/tools/${encodeURIComponent(id)}/versions`,
|
|
@@ -3569,18 +3737,15 @@ function makeToolsClient(transport) {
|
|
|
3569
3737
|
...filter?.includeTombstoned === true && { includeTombstoned: "true" }
|
|
3570
3738
|
}
|
|
3571
3739
|
});
|
|
3572
|
-
return
|
|
3573
|
-
items: page.data,
|
|
3574
|
-
...page.nextCursor !== void 0 && { nextCursor: page.nextCursor }
|
|
3575
|
-
};
|
|
3740
|
+
return listPage(page);
|
|
3576
3741
|
},
|
|
3577
|
-
async
|
|
3742
|
+
async get(id, version) {
|
|
3578
3743
|
return transport.request({
|
|
3579
3744
|
method: "GET",
|
|
3580
3745
|
path: `/v1/tools/${encodeURIComponent(id)}/versions/${encodeURIComponent(version)}`
|
|
3581
3746
|
});
|
|
3582
3747
|
},
|
|
3583
|
-
async
|
|
3748
|
+
async reinstate(id, version, options) {
|
|
3584
3749
|
const wire = await transport.request({
|
|
3585
3750
|
method: "POST",
|
|
3586
3751
|
path: `/v1/tools/${encodeURIComponent(id)}/versions/${encodeURIComponent(version)}/reinstate`,
|
|
@@ -3594,7 +3759,7 @@ function makeToolsClient(transport) {
|
|
|
3594
3759
|
wasTombstoned: wire.wasTombstoned
|
|
3595
3760
|
};
|
|
3596
3761
|
},
|
|
3597
|
-
async
|
|
3762
|
+
async unregister(id, version, options) {
|
|
3598
3763
|
const wire = await transport.request({
|
|
3599
3764
|
method: "POST",
|
|
3600
3765
|
path: `/v1/tools/${encodeURIComponent(id)}/versions/${encodeURIComponent(version)}/unregister`,
|
|
@@ -3607,7 +3772,43 @@ function makeToolsClient(transport) {
|
|
|
3607
3772
|
version: wire.version,
|
|
3608
3773
|
unregistered: wire.unregistered
|
|
3609
3774
|
};
|
|
3775
|
+
}
|
|
3776
|
+
};
|
|
3777
|
+
return {
|
|
3778
|
+
async list(filter) {
|
|
3779
|
+
const page = await transport.request({
|
|
3780
|
+
method: "GET",
|
|
3781
|
+
path: "/v1/tools",
|
|
3782
|
+
query: {
|
|
3783
|
+
...filter?.limit !== void 0 && { limit: filter.limit },
|
|
3784
|
+
...filter?.cursor !== void 0 && { cursor: filter.cursor },
|
|
3785
|
+
...filter?.name !== void 0 && { name: filter.name }
|
|
3786
|
+
}
|
|
3787
|
+
});
|
|
3788
|
+
return listPage(page);
|
|
3789
|
+
},
|
|
3790
|
+
async get(id) {
|
|
3791
|
+
return transport.request({
|
|
3792
|
+
method: "GET",
|
|
3793
|
+
path: `/v1/tools/${encodeURIComponent(id)}`
|
|
3794
|
+
});
|
|
3610
3795
|
},
|
|
3796
|
+
versions,
|
|
3797
|
+
async register(manifest, options) {
|
|
3798
|
+
const result = await transport.request({
|
|
3799
|
+
method: "POST",
|
|
3800
|
+
path: "/v1/tools",
|
|
3801
|
+
body: { ...manifest, projectId: options.projectId },
|
|
3802
|
+
...options.idempotencyKey !== void 0 && {
|
|
3803
|
+
idempotencyKey: options.idempotencyKey
|
|
3804
|
+
}
|
|
3805
|
+
});
|
|
3806
|
+
return { toolId: result.toolId };
|
|
3807
|
+
},
|
|
3808
|
+
listVersions: (id, filter) => versions.list(id, filter),
|
|
3809
|
+
getVersion: (id, version) => versions.get(id, version),
|
|
3810
|
+
reinstateVersion: (id, version, options) => versions.reinstate(id, version, options),
|
|
3811
|
+
unregisterVersion: (id, version, options) => versions.unregister(id, version, options),
|
|
3611
3812
|
async invoke(_id, _input) {
|
|
3612
3813
|
throw new KindgiApiError(
|
|
3613
3814
|
notYetWired(
|
|
@@ -3660,12 +3861,7 @@ function makeUsersClient(transport) {
|
|
|
3660
3861
|
...filter?.query !== void 0 && { query: filter.query }
|
|
3661
3862
|
}
|
|
3662
3863
|
});
|
|
3663
|
-
return
|
|
3664
|
-
items: page.data,
|
|
3665
|
-
...page.nextCursor !== void 0 && {
|
|
3666
|
-
nextCursor: page.nextCursor
|
|
3667
|
-
}
|
|
3668
|
-
};
|
|
3864
|
+
return listPage(page);
|
|
3669
3865
|
},
|
|
3670
3866
|
async update(_id, _patch) {
|
|
3671
3867
|
throw new KindgiApiError(
|
|
@@ -3689,12 +3885,7 @@ function makeUsersClient(transport) {
|
|
|
3689
3885
|
method: "GET",
|
|
3690
3886
|
path: `/v1/identity/users/${encodeURIComponent(userId)}/sessions`
|
|
3691
3887
|
});
|
|
3692
|
-
return
|
|
3693
|
-
items: page.data,
|
|
3694
|
-
...page.nextCursor !== void 0 && {
|
|
3695
|
-
nextCursor: page.nextCursor
|
|
3696
|
-
}
|
|
3697
|
-
};
|
|
3888
|
+
return listPage(page);
|
|
3698
3889
|
},
|
|
3699
3890
|
async revokeAll(userId, options) {
|
|
3700
3891
|
return transport.request({
|
|
@@ -3925,7 +4116,9 @@ function createTransport(options) {
|
|
|
3925
4116
|
} catch {
|
|
3926
4117
|
body = void 0;
|
|
3927
4118
|
}
|
|
3928
|
-
throw new KindgiApiError(
|
|
4119
|
+
throw new KindgiApiError(
|
|
4120
|
+
fromWire(unwrapErrorEnvelope(body, response.status), response.status)
|
|
4121
|
+
);
|
|
3929
4122
|
}
|
|
3930
4123
|
};
|
|
3931
4124
|
}
|
|
@@ -3937,7 +4130,8 @@ function buildUrl(apiUrl, path, query) {
|
|
|
3937
4130
|
for (const key of Object.keys(query)) {
|
|
3938
4131
|
const value = query[key];
|
|
3939
4132
|
if (value === void 0) continue;
|
|
3940
|
-
|
|
4133
|
+
const values = typeof value === "object" ? value : [String(value)];
|
|
4134
|
+
for (const v of values) params.push(`${encodeURIComponent(key)}=${encodeURIComponent(v)}`);
|
|
3941
4135
|
}
|
|
3942
4136
|
return params.length === 0 ? base : `${base}?${params.join("&")}`;
|
|
3943
4137
|
}
|
|
@@ -3995,6 +4189,8 @@ function createClient(options) {
|
|
|
3995
4189
|
adapters: makeAdaptersClient(transport),
|
|
3996
4190
|
providers: makeProvidersClient(transport),
|
|
3997
4191
|
policies: makePoliciesClient(transport),
|
|
4192
|
+
gatePolicies: makeGatePoliciesClient(transport),
|
|
4193
|
+
retention: makeRetentionClient(transport),
|
|
3998
4194
|
projects: makeProjectsClient(transport),
|
|
3999
4195
|
env: makeEnvClient(transport),
|
|
4000
4196
|
secrets: makeSecretsClient(transport),
|