@miosa/sdk 3.0.1 → 3.1.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.js CHANGED
@@ -168,7 +168,7 @@ var TokenRefreshFailedError = class extends MiosaError {
168
168
  };
169
169
 
170
170
  // src/version.ts
171
- var SDK_VERSION = "2.0.0";
171
+ var SDK_VERSION = "3.1.0";
172
172
  var SDK_USER_AGENT = `@miosa/sdk/${SDK_VERSION}`;
173
173
 
174
174
  // src/http.ts
@@ -302,8 +302,9 @@ var HttpClient = class {
302
302
  return new Uint8Array(buffer);
303
303
  }
304
304
  if (response.status === 204) {
305
- return void 0;
305
+ return options.rawResponse ? response : void 0;
306
306
  }
307
+ if (options.rawResponse) return response;
307
308
  return await response.json();
308
309
  } catch (err) {
309
310
  clearTimeout(timer);
@@ -363,10 +364,13 @@ var HttpClient = class {
363
364
  return this.request(path, { method: "POST", formData });
364
365
  }
365
366
  /**
366
- * Open a Server-Sent Events stream. Returns an AsyncIterableIterator of
367
- * parsed event data objects. The caller is responsible for breaking the loop.
367
+ * Open a Server-Sent Events stream and yield each frame's parsed `data:`
368
+ * payload together with its SSE `event:` name (when present). Most callers
369
+ * want {@link stream}; use this when the event name carries meaning — e.g. the
370
+ * sandbox exec stream tags frames as `stdout` / `stderr` / `exit`. The caller
371
+ * is responsible for breaking the loop.
368
372
  */
369
- async *stream(path, options = {}) {
373
+ async *streamFrames(path, options = {}) {
370
374
  const method = options.method ?? "GET";
371
375
  let headers = this.baseHeaders({
372
376
  Accept: "text/event-stream",
@@ -413,6 +417,7 @@ var HttpClient = class {
413
417
  const reader = response.body.getReader();
414
418
  const decoder = new TextDecoder();
415
419
  let buffer = "";
420
+ let event = null;
416
421
  try {
417
422
  while (true) {
418
423
  const { done, value } = await reader.read();
@@ -420,12 +425,22 @@ var HttpClient = class {
420
425
  buffer += decoder.decode(value, { stream: true });
421
426
  const lines = buffer.split("\n");
422
427
  buffer = lines.pop() ?? "";
423
- for (const line of lines) {
428
+ for (const rawLine of lines) {
429
+ const line = rawLine.replace(/\r$/, "");
430
+ if (line === "") {
431
+ event = null;
432
+ continue;
433
+ }
434
+ if (line.startsWith(":")) continue;
435
+ if (line.startsWith("event:")) {
436
+ event = line.slice(6).trim();
437
+ continue;
438
+ }
424
439
  if (line.startsWith("data:")) {
425
440
  const raw = line.slice(5).trim();
426
441
  if (raw === "[DONE]" || raw === "") continue;
427
442
  try {
428
- yield JSON.parse(raw);
443
+ yield { event, data: JSON.parse(raw) };
429
444
  } catch {
430
445
  }
431
446
  }
@@ -436,6 +451,15 @@ var HttpClient = class {
436
451
  reader.releaseLock();
437
452
  }
438
453
  }
454
+ /**
455
+ * Open a Server-Sent Events stream. Returns an AsyncIterableIterator of
456
+ * parsed event data objects. The caller is responsible for breaking the loop.
457
+ */
458
+ async *stream(path, options = {}) {
459
+ for await (const frame of this.streamFrames(path, options)) {
460
+ yield frame.data;
461
+ }
462
+ }
439
463
  };
440
464
 
441
465
  // src/resources/admin.ts
@@ -1258,8 +1282,69 @@ var AgentRuntimeProfiles = class {
1258
1282
  }
1259
1283
  };
1260
1284
 
1261
- // src/resources/runs.ts
1285
+ // src/resources/agent-definitions.ts
1262
1286
  function unwrap5(payload) {
1287
+ if (payload !== null && typeof payload === "object" && "data" in payload && payload.data !== void 0) {
1288
+ return payload.data;
1289
+ }
1290
+ return payload;
1291
+ }
1292
+ var AgentDefinitions = class {
1293
+ constructor(http) {
1294
+ this.http = http;
1295
+ }
1296
+ http;
1297
+ async list(params = {}) {
1298
+ return unwrap5(
1299
+ await this.http.get("/agents", {
1300
+ workspace_id: params.workspaceId ?? params.workspace_id,
1301
+ project_id: params.projectId ?? params.project_id,
1302
+ status: params.status
1303
+ })
1304
+ );
1305
+ }
1306
+ async get(id) {
1307
+ return unwrap5(
1308
+ await this.http.get(
1309
+ `/agents/${encodeURIComponent(id)}`
1310
+ )
1311
+ );
1312
+ }
1313
+ async create(params) {
1314
+ return unwrap5(
1315
+ await this.http.post(
1316
+ "/agents",
1317
+ {
1318
+ workspace_id: params.workspaceId ?? params.workspace_id,
1319
+ project_id: params.projectId ?? params.project_id,
1320
+ name: params.name,
1321
+ description: params.description,
1322
+ metadata: params.metadata,
1323
+ configuration: params.configuration
1324
+ }
1325
+ )
1326
+ );
1327
+ }
1328
+ async update(id, params) {
1329
+ return unwrap5(
1330
+ await this.http.patch(`/agents/${encodeURIComponent(id)}`, params)
1331
+ );
1332
+ }
1333
+ async publish(id, configuration) {
1334
+ return unwrap5(
1335
+ await this.http.post(
1336
+ `/agents/${encodeURIComponent(id)}/versions`,
1337
+ { configuration }
1338
+ )
1339
+ );
1340
+ }
1341
+ async archive(id) {
1342
+ await this.http.delete(`/agents/${encodeURIComponent(id)}`);
1343
+ }
1344
+ };
1345
+
1346
+ // src/resources/runs.ts
1347
+ function unwrap6(payload) {
1263
1348
  if (payload && typeof payload === "object" && "data" in payload) {
1264
1349
  return payload.data;
1265
1350
  }
@@ -1298,24 +1383,24 @@ var Runs = class {
1298
1383
  status: params.status
1299
1384
  })
1300
1385
  );
1301
- const data = unwrap5(
1386
+ const data = unwrap6(
1302
1387
  response
1303
1388
  );
1304
1389
  if (Array.isArray(data)) return data;
1305
1390
  return data.runs ?? data.items ?? [];
1306
1391
  }
1307
1392
  async get(id) {
1308
- return unwrap5(
1393
+ return unwrap6(
1309
1394
  await this.http.get(`/runs/${encodeURIComponent(id)}`)
1310
1395
  );
1311
1396
  }
1312
1397
  async outputs(id) {
1313
- return unwrap5(
1398
+ return unwrap6(
1314
1399
  await this.http.get(`/runs/${encodeURIComponent(id)}/outputs`)
1315
1400
  );
1316
1401
  }
1317
1402
  async files(id) {
1318
- const data = unwrap5(
1403
+ const data = unwrap6(
1319
1404
  await this.http.get(`/runs/${encodeURIComponent(id)}/files`)
1320
1405
  );
1321
1406
  if (Array.isArray(data)) return data;
@@ -1330,33 +1415,33 @@ var Runs = class {
1330
1415
  );
1331
1416
  }
1332
1417
  async messages(id) {
1333
- const data = unwrap5(
1418
+ const data = unwrap6(
1334
1419
  await this.http.get(`/runs/${encodeURIComponent(id)}/messages`)
1335
1420
  );
1336
1421
  if (Array.isArray(data)) return data;
1337
1422
  return data.messages ?? data.items ?? [];
1338
1423
  }
1339
1424
  async commandOutput(id) {
1340
- return unwrap5(
1425
+ return unwrap6(
1341
1426
  await this.http.get(`/runs/${encodeURIComponent(id)}/command-output`)
1342
1427
  );
1343
1428
  }
1344
1429
  async activity(id) {
1345
- const data = unwrap5(
1430
+ const data = unwrap6(
1346
1431
  await this.http.get(`/runs/${encodeURIComponent(id)}/activity`)
1347
1432
  );
1348
1433
  if (Array.isArray(data)) return data;
1349
1434
  return data.activity ?? data.items ?? [];
1350
1435
  }
1351
1436
  async previews(id) {
1352
- const data = unwrap5(
1437
+ const data = unwrap6(
1353
1438
  await this.http.get(`/runs/${encodeURIComponent(id)}/previews`)
1354
1439
  );
1355
1440
  if (Array.isArray(data)) return data;
1356
1441
  return data.previews ?? data.items ?? [];
1357
1442
  }
1358
1443
  async diagnostics(id) {
1359
- const data = unwrap5(await this.http.get(`/runs/${encodeURIComponent(id)}/diagnostics`));
1444
+ const data = unwrap6(await this.http.get(`/runs/${encodeURIComponent(id)}/diagnostics`));
1360
1445
  if (Array.isArray(data)) return data;
1361
1446
  return data.diagnostics ?? data.items ?? [];
1362
1447
  }
@@ -1403,6 +1488,9 @@ var Runs = class {
1403
1488
  env: params.env,
1404
1489
  agent_runtime_profile_id: params.agentRuntimeProfileId,
1405
1490
  agent_profile_id: params.agentProfileId,
1491
+ agent_definition_id: params.agentDefinitionId,
1492
+ agent_version_id: params.agentVersionId,
1493
+ configuration_receipt: params.configurationReceipt,
1406
1494
  run_group_id: params.runGroupId,
1407
1495
  parent_run_id: params.parentRunId,
1408
1496
  orchestration_role: params.orchestrationRole,
@@ -1416,10 +1504,10 @@ var Runs = class {
1416
1504
  capability_requirements: params.capabilityRequirements,
1417
1505
  metadata: params.metadata
1418
1506
  });
1419
- return unwrap5(await this.http.post("/runs", body5));
1507
+ return unwrap6(await this.http.post("/runs", body5));
1420
1508
  }
1421
1509
  async cancel(id) {
1422
- return unwrap5(
1510
+ return unwrap6(
1423
1511
  await this.http.post(
1424
1512
  `/runs/${encodeURIComponent(id)}/cancel`,
1425
1513
  {}
@@ -1429,7 +1517,7 @@ var Runs = class {
1429
1517
  };
1430
1518
 
1431
1519
  // src/resources/analytics.ts
1432
- function unwrap6(payload) {
1520
+ function unwrap7(payload) {
1433
1521
  if (payload && typeof payload === "object") {
1434
1522
  const p = payload;
1435
1523
  for (const k of ["data", "analytics", "series", "items"]) {
@@ -1452,16 +1540,16 @@ var Analytics = class {
1452
1540
  async overview(filters = {}) {
1453
1541
  const query3 = stripUndefined5(filters);
1454
1542
  const data = await this.http.get("/analytics/overview", query3);
1455
- return unwrap6(data);
1543
+ return unwrap7(data);
1456
1544
  }
1457
1545
  /** Get a timeseries for a metric over a period. */
1458
1546
  async timeseries(params = {}) {
1459
1547
  const query3 = stripUndefined5(params);
1460
1548
  const data = await this.http.get("/analytics/timeseries", query3);
1461
- return unwrap6(data);
1549
+ return unwrap7(data);
1462
1550
  }
1463
1551
  };
1464
- function unwrap7(payload) {
1552
+ function unwrap8(payload) {
1465
1553
  if (payload && typeof payload === "object" && "data" in payload) {
1466
1554
  return payload.data;
1467
1555
  }
@@ -1506,7 +1594,7 @@ var ApiKeys = class {
1506
1594
  body: body5,
1507
1595
  headers: { "Idempotency-Key": idempotencyKey(ikey) }
1508
1596
  });
1509
- return unwrap7(data);
1597
+ return unwrap8(data);
1510
1598
  }
1511
1599
  /** POST /api/v1/api-keys/scoped — L2 delegation token bound to one external user. */
1512
1600
  async createScoped(params) {
@@ -1515,7 +1603,7 @@ var ApiKeys = class {
1515
1603
  scopes: params.scopes,
1516
1604
  expires_at: params.expiresAt
1517
1605
  });
1518
- return unwrap7(
1606
+ return unwrap8(
1519
1607
  await this.http.post("/api-keys/scoped", body5)
1520
1608
  );
1521
1609
  }
@@ -1524,8 +1612,190 @@ var ApiKeys = class {
1524
1612
  }
1525
1613
  };
1526
1614
 
1615
+ // src/resources/app-documents.ts
1616
+ function unwrap9(payload) {
1617
+ return payload && typeof payload === "object" && "data" in payload ? payload.data : payload;
1618
+ }
1619
+ var AppDocuments = class {
1620
+ constructor(http) {
1621
+ this.http = http;
1622
+ }
1623
+ http;
1624
+ async list(workspaceId2) {
1625
+ const payload = await this.http.get(
1626
+ "/builder/apps",
1627
+ { workspace_id: workspaceId2 }
1628
+ );
1629
+ return payload.data;
1630
+ }
1631
+ async get(id) {
1632
+ return unwrap9(
1633
+ await this.http.get(
1634
+ `/builder/apps/${id}`
1635
+ )
1636
+ );
1637
+ }
1638
+ async create(params) {
1639
+ const { workspaceId: workspaceId2, ...body5 } = params;
1640
+ return unwrap9(
1641
+ await this.http.post(
1642
+ "/builder/apps",
1643
+ { ...body5, workspace_id: workspaceId2 }
1644
+ )
1645
+ );
1646
+ }
1647
+ async update(id, params) {
1648
+ return unwrap9(
1649
+ await this.http.patch(`/builder/apps/${id}`, params)
1650
+ );
1651
+ }
1652
+ async archive(id) {
1653
+ await this.http.delete(`/builder/apps/${id}`);
1654
+ }
1655
+ async diagnostics(id) {
1656
+ return unwrap9(
1657
+ await this.http.get(`/builder/apps/${id}/diagnostics`)
1658
+ );
1659
+ }
1660
+ async stageCandidate(id) {
1661
+ return unwrap9(
1662
+ await this.http.post(`/builder/apps/${id}/candidates`, {})
1663
+ );
1664
+ }
1665
+ async approveExactVersion(id, releaseId, reason) {
1666
+ return unwrap9(
1667
+ await this.http.post(`/builder/apps/${id}/approvals`, {
1668
+ reason,
1669
+ release_id: releaseId
1670
+ })
1671
+ );
1672
+ }
1673
+ async publishExactRelease(id) {
1674
+ const payload = await this.http.post(`/builder/apps/${id}/publish`, {});
1675
+ return unwrap9(payload).app;
1676
+ }
1677
+ async listData(id, collection) {
1678
+ const payload = await this.http.get(
1679
+ `/builder/apps/${encodeURIComponent(id)}/data/${encodeURIComponent(collection)}`
1680
+ );
1681
+ return payload.data;
1682
+ }
1683
+ async getData(id, collection, key) {
1684
+ return unwrap9(
1685
+ await this.http.get(
1686
+ `/builder/apps/${encodeURIComponent(id)}/data/${encodeURIComponent(collection)}/${encodeURIComponent(key)}`
1687
+ )
1688
+ );
1689
+ }
1690
+ async putData(id, collection, key, value, expectedVersion) {
1691
+ return unwrap9(
1692
+ await this.http.put(
1693
+ `/builder/apps/${encodeURIComponent(id)}/data/${encodeURIComponent(collection)}/${encodeURIComponent(key)}`,
1694
+ { value, expected_version: expectedVersion }
1695
+ )
1696
+ );
1697
+ }
1698
+ async deleteData(id, collection, key, expectedVersion) {
1699
+ const suffix = expectedVersion === void 0 ? "" : `?expected_version=${encodeURIComponent(String(expectedVersion))}`;
1700
+ await this.http.delete(
1701
+ `/builder/apps/${encodeURIComponent(id)}/data/${encodeURIComponent(collection)}/${encodeURIComponent(key)}${suffix}`
1702
+ );
1703
+ }
1704
+ async authorizeAction(id, input) {
1705
+ return this.http.request(
1706
+ `/actions/apps/${encodeURIComponent(id)}/authorize`,
1707
+ {
1708
+ method: "POST",
1709
+ headers: {
1710
+ "x-miosa-app-callback-token": input.callbackToken
1711
+ },
1712
+ body: {
1713
+ release_id: input.releaseId,
1714
+ capability: input.capability,
1715
+ request_fingerprint: input.requestFingerprint,
1716
+ params_fingerprint: input.paramsFingerprint,
1717
+ connector_id: input.connectorId
1718
+ }
1719
+ }
1720
+ );
1721
+ }
1722
+ async mintRuntimeToken(id) {
1723
+ return unwrap9(
1724
+ await this.http.post(
1725
+ `/builder/apps/${encodeURIComponent(id)}/runtime-token`,
1726
+ {}
1727
+ )
1728
+ );
1729
+ }
1730
+ async resolveBinding(id, bindingId, receiptId, callbackToken) {
1731
+ return unwrap9(
1732
+ await this.http.request(
1733
+ `/builder/apps/${encodeURIComponent(id)}/runtime/bindings/${encodeURIComponent(bindingId)}?receipt_id=${encodeURIComponent(receiptId)}`,
1734
+ {
1735
+ method: "GET",
1736
+ headers: {
1737
+ "x-miosa-app-callback-token": callbackToken
1738
+ }
1739
+ }
1740
+ )
1741
+ );
1742
+ }
1743
+ async listAutomationRuns(id) {
1744
+ const payload = await this.http.get(
1745
+ `/builder/apps/${encodeURIComponent(id)}/automation-runs`
1746
+ );
1747
+ return payload.data;
1748
+ }
1749
+ async startAutomationRun(id, automationId, trigger = {}) {
1750
+ return unwrap9(
1751
+ await this.http.post(
1752
+ `/builder/apps/${encodeURIComponent(id)}/automations/${encodeURIComponent(automationId)}/runs`,
1753
+ { trigger }
1754
+ )
1755
+ );
1756
+ }
1757
+ async claimAutomationStep(id, runId) {
1758
+ return unwrap9(
1759
+ await this.http.post(
1760
+ `/builder/apps/${encodeURIComponent(id)}/automation-runs/${encodeURIComponent(runId)}/claim`,
1761
+ {}
1762
+ )
1763
+ );
1764
+ }
1765
+ async completeAutomationStep(id, runId, cursor, idempotencyKey11, output = null) {
1766
+ return unwrap9(
1767
+ await this.http.post(
1768
+ `/builder/apps/${encodeURIComponent(id)}/automation-runs/${encodeURIComponent(runId)}/complete`,
1769
+ {
1770
+ cursor,
1771
+ idempotency_key: idempotencyKey11,
1772
+ output
1773
+ }
1774
+ )
1775
+ );
1776
+ }
1777
+ async failAutomationStep(id, runId, cursor, idempotencyKey11, reason) {
1778
+ return unwrap9(
1779
+ await this.http.post(
1780
+ `/builder/apps/${encodeURIComponent(id)}/automation-runs/${encodeURIComponent(runId)}/fail`,
1781
+ {
1782
+ cursor,
1783
+ idempotency_key: idempotencyKey11,
1784
+ reason
1785
+ }
1786
+ )
1787
+ );
1788
+ }
1789
+ async revokeApproval(id, approvalId) {
1790
+ await this.http.post(
1791
+ `/builder/apps/${id}/approvals/${approvalId}/revoke`,
1792
+ {}
1793
+ );
1794
+ }
1795
+ };
1796
+
1527
1797
  // src/resources/audit-log.ts
1528
- function unwrap8(payload) {
1798
+ function unwrap10(payload) {
1529
1799
  if (payload && typeof payload === "object") {
1530
1800
  const p = payload;
1531
1801
  for (const k of ["data", "audit_log", "events", "items"]) {
@@ -1548,14 +1818,14 @@ var AuditLog = class {
1548
1818
  async list(params = {}) {
1549
1819
  const query3 = stripUndefined7(params);
1550
1820
  const data = await this.http.get("/audit-log", query3);
1551
- const result = unwrap8(data);
1821
+ const result = unwrap10(data);
1552
1822
  if (Array.isArray(result)) return result;
1553
1823
  return [];
1554
1824
  }
1555
1825
  };
1556
1826
 
1557
1827
  // src/resources/benchmarks.ts
1558
- function unwrap9(data) {
1828
+ function unwrap11(data) {
1559
1829
  if (data && typeof data === "object") {
1560
1830
  const d = data;
1561
1831
  for (const k of ["data", "benchmarks", "samples", "items"]) {
@@ -1587,7 +1857,7 @@ var Benchmarks = class {
1587
1857
  return unwrapList(data);
1588
1858
  }
1589
1859
  async get(benchmarkId) {
1590
- return unwrap9(
1860
+ return unwrap11(
1591
1861
  await this.http.get(`/admin/benchmarks/${benchmarkId}`)
1592
1862
  );
1593
1863
  }
@@ -1596,10 +1866,10 @@ var Benchmarks = class {
1596
1866
  const body5 = Object.fromEntries(
1597
1867
  Object.entries(params).filter(([, v]) => v !== void 0)
1598
1868
  );
1599
- return unwrap9(await this.http.post("/admin/benchmarks", body5));
1869
+ return unwrap11(await this.http.post("/admin/benchmarks", body5));
1600
1870
  }
1601
1871
  async cancel(benchmarkId) {
1602
- return unwrap9(
1872
+ return unwrap11(
1603
1873
  await this.http.post(`/admin/benchmarks/${benchmarkId}/cancel`)
1604
1874
  );
1605
1875
  }
@@ -1619,14 +1889,14 @@ var Benchmarks = class {
1619
1889
  const body5 = Object.fromEntries(
1620
1890
  Object.entries(params).filter(([, v]) => v !== void 0)
1621
1891
  );
1622
- return unwrap9(
1892
+ return unwrap11(
1623
1893
  await this.http.post("/admin/benchmarks/compare", body5)
1624
1894
  );
1625
1895
  }
1626
1896
  };
1627
1897
 
1628
1898
  // src/resources/builder-sessions.ts
1629
- function unwrap10(data) {
1899
+ function unwrap12(data) {
1630
1900
  if (data && typeof data === "object") {
1631
1901
  const d = data;
1632
1902
  for (const k of ["data", "sessions", "items"]) {
@@ -1663,7 +1933,7 @@ var BuilderSessions = class {
1663
1933
  return all.find((s) => s.id === sessionId) ?? {};
1664
1934
  }
1665
1935
  async updateTitle(sessionId, title) {
1666
- return unwrap10(
1936
+ return unwrap12(
1667
1937
  await this.http.patch(`/builder/sessions/${sessionId}/title`, {
1668
1938
  title
1669
1939
  })
@@ -1675,7 +1945,7 @@ var BuilderSessions = class {
1675
1945
  };
1676
1946
 
1677
1947
  // src/resources/channels.ts
1678
- function unwrap11(payload) {
1948
+ function unwrap13(payload) {
1679
1949
  if (payload && typeof payload === "object") {
1680
1950
  const p = payload;
1681
1951
  for (const k of ["data", "channels", "notifications", "items"]) {
@@ -1703,26 +1973,26 @@ var Channels = class {
1703
1973
  async list(params = {}) {
1704
1974
  const query3 = stripUndefined8(params);
1705
1975
  const data = await this.http.get("/channels", query3);
1706
- const result = unwrap11(data);
1976
+ const result = unwrap13(data);
1707
1977
  if (Array.isArray(result)) return result;
1708
1978
  return [];
1709
1979
  }
1710
1980
  /** Get a single channel. */
1711
1981
  async get(channelId) {
1712
1982
  const data = await this.http.get(`/channels/${channelId}`);
1713
- return unwrap11(data);
1983
+ return unwrap13(data);
1714
1984
  }
1715
1985
  /** Create a new channel. */
1716
1986
  async create(params) {
1717
1987
  const body5 = stripUndefObj(params);
1718
1988
  const data = await this.http.post("/channels", body5);
1719
- return unwrap11(data);
1989
+ return unwrap13(data);
1720
1990
  }
1721
1991
  /** Update a channel. */
1722
1992
  async update(channelId, params) {
1723
1993
  const body5 = stripUndefObj(params);
1724
1994
  const data = await this.http.patch(`/channels/${channelId}`, body5);
1725
- return unwrap11(data);
1995
+ return unwrap13(data);
1726
1996
  }
1727
1997
  /** Delete a channel. */
1728
1998
  async delete(channelId) {
@@ -1732,30 +2002,30 @@ var Channels = class {
1732
2002
  /** Get notification preferences across all channels. */
1733
2003
  async listNotifications() {
1734
2004
  const data = await this.http.get("/channels/notifications");
1735
- return unwrap11(data);
2005
+ return unwrap13(data);
1736
2006
  }
1737
2007
  /** Update notification preferences. */
1738
2008
  async updateNotifications(params) {
1739
2009
  const body5 = stripUndefObj(params);
1740
2010
  const data = await this.http.put("/channels/notifications", body5);
1741
- return unwrap11(data);
2011
+ return unwrap13(data);
1742
2012
  }
1743
2013
  /** Enable a channel. */
1744
2014
  async enable(channelId) {
1745
2015
  const data = await this.http.post(`/channels/${channelId}/enable`);
1746
- return unwrap11(data);
2016
+ return unwrap13(data);
1747
2017
  }
1748
2018
  /** Disable a channel. */
1749
2019
  async disable(channelId) {
1750
2020
  const data = await this.http.post(
1751
2021
  `/channels/${channelId}/disable`
1752
2022
  );
1753
- return unwrap11(data);
2023
+ return unwrap13(data);
1754
2024
  }
1755
2025
  };
1756
2026
 
1757
2027
  // src/resources/cloud.ts
1758
- function unwrap12(payload) {
2028
+ function unwrap14(payload) {
1759
2029
  if (payload !== null && typeof payload === "object" && "data" in payload && payload.data !== void 0) {
1760
2030
  return payload.data;
1761
2031
  }
@@ -1830,12 +2100,12 @@ var Cloud = class {
1830
2100
  }
1831
2101
  http;
1832
2102
  async listAccounts() {
1833
- return unwrap12(
2103
+ return unwrap14(
1834
2104
  await this.http.get("/cloud/accounts")
1835
2105
  );
1836
2106
  }
1837
2107
  async createAccount(params) {
1838
- return unwrap12(
2108
+ return unwrap14(
1839
2109
  await this.http.post(
1840
2110
  "/cloud/accounts",
1841
2111
  accountBody(params)
@@ -1843,7 +2113,7 @@ var Cloud = class {
1843
2113
  );
1844
2114
  }
1845
2115
  async attachAwsRole(id, params) {
1846
- return unwrap12(
2116
+ return unwrap14(
1847
2117
  await this.http.post(
1848
2118
  `/cloud/accounts/${encodeURIComponent(id)}/aws/role`,
1849
2119
  stripUndefined9({
@@ -1854,7 +2124,7 @@ var Cloud = class {
1854
2124
  );
1855
2125
  }
1856
2126
  async listRegions(params = {}) {
1857
- return unwrap12(
2127
+ return unwrap14(
1858
2128
  await this.http.get(
1859
2129
  "/cloud/regions",
1860
2130
  query(params)
@@ -1862,7 +2132,7 @@ var Cloud = class {
1862
2132
  );
1863
2133
  }
1864
2134
  async createRegion(params) {
1865
- return unwrap12(
2135
+ return unwrap14(
1866
2136
  await this.http.post(
1867
2137
  "/cloud/regions",
1868
2138
  regionBody(params)
@@ -1870,12 +2140,12 @@ var Cloud = class {
1870
2140
  );
1871
2141
  }
1872
2142
  async listPools(params = {}) {
1873
- return unwrap12(
2143
+ return unwrap14(
1874
2144
  await this.http.get("/cloud/pools", query(params))
1875
2145
  );
1876
2146
  }
1877
2147
  async createPool(params) {
1878
- return unwrap12(
2148
+ return unwrap14(
1879
2149
  await this.http.post(
1880
2150
  "/cloud/pools",
1881
2151
  poolBody(params)
@@ -1883,7 +2153,7 @@ var Cloud = class {
1883
2153
  );
1884
2154
  }
1885
2155
  async listPreflights(params = {}) {
1886
- return unwrap12(
2156
+ return unwrap14(
1887
2157
  await this.http.get(
1888
2158
  "/cloud/preflights",
1889
2159
  query(params)
@@ -1891,7 +2161,7 @@ var Cloud = class {
1891
2161
  );
1892
2162
  }
1893
2163
  async recordPreflight(params) {
1894
- return unwrap12(
2164
+ return unwrap14(
1895
2165
  await this.http.post(
1896
2166
  "/cloud/preflights",
1897
2167
  preflightBody(params)
@@ -1901,7 +2171,7 @@ var Cloud = class {
1901
2171
  };
1902
2172
 
1903
2173
  // src/resources/command-center.ts
1904
- function unwrap13(data) {
2174
+ function unwrap15(data) {
1905
2175
  if (data && typeof data === "object") {
1906
2176
  const d = data;
1907
2177
  for (const k of [
@@ -1935,7 +2205,7 @@ var CommandCenter = class {
1935
2205
  http;
1936
2206
  /** Top-level snapshot (GET /command-center). */
1937
2207
  async overview() {
1938
- return unwrap13(await this.http.get("/command-center"));
2208
+ return unwrap15(await this.http.get("/command-center"));
1939
2209
  }
1940
2210
  async agents() {
1941
2211
  return unwrapList3(await this.http.get("/command-center/agents"));
@@ -1946,13 +2216,13 @@ var CommandCenter = class {
1946
2216
  );
1947
2217
  }
1948
2218
  async metrics() {
1949
- return unwrap13(await this.http.get("/command-center/metrics"));
2219
+ return unwrap15(await this.http.get("/command-center/metrics"));
1950
2220
  }
1951
2221
  async presets() {
1952
2222
  return unwrapList3(await this.http.get("/command-center/presets"));
1953
2223
  }
1954
2224
  async tiers() {
1955
- return unwrap13(await this.http.get("/command-center/tiers"));
2225
+ return unwrap15(await this.http.get("/command-center/tiers"));
1956
2226
  }
1957
2227
  /** Stream live command-center events via SSE. */
1958
2228
  events() {
@@ -1961,7 +2231,7 @@ var CommandCenter = class {
1961
2231
  };
1962
2232
 
1963
2233
  // src/resources/community.ts
1964
- function unwrap14(data) {
2234
+ function unwrap16(data) {
1965
2235
  if (data && typeof data === "object") {
1966
2236
  const d = data;
1967
2237
  for (const k of ["data", "templates", "agents", "items"]) {
@@ -1993,7 +2263,7 @@ var Community = class {
1993
2263
  return unwrapList4(await this.http.get("/community/agents", query3));
1994
2264
  }
1995
2265
  async getAgent(agentId) {
1996
- return unwrap14(await this.http.get(`/community/agents/${agentId}`));
2266
+ return unwrap16(await this.http.get(`/community/agents/${agentId}`));
1997
2267
  }
1998
2268
  // ── Templates ─────────────────────────────────────────────────────────
1999
2269
  async listTemplates(filters = {}) {
@@ -2005,7 +2275,7 @@ var Community = class {
2005
2275
  );
2006
2276
  }
2007
2277
  async getTemplate(templateId) {
2008
- return unwrap14(
2278
+ return unwrap16(
2009
2279
  await this.http.get(`/community/templates/${templateId}`)
2010
2280
  );
2011
2281
  }
@@ -2014,7 +2284,7 @@ var Community = class {
2014
2284
  const body5 = Object.fromEntries(
2015
2285
  Object.entries(opts).filter(([, v]) => v !== void 0)
2016
2286
  );
2017
- return unwrap14(
2287
+ return unwrap16(
2018
2288
  await this.http.post(
2019
2289
  `/community/templates/${templateId}/install`,
2020
2290
  body5
@@ -2029,7 +2299,7 @@ var Community = class {
2029
2299
  Object.entries(opts).filter(([, v]) => v !== void 0)
2030
2300
  )
2031
2301
  };
2032
- return unwrap14(
2302
+ return unwrap16(
2033
2303
  await this.http.post(
2034
2304
  `/community/templates/${templateId}/rate`,
2035
2305
  body5
@@ -2039,7 +2309,7 @@ var Community = class {
2039
2309
  };
2040
2310
 
2041
2311
  // src/resources/completions.ts
2042
- function unwrap15(data) {
2312
+ function unwrap17(data) {
2043
2313
  if (data && typeof data === "object") {
2044
2314
  const d = data;
2045
2315
  if (Array.isArray(d.choices)) return d;
@@ -2065,7 +2335,7 @@ var Completions = class {
2065
2335
  { method: "POST", body: body5 }
2066
2336
  );
2067
2337
  }
2068
- return this.http.post("/intelligence/completions", body5).then(unwrap15);
2338
+ return this.http.post("/intelligence/completions", body5).then(unwrap17);
2069
2339
  }
2070
2340
  chat(params) {
2071
2341
  const body5 = buildBody(params);
@@ -2075,7 +2345,7 @@ var Completions = class {
2075
2345
  { method: "POST", body: body5 }
2076
2346
  );
2077
2347
  }
2078
- return this.http.post("/intelligence/chat/completions", body5).then(unwrap15);
2348
+ return this.http.post("/intelligence/chat/completions", body5).then(unwrap17);
2079
2349
  }
2080
2350
  };
2081
2351
 
@@ -2198,7 +2468,7 @@ var Checkpoints = class {
2198
2468
  };
2199
2469
 
2200
2470
  // src/resources/computer-auto-stop.ts
2201
- function unwrap16(data) {
2471
+ function unwrap18(data) {
2202
2472
  if (data && typeof data === "object") {
2203
2473
  const d = data;
2204
2474
  if ("data" in d && Object.keys(d).length <= 2) {
@@ -2216,13 +2486,13 @@ var ComputerAutoStop = class {
2216
2486
  computerId;
2217
2487
  /** Return the current auto-stop configuration. */
2218
2488
  async get() {
2219
- return unwrap16(
2489
+ return unwrap18(
2220
2490
  await this.http.get(`/computers/${this.computerId}/auto-stop`)
2221
2491
  );
2222
2492
  }
2223
2493
  /** Set the idle timeout in seconds (0 disables auto-stop). */
2224
2494
  async update(seconds) {
2225
- return unwrap16(
2495
+ return unwrap18(
2226
2496
  await this.http.patch(
2227
2497
  `/computers/${this.computerId}/auto-stop`,
2228
2498
  { seconds }
@@ -2232,7 +2502,7 @@ var ComputerAutoStop = class {
2232
2502
  };
2233
2503
 
2234
2504
  // src/resources/computer-env.ts
2235
- function unwrap17(data) {
2505
+ function unwrap19(data) {
2236
2506
  if (data && typeof data === "object") {
2237
2507
  const d = data;
2238
2508
  if ("data" in d && Object.keys(d).length <= 2) {
@@ -2267,11 +2537,11 @@ var ComputerEnv = class {
2267
2537
  }
2268
2538
  /** Create a new env var. Use update() to change an existing one. */
2269
2539
  async set(name, value) {
2270
- return unwrap17(await this.http.post(this.base(), { name, value }));
2540
+ return unwrap19(await this.http.post(this.base(), { name, value }));
2271
2541
  }
2272
2542
  /** Patch the value of an existing env var by name. */
2273
2543
  async update(name, value) {
2274
- return unwrap17(
2544
+ return unwrap19(
2275
2545
  await this.http.patch(`${this.base()}/${name}`, { value })
2276
2546
  );
2277
2547
  }
@@ -2288,7 +2558,7 @@ var ComputerEnv = class {
2288
2558
  };
2289
2559
 
2290
2560
  // src/resources/computer-logs.ts
2291
- function unwrap18(data) {
2561
+ function unwrap20(data) {
2292
2562
  if (data && typeof data === "object") {
2293
2563
  const d = data;
2294
2564
  if ("data" in d && Object.keys(d).length <= 2) {
@@ -2309,7 +2579,7 @@ var ComputerLogs = class {
2309
2579
  const query3 = Object.fromEntries(
2310
2580
  Object.entries(params).filter(([, v]) => v !== void 0)
2311
2581
  );
2312
- return unwrap18(
2582
+ return unwrap20(
2313
2583
  await this.http.get(`/computers/${this.computerId}/logs`, query3)
2314
2584
  );
2315
2585
  }
@@ -2322,7 +2592,7 @@ var ComputerLogs = class {
2322
2592
  };
2323
2593
 
2324
2594
  // src/resources/computer-osa.ts
2325
- function unwrap19(data) {
2595
+ function unwrap21(data) {
2326
2596
  if (data && typeof data === "object") {
2327
2597
  const d = data;
2328
2598
  if ("data" in d && Object.keys(d).length <= 2) {
@@ -2346,7 +2616,7 @@ var ComputerOsa = class {
2346
2616
  Object.entries(params).filter(([, v]) => v !== void 0)
2347
2617
  )
2348
2618
  };
2349
- return unwrap19(
2619
+ return unwrap21(
2350
2620
  await this.http.post(
2351
2621
  `/computers/${this.computerId}/osa/task`,
2352
2622
  body5
@@ -2355,13 +2625,13 @@ var ComputerOsa = class {
2355
2625
  }
2356
2626
  /** Cancel the currently-running OSA task, if any. */
2357
2627
  async cancelTask() {
2358
- return unwrap19(
2628
+ return unwrap21(
2359
2629
  await this.http.delete(`/computers/${this.computerId}/osa/task`)
2360
2630
  );
2361
2631
  }
2362
2632
  /** Return OSA's current task / configuration / health snapshot. */
2363
2633
  async status() {
2364
- return unwrap19(
2634
+ return unwrap21(
2365
2635
  await this.http.get(`/computers/${this.computerId}/osa/status`)
2366
2636
  );
2367
2637
  }
@@ -2370,7 +2640,7 @@ var ComputerOsa = class {
2370
2640
  const body5 = Object.fromEntries(
2371
2641
  Object.entries(config).filter(([, v]) => v !== void 0)
2372
2642
  );
2373
- return unwrap19(
2643
+ return unwrap21(
2374
2644
  await this.http.post(
2375
2645
  `/computers/${this.computerId}/osa/configure`,
2376
2646
  body5
@@ -2380,7 +2650,7 @@ var ComputerOsa = class {
2380
2650
  };
2381
2651
 
2382
2652
  // src/resources/computer-ports.ts
2383
- function unwrap20(data) {
2653
+ function unwrap22(data) {
2384
2654
  if (data && typeof data === "object") {
2385
2655
  const d = data;
2386
2656
  if ("data" in d && Object.keys(d).length <= 2) {
@@ -2425,14 +2695,14 @@ var ComputerPorts = class {
2425
2695
  Object.entries(opts).filter(([, v]) => v !== void 0)
2426
2696
  )
2427
2697
  };
2428
- return unwrap20(await this.http.post(this.base(), body5));
2698
+ return unwrap22(await this.http.post(this.base(), body5));
2429
2699
  }
2430
2700
  /** Patch visibility / auth options for port. */
2431
2701
  async update(port, opts) {
2432
2702
  const body5 = Object.fromEntries(
2433
2703
  Object.entries(opts).filter(([, v]) => v !== void 0)
2434
2704
  );
2435
- return unwrap20(
2705
+ return unwrap22(
2436
2706
  await this.http.patch(`${this.base()}/${port}`, body5)
2437
2707
  );
2438
2708
  }
@@ -2459,7 +2729,7 @@ var ComputerTerminal = class {
2459
2729
  `/computers/${this.computerId}/terminal`,
2460
2730
  body5
2461
2731
  );
2462
- return unwrap21(raw);
2732
+ return unwrap23(raw);
2463
2733
  }
2464
2734
  /** Resize an existing PTY session. */
2465
2735
  async resize(sessionId, cols, rows) {
@@ -2467,10 +2737,10 @@ var ComputerTerminal = class {
2467
2737
  `/computers/${this.computerId}/pty/${sessionId}/resize`,
2468
2738
  { cols, rows }
2469
2739
  );
2470
- return unwrap21(raw);
2740
+ return unwrap23(raw);
2471
2741
  }
2472
2742
  };
2473
- function unwrap21(data) {
2743
+ function unwrap23(data) {
2474
2744
  if (data && typeof data === "object") {
2475
2745
  const d = data;
2476
2746
  if ("data" in d && Object.keys(d).length <= 2) {
@@ -2481,7 +2751,7 @@ function unwrap21(data) {
2481
2751
  }
2482
2752
 
2483
2753
  // src/resources/computer-volumes.ts
2484
- function unwrap22(data) {
2754
+ function unwrap24(data) {
2485
2755
  if (data && typeof data === "object") {
2486
2756
  const d = data;
2487
2757
  if ("data" in d && Object.keys(d).length <= 2) {
@@ -2515,7 +2785,7 @@ var ComputerVolumes = class {
2515
2785
  }
2516
2786
  /** Attach volumeId at mountPath inside the VM. */
2517
2787
  async attach(volumeId, mountPath) {
2518
- return unwrap22(
2788
+ return unwrap24(
2519
2789
  await this.http.post(this.base(), {
2520
2790
  volume_id: volumeId,
2521
2791
  mount_path: mountPath
@@ -2529,7 +2799,7 @@ var ComputerVolumes = class {
2529
2799
  };
2530
2800
 
2531
2801
  // src/resources/connectors.ts
2532
- function unwrap23(payload) {
2802
+ function unwrap25(payload) {
2533
2803
  if (payload && typeof payload === "object") {
2534
2804
  const p = payload;
2535
2805
  for (const key of ["data", "binding"]) {
@@ -2740,7 +3010,7 @@ var Connectors = class {
2740
3010
  const data = await this.http.get(
2741
3011
  `/connect/connectors/${connectorPath(connector)}`
2742
3012
  );
2743
- return unwrap23(data);
3013
+ return unwrap25(data);
2744
3014
  }
2745
3015
  show(connector) {
2746
3016
  return this.get(connector);
@@ -2751,7 +3021,7 @@ var Connectors = class {
2751
3021
  "/connect/connectors",
2752
3022
  bodyFromCreateParams(provider, params)
2753
3023
  );
2754
- return unwrap23(data);
3024
+ return unwrap25(data);
2755
3025
  }
2756
3026
  /** Request a runtime provider token for a connector. */
2757
3027
  async getToken(connector, params = {}) {
@@ -2759,7 +3029,7 @@ var Connectors = class {
2759
3029
  `/connect/token/${connectorPath(connector)}`,
2760
3030
  tokenBody(params)
2761
3031
  );
2762
- return unwrap23(data);
3032
+ return unwrap25(data);
2763
3033
  }
2764
3034
  token(connector, params = {}) {
2765
3035
  return this.getToken(connector, params);
@@ -2781,7 +3051,7 @@ var Connectors = class {
2781
3051
  ...externalAttributionParams(params)
2782
3052
  })
2783
3053
  );
2784
- return unwrap23(data);
3054
+ return unwrap25(data);
2785
3055
  }
2786
3056
  /** List connector installations/grants. */
2787
3057
  async installations(params = {}) {
@@ -2821,7 +3091,7 @@ var Connectors = class {
2821
3091
  "/connect/defaults/materialize",
2822
3092
  materializeDefaultsBody(params)
2823
3093
  );
2824
- return unwrap23(data);
3094
+ return unwrap25(data);
2825
3095
  }
2826
3096
  /** Create an inherited connector default for future runtime resources. */
2827
3097
  async createDefault(params) {
@@ -2829,7 +3099,7 @@ var Connectors = class {
2829
3099
  "/connect/defaults",
2830
3100
  defaultBody(params)
2831
3101
  );
2832
- return unwrap23(data);
3102
+ return unwrap25(data);
2833
3103
  }
2834
3104
  /** Delete an inherited connector default. */
2835
3105
  async deleteDefault(id) {
@@ -2849,7 +3119,7 @@ var Connectors = class {
2849
3119
  "/connect/triggers",
2850
3120
  triggerBody(params)
2851
3121
  );
2852
- return unwrap23(data);
3122
+ return unwrap25(data);
2853
3123
  }
2854
3124
  /** List inbound provider trigger delivery attempts. */
2855
3125
  async triggerDeliveries(params = {}) {
@@ -2876,7 +3146,7 @@ var Connectors = class {
2876
3146
  "/connect/project-links",
2877
3147
  projectLinkBody(params)
2878
3148
  );
2879
- return unwrap23(data);
3149
+ return unwrap25(data);
2880
3150
  }
2881
3151
  /** Delete a project connector link. */
2882
3152
  async deleteProjectLink(id) {
@@ -2912,7 +3182,7 @@ var RuntimeConnectors = class {
2912
3182
  ...externalAttributionParams(params)
2913
3183
  })
2914
3184
  );
2915
- return unwrap23(data);
3185
+ return unwrap25(data);
2916
3186
  }
2917
3187
  /** Detach a connector binding by binding id or connector UID. */
2918
3188
  async detach(bindingOrConnector) {
@@ -2921,7 +3191,7 @@ var RuntimeConnectors = class {
2921
3191
  /** Sync or materialize connector placeholder env vars for this runtime resource. */
2922
3192
  async sync() {
2923
3193
  const data = await this.http.post(`${this.basePath}/sync`, {});
2924
- return unwrap23(data);
3194
+ return unwrap25(data);
2925
3195
  }
2926
3196
  /** Verify a required connector is attached before agent work begins. */
2927
3197
  async preflight(params = {}) {
@@ -2929,7 +3199,7 @@ var RuntimeConnectors = class {
2929
3199
  `${this.basePath}/preflight`,
2930
3200
  stripUndefined10(params)
2931
3201
  );
2932
- return unwrap23(data);
3202
+ return unwrap25(data);
2933
3203
  }
2934
3204
  };
2935
3205
  var SandboxConnectors = class extends RuntimeConnectors {
@@ -3132,7 +3402,7 @@ var Desktop = class {
3132
3402
  };
3133
3403
 
3134
3404
  // src/resources/egressAudit.ts
3135
- function unwrap24(payload) {
3405
+ function unwrap26(payload) {
3136
3406
  if (payload && typeof payload === "object") {
3137
3407
  const p = payload;
3138
3408
  for (const k of ["data", "event", "items"]) {
@@ -3198,7 +3468,7 @@ var EgressAudit = class {
3198
3468
  const data = await this.http.get(
3199
3469
  `/egress/audit/${id}`
3200
3470
  );
3201
- return unwrap24(data);
3471
+ return unwrap26(data);
3202
3472
  }
3203
3473
  /**
3204
3474
  * Long-poll the audit endpoint and yield new events as they appear.
@@ -3274,7 +3544,7 @@ var ComputerAudit = class extends SandboxAudit {
3274
3544
  };
3275
3545
 
3276
3546
  // src/resources/egressNetwork.ts
3277
- function unwrap25(payload) {
3547
+ function unwrap27(payload) {
3278
3548
  if (payload && typeof payload === "object") {
3279
3549
  const p = payload;
3280
3550
  for (const k of ["data", "policy", "rule", "items"]) {
@@ -3333,7 +3603,7 @@ var EgressNetwork = class {
3333
3603
  "/egress/allowlist",
3334
3604
  ruleBody(host, params, "allow")
3335
3605
  );
3336
- return unwrap25(data);
3606
+ return unwrap27(data);
3337
3607
  }
3338
3608
  /** Add a `deny` rule for `host` to the allowlist. */
3339
3609
  async deny(host, params = {}) {
@@ -3341,7 +3611,7 @@ var EgressNetwork = class {
3341
3611
  "/egress/allowlist",
3342
3612
  ruleBody(host, params, "deny")
3343
3613
  );
3344
- return unwrap25(data);
3614
+ return unwrap27(data);
3345
3615
  }
3346
3616
  /** List allowlist rules. */
3347
3617
  async rules(params = {}) {
@@ -3385,7 +3655,7 @@ var EgressNetwork = class {
3385
3655
  "/egress/policies",
3386
3656
  body5
3387
3657
  );
3388
- return unwrap25(data);
3658
+ return unwrap27(data);
3389
3659
  }
3390
3660
  /** Update an egress policy by id. */
3391
3661
  async updatePolicy(policyId, params) {
@@ -3399,7 +3669,7 @@ var EgressNetwork = class {
3399
3669
  `/egress/policies/${policyId}`,
3400
3670
  body5
3401
3671
  );
3402
- return unwrap25(data);
3672
+ return unwrap27(data);
3403
3673
  }
3404
3674
  // ── mode helpers ──────────────────────────────────────────────────────────
3405
3675
  /** Set the policy to `mode="enforce"` — denied egress is blocked. */
@@ -3426,7 +3696,7 @@ var EgressNetwork = class {
3426
3696
  "/egress/policies",
3427
3697
  body5
3428
3698
  );
3429
- return unwrap25(data);
3699
+ return unwrap27(data);
3430
3700
  }
3431
3701
  // ── suggestions ───────────────────────────────────────────────────────────
3432
3702
  /** AI-generated allowlist suggestions from recent denied egress. */
@@ -3517,7 +3787,7 @@ var ComputerNetwork = class extends SandboxNetwork {
3517
3787
  };
3518
3788
 
3519
3789
  // src/resources/egressSecrets.ts
3520
- function unwrap26(payload) {
3790
+ function unwrap28(payload) {
3521
3791
  if (payload && typeof payload === "object") {
3522
3792
  const p = payload;
3523
3793
  for (const k of ["data", "secret", "binding", "items"]) {
@@ -3653,7 +3923,7 @@ var OAuthFlow = class {
3653
3923
  const data = await this.http.get("/egress/oauth/status", {
3654
3924
  state: this.state
3655
3925
  });
3656
- const payload = unwrap26(data) ?? {};
3926
+ const payload = unwrap28(data) ?? {};
3657
3927
  const status = payload.status;
3658
3928
  if (status === "completed" || status === "ready" || status === "succeeded") {
3659
3929
  return payload;
@@ -3685,7 +3955,7 @@ var EgressSecrets = class {
3685
3955
  "/egress/secrets",
3686
3956
  setBody(params)
3687
3957
  );
3688
- return unwrap26(data);
3958
+ return unwrap28(data);
3689
3959
  }
3690
3960
  /** List secrets. */
3691
3961
  async list(params = {}) {
@@ -3700,7 +3970,7 @@ var EgressSecrets = class {
3700
3970
  const data = await this.http.get(
3701
3971
  `/egress/secrets/${id}`
3702
3972
  );
3703
- return unwrap26(data);
3973
+ return unwrap28(data);
3704
3974
  }
3705
3975
  /** Rotate the secret's value. */
3706
3976
  async rotate(id, params) {
@@ -3709,7 +3979,7 @@ var EgressSecrets = class {
3709
3979
  `/egress/secrets/${id}`,
3710
3980
  body5
3711
3981
  );
3712
- return unwrap26(data);
3982
+ return unwrap28(data);
3713
3983
  }
3714
3984
  /** Delete a secret. */
3715
3985
  async delete(id) {
@@ -3722,7 +3992,7 @@ var EgressSecrets = class {
3722
3992
  "/egress/bindings",
3723
3993
  bindingBody(params)
3724
3994
  );
3725
- return unwrap26(data);
3995
+ return unwrap28(data);
3726
3996
  }
3727
3997
  /** List secret bindings. */
3728
3998
  async listBindings(params = {}) {
@@ -3755,7 +4025,7 @@ var EgressSecrets = class {
3755
4025
  "/egress/oauth/start",
3756
4026
  oauthBody(params)
3757
4027
  );
3758
- const payload = unwrap26(data) ?? {};
4028
+ const payload = unwrap28(data) ?? {};
3759
4029
  return new OAuthFlow(this.http, payload, params.provider);
3760
4030
  }
3761
4031
  };
@@ -4919,7 +5189,7 @@ var Credits = class {
4919
5189
  return this.http.get("/credits/usage");
4920
5190
  }
4921
5191
  };
4922
- function unwrap27(payload) {
5192
+ function unwrap29(payload) {
4923
5193
  if (payload && typeof payload === "object" && "data" in payload) {
4924
5194
  return payload.data;
4925
5195
  }
@@ -4955,7 +5225,7 @@ var CronJobs = class {
4955
5225
  }
4956
5226
  async get(jobId) {
4957
5227
  const data = await this.http.get(`/cron-jobs/${jobId}`);
4958
- return unwrap27(data);
5228
+ return unwrap29(data);
4959
5229
  }
4960
5230
  async create(params) {
4961
5231
  const { idempotencyKey: ikey, ...rest } = params;
@@ -4965,12 +5235,12 @@ var CronJobs = class {
4965
5235
  body: body5,
4966
5236
  headers: { "Idempotency-Key": idempotencyKey2(ikey) }
4967
5237
  });
4968
- return unwrap27(data);
5238
+ return unwrap29(data);
4969
5239
  }
4970
5240
  async update(jobId, params) {
4971
5241
  const body5 = stripUndefined14(params);
4972
5242
  const data = await this.http.patch(`/cron-jobs/${jobId}`, body5);
4973
- return unwrap27(data);
5243
+ return unwrap29(data);
4974
5244
  }
4975
5245
  async delete(jobId) {
4976
5246
  await this.http.delete(`/cron-jobs/${jobId}`);
@@ -4978,11 +5248,11 @@ var CronJobs = class {
4978
5248
  // ── Control ────────────────────────────────────────────────────────────────
4979
5249
  async pause(jobId) {
4980
5250
  const data = await this.http.post(`/cron-jobs/${jobId}/pause`);
4981
- return unwrap27(data);
5251
+ return unwrap29(data);
4982
5252
  }
4983
5253
  async resume(jobId) {
4984
5254
  const data = await this.http.post(`/cron-jobs/${jobId}/resume`);
4985
- return unwrap27(data);
5255
+ return unwrap29(data);
4986
5256
  }
4987
5257
  async runNow(jobId, opts = {}) {
4988
5258
  const data = await this.http.request(
@@ -4992,7 +5262,7 @@ var CronJobs = class {
4992
5262
  headers: { "Idempotency-Key": idempotencyKey2(opts.idempotencyKey) }
4993
5263
  }
4994
5264
  );
4995
- return unwrap27(data);
5265
+ return unwrap29(data);
4996
5266
  }
4997
5267
  // ── Execution history ──────────────────────────────────────────────────────
4998
5268
  async listExecutions(jobId) {
@@ -5007,12 +5277,12 @@ var CronJobs = class {
5007
5277
  const data = await this.http.get(
5008
5278
  `/cron-jobs/${jobId}/executions/${executionId}`
5009
5279
  );
5010
- return unwrap27(data);
5280
+ return unwrap29(data);
5011
5281
  }
5012
5282
  };
5013
5283
 
5014
5284
  // src/resources/dashboard.ts
5015
- function unwrap28(payload) {
5285
+ function unwrap30(payload) {
5016
5286
  if (payload && typeof payload === "object") {
5017
5287
  const p = payload;
5018
5288
  for (const k of ["data", "dashboard", "overview", "items"]) {
@@ -5029,15 +5299,15 @@ var Dashboard = class {
5029
5299
  /** Aggregated user dashboard payload. */
5030
5300
  async summary() {
5031
5301
  const data = await this.http.get("/dashboard");
5032
- return unwrap28(data);
5302
+ return unwrap30(data);
5033
5303
  }
5034
5304
  /** Status / health overview (public endpoint). */
5035
5305
  async overview() {
5036
5306
  const data = await this.http.get("/overview");
5037
- return unwrap28(data);
5307
+ return unwrap30(data);
5038
5308
  }
5039
5309
  };
5040
- function unwrap29(payload) {
5310
+ function unwrap31(payload) {
5041
5311
  if (payload && typeof payload === "object" && "data" in payload) {
5042
5312
  return payload.data;
5043
5313
  }
@@ -5073,7 +5343,7 @@ var Databases = class {
5073
5343
  }
5074
5344
  async get(databaseId) {
5075
5345
  const data = await this.http.get(`/databases/${databaseId}`);
5076
- return unwrap29(data);
5346
+ return unwrap31(data);
5077
5347
  }
5078
5348
  async create(params) {
5079
5349
  const {
@@ -5097,7 +5367,7 @@ var Databases = class {
5097
5367
  )
5098
5368
  }
5099
5369
  });
5100
- return unwrap29(data);
5370
+ return unwrap31(data);
5101
5371
  }
5102
5372
  async delete(databaseId) {
5103
5373
  await this.http.delete(`/databases/${databaseId}`);
@@ -5107,24 +5377,24 @@ var Databases = class {
5107
5377
  const data = await this.http.post(
5108
5378
  `/databases/${databaseId}/start`
5109
5379
  );
5110
- return unwrap29(data);
5380
+ return unwrap31(data);
5111
5381
  }
5112
5382
  async stop(databaseId) {
5113
5383
  const data = await this.http.post(`/databases/${databaseId}/stop`);
5114
- return unwrap29(data);
5384
+ return unwrap31(data);
5115
5385
  }
5116
5386
  async restart(databaseId) {
5117
5387
  const data = await this.http.post(
5118
5388
  `/databases/${databaseId}/restart`
5119
5389
  );
5120
- return unwrap29(data);
5390
+ return unwrap31(data);
5121
5391
  }
5122
5392
  // ── Credentials + logs ────────────────────────────────────────────────────
5123
5393
  async credentials(databaseId) {
5124
5394
  const data = await this.http.get(
5125
5395
  `/databases/${databaseId}/credentials`
5126
5396
  );
5127
- return unwrap29(data);
5397
+ return unwrap31(data);
5128
5398
  }
5129
5399
  async logs(databaseId, params = {}) {
5130
5400
  const query3 = stripUndefined15({
@@ -5154,7 +5424,7 @@ function attributionBody(p) {
5154
5424
  function idempotencyKey4(key) {
5155
5425
  return key ?? randomUUID();
5156
5426
  }
5157
- function unwrap30(payload) {
5427
+ function unwrap32(payload) {
5158
5428
  if (payload && typeof payload === "object" && "data" in payload) {
5159
5429
  return payload.data;
5160
5430
  }
@@ -5263,7 +5533,7 @@ var DeploymentVersions = class {
5263
5533
  const data = await this.http.get(
5264
5534
  `/deployments/${this.deploymentId}/versions/${versionId}`
5265
5535
  );
5266
- return unwrap30(data);
5536
+ return unwrap32(data);
5267
5537
  }
5268
5538
  async promote(versionId, opts = {}) {
5269
5539
  const body5 = stripUndefined16({ environment: opts.environment });
@@ -5275,14 +5545,14 @@ var DeploymentVersions = class {
5275
5545
  headers: { "Idempotency-Key": idempotencyKey4(opts.idempotencyKey) }
5276
5546
  }
5277
5547
  );
5278
- return unwrap30(data);
5548
+ return unwrap32(data);
5279
5549
  }
5280
5550
  async prepareMigrationBackup(versionId) {
5281
5551
  const data = await this.http.request(
5282
5552
  `/deployments/${this.deploymentId}/versions/${versionId}/migration-backup`,
5283
5553
  { method: "POST", body: {} }
5284
5554
  );
5285
- return unwrap30(data);
5555
+ return unwrap32(data);
5286
5556
  }
5287
5557
  };
5288
5558
  var DeploymentReleases = class {
@@ -5302,7 +5572,7 @@ var DeploymentReleases = class {
5302
5572
  const data = await this.http.get(
5303
5573
  `/deployments/${this.deploymentId}/releases/${releaseId}`
5304
5574
  );
5305
- return unwrap30(data);
5575
+ return unwrap32(data);
5306
5576
  }
5307
5577
  async promote(releaseId, idempotencyKey11) {
5308
5578
  const key = idempotencyKey11 ?? `promote:${this.deploymentId}:${releaseId}`;
@@ -5314,7 +5584,7 @@ var DeploymentReleases = class {
5314
5584
  headers: { "Idempotency-Key": key }
5315
5585
  }
5316
5586
  );
5317
- return unwrap30(data);
5587
+ return unwrap32(data);
5318
5588
  }
5319
5589
  };
5320
5590
  var DeploymentRuntimeInstances = class {
@@ -5334,14 +5604,14 @@ var DeploymentRuntimeInstances = class {
5334
5604
  const data = await this.http.get(
5335
5605
  `/deployments/${this.deploymentId}/runtime-instances/${instanceId}`
5336
5606
  );
5337
- return unwrap30(data);
5607
+ return unwrap32(data);
5338
5608
  }
5339
5609
  async logs(instanceId, lines = 100) {
5340
5610
  const data = await this.http.get(
5341
5611
  `/deployments/${this.deploymentId}/runtime-instances/${instanceId}/logs`,
5342
5612
  { lines }
5343
5613
  );
5344
- const unwrapped = unwrap30(data);
5614
+ const unwrapped = unwrap32(data);
5345
5615
  const result = { logs: String(unwrapped.logs ?? "") };
5346
5616
  if (typeof unwrapped.runtime_instance_id === "string") {
5347
5617
  result.runtime_instance_id = unwrapped.runtime_instance_id;
@@ -5376,7 +5646,7 @@ var DeploymentDomains = class {
5376
5646
  headers: { "Idempotency-Key": idempotencyKey4(params.idempotencyKey) }
5377
5647
  }
5378
5648
  );
5379
- return unwrap30(data);
5649
+ return unwrap32(data);
5380
5650
  }
5381
5651
  async list(filters = {}) {
5382
5652
  const data = await this.http.get(
@@ -5389,7 +5659,7 @@ var DeploymentDomains = class {
5389
5659
  const data = await this.http.post(
5390
5660
  `/deployments/${this.deploymentId}/domains/${domainId}/verify`
5391
5661
  );
5392
- return unwrap30(data);
5662
+ return unwrap32(data);
5393
5663
  }
5394
5664
  async delete(domainId) {
5395
5665
  await this.http.delete(
@@ -5419,7 +5689,7 @@ var Deployments = class {
5419
5689
  }
5420
5690
  async get(deploymentId) {
5421
5691
  const data = await this.http.get(`/deployments/${deploymentId}`);
5422
- return unwrap30(data);
5692
+ return unwrap32(data);
5423
5693
  }
5424
5694
  async create(params) {
5425
5695
  const body5 = stripUndefined16({
@@ -5438,7 +5708,7 @@ var Deployments = class {
5438
5708
  body: body5,
5439
5709
  headers: { "Idempotency-Key": idempotencyKey4(params.idempotencyKey) }
5440
5710
  });
5441
- return unwrap30(data);
5711
+ return unwrap32(data);
5442
5712
  }
5443
5713
  /**
5444
5714
  * Create a deployment that runs on the workspace's dedicated App Engine
@@ -5482,7 +5752,7 @@ var Deployments = class {
5482
5752
  const rawHost = await this.http.get(
5483
5753
  `/docker-deploy/hosts/${hostId}`
5484
5754
  );
5485
- host = unwrap30(
5755
+ host = unwrap32(
5486
5756
  rawHost
5487
5757
  );
5488
5758
  addDoctorCheck(
@@ -5633,7 +5903,7 @@ var Deployments = class {
5633
5903
  const rawHost = await this.http.get(
5634
5904
  `/docker-deploy/hosts/${hostId}`
5635
5905
  );
5636
- const host = unwrap30(
5906
+ const host = unwrap32(
5637
5907
  rawHost
5638
5908
  );
5639
5909
  addProofCheck(
@@ -5740,7 +6010,7 @@ var Deployments = class {
5740
6010
  `/deployments/${deploymentId}`,
5741
6011
  body5
5742
6012
  );
5743
- return unwrap30(data);
6013
+ return unwrap32(data);
5744
6014
  }
5745
6015
  async delete(deploymentId) {
5746
6016
  await this.http.delete(`/deployments/${deploymentId}`);
@@ -5760,7 +6030,7 @@ var Deployments = class {
5760
6030
  headers: { "Idempotency-Key": idempotencyKey4(params.idempotencyKey) }
5761
6031
  }
5762
6032
  );
5763
- return unwrap30(data);
6033
+ return unwrap32(data);
5764
6034
  }
5765
6035
  /**
5766
6036
  * Backward-compatible bridge: POST /sandboxes/:id/deploy. Works today;
@@ -5785,7 +6055,7 @@ var Deployments = class {
5785
6055
  headers: { "Idempotency-Key": idempotencyKey4(params.idempotencyKey) }
5786
6056
  }
5787
6057
  );
5788
- return unwrap30(data);
6058
+ return unwrap32(data);
5789
6059
  }
5790
6060
  async rollback(deploymentId, params = {}) {
5791
6061
  const body5 = stripUndefined16({
@@ -5799,7 +6069,7 @@ var Deployments = class {
5799
6069
  headers: { "Idempotency-Key": idempotencyKey4(params.idempotencyKey) }
5800
6070
  }
5801
6071
  );
5802
- return unwrap30(data);
6072
+ return unwrap32(data);
5803
6073
  }
5804
6074
  async listBuilds(deploymentId) {
5805
6075
  const data = await this.http.get(
@@ -5811,7 +6081,7 @@ var Deployments = class {
5811
6081
  const data = await this.http.get(
5812
6082
  `/deployments/${deploymentId}/builds/${buildId}`
5813
6083
  );
5814
- return unwrap30(data);
6084
+ return unwrap32(data);
5815
6085
  }
5816
6086
  async listEnv(deploymentId) {
5817
6087
  const data = await this.http.get(
@@ -5857,7 +6127,7 @@ var RUNTIME_BINARIES = {
5857
6127
  pi: ["pi"],
5858
6128
  custom: []
5859
6129
  };
5860
- function unwrap31(payload, keys = ["data"]) {
6130
+ function unwrap33(payload, keys = ["data"]) {
5861
6131
  if (payload && typeof payload === "object") {
5862
6132
  const p = payload;
5863
6133
  for (const key of keys) {
@@ -5916,7 +6186,7 @@ var Devices = class {
5916
6186
  /** Show one unified device by id. */
5917
6187
  async get(id) {
5918
6188
  const data = await this.http.get(`/devices/${devicePath(id)}`);
5919
- return unwrap31(data);
6189
+ return unwrap33(data);
5920
6190
  }
5921
6191
  show(id) {
5922
6192
  return this.get(id);
@@ -5926,7 +6196,7 @@ var Devices = class {
5926
6196
  const data = await this.http.get(
5927
6197
  `/devices/${devicePath(id)}/capabilities`
5928
6198
  );
5929
- return unwrap31(data);
6199
+ return unwrap33(data);
5930
6200
  }
5931
6201
  /** Execute a command inside the device. */
5932
6202
  async exec(id, params) {
@@ -5939,7 +6209,7 @@ var Devices = class {
5939
6209
  env: params.env
5940
6210
  })
5941
6211
  );
5942
- return unwrap31(data);
6212
+ return unwrap33(data);
5943
6213
  }
5944
6214
  /** List files inside the device filesystem. */
5945
6215
  async listFiles(id, params = {}) {
@@ -5955,7 +6225,7 @@ var Devices = class {
5955
6225
  `/devices/${devicePath(id)}/files/read`,
5956
6226
  queryFromFileParams(params)
5957
6227
  );
5958
- return unwrap31(data);
6228
+ return unwrap33(data);
5959
6229
  }
5960
6230
  /** Write a text or base64 payload into the device filesystem. */
5961
6231
  async writeFile(id, params) {
@@ -5967,7 +6237,7 @@ var Devices = class {
5967
6237
  content_base64: pickFirst5(params.contentBase64, params.content_base64)
5968
6238
  })
5969
6239
  );
5970
- return unwrap31(data);
6240
+ return unwrap33(data);
5971
6241
  }
5972
6242
  /** Expose a device port through MIOSA routing. */
5973
6243
  async expose(id, params) {
@@ -5975,44 +6245,44 @@ var Devices = class {
5975
6245
  `/devices/${devicePath(id)}/expose`,
5976
6246
  { port: params.port }
5977
6247
  );
5978
- return unwrap31(data);
6248
+ return unwrap33(data);
5979
6249
  }
5980
6250
  /** Return browser/desktop connection details for a computer-backed device. */
5981
6251
  async browser(id) {
5982
6252
  const data = await this.http.get(`/devices/${devicePath(id)}/browser`);
5983
- return unwrap31(data);
6253
+ return unwrap33(data);
5984
6254
  }
5985
6255
  async pause(id) {
5986
6256
  const data = await this.http.post(
5987
6257
  `/devices/${devicePath(id)}/pause`,
5988
6258
  {}
5989
6259
  );
5990
- return unwrap31(data);
6260
+ return unwrap33(data);
5991
6261
  }
5992
6262
  async stop(id) {
5993
6263
  const data = await this.http.post(
5994
6264
  `/devices/${devicePath(id)}/stop`,
5995
6265
  {}
5996
6266
  );
5997
- return unwrap31(data);
6267
+ return unwrap33(data);
5998
6268
  }
5999
6269
  async resume(id) {
6000
6270
  const data = await this.http.post(
6001
6271
  `/devices/${devicePath(id)}/resume`,
6002
6272
  {}
6003
6273
  );
6004
- return unwrap31(data);
6274
+ return unwrap33(data);
6005
6275
  }
6006
6276
  async extend(id, params) {
6007
6277
  const data = await this.http.post(
6008
6278
  `/devices/${devicePath(id)}/extend`,
6009
6279
  { timeout_sec: pickFirst5(params.timeoutSec, params.timeout_sec) }
6010
6280
  );
6011
- return unwrap31(data);
6281
+ return unwrap33(data);
6012
6282
  }
6013
6283
  async destroy(id) {
6014
6284
  const data = await this.http.delete(`/devices/${devicePath(id)}`);
6015
- return unwrap31(data);
6285
+ return unwrap33(data);
6016
6286
  }
6017
6287
  /**
6018
6288
  * Write a MIOSA runtime bootstrap manifest and optionally install/probe
@@ -6182,7 +6452,7 @@ var DockerDeploy = class {
6182
6452
  };
6183
6453
 
6184
6454
  // src/resources/email.ts
6185
- function unwrap32(data) {
6455
+ function unwrap34(data) {
6186
6456
  if (data && typeof data === "object") {
6187
6457
  const d = data;
6188
6458
  for (const k of [
@@ -6234,12 +6504,12 @@ var EmailCampaigns = class {
6234
6504
  );
6235
6505
  }
6236
6506
  async create(attrs) {
6237
- return unwrap32(
6507
+ return unwrap34(
6238
6508
  await this.http.post("/admin/email-campaigns", strip(attrs))
6239
6509
  );
6240
6510
  }
6241
6511
  async recipientCount(filters = {}) {
6242
- return unwrap32(
6512
+ return unwrap34(
6243
6513
  await this.http.get(
6244
6514
  "/admin/email-campaigns/recipient-count",
6245
6515
  filters
@@ -6247,7 +6517,7 @@ var EmailCampaigns = class {
6247
6517
  );
6248
6518
  }
6249
6519
  async send(campaignId, opts = {}) {
6250
- return unwrap32(
6520
+ return unwrap34(
6251
6521
  await this.http.post(
6252
6522
  `/admin/email-campaigns/${campaignId}/send`,
6253
6523
  strip(opts)
@@ -6255,7 +6525,7 @@ var EmailCampaigns = class {
6255
6525
  );
6256
6526
  }
6257
6527
  async cancel(campaignId) {
6258
- return unwrap32(
6528
+ return unwrap34(
6259
6529
  await this.http.post(
6260
6530
  `/admin/email-campaigns/${campaignId}/cancel`
6261
6531
  )
@@ -6281,7 +6551,7 @@ var EmailTemplates = class {
6281
6551
  );
6282
6552
  }
6283
6553
  async create(key, attrs = {}) {
6284
- return unwrap32(
6554
+ return unwrap34(
6285
6555
  await this.http.post("/admin/email-templates", {
6286
6556
  key,
6287
6557
  ...strip(attrs)
@@ -6289,7 +6559,7 @@ var EmailTemplates = class {
6289
6559
  );
6290
6560
  }
6291
6561
  async update(key, attrs) {
6292
- return unwrap32(
6562
+ return unwrap34(
6293
6563
  await this.http.put(
6294
6564
  `/admin/email-templates/${key}`,
6295
6565
  strip(attrs)
@@ -6297,7 +6567,7 @@ var EmailTemplates = class {
6297
6567
  );
6298
6568
  }
6299
6569
  async reset(key) {
6300
- return unwrap32(
6570
+ return unwrap34(
6301
6571
  await this.http.post(`/admin/email-templates/${key}/reset`)
6302
6572
  );
6303
6573
  }
@@ -6313,17 +6583,17 @@ var EmailInbox = class {
6313
6583
  );
6314
6584
  }
6315
6585
  async send(attrs) {
6316
- return unwrap32(
6586
+ return unwrap34(
6317
6587
  await this.http.post("/admin/email-inbox/send", strip(attrs))
6318
6588
  );
6319
6589
  }
6320
6590
  async markRead(messageId) {
6321
- return unwrap32(
6591
+ return unwrap34(
6322
6592
  await this.http.post(`/admin/email-inbox/${messageId}/read`)
6323
6593
  );
6324
6594
  }
6325
6595
  async archive(messageId) {
6326
- return unwrap32(
6596
+ return unwrap34(
6327
6597
  await this.http.post(`/admin/email-inbox/${messageId}/archive`)
6328
6598
  );
6329
6599
  }
@@ -6363,7 +6633,7 @@ var Embeddings = class {
6363
6633
  };
6364
6634
 
6365
6635
  // src/resources/external-keys.ts
6366
- function unwrap33(payload) {
6636
+ function unwrap35(payload) {
6367
6637
  if (payload && typeof payload === "object") {
6368
6638
  const p = payload;
6369
6639
  for (const k of ["data", "external_keys", "items"]) {
@@ -6385,7 +6655,7 @@ var ExternalKeys = class {
6385
6655
  /** List configured external keys. */
6386
6656
  async list() {
6387
6657
  const data = await this.http.get("/external-keys");
6388
- const result = unwrap33(data);
6658
+ const result = unwrap35(data);
6389
6659
  if (Array.isArray(result)) return result;
6390
6660
  return [];
6391
6661
  }
@@ -6393,14 +6663,14 @@ var ExternalKeys = class {
6393
6663
  async create(params) {
6394
6664
  const body5 = stripUndefined18(params);
6395
6665
  const data = await this.http.post("/external-keys", body5);
6396
- return unwrap33(data);
6666
+ return unwrap35(data);
6397
6667
  }
6398
6668
  /** Resolve (preview) the stored key for a provider. */
6399
6669
  async resolve(provider) {
6400
6670
  const data = await this.http.get(
6401
6671
  `/external-keys/${provider}/resolve`
6402
6672
  );
6403
- return unwrap33(data);
6673
+ return unwrap35(data);
6404
6674
  }
6405
6675
  /**
6406
6676
  * Delete the stored key for a provider.
@@ -6410,7 +6680,7 @@ var ExternalKeys = class {
6410
6680
  await this.http.delete(`/external-keys/${provider}`);
6411
6681
  }
6412
6682
  };
6413
- function unwrap34(payload) {
6683
+ function unwrap36(payload) {
6414
6684
  if (payload && typeof payload === "object" && "data" in payload) {
6415
6685
  return payload.data;
6416
6686
  }
@@ -6463,97 +6733,476 @@ var FlatCustomDomains = class {
6463
6733
  body: body5,
6464
6734
  headers: { "Idempotency-Key": idempotencyKey5(ikey) }
6465
6735
  });
6466
- return unwrap34(data);
6736
+ return unwrap36(data);
6467
6737
  }
6468
6738
  async delete(domainId) {
6469
6739
  await this.http.delete(`/custom-domains/${domainId}`);
6470
6740
  }
6471
6741
  };
6472
- function unwrap35(payload) {
6742
+ function unwrap37(payload) {
6473
6743
  if (payload && typeof payload === "object" && "data" in payload) {
6474
6744
  return payload.data;
6475
6745
  }
6476
6746
  return payload;
6477
6747
  }
6478
- function listItems6(payload, candidateKeys = ["data", "functions", "items"]) {
6479
- if (Array.isArray(payload)) return payload;
6480
- if (!payload || typeof payload !== "object") return [];
6481
- const p = payload;
6482
- if (Array.isArray(p.data)) return p.data;
6483
- for (const key of candidateKeys) {
6484
- if (Array.isArray(p[key])) return p[key];
6748
+ function listItems6(payload, candidateKeys = ["data", "functions", "items"]) {
6749
+ if (Array.isArray(payload)) return payload;
6750
+ if (!payload || typeof payload !== "object") return [];
6751
+ const p = payload;
6752
+ if (Array.isArray(p.data)) return p.data;
6753
+ for (const key of candidateKeys) {
6754
+ if (Array.isArray(p[key])) return p[key];
6755
+ }
6756
+ return [];
6757
+ }
6758
+ function stripUndefined20(input) {
6759
+ return Object.fromEntries(
6760
+ Object.entries(input).filter(([, v]) => v !== void 0)
6761
+ );
6762
+ }
6763
+ function idempotencyKey6(key) {
6764
+ return key ?? randomUUID();
6765
+ }
6766
+ var Functions = class {
6767
+ constructor(http) {
6768
+ this.http = http;
6769
+ }
6770
+ http;
6771
+ async list(params = {}) {
6772
+ const query3 = stripUndefined20({ ...params });
6773
+ const data = await this.http.get("/functions", query3);
6774
+ return listItems6(data);
6775
+ }
6776
+ async get(functionId) {
6777
+ const data = await this.http.get(`/functions/${functionId}`);
6778
+ return unwrap37(data);
6779
+ }
6780
+ async create(params) {
6781
+ const { idempotencyKey: ikey, memoryMb, timeoutSec, ...rest } = params;
6782
+ const body5 = stripUndefined20({
6783
+ ...rest,
6784
+ memory_mb: memoryMb ?? rest.memory_mb,
6785
+ timeout_sec: timeoutSec ?? rest.timeout_sec
6786
+ });
6787
+ const data = await this.http.request("/functions", {
6788
+ method: "POST",
6789
+ body: body5,
6790
+ headers: { "Idempotency-Key": idempotencyKey6(ikey) }
6791
+ });
6792
+ return unwrap37(data);
6793
+ }
6794
+ async update(functionId, params) {
6795
+ const { memoryMb, timeoutSec, ...rest } = params;
6796
+ const body5 = stripUndefined20({
6797
+ ...rest,
6798
+ memory_mb: memoryMb ?? rest.memory_mb,
6799
+ timeout_sec: timeoutSec ?? rest.timeout_sec
6800
+ });
6801
+ const data = await this.http.patch(
6802
+ `/functions/${functionId}`,
6803
+ body5
6804
+ );
6805
+ return unwrap37(data);
6806
+ }
6807
+ async delete(functionId) {
6808
+ await this.http.delete(`/functions/${functionId}`);
6809
+ }
6810
+ async invoke(functionId, params = {}) {
6811
+ const { payload = {}, headers, idempotencyKey: ikey } = params;
6812
+ const data = await this.http.request(
6813
+ `/functions/${functionId}/invoke`,
6814
+ {
6815
+ method: "POST",
6816
+ body: payload,
6817
+ headers: {
6818
+ "Idempotency-Key": idempotencyKey6(ikey),
6819
+ ...headers
6820
+ }
6821
+ }
6822
+ );
6823
+ return data ?? {};
6824
+ }
6825
+ };
6826
+
6827
+ // src/resources/forge.ts
6828
+ var REPOSITORY_VISIBILITIES = /* @__PURE__ */ new Set([
6829
+ "public",
6830
+ "private",
6831
+ "internal"
6832
+ ]);
6833
+ var REPOSITORY_STATES = /* @__PURE__ */ new Set([
6834
+ "provisioning",
6835
+ "active",
6836
+ "error",
6837
+ "deletion_pending",
6838
+ "deleted"
6839
+ ]);
6840
+ var ForgeContractError = class extends MiosaError {
6841
+ constructor(message, details) {
6842
+ super(message, 502, "FORGE_CONTRACT_ERROR", details);
6843
+ this.name = "ForgeContractError";
6844
+ }
6845
+ };
6846
+ var ForgeUnavailableError = class extends MiosaError {
6847
+ constructor(message, cause) {
6848
+ super(message, cause.status, "FORGE_DISABLED", cause.details, cause.requestId);
6849
+ this.name = "ForgeUnavailableError";
6850
+ }
6851
+ };
6852
+ var ForgeStorageError = class extends MiosaError {
6853
+ constructor(message, cause) {
6854
+ super(message, cause.status, cause.code, cause.details, cause.requestId);
6855
+ this.name = "ForgeStorageError";
6856
+ }
6857
+ };
6858
+ var ForgePolicyViolationError = class extends MiosaError {
6859
+ constructor(message, cause) {
6860
+ super(message, cause.status, cause.code, cause.details, cause.requestId);
6861
+ this.name = "ForgePolicyViolationError";
6862
+ }
6863
+ };
6864
+ function translateError(error) {
6865
+ if (!(error instanceof MiosaError)) throw error;
6866
+ if (error.code === "FORGE_DISABLED") {
6867
+ throw new ForgeUnavailableError("Forge is not enabled for this organization", error);
6868
+ }
6869
+ if (error.code === "FORGE_STORAGE_UNAVAILABLE" || error.code === "FORGE_OPERATION_FAILED") {
6870
+ throw new ForgeStorageError("Forge repository storage is unavailable", error);
6871
+ }
6872
+ if (error.code === "INVALID_PROJECT_ATTACHMENT") {
6873
+ throw new ForgePolicyViolationError("Forge repository policy rejected the operation", error);
6874
+ }
6875
+ throw error;
6876
+ }
6877
+ function repositoryPath(id) {
6878
+ return `/forge/repositories/${encodeURIComponent(id)}`;
6879
+ }
6880
+ function compact(value) {
6881
+ return Object.fromEntries(
6882
+ Object.entries(value).filter(([, item]) => item !== void 0)
6883
+ );
6884
+ }
6885
+ function object(payload, label) {
6886
+ if (!payload || typeof payload !== "object" || Array.isArray(payload)) {
6887
+ throw new ForgeContractError(`Forge returned invalid ${label}`, { payload });
6888
+ }
6889
+ return payload;
6890
+ }
6891
+ function string(value, field, payload) {
6892
+ if (typeof value !== "string") {
6893
+ throw new ForgeContractError(`Forge content is missing ${field}`, { field, payload });
6894
+ }
6895
+ return value;
6896
+ }
6897
+ function nullableString(value, field, payload) {
6898
+ if (value !== null && typeof value !== "string") {
6899
+ throw new ForgeContractError(`Forge content has invalid ${field}`, { field, payload });
6900
+ }
6901
+ return value;
6902
+ }
6903
+ function queryPath(path, params) {
6904
+ const query3 = new URLSearchParams();
6905
+ for (const [key, value] of Object.entries(params)) {
6906
+ if (value !== void 0) query3.set(key, String(value));
6907
+ }
6908
+ const encoded = query3.toString();
6909
+ return encoded ? `${path}?${encoded}` : path;
6910
+ }
6911
+ function parseNamedRef(payload) {
6912
+ const value = object(payload, "repository ref");
6913
+ return { name: string(value.name, "name", payload), oid: string(value.oid, "oid", payload) };
6914
+ }
6915
+ function parseRefs(payload) {
6916
+ const value = object(payload, "repository refs");
6917
+ if (!Array.isArray(value.branches) || !Array.isArray(value.tags)) {
6918
+ throw new ForgeContractError("Forge repository refs have invalid collections", { payload });
6919
+ }
6920
+ const branches = value.branches.map((item) => {
6921
+ const branch = object(item, "branch");
6922
+ if (typeof branch.is_default !== "boolean") {
6923
+ throw new ForgeContractError("Forge branch is missing is_default", { payload: item });
6924
+ }
6925
+ return { ...parseNamedRef(item), is_default: branch.is_default };
6926
+ });
6927
+ return {
6928
+ default_branch: string(value.default_branch, "default_branch", payload),
6929
+ head_oid: nullableString(value.head_oid, "head_oid", payload),
6930
+ branches,
6931
+ tags: value.tags.map(parseNamedRef)
6932
+ };
6933
+ }
6934
+ function parseTree(payload) {
6935
+ const value = object(payload, "repository tree");
6936
+ if (!Array.isArray(value.entries) || typeof value.truncated !== "boolean") {
6937
+ throw new ForgeContractError("Forge repository tree has invalid entries", { payload });
6938
+ }
6939
+ const entries = value.entries.map((item) => {
6940
+ const entry = object(item, "tree entry");
6941
+ if (entry.type !== "blob" && entry.type !== "tree") {
6942
+ throw new ForgeContractError("Forge tree entry has invalid type", { payload: item });
6943
+ }
6944
+ if (entry.size !== null && (typeof entry.size !== "number" || !Number.isSafeInteger(entry.size) || entry.size < 0)) {
6945
+ throw new ForgeContractError("Forge tree entry has invalid size", { payload: item });
6946
+ }
6947
+ return {
6948
+ name: string(entry.name, "name", item),
6949
+ path: string(entry.path, "path", item),
6950
+ type: entry.type,
6951
+ oid: string(entry.oid, "oid", item),
6952
+ size: entry.size
6953
+ };
6954
+ });
6955
+ return {
6956
+ ref: string(value.ref, "ref", payload),
6957
+ commit_oid: string(value.commit_oid, "commit_oid", payload),
6958
+ path: string(value.path, "path", payload),
6959
+ entries,
6960
+ truncated: value.truncated
6961
+ };
6962
+ }
6963
+ function parseBlob(payload) {
6964
+ const value = object(payload, "repository blob");
6965
+ if (value.encoding !== "utf-8" && value.encoding !== "base64") {
6966
+ throw new ForgeContractError("Forge blob has invalid encoding", { payload });
6967
+ }
6968
+ if (typeof value.size !== "number" || !Number.isSafeInteger(value.size) || value.size < 0) {
6969
+ throw new ForgeContractError("Forge blob has invalid size", { payload });
6970
+ }
6971
+ return {
6972
+ ref: string(value.ref, "ref", payload),
6973
+ commit_oid: string(value.commit_oid, "commit_oid", payload),
6974
+ path: string(value.path, "path", payload),
6975
+ oid: string(value.oid, "oid", payload),
6976
+ size: value.size,
6977
+ encoding: value.encoding,
6978
+ content: string(value.content, "content", payload)
6979
+ };
6980
+ }
6981
+ function parseHistory(payload) {
6982
+ const value = object(payload, "commit history");
6983
+ const page = object(value.page, "commit page");
6984
+ if (!Array.isArray(value.commits) || typeof page.has_more !== "boolean") {
6985
+ throw new ForgeContractError("Forge commit history has invalid pagination", { payload });
6986
+ }
6987
+ const commits = value.commits.map((item) => {
6988
+ const commit = object(item, "commit");
6989
+ if (!Array.isArray(commit.parents) || !commit.parents.every((parent) => typeof parent === "string")) {
6990
+ throw new ForgeContractError("Forge commit has invalid parents", { payload: item });
6991
+ }
6992
+ return {
6993
+ oid: string(commit.oid, "oid", item),
6994
+ short_oid: string(commit.short_oid, "short_oid", item),
6995
+ subject: string(commit.subject, "subject", item),
6996
+ author_name: string(commit.author_name, "author_name", item),
6997
+ author_email: string(commit.author_email, "author_email", item),
6998
+ authored_at: string(commit.authored_at, "authored_at", item),
6999
+ committer_name: string(commit.committer_name, "committer_name", item),
7000
+ committed_at: string(commit.committed_at, "committed_at", item),
7001
+ parents: commit.parents
7002
+ };
7003
+ });
7004
+ return {
7005
+ ref: string(value.ref, "ref", payload),
7006
+ path: string(value.path, "path", payload),
7007
+ commits,
7008
+ page: { has_more: page.has_more, next_cursor: nullableString(page.next_cursor, "next_cursor", page) }
7009
+ };
7010
+ }
7011
+ function parseFileReceipt(payload, replayed) {
7012
+ const value = object(payload, "file operation receipt");
7013
+ const commit = object(value.commit, "file operation commit");
7014
+ const policy = object(value.policy, "file operation policy");
7015
+ const stringFields = ["operation_id", "repository_id", "branch", "path", "previous_head", "new_head"];
7016
+ if (stringFields.some((field) => typeof value[field] !== "string") || !["create", "update", "delete"].includes(String(value.action)) || policy.decision !== "allowed" || !Array.isArray(policy.receipt_ids) || !policy.receipt_ids.every((id) => typeof id === "string") || typeof commit.oid !== "string" || typeof commit.committed_at !== "string") {
7017
+ throw new ForgeContractError("Forge returned invalid file operation receipt", { payload });
6485
7018
  }
6486
- return [];
7019
+ return { ...value, replayed };
6487
7020
  }
6488
- function stripUndefined20(input) {
6489
- return Object.fromEntries(
6490
- Object.entries(input).filter(([, v]) => v !== void 0)
6491
- );
7021
+ function parseRepository(payload) {
7022
+ if (!payload || typeof payload !== "object" || Array.isArray(payload)) {
7023
+ throw new ForgeContractError("Forge returned an invalid repository", {
7024
+ payload
7025
+ });
7026
+ }
7027
+ const value = payload;
7028
+ const requiredStrings = [
7029
+ "id",
7030
+ "name",
7031
+ "slug",
7032
+ "default_branch",
7033
+ "visibility",
7034
+ "state",
7035
+ "created_at",
7036
+ "updated_at"
7037
+ ];
7038
+ for (const field of requiredStrings) {
7039
+ if (typeof value[field] !== "string" || value[field].length === 0) {
7040
+ throw new ForgeContractError(`Forge repository is missing ${field}`, {
7041
+ field,
7042
+ payload
7043
+ });
7044
+ }
7045
+ }
7046
+ if (!REPOSITORY_VISIBILITIES.has(value.visibility)) {
7047
+ throw new ForgeContractError("Forge repository has an invalid visibility", {
7048
+ payload
7049
+ });
7050
+ }
7051
+ if (!REPOSITORY_STATES.has(value.state)) {
7052
+ throw new ForgeContractError("Forge repository has an invalid state", {
7053
+ payload
7054
+ });
7055
+ }
7056
+ if (typeof value.clone_ready !== "boolean" || value.clone_url !== null && typeof value.clone_url !== "string" || !Array.isArray(value.project_ids) || !value.project_ids.every((id) => typeof id === "string"))
7057
+ throw new ForgeContractError("Forge repository has invalid clone or project metadata", { payload });
7058
+ if (value.clone_ready !== (value.state === "active") || value.clone_ready && !value.clone_url || !value.clone_ready && value.clone_url !== null)
7059
+ throw new ForgeContractError("Forge repository clone readiness is inconsistent", { payload });
7060
+ return {
7061
+ id: value.id,
7062
+ name: value.name,
7063
+ slug: value.slug,
7064
+ default_branch: value.default_branch,
7065
+ visibility: value.visibility,
7066
+ state: value.state,
7067
+ clone_ready: value.clone_ready,
7068
+ clone_url: value.clone_url,
7069
+ project_ids: value.project_ids,
7070
+ created_at: value.created_at,
7071
+ updated_at: value.updated_at
7072
+ };
6492
7073
  }
6493
- function idempotencyKey6(key) {
6494
- return key ?? randomUUID();
7074
+ function parseCapabilities(payload) {
7075
+ const value = object(payload, "capabilities");
7076
+ const valid = value.api_version === "v1" && value.ownership === "organization" && value.detail_locator === "repository_id" && typeof value.base_url === "string" && Array.isArray(value.lifecycle_states) && Array.isArray(value.visibility_values) && Array.isArray(value.clone_ready_states) && value.clone_ready_states.length === 1 && value.clone_ready_states[0] === "active" && value.features && typeof value.features === "object";
7077
+ if (!valid) throw new ForgeContractError("Forge returned invalid capabilities", { payload });
7078
+ return value;
6495
7079
  }
6496
- var Functions = class {
7080
+ var ForgeRepositories = class {
6497
7081
  constructor(http) {
6498
7082
  this.http = http;
6499
7083
  }
6500
7084
  http;
6501
- async list(params = {}) {
6502
- const query3 = stripUndefined20({ ...params });
6503
- const data = await this.http.get("/functions", query3);
6504
- return listItems6(data);
7085
+ async create(params) {
7086
+ try {
7087
+ const payload = await this.http.request("/forge/repositories", {
7088
+ method: "POST",
7089
+ headers: { "Idempotency-Key": params.idempotencyKey ?? crypto.randomUUID() },
7090
+ body: compact({
7091
+ name: params.name,
7092
+ slug: params.slug,
7093
+ default_branch: params.defaultBranch,
7094
+ visibility: params.visibility,
7095
+ project_ids: params.projectIds
7096
+ })
7097
+ });
7098
+ return parseRepository(unwrapData2(payload));
7099
+ } catch (error) {
7100
+ translateError(error);
7101
+ }
6505
7102
  }
6506
- async get(functionId) {
6507
- const data = await this.http.get(`/functions/${functionId}`);
6508
- return unwrap35(data);
7103
+ async list() {
7104
+ const payload = await this.http.get("/forge/repositories");
7105
+ if (!payload || typeof payload !== "object" || Array.isArray(payload) || !Array.isArray(payload.data)) {
7106
+ throw new ForgeContractError("Forge returned an invalid repository list", {
7107
+ payload
7108
+ });
7109
+ }
7110
+ return payload.data.map(
7111
+ parseRepository
7112
+ );
6509
7113
  }
6510
- async create(params) {
6511
- const { idempotencyKey: ikey, memoryMb, timeoutSec, ...rest } = params;
6512
- const body5 = stripUndefined20({
6513
- ...rest,
6514
- memory_mb: memoryMb ?? rest.memory_mb,
6515
- timeout_sec: timeoutSec ?? rest.timeout_sec
6516
- });
6517
- const data = await this.http.request("/functions", {
6518
- method: "POST",
6519
- body: body5,
6520
- headers: { "Idempotency-Key": idempotencyKey6(ikey) }
7114
+ async get(id) {
7115
+ return parseRepository(unwrapData2(await this.http.get(repositoryPath(id))));
7116
+ }
7117
+ async refs(id) {
7118
+ return parseRefs(unwrapData2(await this.http.get(`${repositoryPath(id)}/refs`)));
7119
+ }
7120
+ async tree(id, location = {}) {
7121
+ const path = queryPath(`${repositoryPath(id)}/tree`, { ref: location.ref, path: location.path });
7122
+ return parseTree(unwrapData2(await this.http.get(path)));
7123
+ }
7124
+ async blob(id, location) {
7125
+ const path = queryPath(`${repositoryPath(id)}/blob`, { ref: location.ref, path: location.path });
7126
+ return parseBlob(unwrapData2(await this.http.get(path)));
7127
+ }
7128
+ async readme(id, location = {}) {
7129
+ const path = queryPath(`${repositoryPath(id)}/readme`, { ref: location.ref, path: location.path });
7130
+ return parseBlob(unwrapData2(await this.http.get(path)));
7131
+ }
7132
+ async commits(id, query3 = {}) {
7133
+ const path = queryPath(`${repositoryPath(id)}/commits`, {
7134
+ ref: query3.ref,
7135
+ path: query3.path,
7136
+ limit: query3.limit,
7137
+ cursor: query3.cursor
6521
7138
  });
6522
- return unwrap35(data);
7139
+ return parseHistory(unwrapData2(await this.http.get(path)));
6523
7140
  }
6524
- async update(functionId, params) {
6525
- const { memoryMb, timeoutSec, ...rest } = params;
6526
- const body5 = stripUndefined20({
6527
- ...rest,
6528
- memory_mb: memoryMb ?? rest.memory_mb,
6529
- timeout_sec: timeoutSec ?? rest.timeout_sec
7141
+ async putFile(id, path, params) {
7142
+ return this.authorFile(id, path, "PUT", params);
7143
+ }
7144
+ async deleteFile(id, path, params) {
7145
+ return this.authorFile(id, path, "DELETE", params);
7146
+ }
7147
+ async authorFile(id, path, method, params) {
7148
+ const response = await this.http.request(`${repositoryPath(id)}/files/${path.split("/").map(encodeURIComponent).join("/")}`, {
7149
+ method,
7150
+ rawResponse: true,
7151
+ headers: { "Idempotency-Key": params.idempotencyKey ?? crypto.randomUUID() },
7152
+ body: compact({ branch: params.branch, expected_head: params.expectedHead, message: params.message, content: params.content })
6530
7153
  });
6531
- const data = await this.http.patch(
6532
- `/functions/${functionId}`,
6533
- body5
6534
- );
6535
- return unwrap35(data);
7154
+ let payload;
7155
+ try {
7156
+ payload = await response.json();
7157
+ } catch {
7158
+ throw new ForgeContractError("Forge returned invalid file operation JSON");
7159
+ }
7160
+ return parseFileReceipt(unwrapData2(payload), response.headers.get("idempotency-replayed") === "true");
6536
7161
  }
6537
- async delete(functionId) {
6538
- await this.http.delete(`/functions/${functionId}`);
7162
+ async update(id, params) {
7163
+ try {
7164
+ const payload = await this.http.request(repositoryPath(id), { method: "PATCH", body: compact({
7165
+ name: params.name,
7166
+ slug: params.slug,
7167
+ visibility: params.visibility,
7168
+ project_ids: params.projectIds
7169
+ }) });
7170
+ return parseRepository(unwrapData2(payload));
7171
+ } catch (error) {
7172
+ translateError(error);
7173
+ }
6539
7174
  }
6540
- async invoke(functionId, params = {}) {
6541
- const { payload = {}, headers, idempotencyKey: ikey } = params;
6542
- const data = await this.http.request(
6543
- `/functions/${functionId}/invoke`,
6544
- {
6545
- method: "POST",
6546
- body: payload,
6547
- headers: {
6548
- "Idempotency-Key": idempotencyKey6(ikey),
6549
- ...headers
6550
- }
6551
- }
6552
- );
6553
- return data ?? {};
7175
+ async delete(id, _options = {}) {
7176
+ try {
7177
+ const response = await this.http.request(repositoryPath(id), {
7178
+ method: "DELETE",
7179
+ rawResponse: true
7180
+ });
7181
+ const operationId = response.headers.get("x-forge-operation-id");
7182
+ if (!operationId) throw new ForgeContractError("Forge delete omitted its operation receipt");
7183
+ return { operation_id: operationId, replayed: response.headers.get("idempotency-replayed") === "true" };
7184
+ } catch (error) {
7185
+ translateError(error);
7186
+ }
6554
7187
  }
6555
7188
  };
6556
- function unwrap36(payload) {
7189
+ function unwrapData2(payload) {
7190
+ if (!payload || typeof payload !== "object" || Array.isArray(payload) || !("data" in payload))
7191
+ throw new ForgeContractError("Forge returned an invalid success envelope", { payload });
7192
+ return payload.data;
7193
+ }
7194
+ var Forge = class {
7195
+ repositories;
7196
+ constructor(http) {
7197
+ this.repositories = new ForgeRepositories(http);
7198
+ this.http = http;
7199
+ }
7200
+ http;
7201
+ async capabilities() {
7202
+ return parseCapabilities(unwrapData2(await this.http.get("/forge/capabilities")));
7203
+ }
7204
+ };
7205
+ function unwrap38(payload) {
6557
7206
  if (payload && typeof payload === "object" && "data" in payload) {
6558
7207
  return payload.data;
6559
7208
  }
@@ -6589,7 +7238,7 @@ var HealthChecks = class {
6589
7238
  }
6590
7239
  async get(checkId) {
6591
7240
  const data = await this.http.get(`/health-checks/${checkId}`);
6592
- return unwrap36(data);
7241
+ return unwrap38(data);
6593
7242
  }
6594
7243
  async create(params) {
6595
7244
  const {
@@ -6610,7 +7259,7 @@ var HealthChecks = class {
6610
7259
  body: body5,
6611
7260
  headers: { "Idempotency-Key": idempotencyKey7(ikey) }
6612
7261
  });
6613
- return unwrap36(data);
7262
+ return unwrap38(data);
6614
7263
  }
6615
7264
  async update(checkId, params) {
6616
7265
  const { intervalSec, timeoutSec, expectedStatus, ...rest } = params;
@@ -6624,7 +7273,7 @@ var HealthChecks = class {
6624
7273
  `/health-checks/${checkId}`,
6625
7274
  body5
6626
7275
  );
6627
- return unwrap36(data);
7276
+ return unwrap38(data);
6628
7277
  }
6629
7278
  async delete(checkId) {
6630
7279
  await this.http.delete(`/health-checks/${checkId}`);
@@ -6632,7 +7281,7 @@ var HealthChecks = class {
6632
7281
  };
6633
7282
 
6634
7283
  // src/resources/integrations.ts
6635
- function unwrap37(payload) {
7284
+ function unwrap39(payload) {
6636
7285
  if (payload && typeof payload === "object") {
6637
7286
  const p = payload;
6638
7287
  for (const k of ["data", "integrations", "catalog", "items"]) {
@@ -6642,7 +7291,7 @@ function unwrap37(payload) {
6642
7291
  return payload;
6643
7292
  }
6644
7293
  function listItems8(payload) {
6645
- const result = unwrap37(payload);
7294
+ const result = unwrap39(payload);
6646
7295
  if (Array.isArray(result)) return result;
6647
7296
  return [];
6648
7297
  }
@@ -6671,14 +7320,14 @@ var Integrations = class {
6671
7320
  const data = await this.http.get(
6672
7321
  `/integrations/${provider}/start`
6673
7322
  );
6674
- return unwrap37(data);
7323
+ return unwrap39(data);
6675
7324
  }
6676
7325
  /** Force-refresh the access token for a provider. */
6677
7326
  async refresh(provider) {
6678
7327
  const data = await this.http.post(
6679
7328
  `/integrations/${provider}/refresh`
6680
7329
  );
6681
- return unwrap37(data);
7330
+ return unwrap39(data);
6682
7331
  }
6683
7332
  /** Disconnect (revoke) an integration. */
6684
7333
  async disconnect(provider) {
@@ -6703,7 +7352,7 @@ var Integrations = class {
6703
7352
  "/integrations/slack/send-test",
6704
7353
  body5
6705
7354
  );
6706
- return unwrap37(data);
7355
+ return unwrap39(data);
6707
7356
  }
6708
7357
  /** Send a test message to the connected Discord channel. */
6709
7358
  async discordSendTest(params = {}) {
@@ -6712,13 +7361,13 @@ var Integrations = class {
6712
7361
  "/integrations/discord/send-test",
6713
7362
  body5
6714
7363
  );
6715
- return unwrap37(data);
7364
+ return unwrap39(data);
6716
7365
  }
6717
7366
  // ── Linear dedicated controller ────────────────────────────────────────────
6718
7367
  /** Begin Linear OAuth — Linear has provider-specific error shapes. */
6719
7368
  async linearStart() {
6720
7369
  const data = await this.http.get("/integrations/linear/start");
6721
- return unwrap37(data);
7370
+ return unwrap39(data);
6722
7371
  }
6723
7372
  /** Create a Linear issue via the connected workspace. */
6724
7373
  async linearCreateIssue(params = {}) {
@@ -6727,12 +7376,12 @@ var Integrations = class {
6727
7376
  "/integrations/linear/create-issue",
6728
7377
  body5
6729
7378
  );
6730
- return unwrap37(data);
7379
+ return unwrap39(data);
6731
7380
  }
6732
7381
  };
6733
7382
 
6734
7383
  // src/resources/mcp.ts
6735
- function unwrap38(payload) {
7384
+ function unwrap40(payload) {
6736
7385
  if (payload && typeof payload === "object") {
6737
7386
  const p = payload;
6738
7387
  for (const k of ["data", "mcp", "result", "items"]) {
@@ -6758,7 +7407,7 @@ var Mcp = class {
6758
7407
  "/mcp",
6759
7408
  Object.keys(body5).length > 0 ? body5 : void 0
6760
7409
  );
6761
- return unwrap38(data);
7410
+ return unwrap40(data);
6762
7411
  }
6763
7412
  /**
6764
7413
  * Open the MCP listen channel (GET).
@@ -6768,7 +7417,7 @@ var Mcp = class {
6768
7417
  */
6769
7418
  async listen() {
6770
7419
  const data = await this.http.get("/mcp");
6771
- return unwrap38(data);
7420
+ return unwrap40(data);
6772
7421
  }
6773
7422
  /** Close (terminate) the MCP session. */
6774
7423
  async close() {
@@ -6777,7 +7426,7 @@ var Mcp = class {
6777
7426
  };
6778
7427
 
6779
7428
  // src/resources/models.ts
6780
- function unwrap39(data) {
7429
+ function unwrap41(data) {
6781
7430
  if (Array.isArray(data)) return data;
6782
7431
  if (data && typeof data === "object") {
6783
7432
  const d = data;
@@ -6798,7 +7447,7 @@ var Models = class {
6798
7447
  Object.entries(filters).filter(([, v]) => v !== void 0)
6799
7448
  );
6800
7449
  const data = await this.http.get("/intelligence/models", query3);
6801
- return unwrap39(data);
7450
+ return unwrap41(data);
6802
7451
  }
6803
7452
  /**
6804
7453
  * Get a single model by id.
@@ -7454,7 +8103,7 @@ function requestBody(params) {
7454
8103
  config: authConfig(params)
7455
8104
  });
7456
8105
  }
7457
- function unwrap40(payload) {
8106
+ function unwrap42(payload) {
7458
8107
  if (payload && typeof payload === "object") {
7459
8108
  const p = payload;
7460
8109
  for (const k of ["data", "project_auth", "config", "items"]) {
@@ -7479,13 +8128,13 @@ var ProjectAuth = class {
7479
8128
  "/project-auth/status",
7480
8129
  resourcePayload(params)
7481
8130
  );
7482
- return unwrap40(data);
8131
+ return unwrap42(data);
7483
8132
  }
7484
8133
  /** Enable project auth. */
7485
8134
  async enable(params) {
7486
8135
  const body5 = requestBody(params);
7487
8136
  const data = await this.http.post("/project-auth/enable", body5);
7488
- return unwrap40(data);
8137
+ return unwrap42(data);
7489
8138
  }
7490
8139
  /** Disable project auth. */
7491
8140
  async disable(params) {
@@ -7493,18 +8142,18 @@ var ProjectAuth = class {
7493
8142
  "/project-auth/disable",
7494
8143
  resourcePayload(params)
7495
8144
  );
7496
- return unwrap40(data);
8145
+ return unwrap42(data);
7497
8146
  }
7498
8147
  /** Update project-auth configuration. */
7499
8148
  async update(params) {
7500
8149
  const body5 = requestBody(params);
7501
8150
  const data = await this.http.patch("/project-auth/config", body5);
7502
- return unwrap40(data);
8151
+ return unwrap42(data);
7503
8152
  }
7504
8153
  };
7505
8154
 
7506
8155
  // src/resources/project-integrations.ts
7507
- function unwrap41(payload) {
8156
+ function unwrap43(payload) {
7508
8157
  if (payload && typeof payload === "object") {
7509
8158
  const p = payload;
7510
8159
  for (const k of ["data", "project_integrations", "catalog", "items"]) {
@@ -7514,7 +8163,7 @@ function unwrap41(payload) {
7514
8163
  return payload;
7515
8164
  }
7516
8165
  function listItems9(payload) {
7517
- const result = unwrap41(payload);
8166
+ const result = unwrap43(payload);
7518
8167
  if (Array.isArray(result)) return result;
7519
8168
  return [];
7520
8169
  }
@@ -7549,13 +8198,13 @@ var ProjectIntegrations = class {
7549
8198
  const data = await this.http.get(
7550
8199
  `/project-integrations/${integrationId}`
7551
8200
  );
7552
- return unwrap41(data);
8201
+ return unwrap43(data);
7553
8202
  }
7554
8203
  /** Create a project integration. */
7555
8204
  async create(params) {
7556
8205
  const body5 = stripUndefObj2(params);
7557
8206
  const data = await this.http.post("/project-integrations", body5);
7558
- return unwrap41(data);
8207
+ return unwrap43(data);
7559
8208
  }
7560
8209
  /** Update a project integration. */
7561
8210
  async update(integrationId, params) {
@@ -7564,7 +8213,7 @@ var ProjectIntegrations = class {
7564
8213
  `/project-integrations/${integrationId}`,
7565
8214
  body5
7566
8215
  );
7567
- return unwrap41(data);
8216
+ return unwrap43(data);
7568
8217
  }
7569
8218
  /** Delete a project integration. */
7570
8219
  async delete(integrationId) {
@@ -7573,7 +8222,7 @@ var ProjectIntegrations = class {
7573
8222
  };
7574
8223
 
7575
8224
  // src/resources/provider-defaults.ts
7576
- function unwrap42(data) {
8225
+ function unwrap44(data) {
7577
8226
  if (data && typeof data === "object") {
7578
8227
  const d = data;
7579
8228
  for (const k of ["data", "defaults", "provider_defaults", "config"]) {
@@ -7589,7 +8238,7 @@ var ProviderDefaults = class {
7589
8238
  http;
7590
8239
  /** Get the current fleet-wide provider defaults. */
7591
8240
  async list() {
7592
- return unwrap42(await this.http.get("/admin/provider-defaults"));
8241
+ return unwrap44(await this.http.get("/admin/provider-defaults"));
7593
8242
  }
7594
8243
  /** Return the defaults entry for a single provider, or {} if missing. */
7595
8244
  async get(provider) {
@@ -7605,13 +8254,13 @@ var ProviderDefaults = class {
7605
8254
  const body5 = Object.fromEntries(
7606
8255
  Object.entries(opts).filter(([, v]) => v !== void 0)
7607
8256
  );
7608
- return unwrap42(
8257
+ return unwrap44(
7609
8258
  await this.http.put("/admin/provider-defaults", body5)
7610
8259
  );
7611
8260
  }
7612
8261
  // ── Per-tenant overrides ────────────────────────────────────────────────
7613
8262
  async getTenant(tenantId) {
7614
- return unwrap42(
8263
+ return unwrap44(
7615
8264
  await this.http.get(
7616
8265
  `/admin/tenants/${tenantId}/provider-config`
7617
8266
  )
@@ -7621,7 +8270,7 @@ var ProviderDefaults = class {
7621
8270
  const body5 = Object.fromEntries(
7622
8271
  Object.entries(opts).filter(([, v]) => v !== void 0)
7623
8272
  );
7624
- return unwrap42(
8273
+ return unwrap44(
7625
8274
  await this.http.put(
7626
8275
  `/admin/tenants/${tenantId}/provider-config`,
7627
8276
  body5
@@ -7634,7 +8283,7 @@ var ProviderDefaults = class {
7634
8283
  };
7635
8284
 
7636
8285
  // src/resources/regions.ts
7637
- function unwrap43(payload) {
8286
+ function unwrap45(payload) {
7638
8287
  if (payload && typeof payload === "object") {
7639
8288
  const p = payload;
7640
8289
  for (const k of [
@@ -7651,7 +8300,7 @@ function unwrap43(payload) {
7651
8300
  return payload;
7652
8301
  }
7653
8302
  function listItems10(payload) {
7654
- const result = unwrap43(payload);
8303
+ const result = unwrap45(payload);
7655
8304
  if (Array.isArray(result)) return result;
7656
8305
  return [];
7657
8306
  }
@@ -7668,7 +8317,7 @@ var Regions = class {
7668
8317
  /** Get canonical compute catalog, including product templates and readiness. */
7669
8318
  async catalog() {
7670
8319
  const data = await this.http.get("/compute/catalog");
7671
- return unwrap43(data);
8320
+ return unwrap45(data);
7672
8321
  }
7673
8322
  /** List available compute sizes. */
7674
8323
  async listSizes() {
@@ -7678,7 +8327,7 @@ var Regions = class {
7678
8327
  /** Get static compute pricing data. */
7679
8328
  async pricing() {
7680
8329
  const data = await this.http.get("/compute/pricing");
7681
- return unwrap43(data);
8330
+ return unwrap45(data);
7682
8331
  }
7683
8332
  /** List community computer templates. */
7684
8333
  async listTemplates() {
@@ -7690,12 +8339,12 @@ var Regions = class {
7690
8339
  const data = await this.http.get(
7691
8340
  `/compute/templates/${templateId}`
7692
8341
  );
7693
- return unwrap43(data);
8342
+ return unwrap45(data);
7694
8343
  }
7695
8344
  };
7696
8345
 
7697
8346
  // src/resources/runtime-env.ts
7698
- function unwrap44(payload) {
8347
+ function unwrap46(payload) {
7699
8348
  if (payload !== null && typeof payload === "object" && "data" in payload && payload.data !== void 0) {
7700
8349
  return payload.data;
7701
8350
  }
@@ -7748,11 +8397,11 @@ var RuntimeEnv = class {
7748
8397
  "/runtime-env",
7749
8398
  query2(params)
7750
8399
  );
7751
- return unwrap44(response).map(normalize2);
8400
+ return unwrap46(response).map(normalize2);
7752
8401
  }
7753
8402
  async get(id) {
7754
8403
  return normalize2(
7755
- unwrap44(
8404
+ unwrap46(
7756
8405
  await this.http.get(
7757
8406
  `/runtime-env/${encodeURIComponent(id)}`
7758
8407
  )
@@ -7761,7 +8410,7 @@ var RuntimeEnv = class {
7761
8410
  }
7762
8411
  async set(params) {
7763
8412
  return normalize2(
7764
- unwrap44(
8413
+ unwrap46(
7765
8414
  await this.http.post(
7766
8415
  "/runtime-env",
7767
8416
  body4(params)
@@ -7775,7 +8424,7 @@ var RuntimeEnv = class {
7775
8424
  };
7776
8425
 
7777
8426
  // src/resources/runtime-capabilities.ts
7778
- function unwrap45(payload) {
8427
+ function unwrap47(payload) {
7779
8428
  if (payload && typeof payload === "object" && "data" in payload) {
7780
8429
  return payload.data;
7781
8430
  }
@@ -7787,7 +8436,7 @@ var RuntimeCapabilitiesResource = class {
7787
8436
  }
7788
8437
  http;
7789
8438
  async get() {
7790
- return unwrap45(
8439
+ return unwrap47(
7791
8440
  await this.http.get("/runtime-capabilities")
7792
8441
  );
7793
8442
  }
@@ -7803,12 +8452,12 @@ function encodeContent(content) {
7803
8452
  return btoa(bin);
7804
8453
  }
7805
8454
  var SANDBOX_TEMPLATE = "miosa-sandbox";
7806
- var SANDBOX_SHAPE_CONTRACTS = {
7807
- xs: { cpuCount: 1, memoryMb: 2048, diskSizeMb: 10240 },
7808
- small: { cpuCount: 2, memoryMb: 4096, diskSizeMb: 10240 },
7809
- medium: { cpuCount: 4, memoryMb: 8192, diskSizeMb: 20480 },
7810
- large: { cpuCount: 8, memoryMb: 16384, diskSizeMb: 40960 },
7811
- xl: { cpuCount: 16, memoryMb: 32768, diskSizeMb: 81920 }
8455
+ var SANDBOX_TIER_BY_CPU = {
8456
+ 1: { size: "xs", memoryMb: 2048 },
8457
+ 2: { size: "small", memoryMb: 4096 },
8458
+ 4: { size: "medium", memoryMb: 8192 },
8459
+ 8: { size: "large", memoryMb: 16384 },
8460
+ 16: { size: "xl", memoryMb: 32768 }
7812
8461
  };
7813
8462
  var AGENT_WORKSPACE_TIMEOUT_SEC = 86400;
7814
8463
  var AGENT_WORKSPACE_IDLE_TIMEOUT_SEC = 1800;
@@ -7817,7 +8466,7 @@ var AGENT_WORKSPACE_KEEP_LAST_SNAPSHOTS = 1;
7817
8466
  function isLegacyForkParams(opts) {
7818
8467
  return "name" in opts || "metadata" in opts;
7819
8468
  }
7820
- function unwrap46(payload) {
8469
+ function unwrap48(payload) {
7821
8470
  if (payload !== null && typeof payload === "object" && "data" in payload && payload.data !== void 0) {
7822
8471
  return payload.data;
7823
8472
  }
@@ -7861,31 +8510,10 @@ function createBody(params = {}) {
7861
8510
  if (legacyPersistencePolicy) metadata.miosa_persistent = persistent;
7862
8511
  const cpuCount = params.cpuCount ?? params.cpu_count;
7863
8512
  const memoryMb = params.memoryMb ?? params.memory_mb;
7864
- const diskMb = params.diskMb ?? params.disk_mb ?? params.diskSizeMb ?? params.disk_size_mb;
7865
- const suppliedResources = [cpuCount, memoryMb, diskMb].filter(
7866
- (value) => value !== void 0
7867
- ).length;
7868
- if (suppliedResources !== 0 && suppliedResources !== 3) {
7869
- throw new TypeError(
7870
- "Raw sandbox resources require cpuCount, memoryMb, and diskSizeMb together. Prefer size."
7871
- );
7872
- }
7873
- let resolvedSize = params.size;
7874
- if (suppliedResources === 3) {
7875
- const matchingSize = Object.entries(SANDBOX_SHAPE_CONTRACTS).find(
7876
- ([, contract]) => contract.cpuCount === cpuCount && contract.memoryMb === memoryMb && contract.diskSizeMb === diskMb
7877
- )?.[0];
7878
- if (!matchingSize) {
7879
- throw new TypeError(
7880
- "Raw sandbox resources must exactly match a named size contract."
7881
- );
7882
- }
7883
- if (resolvedSize && resolvedSize !== matchingSize) {
7884
- throw new TypeError(
7885
- `Raw sandbox resources match ${matchingSize}, not requested size ${resolvedSize}.`
7886
- );
7887
- }
7888
- resolvedSize = matchingSize;
8513
+ const diskSizeMb = params.diskSizeMb ?? params.disk_size_mb;
8514
+ const resolvedSize = params.size;
8515
+ if (cpuCount !== void 0 || memoryMb !== void 0) {
8516
+ resolveRawShape(cpuCount, memoryMb, diskSizeMb, resolvedSize);
7889
8517
  }
7890
8518
  if (snapshotExpirationSec !== void 0) {
7891
8519
  metadata.snapshot_expiration_sec = snapshotExpirationSec;
@@ -7900,7 +8528,7 @@ function createBody(params = {}) {
7900
8528
  cpu_count: cpuCount,
7901
8529
  memory_mb: memoryMb,
7902
8530
  disk_mb: params.diskMb ?? params.disk_mb,
7903
- disk_size_mb: params.diskSizeMb ?? params.disk_size_mb,
8531
+ disk_size_mb: diskSizeMb,
7904
8532
  timeout_sec: params.timeoutSec ?? params.timeout_sec ?? (legacyPersistencePolicy && persistent === true ? 86400 : void 0),
7905
8533
  idle_timeout_sec: params.idleTimeoutSec ?? params.idle_timeout_sec ?? (legacyPersistencePolicy && persistent === true ? 1800 : void 0),
7906
8534
  always_on: params.alwaysOn ?? params.always_on,
@@ -7920,11 +8548,40 @@ function createBody(params = {}) {
7920
8548
  slug: params.slug,
7921
8549
  agent_runtime_profile_id: params.agentRuntimeProfileId ?? params.agent_runtime_profile_id ?? params.agentProfileId ?? params.agent_profile_id,
7922
8550
  skip_agent_runtime_profile: params.skipRuntimeProfile ?? params.skip_agent_runtime_profile,
8551
+ workspace_id: params.workspaceId ?? params.workspace_id,
8552
+ workspace_slug: params.workspaceSlug ?? params.workspace_slug,
8553
+ workspace_name: params.workspaceName ?? params.workspace_name,
8554
+ project_id: params.projectId ?? params.project_id,
8555
+ project_slug: params.projectSlug ?? params.project_slug,
8556
+ project_name: params.projectName ?? params.project_name,
7923
8557
  external_workspace_id: params.externalWorkspaceId ?? params.external_workspace_id,
7924
8558
  external_user_id: params.externalUserId ?? params.external_user_id,
7925
8559
  external_project_id: params.externalProjectId ?? params.external_project_id
7926
8560
  });
7927
8561
  }
8562
+ function resolveRawShape(cpuCount, memoryMb, diskSizeMb, requestedSize) {
8563
+ const tier = cpuCount === void 0 ? void 0 : SANDBOX_TIER_BY_CPU[cpuCount];
8564
+ const matchedSize = tier && tier.memoryMb === memoryMb ? tier.size : void 0;
8565
+ if (matchedSize === void 0 && (cpuCount === void 0 || memoryMb === void 0 || diskSizeMb === void 0)) {
8566
+ raiseUnresolvableShape(cpuCount, memoryMb, tier);
8567
+ }
8568
+ if (requestedSize !== void 0 && requestedSize !== matchedSize) {
8569
+ throw new TypeError(
8570
+ `Raw sandbox resources (${cpuCount} vCPU / ${memoryMb} MiB) do not match requested size "${requestedSize}".`
8571
+ );
8572
+ }
8573
+ }
8574
+ function raiseUnresolvableShape(cpuCount, memoryMb, tier) {
8575
+ const supplied = `${cpuCount ?? "?"} vCPU / ${memoryMb ?? "?"} MiB`;
8576
+ if (tier) {
8577
+ throw new TypeError(
8578
+ `Unsupported cpu/memory combination (${supplied}); nearest published tier is ${tier.size} (${cpuCount} vCPU / ${tier.memoryMb} MiB). Pass size: "${tier.size}" or memoryMb: ${tier.memoryMb}, or supply cpuCount, memoryMb, and diskSizeMb together for a custom shape.`
8579
+ );
8580
+ }
8581
+ throw new TypeError(
8582
+ `Unsupported cpu/memory combination (${supplied}). Supported tiers: xs (1/2048), small (2/4096), medium (4/8192), large (8/16384), xl (16/32768). Pass a matching cpuCount + memoryMb (any diskSizeMb is allowed), use size, or supply cpuCount, memoryMb, and diskSizeMb together for a custom shape.`
8583
+ );
8584
+ }
7928
8585
  function execBody(command, options = {}) {
7929
8586
  return stripUndefined26({
7930
8587
  command,
@@ -7933,6 +8590,19 @@ function execBody(command, options = {}) {
7933
8590
  timeout: options.timeout ?? options.timeoutSec ?? options.timeout_sec
7934
8591
  });
7935
8592
  }
8593
+ function normalizeExecEvent(event, payload) {
8594
+ const record = payload !== null && typeof payload === "object" ? payload : {};
8595
+ const isExit = event === "exit" || record.exit_code !== void 0 || record.exitCode !== void 0 || event === null && typeof payload === "number";
8596
+ if (isExit) {
8597
+ const code = Number(
8598
+ record.exit_code ?? record.exitCode ?? (typeof payload === "number" ? payload : 0)
8599
+ );
8600
+ return { type: "exit", exit_code: code, exitCode: code };
8601
+ }
8602
+ const type = event === "stderr" ? "stderr" : "stdout";
8603
+ const data = typeof payload === "string" ? payload : String(record.line ?? record.data ?? "");
8604
+ return { type, data, line: data };
8605
+ }
7936
8606
  function stripUndefined26(input) {
7937
8607
  return Object.fromEntries(
7938
8608
  Object.entries(input).filter(([, value]) => value !== void 0)
@@ -8078,7 +8748,7 @@ var SandboxTerminal = class {
8078
8748
  const body5 = Object.fromEntries(
8079
8749
  Object.entries(params).filter(([, v]) => v !== void 0)
8080
8750
  );
8081
- const response = unwrap46(
8751
+ const response = unwrap48(
8082
8752
  await this.sandbox.http.post(`/sandboxes/${this.sandbox.id}/terminal`, body5)
8083
8753
  );
8084
8754
  return response;
@@ -8136,7 +8806,7 @@ var SandboxPreviews = class {
8136
8806
  Object.entries(opts).filter(([, v]) => v !== void 0)
8137
8807
  )
8138
8808
  };
8139
- return unwrap46(
8809
+ return unwrap48(
8140
8810
  await this.http.post(
8141
8811
  `/sandboxes/${this.sandbox.id}/previews`,
8142
8812
  body5
@@ -8144,7 +8814,7 @@ var SandboxPreviews = class {
8144
8814
  );
8145
8815
  }
8146
8816
  async get(previewId) {
8147
- return unwrap46(
8817
+ return unwrap48(
8148
8818
  await this.http.get(
8149
8819
  `/sandboxes/${this.sandbox.id}/previews/${previewId}`
8150
8820
  )
@@ -8157,7 +8827,7 @@ var SandboxPreviews = class {
8157
8827
  }
8158
8828
  /** Mint a share token for previewId. */
8159
8829
  async share(previewId, opts = {}) {
8160
- return unwrap46(
8830
+ return unwrap48(
8161
8831
  await this.http.post(
8162
8832
  `/sandboxes/${this.sandbox.id}/previews/${previewId}/share`,
8163
8833
  { ttl_seconds: opts.ttl_seconds ?? opts.expires_in_sec ?? 3600 }
@@ -8226,7 +8896,7 @@ var SandboxTags = class {
8226
8896
  sandbox;
8227
8897
  /** Replace the full tag list with tags. */
8228
8898
  async set(tags) {
8229
- return unwrap46(
8899
+ return unwrap48(
8230
8900
  await this.sandbox.http.patch(`/sandboxes/${this.sandbox.id}/tags`, { tags })
8231
8901
  );
8232
8902
  }
@@ -8300,7 +8970,7 @@ var Sandbox = class _Sandbox {
8300
8970
  return this.data.template_id ?? this.data.image_id ?? "";
8301
8971
  }
8302
8972
  async refresh() {
8303
- this.data = unwrap46(
8973
+ this.data = unwrap48(
8304
8974
  await this.http.get(`/sandboxes/${this.id}`)
8305
8975
  );
8306
8976
  return this;
@@ -8342,7 +9012,7 @@ var Sandbox = class _Sandbox {
8342
9012
  }
8343
9013
  async runExec(command, options) {
8344
9014
  this.assertRunning("exec");
8345
- const response = unwrap46(
9015
+ const response = unwrap48(
8346
9016
  await this.http.post(
8347
9017
  `/sandboxes/${this.id}/exec`,
8348
9018
  execBody(command, options)
@@ -8363,13 +9033,18 @@ var Sandbox = class _Sandbox {
8363
9033
  }
8364
9034
  execStream(command, options) {
8365
9035
  this.assertRunning("exec.stream");
8366
- return this.http.stream(
9036
+ const frames = this.http.streamFrames(
8367
9037
  `/sandboxes/${this.id}/exec/stream`,
8368
9038
  {
8369
9039
  method: "POST",
8370
9040
  body: execBody(command, options)
8371
9041
  }
8372
9042
  );
9043
+ return (async function* () {
9044
+ for await (const frame of frames) {
9045
+ yield normalizeExecEvent(frame.event, frame.data);
9046
+ }
9047
+ })();
8373
9048
  }
8374
9049
  async writeFile(path, content) {
8375
9050
  this.assertRunning("writeFile");
@@ -8387,7 +9062,7 @@ var Sandbox = class _Sandbox {
8387
9062
  }
8388
9063
  async createExport(params) {
8389
9064
  const body5 = typeof params === "string" ? { path: params } : Array.isArray(params) ? { paths: params } : params;
8390
- const response = unwrap46(
9065
+ const response = unwrap48(
8391
9066
  await this.http.post(
8392
9067
  `/sandboxes/${this.id}/exports`,
8393
9068
  body5
@@ -8412,7 +9087,7 @@ var Sandbox = class _Sandbox {
8412
9087
  }
8413
9088
  async listFiles(path = "/workspace") {
8414
9089
  this.assertRunning("files.list");
8415
- const response = unwrap46(
9090
+ const response = unwrap48(
8416
9091
  await this.http.get(
8417
9092
  `/sandboxes/${this.id}/files`,
8418
9093
  { path }
@@ -8422,7 +9097,7 @@ var Sandbox = class _Sandbox {
8422
9097
  }
8423
9098
  async statFile(path) {
8424
9099
  this.assertRunning("files.stat");
8425
- return unwrap46(
9100
+ return unwrap48(
8426
9101
  await this.http.post(
8427
9102
  `/sandboxes/${this.id}/files/stat`,
8428
9103
  { path }
@@ -8442,7 +9117,7 @@ var Sandbox = class _Sandbox {
8442
9117
  }
8443
9118
  async exposeInfo(port) {
8444
9119
  this.assertRunning("expose");
8445
- const response = unwrap46(
9120
+ const response = unwrap48(
8446
9121
  await this.http.post(
8447
9122
  `/sandboxes/${this.id}/expose`,
8448
9123
  port === void 0 ? {} : { port }
@@ -8452,7 +9127,7 @@ var Sandbox = class _Sandbox {
8452
9127
  }
8453
9128
  async startTemplate(options = {}) {
8454
9129
  this.assertRunning("startTemplate");
8455
- return unwrap46(
9130
+ return unwrap48(
8456
9131
  await this.http.post(
8457
9132
  `/sandboxes/${this.id}/template/start`,
8458
9133
  options
@@ -8460,7 +9135,7 @@ var Sandbox = class _Sandbox {
8460
9135
  );
8461
9136
  }
8462
9137
  async getArtifacts() {
8463
- return unwrap46(
9138
+ return unwrap48(
8464
9139
  await this.http.get(
8465
9140
  `/sandboxes/${this.id}/artifacts`
8466
9141
  )
@@ -8471,7 +9146,7 @@ var Sandbox = class _Sandbox {
8471
9146
  `/sandboxes/${this.id}/logs`,
8472
9147
  { lines }
8473
9148
  );
8474
- return unwrap46(response);
9149
+ return unwrap48(response);
8475
9150
  }
8476
9151
  streamLogs() {
8477
9152
  return this.http.stream(
@@ -8479,7 +9154,7 @@ var Sandbox = class _Sandbox {
8479
9154
  );
8480
9155
  }
8481
9156
  async metrics(window2 = "1h") {
8482
- return unwrap46(
9157
+ return unwrap48(
8483
9158
  await this.http.get(
8484
9159
  `/sandboxes/${this.id}/metrics`,
8485
9160
  { window: window2 }
@@ -8491,7 +9166,7 @@ var Sandbox = class _Sandbox {
8491
9166
  }
8492
9167
  async createSnapshot(comment) {
8493
9168
  this.assertRunning("snapshots.create");
8494
- return unwrap46(
9169
+ return unwrap48(
8495
9170
  await this.http.post(
8496
9171
  `/sandboxes/${this.id}/snapshots`,
8497
9172
  comment ? { comment } : {}
@@ -8499,14 +9174,14 @@ var Sandbox = class _Sandbox {
8499
9174
  );
8500
9175
  }
8501
9176
  async listSnapshots() {
8502
- return unwrap46(
9177
+ return unwrap48(
8503
9178
  await this.http.get(
8504
9179
  `/sandboxes/${this.id}/snapshots`
8505
9180
  )
8506
9181
  );
8507
9182
  }
8508
9183
  async restoreSnapshot(snapshotId) {
8509
- const data = unwrap46(
9184
+ const data = unwrap48(
8510
9185
  await this.http.post(
8511
9186
  `/sandboxes/${this.id}/restore/${snapshotId}`,
8512
9187
  {}
@@ -8523,11 +9198,12 @@ var Sandbox = class _Sandbox {
8523
9198
  }
8524
9199
  this.assertRunning("fork");
8525
9200
  const body5 = stripUndefined26({
9201
+ snapshot_id: opts.snapshotId ?? opts.snapshot_id,
8526
9202
  timeout_sec: opts.timeoutSec ?? opts.timeout_sec,
8527
9203
  template_id: opts.templateId ?? opts.template_id
8528
9204
  });
8529
9205
  const idempotencyKey11 = opts.idempotencyKey ?? opts.idempotency_key;
8530
- const data = unwrap46(
9206
+ const data = unwrap48(
8531
9207
  await this.http.request(
8532
9208
  `/sandboxes/${this.id}/fork`,
8533
9209
  {
@@ -8543,13 +9219,14 @@ var Sandbox = class _Sandbox {
8543
9219
  async forkLegacy(opts = {}) {
8544
9220
  this.assertRunning("fork");
8545
9221
  const body5 = stripUndefined26({
9222
+ snapshot_id: opts.snapshotId ?? opts.snapshot_id,
8546
9223
  timeout_sec: opts.timeoutSec ?? opts.timeout_sec,
8547
9224
  template_id: opts.templateId ?? opts.template_id,
8548
9225
  name: opts.name,
8549
9226
  metadata: opts.metadata
8550
9227
  });
8551
9228
  const idempotencyKey11 = opts.idempotencyKey ?? opts.idempotency_key;
8552
- const data = unwrap46(
9229
+ const data = unwrap48(
8553
9230
  await this.http.request(
8554
9231
  `/sandboxes/${this.id}/fork`,
8555
9232
  {
@@ -8585,7 +9262,7 @@ var Sandbox = class _Sandbox {
8585
9262
  timeout_sec: params.timeout_sec ?? params.timeoutSec,
8586
9263
  idle_timeout_sec: params.idle_timeout_sec ?? params.idleTimeoutSec
8587
9264
  });
8588
- const data = unwrap46(
9265
+ const data = unwrap48(
8589
9266
  await this.http.patch(
8590
9267
  `/sandboxes/${this.id}`,
8591
9268
  body5
@@ -8595,7 +9272,7 @@ var Sandbox = class _Sandbox {
8595
9272
  return this;
8596
9273
  }
8597
9274
  async extend(timeoutSec) {
8598
- const data = unwrap46(
9275
+ const data = unwrap48(
8599
9276
  await this.http.post(
8600
9277
  `/sandboxes/${this.id}/extend`,
8601
9278
  timeoutSec === void 0 ? {} : { timeout_sec: timeoutSec }
@@ -8605,7 +9282,7 @@ var Sandbox = class _Sandbox {
8605
9282
  return this;
8606
9283
  }
8607
9284
  async usage() {
8608
- return unwrap46(
9285
+ return unwrap48(
8609
9286
  await this.http.get(
8610
9287
  `/sandboxes/${this.id}/usage`
8611
9288
  )
@@ -8625,7 +9302,7 @@ var Sandbox = class _Sandbox {
8625
9302
  return raw;
8626
9303
  }
8627
9304
  async pause() {
8628
- const data = unwrap46(
9305
+ const data = unwrap48(
8629
9306
  await this.http.post(
8630
9307
  `/sandboxes/${this.id}/pause`,
8631
9308
  {}
@@ -8646,7 +9323,7 @@ var Sandbox = class _Sandbox {
8646
9323
  `/sandboxes/${this.id}/resume`,
8647
9324
  {}
8648
9325
  );
8649
- const data = unwrap46(response);
9326
+ const data = unwrap48(response);
8650
9327
  this.data = { ...this.data, ...data };
8651
9328
  return this;
8652
9329
  }
@@ -8677,7 +9354,7 @@ var Sandbox = class _Sandbox {
8677
9354
  if (idempotencyKey11) {
8678
9355
  requestOptions.headers = { "Idempotency-Key": idempotencyKey11 };
8679
9356
  }
8680
- return unwrap46(
9357
+ return unwrap48(
8681
9358
  await this.http.request(
8682
9359
  `/sandboxes/${this.id}/deploy`,
8683
9360
  requestOptions
@@ -8687,9 +9364,57 @@ var Sandbox = class _Sandbox {
8687
9364
  async deployDocker(params = {}) {
8688
9365
  return this.deploy({ ...params, deploymentType: "docker_deploy" });
8689
9366
  }
9367
+ /** Deploy an immutable snapshot without modifying the editable sandbox. */
9368
+ async deploySnapshot(snapshotId, params = {}, options = {}) {
9369
+ const release = await this.forkLegacy({
9370
+ snapshotId,
9371
+ name: `release-${snapshotId.slice(0, 12)}`,
9372
+ metadata: { release_source_sandbox_id: this.id, snapshot_id: snapshotId },
9373
+ ...options.forkIdempotencyKey ? { idempotencyKey: options.forkIdempotencyKey } : {}
9374
+ });
9375
+ const cleanupRequested = options.cleanup !== false;
9376
+ const destroyRelease = async () => {
9377
+ if (!cleanupRequested) return void 0;
9378
+ try {
9379
+ await release.destroy();
9380
+ return void 0;
9381
+ } catch (error) {
9382
+ return error instanceof Error ? error.message : String(error);
9383
+ }
9384
+ };
9385
+ let result;
9386
+ try {
9387
+ result = await release.deploy(params) ?? {};
9388
+ } catch (error) {
9389
+ const failedCleanup = await destroyRelease();
9390
+ if (cleanupRequested && failedCleanup === void 0) throw error;
9391
+ const leak = {
9392
+ release_sandbox_id: release.id
9393
+ };
9394
+ if (failedCleanup !== void 0) {
9395
+ leak.release_cleanup_error = failedCleanup;
9396
+ }
9397
+ if (typeof error === "object" && error !== null) {
9398
+ throw Object.assign(error, leak);
9399
+ }
9400
+ throw Object.assign(
9401
+ new Error(`Snapshot deployment failed: ${String(error)}`, {
9402
+ cause: error
9403
+ }),
9404
+ leak
9405
+ );
9406
+ }
9407
+ const cleanupErrorMessage = await destroyRelease();
9408
+ result.source_snapshot_id = snapshotId;
9409
+ result.release_sandbox_id = release.id;
9410
+ if (cleanupErrorMessage !== void 0) {
9411
+ result.release_cleanup_error = cleanupErrorMessage;
9412
+ }
9413
+ return result;
9414
+ }
8690
9415
  /** Check readiness of the sandbox (GET /sandboxes/:id/readiness). */
8691
9416
  async readiness() {
8692
- return unwrap46(
9417
+ return unwrap48(
8693
9418
  await this.http.get(
8694
9419
  `/sandboxes/${this.id}/readiness`
8695
9420
  )
@@ -8716,19 +9441,40 @@ var Sandbox = class _Sandbox {
8716
9441
  const stream = options.stream ?? true;
8717
9442
  if (stream) {
8718
9443
  const sseResult = await this.tryReadinessStream(timeout);
8719
- if (sseResult !== null) return sseResult;
9444
+ if (sseResult !== null) {
9445
+ if (sseResult) await this.adoptReadyState();
9446
+ return sseResult;
9447
+ }
8720
9448
  }
8721
9449
  const deadlineMs = Date.now() + timeout * 1e3;
8722
9450
  while (Date.now() < deadlineMs) {
8723
9451
  try {
8724
9452
  const data = await this.readiness();
8725
- if (data.ready === true || data.status === "ready") return true;
9453
+ if (data.ready === true || data.status === "ready") {
9454
+ await this.adoptReadyState();
9455
+ return true;
9456
+ }
8726
9457
  } catch {
8727
9458
  }
8728
9459
  await new Promise((resolve) => setTimeout(resolve, 10));
8729
9460
  }
8730
9461
  return false;
8731
9462
  }
9463
+ /**
9464
+ * Readiness answers from the server; `assertRunning` reads the local
9465
+ * snapshot. Leaving that snapshot behind meant a caller could await
9466
+ * `waitUntilReady()`, receive `true`, and have the very next call refused
9467
+ * for being "provisioning" — the sandbox was running the whole time, only
9468
+ * this object had not been told. Nothing here can fail the wait: readiness
9469
+ * has already answered, so a refresh that does not land is not the caller's
9470
+ * problem.
9471
+ */
9472
+ async adoptReadyState() {
9473
+ try {
9474
+ await this.refresh();
9475
+ } catch {
9476
+ }
9477
+ }
8732
9478
  /**
8733
9479
  * Returns `true` / `false` for terminal SSE events, or `null` if the
8734
9480
  * stream endpoint is unavailable (404 or transport error) so callers
@@ -8857,7 +9603,7 @@ var Sandboxes = class {
8857
9603
  if (idempotencyKey11) {
8858
9604
  requestOptions.headers = { "Idempotency-Key": idempotencyKey11 };
8859
9605
  }
8860
- const data = unwrap46(
9606
+ const data = unwrap48(
8861
9607
  await this.http.request(
8862
9608
  "/sandboxes",
8863
9609
  requestOptions
@@ -8876,7 +9622,7 @@ var Sandboxes = class {
8876
9622
  return listItems11(data).map((item) => new Sandbox(this.http, item));
8877
9623
  }
8878
9624
  async get(id) {
8879
- const data = unwrap46(
9625
+ const data = unwrap48(
8880
9626
  await this.http.get(`/sandboxes/${id}`)
8881
9627
  );
8882
9628
  return new Sandbox(this.http, data);
@@ -8904,7 +9650,7 @@ var Sandboxes = class {
8904
9650
  return this.get(id);
8905
9651
  }
8906
9652
  async getByName(name) {
8907
- const data = unwrap46(
9653
+ const data = unwrap48(
8908
9654
  await this.http.get(
8909
9655
  `/sandboxes/by-name/${encodeURIComponent(name)}`
8910
9656
  )
@@ -8951,7 +9697,7 @@ var Sandboxes = class {
8951
9697
  );
8952
9698
  }
8953
9699
  async validateBuildSpec(buildSpec) {
8954
- return unwrap46(
9700
+ return unwrap48(
8955
9701
  await this.http.post(
8956
9702
  "/sandbox-templates/validate",
8957
9703
  {
@@ -8971,7 +9717,7 @@ var Sandboxes = class {
8971
9717
  metadata: params.metadata
8972
9718
  })
8973
9719
  );
8974
- return unwrap46(response);
9720
+ return unwrap48(response);
8975
9721
  }
8976
9722
  async createTemplateBuild(templateId, params = {}) {
8977
9723
  const response = await this.http.post(
@@ -8981,19 +9727,19 @@ var Sandboxes = class {
8981
9727
  metadata: params.metadata
8982
9728
  })
8983
9729
  );
8984
- return unwrap46(response);
9730
+ return unwrap48(response);
8985
9731
  }
8986
9732
  async listTemplateBuilds(templateId) {
8987
9733
  const response = await this.http.get(
8988
9734
  `/sandbox-templates/${templateId}/builds`
8989
9735
  );
8990
- return unwrap46(response);
9736
+ return unwrap48(response);
8991
9737
  }
8992
9738
  async getTemplateBuild(buildId) {
8993
9739
  const response = await this.http.get(
8994
9740
  `/sandbox-template-builds/${buildId}`
8995
9741
  );
8996
- return unwrap46(response);
9742
+ return unwrap48(response);
8997
9743
  }
8998
9744
  };
8999
9745
  function toBase642(bytes) {
@@ -9025,7 +9771,7 @@ function previewInfoFromResponse(response) {
9025
9771
  )
9026
9772
  };
9027
9773
  }
9028
- function unwrap47(payload) {
9774
+ function unwrap49(payload) {
9029
9775
  if (payload && typeof payload === "object" && "data" in payload) {
9030
9776
  return payload.data;
9031
9777
  }
@@ -9068,7 +9814,7 @@ var SandboxTemplates = class {
9068
9814
  const data = await this.http.get(
9069
9815
  `/sandbox-templates/${templateId}`
9070
9816
  );
9071
- return unwrap47(data);
9817
+ return unwrap49(data);
9072
9818
  }
9073
9819
  async create(params) {
9074
9820
  const {
@@ -9088,7 +9834,7 @@ var SandboxTemplates = class {
9088
9834
  body: body5,
9089
9835
  headers: { "Idempotency-Key": idempotencyKey8(ikey) }
9090
9836
  });
9091
- return unwrap47(data);
9837
+ return unwrap49(data);
9092
9838
  }
9093
9839
  async buildSpecSchema() {
9094
9840
  const data = await this.http.get("/sandbox-templates/build-spec");
@@ -9121,12 +9867,12 @@ var SandboxTemplates = class {
9121
9867
  headers: { "Idempotency-Key": idempotencyKey8(ikey) }
9122
9868
  }
9123
9869
  );
9124
- return unwrap47(data);
9870
+ return unwrap49(data);
9125
9871
  }
9126
9872
  };
9127
9873
 
9128
9874
  // src/resources/settings.ts
9129
- function unwrap48(payload) {
9875
+ function unwrap50(payload) {
9130
9876
  if (payload && typeof payload === "object") {
9131
9877
  const p = payload;
9132
9878
  for (const k of [
@@ -9142,7 +9888,7 @@ function unwrap48(payload) {
9142
9888
  return payload;
9143
9889
  }
9144
9890
  function listItems13(payload) {
9145
- const result = unwrap48(payload);
9891
+ const result = unwrap50(payload);
9146
9892
  if (Array.isArray(result)) return result;
9147
9893
  return [];
9148
9894
  }
@@ -9159,46 +9905,46 @@ var Settings = class {
9159
9905
  /** Get the current tenant settings. */
9160
9906
  async get() {
9161
9907
  const data = await this.http.get("/settings");
9162
- return unwrap48(data);
9908
+ return unwrap50(data);
9163
9909
  }
9164
9910
  /** Update tenant settings. */
9165
9911
  async update(params) {
9166
9912
  const body5 = stripUndefined28(params);
9167
9913
  const data = await this.http.put("/settings", body5);
9168
- return unwrap48(data);
9914
+ return unwrap50(data);
9169
9915
  }
9170
9916
  // ── Branding ──────────────────────────────────────────────────────────────
9171
9917
  /** Get tenant branding (logo, colors, custom wordmark). */
9172
9918
  async getBranding() {
9173
9919
  const data = await this.http.get("/settings/branding");
9174
- return unwrap48(data);
9920
+ return unwrap50(data);
9175
9921
  }
9176
9922
  /** Update tenant branding. */
9177
9923
  async updateBranding(params) {
9178
9924
  const body5 = stripUndefined28(params);
9179
9925
  const data = await this.http.put("/settings/branding", body5);
9180
- return unwrap48(data);
9926
+ return unwrap50(data);
9181
9927
  }
9182
9928
  // ── Read-only reference data ───────────────────────────────────────────────
9183
9929
  /** Get tenant-scoped compute pricing. */
9184
9930
  async computePricing() {
9185
9931
  const data = await this.http.get("/settings/compute-pricing");
9186
- return unwrap48(data);
9932
+ return unwrap50(data);
9187
9933
  }
9188
9934
  /** Get tenant-scoped GPU pricing. */
9189
9935
  async gpuPricing() {
9190
9936
  const data = await this.http.get("/settings/gpu-pricing");
9191
- return unwrap48(data);
9937
+ return unwrap50(data);
9192
9938
  }
9193
9939
  /** List models available to this tenant. */
9194
9940
  async availableModels() {
9195
9941
  const data = await this.http.get("/settings/available-models");
9196
- return unwrap48(data);
9942
+ return unwrap50(data);
9197
9943
  }
9198
9944
  /** List regions enabled for this tenant. */
9199
9945
  async regions() {
9200
9946
  const data = await this.http.get("/settings/regions");
9201
- return unwrap48(data);
9947
+ return unwrap50(data);
9202
9948
  }
9203
9949
  // ── BYOK provider keys ────────────────────────────────────────────────────
9204
9950
  /** List tenant-level BYOK provider keys (Anthropic, OpenAI, etc.). */
@@ -9213,7 +9959,7 @@ var Settings = class {
9213
9959
  `/settings/provider-keys/${provider}`,
9214
9960
  body5
9215
9961
  );
9216
- return unwrap48(data);
9962
+ return unwrap50(data);
9217
9963
  }
9218
9964
  /** Delete a BYOK provider key. */
9219
9965
  async deleteProviderKey(provider) {
@@ -9222,7 +9968,7 @@ var Settings = class {
9222
9968
  };
9223
9969
 
9224
9970
  // src/resources/snapshots-standalone.ts
9225
- function unwrap49(data) {
9971
+ function unwrap51(data) {
9226
9972
  if (data && typeof data === "object") {
9227
9973
  const d = data;
9228
9974
  for (const k of ["data", "snapshots", "items"]) {
@@ -9253,14 +9999,14 @@ var SnapshotsStandalone = class {
9253
9999
  return unwrapList14(await this.http.get("/admin/snapshots", query3));
9254
10000
  }
9255
10001
  async get(snapshotId) {
9256
- return unwrap49(
10002
+ return unwrap51(
9257
10003
  await this.http.get(`/admin/snapshots/${snapshotId}`)
9258
10004
  );
9259
10005
  }
9260
10006
  };
9261
10007
 
9262
10008
  // src/resources/storage.ts
9263
- function unwrap50(payload) {
10009
+ function unwrap52(payload) {
9264
10010
  if (payload && typeof payload === "object" && "data" in payload) {
9265
10011
  return payload.data;
9266
10012
  }
@@ -9299,11 +10045,11 @@ var Storage = class {
9299
10045
  ...rest
9300
10046
  });
9301
10047
  const data = await this.http.post("/storage/buckets", body5);
9302
- return unwrap50(data);
10048
+ return unwrap52(data);
9303
10049
  }
9304
10050
  async getBucket(bucketId) {
9305
10051
  const data = await this.http.get(`/storage/buckets/${bucketId}`);
9306
- return unwrap50(data);
10052
+ return unwrap52(data);
9307
10053
  }
9308
10054
  async deleteBucket(bucketId) {
9309
10055
  await this.http.delete(`/storage/buckets/${bucketId}`);
@@ -9353,7 +10099,7 @@ var Storage = class {
9353
10099
  `/storage/buckets/${bucketId}/presign`,
9354
10100
  body5
9355
10101
  );
9356
- return unwrap50(data);
10102
+ return unwrap52(data);
9357
10103
  }
9358
10104
  };
9359
10105
 
@@ -9493,7 +10239,7 @@ var Organizations = class {
9493
10239
  };
9494
10240
 
9495
10241
  // src/resources/tenant.ts
9496
- function unwrap51(payload) {
10242
+ function unwrap53(payload) {
9497
10243
  if (payload && typeof payload === "object") {
9498
10244
  const p = payload;
9499
10245
  for (const k of ["data", "tenant", "branding", "items"]) {
@@ -9515,14 +10261,14 @@ var PreviewDomain = class {
9515
10261
  /** Get the tenant's white-label preview domain settings. */
9516
10262
  async get() {
9517
10263
  const data = await this.http.get("/tenant/preview-domain");
9518
- return unwrap51(data);
10264
+ return unwrap53(data);
9519
10265
  }
9520
10266
  /** Set the tenant's white-label preview domain. */
9521
10267
  async set(domain) {
9522
10268
  const data = await this.http.put("/tenant/preview-domain", {
9523
10269
  preview_domain: domain
9524
10270
  });
9525
- return unwrap51(data);
10271
+ return unwrap53(data);
9526
10272
  }
9527
10273
  /** Re-run DNS verification for the configured preview domain. */
9528
10274
  async verify() {
@@ -9530,7 +10276,7 @@ var PreviewDomain = class {
9530
10276
  "/tenant/preview-domain/verify",
9531
10277
  {}
9532
10278
  );
9533
- return unwrap51(data);
10279
+ return unwrap53(data);
9534
10280
  }
9535
10281
  /** Remove the tenant's custom preview domain. */
9536
10282
  async delete() {
@@ -9545,14 +10291,14 @@ var Branding = class {
9545
10291
  /** Get tenant branding used by white-label hosted surfaces. */
9546
10292
  async get() {
9547
10293
  const data = await this.http.get("/tenant/branding");
9548
- return unwrap51(data);
10294
+ return unwrap53(data);
9549
10295
  }
9550
10296
  /** Update tenant branding used by white-label hosted surfaces. */
9551
10297
  async set(params) {
9552
10298
  const data = await this.http.put("/tenant/branding", {
9553
10299
  branding: stripUndefined30(params)
9554
10300
  });
9555
- return unwrap51(data);
10301
+ return unwrap53(data);
9556
10302
  }
9557
10303
  /** Reset tenant branding to platform defaults. */
9558
10304
  async delete() {
@@ -9574,7 +10320,7 @@ var Tenant = class {
9574
10320
  /** Get the current tenant's plan, limits, and live usage counters. */
9575
10321
  async current() {
9576
10322
  const data = await this.http.get("/tenant/plan");
9577
- return unwrap51(data);
10323
+ return unwrap53(data);
9578
10324
  }
9579
10325
  /** Convenience alias for `tenant.branding.get()`. */
9580
10326
  async getBranding() {
@@ -9635,7 +10381,7 @@ var Templates = class {
9635
10381
  };
9636
10382
 
9637
10383
  // src/resources/usage.ts
9638
- function unwrap52(payload) {
10384
+ function unwrap54(payload) {
9639
10385
  if (payload && typeof payload === "object") {
9640
10386
  const p = payload;
9641
10387
  for (const k of ["data", "usage", "sessions", "summary", "items"]) {
@@ -9657,13 +10403,13 @@ var Usage = class {
9657
10403
  /** Get the current period usage summary. */
9658
10404
  async current() {
9659
10405
  const data = await this.http.get("/usage/summary");
9660
- return unwrap52(data);
10406
+ return unwrap54(data);
9661
10407
  }
9662
10408
  /** List per-session metering events. */
9663
10409
  async sessions(params = {}) {
9664
10410
  const query3 = stripUndefined31(params);
9665
10411
  const data = await this.http.get("/usage/sessions", query3);
9666
- const result = unwrap52(data);
10412
+ const result = unwrap54(data);
9667
10413
  if (Array.isArray(result)) return result;
9668
10414
  return [];
9669
10415
  }
@@ -9671,10 +10417,10 @@ var Usage = class {
9671
10417
  async report(params = {}) {
9672
10418
  const query3 = stripUndefined31(params);
9673
10419
  const data = await this.http.get("/usage/summary", query3);
9674
- return unwrap52(data);
10420
+ return unwrap54(data);
9675
10421
  }
9676
10422
  };
9677
- function unwrap53(payload) {
10423
+ function unwrap55(payload) {
9678
10424
  if (payload && typeof payload === "object" && "data" in payload) {
9679
10425
  return payload.data;
9680
10426
  }
@@ -9710,7 +10456,7 @@ var Volumes = class {
9710
10456
  }
9711
10457
  async get(volumeId) {
9712
10458
  const data = await this.http.get(`/volumes/${volumeId}`);
9713
- return unwrap53(data);
10459
+ return unwrap55(data);
9714
10460
  }
9715
10461
  async create(params) {
9716
10462
  const { idempotencyKey: ikey, sizeGb, ...rest } = params;
@@ -9723,7 +10469,7 @@ var Volumes = class {
9723
10469
  body: body5,
9724
10470
  headers: { "Idempotency-Key": idempotencyKey9(ikey) }
9725
10471
  });
9726
- return unwrap53(data);
10472
+ return unwrap55(data);
9727
10473
  }
9728
10474
  async delete(volumeId) {
9729
10475
  await this.http.delete(`/volumes/${volumeId}`);
@@ -9754,7 +10500,7 @@ var Volumes = class {
9754
10500
  `/computers/${computerId}/volumes`,
9755
10501
  body5
9756
10502
  );
9757
- return unwrap53(data);
10503
+ return unwrap55(data);
9758
10504
  }
9759
10505
  async detach(computerId, attachmentId) {
9760
10506
  await this.http.delete(
@@ -9762,7 +10508,7 @@ var Volumes = class {
9762
10508
  );
9763
10509
  }
9764
10510
  };
9765
- function unwrap54(payload) {
10511
+ function unwrap56(payload) {
9766
10512
  if (payload && typeof payload === "object" && "data" in payload) {
9767
10513
  return payload.data;
9768
10514
  }
@@ -9829,7 +10575,7 @@ var Webhooks = class {
9829
10575
  }
9830
10576
  async get(webhookId) {
9831
10577
  const data = await this.http.get(`/webhooks/${webhookId}`);
9832
- return unwrap54(data);
10578
+ return unwrap56(data);
9833
10579
  }
9834
10580
  async create(params) {
9835
10581
  const { idempotencyKey: ikey, ...rest } = params;
@@ -9839,12 +10585,12 @@ var Webhooks = class {
9839
10585
  body: body5,
9840
10586
  headers: { "Idempotency-Key": idempotencyKey10(ikey) }
9841
10587
  });
9842
- return unwrap54(data);
10588
+ return unwrap56(data);
9843
10589
  }
9844
10590
  async update(webhookId, params) {
9845
10591
  const body5 = stripUndefined33(params);
9846
10592
  const data = await this.http.patch(`/webhooks/${webhookId}`, body5);
9847
- return unwrap54(data);
10593
+ return unwrap56(data);
9848
10594
  }
9849
10595
  async delete(webhookId) {
9850
10596
  await this.http.delete(`/webhooks/${webhookId}`);
@@ -9857,7 +10603,7 @@ var Webhooks = class {
9857
10603
  headers: { "Idempotency-Key": idempotencyKey10(opts.idempotencyKey) }
9858
10604
  }
9859
10605
  );
9860
- return unwrap54(data);
10606
+ return unwrap56(data);
9861
10607
  }
9862
10608
  async deliveries(webhookId) {
9863
10609
  const data = await this.http.get(
@@ -10040,6 +10786,7 @@ var Miosa = class {
10040
10786
  orgInvites;
10041
10787
  /** Organizations available to the user session, membership, invites, and switching. */
10042
10788
  organizations;
10789
+ forge;
10043
10790
  /** Current tenant plan, limits, and live usage counters. */
10044
10791
  tenant;
10045
10792
  /** Datacenter regions, compute sizes, pricing, community templates. */
@@ -10064,6 +10811,8 @@ var Miosa = class {
10064
10811
  projectIntegrations;
10065
10812
  /** Built-in auth for generated apps inside sandboxes/deployments. */
10066
10813
  projectAuth;
10814
+ /** Durable generated App Documents, exact-version reviews, and publication bindings. */
10815
+ appDocuments;
10067
10816
  /** BYOK encrypted per-user provider keys. */
10068
10817
  externalKeys;
10069
10818
  /** Model Context Protocol — JSON-RPC dispatch + streaming channel. */
@@ -10078,6 +10827,8 @@ var Miosa = class {
10078
10827
  agentRunGroups;
10079
10828
  /** Agent runtime profiles — tenant/workspace defaults for sandbox/computer agents. */
10080
10829
  agentRuntimeProfiles;
10830
+ /** Persisted workspace Agent definitions and immutable versions. */
10831
+ agents;
10081
10832
  /** MIOSA Connect — provider connectors and runtime tokens. */
10082
10833
  connectors;
10083
10834
  /** Inherited runtime env — tenant/workspace/project defaults for agent runtimes. */
@@ -10183,6 +10934,7 @@ var Miosa = class {
10183
10934
  this.workspaceInvites = new WorkspaceInvites(this.http);
10184
10935
  this.orgInvites = new OrgInvites(this.http);
10185
10936
  this.organizations = new Organizations(this.http);
10937
+ this.forge = new Forge(this.http);
10186
10938
  this.tenant = new Tenant(this.http);
10187
10939
  this.regions = new Regions(this.http);
10188
10940
  this.settings = new Settings(this.http);
@@ -10195,6 +10947,7 @@ var Miosa = class {
10195
10947
  this.integrations = new Integrations(this.http);
10196
10948
  this.projectIntegrations = new ProjectIntegrations(this.http);
10197
10949
  this.projectAuth = new ProjectAuth(this.http);
10950
+ this.appDocuments = new AppDocuments(this.http);
10198
10951
  this.externalKeys = new ExternalKeys(this.http);
10199
10952
  this.mcp = new Mcp(this.http);
10200
10953
  this.runs = new Runs(this.http);
@@ -10202,6 +10955,7 @@ var Miosa = class {
10202
10955
  this.agentRuns = new AgentRuns(this.http);
10203
10956
  this.agentRunGroups = new AgentRunGroups(this.http);
10204
10957
  this.agentRuntimeProfiles = new AgentRuntimeProfiles(this.http);
10958
+ this.agents = new AgentDefinitions(this.http);
10205
10959
  this.connectors = new Connectors(this.http);
10206
10960
  this.runtimeEnv = new RuntimeEnv(this.http);
10207
10961
  this.runtimeCapabilities = new RuntimeCapabilitiesResource(this.http);
@@ -10728,6 +11482,6 @@ var AppAuth = class {
10728
11482
  }
10729
11483
  };
10730
11484
 
10731
- export { AGENT_BUILD_KIND_SPECS, Admin, AgentRuntimeProfiles, Analytics, ApiKeys, AppAuth, AuditLog, AuthError, Benchmarks, BuilderSessions, Channels, Checkpoints, Cloud, CommandCenter, Community, Completions, Computer, ComputerAudit, ComputerAutoStop, ComputerConnectors, ComputerEnv, ComputerInbox, ComputerLogs, ComputerNetwork, ComputerOsa, ComputerPorts, ComputerSecrets, ComputerTerminal, ComputerVolumes, Computers, Connectors, Credits, CronJobs, DEFAULT_AGENT_BUILD_OUTPUT_ROOT, DEFAULT_AGENT_BUILD_PACKET_VERSION, Dashboard, Databases, DeploymentConnectors, DeploymentDomains, DeploymentReleases, DeploymentRuntimeInstances, DeploymentVersions, Deployments, Desktop, Devices, DockerDeploy, EgressAudit, EgressHostNotAllowedError, EgressNetwork, EgressSecrets, Email, EmailCampaigns, EmailInbox, EmailTemplates, Embeddings, Exec, ExternalKeys, Files, FlatCustomDomains, Functions, HealthChecks, InstallationRequiredError, InsufficientCreditsError, Integrations, ManagedProviderBindingOnlyError, Mcp, Miosa, MiosaError, Models, NetworkError, NetworkPolicy, NotFoundError, OAuthFlow, OpenComputers, OrgInvites, OrganizationMembers, Organizations, ProjectAuth, ProjectIntegrations, ProjectNotLinkedError, ProviderDefaults, RateLimitError, Regions, RunGroups, Runs, RuntimeCapabilitiesResource, RuntimeEnv, SANDBOX_TEMPLATE, Sandbox, SandboxAudit, SandboxCommands, SandboxConnectors, SandboxEnv, SandboxEvents, SandboxFiles, SandboxNetwork, SandboxPreview, SandboxPreviews, SandboxSecrets, SandboxTags, SandboxTemplates, SandboxTerminal, Sandboxes, ScopeNotAllowedError, ScopedFs, Settings, SnapshotsStandalone, Storage, SubjectNotAllowedError, Templates, Tenant, TimeoutError, TokenRefreshFailedError, Usage, UserAuthorizationRequiredError, ValidationError, Volumes, Webhooks, WorkspaceInvites, WorkspaceMembers, createAgentBuildExecutionPacket, createAgentBuildExpectedOutputs, createAgentBuildPrompt, createBuildRunParams, getAgentBuildKindSpec, resolveAgentBuildKind, verifySignature };
11485
+ export { AGENT_BUILD_KIND_SPECS, Admin, AgentDefinitions, AgentRuntimeProfiles, Analytics, ApiKeys, AppAuth, AppDocuments, AuditLog, AuthError, Benchmarks, BuilderSessions, Channels, Checkpoints, Cloud, CommandCenter, Community, Completions, Computer, ComputerAudit, ComputerAutoStop, ComputerConnectors, ComputerEnv, ComputerInbox, ComputerLogs, ComputerNetwork, ComputerOsa, ComputerPorts, ComputerSecrets, ComputerTerminal, ComputerVolumes, Computers, Connectors, Credits, CronJobs, DEFAULT_AGENT_BUILD_OUTPUT_ROOT, DEFAULT_AGENT_BUILD_PACKET_VERSION, Dashboard, Databases, DeploymentConnectors, DeploymentDomains, DeploymentReleases, DeploymentRuntimeInstances, DeploymentVersions, Deployments, Desktop, Devices, DockerDeploy, EgressAudit, EgressHostNotAllowedError, EgressNetwork, EgressSecrets, Email, EmailCampaigns, EmailInbox, EmailTemplates, Embeddings, Exec, ExternalKeys, Files, FlatCustomDomains, Forge, ForgeContractError, ForgePolicyViolationError, ForgeRepositories, ForgeStorageError, ForgeUnavailableError, Functions, HealthChecks, InstallationRequiredError, InsufficientCreditsError, Integrations, ManagedProviderBindingOnlyError, Mcp, Miosa, MiosaError, Models, NetworkError, NetworkPolicy, NotFoundError, OAuthFlow, OpenComputers, OrgInvites, OrganizationMembers, Organizations, ProjectAuth, ProjectIntegrations, ProjectNotLinkedError, ProviderDefaults, RateLimitError, Regions, RunGroups, Runs, RuntimeCapabilitiesResource, RuntimeEnv, SANDBOX_TEMPLATE, Sandbox, SandboxAudit, SandboxCommands, SandboxConnectors, SandboxEnv, SandboxEvents, SandboxFiles, SandboxNetwork, SandboxPreview, SandboxPreviews, SandboxSecrets, SandboxTags, SandboxTemplates, SandboxTerminal, Sandboxes, ScopeNotAllowedError, ScopedFs, Settings, SnapshotsStandalone, Storage, SubjectNotAllowedError, Templates, Tenant, TimeoutError, TokenRefreshFailedError, Usage, UserAuthorizationRequiredError, ValidationError, Volumes, Webhooks, WorkspaceInvites, WorkspaceMembers, createAgentBuildExecutionPacket, createAgentBuildExpectedOutputs, createAgentBuildPrompt, createBuildRunParams, getAgentBuildKindSpec, resolveAgentBuildKind, verifySignature };
10732
11486
  //# sourceMappingURL=index.js.map
10733
11487
  //# sourceMappingURL=index.js.map