@miosa/sdk 1.2.6 → 1.2.7
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.d.ts +335 -144
- package/dist/index.js +884 -478
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { randomUUID } from 'crypto';
|
|
1
|
+
import { createHmac, timingSafeEqual, randomUUID } from 'crypto';
|
|
2
2
|
import EventEmitter from 'events';
|
|
3
3
|
|
|
4
4
|
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
@@ -22,10 +22,10 @@ var MiosaError = class _MiosaError extends Error {
|
|
|
22
22
|
this.details = details;
|
|
23
23
|
this.requestId = requestId;
|
|
24
24
|
}
|
|
25
|
-
static fromResponse(status,
|
|
26
|
-
const message =
|
|
27
|
-
const code =
|
|
28
|
-
const details =
|
|
25
|
+
static fromResponse(status, body2, requestId) {
|
|
26
|
+
const message = body2.error?.message ?? body2.message ?? `HTTP ${status}`;
|
|
27
|
+
const code = body2.error?.code ?? body2.code ?? "UNKNOWN_ERROR";
|
|
28
|
+
const details = body2.error?.details;
|
|
29
29
|
if (status === 401 || status === 403) {
|
|
30
30
|
return new AuthError(message, status, code, details, requestId);
|
|
31
31
|
}
|
|
@@ -167,7 +167,7 @@ var HttpClient = class {
|
|
|
167
167
|
async request(path, options = {}) {
|
|
168
168
|
const {
|
|
169
169
|
method = "GET",
|
|
170
|
-
body,
|
|
170
|
+
body: body2,
|
|
171
171
|
formData,
|
|
172
172
|
binary = false,
|
|
173
173
|
timeout = this.timeout
|
|
@@ -176,9 +176,9 @@ var HttpClient = class {
|
|
|
176
176
|
let fetchBody;
|
|
177
177
|
if (formData) {
|
|
178
178
|
fetchBody = formData;
|
|
179
|
-
} else if (
|
|
179
|
+
} else if (body2 !== void 0) {
|
|
180
180
|
headers = { ...headers, "Content-Type": "application/json" };
|
|
181
|
-
fetchBody = JSON.stringify(
|
|
181
|
+
fetchBody = JSON.stringify(body2);
|
|
182
182
|
}
|
|
183
183
|
let lastError;
|
|
184
184
|
for (let attempt = 0; attempt <= this.maxRetries; attempt++) {
|
|
@@ -260,17 +260,17 @@ var HttpClient = class {
|
|
|
260
260
|
}
|
|
261
261
|
return this.request(fullPath, { method: "GET" });
|
|
262
262
|
}
|
|
263
|
-
async post(path,
|
|
264
|
-
return this.request(path, { method: "POST", body });
|
|
263
|
+
async post(path, body2) {
|
|
264
|
+
return this.request(path, { method: "POST", body: body2 });
|
|
265
265
|
}
|
|
266
|
-
async patch(path,
|
|
267
|
-
return this.request(path, { method: "PATCH", body });
|
|
266
|
+
async patch(path, body2) {
|
|
267
|
+
return this.request(path, { method: "PATCH", body: body2 });
|
|
268
268
|
}
|
|
269
|
-
async put(path,
|
|
270
|
-
return this.request(path, { method: "PUT", body });
|
|
269
|
+
async put(path, body2) {
|
|
270
|
+
return this.request(path, { method: "PUT", body: body2 });
|
|
271
271
|
}
|
|
272
|
-
async delete(path,
|
|
273
|
-
return this.request(path, { method: "DELETE", body });
|
|
272
|
+
async delete(path, body2) {
|
|
273
|
+
return this.request(path, { method: "DELETE", body: body2 });
|
|
274
274
|
}
|
|
275
275
|
async getBinary(path) {
|
|
276
276
|
return this.request(path, { method: "GET", binary: true });
|
|
@@ -288,10 +288,10 @@ var HttpClient = class {
|
|
|
288
288
|
Accept: "text/event-stream",
|
|
289
289
|
...options.headers
|
|
290
290
|
});
|
|
291
|
-
let
|
|
291
|
+
let body2 = null;
|
|
292
292
|
if (options.body !== void 0) {
|
|
293
293
|
headers = { ...headers, "Content-Type": "application/json" };
|
|
294
|
-
|
|
294
|
+
body2 = JSON.stringify(options.body);
|
|
295
295
|
}
|
|
296
296
|
const controller = new AbortController();
|
|
297
297
|
let response;
|
|
@@ -299,7 +299,7 @@ var HttpClient = class {
|
|
|
299
299
|
response = await fetch(`${this.baseUrl}${path}`, {
|
|
300
300
|
method,
|
|
301
301
|
headers,
|
|
302
|
-
body,
|
|
302
|
+
body: body2,
|
|
303
303
|
signal: controller.signal
|
|
304
304
|
});
|
|
305
305
|
} catch (err) {
|
|
@@ -368,7 +368,7 @@ var Admin = class {
|
|
|
368
368
|
this.http = http;
|
|
369
369
|
}
|
|
370
370
|
/** Escape hatch — call any admin endpoint by method + path. */
|
|
371
|
-
async request(method, path,
|
|
371
|
+
async request(method, path, body2, query) {
|
|
372
372
|
const fullPath = query ? (() => {
|
|
373
373
|
const qs = new URLSearchParams();
|
|
374
374
|
for (const [k, v] of Object.entries(query)) {
|
|
@@ -381,13 +381,13 @@ var Admin = class {
|
|
|
381
381
|
case "GET":
|
|
382
382
|
return this.http.get(fullPath);
|
|
383
383
|
case "POST":
|
|
384
|
-
return this.http.post(fullPath,
|
|
384
|
+
return this.http.post(fullPath, body2);
|
|
385
385
|
case "PUT":
|
|
386
|
-
return this.http.put(fullPath,
|
|
386
|
+
return this.http.put(fullPath, body2);
|
|
387
387
|
case "PATCH":
|
|
388
|
-
return this.http.patch(fullPath,
|
|
388
|
+
return this.http.patch(fullPath, body2);
|
|
389
389
|
case "DELETE":
|
|
390
|
-
return this.http.delete(fullPath,
|
|
390
|
+
return this.http.delete(fullPath, body2);
|
|
391
391
|
}
|
|
392
392
|
}
|
|
393
393
|
// ── Overview ────────────────────────────────────────────────
|
|
@@ -601,72 +601,134 @@ var Admin = class {
|
|
|
601
601
|
}
|
|
602
602
|
};
|
|
603
603
|
|
|
604
|
-
// src/resources/agent-
|
|
605
|
-
function
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
function createBody(params) {
|
|
609
|
-
return stripUndefined({
|
|
610
|
-
target_id: params.target_id ?? params.targetId ?? params.sandbox_id ?? params.sandboxId ?? params.computer_id ?? params.computerId,
|
|
611
|
-
target_kind: params.target_kind ?? params.targetKind,
|
|
612
|
-
provider: params.provider,
|
|
613
|
-
prompt: params.prompt,
|
|
614
|
-
instruction: params.instruction,
|
|
615
|
-
command: params.command,
|
|
616
|
-
model: params.model,
|
|
617
|
-
cwd: params.cwd,
|
|
618
|
-
timeout: params.timeout,
|
|
619
|
-
metadata: params.metadata
|
|
620
|
-
});
|
|
621
|
-
}
|
|
622
|
-
function listQuery(params) {
|
|
623
|
-
return {
|
|
624
|
-
target_id: params.target_id ?? params.targetId ?? params.sandbox_id ?? params.sandboxId ?? params.computer_id ?? params.computerId,
|
|
625
|
-
limit: params.limit
|
|
626
|
-
};
|
|
627
|
-
}
|
|
628
|
-
function unwrapRun(response) {
|
|
629
|
-
const run = response.data ?? response.run;
|
|
630
|
-
if (!run) {
|
|
631
|
-
throw new Error("Agent run response was empty.");
|
|
604
|
+
// src/resources/agent-runtime-profiles.ts
|
|
605
|
+
function unwrap(payload) {
|
|
606
|
+
if (payload !== null && typeof payload === "object" && "data" in payload && payload.data !== void 0) {
|
|
607
|
+
return payload.data;
|
|
632
608
|
}
|
|
633
|
-
return
|
|
609
|
+
return payload;
|
|
634
610
|
}
|
|
635
|
-
function
|
|
636
|
-
|
|
637
|
-
|
|
611
|
+
function body(params) {
|
|
612
|
+
return Object.fromEntries(
|
|
613
|
+
Object.entries({
|
|
614
|
+
workspace_id: params.workspaceId ?? params.workspace_id,
|
|
615
|
+
name: params.name,
|
|
616
|
+
runtime: params.runtime,
|
|
617
|
+
description: params.description,
|
|
618
|
+
applies_to: params.appliesTo ?? params.applies_to,
|
|
619
|
+
tools: params.tools,
|
|
620
|
+
connectors: params.connectors,
|
|
621
|
+
env: params.env,
|
|
622
|
+
policy: params.policy,
|
|
623
|
+
metadata: params.metadata,
|
|
624
|
+
is_default: params.isDefault ?? params.is_default
|
|
625
|
+
}).filter(([, value]) => value !== void 0)
|
|
626
|
+
);
|
|
638
627
|
}
|
|
639
|
-
|
|
628
|
+
function normalize(profile) {
|
|
629
|
+
const normalized = {
|
|
630
|
+
...profile
|
|
631
|
+
};
|
|
632
|
+
const tenantId = profile.tenantId ?? profile.tenant_id;
|
|
633
|
+
const workspaceId2 = profile.workspaceId ?? profile.workspace_id;
|
|
634
|
+
const appliesTo = profile.appliesTo ?? profile.applies_to;
|
|
635
|
+
const isDefault = profile.isDefault ?? profile.is_default;
|
|
636
|
+
const createdAt = profile.createdAt ?? profile.created_at;
|
|
637
|
+
const updatedAt = profile.updatedAt ?? profile.updated_at;
|
|
638
|
+
if (tenantId !== void 0) normalized.tenantId = tenantId;
|
|
639
|
+
if (workspaceId2 !== void 0) normalized.workspaceId = workspaceId2;
|
|
640
|
+
if (appliesTo !== void 0) normalized.appliesTo = appliesTo;
|
|
641
|
+
if (isDefault !== void 0) normalized.isDefault = isDefault;
|
|
642
|
+
if (createdAt !== void 0) normalized.createdAt = createdAt;
|
|
643
|
+
if (updatedAt !== void 0) normalized.updatedAt = updatedAt;
|
|
644
|
+
return normalized;
|
|
645
|
+
}
|
|
646
|
+
var AgentRuntimeProfiles = class {
|
|
640
647
|
constructor(http) {
|
|
641
648
|
this.http = http;
|
|
642
649
|
}
|
|
643
650
|
http;
|
|
644
|
-
|
|
651
|
+
async list(params = {}) {
|
|
652
|
+
const response = await this.http.get(
|
|
653
|
+
"/agent-runtime-profiles",
|
|
654
|
+
{ workspace_id: params.workspaceId ?? params.workspace_id }
|
|
655
|
+
);
|
|
656
|
+
return unwrap(response).map(normalize);
|
|
657
|
+
}
|
|
658
|
+
async get(id) {
|
|
659
|
+
return normalize(
|
|
660
|
+
unwrap(
|
|
661
|
+
await this.http.get(
|
|
662
|
+
`/agent-runtime-profiles/${encodeURIComponent(id)}`
|
|
663
|
+
)
|
|
664
|
+
)
|
|
665
|
+
);
|
|
666
|
+
}
|
|
645
667
|
async create(params) {
|
|
646
|
-
|
|
647
|
-
|
|
668
|
+
return normalize(
|
|
669
|
+
unwrap(
|
|
670
|
+
await this.http.post(
|
|
671
|
+
"/agent-runtime-profiles",
|
|
672
|
+
body(params)
|
|
673
|
+
)
|
|
674
|
+
)
|
|
675
|
+
);
|
|
648
676
|
}
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
677
|
+
async update(id, params) {
|
|
678
|
+
return normalize(
|
|
679
|
+
unwrap(
|
|
680
|
+
await this.http.put(
|
|
681
|
+
`/agent-runtime-profiles/${encodeURIComponent(id)}`,
|
|
682
|
+
body(params)
|
|
683
|
+
)
|
|
684
|
+
)
|
|
685
|
+
);
|
|
652
686
|
}
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
"/agent-runs",
|
|
657
|
-
listQuery(params)
|
|
687
|
+
async delete(id) {
|
|
688
|
+
await this.http.delete(
|
|
689
|
+
`/agent-runtime-profiles/${encodeURIComponent(id)}`
|
|
658
690
|
);
|
|
659
|
-
return unwrapRuns(response);
|
|
660
691
|
}
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
692
|
+
};
|
|
693
|
+
|
|
694
|
+
// src/resources/agent-runs.ts
|
|
695
|
+
function unwrap2(payload) {
|
|
696
|
+
if (payload && typeof payload === "object" && "data" in payload) {
|
|
697
|
+
return payload.data;
|
|
698
|
+
}
|
|
699
|
+
return payload;
|
|
700
|
+
}
|
|
701
|
+
function stripUndefined(input) {
|
|
702
|
+
return Object.fromEntries(
|
|
703
|
+
Object.entries(input).filter(([, value]) => value !== void 0)
|
|
704
|
+
);
|
|
705
|
+
}
|
|
706
|
+
var AgentRuns = class {
|
|
707
|
+
constructor(http) {
|
|
708
|
+
this.http = http;
|
|
709
|
+
}
|
|
710
|
+
http;
|
|
711
|
+
async run(params) {
|
|
712
|
+
const body2 = stripUndefined({
|
|
713
|
+
prompt: params.prompt,
|
|
714
|
+
target_kind: params.targetKind,
|
|
715
|
+
target_id: params.targetId,
|
|
716
|
+
sandbox_id: params.sandboxId,
|
|
717
|
+
computer_id: params.computerId,
|
|
718
|
+
provider: params.provider,
|
|
719
|
+
model: params.model,
|
|
720
|
+
command: params.command,
|
|
721
|
+
runtime_command: params.runtimeCommand,
|
|
722
|
+
cwd: params.cwd,
|
|
723
|
+
timeout: params.timeout,
|
|
724
|
+
metadata: params.metadata
|
|
725
|
+
});
|
|
726
|
+
return unwrap2(await this.http.post("/agent-runs", body2));
|
|
665
727
|
}
|
|
666
728
|
};
|
|
667
729
|
|
|
668
730
|
// src/resources/analytics.ts
|
|
669
|
-
function
|
|
731
|
+
function unwrap3(payload) {
|
|
670
732
|
if (payload && typeof payload === "object") {
|
|
671
733
|
const p = payload;
|
|
672
734
|
for (const k of ["data", "analytics", "series", "items"]) {
|
|
@@ -689,16 +751,16 @@ var Analytics = class {
|
|
|
689
751
|
async overview(filters = {}) {
|
|
690
752
|
const query = stripUndefined2(filters);
|
|
691
753
|
const data = await this.http.get("/analytics/overview", query);
|
|
692
|
-
return
|
|
754
|
+
return unwrap3(data);
|
|
693
755
|
}
|
|
694
756
|
/** Get a timeseries for a metric over a period. */
|
|
695
757
|
async timeseries(params = {}) {
|
|
696
758
|
const query = stripUndefined2(params);
|
|
697
759
|
const data = await this.http.get("/analytics/timeseries", query);
|
|
698
|
-
return
|
|
760
|
+
return unwrap3(data);
|
|
699
761
|
}
|
|
700
762
|
};
|
|
701
|
-
function
|
|
763
|
+
function unwrap4(payload) {
|
|
702
764
|
if (payload && typeof payload === "object" && "data" in payload) {
|
|
703
765
|
return payload.data;
|
|
704
766
|
}
|
|
@@ -734,26 +796,26 @@ var ApiKeys = class {
|
|
|
734
796
|
}
|
|
735
797
|
async create(params) {
|
|
736
798
|
const { idempotencyKey: ikey, expiresAt, ...rest } = params;
|
|
737
|
-
const
|
|
799
|
+
const body2 = stripUndefined3({
|
|
738
800
|
...rest,
|
|
739
801
|
expires_at: expiresAt ?? rest.expires_at
|
|
740
802
|
});
|
|
741
803
|
const data = await this.http.request("/api-keys", {
|
|
742
804
|
method: "POST",
|
|
743
|
-
body,
|
|
805
|
+
body: body2,
|
|
744
806
|
headers: { "Idempotency-Key": idempotencyKey(ikey) }
|
|
745
807
|
});
|
|
746
|
-
return
|
|
808
|
+
return unwrap4(data);
|
|
747
809
|
}
|
|
748
810
|
/** POST /api/v1/api-keys/scoped — L2 delegation token bound to one external user. */
|
|
749
811
|
async createScoped(params) {
|
|
750
|
-
const
|
|
812
|
+
const body2 = stripUndefined3({
|
|
751
813
|
external_user_id: params.externalUserId,
|
|
752
814
|
scopes: params.scopes,
|
|
753
815
|
expires_at: params.expiresAt
|
|
754
816
|
});
|
|
755
|
-
return
|
|
756
|
-
await this.http.post("/api-keys/scoped",
|
|
817
|
+
return unwrap4(
|
|
818
|
+
await this.http.post("/api-keys/scoped", body2)
|
|
757
819
|
);
|
|
758
820
|
}
|
|
759
821
|
async delete(keyId) {
|
|
@@ -762,7 +824,7 @@ var ApiKeys = class {
|
|
|
762
824
|
};
|
|
763
825
|
|
|
764
826
|
// src/resources/audit-log.ts
|
|
765
|
-
function
|
|
827
|
+
function unwrap5(payload) {
|
|
766
828
|
if (payload && typeof payload === "object") {
|
|
767
829
|
const p = payload;
|
|
768
830
|
for (const k of ["data", "audit_log", "events", "items"]) {
|
|
@@ -785,14 +847,14 @@ var AuditLog = class {
|
|
|
785
847
|
async list(params = {}) {
|
|
786
848
|
const query = stripUndefined4(params);
|
|
787
849
|
const data = await this.http.get("/audit-log", query);
|
|
788
|
-
const result =
|
|
850
|
+
const result = unwrap5(data);
|
|
789
851
|
if (Array.isArray(result)) return result;
|
|
790
852
|
return [];
|
|
791
853
|
}
|
|
792
854
|
};
|
|
793
855
|
|
|
794
856
|
// src/resources/benchmarks.ts
|
|
795
|
-
function
|
|
857
|
+
function unwrap6(data) {
|
|
796
858
|
if (data && typeof data === "object") {
|
|
797
859
|
const d = data;
|
|
798
860
|
for (const k of ["data", "benchmarks", "samples", "items"]) {
|
|
@@ -824,19 +886,19 @@ var Benchmarks = class {
|
|
|
824
886
|
return unwrapList(data);
|
|
825
887
|
}
|
|
826
888
|
async get(benchmarkId) {
|
|
827
|
-
return
|
|
889
|
+
return unwrap6(
|
|
828
890
|
await this.http.get(`/admin/benchmarks/${benchmarkId}`)
|
|
829
891
|
);
|
|
830
892
|
}
|
|
831
893
|
/** Start a new benchmark run — pass kind and run-specific options. */
|
|
832
894
|
async create(params) {
|
|
833
|
-
const
|
|
895
|
+
const body2 = Object.fromEntries(
|
|
834
896
|
Object.entries(params).filter(([, v]) => v !== void 0)
|
|
835
897
|
);
|
|
836
|
-
return
|
|
898
|
+
return unwrap6(await this.http.post("/admin/benchmarks", body2));
|
|
837
899
|
}
|
|
838
900
|
async cancel(benchmarkId) {
|
|
839
|
-
return
|
|
901
|
+
return unwrap6(
|
|
840
902
|
await this.http.post(`/admin/benchmarks/${benchmarkId}/cancel`)
|
|
841
903
|
);
|
|
842
904
|
}
|
|
@@ -853,17 +915,17 @@ var Benchmarks = class {
|
|
|
853
915
|
}
|
|
854
916
|
/** Compare two benchmark runs. */
|
|
855
917
|
async compare(params) {
|
|
856
|
-
const
|
|
918
|
+
const body2 = Object.fromEntries(
|
|
857
919
|
Object.entries(params).filter(([, v]) => v !== void 0)
|
|
858
920
|
);
|
|
859
|
-
return
|
|
860
|
-
await this.http.post("/admin/benchmarks/compare",
|
|
921
|
+
return unwrap6(
|
|
922
|
+
await this.http.post("/admin/benchmarks/compare", body2)
|
|
861
923
|
);
|
|
862
924
|
}
|
|
863
925
|
};
|
|
864
926
|
|
|
865
927
|
// src/resources/builder-sessions.ts
|
|
866
|
-
function
|
|
928
|
+
function unwrap7(data) {
|
|
867
929
|
if (data && typeof data === "object") {
|
|
868
930
|
const d = data;
|
|
869
931
|
for (const k of ["data", "sessions", "items"]) {
|
|
@@ -900,7 +962,7 @@ var BuilderSessions = class {
|
|
|
900
962
|
return all.find((s) => s.id === sessionId) ?? {};
|
|
901
963
|
}
|
|
902
964
|
async updateTitle(sessionId, title) {
|
|
903
|
-
return
|
|
965
|
+
return unwrap7(
|
|
904
966
|
await this.http.patch(`/builder/sessions/${sessionId}/title`, {
|
|
905
967
|
title
|
|
906
968
|
})
|
|
@@ -912,7 +974,7 @@ var BuilderSessions = class {
|
|
|
912
974
|
};
|
|
913
975
|
|
|
914
976
|
// src/resources/channels.ts
|
|
915
|
-
function
|
|
977
|
+
function unwrap8(payload) {
|
|
916
978
|
if (payload && typeof payload === "object") {
|
|
917
979
|
const p = payload;
|
|
918
980
|
for (const k of ["data", "channels", "notifications", "items"]) {
|
|
@@ -940,26 +1002,26 @@ var Channels = class {
|
|
|
940
1002
|
async list(params = {}) {
|
|
941
1003
|
const query = stripUndefined5(params);
|
|
942
1004
|
const data = await this.http.get("/channels", query);
|
|
943
|
-
const result =
|
|
1005
|
+
const result = unwrap8(data);
|
|
944
1006
|
if (Array.isArray(result)) return result;
|
|
945
1007
|
return [];
|
|
946
1008
|
}
|
|
947
1009
|
/** Get a single channel. */
|
|
948
1010
|
async get(channelId) {
|
|
949
1011
|
const data = await this.http.get(`/channels/${channelId}`);
|
|
950
|
-
return
|
|
1012
|
+
return unwrap8(data);
|
|
951
1013
|
}
|
|
952
1014
|
/** Create a new channel. */
|
|
953
1015
|
async create(params) {
|
|
954
|
-
const
|
|
955
|
-
const data = await this.http.post("/channels",
|
|
956
|
-
return
|
|
1016
|
+
const body2 = stripUndefObj(params);
|
|
1017
|
+
const data = await this.http.post("/channels", body2);
|
|
1018
|
+
return unwrap8(data);
|
|
957
1019
|
}
|
|
958
1020
|
/** Update a channel. */
|
|
959
1021
|
async update(channelId, params) {
|
|
960
|
-
const
|
|
961
|
-
const data = await this.http.patch(`/channels/${channelId}`,
|
|
962
|
-
return
|
|
1022
|
+
const body2 = stripUndefObj(params);
|
|
1023
|
+
const data = await this.http.patch(`/channels/${channelId}`, body2);
|
|
1024
|
+
return unwrap8(data);
|
|
963
1025
|
}
|
|
964
1026
|
/** Delete a channel. */
|
|
965
1027
|
async delete(channelId) {
|
|
@@ -969,30 +1031,30 @@ var Channels = class {
|
|
|
969
1031
|
/** Get notification preferences across all channels. */
|
|
970
1032
|
async listNotifications() {
|
|
971
1033
|
const data = await this.http.get("/channels/notifications");
|
|
972
|
-
return
|
|
1034
|
+
return unwrap8(data);
|
|
973
1035
|
}
|
|
974
1036
|
/** Update notification preferences. */
|
|
975
1037
|
async updateNotifications(params) {
|
|
976
|
-
const
|
|
977
|
-
const data = await this.http.put("/channels/notifications",
|
|
978
|
-
return
|
|
1038
|
+
const body2 = stripUndefObj(params);
|
|
1039
|
+
const data = await this.http.put("/channels/notifications", body2);
|
|
1040
|
+
return unwrap8(data);
|
|
979
1041
|
}
|
|
980
1042
|
/** Enable a channel. */
|
|
981
1043
|
async enable(channelId) {
|
|
982
1044
|
const data = await this.http.post(`/channels/${channelId}/enable`);
|
|
983
|
-
return
|
|
1045
|
+
return unwrap8(data);
|
|
984
1046
|
}
|
|
985
1047
|
/** Disable a channel. */
|
|
986
1048
|
async disable(channelId) {
|
|
987
1049
|
const data = await this.http.post(
|
|
988
1050
|
`/channels/${channelId}/disable`
|
|
989
1051
|
);
|
|
990
|
-
return
|
|
1052
|
+
return unwrap8(data);
|
|
991
1053
|
}
|
|
992
1054
|
};
|
|
993
1055
|
|
|
994
1056
|
// src/resources/command-center.ts
|
|
995
|
-
function
|
|
1057
|
+
function unwrap9(data) {
|
|
996
1058
|
if (data && typeof data === "object") {
|
|
997
1059
|
const d = data;
|
|
998
1060
|
for (const k of [
|
|
@@ -1026,7 +1088,7 @@ var CommandCenter = class {
|
|
|
1026
1088
|
http;
|
|
1027
1089
|
/** Top-level snapshot (GET /command-center). */
|
|
1028
1090
|
async overview() {
|
|
1029
|
-
return
|
|
1091
|
+
return unwrap9(await this.http.get("/command-center"));
|
|
1030
1092
|
}
|
|
1031
1093
|
async agents() {
|
|
1032
1094
|
return unwrapList3(await this.http.get("/command-center/agents"));
|
|
@@ -1037,13 +1099,13 @@ var CommandCenter = class {
|
|
|
1037
1099
|
);
|
|
1038
1100
|
}
|
|
1039
1101
|
async metrics() {
|
|
1040
|
-
return
|
|
1102
|
+
return unwrap9(await this.http.get("/command-center/metrics"));
|
|
1041
1103
|
}
|
|
1042
1104
|
async presets() {
|
|
1043
1105
|
return unwrapList3(await this.http.get("/command-center/presets"));
|
|
1044
1106
|
}
|
|
1045
1107
|
async tiers() {
|
|
1046
|
-
return
|
|
1108
|
+
return unwrap9(await this.http.get("/command-center/tiers"));
|
|
1047
1109
|
}
|
|
1048
1110
|
/** Stream live command-center events via SSE. */
|
|
1049
1111
|
events() {
|
|
@@ -1052,7 +1114,7 @@ var CommandCenter = class {
|
|
|
1052
1114
|
};
|
|
1053
1115
|
|
|
1054
1116
|
// src/resources/community.ts
|
|
1055
|
-
function
|
|
1117
|
+
function unwrap10(data) {
|
|
1056
1118
|
if (data && typeof data === "object") {
|
|
1057
1119
|
const d = data;
|
|
1058
1120
|
for (const k of ["data", "templates", "agents", "items"]) {
|
|
@@ -1084,7 +1146,7 @@ var Community = class {
|
|
|
1084
1146
|
return unwrapList4(await this.http.get("/community/agents", query));
|
|
1085
1147
|
}
|
|
1086
1148
|
async getAgent(agentId) {
|
|
1087
|
-
return
|
|
1149
|
+
return unwrap10(await this.http.get(`/community/agents/${agentId}`));
|
|
1088
1150
|
}
|
|
1089
1151
|
// ── Templates ─────────────────────────────────────────────────────────
|
|
1090
1152
|
async listTemplates(filters = {}) {
|
|
@@ -1096,41 +1158,41 @@ var Community = class {
|
|
|
1096
1158
|
);
|
|
1097
1159
|
}
|
|
1098
1160
|
async getTemplate(templateId) {
|
|
1099
|
-
return
|
|
1161
|
+
return unwrap10(
|
|
1100
1162
|
await this.http.get(`/community/templates/${templateId}`)
|
|
1101
1163
|
);
|
|
1102
1164
|
}
|
|
1103
1165
|
/** Install a community template into the caller's tenant. */
|
|
1104
1166
|
async installTemplate(templateId, opts = {}) {
|
|
1105
|
-
const
|
|
1167
|
+
const body2 = Object.fromEntries(
|
|
1106
1168
|
Object.entries(opts).filter(([, v]) => v !== void 0)
|
|
1107
1169
|
);
|
|
1108
|
-
return
|
|
1170
|
+
return unwrap10(
|
|
1109
1171
|
await this.http.post(
|
|
1110
1172
|
`/community/templates/${templateId}/install`,
|
|
1111
|
-
|
|
1173
|
+
body2
|
|
1112
1174
|
)
|
|
1113
1175
|
);
|
|
1114
1176
|
}
|
|
1115
1177
|
/** Rate a community template (1–5). */
|
|
1116
1178
|
async rateTemplate(templateId, rating, opts = {}) {
|
|
1117
|
-
const
|
|
1179
|
+
const body2 = {
|
|
1118
1180
|
rating,
|
|
1119
1181
|
...Object.fromEntries(
|
|
1120
1182
|
Object.entries(opts).filter(([, v]) => v !== void 0)
|
|
1121
1183
|
)
|
|
1122
1184
|
};
|
|
1123
|
-
return
|
|
1185
|
+
return unwrap10(
|
|
1124
1186
|
await this.http.post(
|
|
1125
1187
|
`/community/templates/${templateId}/rate`,
|
|
1126
|
-
|
|
1188
|
+
body2
|
|
1127
1189
|
)
|
|
1128
1190
|
);
|
|
1129
1191
|
}
|
|
1130
1192
|
};
|
|
1131
1193
|
|
|
1132
1194
|
// src/resources/completions.ts
|
|
1133
|
-
function
|
|
1195
|
+
function unwrap11(data) {
|
|
1134
1196
|
if (data && typeof data === "object") {
|
|
1135
1197
|
const d = data;
|
|
1136
1198
|
if (Array.isArray(d.choices)) return d;
|
|
@@ -1149,24 +1211,24 @@ var Completions = class {
|
|
|
1149
1211
|
}
|
|
1150
1212
|
http;
|
|
1151
1213
|
create(params) {
|
|
1152
|
-
const
|
|
1214
|
+
const body2 = buildBody(params);
|
|
1153
1215
|
if (params.stream === true) {
|
|
1154
1216
|
return this.http.stream(
|
|
1155
1217
|
"/intelligence/completions",
|
|
1156
|
-
{ method: "POST", body }
|
|
1218
|
+
{ method: "POST", body: body2 }
|
|
1157
1219
|
);
|
|
1158
1220
|
}
|
|
1159
|
-
return this.http.post("/intelligence/completions",
|
|
1221
|
+
return this.http.post("/intelligence/completions", body2).then(unwrap11);
|
|
1160
1222
|
}
|
|
1161
1223
|
chat(params) {
|
|
1162
|
-
const
|
|
1224
|
+
const body2 = buildBody(params);
|
|
1163
1225
|
if (params.stream === true) {
|
|
1164
1226
|
return this.http.stream(
|
|
1165
1227
|
"/intelligence/chat/completions",
|
|
1166
|
-
{ method: "POST", body }
|
|
1228
|
+
{ method: "POST", body: body2 }
|
|
1167
1229
|
);
|
|
1168
1230
|
}
|
|
1169
|
-
return this.http.post("/intelligence/chat/completions",
|
|
1231
|
+
return this.http.post("/intelligence/chat/completions", body2).then(unwrap11);
|
|
1170
1232
|
}
|
|
1171
1233
|
};
|
|
1172
1234
|
|
|
@@ -1289,7 +1351,7 @@ var Checkpoints = class {
|
|
|
1289
1351
|
};
|
|
1290
1352
|
|
|
1291
1353
|
// src/resources/computer-auto-stop.ts
|
|
1292
|
-
function
|
|
1354
|
+
function unwrap12(data) {
|
|
1293
1355
|
if (data && typeof data === "object") {
|
|
1294
1356
|
const d = data;
|
|
1295
1357
|
if ("data" in d && Object.keys(d).length <= 2) {
|
|
@@ -1307,13 +1369,13 @@ var ComputerAutoStop = class {
|
|
|
1307
1369
|
computerId;
|
|
1308
1370
|
/** Return the current auto-stop configuration. */
|
|
1309
1371
|
async get() {
|
|
1310
|
-
return
|
|
1372
|
+
return unwrap12(
|
|
1311
1373
|
await this.http.get(`/computers/${this.computerId}/auto-stop`)
|
|
1312
1374
|
);
|
|
1313
1375
|
}
|
|
1314
1376
|
/** Set the idle timeout in seconds (0 disables auto-stop). */
|
|
1315
1377
|
async update(seconds) {
|
|
1316
|
-
return
|
|
1378
|
+
return unwrap12(
|
|
1317
1379
|
await this.http.patch(
|
|
1318
1380
|
`/computers/${this.computerId}/auto-stop`,
|
|
1319
1381
|
{ seconds }
|
|
@@ -1323,7 +1385,7 @@ var ComputerAutoStop = class {
|
|
|
1323
1385
|
};
|
|
1324
1386
|
|
|
1325
1387
|
// src/resources/computer-env.ts
|
|
1326
|
-
function
|
|
1388
|
+
function unwrap13(data) {
|
|
1327
1389
|
if (data && typeof data === "object") {
|
|
1328
1390
|
const d = data;
|
|
1329
1391
|
if ("data" in d && Object.keys(d).length <= 2) {
|
|
@@ -1358,11 +1420,11 @@ var ComputerEnv = class {
|
|
|
1358
1420
|
}
|
|
1359
1421
|
/** Create a new env var. Use update() to change an existing one. */
|
|
1360
1422
|
async set(name, value) {
|
|
1361
|
-
return
|
|
1423
|
+
return unwrap13(await this.http.post(this.base(), { name, value }));
|
|
1362
1424
|
}
|
|
1363
1425
|
/** Patch the value of an existing env var by name. */
|
|
1364
1426
|
async update(name, value) {
|
|
1365
|
-
return
|
|
1427
|
+
return unwrap13(
|
|
1366
1428
|
await this.http.patch(`${this.base()}/${name}`, { value })
|
|
1367
1429
|
);
|
|
1368
1430
|
}
|
|
@@ -1379,7 +1441,7 @@ var ComputerEnv = class {
|
|
|
1379
1441
|
};
|
|
1380
1442
|
|
|
1381
1443
|
// src/resources/computer-logs.ts
|
|
1382
|
-
function
|
|
1444
|
+
function unwrap14(data) {
|
|
1383
1445
|
if (data && typeof data === "object") {
|
|
1384
1446
|
const d = data;
|
|
1385
1447
|
if ("data" in d && Object.keys(d).length <= 2) {
|
|
@@ -1400,7 +1462,7 @@ var ComputerLogs = class {
|
|
|
1400
1462
|
const query = Object.fromEntries(
|
|
1401
1463
|
Object.entries(params).filter(([, v]) => v !== void 0)
|
|
1402
1464
|
);
|
|
1403
|
-
return
|
|
1465
|
+
return unwrap14(
|
|
1404
1466
|
await this.http.get(`/computers/${this.computerId}/logs`, query)
|
|
1405
1467
|
);
|
|
1406
1468
|
}
|
|
@@ -1413,7 +1475,7 @@ var ComputerLogs = class {
|
|
|
1413
1475
|
};
|
|
1414
1476
|
|
|
1415
1477
|
// src/resources/computer-osa.ts
|
|
1416
|
-
function
|
|
1478
|
+
function unwrap15(data) {
|
|
1417
1479
|
if (data && typeof data === "object") {
|
|
1418
1480
|
const d = data;
|
|
1419
1481
|
if ("data" in d && Object.keys(d).length <= 2) {
|
|
@@ -1431,47 +1493,47 @@ var ComputerOsa = class {
|
|
|
1431
1493
|
computerId;
|
|
1432
1494
|
/** Submit a free-form task to the in-VM OSA agent. */
|
|
1433
1495
|
async submitTask(task, params = {}) {
|
|
1434
|
-
const
|
|
1496
|
+
const body2 = {
|
|
1435
1497
|
task,
|
|
1436
1498
|
...Object.fromEntries(
|
|
1437
1499
|
Object.entries(params).filter(([, v]) => v !== void 0)
|
|
1438
1500
|
)
|
|
1439
1501
|
};
|
|
1440
|
-
return
|
|
1502
|
+
return unwrap15(
|
|
1441
1503
|
await this.http.post(
|
|
1442
1504
|
`/computers/${this.computerId}/osa/task`,
|
|
1443
|
-
|
|
1505
|
+
body2
|
|
1444
1506
|
)
|
|
1445
1507
|
);
|
|
1446
1508
|
}
|
|
1447
1509
|
/** Cancel the currently-running OSA task, if any. */
|
|
1448
1510
|
async cancelTask() {
|
|
1449
|
-
return
|
|
1511
|
+
return unwrap15(
|
|
1450
1512
|
await this.http.delete(`/computers/${this.computerId}/osa/task`)
|
|
1451
1513
|
);
|
|
1452
1514
|
}
|
|
1453
1515
|
/** Return OSA's current task / configuration / health snapshot. */
|
|
1454
1516
|
async status() {
|
|
1455
|
-
return
|
|
1517
|
+
return unwrap15(
|
|
1456
1518
|
await this.http.get(`/computers/${this.computerId}/osa/status`)
|
|
1457
1519
|
);
|
|
1458
1520
|
}
|
|
1459
1521
|
/** Update OSA runtime configuration (model, tools, secrets, etc.). */
|
|
1460
1522
|
async configure(config) {
|
|
1461
|
-
const
|
|
1523
|
+
const body2 = Object.fromEntries(
|
|
1462
1524
|
Object.entries(config).filter(([, v]) => v !== void 0)
|
|
1463
1525
|
);
|
|
1464
|
-
return
|
|
1526
|
+
return unwrap15(
|
|
1465
1527
|
await this.http.post(
|
|
1466
1528
|
`/computers/${this.computerId}/osa/configure`,
|
|
1467
|
-
|
|
1529
|
+
body2
|
|
1468
1530
|
)
|
|
1469
1531
|
);
|
|
1470
1532
|
}
|
|
1471
1533
|
};
|
|
1472
1534
|
|
|
1473
1535
|
// src/resources/computer-ports.ts
|
|
1474
|
-
function
|
|
1536
|
+
function unwrap16(data) {
|
|
1475
1537
|
if (data && typeof data === "object") {
|
|
1476
1538
|
const d = data;
|
|
1477
1539
|
if ("data" in d && Object.keys(d).length <= 2) {
|
|
@@ -1510,21 +1572,21 @@ var ComputerPorts = class {
|
|
|
1510
1572
|
}
|
|
1511
1573
|
/** Expose port with the given visibility options. */
|
|
1512
1574
|
async create(port, opts = {}) {
|
|
1513
|
-
const
|
|
1575
|
+
const body2 = {
|
|
1514
1576
|
port,
|
|
1515
1577
|
...Object.fromEntries(
|
|
1516
1578
|
Object.entries(opts).filter(([, v]) => v !== void 0)
|
|
1517
1579
|
)
|
|
1518
1580
|
};
|
|
1519
|
-
return
|
|
1581
|
+
return unwrap16(await this.http.post(this.base(), body2));
|
|
1520
1582
|
}
|
|
1521
1583
|
/** Patch visibility / auth options for port. */
|
|
1522
1584
|
async update(port, opts) {
|
|
1523
|
-
const
|
|
1585
|
+
const body2 = Object.fromEntries(
|
|
1524
1586
|
Object.entries(opts).filter(([, v]) => v !== void 0)
|
|
1525
1587
|
);
|
|
1526
|
-
return
|
|
1527
|
-
await this.http.patch(`${this.base()}/${port}`,
|
|
1588
|
+
return unwrap16(
|
|
1589
|
+
await this.http.patch(`${this.base()}/${port}`, body2)
|
|
1528
1590
|
);
|
|
1529
1591
|
}
|
|
1530
1592
|
/** Stop exposing port. */
|
|
@@ -1543,14 +1605,14 @@ var ComputerTerminal = class {
|
|
|
1543
1605
|
computerId;
|
|
1544
1606
|
/** Open a new PTY session. Returns the server payload (session id, etc.). */
|
|
1545
1607
|
async create(params = {}) {
|
|
1546
|
-
const
|
|
1608
|
+
const body2 = Object.fromEntries(
|
|
1547
1609
|
Object.entries(params).filter(([, v]) => v !== void 0)
|
|
1548
1610
|
);
|
|
1549
1611
|
const raw = await this.http.post(
|
|
1550
1612
|
`/computers/${this.computerId}/terminal`,
|
|
1551
|
-
|
|
1613
|
+
body2
|
|
1552
1614
|
);
|
|
1553
|
-
return
|
|
1615
|
+
return unwrap17(raw);
|
|
1554
1616
|
}
|
|
1555
1617
|
/** Resize an existing PTY session. */
|
|
1556
1618
|
async resize(sessionId, cols, rows) {
|
|
@@ -1558,10 +1620,10 @@ var ComputerTerminal = class {
|
|
|
1558
1620
|
`/computers/${this.computerId}/pty/${sessionId}/resize`,
|
|
1559
1621
|
{ cols, rows }
|
|
1560
1622
|
);
|
|
1561
|
-
return
|
|
1623
|
+
return unwrap17(raw);
|
|
1562
1624
|
}
|
|
1563
1625
|
};
|
|
1564
|
-
function
|
|
1626
|
+
function unwrap17(data) {
|
|
1565
1627
|
if (data && typeof data === "object") {
|
|
1566
1628
|
const d = data;
|
|
1567
1629
|
if ("data" in d && Object.keys(d).length <= 2) {
|
|
@@ -1572,7 +1634,7 @@ function unwrap15(data) {
|
|
|
1572
1634
|
}
|
|
1573
1635
|
|
|
1574
1636
|
// src/resources/computer-volumes.ts
|
|
1575
|
-
function
|
|
1637
|
+
function unwrap18(data) {
|
|
1576
1638
|
if (data && typeof data === "object") {
|
|
1577
1639
|
const d = data;
|
|
1578
1640
|
if ("data" in d && Object.keys(d).length <= 2) {
|
|
@@ -1606,7 +1668,7 @@ var ComputerVolumes = class {
|
|
|
1606
1668
|
}
|
|
1607
1669
|
/** Attach volumeId at mountPath inside the VM. */
|
|
1608
1670
|
async attach(volumeId, mountPath) {
|
|
1609
|
-
return
|
|
1671
|
+
return unwrap18(
|
|
1610
1672
|
await this.http.post(this.base(), {
|
|
1611
1673
|
volume_id: volumeId,
|
|
1612
1674
|
mount_path: mountPath
|
|
@@ -1779,7 +1841,7 @@ var Desktop = class {
|
|
|
1779
1841
|
};
|
|
1780
1842
|
|
|
1781
1843
|
// src/resources/egressAudit.ts
|
|
1782
|
-
function
|
|
1844
|
+
function unwrap19(payload) {
|
|
1783
1845
|
if (payload && typeof payload === "object") {
|
|
1784
1846
|
const p = payload;
|
|
1785
1847
|
for (const k of ["data", "event", "items"]) {
|
|
@@ -1807,7 +1869,7 @@ function pickFirst(...values) {
|
|
|
1807
1869
|
for (const v of values) if (v !== void 0) return v;
|
|
1808
1870
|
return void 0;
|
|
1809
1871
|
}
|
|
1810
|
-
function
|
|
1872
|
+
function listQuery(params) {
|
|
1811
1873
|
return stripUndefined6({
|
|
1812
1874
|
resource_id: pickFirst(params.resourceId, params.resource_id),
|
|
1813
1875
|
resource_type: pickFirst(params.resourceType, params.resource_type),
|
|
@@ -1836,7 +1898,7 @@ var EgressAudit = class {
|
|
|
1836
1898
|
async list(params = {}) {
|
|
1837
1899
|
const data = await this.http.get(
|
|
1838
1900
|
"/egress/audit",
|
|
1839
|
-
|
|
1901
|
+
listQuery(params)
|
|
1840
1902
|
);
|
|
1841
1903
|
return unwrapList8(data);
|
|
1842
1904
|
}
|
|
@@ -1845,7 +1907,7 @@ var EgressAudit = class {
|
|
|
1845
1907
|
const data = await this.http.get(
|
|
1846
1908
|
`/egress/audit/${id}`
|
|
1847
1909
|
);
|
|
1848
|
-
return
|
|
1910
|
+
return unwrap19(data);
|
|
1849
1911
|
}
|
|
1850
1912
|
/**
|
|
1851
1913
|
* Long-poll the audit endpoint and yield new events as they appear.
|
|
@@ -1863,7 +1925,7 @@ var EgressAudit = class {
|
|
|
1863
1925
|
if (since !== void 0) queryParams.since = since;
|
|
1864
1926
|
const data = await this.http.get(
|
|
1865
1927
|
"/egress/audit",
|
|
1866
|
-
|
|
1928
|
+
listQuery(queryParams)
|
|
1867
1929
|
);
|
|
1868
1930
|
const events = unwrapList8(data);
|
|
1869
1931
|
for (const event of events) {
|
|
@@ -1921,7 +1983,7 @@ var ComputerAudit = class extends SandboxAudit {
|
|
|
1921
1983
|
};
|
|
1922
1984
|
|
|
1923
1985
|
// src/resources/egressNetwork.ts
|
|
1924
|
-
function
|
|
1986
|
+
function unwrap20(payload) {
|
|
1925
1987
|
if (payload && typeof payload === "object") {
|
|
1926
1988
|
const p = payload;
|
|
1927
1989
|
for (const k of ["data", "policy", "rule", "items"]) {
|
|
@@ -1980,7 +2042,7 @@ var EgressNetwork = class {
|
|
|
1980
2042
|
"/egress/allowlist",
|
|
1981
2043
|
ruleBody(host, params, "allow")
|
|
1982
2044
|
);
|
|
1983
|
-
return
|
|
2045
|
+
return unwrap20(data);
|
|
1984
2046
|
}
|
|
1985
2047
|
/** Add a `deny` rule for `host` to the allowlist. */
|
|
1986
2048
|
async deny(host, params = {}) {
|
|
@@ -1988,7 +2050,7 @@ var EgressNetwork = class {
|
|
|
1988
2050
|
"/egress/allowlist",
|
|
1989
2051
|
ruleBody(host, params, "deny")
|
|
1990
2052
|
);
|
|
1991
|
-
return
|
|
2053
|
+
return unwrap20(data);
|
|
1992
2054
|
}
|
|
1993
2055
|
/** List allowlist rules. */
|
|
1994
2056
|
async rules(params = {}) {
|
|
@@ -2016,7 +2078,7 @@ var EgressNetwork = class {
|
|
|
2016
2078
|
}
|
|
2017
2079
|
/** Create an egress policy. */
|
|
2018
2080
|
async createPolicy(params) {
|
|
2019
|
-
const
|
|
2081
|
+
const body2 = stripUndefined7({
|
|
2020
2082
|
name: params.name,
|
|
2021
2083
|
mode: params.mode ?? "enforce",
|
|
2022
2084
|
default_effect: pickFirst2(
|
|
@@ -2030,13 +2092,13 @@ var EgressNetwork = class {
|
|
|
2030
2092
|
});
|
|
2031
2093
|
const data = await this.http.post(
|
|
2032
2094
|
"/egress/policies",
|
|
2033
|
-
|
|
2095
|
+
body2
|
|
2034
2096
|
);
|
|
2035
|
-
return
|
|
2097
|
+
return unwrap20(data);
|
|
2036
2098
|
}
|
|
2037
2099
|
/** Update an egress policy by id. */
|
|
2038
2100
|
async updatePolicy(policyId, params) {
|
|
2039
|
-
const
|
|
2101
|
+
const body2 = stripUndefined7({
|
|
2040
2102
|
mode: params.mode,
|
|
2041
2103
|
default_effect: pickFirst2(params.defaultEffect, params.default_effect),
|
|
2042
2104
|
name: params.name,
|
|
@@ -2044,9 +2106,9 @@ var EgressNetwork = class {
|
|
|
2044
2106
|
});
|
|
2045
2107
|
const data = await this.http.patch(
|
|
2046
2108
|
`/egress/policies/${policyId}`,
|
|
2047
|
-
|
|
2109
|
+
body2
|
|
2048
2110
|
);
|
|
2049
|
-
return
|
|
2111
|
+
return unwrap20(data);
|
|
2050
2112
|
}
|
|
2051
2113
|
// ── mode helpers ──────────────────────────────────────────────────────────
|
|
2052
2114
|
/** Set the policy to `mode="enforce"` — denied egress is blocked. */
|
|
@@ -2064,16 +2126,16 @@ var EgressNetwork = class {
|
|
|
2064
2126
|
if (policyId) {
|
|
2065
2127
|
return this.updatePolicy(policyId, { mode });
|
|
2066
2128
|
}
|
|
2067
|
-
const
|
|
2129
|
+
const body2 = resourceId !== void 0 && resourceType !== void 0 ? stripUndefined7({
|
|
2068
2130
|
mode,
|
|
2069
2131
|
resource_id: resourceId,
|
|
2070
2132
|
resource_type: resourceType
|
|
2071
2133
|
}) : { mode };
|
|
2072
2134
|
const data = await this.http.patch(
|
|
2073
2135
|
"/egress/policies",
|
|
2074
|
-
|
|
2136
|
+
body2
|
|
2075
2137
|
);
|
|
2076
|
-
return
|
|
2138
|
+
return unwrap20(data);
|
|
2077
2139
|
}
|
|
2078
2140
|
// ── suggestions ───────────────────────────────────────────────────────────
|
|
2079
2141
|
/** AI-generated allowlist suggestions from recent denied egress. */
|
|
@@ -2129,28 +2191,28 @@ var SandboxNetwork = class {
|
|
|
2129
2191
|
return this.delegate.removeRule(ruleId);
|
|
2130
2192
|
}
|
|
2131
2193
|
lockdown(params = {}) {
|
|
2132
|
-
const
|
|
2194
|
+
const body2 = {
|
|
2133
2195
|
resource_id: this.resourceId,
|
|
2134
2196
|
resource_type: this.resourceType
|
|
2135
2197
|
};
|
|
2136
|
-
if (params.policyId !== void 0)
|
|
2137
|
-
return this.delegate.lockdown(
|
|
2198
|
+
if (params.policyId !== void 0) body2.policyId = params.policyId;
|
|
2199
|
+
return this.delegate.lockdown(body2);
|
|
2138
2200
|
}
|
|
2139
2201
|
observe(params = {}) {
|
|
2140
|
-
const
|
|
2202
|
+
const body2 = {
|
|
2141
2203
|
resource_id: this.resourceId,
|
|
2142
2204
|
resource_type: this.resourceType
|
|
2143
2205
|
};
|
|
2144
|
-
if (params.policyId !== void 0)
|
|
2145
|
-
return this.delegate.observe(
|
|
2206
|
+
if (params.policyId !== void 0) body2.policyId = params.policyId;
|
|
2207
|
+
return this.delegate.observe(body2);
|
|
2146
2208
|
}
|
|
2147
2209
|
suggestions(params = {}) {
|
|
2148
|
-
const
|
|
2210
|
+
const body2 = {
|
|
2149
2211
|
resource_id: this.resourceId,
|
|
2150
2212
|
resource_type: this.resourceType
|
|
2151
2213
|
};
|
|
2152
|
-
if (params.since !== void 0)
|
|
2153
|
-
return this.delegate.suggestions(
|
|
2214
|
+
if (params.since !== void 0) body2.since = params.since;
|
|
2215
|
+
return this.delegate.suggestions(body2);
|
|
2154
2216
|
}
|
|
2155
2217
|
policies() {
|
|
2156
2218
|
return this.delegate.policies({
|
|
@@ -2164,7 +2226,7 @@ var ComputerNetwork = class extends SandboxNetwork {
|
|
|
2164
2226
|
};
|
|
2165
2227
|
|
|
2166
2228
|
// src/resources/egressSecrets.ts
|
|
2167
|
-
function
|
|
2229
|
+
function unwrap21(payload) {
|
|
2168
2230
|
if (payload && typeof payload === "object") {
|
|
2169
2231
|
const p = payload;
|
|
2170
2232
|
for (const k of ["data", "secret", "binding", "items"]) {
|
|
@@ -2213,7 +2275,7 @@ function setBody(params) {
|
|
|
2213
2275
|
metadata: params.metadata
|
|
2214
2276
|
});
|
|
2215
2277
|
}
|
|
2216
|
-
function
|
|
2278
|
+
function listQuery2(params) {
|
|
2217
2279
|
return stripUndefined8({
|
|
2218
2280
|
scope: params.scope,
|
|
2219
2281
|
type: params.type,
|
|
@@ -2300,7 +2362,7 @@ var OAuthFlow = class {
|
|
|
2300
2362
|
const data = await this.http.get("/egress/oauth/status", {
|
|
2301
2363
|
state: this.state
|
|
2302
2364
|
});
|
|
2303
|
-
const payload =
|
|
2365
|
+
const payload = unwrap21(data) ?? {};
|
|
2304
2366
|
const status = payload.status;
|
|
2305
2367
|
if (status === "completed" || status === "ready" || status === "succeeded") {
|
|
2306
2368
|
return payload;
|
|
@@ -2332,13 +2394,13 @@ var EgressSecrets = class {
|
|
|
2332
2394
|
"/egress/secrets",
|
|
2333
2395
|
setBody(params)
|
|
2334
2396
|
);
|
|
2335
|
-
return
|
|
2397
|
+
return unwrap21(data);
|
|
2336
2398
|
}
|
|
2337
2399
|
/** List secrets. */
|
|
2338
2400
|
async list(params = {}) {
|
|
2339
2401
|
const data = await this.http.get(
|
|
2340
2402
|
"/egress/secrets",
|
|
2341
|
-
|
|
2403
|
+
listQuery2(params)
|
|
2342
2404
|
);
|
|
2343
2405
|
return unwrapList10(data);
|
|
2344
2406
|
}
|
|
@@ -2347,16 +2409,16 @@ var EgressSecrets = class {
|
|
|
2347
2409
|
const data = await this.http.get(
|
|
2348
2410
|
`/egress/secrets/${id}`
|
|
2349
2411
|
);
|
|
2350
|
-
return
|
|
2412
|
+
return unwrap21(data);
|
|
2351
2413
|
}
|
|
2352
2414
|
/** Rotate the secret's value. */
|
|
2353
2415
|
async rotate(id, params) {
|
|
2354
|
-
const
|
|
2416
|
+
const body2 = typeof params === "string" ? rotateBody({ newValue: params }) : rotateBody(params);
|
|
2355
2417
|
const data = await this.http.patch(
|
|
2356
2418
|
`/egress/secrets/${id}`,
|
|
2357
|
-
|
|
2419
|
+
body2
|
|
2358
2420
|
);
|
|
2359
|
-
return
|
|
2421
|
+
return unwrap21(data);
|
|
2360
2422
|
}
|
|
2361
2423
|
/** Delete a secret. */
|
|
2362
2424
|
async delete(id) {
|
|
@@ -2369,7 +2431,7 @@ var EgressSecrets = class {
|
|
|
2369
2431
|
"/egress/bindings",
|
|
2370
2432
|
bindingBody(params)
|
|
2371
2433
|
);
|
|
2372
|
-
return
|
|
2434
|
+
return unwrap21(data);
|
|
2373
2435
|
}
|
|
2374
2436
|
/** List secret bindings. */
|
|
2375
2437
|
async listBindings(params = {}) {
|
|
@@ -2402,7 +2464,7 @@ var EgressSecrets = class {
|
|
|
2402
2464
|
"/egress/oauth/start",
|
|
2403
2465
|
oauthBody(params)
|
|
2404
2466
|
);
|
|
2405
|
-
const payload =
|
|
2467
|
+
const payload = unwrap21(data) ?? {};
|
|
2406
2468
|
return new OAuthFlow(this.http, payload, params.provider);
|
|
2407
2469
|
}
|
|
2408
2470
|
};
|
|
@@ -2966,12 +3028,12 @@ var ComputerInbox = class {
|
|
|
2966
3028
|
return unwrapData(raw);
|
|
2967
3029
|
}
|
|
2968
3030
|
async update(fields) {
|
|
2969
|
-
const
|
|
3031
|
+
const body2 = Object.fromEntries(
|
|
2970
3032
|
Object.entries(fields).filter(([, v]) => v !== void 0)
|
|
2971
3033
|
);
|
|
2972
3034
|
const raw = await this.http.patch(
|
|
2973
3035
|
`/computers/${this.computerId}/inbox`,
|
|
2974
|
-
|
|
3036
|
+
body2
|
|
2975
3037
|
);
|
|
2976
3038
|
return unwrapData(raw);
|
|
2977
3039
|
}
|
|
@@ -3270,12 +3332,12 @@ var Computer = class _Computer {
|
|
|
3270
3332
|
}
|
|
3271
3333
|
/** Clone this computer into a new one. */
|
|
3272
3334
|
async clone(opts = {}) {
|
|
3273
|
-
const
|
|
3335
|
+
const body2 = Object.fromEntries(
|
|
3274
3336
|
Object.entries(opts).filter(([, v]) => v !== void 0)
|
|
3275
3337
|
);
|
|
3276
3338
|
const raw = await this.http.post(
|
|
3277
3339
|
`/computers/${this.id}/clone`,
|
|
3278
|
-
|
|
3340
|
+
body2
|
|
3279
3341
|
);
|
|
3280
3342
|
const data = unwrapData(raw);
|
|
3281
3343
|
return new _Computer(this.http, data);
|
|
@@ -3291,12 +3353,12 @@ var Computer = class _Computer {
|
|
|
3291
3353
|
}
|
|
3292
3354
|
/** Move the computer to a different region or host. */
|
|
3293
3355
|
async move(opts) {
|
|
3294
|
-
const
|
|
3356
|
+
const body2 = Object.fromEntries(
|
|
3295
3357
|
Object.entries(opts).filter(([, v]) => v !== void 0)
|
|
3296
3358
|
);
|
|
3297
3359
|
const updated = await this.http.post(
|
|
3298
3360
|
`/computers/${this.id}/move`,
|
|
3299
|
-
|
|
3361
|
+
body2
|
|
3300
3362
|
);
|
|
3301
3363
|
this.data = updated;
|
|
3302
3364
|
return this;
|
|
@@ -3374,10 +3436,18 @@ var Computers = class {
|
|
|
3374
3436
|
* `computer.start()` once it reaches `stopped` to boot it.
|
|
3375
3437
|
*/
|
|
3376
3438
|
async create(params) {
|
|
3439
|
+
const {
|
|
3440
|
+
agentRuntimeProfileId,
|
|
3441
|
+
agentProfileId,
|
|
3442
|
+
skipAgentRuntimeProfile,
|
|
3443
|
+
...body2
|
|
3444
|
+
} = params;
|
|
3377
3445
|
const data = await this.http.post("/computers", {
|
|
3378
3446
|
template_type: "miosa-desktop",
|
|
3379
3447
|
size: "small",
|
|
3380
|
-
...
|
|
3448
|
+
...body2,
|
|
3449
|
+
agent_runtime_profile_id: agentRuntimeProfileId ?? params.agent_runtime_profile_id ?? agentProfileId ?? params.agent_profile_id,
|
|
3450
|
+
skip_agent_runtime_profile: skipAgentRuntimeProfile ?? params.skip_agent_runtime_profile
|
|
3381
3451
|
});
|
|
3382
3452
|
return new Computer(this.http, data);
|
|
3383
3453
|
}
|
|
@@ -3447,7 +3517,7 @@ var Credits = class {
|
|
|
3447
3517
|
return this.http.get("/credits/usage");
|
|
3448
3518
|
}
|
|
3449
3519
|
};
|
|
3450
|
-
function
|
|
3520
|
+
function unwrap22(payload) {
|
|
3451
3521
|
if (payload && typeof payload === "object" && "data" in payload) {
|
|
3452
3522
|
return payload.data;
|
|
3453
3523
|
}
|
|
@@ -3483,22 +3553,22 @@ var CronJobs = class {
|
|
|
3483
3553
|
}
|
|
3484
3554
|
async get(jobId) {
|
|
3485
3555
|
const data = await this.http.get(`/cron-jobs/${jobId}`);
|
|
3486
|
-
return
|
|
3556
|
+
return unwrap22(data);
|
|
3487
3557
|
}
|
|
3488
3558
|
async create(params) {
|
|
3489
3559
|
const { idempotencyKey: ikey, ...rest } = params;
|
|
3490
|
-
const
|
|
3560
|
+
const body2 = stripUndefined9(rest);
|
|
3491
3561
|
const data = await this.http.request("/cron-jobs", {
|
|
3492
3562
|
method: "POST",
|
|
3493
|
-
body,
|
|
3563
|
+
body: body2,
|
|
3494
3564
|
headers: { "Idempotency-Key": idempotencyKey2(ikey) }
|
|
3495
3565
|
});
|
|
3496
|
-
return
|
|
3566
|
+
return unwrap22(data);
|
|
3497
3567
|
}
|
|
3498
3568
|
async update(jobId, params) {
|
|
3499
|
-
const
|
|
3500
|
-
const data = await this.http.patch(`/cron-jobs/${jobId}`,
|
|
3501
|
-
return
|
|
3569
|
+
const body2 = stripUndefined9(params);
|
|
3570
|
+
const data = await this.http.patch(`/cron-jobs/${jobId}`, body2);
|
|
3571
|
+
return unwrap22(data);
|
|
3502
3572
|
}
|
|
3503
3573
|
async delete(jobId) {
|
|
3504
3574
|
await this.http.delete(`/cron-jobs/${jobId}`);
|
|
@@ -3506,11 +3576,11 @@ var CronJobs = class {
|
|
|
3506
3576
|
// ── Control ────────────────────────────────────────────────────────────────
|
|
3507
3577
|
async pause(jobId) {
|
|
3508
3578
|
const data = await this.http.post(`/cron-jobs/${jobId}/pause`);
|
|
3509
|
-
return
|
|
3579
|
+
return unwrap22(data);
|
|
3510
3580
|
}
|
|
3511
3581
|
async resume(jobId) {
|
|
3512
3582
|
const data = await this.http.post(`/cron-jobs/${jobId}/resume`);
|
|
3513
|
-
return
|
|
3583
|
+
return unwrap22(data);
|
|
3514
3584
|
}
|
|
3515
3585
|
async runNow(jobId, opts = {}) {
|
|
3516
3586
|
const data = await this.http.request(
|
|
@@ -3520,7 +3590,7 @@ var CronJobs = class {
|
|
|
3520
3590
|
headers: { "Idempotency-Key": idempotencyKey2(opts.idempotencyKey) }
|
|
3521
3591
|
}
|
|
3522
3592
|
);
|
|
3523
|
-
return
|
|
3593
|
+
return unwrap22(data);
|
|
3524
3594
|
}
|
|
3525
3595
|
// ── Execution history ──────────────────────────────────────────────────────
|
|
3526
3596
|
async listExecutions(jobId) {
|
|
@@ -3535,12 +3605,12 @@ var CronJobs = class {
|
|
|
3535
3605
|
const data = await this.http.get(
|
|
3536
3606
|
`/cron-jobs/${jobId}/executions/${executionId}`
|
|
3537
3607
|
);
|
|
3538
|
-
return
|
|
3608
|
+
return unwrap22(data);
|
|
3539
3609
|
}
|
|
3540
3610
|
};
|
|
3541
3611
|
|
|
3542
3612
|
// src/resources/dashboard.ts
|
|
3543
|
-
function
|
|
3613
|
+
function unwrap23(payload) {
|
|
3544
3614
|
if (payload && typeof payload === "object") {
|
|
3545
3615
|
const p = payload;
|
|
3546
3616
|
for (const k of ["data", "dashboard", "overview", "items"]) {
|
|
@@ -3557,15 +3627,15 @@ var Dashboard = class {
|
|
|
3557
3627
|
/** Aggregated user dashboard payload. */
|
|
3558
3628
|
async summary() {
|
|
3559
3629
|
const data = await this.http.get("/dashboard");
|
|
3560
|
-
return
|
|
3630
|
+
return unwrap23(data);
|
|
3561
3631
|
}
|
|
3562
3632
|
/** Status / health overview (public endpoint). */
|
|
3563
3633
|
async overview() {
|
|
3564
3634
|
const data = await this.http.get("/overview");
|
|
3565
|
-
return
|
|
3635
|
+
return unwrap23(data);
|
|
3566
3636
|
}
|
|
3567
3637
|
};
|
|
3568
|
-
function
|
|
3638
|
+
function unwrap24(payload) {
|
|
3569
3639
|
if (payload && typeof payload === "object" && "data" in payload) {
|
|
3570
3640
|
return payload.data;
|
|
3571
3641
|
}
|
|
@@ -3601,7 +3671,7 @@ var Databases = class {
|
|
|
3601
3671
|
}
|
|
3602
3672
|
async get(databaseId) {
|
|
3603
3673
|
const data = await this.http.get(`/databases/${databaseId}`);
|
|
3604
|
-
return
|
|
3674
|
+
return unwrap24(data);
|
|
3605
3675
|
}
|
|
3606
3676
|
async create(params) {
|
|
3607
3677
|
const {
|
|
@@ -3612,20 +3682,20 @@ var Databases = class {
|
|
|
3612
3682
|
size: _deprecatedSize,
|
|
3613
3683
|
...rest
|
|
3614
3684
|
} = params;
|
|
3615
|
-
const
|
|
3685
|
+
const body2 = stripUndefined10({
|
|
3616
3686
|
...rest,
|
|
3617
3687
|
engine_version: engine_version ?? version
|
|
3618
3688
|
});
|
|
3619
3689
|
const data = await this.http.request("/databases", {
|
|
3620
3690
|
method: "POST",
|
|
3621
|
-
body,
|
|
3691
|
+
body: body2,
|
|
3622
3692
|
headers: {
|
|
3623
3693
|
"Idempotency-Key": idempotencyKey3(
|
|
3624
3694
|
camelIdempotencyKey ?? snakeIdempotencyKey
|
|
3625
3695
|
)
|
|
3626
3696
|
}
|
|
3627
3697
|
});
|
|
3628
|
-
return
|
|
3698
|
+
return unwrap24(data);
|
|
3629
3699
|
}
|
|
3630
3700
|
async delete(databaseId) {
|
|
3631
3701
|
await this.http.delete(`/databases/${databaseId}`);
|
|
@@ -3635,24 +3705,24 @@ var Databases = class {
|
|
|
3635
3705
|
const data = await this.http.post(
|
|
3636
3706
|
`/databases/${databaseId}/start`
|
|
3637
3707
|
);
|
|
3638
|
-
return
|
|
3708
|
+
return unwrap24(data);
|
|
3639
3709
|
}
|
|
3640
3710
|
async stop(databaseId) {
|
|
3641
3711
|
const data = await this.http.post(`/databases/${databaseId}/stop`);
|
|
3642
|
-
return
|
|
3712
|
+
return unwrap24(data);
|
|
3643
3713
|
}
|
|
3644
3714
|
async restart(databaseId) {
|
|
3645
3715
|
const data = await this.http.post(
|
|
3646
3716
|
`/databases/${databaseId}/restart`
|
|
3647
3717
|
);
|
|
3648
|
-
return
|
|
3718
|
+
return unwrap24(data);
|
|
3649
3719
|
}
|
|
3650
3720
|
// ── Credentials + logs ────────────────────────────────────────────────────
|
|
3651
3721
|
async credentials(databaseId) {
|
|
3652
3722
|
const data = await this.http.get(
|
|
3653
3723
|
`/databases/${databaseId}/credentials`
|
|
3654
3724
|
);
|
|
3655
|
-
return
|
|
3725
|
+
return unwrap24(data);
|
|
3656
3726
|
}
|
|
3657
3727
|
async logs(databaseId, params = {}) {
|
|
3658
3728
|
const query = stripUndefined10({
|
|
@@ -3682,7 +3752,7 @@ function attributionBody(p) {
|
|
|
3682
3752
|
function idempotencyKey4(key) {
|
|
3683
3753
|
return key ?? randomUUID();
|
|
3684
3754
|
}
|
|
3685
|
-
function
|
|
3755
|
+
function unwrap25(payload) {
|
|
3686
3756
|
if (payload && typeof payload === "object" && "data" in payload) {
|
|
3687
3757
|
return payload.data;
|
|
3688
3758
|
}
|
|
@@ -3709,6 +3779,42 @@ function dockerDeployMetadata(metadata) {
|
|
|
3709
3779
|
deployment_product: "docker_deploy"
|
|
3710
3780
|
};
|
|
3711
3781
|
}
|
|
3782
|
+
function dockerDeployProduct(deployment) {
|
|
3783
|
+
return deployment.deployment_product ?? deployment.metadata?.deployment_product;
|
|
3784
|
+
}
|
|
3785
|
+
function dockerDeployHostId(deployment) {
|
|
3786
|
+
const metadataHost = deployment.metadata?.docker_deploy_host_id;
|
|
3787
|
+
return deployment.docker_deploy_host_id ?? (typeof metadataHost === "string" ? metadataHost : null);
|
|
3788
|
+
}
|
|
3789
|
+
function dockerDeployApp(deployment) {
|
|
3790
|
+
const app = deployment.metadata?.docker_deploy;
|
|
3791
|
+
if (!app || typeof app !== "object" || Array.isArray(app)) return null;
|
|
3792
|
+
return app;
|
|
3793
|
+
}
|
|
3794
|
+
function dockerDeployAppPort(app) {
|
|
3795
|
+
const url = app?.url;
|
|
3796
|
+
if (typeof url !== "string") return null;
|
|
3797
|
+
try {
|
|
3798
|
+
const parsed = new URL(url);
|
|
3799
|
+
const port = Number.parseInt(parsed.port, 10);
|
|
3800
|
+
return Number.isInteger(port) ? port : null;
|
|
3801
|
+
} catch {
|
|
3802
|
+
return null;
|
|
3803
|
+
}
|
|
3804
|
+
}
|
|
3805
|
+
function addDoctorCheck(checks, name, ok, message, details) {
|
|
3806
|
+
checks.push({ name, ok, message, ...details ? { details } : {} });
|
|
3807
|
+
}
|
|
3808
|
+
function hostHealthy(host) {
|
|
3809
|
+
return Boolean(
|
|
3810
|
+
host && host.status === "active" && host.appliance_status === "healthy"
|
|
3811
|
+
);
|
|
3812
|
+
}
|
|
3813
|
+
function probeUrl(publicUrl, probePath) {
|
|
3814
|
+
const url = new URL(publicUrl);
|
|
3815
|
+
url.pathname = probePath.startsWith("/") ? probePath : `/${probePath}`;
|
|
3816
|
+
return url.toString();
|
|
3817
|
+
}
|
|
3712
3818
|
var DeploymentVersions = class {
|
|
3713
3819
|
constructor(http, deploymentId) {
|
|
3714
3820
|
this.http = http;
|
|
@@ -3733,19 +3839,19 @@ var DeploymentVersions = class {
|
|
|
3733
3839
|
const data = await this.http.get(
|
|
3734
3840
|
`/deployments/${this.deploymentId}/versions/${versionId}`
|
|
3735
3841
|
);
|
|
3736
|
-
return
|
|
3842
|
+
return unwrap25(data);
|
|
3737
3843
|
}
|
|
3738
3844
|
async promote(versionId, opts = {}) {
|
|
3739
|
-
const
|
|
3845
|
+
const body2 = stripUndefined11({ environment: opts.environment });
|
|
3740
3846
|
const data = await this.http.request(
|
|
3741
3847
|
`/deployments/${this.deploymentId}/versions/${versionId}/promote`,
|
|
3742
3848
|
{
|
|
3743
3849
|
method: "POST",
|
|
3744
|
-
body,
|
|
3850
|
+
body: body2,
|
|
3745
3851
|
headers: { "Idempotency-Key": idempotencyKey4(opts.idempotencyKey) }
|
|
3746
3852
|
}
|
|
3747
3853
|
);
|
|
3748
|
-
return
|
|
3854
|
+
return unwrap25(data);
|
|
3749
3855
|
}
|
|
3750
3856
|
};
|
|
3751
3857
|
var DeploymentReleases = class {
|
|
@@ -3765,7 +3871,7 @@ var DeploymentReleases = class {
|
|
|
3765
3871
|
const data = await this.http.get(
|
|
3766
3872
|
`/deployments/${this.deploymentId}/releases/${releaseId}`
|
|
3767
3873
|
);
|
|
3768
|
-
return
|
|
3874
|
+
return unwrap25(data);
|
|
3769
3875
|
}
|
|
3770
3876
|
};
|
|
3771
3877
|
var DeploymentRuntimeInstances = class {
|
|
@@ -3785,14 +3891,14 @@ var DeploymentRuntimeInstances = class {
|
|
|
3785
3891
|
const data = await this.http.get(
|
|
3786
3892
|
`/deployments/${this.deploymentId}/runtime-instances/${instanceId}`
|
|
3787
3893
|
);
|
|
3788
|
-
return
|
|
3894
|
+
return unwrap25(data);
|
|
3789
3895
|
}
|
|
3790
3896
|
async logs(instanceId, lines = 100) {
|
|
3791
3897
|
const data = await this.http.get(
|
|
3792
3898
|
`/deployments/${this.deploymentId}/runtime-instances/${instanceId}/logs`,
|
|
3793
3899
|
{ lines }
|
|
3794
3900
|
);
|
|
3795
|
-
const unwrapped =
|
|
3901
|
+
const unwrapped = unwrap25(data);
|
|
3796
3902
|
const result = { logs: String(unwrapped.logs ?? "") };
|
|
3797
3903
|
if (typeof unwrapped.runtime_instance_id === "string") {
|
|
3798
3904
|
result.runtime_instance_id = unwrapped.runtime_instance_id;
|
|
@@ -3814,7 +3920,7 @@ var DeploymentDomains = class {
|
|
|
3814
3920
|
http;
|
|
3815
3921
|
deploymentId;
|
|
3816
3922
|
async add(domain, params = {}) {
|
|
3817
|
-
const
|
|
3923
|
+
const body2 = {
|
|
3818
3924
|
domain,
|
|
3819
3925
|
redirect_policy: params.redirectPolicy ?? params.redirect_policy,
|
|
3820
3926
|
...attributionBody(params)
|
|
@@ -3823,11 +3929,11 @@ var DeploymentDomains = class {
|
|
|
3823
3929
|
`/deployments/${this.deploymentId}/domains`,
|
|
3824
3930
|
{
|
|
3825
3931
|
method: "POST",
|
|
3826
|
-
body: stripUndefined11(
|
|
3932
|
+
body: stripUndefined11(body2),
|
|
3827
3933
|
headers: { "Idempotency-Key": idempotencyKey4(params.idempotencyKey) }
|
|
3828
3934
|
}
|
|
3829
3935
|
);
|
|
3830
|
-
return
|
|
3936
|
+
return unwrap25(data);
|
|
3831
3937
|
}
|
|
3832
3938
|
async list(filters = {}) {
|
|
3833
3939
|
const data = await this.http.get(
|
|
@@ -3840,7 +3946,7 @@ var DeploymentDomains = class {
|
|
|
3840
3946
|
const data = await this.http.post(
|
|
3841
3947
|
`/deployments/${this.deploymentId}/domains/${domainId}/verify`
|
|
3842
3948
|
);
|
|
3843
|
-
return
|
|
3949
|
+
return unwrap25(data);
|
|
3844
3950
|
}
|
|
3845
3951
|
async delete(domainId) {
|
|
3846
3952
|
await this.http.delete(
|
|
@@ -3870,10 +3976,10 @@ var Deployments = class {
|
|
|
3870
3976
|
}
|
|
3871
3977
|
async get(deploymentId) {
|
|
3872
3978
|
const data = await this.http.get(`/deployments/${deploymentId}`);
|
|
3873
|
-
return
|
|
3979
|
+
return unwrap25(data);
|
|
3874
3980
|
}
|
|
3875
3981
|
async create(params) {
|
|
3876
|
-
const
|
|
3982
|
+
const body2 = stripUndefined11({
|
|
3877
3983
|
name: params.name,
|
|
3878
3984
|
repo_url: params.repoUrl ?? params.repo_url,
|
|
3879
3985
|
branch: params.branch,
|
|
@@ -3886,10 +3992,10 @@ var Deployments = class {
|
|
|
3886
3992
|
});
|
|
3887
3993
|
const data = await this.http.request("/deployments", {
|
|
3888
3994
|
method: "POST",
|
|
3889
|
-
body,
|
|
3995
|
+
body: body2,
|
|
3890
3996
|
headers: { "Idempotency-Key": idempotencyKey4(params.idempotencyKey) }
|
|
3891
3997
|
});
|
|
3892
|
-
return
|
|
3998
|
+
return unwrap25(data);
|
|
3893
3999
|
}
|
|
3894
4000
|
/**
|
|
3895
4001
|
* Create a deployment that runs on the workspace's dedicated Docker Deploy
|
|
@@ -3902,8 +4008,141 @@ var Deployments = class {
|
|
|
3902
4008
|
metadata: dockerDeployMetadata(params.metadata)
|
|
3903
4009
|
});
|
|
3904
4010
|
}
|
|
4011
|
+
/**
|
|
4012
|
+
* Verify a Docker Deploy deployment before telling a user or agent it is
|
|
4013
|
+
* live. Checks product markers, appliance host health, route metadata, and
|
|
4014
|
+
* optionally probes the public URL.
|
|
4015
|
+
*/
|
|
4016
|
+
async doctorDockerDeploy(deploymentId, params = {}) {
|
|
4017
|
+
const checks = [];
|
|
4018
|
+
const deployment = await this.get(deploymentId);
|
|
4019
|
+
const metadata = deployment.metadata ?? {};
|
|
4020
|
+
const product = dockerDeployProduct(deployment);
|
|
4021
|
+
const hostId = dockerDeployHostId(deployment);
|
|
4022
|
+
addDoctorCheck(
|
|
4023
|
+
checks,
|
|
4024
|
+
"deployment_product",
|
|
4025
|
+
product === "docker_deploy",
|
|
4026
|
+
product === "docker_deploy" ? "Deployment is marked for Docker Deploy." : `Expected deployment_product=docker_deploy, got ${String(product ?? "missing")}.`,
|
|
4027
|
+
{ deployment_product: product ?? null }
|
|
4028
|
+
);
|
|
4029
|
+
addDoctorCheck(
|
|
4030
|
+
checks,
|
|
4031
|
+
"docker_deploy_host_id",
|
|
4032
|
+
Boolean(hostId),
|
|
4033
|
+
hostId ? "Deployment has a Docker Deploy host id." : "Deployment has no docker_deploy_host_id.",
|
|
4034
|
+
{ docker_deploy_host_id: hostId }
|
|
4035
|
+
);
|
|
4036
|
+
let host;
|
|
4037
|
+
if (hostId) {
|
|
4038
|
+
try {
|
|
4039
|
+
const rawHost = await this.http.get(
|
|
4040
|
+
`/docker-deploy/hosts/${hostId}`
|
|
4041
|
+
);
|
|
4042
|
+
host = unwrap25(
|
|
4043
|
+
rawHost
|
|
4044
|
+
);
|
|
4045
|
+
addDoctorCheck(
|
|
4046
|
+
checks,
|
|
4047
|
+
"docker_deploy_host_health",
|
|
4048
|
+
hostHealthy(host),
|
|
4049
|
+
hostHealthy(host) ? "Docker Deploy host is active and healthy." : `Docker Deploy host status=${host.status} appliance=${host.appliance_status}.`,
|
|
4050
|
+
{
|
|
4051
|
+
status: host.status,
|
|
4052
|
+
appliance_status: host.appliance_status
|
|
4053
|
+
}
|
|
4054
|
+
);
|
|
4055
|
+
} catch (error) {
|
|
4056
|
+
addDoctorCheck(
|
|
4057
|
+
checks,
|
|
4058
|
+
"docker_deploy_host_health",
|
|
4059
|
+
false,
|
|
4060
|
+
error instanceof Error ? error.message : String(error)
|
|
4061
|
+
);
|
|
4062
|
+
}
|
|
4063
|
+
}
|
|
4064
|
+
const app = dockerDeployApp(deployment);
|
|
4065
|
+
const appPort = dockerDeployAppPort(app);
|
|
4066
|
+
const appRunning = app?.status === "running" && appPort !== null;
|
|
4067
|
+
addDoctorCheck(
|
|
4068
|
+
checks,
|
|
4069
|
+
"docker_deploy_app",
|
|
4070
|
+
appRunning,
|
|
4071
|
+
appRunning ? "Docker Deploy app metadata points at a running container." : "Deployment is missing running Docker Deploy app metadata.",
|
|
4072
|
+
app ? {
|
|
4073
|
+
app_id: app.app_id,
|
|
4074
|
+
container_id: app.container_id,
|
|
4075
|
+
status: app.status,
|
|
4076
|
+
url: app.url,
|
|
4077
|
+
expected_port: appPort
|
|
4078
|
+
} : void 0
|
|
4079
|
+
);
|
|
4080
|
+
const runtime = metadata.runtime;
|
|
4081
|
+
const runtimeCandidate = typeof runtime === "object" && runtime !== null ? runtime : void 0;
|
|
4082
|
+
const hasRuntimeRoute = typeof runtimeCandidate?.ip === "string" && typeof runtimeCandidate.port === "number";
|
|
4083
|
+
const runtimeRecord = hasRuntimeRoute ? runtimeCandidate : void 0;
|
|
4084
|
+
const routeMatchesContainerPort = hasRuntimeRoute && (appPort === null || runtimeRecord?.port === appPort);
|
|
4085
|
+
addDoctorCheck(
|
|
4086
|
+
checks,
|
|
4087
|
+
"runtime_route",
|
|
4088
|
+
hasRuntimeRoute && routeMatchesContainerPort,
|
|
4089
|
+
hasRuntimeRoute && routeMatchesContainerPort ? "Deployment route points at the Docker container host port." : hasRuntimeRoute && appPort !== null ? `Deployment route port ${String(runtimeRecord?.port)} does not match Docker container host port ${appPort}.` : "Deployment is missing appliance runtime route metadata.",
|
|
4090
|
+
runtimeRecord ? {
|
|
4091
|
+
...runtimeRecord,
|
|
4092
|
+
expected_port: appPort,
|
|
4093
|
+
docker_deploy_url: app?.url
|
|
4094
|
+
} : void 0
|
|
4095
|
+
);
|
|
4096
|
+
let probe;
|
|
4097
|
+
const publicUrl = deployment.public_url;
|
|
4098
|
+
const path = params.probePath ?? params.probe_path ?? "/";
|
|
4099
|
+
if (publicUrl && typeof fetch === "function") {
|
|
4100
|
+
const url = probeUrl(publicUrl, path);
|
|
4101
|
+
const controller = new AbortController();
|
|
4102
|
+
const timeout = setTimeout(
|
|
4103
|
+
() => controller.abort(),
|
|
4104
|
+
params.timeoutMs ?? params.timeout_ms ?? 1e4
|
|
4105
|
+
);
|
|
4106
|
+
try {
|
|
4107
|
+
const response = await fetch(url, {
|
|
4108
|
+
method: "GET",
|
|
4109
|
+
signal: controller.signal
|
|
4110
|
+
});
|
|
4111
|
+
probe = { url, ok: response.ok, status: response.status };
|
|
4112
|
+
addDoctorCheck(
|
|
4113
|
+
checks,
|
|
4114
|
+
"public_url_probe",
|
|
4115
|
+
response.ok,
|
|
4116
|
+
`Public URL returned HTTP ${response.status}.`,
|
|
4117
|
+
{ url, status: response.status }
|
|
4118
|
+
);
|
|
4119
|
+
} catch (error) {
|
|
4120
|
+
probe = {
|
|
4121
|
+
url,
|
|
4122
|
+
ok: false,
|
|
4123
|
+
error: error instanceof Error ? error.message : String(error)
|
|
4124
|
+
};
|
|
4125
|
+
addDoctorCheck(
|
|
4126
|
+
checks,
|
|
4127
|
+
"public_url_probe",
|
|
4128
|
+
false,
|
|
4129
|
+
probe.error ?? "Public URL probe failed.",
|
|
4130
|
+
{ url }
|
|
4131
|
+
);
|
|
4132
|
+
} finally {
|
|
4133
|
+
clearTimeout(timeout);
|
|
4134
|
+
}
|
|
4135
|
+
}
|
|
4136
|
+
return {
|
|
4137
|
+
ok: checks.every((check) => check.ok),
|
|
4138
|
+
deployment,
|
|
4139
|
+
...host ? { host } : {},
|
|
4140
|
+
checks,
|
|
4141
|
+
...probe ? { probe } : {}
|
|
4142
|
+
};
|
|
4143
|
+
}
|
|
3905
4144
|
async update(deploymentId, params) {
|
|
3906
|
-
const
|
|
4145
|
+
const body2 = stripUndefined11({
|
|
3907
4146
|
name: params.name,
|
|
3908
4147
|
branch: params.branch,
|
|
3909
4148
|
build_command: params.buildCommand ?? params.build_command,
|
|
@@ -3912,15 +4151,15 @@ var Deployments = class {
|
|
|
3912
4151
|
});
|
|
3913
4152
|
const data = await this.http.patch(
|
|
3914
4153
|
`/deployments/${deploymentId}`,
|
|
3915
|
-
|
|
4154
|
+
body2
|
|
3916
4155
|
);
|
|
3917
|
-
return
|
|
4156
|
+
return unwrap25(data);
|
|
3918
4157
|
}
|
|
3919
4158
|
async delete(deploymentId) {
|
|
3920
4159
|
await this.http.delete(`/deployments/${deploymentId}`);
|
|
3921
4160
|
}
|
|
3922
4161
|
async publish(deploymentId, params) {
|
|
3923
|
-
const
|
|
4162
|
+
const body2 = stripUndefined11({
|
|
3924
4163
|
source_sandbox_id: params.sourceSandboxId ?? params.source_sandbox_id,
|
|
3925
4164
|
output_path: params.outputPath ?? params.output_path,
|
|
3926
4165
|
entrypoint: params.entrypoint,
|
|
@@ -3930,11 +4169,11 @@ var Deployments = class {
|
|
|
3930
4169
|
`/deployments/${deploymentId}/publish`,
|
|
3931
4170
|
{
|
|
3932
4171
|
method: "POST",
|
|
3933
|
-
body,
|
|
4172
|
+
body: body2,
|
|
3934
4173
|
headers: { "Idempotency-Key": idempotencyKey4(params.idempotencyKey) }
|
|
3935
4174
|
}
|
|
3936
4175
|
);
|
|
3937
|
-
return
|
|
4176
|
+
return unwrap25(data);
|
|
3938
4177
|
}
|
|
3939
4178
|
/**
|
|
3940
4179
|
* Backward-compatible bridge: POST /sandboxes/:id/deploy. Works today;
|
|
@@ -3942,7 +4181,7 @@ var Deployments = class {
|
|
|
3942
4181
|
* phase. Prefer `publish()` once Phase 2B/3 lands.
|
|
3943
4182
|
*/
|
|
3944
4183
|
async publishFromSandbox(sandboxId, params = {}) {
|
|
3945
|
-
const
|
|
4184
|
+
const body2 = stripUndefined11({
|
|
3946
4185
|
name: params.name,
|
|
3947
4186
|
deployment_id: params.deploymentId ?? params.deployment_id,
|
|
3948
4187
|
output_path: params.outputPath ?? params.output_path,
|
|
@@ -3955,25 +4194,25 @@ var Deployments = class {
|
|
|
3955
4194
|
`/sandboxes/${sandboxId}/deploy`,
|
|
3956
4195
|
{
|
|
3957
4196
|
method: "POST",
|
|
3958
|
-
body,
|
|
4197
|
+
body: body2,
|
|
3959
4198
|
headers: { "Idempotency-Key": idempotencyKey4(params.idempotencyKey) }
|
|
3960
4199
|
}
|
|
3961
4200
|
);
|
|
3962
|
-
return
|
|
4201
|
+
return unwrap25(data);
|
|
3963
4202
|
}
|
|
3964
4203
|
async rollback(deploymentId, params = {}) {
|
|
3965
|
-
const
|
|
4204
|
+
const body2 = stripUndefined11({
|
|
3966
4205
|
version_id: params.versionId ?? params.version_id
|
|
3967
4206
|
});
|
|
3968
4207
|
const data = await this.http.request(
|
|
3969
4208
|
`/deployments/${deploymentId}/rollback`,
|
|
3970
4209
|
{
|
|
3971
4210
|
method: "POST",
|
|
3972
|
-
body,
|
|
4211
|
+
body: body2,
|
|
3973
4212
|
headers: { "Idempotency-Key": idempotencyKey4(params.idempotencyKey) }
|
|
3974
4213
|
}
|
|
3975
4214
|
);
|
|
3976
|
-
return
|
|
4215
|
+
return unwrap25(data);
|
|
3977
4216
|
}
|
|
3978
4217
|
async listBuilds(deploymentId) {
|
|
3979
4218
|
const data = await this.http.get(
|
|
@@ -3985,7 +4224,7 @@ var Deployments = class {
|
|
|
3985
4224
|
const data = await this.http.get(
|
|
3986
4225
|
`/deployments/${deploymentId}/builds/${buildId}`
|
|
3987
4226
|
);
|
|
3988
|
-
return
|
|
4227
|
+
return unwrap25(data);
|
|
3989
4228
|
}
|
|
3990
4229
|
async listEnv(deploymentId) {
|
|
3991
4230
|
const data = await this.http.get(
|
|
@@ -3994,10 +4233,10 @@ var Deployments = class {
|
|
|
3994
4233
|
return listItems4(data);
|
|
3995
4234
|
}
|
|
3996
4235
|
async setEnv(deploymentId, vars, opts = {}) {
|
|
3997
|
-
const
|
|
4236
|
+
const body2 = stripUndefined11({ env: vars, environment: opts.environment });
|
|
3998
4237
|
const data = await this.http.post(
|
|
3999
4238
|
`/deployments/${deploymentId}/env`,
|
|
4000
|
-
|
|
4239
|
+
body2
|
|
4001
4240
|
);
|
|
4002
4241
|
return listItems4(data);
|
|
4003
4242
|
}
|
|
@@ -4023,12 +4262,12 @@ function workspaceId(params) {
|
|
|
4023
4262
|
return params?.workspace_id ?? params?.workspaceId;
|
|
4024
4263
|
}
|
|
4025
4264
|
function ensureBody(params) {
|
|
4026
|
-
const
|
|
4265
|
+
const body2 = {};
|
|
4027
4266
|
const id = params.workspace_id ?? params.workspaceId;
|
|
4028
4267
|
const externalId = params.external_workspace_id ?? params.externalWorkspaceId;
|
|
4029
|
-
if (id)
|
|
4030
|
-
if (externalId)
|
|
4031
|
-
return
|
|
4268
|
+
if (id) body2.workspace_id = id;
|
|
4269
|
+
if (externalId) body2.external_workspace_id = externalId;
|
|
4270
|
+
return body2;
|
|
4032
4271
|
}
|
|
4033
4272
|
function unwrapHost(response) {
|
|
4034
4273
|
const host = response.data ?? response.host;
|
|
@@ -4103,7 +4342,7 @@ var DockerDeploy = class {
|
|
|
4103
4342
|
};
|
|
4104
4343
|
|
|
4105
4344
|
// src/resources/email.ts
|
|
4106
|
-
function
|
|
4345
|
+
function unwrap26(data) {
|
|
4107
4346
|
if (data && typeof data === "object") {
|
|
4108
4347
|
const d = data;
|
|
4109
4348
|
for (const k of [
|
|
@@ -4155,12 +4394,12 @@ var EmailCampaigns = class {
|
|
|
4155
4394
|
);
|
|
4156
4395
|
}
|
|
4157
4396
|
async create(attrs) {
|
|
4158
|
-
return
|
|
4397
|
+
return unwrap26(
|
|
4159
4398
|
await this.http.post("/admin/email-campaigns", strip(attrs))
|
|
4160
4399
|
);
|
|
4161
4400
|
}
|
|
4162
4401
|
async recipientCount(filters = {}) {
|
|
4163
|
-
return
|
|
4402
|
+
return unwrap26(
|
|
4164
4403
|
await this.http.get(
|
|
4165
4404
|
"/admin/email-campaigns/recipient-count",
|
|
4166
4405
|
filters
|
|
@@ -4168,7 +4407,7 @@ var EmailCampaigns = class {
|
|
|
4168
4407
|
);
|
|
4169
4408
|
}
|
|
4170
4409
|
async send(campaignId, opts = {}) {
|
|
4171
|
-
return
|
|
4410
|
+
return unwrap26(
|
|
4172
4411
|
await this.http.post(
|
|
4173
4412
|
`/admin/email-campaigns/${campaignId}/send`,
|
|
4174
4413
|
strip(opts)
|
|
@@ -4176,7 +4415,7 @@ var EmailCampaigns = class {
|
|
|
4176
4415
|
);
|
|
4177
4416
|
}
|
|
4178
4417
|
async cancel(campaignId) {
|
|
4179
|
-
return
|
|
4418
|
+
return unwrap26(
|
|
4180
4419
|
await this.http.post(
|
|
4181
4420
|
`/admin/email-campaigns/${campaignId}/cancel`
|
|
4182
4421
|
)
|
|
@@ -4202,7 +4441,7 @@ var EmailTemplates = class {
|
|
|
4202
4441
|
);
|
|
4203
4442
|
}
|
|
4204
4443
|
async create(key, attrs = {}) {
|
|
4205
|
-
return
|
|
4444
|
+
return unwrap26(
|
|
4206
4445
|
await this.http.post("/admin/email-templates", {
|
|
4207
4446
|
key,
|
|
4208
4447
|
...strip(attrs)
|
|
@@ -4210,7 +4449,7 @@ var EmailTemplates = class {
|
|
|
4210
4449
|
);
|
|
4211
4450
|
}
|
|
4212
4451
|
async update(key, attrs) {
|
|
4213
|
-
return
|
|
4452
|
+
return unwrap26(
|
|
4214
4453
|
await this.http.put(
|
|
4215
4454
|
`/admin/email-templates/${key}`,
|
|
4216
4455
|
strip(attrs)
|
|
@@ -4218,7 +4457,7 @@ var EmailTemplates = class {
|
|
|
4218
4457
|
);
|
|
4219
4458
|
}
|
|
4220
4459
|
async reset(key) {
|
|
4221
|
-
return
|
|
4460
|
+
return unwrap26(
|
|
4222
4461
|
await this.http.post(`/admin/email-templates/${key}/reset`)
|
|
4223
4462
|
);
|
|
4224
4463
|
}
|
|
@@ -4234,17 +4473,17 @@ var EmailInbox = class {
|
|
|
4234
4473
|
);
|
|
4235
4474
|
}
|
|
4236
4475
|
async send(attrs) {
|
|
4237
|
-
return
|
|
4476
|
+
return unwrap26(
|
|
4238
4477
|
await this.http.post("/admin/email-inbox/send", strip(attrs))
|
|
4239
4478
|
);
|
|
4240
4479
|
}
|
|
4241
4480
|
async markRead(messageId) {
|
|
4242
|
-
return
|
|
4481
|
+
return unwrap26(
|
|
4243
4482
|
await this.http.post(`/admin/email-inbox/${messageId}/read`)
|
|
4244
4483
|
);
|
|
4245
4484
|
}
|
|
4246
4485
|
async archive(messageId) {
|
|
4247
|
-
return
|
|
4486
|
+
return unwrap26(
|
|
4248
4487
|
await this.http.post(`/admin/email-inbox/${messageId}/archive`)
|
|
4249
4488
|
);
|
|
4250
4489
|
}
|
|
@@ -4273,18 +4512,18 @@ var Embeddings = class {
|
|
|
4273
4512
|
* `{ object: "list", data: [...], model, usage }`.
|
|
4274
4513
|
*/
|
|
4275
4514
|
async create(params) {
|
|
4276
|
-
const
|
|
4515
|
+
const body2 = Object.fromEntries(
|
|
4277
4516
|
Object.entries(params).filter(([, v]) => v !== void 0)
|
|
4278
4517
|
);
|
|
4279
4518
|
return this.http.post(
|
|
4280
4519
|
"/intelligence/embeddings",
|
|
4281
|
-
|
|
4520
|
+
body2
|
|
4282
4521
|
);
|
|
4283
4522
|
}
|
|
4284
4523
|
};
|
|
4285
4524
|
|
|
4286
4525
|
// src/resources/external-keys.ts
|
|
4287
|
-
function
|
|
4526
|
+
function unwrap27(payload) {
|
|
4288
4527
|
if (payload && typeof payload === "object") {
|
|
4289
4528
|
const p = payload;
|
|
4290
4529
|
for (const k of ["data", "external_keys", "items"]) {
|
|
@@ -4306,22 +4545,22 @@ var ExternalKeys = class {
|
|
|
4306
4545
|
/** List configured external keys. */
|
|
4307
4546
|
async list() {
|
|
4308
4547
|
const data = await this.http.get("/external-keys");
|
|
4309
|
-
const result =
|
|
4548
|
+
const result = unwrap27(data);
|
|
4310
4549
|
if (Array.isArray(result)) return result;
|
|
4311
4550
|
return [];
|
|
4312
4551
|
}
|
|
4313
4552
|
/** Create / register an external provider key. */
|
|
4314
4553
|
async create(params) {
|
|
4315
|
-
const
|
|
4316
|
-
const data = await this.http.post("/external-keys",
|
|
4317
|
-
return
|
|
4554
|
+
const body2 = stripUndefined12(params);
|
|
4555
|
+
const data = await this.http.post("/external-keys", body2);
|
|
4556
|
+
return unwrap27(data);
|
|
4318
4557
|
}
|
|
4319
4558
|
/** Resolve (preview) the stored key for a provider. */
|
|
4320
4559
|
async resolve(provider) {
|
|
4321
4560
|
const data = await this.http.get(
|
|
4322
4561
|
`/external-keys/${provider}/resolve`
|
|
4323
4562
|
);
|
|
4324
|
-
return
|
|
4563
|
+
return unwrap27(data);
|
|
4325
4564
|
}
|
|
4326
4565
|
/**
|
|
4327
4566
|
* Delete the stored key for a provider.
|
|
@@ -4331,7 +4570,7 @@ var ExternalKeys = class {
|
|
|
4331
4570
|
await this.http.delete(`/external-keys/${provider}`);
|
|
4332
4571
|
}
|
|
4333
4572
|
};
|
|
4334
|
-
function
|
|
4573
|
+
function unwrap28(payload) {
|
|
4335
4574
|
if (payload && typeof payload === "object" && "data" in payload) {
|
|
4336
4575
|
return payload.data;
|
|
4337
4576
|
}
|
|
@@ -4373,7 +4612,7 @@ var FlatCustomDomains = class {
|
|
|
4373
4612
|
redirectPolicy,
|
|
4374
4613
|
...rest
|
|
4375
4614
|
} = params;
|
|
4376
|
-
const
|
|
4615
|
+
const body2 = stripUndefined13({
|
|
4377
4616
|
...rest,
|
|
4378
4617
|
resource_type: resourceType ?? rest.resource_type,
|
|
4379
4618
|
resource_id: resourceId ?? rest.resource_id,
|
|
@@ -4381,16 +4620,16 @@ var FlatCustomDomains = class {
|
|
|
4381
4620
|
});
|
|
4382
4621
|
const data = await this.http.request("/custom-domains", {
|
|
4383
4622
|
method: "POST",
|
|
4384
|
-
body,
|
|
4623
|
+
body: body2,
|
|
4385
4624
|
headers: { "Idempotency-Key": idempotencyKey5(ikey) }
|
|
4386
4625
|
});
|
|
4387
|
-
return
|
|
4626
|
+
return unwrap28(data);
|
|
4388
4627
|
}
|
|
4389
4628
|
async delete(domainId) {
|
|
4390
4629
|
await this.http.delete(`/custom-domains/${domainId}`);
|
|
4391
4630
|
}
|
|
4392
4631
|
};
|
|
4393
|
-
function
|
|
4632
|
+
function unwrap29(payload) {
|
|
4394
4633
|
if (payload && typeof payload === "object" && "data" in payload) {
|
|
4395
4634
|
return payload.data;
|
|
4396
4635
|
}
|
|
@@ -4426,34 +4665,34 @@ var Functions = class {
|
|
|
4426
4665
|
}
|
|
4427
4666
|
async get(functionId) {
|
|
4428
4667
|
const data = await this.http.get(`/functions/${functionId}`);
|
|
4429
|
-
return
|
|
4668
|
+
return unwrap29(data);
|
|
4430
4669
|
}
|
|
4431
4670
|
async create(params) {
|
|
4432
4671
|
const { idempotencyKey: ikey, memoryMb, timeoutSec, ...rest } = params;
|
|
4433
|
-
const
|
|
4672
|
+
const body2 = stripUndefined14({
|
|
4434
4673
|
...rest,
|
|
4435
4674
|
memory_mb: memoryMb ?? rest.memory_mb,
|
|
4436
4675
|
timeout_sec: timeoutSec ?? rest.timeout_sec
|
|
4437
4676
|
});
|
|
4438
4677
|
const data = await this.http.request("/functions", {
|
|
4439
4678
|
method: "POST",
|
|
4440
|
-
body,
|
|
4679
|
+
body: body2,
|
|
4441
4680
|
headers: { "Idempotency-Key": idempotencyKey6(ikey) }
|
|
4442
4681
|
});
|
|
4443
|
-
return
|
|
4682
|
+
return unwrap29(data);
|
|
4444
4683
|
}
|
|
4445
4684
|
async update(functionId, params) {
|
|
4446
4685
|
const { memoryMb, timeoutSec, ...rest } = params;
|
|
4447
|
-
const
|
|
4686
|
+
const body2 = stripUndefined14({
|
|
4448
4687
|
...rest,
|
|
4449
4688
|
memory_mb: memoryMb ?? rest.memory_mb,
|
|
4450
4689
|
timeout_sec: timeoutSec ?? rest.timeout_sec
|
|
4451
4690
|
});
|
|
4452
4691
|
const data = await this.http.patch(
|
|
4453
4692
|
`/functions/${functionId}`,
|
|
4454
|
-
|
|
4693
|
+
body2
|
|
4455
4694
|
);
|
|
4456
|
-
return
|
|
4695
|
+
return unwrap29(data);
|
|
4457
4696
|
}
|
|
4458
4697
|
async delete(functionId) {
|
|
4459
4698
|
await this.http.delete(`/functions/${functionId}`);
|
|
@@ -4474,7 +4713,7 @@ var Functions = class {
|
|
|
4474
4713
|
return data ?? {};
|
|
4475
4714
|
}
|
|
4476
4715
|
};
|
|
4477
|
-
function
|
|
4716
|
+
function unwrap30(payload) {
|
|
4478
4717
|
if (payload && typeof payload === "object" && "data" in payload) {
|
|
4479
4718
|
return payload.data;
|
|
4480
4719
|
}
|
|
@@ -4510,7 +4749,7 @@ var HealthChecks = class {
|
|
|
4510
4749
|
}
|
|
4511
4750
|
async get(checkId) {
|
|
4512
4751
|
const data = await this.http.get(`/health-checks/${checkId}`);
|
|
4513
|
-
return
|
|
4752
|
+
return unwrap30(data);
|
|
4514
4753
|
}
|
|
4515
4754
|
async create(params) {
|
|
4516
4755
|
const {
|
|
@@ -4520,7 +4759,7 @@ var HealthChecks = class {
|
|
|
4520
4759
|
expectedStatus,
|
|
4521
4760
|
...rest
|
|
4522
4761
|
} = params;
|
|
4523
|
-
const
|
|
4762
|
+
const body2 = stripUndefined15({
|
|
4524
4763
|
...rest,
|
|
4525
4764
|
interval_sec: intervalSec ?? rest.interval_sec,
|
|
4526
4765
|
timeout_sec: timeoutSec ?? rest.timeout_sec,
|
|
@@ -4528,14 +4767,14 @@ var HealthChecks = class {
|
|
|
4528
4767
|
});
|
|
4529
4768
|
const data = await this.http.request("/health-checks", {
|
|
4530
4769
|
method: "POST",
|
|
4531
|
-
body,
|
|
4770
|
+
body: body2,
|
|
4532
4771
|
headers: { "Idempotency-Key": idempotencyKey7(ikey) }
|
|
4533
4772
|
});
|
|
4534
|
-
return
|
|
4773
|
+
return unwrap30(data);
|
|
4535
4774
|
}
|
|
4536
4775
|
async update(checkId, params) {
|
|
4537
4776
|
const { intervalSec, timeoutSec, expectedStatus, ...rest } = params;
|
|
4538
|
-
const
|
|
4777
|
+
const body2 = stripUndefined15({
|
|
4539
4778
|
...rest,
|
|
4540
4779
|
interval_sec: intervalSec ?? rest.interval_sec,
|
|
4541
4780
|
timeout_sec: timeoutSec ?? rest.timeout_sec,
|
|
@@ -4543,9 +4782,9 @@ var HealthChecks = class {
|
|
|
4543
4782
|
});
|
|
4544
4783
|
const data = await this.http.patch(
|
|
4545
4784
|
`/health-checks/${checkId}`,
|
|
4546
|
-
|
|
4785
|
+
body2
|
|
4547
4786
|
);
|
|
4548
|
-
return
|
|
4787
|
+
return unwrap30(data);
|
|
4549
4788
|
}
|
|
4550
4789
|
async delete(checkId) {
|
|
4551
4790
|
await this.http.delete(`/health-checks/${checkId}`);
|
|
@@ -4553,7 +4792,7 @@ var HealthChecks = class {
|
|
|
4553
4792
|
};
|
|
4554
4793
|
|
|
4555
4794
|
// src/resources/integrations.ts
|
|
4556
|
-
function
|
|
4795
|
+
function unwrap31(payload) {
|
|
4557
4796
|
if (payload && typeof payload === "object") {
|
|
4558
4797
|
const p = payload;
|
|
4559
4798
|
for (const k of ["data", "integrations", "catalog", "items"]) {
|
|
@@ -4563,7 +4802,7 @@ function unwrap29(payload) {
|
|
|
4563
4802
|
return payload;
|
|
4564
4803
|
}
|
|
4565
4804
|
function listItems8(payload) {
|
|
4566
|
-
const result =
|
|
4805
|
+
const result = unwrap31(payload);
|
|
4567
4806
|
if (Array.isArray(result)) return result;
|
|
4568
4807
|
return [];
|
|
4569
4808
|
}
|
|
@@ -4592,14 +4831,14 @@ var Integrations = class {
|
|
|
4592
4831
|
const data = await this.http.get(
|
|
4593
4832
|
`/integrations/${provider}/start`
|
|
4594
4833
|
);
|
|
4595
|
-
return
|
|
4834
|
+
return unwrap31(data);
|
|
4596
4835
|
}
|
|
4597
4836
|
/** Force-refresh the access token for a provider. */
|
|
4598
4837
|
async refresh(provider) {
|
|
4599
4838
|
const data = await this.http.post(
|
|
4600
4839
|
`/integrations/${provider}/refresh`
|
|
4601
4840
|
);
|
|
4602
|
-
return
|
|
4841
|
+
return unwrap31(data);
|
|
4603
4842
|
}
|
|
4604
4843
|
/** Disconnect (revoke) an integration. */
|
|
4605
4844
|
async disconnect(provider) {
|
|
@@ -4619,41 +4858,41 @@ var Integrations = class {
|
|
|
4619
4858
|
// ── Test hooks ─────────────────────────────────────────────────────────────
|
|
4620
4859
|
/** Send a test message to the connected Slack channel. */
|
|
4621
4860
|
async slackSendTest(params = {}) {
|
|
4622
|
-
const
|
|
4861
|
+
const body2 = stripUndefined16(params);
|
|
4623
4862
|
const data = await this.http.post(
|
|
4624
4863
|
"/integrations/slack/send-test",
|
|
4625
|
-
|
|
4864
|
+
body2
|
|
4626
4865
|
);
|
|
4627
|
-
return
|
|
4866
|
+
return unwrap31(data);
|
|
4628
4867
|
}
|
|
4629
4868
|
/** Send a test message to the connected Discord channel. */
|
|
4630
4869
|
async discordSendTest(params = {}) {
|
|
4631
|
-
const
|
|
4870
|
+
const body2 = stripUndefined16(params);
|
|
4632
4871
|
const data = await this.http.post(
|
|
4633
4872
|
"/integrations/discord/send-test",
|
|
4634
|
-
|
|
4873
|
+
body2
|
|
4635
4874
|
);
|
|
4636
|
-
return
|
|
4875
|
+
return unwrap31(data);
|
|
4637
4876
|
}
|
|
4638
4877
|
// ── Linear dedicated controller ────────────────────────────────────────────
|
|
4639
4878
|
/** Begin Linear OAuth — Linear has provider-specific error shapes. */
|
|
4640
4879
|
async linearStart() {
|
|
4641
4880
|
const data = await this.http.get("/integrations/linear/start");
|
|
4642
|
-
return
|
|
4881
|
+
return unwrap31(data);
|
|
4643
4882
|
}
|
|
4644
4883
|
/** Create a Linear issue via the connected workspace. */
|
|
4645
4884
|
async linearCreateIssue(params = {}) {
|
|
4646
|
-
const
|
|
4885
|
+
const body2 = stripUndefined16(params);
|
|
4647
4886
|
const data = await this.http.post(
|
|
4648
4887
|
"/integrations/linear/create-issue",
|
|
4649
|
-
|
|
4888
|
+
body2
|
|
4650
4889
|
);
|
|
4651
|
-
return
|
|
4890
|
+
return unwrap31(data);
|
|
4652
4891
|
}
|
|
4653
4892
|
};
|
|
4654
4893
|
|
|
4655
4894
|
// src/resources/mcp.ts
|
|
4656
|
-
function
|
|
4895
|
+
function unwrap32(payload) {
|
|
4657
4896
|
if (payload && typeof payload === "object") {
|
|
4658
4897
|
const p = payload;
|
|
4659
4898
|
for (const k of ["data", "mcp", "result", "items"]) {
|
|
@@ -4674,12 +4913,12 @@ var Mcp = class {
|
|
|
4674
4913
|
http;
|
|
4675
4914
|
/** Send a JSON-RPC request to the MCP endpoint. */
|
|
4676
4915
|
async dispatch(params = {}) {
|
|
4677
|
-
const
|
|
4916
|
+
const body2 = stripUndefined17(params);
|
|
4678
4917
|
const data = await this.http.post(
|
|
4679
4918
|
"/mcp",
|
|
4680
|
-
Object.keys(
|
|
4919
|
+
Object.keys(body2).length > 0 ? body2 : void 0
|
|
4681
4920
|
);
|
|
4682
|
-
return
|
|
4921
|
+
return unwrap32(data);
|
|
4683
4922
|
}
|
|
4684
4923
|
/**
|
|
4685
4924
|
* Open the MCP listen channel (GET).
|
|
@@ -4689,7 +4928,7 @@ var Mcp = class {
|
|
|
4689
4928
|
*/
|
|
4690
4929
|
async listen() {
|
|
4691
4930
|
const data = await this.http.get("/mcp");
|
|
4692
|
-
return
|
|
4931
|
+
return unwrap32(data);
|
|
4693
4932
|
}
|
|
4694
4933
|
/** Close (terminate) the MCP session. */
|
|
4695
4934
|
async close() {
|
|
@@ -4698,7 +4937,7 @@ var Mcp = class {
|
|
|
4698
4937
|
};
|
|
4699
4938
|
|
|
4700
4939
|
// src/resources/models.ts
|
|
4701
|
-
function
|
|
4940
|
+
function unwrap33(data) {
|
|
4702
4941
|
if (Array.isArray(data)) return data;
|
|
4703
4942
|
if (data && typeof data === "object") {
|
|
4704
4943
|
const d = data;
|
|
@@ -4719,7 +4958,7 @@ var Models = class {
|
|
|
4719
4958
|
Object.entries(filters).filter(([, v]) => v !== void 0)
|
|
4720
4959
|
);
|
|
4721
4960
|
const data = await this.http.get("/intelligence/models", query);
|
|
4722
|
-
return
|
|
4961
|
+
return unwrap33(data);
|
|
4723
4962
|
}
|
|
4724
4963
|
/**
|
|
4725
4964
|
* Get a single model by id.
|
|
@@ -4742,30 +4981,43 @@ var Agents = class {
|
|
|
4742
4981
|
base(hostId) {
|
|
4743
4982
|
return `/opencomputers/hosts/${hostId}/agent`;
|
|
4744
4983
|
}
|
|
4984
|
+
unwrapSession(payload) {
|
|
4985
|
+
const value = payload && typeof payload === "object" && "session" in payload ? payload.session : payload && typeof payload === "object" && "data" in payload ? payload.data : payload;
|
|
4986
|
+
const session = value;
|
|
4987
|
+
if (!session.id && session.session_id) {
|
|
4988
|
+
return { ...session, id: session.session_id };
|
|
4989
|
+
}
|
|
4990
|
+
return session;
|
|
4991
|
+
}
|
|
4992
|
+
unwrapList(payload) {
|
|
4993
|
+
if (payload && typeof payload === "object" && "sessions" in payload) {
|
|
4994
|
+
return { data: payload.sessions };
|
|
4995
|
+
}
|
|
4996
|
+
if (Array.isArray(payload)) {
|
|
4997
|
+
return { data: payload };
|
|
4998
|
+
}
|
|
4999
|
+
return payload;
|
|
5000
|
+
}
|
|
4745
5001
|
/**
|
|
4746
5002
|
* Dispatch a new agent session on the host.
|
|
4747
5003
|
*/
|
|
4748
5004
|
async dispatch(hostId, params) {
|
|
4749
|
-
|
|
4750
|
-
|
|
4751
|
-
params
|
|
4752
|
-
);
|
|
5005
|
+
const payload = await this.http.post(`${this.base(hostId)}/dispatch`, params);
|
|
5006
|
+
return this.unwrapSession(payload);
|
|
4753
5007
|
}
|
|
4754
5008
|
/**
|
|
4755
5009
|
* List all agent sessions for a host.
|
|
4756
5010
|
*/
|
|
4757
5011
|
async list(hostId) {
|
|
4758
|
-
|
|
4759
|
-
|
|
4760
|
-
);
|
|
5012
|
+
const payload = await this.http.get(`${this.base(hostId)}/sessions`);
|
|
5013
|
+
return this.unwrapList(payload);
|
|
4761
5014
|
}
|
|
4762
5015
|
/**
|
|
4763
5016
|
* Fetch the current state of a specific agent session.
|
|
4764
5017
|
*/
|
|
4765
5018
|
async get(hostId, sessionId) {
|
|
4766
|
-
|
|
4767
|
-
|
|
4768
|
-
);
|
|
5019
|
+
const payload = await this.http.get(`${this.base(hostId)}/sessions/${sessionId}`);
|
|
5020
|
+
return this.unwrapSession(payload);
|
|
4769
5021
|
}
|
|
4770
5022
|
/**
|
|
4771
5023
|
* Stream live events from an agent session.
|
|
@@ -5362,7 +5614,7 @@ function requestBody(params) {
|
|
|
5362
5614
|
config: authConfig(params)
|
|
5363
5615
|
});
|
|
5364
5616
|
}
|
|
5365
|
-
function
|
|
5617
|
+
function unwrap34(payload) {
|
|
5366
5618
|
if (payload && typeof payload === "object") {
|
|
5367
5619
|
const p = payload;
|
|
5368
5620
|
for (const k of ["data", "project_auth", "config", "items"]) {
|
|
@@ -5387,13 +5639,13 @@ var ProjectAuth = class {
|
|
|
5387
5639
|
"/project-auth/status",
|
|
5388
5640
|
resourcePayload(params)
|
|
5389
5641
|
);
|
|
5390
|
-
return
|
|
5642
|
+
return unwrap34(data);
|
|
5391
5643
|
}
|
|
5392
5644
|
/** Enable project auth. */
|
|
5393
5645
|
async enable(params) {
|
|
5394
|
-
const
|
|
5395
|
-
const data = await this.http.post("/project-auth/enable",
|
|
5396
|
-
return
|
|
5646
|
+
const body2 = requestBody(params);
|
|
5647
|
+
const data = await this.http.post("/project-auth/enable", body2);
|
|
5648
|
+
return unwrap34(data);
|
|
5397
5649
|
}
|
|
5398
5650
|
/** Disable project auth. */
|
|
5399
5651
|
async disable(params) {
|
|
@@ -5401,18 +5653,18 @@ var ProjectAuth = class {
|
|
|
5401
5653
|
"/project-auth/disable",
|
|
5402
5654
|
resourcePayload(params)
|
|
5403
5655
|
);
|
|
5404
|
-
return
|
|
5656
|
+
return unwrap34(data);
|
|
5405
5657
|
}
|
|
5406
5658
|
/** Update project-auth configuration. */
|
|
5407
5659
|
async update(params) {
|
|
5408
|
-
const
|
|
5409
|
-
const data = await this.http.patch("/project-auth/config",
|
|
5410
|
-
return
|
|
5660
|
+
const body2 = requestBody(params);
|
|
5661
|
+
const data = await this.http.patch("/project-auth/config", body2);
|
|
5662
|
+
return unwrap34(data);
|
|
5411
5663
|
}
|
|
5412
5664
|
};
|
|
5413
5665
|
|
|
5414
5666
|
// src/resources/project-integrations.ts
|
|
5415
|
-
function
|
|
5667
|
+
function unwrap35(payload) {
|
|
5416
5668
|
if (payload && typeof payload === "object") {
|
|
5417
5669
|
const p = payload;
|
|
5418
5670
|
for (const k of ["data", "project_integrations", "catalog", "items"]) {
|
|
@@ -5422,7 +5674,7 @@ function unwrap33(payload) {
|
|
|
5422
5674
|
return payload;
|
|
5423
5675
|
}
|
|
5424
5676
|
function listItems9(payload) {
|
|
5425
|
-
const result =
|
|
5677
|
+
const result = unwrap35(payload);
|
|
5426
5678
|
if (Array.isArray(result)) return result;
|
|
5427
5679
|
return [];
|
|
5428
5680
|
}
|
|
@@ -5457,22 +5709,22 @@ var ProjectIntegrations = class {
|
|
|
5457
5709
|
const data = await this.http.get(
|
|
5458
5710
|
`/project-integrations/${integrationId}`
|
|
5459
5711
|
);
|
|
5460
|
-
return
|
|
5712
|
+
return unwrap35(data);
|
|
5461
5713
|
}
|
|
5462
5714
|
/** Create a project integration. */
|
|
5463
5715
|
async create(params) {
|
|
5464
|
-
const
|
|
5465
|
-
const data = await this.http.post("/project-integrations",
|
|
5466
|
-
return
|
|
5716
|
+
const body2 = stripUndefObj2(params);
|
|
5717
|
+
const data = await this.http.post("/project-integrations", body2);
|
|
5718
|
+
return unwrap35(data);
|
|
5467
5719
|
}
|
|
5468
5720
|
/** Update a project integration. */
|
|
5469
5721
|
async update(integrationId, params) {
|
|
5470
|
-
const
|
|
5722
|
+
const body2 = stripUndefObj2(params);
|
|
5471
5723
|
const data = await this.http.patch(
|
|
5472
5724
|
`/project-integrations/${integrationId}`,
|
|
5473
|
-
|
|
5725
|
+
body2
|
|
5474
5726
|
);
|
|
5475
|
-
return
|
|
5727
|
+
return unwrap35(data);
|
|
5476
5728
|
}
|
|
5477
5729
|
/** Delete a project integration. */
|
|
5478
5730
|
async delete(integrationId) {
|
|
@@ -5481,7 +5733,7 @@ var ProjectIntegrations = class {
|
|
|
5481
5733
|
};
|
|
5482
5734
|
|
|
5483
5735
|
// src/resources/provider-defaults.ts
|
|
5484
|
-
function
|
|
5736
|
+
function unwrap36(data) {
|
|
5485
5737
|
if (data && typeof data === "object") {
|
|
5486
5738
|
const d = data;
|
|
5487
5739
|
for (const k of ["data", "defaults", "provider_defaults", "config"]) {
|
|
@@ -5497,7 +5749,7 @@ var ProviderDefaults = class {
|
|
|
5497
5749
|
http;
|
|
5498
5750
|
/** Get the current fleet-wide provider defaults. */
|
|
5499
5751
|
async list() {
|
|
5500
|
-
return
|
|
5752
|
+
return unwrap36(await this.http.get("/admin/provider-defaults"));
|
|
5501
5753
|
}
|
|
5502
5754
|
/** Return the defaults entry for a single provider, or {} if missing. */
|
|
5503
5755
|
async get(provider) {
|
|
@@ -5510,29 +5762,29 @@ var ProviderDefaults = class {
|
|
|
5510
5762
|
}
|
|
5511
5763
|
/** Replace the fleet-wide defaults (PUT /admin/provider-defaults). */
|
|
5512
5764
|
async update(opts) {
|
|
5513
|
-
const
|
|
5765
|
+
const body2 = Object.fromEntries(
|
|
5514
5766
|
Object.entries(opts).filter(([, v]) => v !== void 0)
|
|
5515
5767
|
);
|
|
5516
|
-
return
|
|
5517
|
-
await this.http.put("/admin/provider-defaults",
|
|
5768
|
+
return unwrap36(
|
|
5769
|
+
await this.http.put("/admin/provider-defaults", body2)
|
|
5518
5770
|
);
|
|
5519
5771
|
}
|
|
5520
5772
|
// ── Per-tenant overrides ────────────────────────────────────────────────
|
|
5521
5773
|
async getTenant(tenantId) {
|
|
5522
|
-
return
|
|
5774
|
+
return unwrap36(
|
|
5523
5775
|
await this.http.get(
|
|
5524
5776
|
`/admin/tenants/${tenantId}/provider-config`
|
|
5525
5777
|
)
|
|
5526
5778
|
);
|
|
5527
5779
|
}
|
|
5528
5780
|
async setTenant(tenantId, opts) {
|
|
5529
|
-
const
|
|
5781
|
+
const body2 = Object.fromEntries(
|
|
5530
5782
|
Object.entries(opts).filter(([, v]) => v !== void 0)
|
|
5531
5783
|
);
|
|
5532
|
-
return
|
|
5784
|
+
return unwrap36(
|
|
5533
5785
|
await this.http.put(
|
|
5534
5786
|
`/admin/tenants/${tenantId}/provider-config`,
|
|
5535
|
-
|
|
5787
|
+
body2
|
|
5536
5788
|
)
|
|
5537
5789
|
);
|
|
5538
5790
|
}
|
|
@@ -5542,7 +5794,7 @@ var ProviderDefaults = class {
|
|
|
5542
5794
|
};
|
|
5543
5795
|
|
|
5544
5796
|
// src/resources/regions.ts
|
|
5545
|
-
function
|
|
5797
|
+
function unwrap37(payload) {
|
|
5546
5798
|
if (payload && typeof payload === "object") {
|
|
5547
5799
|
const p = payload;
|
|
5548
5800
|
for (const k of [
|
|
@@ -5559,7 +5811,7 @@ function unwrap35(payload) {
|
|
|
5559
5811
|
return payload;
|
|
5560
5812
|
}
|
|
5561
5813
|
function listItems10(payload) {
|
|
5562
|
-
const result =
|
|
5814
|
+
const result = unwrap37(payload);
|
|
5563
5815
|
if (Array.isArray(result)) return result;
|
|
5564
5816
|
return [];
|
|
5565
5817
|
}
|
|
@@ -5581,7 +5833,7 @@ var Regions = class {
|
|
|
5581
5833
|
/** Get static compute pricing data. */
|
|
5582
5834
|
async pricing() {
|
|
5583
5835
|
const data = await this.http.get("/compute/pricing");
|
|
5584
|
-
return
|
|
5836
|
+
return unwrap37(data);
|
|
5585
5837
|
}
|
|
5586
5838
|
/** List community computer templates. */
|
|
5587
5839
|
async listTemplates() {
|
|
@@ -5593,7 +5845,7 @@ var Regions = class {
|
|
|
5593
5845
|
const data = await this.http.get(
|
|
5594
5846
|
`/compute/templates/${templateId}`
|
|
5595
5847
|
);
|
|
5596
|
-
return
|
|
5848
|
+
return unwrap37(data);
|
|
5597
5849
|
}
|
|
5598
5850
|
};
|
|
5599
5851
|
|
|
@@ -5611,12 +5863,32 @@ var AGENT_WORKSPACE_TIMEOUT_SEC = 86400;
|
|
|
5611
5863
|
var AGENT_WORKSPACE_IDLE_TIMEOUT_SEC = 1800;
|
|
5612
5864
|
var AGENT_WORKSPACE_SNAPSHOT_EXPIRATION_DAYS = 30;
|
|
5613
5865
|
var AGENT_WORKSPACE_KEEP_LAST_SNAPSHOTS = 1;
|
|
5614
|
-
function
|
|
5866
|
+
function unwrap38(payload) {
|
|
5615
5867
|
if (payload !== null && typeof payload === "object" && "data" in payload && payload.data !== void 0) {
|
|
5616
5868
|
return payload.data;
|
|
5617
5869
|
}
|
|
5618
5870
|
return payload;
|
|
5619
5871
|
}
|
|
5872
|
+
function normalizeExport(value) {
|
|
5873
|
+
const normalized = {
|
|
5874
|
+
...value,
|
|
5875
|
+
files: (value.files ?? []).map((file) => {
|
|
5876
|
+
const normalized2 = { ...file };
|
|
5877
|
+
const downloadUrl = file.downloadUrl ?? file.download_url;
|
|
5878
|
+
if (downloadUrl !== void 0) normalized2.downloadUrl = downloadUrl;
|
|
5879
|
+
return normalized2;
|
|
5880
|
+
})
|
|
5881
|
+
};
|
|
5882
|
+
const sandboxId = value.sandboxId ?? value.sandbox_id;
|
|
5883
|
+
const archiveDownloadUrl = value.archiveDownloadUrl ?? value.archive_download_url;
|
|
5884
|
+
const createdAt = value.createdAt ?? value.created_at;
|
|
5885
|
+
if (sandboxId !== void 0) normalized.sandboxId = sandboxId;
|
|
5886
|
+
if (archiveDownloadUrl !== void 0) {
|
|
5887
|
+
normalized.archiveDownloadUrl = archiveDownloadUrl;
|
|
5888
|
+
}
|
|
5889
|
+
if (createdAt !== void 0) normalized.createdAt = createdAt;
|
|
5890
|
+
return normalized;
|
|
5891
|
+
}
|
|
5620
5892
|
function listItems11(payload) {
|
|
5621
5893
|
if (Array.isArray(payload)) return payload;
|
|
5622
5894
|
if ("data" in payload && Array.isArray(payload.data)) return payload.data;
|
|
@@ -5625,7 +5897,7 @@ function listItems11(payload) {
|
|
|
5625
5897
|
if ("items" in payload && Array.isArray(payload.items)) return payload.items;
|
|
5626
5898
|
return [];
|
|
5627
5899
|
}
|
|
5628
|
-
function
|
|
5900
|
+
function createBody(params = {}) {
|
|
5629
5901
|
const templateId = params.templateId ?? params.template_id ?? params.image ?? SANDBOX_TEMPLATE;
|
|
5630
5902
|
const persistent = params.persistent;
|
|
5631
5903
|
const snapshotExpirationSec = snapshotExpirationSeconds(params);
|
|
@@ -5660,6 +5932,8 @@ function createBody2(params = {}) {
|
|
|
5660
5932
|
entrypoint: params.entrypoint,
|
|
5661
5933
|
tags: params.tags,
|
|
5662
5934
|
slug: params.slug,
|
|
5935
|
+
agent_runtime_profile_id: params.agentRuntimeProfileId ?? params.agent_runtime_profile_id ?? params.agentProfileId ?? params.agent_profile_id,
|
|
5936
|
+
skip_agent_runtime_profile: params.skipAgentRuntimeProfile ?? params.skip_agent_runtime_profile,
|
|
5663
5937
|
external_workspace_id: params.externalWorkspaceId ?? params.external_workspace_id,
|
|
5664
5938
|
external_user_id: params.externalUserId ?? params.external_user_id,
|
|
5665
5939
|
external_project_id: params.externalProjectId ?? params.external_project_id
|
|
@@ -5812,11 +6086,11 @@ var SandboxTerminal = class {
|
|
|
5812
6086
|
}
|
|
5813
6087
|
sandbox;
|
|
5814
6088
|
async create(params = {}) {
|
|
5815
|
-
const
|
|
6089
|
+
const body2 = Object.fromEntries(
|
|
5816
6090
|
Object.entries(params).filter(([, v]) => v !== void 0)
|
|
5817
6091
|
);
|
|
5818
|
-
const response =
|
|
5819
|
-
await this.sandbox.http.post(`/sandboxes/${this.sandbox.id}/terminal`,
|
|
6092
|
+
const response = unwrap38(
|
|
6093
|
+
await this.sandbox.http.post(`/sandboxes/${this.sandbox.id}/terminal`, body2)
|
|
5820
6094
|
);
|
|
5821
6095
|
return response;
|
|
5822
6096
|
}
|
|
@@ -5858,21 +6132,21 @@ var SandboxPreviews = class {
|
|
|
5858
6132
|
return [];
|
|
5859
6133
|
}
|
|
5860
6134
|
async create(port, opts = {}) {
|
|
5861
|
-
const
|
|
6135
|
+
const body2 = {
|
|
5862
6136
|
port,
|
|
5863
6137
|
...Object.fromEntries(
|
|
5864
6138
|
Object.entries(opts).filter(([, v]) => v !== void 0)
|
|
5865
6139
|
)
|
|
5866
6140
|
};
|
|
5867
|
-
return
|
|
6141
|
+
return unwrap38(
|
|
5868
6142
|
await this.http.post(
|
|
5869
6143
|
`/sandboxes/${this.sandbox.id}/previews`,
|
|
5870
|
-
|
|
6144
|
+
body2
|
|
5871
6145
|
)
|
|
5872
6146
|
);
|
|
5873
6147
|
}
|
|
5874
6148
|
async get(previewId) {
|
|
5875
|
-
return
|
|
6149
|
+
return unwrap38(
|
|
5876
6150
|
await this.http.get(
|
|
5877
6151
|
`/sandboxes/${this.sandbox.id}/previews/${previewId}`
|
|
5878
6152
|
)
|
|
@@ -5885,7 +6159,7 @@ var SandboxPreviews = class {
|
|
|
5885
6159
|
}
|
|
5886
6160
|
/** Mint a share token for previewId. */
|
|
5887
6161
|
async share(previewId, opts = {}) {
|
|
5888
|
-
return
|
|
6162
|
+
return unwrap38(
|
|
5889
6163
|
await this.http.post(
|
|
5890
6164
|
`/sandboxes/${this.sandbox.id}/previews/${previewId}/share`,
|
|
5891
6165
|
{ ttl_seconds: opts.ttl_seconds ?? opts.expires_in_sec ?? 3600 }
|
|
@@ -5954,7 +6228,7 @@ var SandboxTags = class {
|
|
|
5954
6228
|
sandbox;
|
|
5955
6229
|
/** Replace the full tag list with tags. */
|
|
5956
6230
|
async set(tags) {
|
|
5957
|
-
return
|
|
6231
|
+
return unwrap38(
|
|
5958
6232
|
await this.sandbox.http.patch(`/sandboxes/${this.sandbox.id}/tags`, { tags })
|
|
5959
6233
|
);
|
|
5960
6234
|
}
|
|
@@ -6022,14 +6296,14 @@ var Sandbox = class _Sandbox {
|
|
|
6022
6296
|
return this.data.template_id ?? this.data.image_id ?? "";
|
|
6023
6297
|
}
|
|
6024
6298
|
async refresh() {
|
|
6025
|
-
this.data =
|
|
6299
|
+
this.data = unwrap38(
|
|
6026
6300
|
await this.http.get(`/sandboxes/${this.id}`)
|
|
6027
6301
|
);
|
|
6028
6302
|
return this;
|
|
6029
6303
|
}
|
|
6030
6304
|
async runExec(command, options) {
|
|
6031
6305
|
this.assertRunning("exec");
|
|
6032
|
-
const response =
|
|
6306
|
+
const response = unwrap38(
|
|
6033
6307
|
await this.http.post(
|
|
6034
6308
|
`/sandboxes/${this.id}/exec`,
|
|
6035
6309
|
execBody(command, options)
|
|
@@ -6072,12 +6346,34 @@ var Sandbox = class _Sandbox {
|
|
|
6072
6346
|
`/sandboxes/${this.id}/files/${path.replace(/^\/+/, "")}`
|
|
6073
6347
|
);
|
|
6074
6348
|
}
|
|
6349
|
+
async createExport(params) {
|
|
6350
|
+
const body2 = typeof params === "string" ? { path: params } : Array.isArray(params) ? { paths: params } : params;
|
|
6351
|
+
const response = unwrap38(
|
|
6352
|
+
await this.http.post(
|
|
6353
|
+
`/sandboxes/${this.id}/exports`,
|
|
6354
|
+
body2
|
|
6355
|
+
)
|
|
6356
|
+
);
|
|
6357
|
+
return normalizeExport(response);
|
|
6358
|
+
}
|
|
6359
|
+
async downloadExport(paths, options = {}) {
|
|
6360
|
+
const query = new URLSearchParams();
|
|
6361
|
+
if (Array.isArray(paths)) {
|
|
6362
|
+
for (const path of paths) query.append("paths[]", path);
|
|
6363
|
+
} else {
|
|
6364
|
+
query.set("path", paths);
|
|
6365
|
+
}
|
|
6366
|
+
if (options.filename) query.set("filename", options.filename);
|
|
6367
|
+
return this.http.getBinary(
|
|
6368
|
+
`/sandboxes/${this.id}/exports/download?${query.toString()}`
|
|
6369
|
+
);
|
|
6370
|
+
}
|
|
6075
6371
|
async readFile(path) {
|
|
6076
6372
|
return new TextDecoder().decode(await this.download(path));
|
|
6077
6373
|
}
|
|
6078
6374
|
async listFiles(path = "/workspace") {
|
|
6079
6375
|
this.assertRunning("files.list");
|
|
6080
|
-
const response =
|
|
6376
|
+
const response = unwrap38(
|
|
6081
6377
|
await this.http.get(
|
|
6082
6378
|
`/sandboxes/${this.id}/files`,
|
|
6083
6379
|
{ path }
|
|
@@ -6087,7 +6383,7 @@ var Sandbox = class _Sandbox {
|
|
|
6087
6383
|
}
|
|
6088
6384
|
async statFile(path) {
|
|
6089
6385
|
this.assertRunning("files.stat");
|
|
6090
|
-
return
|
|
6386
|
+
return unwrap38(
|
|
6091
6387
|
await this.http.post(
|
|
6092
6388
|
`/sandboxes/${this.id}/files/stat`,
|
|
6093
6389
|
{ path }
|
|
@@ -6096,7 +6392,7 @@ var Sandbox = class _Sandbox {
|
|
|
6096
6392
|
}
|
|
6097
6393
|
async expose(port) {
|
|
6098
6394
|
this.assertRunning("expose");
|
|
6099
|
-
const response =
|
|
6395
|
+
const response = unwrap38(
|
|
6100
6396
|
await this.http.post(
|
|
6101
6397
|
`/sandboxes/${this.id}/expose`,
|
|
6102
6398
|
port === void 0 ? {} : { port }
|
|
@@ -6106,7 +6402,7 @@ var Sandbox = class _Sandbox {
|
|
|
6106
6402
|
}
|
|
6107
6403
|
async startTemplate(options = {}) {
|
|
6108
6404
|
this.assertRunning("startTemplate");
|
|
6109
|
-
return
|
|
6405
|
+
return unwrap38(
|
|
6110
6406
|
await this.http.post(
|
|
6111
6407
|
`/sandboxes/${this.id}/template/start`,
|
|
6112
6408
|
options
|
|
@@ -6114,7 +6410,7 @@ var Sandbox = class _Sandbox {
|
|
|
6114
6410
|
);
|
|
6115
6411
|
}
|
|
6116
6412
|
async getArtifacts() {
|
|
6117
|
-
return
|
|
6413
|
+
return unwrap38(
|
|
6118
6414
|
await this.http.get(
|
|
6119
6415
|
`/sandboxes/${this.id}/artifacts`
|
|
6120
6416
|
)
|
|
@@ -6125,7 +6421,7 @@ var Sandbox = class _Sandbox {
|
|
|
6125
6421
|
`/sandboxes/${this.id}/logs`,
|
|
6126
6422
|
{ lines }
|
|
6127
6423
|
);
|
|
6128
|
-
return
|
|
6424
|
+
return unwrap38(response);
|
|
6129
6425
|
}
|
|
6130
6426
|
streamLogs() {
|
|
6131
6427
|
return this.http.stream(
|
|
@@ -6134,7 +6430,7 @@ var Sandbox = class _Sandbox {
|
|
|
6134
6430
|
}
|
|
6135
6431
|
async createSnapshot(comment) {
|
|
6136
6432
|
this.assertRunning("snapshots.create");
|
|
6137
|
-
return
|
|
6433
|
+
return unwrap38(
|
|
6138
6434
|
await this.http.post(
|
|
6139
6435
|
`/sandboxes/${this.id}/snapshots`,
|
|
6140
6436
|
comment ? { comment } : {}
|
|
@@ -6142,14 +6438,14 @@ var Sandbox = class _Sandbox {
|
|
|
6142
6438
|
);
|
|
6143
6439
|
}
|
|
6144
6440
|
async listSnapshots() {
|
|
6145
|
-
return
|
|
6441
|
+
return unwrap38(
|
|
6146
6442
|
await this.http.get(
|
|
6147
6443
|
`/sandboxes/${this.id}/snapshots`
|
|
6148
6444
|
)
|
|
6149
6445
|
);
|
|
6150
6446
|
}
|
|
6151
6447
|
async restoreSnapshot(snapshotId) {
|
|
6152
|
-
const data =
|
|
6448
|
+
const data = unwrap38(
|
|
6153
6449
|
await this.http.post(
|
|
6154
6450
|
`/sandboxes/${this.id}/restore/${snapshotId}`,
|
|
6155
6451
|
{}
|
|
@@ -6166,13 +6462,13 @@ var Sandbox = class _Sandbox {
|
|
|
6166
6462
|
*/
|
|
6167
6463
|
async fork(opts = {}) {
|
|
6168
6464
|
this.assertRunning("fork");
|
|
6169
|
-
const
|
|
6170
|
-
if (opts.name !== void 0)
|
|
6171
|
-
if (opts.metadata !== void 0)
|
|
6172
|
-
const data =
|
|
6465
|
+
const body2 = {};
|
|
6466
|
+
if (opts.name !== void 0) body2.name = opts.name;
|
|
6467
|
+
if (opts.metadata !== void 0) body2.metadata = opts.metadata;
|
|
6468
|
+
const data = unwrap38(
|
|
6173
6469
|
await this.http.post(
|
|
6174
6470
|
`/sandboxes/${this.id}/fork`,
|
|
6175
|
-
|
|
6471
|
+
body2
|
|
6176
6472
|
)
|
|
6177
6473
|
);
|
|
6178
6474
|
return new _Sandbox(this.http, data);
|
|
@@ -6191,7 +6487,7 @@ var Sandbox = class _Sandbox {
|
|
|
6191
6487
|
if (keepLastSnapshots !== void 0) {
|
|
6192
6488
|
metadata.keep_last_snapshots = keepLastSnapshots;
|
|
6193
6489
|
}
|
|
6194
|
-
const
|
|
6490
|
+
const body2 = stripUndefined20({
|
|
6195
6491
|
name: params.name,
|
|
6196
6492
|
slug: params.slug,
|
|
6197
6493
|
tags: params.tags,
|
|
@@ -6200,17 +6496,17 @@ var Sandbox = class _Sandbox {
|
|
|
6200
6496
|
timeout_sec: params.timeout_sec ?? params.timeoutSec,
|
|
6201
6497
|
idle_timeout_sec: params.idle_timeout_sec ?? params.idleTimeoutSec
|
|
6202
6498
|
});
|
|
6203
|
-
const data =
|
|
6499
|
+
const data = unwrap38(
|
|
6204
6500
|
await this.http.patch(
|
|
6205
6501
|
`/sandboxes/${this.id}`,
|
|
6206
|
-
|
|
6502
|
+
body2
|
|
6207
6503
|
)
|
|
6208
6504
|
);
|
|
6209
6505
|
this.data = data;
|
|
6210
6506
|
return this;
|
|
6211
6507
|
}
|
|
6212
6508
|
async extend(timeoutSec) {
|
|
6213
|
-
const data =
|
|
6509
|
+
const data = unwrap38(
|
|
6214
6510
|
await this.http.post(
|
|
6215
6511
|
`/sandboxes/${this.id}/extend`,
|
|
6216
6512
|
{ timeout_sec: timeoutSec }
|
|
@@ -6233,7 +6529,7 @@ var Sandbox = class _Sandbox {
|
|
|
6233
6529
|
return raw;
|
|
6234
6530
|
}
|
|
6235
6531
|
async pause() {
|
|
6236
|
-
const data =
|
|
6532
|
+
const data = unwrap38(
|
|
6237
6533
|
await this.http.post(
|
|
6238
6534
|
`/sandboxes/${this.id}/pause`,
|
|
6239
6535
|
{}
|
|
@@ -6243,7 +6539,7 @@ var Sandbox = class _Sandbox {
|
|
|
6243
6539
|
return this;
|
|
6244
6540
|
}
|
|
6245
6541
|
async resume() {
|
|
6246
|
-
const data =
|
|
6542
|
+
const data = unwrap38(
|
|
6247
6543
|
await this.http.post(
|
|
6248
6544
|
`/sandboxes/${this.id}/resume`,
|
|
6249
6545
|
{}
|
|
@@ -6279,7 +6575,7 @@ var Sandbox = class _Sandbox {
|
|
|
6279
6575
|
if (idempotencyKey11) {
|
|
6280
6576
|
requestOptions.headers = { "Idempotency-Key": idempotencyKey11 };
|
|
6281
6577
|
}
|
|
6282
|
-
return
|
|
6578
|
+
return unwrap38(
|
|
6283
6579
|
await this.http.request(
|
|
6284
6580
|
`/sandboxes/${this.id}/deploy`,
|
|
6285
6581
|
requestOptions
|
|
@@ -6291,7 +6587,7 @@ var Sandbox = class _Sandbox {
|
|
|
6291
6587
|
}
|
|
6292
6588
|
/** Check readiness of the sandbox (GET /sandboxes/:id/readiness). */
|
|
6293
6589
|
async readiness() {
|
|
6294
|
-
return
|
|
6590
|
+
return unwrap38(
|
|
6295
6591
|
await this.http.get(
|
|
6296
6592
|
`/sandboxes/${this.id}/readiness`
|
|
6297
6593
|
)
|
|
@@ -6451,12 +6747,12 @@ var Sandboxes = class {
|
|
|
6451
6747
|
const idempotencyKey11 = params.idempotencyKey ?? params.idempotency_key;
|
|
6452
6748
|
const requestOptions = {
|
|
6453
6749
|
method: "POST",
|
|
6454
|
-
body:
|
|
6750
|
+
body: createBody(params)
|
|
6455
6751
|
};
|
|
6456
6752
|
if (idempotencyKey11) {
|
|
6457
6753
|
requestOptions.headers = { "Idempotency-Key": idempotencyKey11 };
|
|
6458
6754
|
}
|
|
6459
|
-
const data =
|
|
6755
|
+
const data = unwrap38(
|
|
6460
6756
|
await this.http.request(
|
|
6461
6757
|
"/sandboxes",
|
|
6462
6758
|
requestOptions
|
|
@@ -6475,7 +6771,7 @@ var Sandboxes = class {
|
|
|
6475
6771
|
return listItems11(data).map((item) => new Sandbox(this.http, item));
|
|
6476
6772
|
}
|
|
6477
6773
|
async get(id) {
|
|
6478
|
-
const data =
|
|
6774
|
+
const data = unwrap38(
|
|
6479
6775
|
await this.http.get(`/sandboxes/${id}`)
|
|
6480
6776
|
);
|
|
6481
6777
|
return new Sandbox(this.http, data);
|
|
@@ -6484,7 +6780,7 @@ var Sandboxes = class {
|
|
|
6484
6780
|
return this.get(id);
|
|
6485
6781
|
}
|
|
6486
6782
|
async getByName(name) {
|
|
6487
|
-
const data =
|
|
6783
|
+
const data = unwrap38(
|
|
6488
6784
|
await this.http.get(
|
|
6489
6785
|
`/sandboxes/by-name/${encodeURIComponent(name)}`
|
|
6490
6786
|
)
|
|
@@ -6549,7 +6845,7 @@ var Sandboxes = class {
|
|
|
6549
6845
|
metadata: params.metadata
|
|
6550
6846
|
})
|
|
6551
6847
|
);
|
|
6552
|
-
return
|
|
6848
|
+
return unwrap38(response);
|
|
6553
6849
|
}
|
|
6554
6850
|
async createTemplateBuild(templateId, params = {}) {
|
|
6555
6851
|
const response = await this.http.post(
|
|
@@ -6559,19 +6855,19 @@ var Sandboxes = class {
|
|
|
6559
6855
|
metadata: params.metadata
|
|
6560
6856
|
})
|
|
6561
6857
|
);
|
|
6562
|
-
return
|
|
6858
|
+
return unwrap38(response);
|
|
6563
6859
|
}
|
|
6564
6860
|
async listTemplateBuilds(templateId) {
|
|
6565
6861
|
const response = await this.http.get(
|
|
6566
6862
|
`/sandbox-templates/${templateId}/builds`
|
|
6567
6863
|
);
|
|
6568
|
-
return
|
|
6864
|
+
return unwrap38(response);
|
|
6569
6865
|
}
|
|
6570
6866
|
async getTemplateBuild(buildId) {
|
|
6571
6867
|
const response = await this.http.get(
|
|
6572
6868
|
`/sandbox-template-builds/${buildId}`
|
|
6573
6869
|
);
|
|
6574
|
-
return
|
|
6870
|
+
return unwrap38(response);
|
|
6575
6871
|
}
|
|
6576
6872
|
};
|
|
6577
6873
|
function toBase642(bytes) {
|
|
@@ -6583,7 +6879,7 @@ function toBase642(bytes) {
|
|
|
6583
6879
|
}
|
|
6584
6880
|
return btoa(binary);
|
|
6585
6881
|
}
|
|
6586
|
-
function
|
|
6882
|
+
function unwrap39(payload) {
|
|
6587
6883
|
if (payload && typeof payload === "object" && "data" in payload) {
|
|
6588
6884
|
return payload.data;
|
|
6589
6885
|
}
|
|
@@ -6626,7 +6922,7 @@ var SandboxTemplates = class {
|
|
|
6626
6922
|
const data = await this.http.get(
|
|
6627
6923
|
`/sandbox-templates/${templateId}`
|
|
6628
6924
|
);
|
|
6629
|
-
return
|
|
6925
|
+
return unwrap39(data);
|
|
6630
6926
|
}
|
|
6631
6927
|
async create(params) {
|
|
6632
6928
|
const {
|
|
@@ -6636,17 +6932,17 @@ var SandboxTemplates = class {
|
|
|
6636
6932
|
name,
|
|
6637
6933
|
...rest
|
|
6638
6934
|
} = params;
|
|
6639
|
-
const
|
|
6935
|
+
const body2 = stripUndefined21({
|
|
6640
6936
|
name,
|
|
6641
6937
|
build_spec: buildSpec ?? build_spec,
|
|
6642
6938
|
...rest
|
|
6643
6939
|
});
|
|
6644
6940
|
const data = await this.http.request("/sandbox-templates", {
|
|
6645
6941
|
method: "POST",
|
|
6646
|
-
body,
|
|
6942
|
+
body: body2,
|
|
6647
6943
|
headers: { "Idempotency-Key": idempotencyKey8(ikey) }
|
|
6648
6944
|
});
|
|
6649
|
-
return
|
|
6945
|
+
return unwrap39(data);
|
|
6650
6946
|
}
|
|
6651
6947
|
async buildSpecSchema() {
|
|
6652
6948
|
const data = await this.http.get("/sandbox-templates/build-spec");
|
|
@@ -6670,21 +6966,21 @@ var SandboxTemplates = class {
|
|
|
6670
6966
|
}
|
|
6671
6967
|
async createBuild(templateId, params = {}) {
|
|
6672
6968
|
const { idempotencyKey: ikey, ...rest } = params;
|
|
6673
|
-
const
|
|
6969
|
+
const body2 = stripUndefined21(rest);
|
|
6674
6970
|
const data = await this.http.request(
|
|
6675
6971
|
`/sandbox-templates/${templateId}/builds`,
|
|
6676
6972
|
{
|
|
6677
6973
|
method: "POST",
|
|
6678
|
-
body,
|
|
6974
|
+
body: body2,
|
|
6679
6975
|
headers: { "Idempotency-Key": idempotencyKey8(ikey) }
|
|
6680
6976
|
}
|
|
6681
6977
|
);
|
|
6682
|
-
return
|
|
6978
|
+
return unwrap39(data);
|
|
6683
6979
|
}
|
|
6684
6980
|
};
|
|
6685
6981
|
|
|
6686
6982
|
// src/resources/settings.ts
|
|
6687
|
-
function
|
|
6983
|
+
function unwrap40(payload) {
|
|
6688
6984
|
if (payload && typeof payload === "object") {
|
|
6689
6985
|
const p = payload;
|
|
6690
6986
|
for (const k of [
|
|
@@ -6700,7 +6996,7 @@ function unwrap38(payload) {
|
|
|
6700
6996
|
return payload;
|
|
6701
6997
|
}
|
|
6702
6998
|
function listItems13(payload) {
|
|
6703
|
-
const result =
|
|
6999
|
+
const result = unwrap40(payload);
|
|
6704
7000
|
if (Array.isArray(result)) return result;
|
|
6705
7001
|
return [];
|
|
6706
7002
|
}
|
|
@@ -6717,46 +7013,46 @@ var Settings = class {
|
|
|
6717
7013
|
/** Get the current tenant settings. */
|
|
6718
7014
|
async get() {
|
|
6719
7015
|
const data = await this.http.get("/settings");
|
|
6720
|
-
return
|
|
7016
|
+
return unwrap40(data);
|
|
6721
7017
|
}
|
|
6722
7018
|
/** Update tenant settings. */
|
|
6723
7019
|
async update(params) {
|
|
6724
|
-
const
|
|
6725
|
-
const data = await this.http.put("/settings",
|
|
6726
|
-
return
|
|
7020
|
+
const body2 = stripUndefined22(params);
|
|
7021
|
+
const data = await this.http.put("/settings", body2);
|
|
7022
|
+
return unwrap40(data);
|
|
6727
7023
|
}
|
|
6728
7024
|
// ── Branding ──────────────────────────────────────────────────────────────
|
|
6729
7025
|
/** Get tenant branding (logo, colors, custom wordmark). */
|
|
6730
7026
|
async getBranding() {
|
|
6731
7027
|
const data = await this.http.get("/settings/branding");
|
|
6732
|
-
return
|
|
7028
|
+
return unwrap40(data);
|
|
6733
7029
|
}
|
|
6734
7030
|
/** Update tenant branding. */
|
|
6735
7031
|
async updateBranding(params) {
|
|
6736
|
-
const
|
|
6737
|
-
const data = await this.http.put("/settings/branding",
|
|
6738
|
-
return
|
|
7032
|
+
const body2 = stripUndefined22(params);
|
|
7033
|
+
const data = await this.http.put("/settings/branding", body2);
|
|
7034
|
+
return unwrap40(data);
|
|
6739
7035
|
}
|
|
6740
7036
|
// ── Read-only reference data ───────────────────────────────────────────────
|
|
6741
7037
|
/** Get tenant-scoped compute pricing. */
|
|
6742
7038
|
async computePricing() {
|
|
6743
7039
|
const data = await this.http.get("/settings/compute-pricing");
|
|
6744
|
-
return
|
|
7040
|
+
return unwrap40(data);
|
|
6745
7041
|
}
|
|
6746
7042
|
/** Get tenant-scoped GPU pricing. */
|
|
6747
7043
|
async gpuPricing() {
|
|
6748
7044
|
const data = await this.http.get("/settings/gpu-pricing");
|
|
6749
|
-
return
|
|
7045
|
+
return unwrap40(data);
|
|
6750
7046
|
}
|
|
6751
7047
|
/** List models available to this tenant. */
|
|
6752
7048
|
async availableModels() {
|
|
6753
7049
|
const data = await this.http.get("/settings/available-models");
|
|
6754
|
-
return
|
|
7050
|
+
return unwrap40(data);
|
|
6755
7051
|
}
|
|
6756
7052
|
/** List regions enabled for this tenant. */
|
|
6757
7053
|
async regions() {
|
|
6758
7054
|
const data = await this.http.get("/settings/regions");
|
|
6759
|
-
return
|
|
7055
|
+
return unwrap40(data);
|
|
6760
7056
|
}
|
|
6761
7057
|
// ── BYOK provider keys ────────────────────────────────────────────────────
|
|
6762
7058
|
/** List tenant-level BYOK provider keys (Anthropic, OpenAI, etc.). */
|
|
@@ -6766,12 +7062,12 @@ var Settings = class {
|
|
|
6766
7062
|
}
|
|
6767
7063
|
/** Create or update a BYOK provider key. */
|
|
6768
7064
|
async upsertProviderKey(provider, params) {
|
|
6769
|
-
const
|
|
7065
|
+
const body2 = stripUndefined22(params);
|
|
6770
7066
|
const data = await this.http.put(
|
|
6771
7067
|
`/settings/provider-keys/${provider}`,
|
|
6772
|
-
|
|
7068
|
+
body2
|
|
6773
7069
|
);
|
|
6774
|
-
return
|
|
7070
|
+
return unwrap40(data);
|
|
6775
7071
|
}
|
|
6776
7072
|
/** Delete a BYOK provider key. */
|
|
6777
7073
|
async deleteProviderKey(provider) {
|
|
@@ -6780,7 +7076,7 @@ var Settings = class {
|
|
|
6780
7076
|
};
|
|
6781
7077
|
|
|
6782
7078
|
// src/resources/snapshots-standalone.ts
|
|
6783
|
-
function
|
|
7079
|
+
function unwrap41(data) {
|
|
6784
7080
|
if (data && typeof data === "object") {
|
|
6785
7081
|
const d = data;
|
|
6786
7082
|
for (const k of ["data", "snapshots", "items"]) {
|
|
@@ -6811,14 +7107,14 @@ var SnapshotsStandalone = class {
|
|
|
6811
7107
|
return unwrapList12(await this.http.get("/admin/snapshots", query));
|
|
6812
7108
|
}
|
|
6813
7109
|
async get(snapshotId) {
|
|
6814
|
-
return
|
|
7110
|
+
return unwrap41(
|
|
6815
7111
|
await this.http.get(`/admin/snapshots/${snapshotId}`)
|
|
6816
7112
|
);
|
|
6817
7113
|
}
|
|
6818
7114
|
};
|
|
6819
7115
|
|
|
6820
7116
|
// src/resources/storage.ts
|
|
6821
|
-
function
|
|
7117
|
+
function unwrap42(payload) {
|
|
6822
7118
|
if (payload && typeof payload === "object" && "data" in payload) {
|
|
6823
7119
|
return payload.data;
|
|
6824
7120
|
}
|
|
@@ -6851,17 +7147,17 @@ var Storage = class {
|
|
|
6851
7147
|
}
|
|
6852
7148
|
async createBucket(params) {
|
|
6853
7149
|
const { name, public: isPublic, visibility, ...rest } = params;
|
|
6854
|
-
const
|
|
7150
|
+
const body2 = stripUndefined23({
|
|
6855
7151
|
name,
|
|
6856
7152
|
visibility: visibility ?? (isPublic === void 0 ? void 0 : isPublic ? "public" : "private"),
|
|
6857
7153
|
...rest
|
|
6858
7154
|
});
|
|
6859
|
-
const data = await this.http.post("/storage/buckets",
|
|
6860
|
-
return
|
|
7155
|
+
const data = await this.http.post("/storage/buckets", body2);
|
|
7156
|
+
return unwrap42(data);
|
|
6861
7157
|
}
|
|
6862
7158
|
async getBucket(bucketId) {
|
|
6863
7159
|
const data = await this.http.get(`/storage/buckets/${bucketId}`);
|
|
6864
|
-
return
|
|
7160
|
+
return unwrap42(data);
|
|
6865
7161
|
}
|
|
6866
7162
|
async deleteBucket(bucketId) {
|
|
6867
7163
|
await this.http.delete(`/storage/buckets/${bucketId}`);
|
|
@@ -6902,16 +7198,16 @@ var Storage = class {
|
|
|
6902
7198
|
// ── Presigned URLs ─────────────────────────────────────────────────────────
|
|
6903
7199
|
async presign(bucketId, params) {
|
|
6904
7200
|
const operationMethod = params.operation === "put" ? "PUT" : params.operation === "get" ? "GET" : void 0;
|
|
6905
|
-
const
|
|
7201
|
+
const body2 = stripUndefined23({
|
|
6906
7202
|
key: params.key,
|
|
6907
7203
|
method: params.method ?? operationMethod ?? "GET",
|
|
6908
7204
|
expires_in: params.expiresIn ?? params.expires_in ?? params.expiresInSec ?? params.expires_in_sec ?? 3600
|
|
6909
7205
|
});
|
|
6910
7206
|
const data = await this.http.post(
|
|
6911
7207
|
`/storage/buckets/${bucketId}/presign`,
|
|
6912
|
-
|
|
7208
|
+
body2
|
|
6913
7209
|
);
|
|
6914
|
-
return
|
|
7210
|
+
return unwrap42(data);
|
|
6915
7211
|
}
|
|
6916
7212
|
};
|
|
6917
7213
|
|
|
@@ -7001,29 +7297,105 @@ var OrgInvites = class {
|
|
|
7001
7297
|
};
|
|
7002
7298
|
|
|
7003
7299
|
// src/resources/tenant.ts
|
|
7004
|
-
function
|
|
7300
|
+
function unwrap43(payload) {
|
|
7005
7301
|
if (payload && typeof payload === "object") {
|
|
7006
7302
|
const p = payload;
|
|
7007
|
-
for (const k of ["data", "tenant", "items"]) {
|
|
7303
|
+
for (const k of ["data", "tenant", "branding", "items"]) {
|
|
7008
7304
|
if (k in p) return p[k];
|
|
7009
7305
|
}
|
|
7010
7306
|
}
|
|
7011
7307
|
return payload;
|
|
7012
7308
|
}
|
|
7309
|
+
function stripUndefined24(input) {
|
|
7310
|
+
return Object.fromEntries(
|
|
7311
|
+
Object.entries(input).filter(([, v]) => v !== void 0)
|
|
7312
|
+
);
|
|
7313
|
+
}
|
|
7314
|
+
var PreviewDomain = class {
|
|
7315
|
+
constructor(http) {
|
|
7316
|
+
this.http = http;
|
|
7317
|
+
}
|
|
7318
|
+
http;
|
|
7319
|
+
/** Get the tenant's white-label preview domain settings. */
|
|
7320
|
+
async get() {
|
|
7321
|
+
const data = await this.http.get("/tenant/preview-domain");
|
|
7322
|
+
return unwrap43(data);
|
|
7323
|
+
}
|
|
7324
|
+
/** Set the tenant's white-label preview domain. */
|
|
7325
|
+
async set(domain) {
|
|
7326
|
+
const data = await this.http.put("/tenant/preview-domain", {
|
|
7327
|
+
preview_domain: domain
|
|
7328
|
+
});
|
|
7329
|
+
return unwrap43(data);
|
|
7330
|
+
}
|
|
7331
|
+
/** Re-run DNS verification for the configured preview domain. */
|
|
7332
|
+
async verify() {
|
|
7333
|
+
const data = await this.http.post(
|
|
7334
|
+
"/tenant/preview-domain/verify",
|
|
7335
|
+
{}
|
|
7336
|
+
);
|
|
7337
|
+
return unwrap43(data);
|
|
7338
|
+
}
|
|
7339
|
+
/** Remove the tenant's custom preview domain. */
|
|
7340
|
+
async delete() {
|
|
7341
|
+
await this.http.delete("/tenant/preview-domain");
|
|
7342
|
+
}
|
|
7343
|
+
};
|
|
7344
|
+
var Branding = class {
|
|
7345
|
+
constructor(http) {
|
|
7346
|
+
this.http = http;
|
|
7347
|
+
}
|
|
7348
|
+
http;
|
|
7349
|
+
/** Get tenant branding used by white-label hosted surfaces. */
|
|
7350
|
+
async get() {
|
|
7351
|
+
const data = await this.http.get("/tenant/branding");
|
|
7352
|
+
return unwrap43(data);
|
|
7353
|
+
}
|
|
7354
|
+
/** Update tenant branding used by white-label hosted surfaces. */
|
|
7355
|
+
async set(params) {
|
|
7356
|
+
const data = await this.http.put("/tenant/branding", {
|
|
7357
|
+
branding: stripUndefined24(params)
|
|
7358
|
+
});
|
|
7359
|
+
return unwrap43(data);
|
|
7360
|
+
}
|
|
7361
|
+
/** Reset tenant branding to platform defaults. */
|
|
7362
|
+
async delete() {
|
|
7363
|
+
await this.http.delete("/tenant/branding");
|
|
7364
|
+
}
|
|
7365
|
+
};
|
|
7013
7366
|
var Tenant = class {
|
|
7014
7367
|
constructor(http) {
|
|
7015
7368
|
this.http = http;
|
|
7369
|
+
this.preview_domain = new PreviewDomain(http);
|
|
7370
|
+
this.previewDomain = this.preview_domain;
|
|
7371
|
+
this.branding = new Branding(http);
|
|
7016
7372
|
}
|
|
7017
7373
|
http;
|
|
7374
|
+
preview_domain;
|
|
7375
|
+
branding;
|
|
7376
|
+
/** camelCase alias for SDK consumers that avoid snake_case properties. */
|
|
7377
|
+
previewDomain;
|
|
7018
7378
|
/** Get the current tenant's plan, limits, and live usage counters. */
|
|
7019
7379
|
async current() {
|
|
7020
7380
|
const data = await this.http.get("/tenant/plan");
|
|
7021
|
-
return
|
|
7381
|
+
return unwrap43(data);
|
|
7382
|
+
}
|
|
7383
|
+
/** Convenience alias for `tenant.branding.get()`. */
|
|
7384
|
+
async getBranding() {
|
|
7385
|
+
return this.branding.get();
|
|
7386
|
+
}
|
|
7387
|
+
/** Convenience alias for `tenant.branding.set(...)`. */
|
|
7388
|
+
async setBranding(params) {
|
|
7389
|
+
return this.branding.set(params);
|
|
7390
|
+
}
|
|
7391
|
+
/** Convenience alias for `tenant.branding.delete()`. */
|
|
7392
|
+
async deleteBranding() {
|
|
7393
|
+
await this.branding.delete();
|
|
7022
7394
|
}
|
|
7023
7395
|
};
|
|
7024
7396
|
|
|
7025
7397
|
// src/resources/usage.ts
|
|
7026
|
-
function
|
|
7398
|
+
function unwrap44(payload) {
|
|
7027
7399
|
if (payload && typeof payload === "object") {
|
|
7028
7400
|
const p = payload;
|
|
7029
7401
|
for (const k of ["data", "usage", "sessions", "summary", "items"]) {
|
|
@@ -7032,7 +7404,7 @@ function unwrap42(payload) {
|
|
|
7032
7404
|
}
|
|
7033
7405
|
return payload;
|
|
7034
7406
|
}
|
|
7035
|
-
function
|
|
7407
|
+
function stripUndefined25(input) {
|
|
7036
7408
|
return Object.fromEntries(
|
|
7037
7409
|
Object.entries(input).filter(([, v]) => v !== void 0)
|
|
7038
7410
|
);
|
|
@@ -7045,24 +7417,24 @@ var Usage = class {
|
|
|
7045
7417
|
/** Get the current period usage summary. */
|
|
7046
7418
|
async current() {
|
|
7047
7419
|
const data = await this.http.get("/usage/summary");
|
|
7048
|
-
return
|
|
7420
|
+
return unwrap44(data);
|
|
7049
7421
|
}
|
|
7050
7422
|
/** List per-session metering events. */
|
|
7051
7423
|
async sessions(params = {}) {
|
|
7052
|
-
const query =
|
|
7424
|
+
const query = stripUndefined25(params);
|
|
7053
7425
|
const data = await this.http.get("/usage/sessions", query);
|
|
7054
|
-
const result =
|
|
7426
|
+
const result = unwrap44(data);
|
|
7055
7427
|
if (Array.isArray(result)) return result;
|
|
7056
7428
|
return [];
|
|
7057
7429
|
}
|
|
7058
7430
|
/** Get a usage report for a period. */
|
|
7059
7431
|
async report(params = {}) {
|
|
7060
|
-
const query =
|
|
7432
|
+
const query = stripUndefined25(params);
|
|
7061
7433
|
const data = await this.http.get("/usage/summary", query);
|
|
7062
|
-
return
|
|
7434
|
+
return unwrap44(data);
|
|
7063
7435
|
}
|
|
7064
7436
|
};
|
|
7065
|
-
function
|
|
7437
|
+
function unwrap45(payload) {
|
|
7066
7438
|
if (payload && typeof payload === "object" && "data" in payload) {
|
|
7067
7439
|
return payload.data;
|
|
7068
7440
|
}
|
|
@@ -7078,7 +7450,7 @@ function listItems15(payload, candidateKeys = ["data", "volumes", "items"]) {
|
|
|
7078
7450
|
}
|
|
7079
7451
|
return [];
|
|
7080
7452
|
}
|
|
7081
|
-
function
|
|
7453
|
+
function stripUndefined26(input) {
|
|
7082
7454
|
return Object.fromEntries(
|
|
7083
7455
|
Object.entries(input).filter(([, v]) => v !== void 0)
|
|
7084
7456
|
);
|
|
@@ -7092,32 +7464,32 @@ var Volumes = class {
|
|
|
7092
7464
|
}
|
|
7093
7465
|
http;
|
|
7094
7466
|
async list(params = {}) {
|
|
7095
|
-
const query =
|
|
7467
|
+
const query = stripUndefined26({ ...params });
|
|
7096
7468
|
const data = await this.http.get("/volumes", query);
|
|
7097
7469
|
return listItems15(data);
|
|
7098
7470
|
}
|
|
7099
7471
|
async get(volumeId) {
|
|
7100
7472
|
const data = await this.http.get(`/volumes/${volumeId}`);
|
|
7101
|
-
return
|
|
7473
|
+
return unwrap45(data);
|
|
7102
7474
|
}
|
|
7103
7475
|
async create(params) {
|
|
7104
7476
|
const { idempotencyKey: ikey, sizeGb, ...rest } = params;
|
|
7105
|
-
const
|
|
7477
|
+
const body2 = stripUndefined26({
|
|
7106
7478
|
...rest,
|
|
7107
7479
|
size_gb: sizeGb ?? rest.size_gb
|
|
7108
7480
|
});
|
|
7109
7481
|
const data = await this.http.request("/volumes", {
|
|
7110
7482
|
method: "POST",
|
|
7111
|
-
body,
|
|
7483
|
+
body: body2,
|
|
7112
7484
|
headers: { "Idempotency-Key": idempotencyKey9(ikey) }
|
|
7113
7485
|
});
|
|
7114
|
-
return
|
|
7486
|
+
return unwrap45(data);
|
|
7115
7487
|
}
|
|
7116
7488
|
async delete(volumeId) {
|
|
7117
7489
|
await this.http.delete(`/volumes/${volumeId}`);
|
|
7118
7490
|
}
|
|
7119
7491
|
};
|
|
7120
|
-
function
|
|
7492
|
+
function unwrap46(payload) {
|
|
7121
7493
|
if (payload && typeof payload === "object" && "data" in payload) {
|
|
7122
7494
|
return payload.data;
|
|
7123
7495
|
}
|
|
@@ -7133,7 +7505,7 @@ function listItems16(payload, candidateKeys = ["data", "webhooks", "deliveries",
|
|
|
7133
7505
|
}
|
|
7134
7506
|
return [];
|
|
7135
7507
|
}
|
|
7136
|
-
function
|
|
7508
|
+
function stripUndefined27(input) {
|
|
7137
7509
|
return Object.fromEntries(
|
|
7138
7510
|
Object.entries(input).filter(([, v]) => v !== void 0)
|
|
7139
7511
|
);
|
|
@@ -7141,34 +7513,65 @@ function stripUndefined26(input) {
|
|
|
7141
7513
|
function idempotencyKey10(key) {
|
|
7142
7514
|
return key ?? randomUUID();
|
|
7143
7515
|
}
|
|
7516
|
+
function bodyBuffer(body2) {
|
|
7517
|
+
if (Buffer.isBuffer(body2)) return body2;
|
|
7518
|
+
if (typeof body2 === "string") return Buffer.from(body2, "utf8");
|
|
7519
|
+
return Buffer.from(body2);
|
|
7520
|
+
}
|
|
7521
|
+
function verifySignature(body2, header, secret, toleranceSec = 300) {
|
|
7522
|
+
const parts = Object.fromEntries(
|
|
7523
|
+
header.split(",").map((chunk) => chunk.split("=", 2)).filter(([key, value]) => key && value)
|
|
7524
|
+
);
|
|
7525
|
+
const timestamp = parts.t;
|
|
7526
|
+
const received = parts.v1;
|
|
7527
|
+
if (!timestamp || !received || !secret) return false;
|
|
7528
|
+
const unixSeconds = Number(timestamp);
|
|
7529
|
+
if (!Number.isFinite(unixSeconds)) return false;
|
|
7530
|
+
const ageSec = Math.abs(Date.now() / 1e3 - unixSeconds);
|
|
7531
|
+
if (ageSec > toleranceSec) {
|
|
7532
|
+
throw new Error("webhook timestamp too old");
|
|
7533
|
+
}
|
|
7534
|
+
const rawBody = bodyBuffer(body2);
|
|
7535
|
+
const signed = Buffer.concat([Buffer.from(`${timestamp}.`), rawBody]);
|
|
7536
|
+
const expected = createHmac("sha256", secret).update(signed).digest("hex");
|
|
7537
|
+
try {
|
|
7538
|
+
return timingSafeEqual(
|
|
7539
|
+
Buffer.from(expected, "utf8"),
|
|
7540
|
+
Buffer.from(received, "utf8")
|
|
7541
|
+
);
|
|
7542
|
+
} catch {
|
|
7543
|
+
return false;
|
|
7544
|
+
}
|
|
7545
|
+
}
|
|
7144
7546
|
var Webhooks = class {
|
|
7145
7547
|
constructor(http) {
|
|
7146
7548
|
this.http = http;
|
|
7147
7549
|
}
|
|
7148
7550
|
http;
|
|
7551
|
+
static verifySignature = verifySignature;
|
|
7149
7552
|
async list(params = {}) {
|
|
7150
|
-
const query =
|
|
7553
|
+
const query = stripUndefined27({ ...params });
|
|
7151
7554
|
const data = await this.http.get("/webhooks", query);
|
|
7152
7555
|
return listItems16(data);
|
|
7153
7556
|
}
|
|
7154
7557
|
async get(webhookId) {
|
|
7155
7558
|
const data = await this.http.get(`/webhooks/${webhookId}`);
|
|
7156
|
-
return
|
|
7559
|
+
return unwrap46(data);
|
|
7157
7560
|
}
|
|
7158
7561
|
async create(params) {
|
|
7159
7562
|
const { idempotencyKey: ikey, ...rest } = params;
|
|
7160
|
-
const
|
|
7563
|
+
const body2 = stripUndefined27(rest);
|
|
7161
7564
|
const data = await this.http.request("/webhooks", {
|
|
7162
7565
|
method: "POST",
|
|
7163
|
-
body,
|
|
7566
|
+
body: body2,
|
|
7164
7567
|
headers: { "Idempotency-Key": idempotencyKey10(ikey) }
|
|
7165
7568
|
});
|
|
7166
|
-
return
|
|
7569
|
+
return unwrap46(data);
|
|
7167
7570
|
}
|
|
7168
7571
|
async update(webhookId, params) {
|
|
7169
|
-
const
|
|
7170
|
-
const data = await this.http.patch(`/webhooks/${webhookId}`,
|
|
7171
|
-
return
|
|
7572
|
+
const body2 = stripUndefined27(params);
|
|
7573
|
+
const data = await this.http.patch(`/webhooks/${webhookId}`, body2);
|
|
7574
|
+
return unwrap46(data);
|
|
7172
7575
|
}
|
|
7173
7576
|
async delete(webhookId) {
|
|
7174
7577
|
await this.http.delete(`/webhooks/${webhookId}`);
|
|
@@ -7181,7 +7584,7 @@ var Webhooks = class {
|
|
|
7181
7584
|
headers: { "Idempotency-Key": idempotencyKey10(opts.idempotencyKey) }
|
|
7182
7585
|
}
|
|
7183
7586
|
);
|
|
7184
|
-
return
|
|
7587
|
+
return unwrap46(data);
|
|
7185
7588
|
}
|
|
7186
7589
|
async deliveries(webhookId) {
|
|
7187
7590
|
const data = await this.http.get(
|
|
@@ -7352,8 +7755,6 @@ var DEFAULT_MAX_RETRIES2 = 3;
|
|
|
7352
7755
|
var Miosa = class {
|
|
7353
7756
|
/** Per-workspace user roster — list, add, update role, remove. */
|
|
7354
7757
|
workspaceMembers;
|
|
7355
|
-
/** Target-agnostic prompt dispatch to sandboxes/computers with durable records. */
|
|
7356
|
-
agentRuns;
|
|
7357
7758
|
/**
|
|
7358
7759
|
* Workspace invite flow — create invite, list, revoke, preview, accept.
|
|
7359
7760
|
* Sending to an email already in the org adds the user directly.
|
|
@@ -7390,6 +7791,10 @@ var Miosa = class {
|
|
|
7390
7791
|
externalKeys;
|
|
7391
7792
|
/** Model Context Protocol — JSON-RPC dispatch + streaming channel. */
|
|
7392
7793
|
mcp;
|
|
7794
|
+
/** Agent Runs — prompt dispatch into sandbox targets. */
|
|
7795
|
+
agentRuns;
|
|
7796
|
+
/** Agent runtime profiles — tenant/workspace defaults for sandbox/computer agents. */
|
|
7797
|
+
agentRuntimeProfiles;
|
|
7393
7798
|
/** Computer management — create, list, get, delete. */
|
|
7394
7799
|
computers;
|
|
7395
7800
|
/** Sandboxes — native code-execution environments under `/sandboxes`. */
|
|
@@ -7476,7 +7881,6 @@ var Miosa = class {
|
|
|
7476
7881
|
timeout: config.timeout ?? DEFAULT_TIMEOUT2,
|
|
7477
7882
|
maxRetries: config.maxRetries ?? DEFAULT_MAX_RETRIES2
|
|
7478
7883
|
});
|
|
7479
|
-
this.agentRuns = new AgentRuns(this.http);
|
|
7480
7884
|
this.workspaceMembers = new WorkspaceMembers(this.http);
|
|
7481
7885
|
this.workspaceInvites = new WorkspaceInvites(this.http);
|
|
7482
7886
|
this.orgInvites = new OrgInvites(this.http);
|
|
@@ -7493,6 +7897,8 @@ var Miosa = class {
|
|
|
7493
7897
|
this.projectAuth = new ProjectAuth(this.http);
|
|
7494
7898
|
this.externalKeys = new ExternalKeys(this.http);
|
|
7495
7899
|
this.mcp = new Mcp(this.http);
|
|
7900
|
+
this.agentRuns = new AgentRuns(this.http);
|
|
7901
|
+
this.agentRuntimeProfiles = new AgentRuntimeProfiles(this.http);
|
|
7496
7902
|
this.computers = new Computers(this.http);
|
|
7497
7903
|
this.sandboxes = new Sandboxes(this.http);
|
|
7498
7904
|
this.deployments = new Deployments(this.http);
|
|
@@ -7614,8 +8020,8 @@ var AppAuth = class {
|
|
|
7614
8020
|
}
|
|
7615
8021
|
});
|
|
7616
8022
|
if (!resp.ok) {
|
|
7617
|
-
const
|
|
7618
|
-
throw new Error(`AppAuth me failed (${resp.status}): ${
|
|
8023
|
+
const body2 = await resp.text();
|
|
8024
|
+
throw new Error(`AppAuth me failed (${resp.status}): ${body2}`);
|
|
7619
8025
|
}
|
|
7620
8026
|
return unwrapSession(await resp.json());
|
|
7621
8027
|
}
|
|
@@ -7667,12 +8073,12 @@ var AppAuth = class {
|
|
|
7667
8073
|
return payload;
|
|
7668
8074
|
}
|
|
7669
8075
|
// ── Private ──────────────────────────────────────────────────────────────────
|
|
7670
|
-
async _post(action,
|
|
8076
|
+
async _post(action, body2) {
|
|
7671
8077
|
const url = `${this.baseUrl}/app-auth/${this.resourceType}/${this.resourceId}/${action}`;
|
|
7672
8078
|
const resp = await fetch(url, {
|
|
7673
8079
|
method: "POST",
|
|
7674
8080
|
headers: { "Content-Type": "application/json" },
|
|
7675
|
-
body: JSON.stringify(
|
|
8081
|
+
body: JSON.stringify(body2)
|
|
7676
8082
|
});
|
|
7677
8083
|
if (!resp.ok) {
|
|
7678
8084
|
const text = await resp.text();
|
|
@@ -7682,6 +8088,6 @@ var AppAuth = class {
|
|
|
7682
8088
|
}
|
|
7683
8089
|
};
|
|
7684
8090
|
|
|
7685
|
-
export { Admin, AgentRuns, Analytics, ApiKeys, AppAuth, AuditLog, AuthError, Benchmarks, BuilderSessions, Channels, Checkpoints, CommandCenter, Community, Completions, Computer, ComputerAudit, ComputerAutoStop, ComputerEnv, ComputerInbox, ComputerLogs, ComputerNetwork, ComputerOsa, ComputerPorts, ComputerSecrets, ComputerTerminal, ComputerVolumes, Computers, Credits, CronJobs, Dashboard, Databases, DeploymentDomains, DeploymentReleases, DeploymentRuntimeInstances, DeploymentVersions, Deployments, Desktop, DockerDeploy, EgressAudit, EgressNetwork, EgressSecrets, Email, EmailCampaigns, EmailInbox, EmailTemplates, Embeddings, Exec, ExternalKeys, Files, FlatCustomDomains, Functions, HealthChecks, InsufficientCreditsError, Integrations, Mcp, Miosa, MiosaError, Models, NetworkError, NetworkPolicy, NotFoundError, OAuthFlow, OpenComputers, OrgInvites, ProjectAuth, ProjectIntegrations, ProviderDefaults, RateLimitError, Regions, SANDBOX_TEMPLATE, Sandbox, SandboxArtifacts, SandboxAudit, SandboxCommands, SandboxEnv, SandboxEvents, SandboxFiles, SandboxNetwork, SandboxPreview, SandboxPreviews, SandboxSecrets, SandboxTags, SandboxTemplates, SandboxTerminal, Sandboxes, ScopedFs, Settings, SnapshotsStandalone, Storage, Tenant, TimeoutError, Usage, ValidationError, Volumes, Webhooks, WorkspaceInvites, WorkspaceMembers };
|
|
8091
|
+
export { Admin, AgentRuns, AgentRuntimeProfiles, Analytics, ApiKeys, AppAuth, AuditLog, AuthError, Benchmarks, BuilderSessions, Channels, Checkpoints, CommandCenter, Community, Completions, Computer, ComputerAudit, ComputerAutoStop, ComputerEnv, ComputerInbox, ComputerLogs, ComputerNetwork, ComputerOsa, ComputerPorts, ComputerSecrets, ComputerTerminal, ComputerVolumes, Computers, Credits, CronJobs, Dashboard, Databases, DeploymentDomains, DeploymentReleases, DeploymentRuntimeInstances, DeploymentVersions, Deployments, Desktop, DockerDeploy, EgressAudit, EgressNetwork, EgressSecrets, Email, EmailCampaigns, EmailInbox, EmailTemplates, Embeddings, Exec, ExternalKeys, Files, FlatCustomDomains, Functions, HealthChecks, InsufficientCreditsError, Integrations, Mcp, Miosa, MiosaError, Models, NetworkError, NetworkPolicy, NotFoundError, OAuthFlow, OpenComputers, OrgInvites, ProjectAuth, ProjectIntegrations, ProviderDefaults, RateLimitError, Regions, SANDBOX_TEMPLATE, Sandbox, SandboxArtifacts, SandboxAudit, SandboxCommands, SandboxEnv, SandboxEvents, SandboxFiles, SandboxNetwork, SandboxPreview, SandboxPreviews, SandboxSecrets, SandboxTags, SandboxTemplates, SandboxTerminal, Sandboxes, ScopedFs, Settings, SnapshotsStandalone, Storage, Tenant, TimeoutError, Usage, ValidationError, Volumes, Webhooks, WorkspaceInvites, WorkspaceMembers, verifySignature };
|
|
7686
8092
|
//# sourceMappingURL=index.js.map
|
|
7687
8093
|
//# sourceMappingURL=index.js.map
|