codai-sdk 0.68.0 → 0.70.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1629 -314
- package/dist/index.js +362 -191
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/http.ts
|
|
2
2
|
var CodaiError = class extends Error {
|
|
3
3
|
status;
|
|
4
4
|
body;
|
|
@@ -258,16 +258,14 @@ function sleep(ms) {
|
|
|
258
258
|
return new Promise((r) => setTimeout(r, ms));
|
|
259
259
|
}
|
|
260
260
|
|
|
261
|
-
|
|
262
|
-
//#region src/resources/_shared.ts
|
|
261
|
+
// src/resources/_shared.ts
|
|
263
262
|
function stripUndefined(obj) {
|
|
264
263
|
const out = {};
|
|
265
264
|
for (const [k, v] of Object.entries(obj)) if (v !== void 0) out[k] = v;
|
|
266
265
|
return out;
|
|
267
266
|
}
|
|
268
267
|
|
|
269
|
-
|
|
270
|
-
//#region src/resources/account.ts
|
|
268
|
+
// src/resources/account.ts
|
|
271
269
|
var Account = class {
|
|
272
270
|
http;
|
|
273
271
|
constructor(http) {
|
|
@@ -341,8 +339,7 @@ var PhoneModels = class {
|
|
|
341
339
|
}
|
|
342
340
|
};
|
|
343
341
|
|
|
344
|
-
|
|
345
|
-
//#region src/resources/agents.ts
|
|
342
|
+
// src/resources/agents.ts
|
|
346
343
|
/** `/v1/agents/*` — synchronous runs and the persisted async run lifecycle. */
|
|
347
344
|
var AgentRuns = class {
|
|
348
345
|
http;
|
|
@@ -436,8 +433,7 @@ var Agents = class {
|
|
|
436
433
|
}
|
|
437
434
|
};
|
|
438
435
|
|
|
439
|
-
|
|
440
|
-
//#region src/resources/audio.ts
|
|
436
|
+
// src/resources/audio.ts
|
|
441
437
|
/** `POST /v1/audio/transcriptions`, `POST /v1/audio/speech` and `POST /v1/audio/speech/stream`. */
|
|
442
438
|
function base64ToBytes$1(b64) {
|
|
443
439
|
const bin = atob(b64);
|
|
@@ -564,8 +560,7 @@ var Audio = class {
|
|
|
564
560
|
}
|
|
565
561
|
};
|
|
566
562
|
|
|
567
|
-
|
|
568
|
-
//#region src/resources/billing.ts
|
|
563
|
+
// src/resources/billing.ts
|
|
569
564
|
var Billing = class {
|
|
570
565
|
http;
|
|
571
566
|
constructor(http) {
|
|
@@ -637,8 +632,7 @@ var Billing = class {
|
|
|
637
632
|
}
|
|
638
633
|
};
|
|
639
634
|
|
|
640
|
-
|
|
641
|
-
//#region src/resources/cards.ts
|
|
635
|
+
// src/resources/cards.ts
|
|
642
636
|
var Cards = class {
|
|
643
637
|
http;
|
|
644
638
|
constructor(http) {
|
|
@@ -765,8 +759,7 @@ var Cards = class {
|
|
|
765
759
|
}
|
|
766
760
|
};
|
|
767
761
|
|
|
768
|
-
|
|
769
|
-
//#region src/resources/chat.ts
|
|
762
|
+
// src/resources/chat.ts
|
|
770
763
|
/** `POST /v1/chat/completions` — OpenAI-compatible completions (JSON + SSE). */
|
|
771
764
|
function toUsage(u) {
|
|
772
765
|
if (!u) return null;
|
|
@@ -905,8 +898,7 @@ var Chat = class {
|
|
|
905
898
|
}
|
|
906
899
|
};
|
|
907
900
|
|
|
908
|
-
|
|
909
|
-
//#region src/resources/devices.ts
|
|
901
|
+
// src/resources/devices.ts
|
|
910
902
|
var Devices = class {
|
|
911
903
|
http;
|
|
912
904
|
constructor(http) {
|
|
@@ -960,8 +952,7 @@ var Devices = class {
|
|
|
960
952
|
}
|
|
961
953
|
};
|
|
962
954
|
|
|
963
|
-
|
|
964
|
-
//#region src/resources/embeddings.ts
|
|
955
|
+
// src/resources/embeddings.ts
|
|
965
956
|
var Embeddings = class {
|
|
966
957
|
http;
|
|
967
958
|
constructor(http) {
|
|
@@ -987,8 +978,7 @@ var Embeddings = class {
|
|
|
987
978
|
}
|
|
988
979
|
};
|
|
989
980
|
|
|
990
|
-
|
|
991
|
-
//#region src/resources/environments.ts
|
|
981
|
+
// src/resources/environments.ts
|
|
992
982
|
const envPath = (id, suffix = "") => `/v1/environments/${encodeURIComponent(id)}${suffix}`;
|
|
993
983
|
/** Absolute environment path → `/files/<each segment URL-encoded>`. */
|
|
994
984
|
const filePath$1 = (path) => path.replace(/^\/+/, "").split("/").map((s) => encodeURIComponent(s)).join("/");
|
|
@@ -1332,8 +1322,7 @@ var Environments = class {
|
|
|
1332
1322
|
}
|
|
1333
1323
|
};
|
|
1334
1324
|
|
|
1335
|
-
|
|
1336
|
-
//#region src/resources/health.ts
|
|
1325
|
+
// src/resources/health.ts
|
|
1337
1326
|
var Health = class {
|
|
1338
1327
|
http;
|
|
1339
1328
|
constructor(http) {
|
|
@@ -1370,8 +1359,7 @@ var Health = class {
|
|
|
1370
1359
|
}
|
|
1371
1360
|
};
|
|
1372
1361
|
|
|
1373
|
-
|
|
1374
|
-
//#region src/resources/hosts.ts
|
|
1362
|
+
// src/resources/hosts.ts
|
|
1375
1363
|
/** `/v1/hosts/*` — host relay (desktop announces itself; clients exec ops on it). */
|
|
1376
1364
|
var Hosts = class {
|
|
1377
1365
|
http;
|
|
@@ -1438,8 +1426,7 @@ var Hosts = class {
|
|
|
1438
1426
|
}
|
|
1439
1427
|
};
|
|
1440
1428
|
|
|
1441
|
-
|
|
1442
|
-
//#region src/resources/assets.ts
|
|
1429
|
+
// src/resources/assets.ts
|
|
1443
1430
|
/** True for a `data` item that is a stored asset rather than inline base64. */
|
|
1444
1431
|
function isAssetDto(item) {
|
|
1445
1432
|
return typeof item === "object" && item !== null && "asset_id" in item;
|
|
@@ -1514,8 +1501,7 @@ var Assets = class {
|
|
|
1514
1501
|
}
|
|
1515
1502
|
};
|
|
1516
1503
|
|
|
1517
|
-
|
|
1518
|
-
//#region src/resources/images.ts
|
|
1504
|
+
// src/resources/images.ts
|
|
1519
1505
|
/** Image generation typically takes 5–30 s; the gateway allows 120 s upstream. */
|
|
1520
1506
|
const MIN_IMAGE_TIMEOUT_MS = 15e4;
|
|
1521
1507
|
function decodeBase64$1(b64) {
|
|
@@ -1573,8 +1559,7 @@ var Images = class {
|
|
|
1573
1559
|
}
|
|
1574
1560
|
};
|
|
1575
1561
|
|
|
1576
|
-
|
|
1577
|
-
//#region src/resources/media.ts
|
|
1562
|
+
// src/resources/media.ts
|
|
1578
1563
|
/** Lyria 3 Pro can take minutes for a long song; the gateway allows 240 s upstream (+ lyrics check). */
|
|
1579
1564
|
const MIN_MUSIC_TIMEOUT_MS = 3e5;
|
|
1580
1565
|
function decodeBase64(b64) {
|
|
@@ -1583,7 +1568,7 @@ function decodeBase64(b64) {
|
|
|
1583
1568
|
for (let i = 0; i < bin.length; i++) out[i] = bin.charCodeAt(i);
|
|
1584
1569
|
return out;
|
|
1585
1570
|
}
|
|
1586
|
-
function abortableSleep$
|
|
1571
|
+
function abortableSleep$8(ms, signal) {
|
|
1587
1572
|
return new Promise((resolve, reject) => {
|
|
1588
1573
|
if (signal?.aborted) return reject(signal.reason ?? /* @__PURE__ */ new Error("Aborted"));
|
|
1589
1574
|
const t = setTimeout(() => {
|
|
@@ -1698,7 +1683,7 @@ var Videos = class {
|
|
|
1698
1683
|
}
|
|
1699
1684
|
if (st.status === "failed" || st.status === "filtered") throw new Error(`codai video job ${st.status}: ${st.error ?? "no details"}`);
|
|
1700
1685
|
if (Date.now() + pollIntervalMs > deadline) throw new Error(`codai video job ${job.id} did not finish within ${timeoutMs} ms`);
|
|
1701
|
-
await abortableSleep$
|
|
1686
|
+
await abortableSleep$8(pollIntervalMs, signal);
|
|
1702
1687
|
}
|
|
1703
1688
|
}
|
|
1704
1689
|
};
|
|
@@ -1797,14 +1782,13 @@ var Renders = class {
|
|
|
1797
1782
|
}
|
|
1798
1783
|
if (st.status === "failed") throw new Error(`codai render failed: ${st.error ?? "no details"}`);
|
|
1799
1784
|
if (Date.now() + pollIntervalMs > deadline) throw new Error(`codai render ${job.id} did not finish within ${timeoutMs} ms`);
|
|
1800
|
-
await abortableSleep$
|
|
1785
|
+
await abortableSleep$8(pollIntervalMs, signal);
|
|
1801
1786
|
}
|
|
1802
1787
|
}
|
|
1803
1788
|
};
|
|
1804
1789
|
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
function abortableSleep$6(ms, signal) {
|
|
1790
|
+
// src/resources/documents.ts
|
|
1791
|
+
function abortableSleep$7(ms, signal) {
|
|
1808
1792
|
return new Promise((resolve, reject) => {
|
|
1809
1793
|
if (signal?.aborted) return reject(signal.reason ?? /* @__PURE__ */ new Error("Aborted"));
|
|
1810
1794
|
const t = setTimeout(() => {
|
|
@@ -1897,7 +1881,7 @@ var Documents = class {
|
|
|
1897
1881
|
if (st.status === "succeeded") return st;
|
|
1898
1882
|
if (st.status === "failed") throw new Error(`codai document preview failed: ${st.error ?? "no details"}`);
|
|
1899
1883
|
if (Date.now() + pollIntervalMs > deadline) throw new Error(`codai document preview ${job.id} did not finish within ${timeoutMs} ms`);
|
|
1900
|
-
await abortableSleep$
|
|
1884
|
+
await abortableSleep$7(pollIntervalMs, signal);
|
|
1901
1885
|
}
|
|
1902
1886
|
}
|
|
1903
1887
|
/** Queue a deck video and poll `renders.retrieve` until it succeeds. Throws on `failed` or timeout. */
|
|
@@ -1929,15 +1913,14 @@ var Documents = class {
|
|
|
1929
1913
|
}
|
|
1930
1914
|
if (st.status === "failed") throw new Error(`codai deck video failed: ${st.error ?? "no details"}`);
|
|
1931
1915
|
if (Date.now() + pollIntervalMs > deadline) throw new Error(`codai deck video ${accepted.id} did not finish within ${timeoutMs} ms`);
|
|
1932
|
-
await abortableSleep$
|
|
1916
|
+
await abortableSleep$7(pollIntervalMs, signal);
|
|
1933
1917
|
}
|
|
1934
1918
|
}
|
|
1935
1919
|
};
|
|
1936
1920
|
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
function abortableSleep$5(ms, signal) {
|
|
1921
|
+
// src/resources/exports.ts
|
|
1922
|
+
const path$7 = (id) => `/v1/studio/exports/${encodeURIComponent(id)}`;
|
|
1923
|
+
function abortableSleep$6(ms, signal) {
|
|
1941
1924
|
return new Promise((resolve, reject) => {
|
|
1942
1925
|
if (signal?.aborted) return reject(signal.reason ?? /* @__PURE__ */ new Error("Aborted"));
|
|
1943
1926
|
const t = setTimeout(() => {
|
|
@@ -1958,7 +1941,7 @@ var Exports = class {
|
|
|
1958
1941
|
}
|
|
1959
1942
|
/** The export: `queued` / `running`, then `succeeded` (signed `url`, valid 1 h) or `failed` (`error`). Free. */
|
|
1960
1943
|
retrieve(id, opts = {}) {
|
|
1961
|
-
return this.http.json(path$
|
|
1944
|
+
return this.http.json(path$7(id), {
|
|
1962
1945
|
ext: opts.ext,
|
|
1963
1946
|
signal: opts.signal
|
|
1964
1947
|
});
|
|
@@ -1978,14 +1961,15 @@ var Exports = class {
|
|
|
1978
1961
|
});
|
|
1979
1962
|
if (st.status === "succeeded" || st.status === "failed") return st;
|
|
1980
1963
|
if (Date.now() + intervalMs > deadline) throw new Error(`codai export ${id} did not finish within ${timeoutMs} ms`);
|
|
1981
|
-
await abortableSleep$
|
|
1964
|
+
await abortableSleep$6(intervalMs, signal);
|
|
1982
1965
|
}
|
|
1983
1966
|
}
|
|
1984
1967
|
};
|
|
1985
1968
|
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
const
|
|
1969
|
+
// src/resources/creatives.ts
|
|
1970
|
+
/** True when a `build` answer is the 202 carousel / print export job (poll `exports.wait(r.export.id)`). */
|
|
1971
|
+
const isPagedBuild = (r) => "export" in r && r.export != null;
|
|
1972
|
+
const path$6 = (id, tail = "") => `/v1/studio/creatives/${encodeURIComponent(id)}${tail}`;
|
|
1989
1973
|
const lottieQuery = (q) => ({
|
|
1990
1974
|
format: q.format,
|
|
1991
1975
|
formats: q.formats,
|
|
@@ -2025,7 +2009,7 @@ var Creatives = class {
|
|
|
2025
2009
|
}
|
|
2026
2010
|
/** The document at the head (or `seq`) with signed `assets` (1 h URLs). */
|
|
2027
2011
|
retrieve(id, query = {}, opts = {}) {
|
|
2028
|
-
return this.http.json(path$
|
|
2012
|
+
return this.http.json(path$6(id), {
|
|
2029
2013
|
query: { seq: query.seq },
|
|
2030
2014
|
ext: opts.ext,
|
|
2031
2015
|
signal: opts.signal
|
|
@@ -2033,14 +2017,14 @@ var Creatives = class {
|
|
|
2033
2017
|
}
|
|
2034
2018
|
/** Compact text outline (+ formats and vars) — the cheapest structure for a prompt. */
|
|
2035
2019
|
outline(id, opts = {}) {
|
|
2036
|
-
return this.http.json(path$
|
|
2020
|
+
return this.http.json(path$6(id, "/outline"), {
|
|
2037
2021
|
ext: opts.ext,
|
|
2038
2022
|
signal: opts.signal
|
|
2039
2023
|
});
|
|
2040
2024
|
}
|
|
2041
2025
|
/** Node ids matching `query` (a string = text/name/id substring, or `{ text, type, sceneId, assetId, locked }`). */
|
|
2042
2026
|
find(id, query, opts = {}) {
|
|
2043
|
-
return this.http.json(path$
|
|
2027
|
+
return this.http.json(path$6(id, "/find"), {
|
|
2044
2028
|
method: "POST",
|
|
2045
2029
|
body: { query },
|
|
2046
2030
|
ext: opts.ext,
|
|
@@ -2049,7 +2033,7 @@ var Creatives = class {
|
|
|
2049
2033
|
}
|
|
2050
2034
|
/** Full JSON of `ids` (scene ids return whole scenes) or of one `sceneId`. */
|
|
2051
2035
|
subtree(id, body, opts = {}) {
|
|
2052
|
-
return this.http.json(path$
|
|
2036
|
+
return this.http.json(path$6(id, "/subtree"), {
|
|
2053
2037
|
method: "POST",
|
|
2054
2038
|
body,
|
|
2055
2039
|
ext: opts.ext,
|
|
@@ -2062,7 +2046,7 @@ var Creatives = class {
|
|
|
2062
2046
|
* ops throw 400 with `code` (`invalid`, `not_found`, `locked`, `duplicate_id`).
|
|
2063
2047
|
*/
|
|
2064
2048
|
edit(id, body, opts = {}) {
|
|
2065
|
-
return this.http.json(path$
|
|
2049
|
+
return this.http.json(path$6(id, "/ops"), {
|
|
2066
2050
|
method: "POST",
|
|
2067
2051
|
body: {
|
|
2068
2052
|
base_seq: body.baseSeq,
|
|
@@ -2078,7 +2062,7 @@ var Creatives = class {
|
|
|
2078
2062
|
}
|
|
2079
2063
|
/** Version history, newest first (`beforeSeq` pages). */
|
|
2080
2064
|
versions(id, query = {}, opts = {}) {
|
|
2081
|
-
return this.http.json(path$
|
|
2065
|
+
return this.http.json(path$6(id, "/versions"), {
|
|
2082
2066
|
query: {
|
|
2083
2067
|
before_seq: query.beforeSeq,
|
|
2084
2068
|
limit: query.limit
|
|
@@ -2089,7 +2073,7 @@ var Creatives = class {
|
|
|
2089
2073
|
}
|
|
2090
2074
|
/** New head whose document is version `seq`'s (undo / redo). */
|
|
2091
2075
|
revert(id, seq, opts = {}) {
|
|
2092
|
-
return this.http.json(path$
|
|
2076
|
+
return this.http.json(path$6(id, "/revert"), {
|
|
2093
2077
|
method: "POST",
|
|
2094
2078
|
body: { seq },
|
|
2095
2079
|
ext: opts.ext,
|
|
@@ -2099,7 +2083,7 @@ var Creatives = class {
|
|
|
2099
2083
|
}
|
|
2100
2084
|
/** New creative from version `seq` (default the head). */
|
|
2101
2085
|
fork(id, body = {}, opts = {}) {
|
|
2102
|
-
return this.http.json(path$
|
|
2086
|
+
return this.http.json(path$6(id, "/fork"), {
|
|
2103
2087
|
method: "POST",
|
|
2104
2088
|
body,
|
|
2105
2089
|
ext: opts.ext,
|
|
@@ -2109,7 +2093,7 @@ var Creatives = class {
|
|
|
2109
2093
|
}
|
|
2110
2094
|
/** Soft-delete the creative. */
|
|
2111
2095
|
delete(id, opts = {}) {
|
|
2112
|
-
return this.http.json(path$
|
|
2096
|
+
return this.http.json(path$6(id), {
|
|
2113
2097
|
method: "DELETE",
|
|
2114
2098
|
ext: opts.ext,
|
|
2115
2099
|
signal: opts.signal
|
|
@@ -2122,7 +2106,7 @@ var Creatives = class {
|
|
|
2122
2106
|
* `text_overflow_locale`); 404 `Locale not found.` for an unknown locale.
|
|
2123
2107
|
*/
|
|
2124
2108
|
lint(id, body = {}, opts = {}) {
|
|
2125
|
-
return this.http.json(path$
|
|
2109
|
+
return this.http.json(path$6(id, "/lint"), {
|
|
2126
2110
|
method: "POST",
|
|
2127
2111
|
...body.locale !== void 0 ? { body: { locale: body.locale } } : {},
|
|
2128
2112
|
ext: opts.ext,
|
|
@@ -2131,7 +2115,7 @@ var Creatives = class {
|
|
|
2131
2115
|
}
|
|
2132
2116
|
/** Preview HTML (signed asset URLs) for `format` / one `scene` / a translation (`locale`). */
|
|
2133
2117
|
compiled(id, query = {}, opts = {}) {
|
|
2134
|
-
return this.http.json(path$
|
|
2118
|
+
return this.http.json(path$6(id, "/compiled"), {
|
|
2135
2119
|
query: {
|
|
2136
2120
|
format: query.format,
|
|
2137
2121
|
scene: query.scene,
|
|
@@ -2150,7 +2134,7 @@ var Creatives = class {
|
|
|
2150
2134
|
* `corner` when the creative uses TTS narration or AI images, else `none` (`none` with narration: 400 `ai_label_required`).
|
|
2151
2135
|
*/
|
|
2152
2136
|
render(id, body = {}, opts = {}) {
|
|
2153
|
-
return this.http.json(path$
|
|
2137
|
+
return this.http.json(path$6(id, "/render"), {
|
|
2154
2138
|
method: "POST",
|
|
2155
2139
|
body,
|
|
2156
2140
|
ext: opts.ext,
|
|
@@ -2167,7 +2151,7 @@ var Creatives = class {
|
|
|
2167
2151
|
* 400 `empty_audio` / `too_long` (20 min) / `no_lyrics`; video creatives use `render`.
|
|
2168
2152
|
*/
|
|
2169
2153
|
renderAudio(id, body = {}, opts = {}) {
|
|
2170
|
-
return this.http.json(path$
|
|
2154
|
+
return this.http.json(path$6(id, "/render"), {
|
|
2171
2155
|
method: "POST",
|
|
2172
2156
|
body,
|
|
2173
2157
|
headers: opts.idempotencyKey ? { "Idempotency-Key": opts.idempotencyKey } : void 0,
|
|
@@ -2183,7 +2167,7 @@ var Creatives = class {
|
|
|
2183
2167
|
* jobs per UTC day are free, then billed (`billed_micro_usd`).
|
|
2184
2168
|
*/
|
|
2185
2169
|
frame(id, body, opts = {}) {
|
|
2186
|
-
return this.http.json(path$
|
|
2170
|
+
return this.http.json(path$6(id, "/frame"), {
|
|
2187
2171
|
method: "POST",
|
|
2188
2172
|
body,
|
|
2189
2173
|
ext: opts.ext,
|
|
@@ -2198,7 +2182,7 @@ var Creatives = class {
|
|
|
2198
2182
|
* Token-metered like any `codai` text call.
|
|
2199
2183
|
*/
|
|
2200
2184
|
comment(id, body, opts = {}) {
|
|
2201
|
-
return this.http.json(path$
|
|
2185
|
+
return this.http.json(path$6(id, "/comments"), {
|
|
2202
2186
|
method: "POST",
|
|
2203
2187
|
body,
|
|
2204
2188
|
ext: opts.ext,
|
|
@@ -2213,7 +2197,7 @@ var Creatives = class {
|
|
|
2213
2197
|
* until `pickVariant`. 422 `no_edit` when no valid variant came back, 504 `timeout` after 90 s. Token-metered.
|
|
2214
2198
|
*/
|
|
2215
2199
|
variants(id, body, opts = {}) {
|
|
2216
|
-
return this.http.json(path$
|
|
2200
|
+
return this.http.json(path$6(id, "/variants"), {
|
|
2217
2201
|
method: "POST",
|
|
2218
2202
|
body,
|
|
2219
2203
|
ext: opts.ext,
|
|
@@ -2223,7 +2207,7 @@ var Creatives = class {
|
|
|
2223
2207
|
}
|
|
2224
2208
|
/** The latest variant group of a creative (`group_id: null` when none) with statuses and stored render state. */
|
|
2225
2209
|
listVariants(id, opts = {}) {
|
|
2226
|
-
return this.http.json(path$
|
|
2210
|
+
return this.http.json(path$6(id, "/variants"), {
|
|
2227
2211
|
ext: opts.ext,
|
|
2228
2212
|
signal: opts.signal
|
|
2229
2213
|
});
|
|
@@ -2233,7 +2217,7 @@ var Creatives = class {
|
|
|
2233
2217
|
* else); the winner is marked `winner`, the rest of its group `rejected`.
|
|
2234
2218
|
*/
|
|
2235
2219
|
pickVariant(id, variantId, body, opts = {}) {
|
|
2236
|
-
return this.http.json(path$
|
|
2220
|
+
return this.http.json(path$6(id, `/variants/${encodeURIComponent(variantId)}/pick`), {
|
|
2237
2221
|
method: "POST",
|
|
2238
2222
|
body,
|
|
2239
2223
|
ext: opts.ext,
|
|
@@ -2247,7 +2231,7 @@ var Creatives = class {
|
|
|
2247
2231
|
* 400 `node_not_found` / `invalid_pick` / `duplicate_key`. Free.
|
|
2248
2232
|
*/
|
|
2249
2233
|
saveTemplate(id, body, opts = {}) {
|
|
2250
|
-
return this.http.json(path$
|
|
2234
|
+
return this.http.json(path$6(id, "/template"), {
|
|
2251
2235
|
method: "POST",
|
|
2252
2236
|
body,
|
|
2253
2237
|
ext: opts.ext,
|
|
@@ -2262,7 +2246,7 @@ var Creatives = class {
|
|
|
2262
2246
|
* rendered seconds are billed (final render price). 400 `unsupported_kind` / `unsupported_format` / `too_long`.
|
|
2263
2247
|
*/
|
|
2264
2248
|
exportFcpxml(id, query = {}, opts = {}) {
|
|
2265
|
-
return this.http.json(path$
|
|
2249
|
+
return this.http.json(path$6(id, "/export.fcpxml"), {
|
|
2266
2250
|
query: {
|
|
2267
2251
|
format: query.format,
|
|
2268
2252
|
seq: query.seq
|
|
@@ -2280,7 +2264,7 @@ var Creatives = class {
|
|
|
2280
2264
|
* 400 `unsupported_kind` / `invalid_request`, 413 `too_large` (over 20 MB).
|
|
2281
2265
|
*/
|
|
2282
2266
|
exportLottie(id, query = {}, opts = {}) {
|
|
2283
|
-
return this.http.json(path$
|
|
2267
|
+
return this.http.json(path$6(id, "/export.lottie"), {
|
|
2284
2268
|
query: lottieQuery(query),
|
|
2285
2269
|
ext: opts.ext,
|
|
2286
2270
|
signal: opts.signal,
|
|
@@ -2292,7 +2276,7 @@ var Creatives = class {
|
|
|
2292
2276
|
* for a dotLottie archive or a zip of JSON files (`formats: 'all'`). Same options and errors as `exportLottie`. Free.
|
|
2293
2277
|
*/
|
|
2294
2278
|
async downloadLottie(id, query = {}, opts = {}) {
|
|
2295
|
-
const res = await this.http.request(path$
|
|
2279
|
+
const res = await this.http.request(path$6(id, "/export.lottie"), {
|
|
2296
2280
|
query: {
|
|
2297
2281
|
...lottieQuery(query),
|
|
2298
2282
|
download: "1"
|
|
@@ -2326,9 +2310,60 @@ var Creatives = class {
|
|
|
2326
2310
|
* Studio document (`document`, exactly the `POST /v1/studio/documents` body). Converter notes come back in
|
|
2327
2311
|
* `warnings`. The file is free; `preview: true` also queues a billed preview (poll it with
|
|
2328
2312
|
* `documents.waitForPreview`). 400 `not_supported_for_kind` (video / image) or `invalid_spec`.
|
|
2313
|
+
*
|
|
2314
|
+
* A carousel (`format: 'png'` zip of slides or `'pdf'`) or print (`'pdf'`, PDF/X-4 with bleed and optional
|
|
2315
|
+
* `crop_marks`) creative answers HTTP 202 with a queued export job in `export` (`format_id` picks the format,
|
|
2316
|
+
* `quote_micro_usd` is held). Tell the two apart with `isPagedBuild`, poll with `exports.wait(r.export.id)` or use
|
|
2317
|
+
* `buildAndWait`.
|
|
2329
2318
|
*/
|
|
2330
2319
|
build(id, body = {}, opts = {}) {
|
|
2331
|
-
return this.http.json(path$
|
|
2320
|
+
return this.http.json(path$6(id, "/build"), {
|
|
2321
|
+
method: "POST",
|
|
2322
|
+
body: stripUndefined(body),
|
|
2323
|
+
ext: opts.ext,
|
|
2324
|
+
signal: opts.signal,
|
|
2325
|
+
noRetry: true
|
|
2326
|
+
});
|
|
2327
|
+
}
|
|
2328
|
+
/**
|
|
2329
|
+
* `build`, then — for a carousel / print creative — poll the export job until it has `succeeded` or `failed`
|
|
2330
|
+
* (`exports.wait`). Resolves to the 200 build for deck / doc / sheet, or to the finished `StudioExport`.
|
|
2331
|
+
*/
|
|
2332
|
+
async buildAndWait(id, body = {}, opts = {}) {
|
|
2333
|
+
const r = await this.build(id, body, {
|
|
2334
|
+
ext: opts.ext,
|
|
2335
|
+
signal: opts.signal
|
|
2336
|
+
});
|
|
2337
|
+
if (!isPagedBuild(r)) return r;
|
|
2338
|
+
const e = r.export;
|
|
2339
|
+
if (e.status === "succeeded" || e.status === "failed") return e;
|
|
2340
|
+
return new Exports(this.http).wait(e.id, opts);
|
|
2341
|
+
}
|
|
2342
|
+
/**
|
|
2343
|
+
* Social post copy for a carousel, image or video creative: a caption + hashtags per platform (`platforms`,
|
|
2344
|
+
* default Instagram + LinkedIn; `language` `ro` (default) | `en`; optional `brief`, `tone`, `seq`) and one alt text
|
|
2345
|
+
* per slide, every answer repaired to the platform's hard limits (changes listed in `fixes`). Nothing is written to
|
|
2346
|
+
* the creative. Token-metered (`cost_micro_usd`) under a small wallet hold (402 `insufficient_funds`); 400
|
|
2347
|
+
* `not_supported_for_kind`, 422 `no_post_copy`, 504 `timeout`. `idempotencyKey` replays a retry (24 h).
|
|
2348
|
+
*/
|
|
2349
|
+
postCopy(id, body = {}, opts = {}) {
|
|
2350
|
+
return this.http.json(path$6(id, "/post-copy"), {
|
|
2351
|
+
method: "POST",
|
|
2352
|
+
body: stripUndefined(body),
|
|
2353
|
+
headers: opts.idempotencyKey ? { "Idempotency-Key": opts.idempotencyKey } : void 0,
|
|
2354
|
+
ext: opts.ext,
|
|
2355
|
+
signal: opts.signal,
|
|
2356
|
+
noRetry: !opts.idempotencyKey
|
|
2357
|
+
});
|
|
2358
|
+
}
|
|
2359
|
+
/**
|
|
2360
|
+
* Edit a video clip by its transcript: delete word ranges (`remove: [{ from_word, to_word }]`, indexes into the
|
|
2361
|
+
* clip asset's cached transcript from `captions`) from video node `node_id`; the pieces are placed back to back as
|
|
2362
|
+
* one new version (`base_seq` rebased like `edit`, locks honoured unless `force`). Free. 409 `captions_required`
|
|
2363
|
+
* (run `captions` on that clip first) or `stale`; video creatives only.
|
|
2364
|
+
*/
|
|
2365
|
+
transcriptCut(id, body, opts = {}) {
|
|
2366
|
+
return this.http.json(path$6(id, "/transcript-cut"), {
|
|
2332
2367
|
method: "POST",
|
|
2333
2368
|
body: stripUndefined(body),
|
|
2334
2369
|
ext: opts.ext,
|
|
@@ -2337,13 +2372,30 @@ var Creatives = class {
|
|
|
2337
2372
|
});
|
|
2338
2373
|
}
|
|
2339
2374
|
/**
|
|
2375
|
+
* Generate a new picture for an `image` node (`prompt`, optional `model`, `aspect_ratio` — default the closest
|
|
2376
|
+
* ratio of the node box — `base_seq`, `force`) and swap it in as one new version. A node with a `castId` sends that
|
|
2377
|
+
* cast entry's `refAssetIds` as references and appends its `description`, so the subject stays consistent. Billed
|
|
2378
|
+
* like `images.generate` (402 `insufficient_funds`); 400 `content_filtered` charges nothing. `idempotencyKey`
|
|
2379
|
+
* replays a retry (24 h).
|
|
2380
|
+
*/
|
|
2381
|
+
regenerateNode(id, nodeId, body, opts = {}) {
|
|
2382
|
+
return this.http.json(path$6(id, `/nodes/${encodeURIComponent(nodeId)}/regenerate`), {
|
|
2383
|
+
method: "POST",
|
|
2384
|
+
body: stripUndefined(body),
|
|
2385
|
+
headers: opts.idempotencyKey ? { "Idempotency-Key": opts.idempotencyKey } : void 0,
|
|
2386
|
+
ext: opts.ext,
|
|
2387
|
+
signal: opts.signal,
|
|
2388
|
+
noRetry: !opts.idempotencyKey
|
|
2389
|
+
});
|
|
2390
|
+
}
|
|
2391
|
+
/**
|
|
2340
2392
|
* Re-apply a brand kit (`brand_kit_id`) or a flat token map (`tokens`) to the creative as one new version: literal
|
|
2341
2393
|
* colours equal to the old brand become token refs, `snap: true` maps every other colour to the nearest kit colour,
|
|
2342
2394
|
* `fonts` (default true) sets heading / body font refs by role, locked nodes are skipped unless `force`. The kit
|
|
2343
2395
|
* logo is registered too. `base_seq` defaults to the head (rebased like `edit`, 409 `stale` else). Free.
|
|
2344
2396
|
*/
|
|
2345
2397
|
restyle(id, body, opts = {}) {
|
|
2346
|
-
return this.http.json(path$
|
|
2398
|
+
return this.http.json(path$6(id, "/restyle"), {
|
|
2347
2399
|
method: "POST",
|
|
2348
2400
|
body: stripUndefined(body),
|
|
2349
2401
|
ext: opts.ext,
|
|
@@ -2359,7 +2411,7 @@ var Creatives = class {
|
|
|
2359
2411
|
* `unsupported_kind`); 403 `residency_unavailable`, 503 `transcription_unavailable`.
|
|
2360
2412
|
*/
|
|
2361
2413
|
captions(id, body = {}, opts = {}) {
|
|
2362
|
-
return this.http.json(path$
|
|
2414
|
+
return this.http.json(path$6(id, "/captions"), {
|
|
2363
2415
|
method: "POST",
|
|
2364
2416
|
body: stripUndefined(body),
|
|
2365
2417
|
ext: opts.ext,
|
|
@@ -2369,7 +2421,7 @@ var Creatives = class {
|
|
|
2369
2421
|
}
|
|
2370
2422
|
/** The captions as SubRip text on the document timeline (`node_id`, `seq` optional); 404 without captions. Free. */
|
|
2371
2423
|
async captionsSrt(id, query = {}, opts = {}) {
|
|
2372
|
-
return (await this.http.request(path$
|
|
2424
|
+
return (await this.http.request(path$6(id, "/captions.srt"), {
|
|
2373
2425
|
query: {
|
|
2374
2426
|
node_id: query.node_id,
|
|
2375
2427
|
seq: query.seq,
|
|
@@ -2381,7 +2433,7 @@ var Creatives = class {
|
|
|
2381
2433
|
}
|
|
2382
2434
|
/** The captions as WebVTT text on the document timeline (`node_id`, `seq` optional); 404 without captions. Free. */
|
|
2383
2435
|
async captionsVtt(id, query = {}, opts = {}) {
|
|
2384
|
-
return (await this.http.request(path$
|
|
2436
|
+
return (await this.http.request(path$6(id, "/captions.vtt"), {
|
|
2385
2437
|
query: {
|
|
2386
2438
|
node_id: query.node_id,
|
|
2387
2439
|
seq: query.seq,
|
|
@@ -2397,7 +2449,7 @@ var Creatives = class {
|
|
|
2397
2449
|
* `focal: 'vision'` (token-metered) finds the focal point of full-bleed images; it fails open. Free otherwise.
|
|
2398
2450
|
*/
|
|
2399
2451
|
adapt(id, body, opts = {}) {
|
|
2400
|
-
return this.http.json(path$
|
|
2452
|
+
return this.http.json(path$6(id, "/adapt"), {
|
|
2401
2453
|
method: "POST",
|
|
2402
2454
|
body: stripUndefined(body),
|
|
2403
2455
|
ext: opts.ext,
|
|
@@ -2411,7 +2463,7 @@ var Creatives = class {
|
|
|
2411
2463
|
* to one `codai` turn. Nothing to fix: the current `seq`, empty `fixed`, no new version.
|
|
2412
2464
|
*/
|
|
2413
2465
|
lintFix(id, body = {}, opts = {}) {
|
|
2414
|
-
return this.http.json(path$
|
|
2466
|
+
return this.http.json(path$6(id, "/lint/fix"), {
|
|
2415
2467
|
method: "POST",
|
|
2416
2468
|
body: stripUndefined(body),
|
|
2417
2469
|
ext: opts.ext,
|
|
@@ -2424,7 +2476,7 @@ var Creatives = class {
|
|
|
2424
2476
|
* values with a `setVar` op and controls with a `setControl` op (`edit`). Free.
|
|
2425
2477
|
*/
|
|
2426
2478
|
controls(id, opts = {}) {
|
|
2427
|
-
return this.http.json(path$
|
|
2479
|
+
return this.http.json(path$6(id, "/controls"), {
|
|
2428
2480
|
ext: opts.ext,
|
|
2429
2481
|
signal: opts.signal
|
|
2430
2482
|
});
|
|
@@ -2434,7 +2486,7 @@ var Creatives = class {
|
|
|
2434
2486
|
* With `locale` (+ `units`, default 1) also the units of that locale (paged with `offset` / `limit` ≤ 500). Free.
|
|
2435
2487
|
*/
|
|
2436
2488
|
locales(id, query = {}, opts = {}) {
|
|
2437
|
-
return this.http.json(path$
|
|
2489
|
+
return this.http.json(path$6(id, "/locales"), {
|
|
2438
2490
|
query: {
|
|
2439
2491
|
locale: query.locale,
|
|
2440
2492
|
units: query.units,
|
|
@@ -2452,7 +2504,7 @@ var Creatives = class {
|
|
|
2452
2504
|
* 400 `nothing_to_translate`; 503 `localize_unavailable` when every locale failed.
|
|
2453
2505
|
*/
|
|
2454
2506
|
localize(id, body, opts = {}) {
|
|
2455
|
-
return this.http.json(path$
|
|
2507
|
+
return this.http.json(path$6(id, "/localize"), {
|
|
2456
2508
|
method: "POST",
|
|
2457
2509
|
body: stripUndefined(body),
|
|
2458
2510
|
ext: opts.ext,
|
|
@@ -2465,7 +2517,7 @@ var Creatives = class {
|
|
|
2465
2517
|
* title `<title> (<locale>)`). 404 `Locale not found.`. Free (HTTP 201).
|
|
2466
2518
|
*/
|
|
2467
2519
|
forkLocale(id, locale, body = {}, opts = {}) {
|
|
2468
|
-
return this.http.json(path$
|
|
2520
|
+
return this.http.json(path$6(id, `/locales/${encodeURIComponent(locale)}/fork`), {
|
|
2469
2521
|
method: "POST",
|
|
2470
2522
|
body: stripUndefined(body),
|
|
2471
2523
|
ext: opts.ext,
|
|
@@ -2479,7 +2531,7 @@ var Creatives = class {
|
|
|
2479
2531
|
* only in this answer (HTTP 201). 400 `unknown_seq`; 409 `too_many_shares` (20 active links). Free.
|
|
2480
2532
|
*/
|
|
2481
2533
|
createShare(id, body, opts = {}) {
|
|
2482
|
-
return this.http.json(path$
|
|
2534
|
+
return this.http.json(path$6(id, "/shares"), {
|
|
2483
2535
|
method: "POST",
|
|
2484
2536
|
body: stripUndefined(body),
|
|
2485
2537
|
ext: opts.ext,
|
|
@@ -2489,14 +2541,14 @@ var Creatives = class {
|
|
|
2489
2541
|
}
|
|
2490
2542
|
/** The active links (not revoked, not expired), newest first; `url` is always null. Free. */
|
|
2491
2543
|
listShares(id, opts = {}) {
|
|
2492
|
-
return this.http.json(path$
|
|
2544
|
+
return this.http.json(path$6(id, "/shares"), {
|
|
2493
2545
|
ext: opts.ext,
|
|
2494
2546
|
signal: opts.signal
|
|
2495
2547
|
});
|
|
2496
2548
|
}
|
|
2497
2549
|
/** Revoke a link: it answers 404 from now on. 404 when unknown or already revoked. Free. */
|
|
2498
2550
|
async revokeShare(id, shareId, opts = {}) {
|
|
2499
|
-
await this.http.request(path$
|
|
2551
|
+
await this.http.request(path$6(id, `/shares/${encodeURIComponent(shareId)}`), {
|
|
2500
2552
|
method: "DELETE",
|
|
2501
2553
|
ext: opts.ext,
|
|
2502
2554
|
signal: opts.signal
|
|
@@ -2507,14 +2559,14 @@ var Creatives = class {
|
|
|
2507
2559
|
* version (`approved_is_head` false once the creative changed), decider and thread counts. Free.
|
|
2508
2560
|
*/
|
|
2509
2561
|
review(id, opts = {}) {
|
|
2510
|
-
return this.http.json(path$
|
|
2562
|
+
return this.http.json(path$6(id, "/review"), {
|
|
2511
2563
|
ext: opts.ext,
|
|
2512
2564
|
signal: opts.signal
|
|
2513
2565
|
});
|
|
2514
2566
|
}
|
|
2515
2567
|
/** Send the head to review (`in_review`, earlier decision cleared) so approver links can decide. Free. */
|
|
2516
2568
|
requestReview(id, opts = {}) {
|
|
2517
|
-
return this.http.json(path$
|
|
2569
|
+
return this.http.json(path$6(id, "/review"), {
|
|
2518
2570
|
method: "POST",
|
|
2519
2571
|
body: { action: "request" },
|
|
2520
2572
|
ext: opts.ext,
|
|
@@ -2523,7 +2575,7 @@ var Creatives = class {
|
|
|
2523
2575
|
}
|
|
2524
2576
|
/** Back to `draft` (decision cleared, comments kept). Free. */
|
|
2525
2577
|
resetReview(id, opts = {}) {
|
|
2526
|
-
return this.http.json(path$
|
|
2578
|
+
return this.http.json(path$6(id, "/review"), {
|
|
2527
2579
|
method: "POST",
|
|
2528
2580
|
body: { action: "reset" },
|
|
2529
2581
|
ext: opts.ext,
|
|
@@ -2532,7 +2584,7 @@ var Creatives = class {
|
|
|
2532
2584
|
}
|
|
2533
2585
|
/** Comment threads, newest first (≤ 200), replies oldest first; `status` `open` | `resolved` | `all`. Free. */
|
|
2534
2586
|
reviewThreads(id, query = {}, opts = {}) {
|
|
2535
|
-
return this.http.json(path$
|
|
2587
|
+
return this.http.json(path$6(id, "/review/threads"), {
|
|
2536
2588
|
query: { status: query.status },
|
|
2537
2589
|
ext: opts.ext,
|
|
2538
2590
|
signal: opts.signal
|
|
@@ -2543,7 +2595,7 @@ var Creatives = class {
|
|
|
2543
2595
|
* 400 `unknown_node` / `unknown_scene`; HTTP 201). 409 `too_many_comments`. Free.
|
|
2544
2596
|
*/
|
|
2545
2597
|
createReviewThread(id, body, opts = {}) {
|
|
2546
|
-
return this.http.json(path$
|
|
2598
|
+
return this.http.json(path$6(id, "/review/threads"), {
|
|
2547
2599
|
method: "POST",
|
|
2548
2600
|
body: stripUndefined(body),
|
|
2549
2601
|
ext: opts.ext,
|
|
@@ -2553,7 +2605,7 @@ var Creatives = class {
|
|
|
2553
2605
|
}
|
|
2554
2606
|
/** Reply in a thread as the owner (HTTP 201) — returns the whole thread. Free. */
|
|
2555
2607
|
replyReviewThread(id, threadId, body, opts = {}) {
|
|
2556
|
-
return this.http.json(path$
|
|
2608
|
+
return this.http.json(path$6(id, `/review/threads/${encodeURIComponent(threadId)}/replies`), {
|
|
2557
2609
|
method: "POST",
|
|
2558
2610
|
body: { body: body.body },
|
|
2559
2611
|
ext: opts.ext,
|
|
@@ -2563,7 +2615,7 @@ var Creatives = class {
|
|
|
2563
2615
|
}
|
|
2564
2616
|
/** Resolve a thread. Free. */
|
|
2565
2617
|
resolveReviewThread(id, threadId, opts = {}) {
|
|
2566
|
-
return this.http.json(path$
|
|
2618
|
+
return this.http.json(path$6(id, `/review/threads/${encodeURIComponent(threadId)}/resolve`), {
|
|
2567
2619
|
method: "POST",
|
|
2568
2620
|
ext: opts.ext,
|
|
2569
2621
|
signal: opts.signal
|
|
@@ -2571,7 +2623,7 @@ var Creatives = class {
|
|
|
2571
2623
|
}
|
|
2572
2624
|
/** Reopen a resolved thread. Free. */
|
|
2573
2625
|
reopenReviewThread(id, threadId, opts = {}) {
|
|
2574
|
-
return this.http.json(path$
|
|
2626
|
+
return this.http.json(path$6(id, `/review/threads/${encodeURIComponent(threadId)}/reopen`), {
|
|
2575
2627
|
method: "POST",
|
|
2576
2628
|
ext: opts.ext,
|
|
2577
2629
|
signal: opts.signal
|
|
@@ -2579,7 +2631,7 @@ var Creatives = class {
|
|
|
2579
2631
|
}
|
|
2580
2632
|
/** Delete any comment (owner moderation; deleting a root hides the thread). 404 when unknown. Free. */
|
|
2581
2633
|
async deleteReviewComment(id, commentId, opts = {}) {
|
|
2582
|
-
await this.http.request(path$
|
|
2634
|
+
await this.http.request(path$6(id, `/review/comments/${encodeURIComponent(commentId)}`), {
|
|
2583
2635
|
method: "DELETE",
|
|
2584
2636
|
ext: opts.ext,
|
|
2585
2637
|
signal: opts.signal
|
|
@@ -2587,16 +2639,15 @@ var Creatives = class {
|
|
|
2587
2639
|
}
|
|
2588
2640
|
/** Poll a frame job: frames when done (`status: 'succeeded'`), `status: 'running'` meanwhile; 404 unknown job. */
|
|
2589
2641
|
frameJob(id, jobId, opts = {}) {
|
|
2590
|
-
return this.http.json(path$
|
|
2642
|
+
return this.http.json(path$6(id, `/frames/${encodeURIComponent(jobId)}`), {
|
|
2591
2643
|
ext: opts.ext,
|
|
2592
2644
|
signal: opts.signal
|
|
2593
2645
|
});
|
|
2594
2646
|
}
|
|
2595
2647
|
};
|
|
2596
2648
|
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
const path$4 = (id, tail = "") => `/v1/studio/brand-kits/${encodeURIComponent(id)}${tail}`;
|
|
2649
|
+
// src/resources/brand-kits.ts
|
|
2650
|
+
const path$5 = (id, tail = "") => `/v1/studio/brand-kits/${encodeURIComponent(id)}${tail}`;
|
|
2600
2651
|
var BrandKits = class {
|
|
2601
2652
|
http;
|
|
2602
2653
|
constructor(http) {
|
|
@@ -2621,7 +2672,7 @@ var BrandKits = class {
|
|
|
2621
2672
|
* `logo_asset_id: null` removes the logo. Creatives keep their tokens until `creatives.restyle`. Free.
|
|
2622
2673
|
*/
|
|
2623
2674
|
update(id, body, opts = {}) {
|
|
2624
|
-
return this.http.json(path$
|
|
2675
|
+
return this.http.json(path$5(id), {
|
|
2625
2676
|
method: "PATCH",
|
|
2626
2677
|
body,
|
|
2627
2678
|
ext: opts.ext,
|
|
@@ -2631,7 +2682,7 @@ var BrandKits = class {
|
|
|
2631
2682
|
}
|
|
2632
2683
|
/** The kit as a DTCG 2025.10 JSON document (`$extensions['ro.codai']` = kit id, name, logo asset id). Free. */
|
|
2633
2684
|
exportDtcg(id, opts = {}) {
|
|
2634
|
-
return this.http.json(path$
|
|
2685
|
+
return this.http.json(path$5(id, "/dtcg"), {
|
|
2635
2686
|
ext: opts.ext,
|
|
2636
2687
|
signal: opts.signal
|
|
2637
2688
|
});
|
|
@@ -2661,14 +2712,14 @@ var BrandKits = class {
|
|
|
2661
2712
|
}
|
|
2662
2713
|
/** One kit with a signed logo URL (1 h), its `dtcg` and the WCAG `contrast` pairs. Free. */
|
|
2663
2714
|
retrieve(id, opts = {}) {
|
|
2664
|
-
return this.http.json(path$
|
|
2715
|
+
return this.http.json(path$5(id), {
|
|
2665
2716
|
ext: opts.ext,
|
|
2666
2717
|
signal: opts.signal
|
|
2667
2718
|
});
|
|
2668
2719
|
}
|
|
2669
2720
|
/** Delete a kit (creatives keep their tokens; the logo asset stays). Free. */
|
|
2670
2721
|
delete(id, opts = {}) {
|
|
2671
|
-
return this.http.json(path$
|
|
2722
|
+
return this.http.json(path$5(id), {
|
|
2672
2723
|
method: "DELETE",
|
|
2673
2724
|
ext: opts.ext,
|
|
2674
2725
|
signal: opts.signal
|
|
@@ -2676,9 +2727,8 @@ var BrandKits = class {
|
|
|
2676
2727
|
}
|
|
2677
2728
|
};
|
|
2678
2729
|
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
const path$3 = (id) => `/v1/studio/templates/${encodeURIComponent(id)}`;
|
|
2730
|
+
// src/resources/templates.ts
|
|
2731
|
+
const path$4 = (id) => `/v1/studio/templates/${encodeURIComponent(id)}`;
|
|
2682
2732
|
var Templates = class {
|
|
2683
2733
|
http;
|
|
2684
2734
|
constructor(http) {
|
|
@@ -2705,14 +2755,14 @@ var Templates = class {
|
|
|
2705
2755
|
}
|
|
2706
2756
|
/** One template with its variables and `doc`. Free. */
|
|
2707
2757
|
retrieve(id, opts = {}) {
|
|
2708
|
-
return this.http.json(path$
|
|
2758
|
+
return this.http.json(path$4(id), {
|
|
2709
2759
|
ext: opts.ext,
|
|
2710
2760
|
signal: opts.signal
|
|
2711
2761
|
});
|
|
2712
2762
|
}
|
|
2713
2763
|
/** Delete a template (creatives made from it are not affected). Free. */
|
|
2714
2764
|
delete(id, opts = {}) {
|
|
2715
|
-
return this.http.json(path$
|
|
2765
|
+
return this.http.json(path$4(id), {
|
|
2716
2766
|
method: "DELETE",
|
|
2717
2767
|
ext: opts.ext,
|
|
2718
2768
|
signal: opts.signal
|
|
@@ -2720,10 +2770,9 @@ var Templates = class {
|
|
|
2720
2770
|
}
|
|
2721
2771
|
};
|
|
2722
2772
|
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
function abortableSleep$4(ms, signal) {
|
|
2773
|
+
// src/resources/productions.ts
|
|
2774
|
+
const path$3 = (id) => `/v1/studio/productions/${encodeURIComponent(id)}`;
|
|
2775
|
+
function abortableSleep$5(ms, signal) {
|
|
2727
2776
|
return new Promise((resolve, reject) => {
|
|
2728
2777
|
if (signal?.aborted) return reject(signal.reason ?? /* @__PURE__ */ new Error("Aborted"));
|
|
2729
2778
|
const t = setTimeout(() => {
|
|
@@ -2756,7 +2805,7 @@ var Productions = class {
|
|
|
2756
2805
|
}
|
|
2757
2806
|
/** `GET /v1/studio/productions/{id}` — advances the production and returns it (another account's id is a 404). */
|
|
2758
2807
|
retrieve(id, opts = {}) {
|
|
2759
|
-
return this.http.json(path$
|
|
2808
|
+
return this.http.json(path$3(id), {
|
|
2760
2809
|
ext: opts.ext,
|
|
2761
2810
|
signal: opts.signal
|
|
2762
2811
|
});
|
|
@@ -2772,7 +2821,7 @@ var Productions = class {
|
|
|
2772
2821
|
const p = await this.retrieve(id, opts);
|
|
2773
2822
|
if (isProductionFinished(p)) return p;
|
|
2774
2823
|
if (Date.now() + interval > deadline) throw new Error(`codai: production ${id} did not finish in time (phase ${p.phase})`);
|
|
2775
|
-
await abortableSleep$
|
|
2824
|
+
await abortableSleep$5(interval, opts.signal);
|
|
2776
2825
|
}
|
|
2777
2826
|
}
|
|
2778
2827
|
/** `create` + `wait`. */
|
|
@@ -2782,8 +2831,110 @@ var Productions = class {
|
|
|
2782
2831
|
}
|
|
2783
2832
|
};
|
|
2784
2833
|
|
|
2785
|
-
|
|
2786
|
-
|
|
2834
|
+
// src/resources/music-room.ts
|
|
2835
|
+
const BASE$2 = "/v1/studio/music-room";
|
|
2836
|
+
const path$2 = (id) => `${BASE$2}/${encodeURIComponent(id)}`;
|
|
2837
|
+
function abortableSleep$4(ms, signal) {
|
|
2838
|
+
return new Promise((resolve, reject) => {
|
|
2839
|
+
if (signal?.aborted) return reject(signal.reason ?? /* @__PURE__ */ new Error("Aborted"));
|
|
2840
|
+
const t = setTimeout(() => {
|
|
2841
|
+
signal?.removeEventListener("abort", onAbort);
|
|
2842
|
+
resolve();
|
|
2843
|
+
}, ms);
|
|
2844
|
+
const onAbort = () => {
|
|
2845
|
+
clearTimeout(t);
|
|
2846
|
+
reject(signal?.reason ?? /* @__PURE__ */ new Error("Aborted"));
|
|
2847
|
+
};
|
|
2848
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
2849
|
+
});
|
|
2850
|
+
}
|
|
2851
|
+
/** The song reached a terminal state (`succeeded` or `failed`). */
|
|
2852
|
+
const isMusicRoomFinished = (r) => r.status === "succeeded" || r.status === "failed";
|
|
2853
|
+
var MusicRoom = class {
|
|
2854
|
+
http;
|
|
2855
|
+
constructor(http) {
|
|
2856
|
+
this.http = http;
|
|
2857
|
+
}
|
|
2858
|
+
/** `POST /v1/studio/music-room` — start a song (202; the producer plans it, then it waits at the plan gate). */
|
|
2859
|
+
create(body, opts = {}) {
|
|
2860
|
+
return this.http.json(BASE$2, {
|
|
2861
|
+
method: "POST",
|
|
2862
|
+
body,
|
|
2863
|
+
headers: opts.idempotencyKey ? { "Idempotency-Key": opts.idempotencyKey } : void 0,
|
|
2864
|
+
noRetry: !opts.idempotencyKey,
|
|
2865
|
+
ext: opts.ext,
|
|
2866
|
+
signal: opts.signal
|
|
2867
|
+
});
|
|
2868
|
+
}
|
|
2869
|
+
/** `GET /v1/studio/music-room/{id}` — advances the workflow and returns the song (another account's id is a 404). */
|
|
2870
|
+
get(id, opts = {}) {
|
|
2871
|
+
return this.http.json(path$2(id), {
|
|
2872
|
+
ext: opts.ext,
|
|
2873
|
+
signal: opts.signal
|
|
2874
|
+
});
|
|
2875
|
+
}
|
|
2876
|
+
/** `GET /v1/studio/music-room` — your songs, newest first; page with `before` while `has_more`. */
|
|
2877
|
+
list(query = {}, opts = {}) {
|
|
2878
|
+
return this.http.json(BASE$2, {
|
|
2879
|
+
query: {
|
|
2880
|
+
limit: query.limit,
|
|
2881
|
+
before: query.before
|
|
2882
|
+
},
|
|
2883
|
+
ext: opts.ext,
|
|
2884
|
+
signal: opts.signal
|
|
2885
|
+
});
|
|
2886
|
+
}
|
|
2887
|
+
/**
|
|
2888
|
+
* `POST /v1/studio/music-room/{id}/choose` — answer the open gate: `{ gate: 'plan', variant }`,
|
|
2889
|
+
* `{ gate: 'demo', approve: true }` or `{ gate: 'final', approve: true }` (409 `not_at_gate` otherwise).
|
|
2890
|
+
*/
|
|
2891
|
+
choose(id, answer, opts = {}) {
|
|
2892
|
+
return this.http.json(`${path$2(id)}/choose`, {
|
|
2893
|
+
method: "POST",
|
|
2894
|
+
body: answer,
|
|
2895
|
+
ext: opts.ext,
|
|
2896
|
+
signal: opts.signal
|
|
2897
|
+
});
|
|
2898
|
+
}
|
|
2899
|
+
/**
|
|
2900
|
+
* `POST /v1/studio/music-room/{id}/direct` — one player re-plays its part following `direction` and the demo is
|
|
2901
|
+
* re-rendered (202; only at the demo or final gate).
|
|
2902
|
+
*/
|
|
2903
|
+
direct(id, body, opts = {}) {
|
|
2904
|
+
return this.http.json(`${path$2(id)}/direct`, {
|
|
2905
|
+
method: "POST",
|
|
2906
|
+
body,
|
|
2907
|
+
headers: opts.idempotencyKey ? { "Idempotency-Key": opts.idempotencyKey } : void 0,
|
|
2908
|
+
noRetry: !opts.idempotencyKey,
|
|
2909
|
+
ext: opts.ext,
|
|
2910
|
+
signal: opts.signal
|
|
2911
|
+
});
|
|
2912
|
+
}
|
|
2913
|
+
/** `GET /v1/studio/music-room/quota` — `{ plan, included, used, remaining, period_end }` for this calendar month. */
|
|
2914
|
+
quota(opts = {}) {
|
|
2915
|
+
return this.http.json(`${BASE$2}/quota`, {
|
|
2916
|
+
ext: opts.ext,
|
|
2917
|
+
signal: opts.signal
|
|
2918
|
+
});
|
|
2919
|
+
}
|
|
2920
|
+
/**
|
|
2921
|
+
* Poll `get` every `intervalMs` (default 10 s) until the song `succeeded` or `failed` (a failed one resolves too —
|
|
2922
|
+
* check `status` / `error`), or with `untilGate: true` until it waits at a gate. Throws after `timeoutMs`
|
|
2923
|
+
* (default 30 min) or when `signal` aborts.
|
|
2924
|
+
*/
|
|
2925
|
+
async wait(id, opts = {}) {
|
|
2926
|
+
const interval = opts.intervalMs ?? 1e4;
|
|
2927
|
+
const deadline = Date.now() + (opts.timeoutMs ?? 18e5);
|
|
2928
|
+
for (;;) {
|
|
2929
|
+
const r = await this.get(id, opts);
|
|
2930
|
+
if (isMusicRoomFinished(r) || opts.untilGate && r.status === "waiting") return r;
|
|
2931
|
+
if (Date.now() + interval > deadline) throw new Error(`codai: music room ${id} did not finish in time (phase ${r.phase})`);
|
|
2932
|
+
await abortableSleep$4(interval, opts.signal);
|
|
2933
|
+
}
|
|
2934
|
+
}
|
|
2935
|
+
};
|
|
2936
|
+
|
|
2937
|
+
// src/resources/media-ops.ts
|
|
2787
2938
|
const BASE$1 = "/v1/studio/media-ops";
|
|
2788
2939
|
const opPath = (op) => `${BASE$1}/${encodeURIComponent(op)}`;
|
|
2789
2940
|
function abortableSleep$3(ms, signal) {
|
|
@@ -2802,7 +2953,8 @@ function abortableSleep$3(ms, signal) {
|
|
|
2802
2953
|
}
|
|
2803
2954
|
const toBody = (input) => ({
|
|
2804
2955
|
asset_ids: input.assetIds ?? [],
|
|
2805
|
-
params: input.params ?? {}
|
|
2956
|
+
params: input.params ?? {},
|
|
2957
|
+
...input.maskPngB64 !== void 0 ? { mask_png_b64: input.maskPngB64 } : {}
|
|
2806
2958
|
});
|
|
2807
2959
|
/** A run answer is a job (async op, HTTP 202) when `object` is `media_op.job`. */
|
|
2808
2960
|
const isMediaOpJob = (r) => r.object === "media_op.job";
|
|
@@ -2870,8 +3022,7 @@ var MediaOps = class {
|
|
|
2870
3022
|
}
|
|
2871
3023
|
};
|
|
2872
3024
|
|
|
2873
|
-
|
|
2874
|
-
//#region src/resources/lyrics.ts
|
|
3025
|
+
// src/resources/lyrics.ts
|
|
2875
3026
|
const BASE = "/v1/studio/lyrics";
|
|
2876
3027
|
var LyricsResource = class {
|
|
2877
3028
|
http;
|
|
@@ -2906,8 +3057,7 @@ var LyricsResource = class {
|
|
|
2906
3057
|
}
|
|
2907
3058
|
};
|
|
2908
3059
|
|
|
2909
|
-
|
|
2910
|
-
//#region src/resources/jam.ts
|
|
3060
|
+
// src/resources/jam.ts
|
|
2911
3061
|
const JAM_SUBPROTOCOL = "codai-jam";
|
|
2912
3062
|
/** WebSocket close codes of `/v1/studio/jam`. */
|
|
2913
3063
|
const JAM_CLOSE_CODES = {
|
|
@@ -3068,8 +3218,7 @@ var Jam = class {
|
|
|
3068
3218
|
}
|
|
3069
3219
|
};
|
|
3070
3220
|
|
|
3071
|
-
|
|
3072
|
-
//#region src/resources/batches.ts
|
|
3221
|
+
// src/resources/batches.ts
|
|
3073
3222
|
const BATCH_DONE = [
|
|
3074
3223
|
"completed",
|
|
3075
3224
|
"failed",
|
|
@@ -3203,8 +3352,7 @@ var Batches = class {
|
|
|
3203
3352
|
}
|
|
3204
3353
|
};
|
|
3205
3354
|
|
|
3206
|
-
|
|
3207
|
-
//#region src/resources/shares.ts
|
|
3355
|
+
// src/resources/shares.ts
|
|
3208
3356
|
const SHARE_TOKEN_RE = /^[A-Za-z0-9_-]{43}$/;
|
|
3209
3357
|
/**
|
|
3210
3358
|
* The share token in `input`: a raw token, or any `https://…/s/<token>` / `…/r/<token>` URL (query and fragment
|
|
@@ -3319,8 +3467,7 @@ var Shares = class {
|
|
|
3319
3467
|
}
|
|
3320
3468
|
};
|
|
3321
3469
|
|
|
3322
|
-
|
|
3323
|
-
//#region src/resources/voice-revocations.ts
|
|
3470
|
+
// src/resources/voice-revocations.ts
|
|
3324
3471
|
var VoiceRevocations = class {
|
|
3325
3472
|
http;
|
|
3326
3473
|
constructor(http) {
|
|
@@ -3338,8 +3485,40 @@ var VoiceRevocations = class {
|
|
|
3338
3485
|
}
|
|
3339
3486
|
};
|
|
3340
3487
|
|
|
3341
|
-
|
|
3342
|
-
|
|
3488
|
+
// src/resources/voices.ts
|
|
3489
|
+
const singing = (id) => `/v1/studio/voices/${encodeURIComponent(id)}/singing-consent`;
|
|
3490
|
+
var Voices = class {
|
|
3491
|
+
http;
|
|
3492
|
+
constructor(http) {
|
|
3493
|
+
this.http = http;
|
|
3494
|
+
}
|
|
3495
|
+
/**
|
|
3496
|
+
* `POST /v1/studio/voices/{id}/singing-consent` — add the singing purpose from a finished singing recording session
|
|
3497
|
+
* (liveness-checked statement + sung sample). Returns the voice with `singing.status: 'active'`. Never retried.
|
|
3498
|
+
*/
|
|
3499
|
+
addSingingConsent(id, body, opts = {}) {
|
|
3500
|
+
return this.http.json(singing(id), {
|
|
3501
|
+
method: "POST",
|
|
3502
|
+
body,
|
|
3503
|
+
ext: opts.ext,
|
|
3504
|
+
signal: opts.signal,
|
|
3505
|
+
noRetry: true
|
|
3506
|
+
});
|
|
3507
|
+
}
|
|
3508
|
+
/**
|
|
3509
|
+
* `DELETE /v1/studio/voices/{id}/singing-consent` — revoke ONLY the singing purpose (204). The sung sample is deleted
|
|
3510
|
+
* at once; the voice keeps working for narration. Idempotent.
|
|
3511
|
+
*/
|
|
3512
|
+
async revokeSingingConsent(id, opts = {}) {
|
|
3513
|
+
await this.http.request(singing(id), {
|
|
3514
|
+
method: "DELETE",
|
|
3515
|
+
ext: opts.ext,
|
|
3516
|
+
signal: opts.signal
|
|
3517
|
+
});
|
|
3518
|
+
}
|
|
3519
|
+
};
|
|
3520
|
+
|
|
3521
|
+
// src/resources/vault.ts
|
|
3343
3522
|
/** The UTF-8 message an unlock proof covers: `codai-vault/unlock/v1|<challenge>|<device_id or "passkey">`. */
|
|
3344
3523
|
function vaultUnlockMessage(challenge, deviceIdOrPasskey) {
|
|
3345
3524
|
return `codai-vault/unlock/v1|${challenge}|${deviceIdOrPasskey}`;
|
|
@@ -3570,8 +3749,7 @@ var Vault = class {
|
|
|
3570
3749
|
}
|
|
3571
3750
|
};
|
|
3572
3751
|
|
|
3573
|
-
|
|
3574
|
-
//#region src/resources/abuse-reports.ts
|
|
3752
|
+
// src/resources/abuse-reports.ts
|
|
3575
3753
|
var AbuseReports = class {
|
|
3576
3754
|
http;
|
|
3577
3755
|
constructor(http) {
|
|
@@ -3589,8 +3767,7 @@ var AbuseReports = class {
|
|
|
3589
3767
|
}
|
|
3590
3768
|
};
|
|
3591
3769
|
|
|
3592
|
-
|
|
3593
|
-
//#region src/resources/provenance.ts
|
|
3770
|
+
// src/resources/provenance.ts
|
|
3594
3771
|
/** Largest file the checker accepts (25 MB). */
|
|
3595
3772
|
const PROVENANCE_MAX_BYTES = 26214400;
|
|
3596
3773
|
var Provenance = class {
|
|
@@ -3615,8 +3792,7 @@ var Provenance = class {
|
|
|
3615
3792
|
}
|
|
3616
3793
|
};
|
|
3617
3794
|
|
|
3618
|
-
|
|
3619
|
-
//#region src/resources/messages.ts
|
|
3795
|
+
// src/resources/messages.ts
|
|
3620
3796
|
/** `POST /v1/messages` — Anthropic Messages wire (JSON + named-event SSE). */
|
|
3621
3797
|
var Messages = class {
|
|
3622
3798
|
http;
|
|
@@ -3719,8 +3895,7 @@ var Messages = class {
|
|
|
3719
3895
|
}
|
|
3720
3896
|
};
|
|
3721
3897
|
|
|
3722
|
-
|
|
3723
|
-
//#region src/resources/models.ts
|
|
3898
|
+
// src/resources/models.ts
|
|
3724
3899
|
var Models = class {
|
|
3725
3900
|
http;
|
|
3726
3901
|
constructor(http) {
|
|
@@ -3735,8 +3910,7 @@ var Models = class {
|
|
|
3735
3910
|
}
|
|
3736
3911
|
};
|
|
3737
3912
|
|
|
3738
|
-
|
|
3739
|
-
//#region src/resources/orgs.ts
|
|
3913
|
+
// src/resources/orgs.ts
|
|
3740
3914
|
var OrgMembers = class {
|
|
3741
3915
|
http;
|
|
3742
3916
|
constructor(http) {
|
|
@@ -3790,8 +3964,7 @@ var Orgs = class {
|
|
|
3790
3964
|
}
|
|
3791
3965
|
};
|
|
3792
3966
|
|
|
3793
|
-
|
|
3794
|
-
//#region src/resources/projects.ts
|
|
3967
|
+
// src/resources/projects.ts
|
|
3795
3968
|
var Projects = class {
|
|
3796
3969
|
http;
|
|
3797
3970
|
constructor(http) {
|
|
@@ -3838,8 +4011,7 @@ var Projects = class {
|
|
|
3838
4011
|
}
|
|
3839
4012
|
};
|
|
3840
4013
|
|
|
3841
|
-
|
|
3842
|
-
//#region src/resources/realtime.ts
|
|
4014
|
+
// src/resources/realtime.ts
|
|
3843
4015
|
const OPEN = 1;
|
|
3844
4016
|
function toBytes(audio) {
|
|
3845
4017
|
if (audio instanceof ArrayBuffer) return new Uint8Array(audio);
|
|
@@ -4022,8 +4194,7 @@ var Realtime = class {
|
|
|
4022
4194
|
}
|
|
4023
4195
|
};
|
|
4024
4196
|
|
|
4025
|
-
|
|
4026
|
-
//#region src/resources/referrals.ts
|
|
4197
|
+
// src/resources/referrals.ts
|
|
4027
4198
|
var Referrals = class {
|
|
4028
4199
|
http;
|
|
4029
4200
|
constructor(http) {
|
|
@@ -4058,8 +4229,7 @@ var Referrals = class {
|
|
|
4058
4229
|
}
|
|
4059
4230
|
};
|
|
4060
4231
|
|
|
4061
|
-
|
|
4062
|
-
//#region src/resources/resolve.ts
|
|
4232
|
+
// src/resources/resolve.ts
|
|
4063
4233
|
/**
|
|
4064
4234
|
* Verify a Resolve webhook delivery: `x-codai-signature: t=<unix>,v1=<hex>`
|
|
4065
4235
|
* with `v1 = HMAC-SHA256(callback_secret, "<t>.<rawBody>")`. Pass the RAW
|
|
@@ -4444,8 +4614,7 @@ function abortableSleep$1(ms, signal) {
|
|
|
4444
4614
|
});
|
|
4445
4615
|
}
|
|
4446
4616
|
|
|
4447
|
-
|
|
4448
|
-
//#region src/resources/responses.ts
|
|
4617
|
+
// src/resources/responses.ts
|
|
4449
4618
|
/** `POST /v1/responses` — OpenAI Responses API compatibility (JSON + named-event SSE). */
|
|
4450
4619
|
var Responses = class {
|
|
4451
4620
|
http;
|
|
@@ -4528,8 +4697,7 @@ var Responses = class {
|
|
|
4528
4697
|
}
|
|
4529
4698
|
};
|
|
4530
4699
|
|
|
4531
|
-
|
|
4532
|
-
//#region src/resources/sessions.ts
|
|
4700
|
+
// src/resources/sessions.ts
|
|
4533
4701
|
/**
|
|
4534
4702
|
* `/v1/sessions/*` — shared-sessions protocol v2 (events, controls, lease,
|
|
4535
4703
|
* dispatch, SSE stream) plus the per-session shares under `/shares`.
|
|
@@ -4765,8 +4933,7 @@ var Sessions = class {
|
|
|
4765
4933
|
}
|
|
4766
4934
|
};
|
|
4767
4935
|
|
|
4768
|
-
|
|
4769
|
-
//#region src/resources/settings.ts
|
|
4936
|
+
// src/resources/settings.ts
|
|
4770
4937
|
/**
|
|
4771
4938
|
* `/v1/settings` — account-level settings shared by every device of the account (per user, not per key). Reads
|
|
4772
4939
|
* always return the full object with defaults applied; writes deep-merge a partial and are validated strictly.
|
|
@@ -4809,8 +4976,7 @@ var Settings = class {
|
|
|
4809
4976
|
}
|
|
4810
4977
|
};
|
|
4811
4978
|
|
|
4812
|
-
|
|
4813
|
-
//#region src/resources/os-gate.ts
|
|
4979
|
+
// src/resources/os-gate.ts
|
|
4814
4980
|
var OsGate = class {
|
|
4815
4981
|
http;
|
|
4816
4982
|
constructor(http) {
|
|
@@ -4837,8 +5003,7 @@ var OsGate = class {
|
|
|
4837
5003
|
}
|
|
4838
5004
|
};
|
|
4839
5005
|
|
|
4840
|
-
|
|
4841
|
-
//#region src/resources/sfx.ts
|
|
5006
|
+
// src/resources/sfx.ts
|
|
4842
5007
|
var Sfx = class {
|
|
4843
5008
|
http;
|
|
4844
5009
|
constructor(http) {
|
|
@@ -4876,8 +5041,7 @@ var Sfx = class {
|
|
|
4876
5041
|
}
|
|
4877
5042
|
};
|
|
4878
5043
|
|
|
4879
|
-
|
|
4880
|
-
//#region src/resources/system-one.ts
|
|
5044
|
+
// src/resources/system-one.ts
|
|
4881
5045
|
var SystemOne = class {
|
|
4882
5046
|
http;
|
|
4883
5047
|
constructor(http) {
|
|
@@ -4896,8 +5060,7 @@ var SystemOne = class {
|
|
|
4896
5060
|
}
|
|
4897
5061
|
};
|
|
4898
5062
|
|
|
4899
|
-
|
|
4900
|
-
//#region src/resources/tasks.ts
|
|
5063
|
+
// src/resources/tasks.ts
|
|
4901
5064
|
var Tasks = class {
|
|
4902
5065
|
http;
|
|
4903
5066
|
constructor(http) {
|
|
@@ -4947,8 +5110,7 @@ var Tasks = class {
|
|
|
4947
5110
|
}
|
|
4948
5111
|
};
|
|
4949
5112
|
|
|
4950
|
-
|
|
4951
|
-
//#region src/resources/triggers.ts
|
|
5113
|
+
// src/resources/triggers.ts
|
|
4952
5114
|
var Triggers = class {
|
|
4953
5115
|
http;
|
|
4954
5116
|
constructor(http) {
|
|
@@ -5098,8 +5260,7 @@ var Notifications = class {
|
|
|
5098
5260
|
}
|
|
5099
5261
|
};
|
|
5100
5262
|
|
|
5101
|
-
|
|
5102
|
-
//#region src/resources/prompts.ts
|
|
5263
|
+
// src/resources/prompts.ts
|
|
5103
5264
|
/** `/v1/prompts/*` — pending prompts: ready-to-paste prompts left for a future chat (handoffs, follow-ups). */
|
|
5104
5265
|
const one$3 = (id, suffix = "") => `/v1/prompts/${encodeURIComponent(id)}${suffix}`;
|
|
5105
5266
|
function filterQuery(q) {
|
|
@@ -5256,8 +5417,7 @@ var Prompts = class {
|
|
|
5256
5417
|
}
|
|
5257
5418
|
};
|
|
5258
5419
|
|
|
5259
|
-
|
|
5260
|
-
//#region src/resources/schedules.ts
|
|
5420
|
+
// src/resources/schedules.ts
|
|
5261
5421
|
/** `/v1/schedules/*`, `/v1/schedule-runs/*`, `/v1/scheduler/*` — the codai Scheduler (ADR 0006). */
|
|
5262
5422
|
const one$2 = (id, suffix = "") => `/v1/schedules/${encodeURIComponent(id)}${suffix}`;
|
|
5263
5423
|
const run = (id, suffix) => `/v1/schedule-runs/${encodeURIComponent(id)}${suffix}`;
|
|
@@ -5528,8 +5688,7 @@ var Schedules = class {
|
|
|
5528
5688
|
}
|
|
5529
5689
|
};
|
|
5530
5690
|
|
|
5531
|
-
|
|
5532
|
-
//#region src/resources/lists.ts
|
|
5691
|
+
// src/resources/lists.ts
|
|
5533
5692
|
/** `/v1/lists/*`, `/v1/share` — lists and the share-sheet entry point. */
|
|
5534
5693
|
const one$1 = (id, suffix = "") => `/v1/lists/${encodeURIComponent(id)}${suffix}`;
|
|
5535
5694
|
const item = (id, suffix = "") => `/v1/lists/items/${encodeURIComponent(id)}${suffix}`;
|
|
@@ -5661,8 +5820,7 @@ var Lists = class {
|
|
|
5661
5820
|
}
|
|
5662
5821
|
};
|
|
5663
5822
|
|
|
5664
|
-
|
|
5665
|
-
//#region src/resources/memory.ts
|
|
5823
|
+
// src/resources/memory.ts
|
|
5666
5824
|
var Memory = class {
|
|
5667
5825
|
http;
|
|
5668
5826
|
constructor(http) {
|
|
@@ -5722,8 +5880,7 @@ var Memory = class {
|
|
|
5722
5880
|
}
|
|
5723
5881
|
};
|
|
5724
5882
|
|
|
5725
|
-
|
|
5726
|
-
//#region src/resources/sandboxes.ts
|
|
5883
|
+
// src/resources/sandboxes.ts
|
|
5727
5884
|
/**
|
|
5728
5885
|
* `/v1/sandboxes` — agent sandboxes: isolated gVisor containers with a persistent `/workspace`, no network
|
|
5729
5886
|
* by default, artifacts from `/workspace/out` as scanned, signed links. Backend `v2` (default) = long-lived
|
|
@@ -5966,8 +6123,7 @@ function execTimeoutMs(timeoutSeconds) {
|
|
|
5966
6123
|
return ((timeoutSeconds ?? 120) + 60) * 1e3;
|
|
5967
6124
|
}
|
|
5968
6125
|
|
|
5969
|
-
|
|
5970
|
-
//#region src/resources/transcripts.ts
|
|
6126
|
+
// src/resources/transcripts.ts
|
|
5971
6127
|
/**
|
|
5972
6128
|
* `/v1/transcripts/*` + `/v1/transcript-folders` + `/v1/transcript-vocabulary` + tus `/v1/uploads` — voice
|
|
5973
6129
|
* recordings → diarized RO/EN transcripts → insights (summary, key points, actions, suggested agent prompts).
|
|
@@ -6391,8 +6547,7 @@ var Transcripts = class {
|
|
|
6391
6547
|
}
|
|
6392
6548
|
};
|
|
6393
6549
|
|
|
6394
|
-
|
|
6395
|
-
//#region src/resources/tokens.ts
|
|
6550
|
+
// src/resources/tokens.ts
|
|
6396
6551
|
var Tokens = class {
|
|
6397
6552
|
http;
|
|
6398
6553
|
constructor(http) {
|
|
@@ -6420,8 +6575,7 @@ var Tokens = class {
|
|
|
6420
6575
|
}
|
|
6421
6576
|
};
|
|
6422
6577
|
|
|
6423
|
-
|
|
6424
|
-
//#region src/resources/tools.ts
|
|
6578
|
+
// src/resources/tools.ts
|
|
6425
6579
|
var Tools = class {
|
|
6426
6580
|
http;
|
|
6427
6581
|
constructor(http) {
|
|
@@ -6461,8 +6615,7 @@ var Tools = class {
|
|
|
6461
6615
|
}
|
|
6462
6616
|
};
|
|
6463
6617
|
|
|
6464
|
-
|
|
6465
|
-
//#region src/resources/research.ts
|
|
6618
|
+
// src/resources/research.ts
|
|
6466
6619
|
const path = (id) => `/v1/research/${encodeURIComponent(id)}`;
|
|
6467
6620
|
function abortableSleep(ms, signal) {
|
|
6468
6621
|
return new Promise((resolve, reject) => {
|
|
@@ -6537,8 +6690,7 @@ var Research = class {
|
|
|
6537
6690
|
}
|
|
6538
6691
|
};
|
|
6539
6692
|
|
|
6540
|
-
|
|
6541
|
-
//#region src/resources/usage-keys.ts
|
|
6693
|
+
// src/resources/usage-keys.ts
|
|
6542
6694
|
var Usage = class {
|
|
6543
6695
|
http;
|
|
6544
6696
|
constructor(http) {
|
|
@@ -6587,8 +6739,7 @@ var Keys = class {
|
|
|
6587
6739
|
}
|
|
6588
6740
|
};
|
|
6589
6741
|
|
|
6590
|
-
|
|
6591
|
-
//#region src/resources/verify.ts
|
|
6742
|
+
// src/resources/verify.ts
|
|
6592
6743
|
var Verify = class {
|
|
6593
6744
|
http;
|
|
6594
6745
|
constructor(http) {
|
|
@@ -6609,8 +6760,7 @@ var Verify = class {
|
|
|
6609
6760
|
}
|
|
6610
6761
|
};
|
|
6611
6762
|
|
|
6612
|
-
|
|
6613
|
-
//#region src/operations.ts
|
|
6763
|
+
// src/operations.ts
|
|
6614
6764
|
/**
|
|
6615
6765
|
* Single source of truth for OpenAPI parity: every `operationId` in
|
|
6616
6766
|
* `apps/docs/openapi/en/gateway.yaml` maps to exactly one dotted method path
|
|
@@ -6711,6 +6861,8 @@ const OPERATION_METHODS = {
|
|
|
6711
6861
|
reopenPublicReviewThread: "shares.reopen",
|
|
6712
6862
|
decidePublicReview: "shares.decide",
|
|
6713
6863
|
createVoiceRevocation: "voiceRevocations.create",
|
|
6864
|
+
addStudioVoiceSingingConsent: "voices.addSingingConsent",
|
|
6865
|
+
revokeStudioVoiceSingingConsent: "voices.revokeSingingConsent",
|
|
6714
6866
|
getVaultAccount: "vault.account",
|
|
6715
6867
|
putVaultAccount: "vault.putAccount",
|
|
6716
6868
|
patchVaultSettings: "vault.updateSettings",
|
|
@@ -6757,6 +6909,12 @@ const OPERATION_METHODS = {
|
|
|
6757
6909
|
listCreativeTemplates: "templates.list",
|
|
6758
6910
|
createStudioProduction: "productions.create",
|
|
6759
6911
|
getStudioProduction: "productions.retrieve",
|
|
6912
|
+
createStudioMusicRoom: "studio.musicRoom.create",
|
|
6913
|
+
listStudioMusicRooms: "studio.musicRoom.list",
|
|
6914
|
+
getStudioMusicRoomQuota: "studio.musicRoom.quota",
|
|
6915
|
+
getStudioMusicRoom: "studio.musicRoom.get",
|
|
6916
|
+
chooseStudioMusicRoom: "studio.musicRoom.choose",
|
|
6917
|
+
directStudioMusicRoom: "studio.musicRoom.direct",
|
|
6760
6918
|
listStudioMediaOps: "mediaOps.list",
|
|
6761
6919
|
quoteStudioMediaOp: "mediaOps.quote",
|
|
6762
6920
|
runStudioMediaOp: "mediaOps.run",
|
|
@@ -6770,6 +6928,9 @@ const OPERATION_METHODS = {
|
|
|
6770
6928
|
getStudioExport: "exports.retrieve",
|
|
6771
6929
|
createCreativeFromDocument: "creatives.fromDocument",
|
|
6772
6930
|
buildCreative: "creatives.build",
|
|
6931
|
+
writeCreativePostCopy: "creatives.postCopy",
|
|
6932
|
+
transcriptCutCreative: "creatives.transcriptCut",
|
|
6933
|
+
regenerateCreativeNode: "creatives.regenerateNode",
|
|
6773
6934
|
createSystemOne: "systemOne.create",
|
|
6774
6935
|
createTranscription: "audio.transcribe",
|
|
6775
6936
|
createSpeech: "audio.speech",
|
|
@@ -7033,8 +7194,7 @@ const RESOLVE_OPERATION_METHODS = {
|
|
|
7033
7194
|
getResolveBalance: "resolve.balance"
|
|
7034
7195
|
};
|
|
7035
7196
|
|
|
7036
|
-
|
|
7037
|
-
//#region src/resources/apps.ts
|
|
7197
|
+
// src/resources/apps.ts
|
|
7038
7198
|
/**
|
|
7039
7199
|
* `CodaiApps` — management client for host apps (studiai.ro, …) that resell
|
|
7040
7200
|
* codai to their own end users. It talks to the mgmt API (`api.codai.ro`),
|
|
@@ -7200,8 +7360,7 @@ var CodaiApps = class {
|
|
|
7200
7360
|
}
|
|
7201
7361
|
};
|
|
7202
7362
|
|
|
7203
|
-
|
|
7204
|
-
//#region src/index.ts
|
|
7363
|
+
// src/index.ts
|
|
7205
7364
|
/**
|
|
7206
7365
|
* codai-sdk — official TypeScript client for the codai AI gateway.
|
|
7207
7366
|
*
|
|
@@ -7231,6 +7390,8 @@ var CodaiApps = class {
|
|
|
7231
7390
|
* built-in starters; free; use with creatives.create({ kind, template, vars }))
|
|
7232
7391
|
* client.productions.create / .retrieve / .wait / .run (codai Studio brief → promo video: storyboard, images,
|
|
7233
7392
|
* voice-over, editable creative, draft render, one review + repair; billed as the parts are produced)
|
|
7393
|
+
* client.studio.musicRoom.create / .get / .list / .choose / .direct / .quota / .wait (codai Studio Music Room: a team
|
|
7394
|
+
* of role agents writes, plays, sings and mixes a song with three approval gates; free within the plan quota)
|
|
7234
7395
|
* client.mediaOps.list / .quote / .run / .job / .wait / .runAndWait (codai Studio media operations on your assets:
|
|
7235
7396
|
* background removal, upscale, inpaint / outpaint / erase, stems, denoise, MIDI, mastering, analysis, ACE-Step
|
|
7236
7397
|
* music and sound effects; quote held, measured cost billed; async ops return a job)
|
|
@@ -7245,6 +7406,8 @@ var CodaiApps = class {
|
|
|
7245
7406
|
* client.shares.get / .remix / .comment / .reply / .resolve / .reopen / .decide (codai Studio share links from the
|
|
7246
7407
|
* outside: read a shared creative, remix a view link, comment and decide through a review link; free)
|
|
7247
7408
|
* client.voiceRevocations.create (public takedown ticket for a voice cloned in codai Studio; no key needed)
|
|
7409
|
+
* client.voices.addSingingConsent / .revokeSingingConsent (voice passport, beta: your own custom voice singing in
|
|
7410
|
+
* Music Room songs; a separate, revocable consent; free)
|
|
7248
7411
|
* client.vault.account / .items / .putItem / .rules / .approvals / .decide / .catalog / .use / .httpCall / .resolve
|
|
7249
7412
|
* client.vault.devices.challenge / .enroll / .list / .rename / .revoke (device approval keys, V-27)
|
|
7250
7413
|
* client.vault.updateSettings / .lock / .unlockChallenge / .unlock / .limits / .setLimits / .revokeTaskGrants (guards, v4)
|
|
@@ -7306,6 +7469,11 @@ var Codai = class {
|
|
|
7306
7469
|
templates;
|
|
7307
7470
|
/** codai Studio productions (`productions.run({ brief, language: 'ro' })` → a finished promo video + editable creative). */
|
|
7308
7471
|
productions;
|
|
7472
|
+
/**
|
|
7473
|
+
* codai Studio namespace. `studio.musicRoom.create({ brief, language: 'ro' })` → a team of role agents makes a song;
|
|
7474
|
+
* answer its gates with `studio.musicRoom.choose(id, …)`, poll with `studio.musicRoom.wait(id, { untilGate: true })`.
|
|
7475
|
+
*/
|
|
7476
|
+
studio;
|
|
7309
7477
|
/** codai Studio media operations (`mediaOps.run('audio.separate_stems', { assetIds })` → job; `mediaOps.wait(id)`). */
|
|
7310
7478
|
mediaOps;
|
|
7311
7479
|
/** codai Studio lyrics (`lyrics.write({ brief, language: 'ro' })`, `lyrics.align({ creative_id, clip_id, lyrics_text })`). */
|
|
@@ -7320,6 +7488,8 @@ var Codai = class {
|
|
|
7320
7488
|
shares;
|
|
7321
7489
|
/** Public takedown tickets for voices cloned in codai Studio (`voiceRevocations.create({ email, … })`; no key needed). */
|
|
7322
7490
|
voiceRevocations;
|
|
7491
|
+
/** codai Studio custom voices: the voice passport singing consent (`voices.addSingingConsent(id, { session_id })`). */
|
|
7492
|
+
voices;
|
|
7323
7493
|
/** Zero-knowledge credentials vault (`vault.items()`, `vault.use({ handle, mode, action })`, `vault.decide(id, …)`). */
|
|
7324
7494
|
vault;
|
|
7325
7495
|
/** Public abuse reports about codai Studio share / review links (`abuseReports.create({ share_token, … })`; no key needed). */
|
|
@@ -7416,6 +7586,7 @@ var Codai = class {
|
|
|
7416
7586
|
this.brandKits = new BrandKits(http);
|
|
7417
7587
|
this.templates = new Templates(http);
|
|
7418
7588
|
this.productions = new Productions(http);
|
|
7589
|
+
this.studio = { musicRoom: new MusicRoom(http) };
|
|
7419
7590
|
this.mediaOps = new MediaOps(http);
|
|
7420
7591
|
this.lyrics = new LyricsResource(http);
|
|
7421
7592
|
this.jam = new Jam({
|
|
@@ -7426,6 +7597,7 @@ var Codai = class {
|
|
|
7426
7597
|
this.batches = new Batches(http);
|
|
7427
7598
|
this.shares = new Shares(http);
|
|
7428
7599
|
this.voiceRevocations = new VoiceRevocations(http);
|
|
7600
|
+
this.voices = new Voices(http);
|
|
7429
7601
|
this.vault = new Vault(http);
|
|
7430
7602
|
this.abuseReports = new AbuseReports(http);
|
|
7431
7603
|
this.provenance = new Provenance(http);
|
|
@@ -7555,6 +7727,5 @@ function allKeys(obj) {
|
|
|
7555
7727
|
return [...keys];
|
|
7556
7728
|
}
|
|
7557
7729
|
|
|
7558
|
-
|
|
7559
|
-
export { AbuseReports, Account, AgentRuns, Agents, Assets, Audio, Batches, Billing, BrandKits, Cards, Chat, ChatCompletions, Codai, Codai as default, CodaiApps, CodaiError, Creatives, Devices, Documents, Embeddings, EnvironmentFiles, EnvironmentJobs, EnvironmentMembers, EnvironmentPorts, EnvironmentSecrets, EnvironmentTasks, Environments, Exports, Feedback, Health, Heartbeats, Hosts, HttpClient, Images, JAM_CLOSE_CODES, JAM_SCALES, JAM_SUBPROTOCOL, Jam, JamSession, Keys, Lists, LyricsResource, MediaOps, Memory, Messages, Models, Music, Notifications, OPERATION_METHODS, OrgMembers, Orgs, OsGate, PROVENANCE_MAX_BYTES, PhoneModels, Productions, Projects, Prompts, Provenance, RESOLVE_ATTESTATION_PAYLOAD_TYPE, RESOLVE_OPERATION_METHODS, RESOLVE_TERMINAL_STATUSES, Realtime, RealtimeSession, Receipts, Referrals, Renders, Research, Resolve, ResolveError, ResolveInsufficientFundsError, Responses, STREAMING_OPERATIONS, SandboxFiles, Sandboxes, ScheduleExecutor, SchedulerHosts, Schedules, SessionControls, SessionEvents, SessionLease, SessionShares, Sessions, Settings, Sfx, Shares, SystemOne, TUS_CHUNK_BYTES, Tasks, Templates, Tokens, Tools, Transcripts, Triggers, Usage, Vault, VaultDevices, Verify, Videos, VoiceRevocations, extensionHeaders, frameJson, isAssetDto, isMediaOpJob, isMediaOpJobFinished, isProductionFinished, isResearchFinished, jamUrl, mergeToolCall, readSse, realtimeUrl, resolveAttestationStatement, settingsConflictCurrent, shareTokenFrom, uploadIdFromLocation, vaultUnlockMessage, verifyAttestationWithKeys, verifyResolveWebhook };
|
|
7730
|
+
export { AbuseReports, Account, AgentRuns, Agents, Assets, Audio, Batches, Billing, BrandKits, Cards, Chat, ChatCompletions, Codai, Codai as default, CodaiApps, CodaiError, Creatives, Devices, Documents, Embeddings, EnvironmentFiles, EnvironmentJobs, EnvironmentMembers, EnvironmentPorts, EnvironmentSecrets, EnvironmentTasks, Environments, Exports, Feedback, Health, Heartbeats, Hosts, HttpClient, Images, JAM_CLOSE_CODES, JAM_SCALES, JAM_SUBPROTOCOL, Jam, JamSession, Keys, Lists, LyricsResource, MediaOps, Memory, Messages, Models, Music, MusicRoom, Notifications, OPERATION_METHODS, OrgMembers, Orgs, OsGate, PROVENANCE_MAX_BYTES, PhoneModels, Productions, Projects, Prompts, Provenance, RESOLVE_ATTESTATION_PAYLOAD_TYPE, RESOLVE_OPERATION_METHODS, RESOLVE_TERMINAL_STATUSES, Realtime, RealtimeSession, Receipts, Referrals, Renders, Research, Resolve, ResolveError, ResolveInsufficientFundsError, Responses, STREAMING_OPERATIONS, SandboxFiles, Sandboxes, ScheduleExecutor, SchedulerHosts, Schedules, SessionControls, SessionEvents, SessionLease, SessionShares, Sessions, Settings, Sfx, Shares, SystemOne, TUS_CHUNK_BYTES, Tasks, Templates, Tokens, Tools, Transcripts, Triggers, Usage, Vault, VaultDevices, Verify, Videos, VoiceRevocations, Voices, extensionHeaders, frameJson, isAssetDto, isMediaOpJob, isMediaOpJobFinished, isMusicRoomFinished, isPagedBuild, isProductionFinished, isResearchFinished, jamUrl, mergeToolCall, readSse, realtimeUrl, resolveAttestationStatement, settingsConflictCurrent, shareTokenFrom, uploadIdFromLocation, vaultUnlockMessage, verifyAttestationWithKeys, verifyResolveWebhook };
|
|
7560
7731
|
//# sourceMappingURL=index.js.map
|