@scalemule/sdk 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -577,81 +577,76 @@ var ScaleMuleClient = class {
577
577
  * Single upload with XMLHttpRequest for progress tracking.
578
578
  * Supports abort via AbortSignal.
579
579
  */
580
- uploadWithXHR(url, buildFormData, onProgress, signal, maxRetries = this.maxRetries) {
581
- return new Promise(async (resolve) => {
582
- let lastError = null;
583
- for (let attempt = 0; attempt <= maxRetries; attempt++) {
584
- const result = await new Promise((res) => {
585
- const xhr = new XMLHttpRequest();
586
- if (signal) {
587
- if (signal.aborted) {
588
- res({ data: null, error: { code: "aborted", message: "Upload aborted", status: 0 } });
589
- return;
590
- }
591
- signal.addEventListener("abort", () => xhr.abort(), { once: true });
580
+ async uploadWithXHR(url, buildFormData, onProgress, signal, maxRetries = this.maxRetries) {
581
+ let lastError = null;
582
+ for (let attempt = 0; attempt <= maxRetries; attempt++) {
583
+ const result = await new Promise((res) => {
584
+ const xhr = new XMLHttpRequest();
585
+ if (signal) {
586
+ if (signal.aborted) {
587
+ res({ data: null, error: { code: "aborted", message: "Upload aborted", status: 0 } });
588
+ return;
592
589
  }
593
- xhr.upload.addEventListener("progress", (event) => {
594
- if (event.lengthComputable) {
595
- onProgress(Math.round(event.loaded / event.total * 100));
596
- }
597
- });
598
- xhr.addEventListener("load", () => {
599
- try {
600
- const data = JSON.parse(xhr.responseText);
601
- if (xhr.status >= 200 && xhr.status < 300) {
602
- const result2 = data?.data !== void 0 ? data.data : data;
603
- res({ data: result2, error: null });
604
- } else {
605
- res({
606
- data: null,
607
- error: {
608
- code: data?.error?.code || statusToErrorCode(xhr.status),
609
- message: data?.error?.message || data?.message || "Upload failed",
610
- status: xhr.status,
611
- details: data?.error?.details
612
- }
613
- });
614
- }
615
- } catch {
616
- res({ data: null, error: { code: "internal_error", message: "Failed to parse response", status: 0 } });
590
+ signal.addEventListener("abort", () => xhr.abort(), { once: true });
591
+ }
592
+ xhr.upload.addEventListener("progress", (event) => {
593
+ if (event.lengthComputable) {
594
+ onProgress(Math.round(event.loaded / event.total * 100));
595
+ }
596
+ });
597
+ xhr.addEventListener("load", () => {
598
+ try {
599
+ const data = JSON.parse(xhr.responseText);
600
+ if (xhr.status >= 200 && xhr.status < 300) {
601
+ const result2 = data?.data !== void 0 ? data.data : data;
602
+ res({ data: result2, error: null });
603
+ } else {
604
+ res({
605
+ data: null,
606
+ error: {
607
+ code: data?.error?.code || statusToErrorCode(xhr.status),
608
+ message: data?.error?.message || data?.message || "Upload failed",
609
+ status: xhr.status,
610
+ details: data?.error?.details
611
+ }
612
+ });
617
613
  }
618
- });
619
- xhr.addEventListener("error", () => {
620
- res({ data: null, error: { code: "upload_error", message: "Upload failed", status: 0 } });
621
- });
622
- xhr.addEventListener("abort", () => {
623
- res({ data: null, error: { code: "aborted", message: "Upload aborted", status: 0 } });
624
- });
625
- xhr.open("POST", url);
626
- xhr.setRequestHeader("x-api-key", this.apiKey);
627
- if (this.sessionToken) {
628
- xhr.setRequestHeader("Authorization", `Bearer ${this.sessionToken}`);
614
+ } catch {
615
+ res({ data: null, error: { code: "internal_error", message: "Failed to parse response", status: 0 } });
629
616
  }
630
- xhr.send(buildFormData());
631
617
  });
632
- if (result.error === null) {
633
- resolve(result);
634
- return;
635
- }
636
- const isRetryable = result.error.code === "upload_error" || result.error.code === "network_error" || RETRYABLE_STATUS_CODES.has(result.error.status);
637
- if (result.error.code === "aborted") {
638
- resolve(result);
639
- return;
640
- }
641
- if (attempt < maxRetries && isRetryable) {
642
- lastError = result.error;
643
- onProgress(0);
644
- await sleep(getBackoffDelay(attempt, this.backoffMs));
645
- continue;
618
+ xhr.addEventListener("error", () => {
619
+ res({ data: null, error: { code: "upload_error", message: "Upload failed", status: 0 } });
620
+ });
621
+ xhr.addEventListener("abort", () => {
622
+ res({ data: null, error: { code: "aborted", message: "Upload aborted", status: 0 } });
623
+ });
624
+ xhr.open("POST", url);
625
+ xhr.setRequestHeader("x-api-key", this.apiKey);
626
+ if (this.sessionToken) {
627
+ xhr.setRequestHeader("Authorization", `Bearer ${this.sessionToken}`);
646
628
  }
647
- resolve(result);
648
- return;
649
- }
650
- resolve({
651
- data: null,
652
- error: lastError || { code: "upload_error", message: "Upload failed", status: 0 }
629
+ xhr.send(buildFormData());
653
630
  });
654
- });
631
+ if (result.error === null) {
632
+ return result;
633
+ }
634
+ const isRetryable = result.error.code === "upload_error" || result.error.code === "network_error" || RETRYABLE_STATUS_CODES.has(result.error.status);
635
+ if (result.error.code === "aborted") {
636
+ return result;
637
+ }
638
+ if (attempt < maxRetries && isRetryable) {
639
+ lastError = result.error;
640
+ onProgress(0);
641
+ await sleep(getBackoffDelay(attempt, this.backoffMs));
642
+ continue;
643
+ }
644
+ return result;
645
+ }
646
+ return {
647
+ data: null,
648
+ error: lastError || { code: "upload_error", message: "Upload failed", status: 0 }
649
+ };
655
650
  }
656
651
  // --------------------------------------------------------------------------
657
652
  // Offline Queue Sync
@@ -744,7 +739,12 @@ var ServiceModule = class {
744
739
  // File upload (delegates to client.upload)
745
740
  // --------------------------------------------------------------------------
746
741
  _upload(path, file, additionalFields, options) {
747
- return this.client.upload(`${this.basePath}${path}`, file, additionalFields, this.resolveOptions(options));
742
+ return this.client.upload(
743
+ `${this.basePath}${path}`,
744
+ file,
745
+ additionalFields,
746
+ this.resolveOptions(options)
747
+ );
748
748
  }
749
749
  // --------------------------------------------------------------------------
750
750
  // Query string helper (available to subclasses)
@@ -1439,13 +1439,17 @@ var StorageService = class extends ServiceModule {
1439
1439
  const directStart = Date.now();
1440
1440
  const requestOpts = this.withSessionHeader(sessionId, options);
1441
1441
  const filename = options?.filename || file.name || "file";
1442
- const initResult = await this.post("/signed-url/upload", {
1443
- filename,
1444
- content_type: file.type || "application/octet-stream",
1445
- size_bytes: file.size,
1446
- is_public: options?.isPublic ?? true,
1447
- metadata: options?.metadata
1448
- }, requestOpts);
1442
+ const initResult = await this.post(
1443
+ "/signed-url/upload",
1444
+ {
1445
+ filename,
1446
+ content_type: file.type || "application/octet-stream",
1447
+ size_bytes: file.size,
1448
+ is_public: options?.isPublic ?? true,
1449
+ metadata: options?.metadata
1450
+ },
1451
+ requestOpts
1452
+ );
1449
1453
  if (initResult.error) {
1450
1454
  telemetry?.emit(sessionId, "upload.failed", { step: "presign", error: initResult.error.message });
1451
1455
  return { data: null, error: initResult.error };
@@ -1471,14 +1475,27 @@ var StorageService = class extends ServiceModule {
1471
1475
  });
1472
1476
  return { data: null, error: uploadResult.error };
1473
1477
  }
1474
- const completeResult = await this.post("/signed-url/complete", {
1475
- file_id,
1476
- completion_token
1477
- }, requestOpts);
1478
+ const completeResult = await this.post(
1479
+ "/signed-url/complete",
1480
+ {
1481
+ file_id,
1482
+ completion_token
1483
+ },
1484
+ requestOpts
1485
+ );
1478
1486
  if (completeResult.error) {
1479
- telemetry?.emit(sessionId, "upload.failed", { step: "complete", error: completeResult.error.message, file_id, duration_ms: Date.now() - directStart });
1487
+ telemetry?.emit(sessionId, "upload.failed", {
1488
+ step: "complete",
1489
+ error: completeResult.error.message,
1490
+ file_id,
1491
+ duration_ms: Date.now() - directStart
1492
+ });
1480
1493
  } else {
1481
- telemetry?.emit(sessionId, "upload.completed", { file_id, size_bytes: file.size, duration_ms: Date.now() - directStart });
1494
+ telemetry?.emit(sessionId, "upload.completed", {
1495
+ file_id,
1496
+ size_bytes: file.size,
1497
+ duration_ms: Date.now() - directStart
1498
+ });
1482
1499
  }
1483
1500
  return completeResult;
1484
1501
  }
@@ -1513,14 +1530,17 @@ var StorageService = class extends ServiceModule {
1513
1530
  });
1514
1531
  }
1515
1532
  } catch (err) {
1516
- telemetry?.emit(sessionId, "upload.retried", { step: "resume_load", error: err instanceof Error ? err.message : "Resume store unavailable" });
1533
+ telemetry?.emit(sessionId, "upload.retried", {
1534
+ step: "resume_load",
1535
+ error: err instanceof Error ? err.message : "Resume store unavailable"
1536
+ });
1517
1537
  resumeStore = null;
1518
1538
  resumeData = null;
1519
1539
  }
1520
1540
  }
1521
1541
  let startData;
1522
1542
  let completionToken;
1523
- let completedParts = /* @__PURE__ */ new Map();
1543
+ const completedParts = /* @__PURE__ */ new Map();
1524
1544
  if (resumeData) {
1525
1545
  startData = {
1526
1546
  upload_session_id: resumeData.upload_session_id,
@@ -1549,15 +1569,19 @@ var StorageService = class extends ServiceModule {
1549
1569
  );
1550
1570
  } catch {
1551
1571
  }
1552
- const startResult = await this.post("/signed-url/multipart/start", {
1553
- filename,
1554
- content_type: file.type || "application/octet-stream",
1555
- size_bytes: file.size,
1556
- is_public: options?.isPublic ?? true,
1557
- metadata: options?.metadata,
1558
- chunk_size: options?.chunkSize,
1559
- ...clientUploadKey ? { client_upload_key: clientUploadKey } : {}
1560
- }, requestOpts);
1572
+ const startResult = await this.post(
1573
+ "/signed-url/multipart/start",
1574
+ {
1575
+ filename,
1576
+ content_type: file.type || "application/octet-stream",
1577
+ size_bytes: file.size,
1578
+ is_public: options?.isPublic ?? true,
1579
+ metadata: options?.metadata,
1580
+ chunk_size: options?.chunkSize,
1581
+ ...clientUploadKey ? { client_upload_key: clientUploadKey } : {}
1582
+ },
1583
+ requestOpts
1584
+ );
1561
1585
  if (startResult.error) {
1562
1586
  telemetry?.emit(sessionId, "upload.multipart.aborted", { error: startResult.error.message });
1563
1587
  return { data: null, error: startResult.error };
@@ -1586,11 +1610,14 @@ var StorageService = class extends ServiceModule {
1586
1610
  created_at: Date.now()
1587
1611
  });
1588
1612
  } catch (err) {
1589
- telemetry?.emit(sessionId, "upload.retried", { step: "resume_save", error: err instanceof Error ? err.message : "Resume save failed" });
1613
+ telemetry?.emit(sessionId, "upload.retried", {
1614
+ step: "resume_save",
1615
+ error: err instanceof Error ? err.message : "Resume save failed"
1616
+ });
1590
1617
  }
1591
1618
  }
1592
1619
  const maxConcurrency = options?.maxConcurrency || this.defaultConcurrency();
1593
- let availableUrls = /* @__PURE__ */ new Map();
1620
+ const availableUrls = /* @__PURE__ */ new Map();
1594
1621
  if (startData.part_urls.length > 0) {
1595
1622
  for (const pu of startData.part_urls) {
1596
1623
  availableUrls.set(pu.part_number, pu);
@@ -1611,7 +1638,11 @@ var StorageService = class extends ServiceModule {
1611
1638
  }
1612
1639
  const milestone = Math.floor(percent / 25) * 25;
1613
1640
  if (milestone > lastProgressMilestone && milestone < 100) {
1614
- telemetry?.emit(sessionId, "upload.progress", { percent: milestone, uploaded_parts: uploadedCount, total_parts });
1641
+ telemetry?.emit(sessionId, "upload.progress", {
1642
+ percent: milestone,
1643
+ uploaded_parts: uploadedCount,
1644
+ total_parts
1645
+ });
1615
1646
  lastProgressMilestone = milestone;
1616
1647
  }
1617
1648
  };
@@ -1711,7 +1742,11 @@ var StorageService = class extends ServiceModule {
1711
1742
  );
1712
1743
  await resumeStore.updatePart(resumeKey, result.partNum, result.etag);
1713
1744
  } catch (err) {
1714
- telemetry?.emit(sessionId, "upload.retried", { step: "resume_update", part_number: result.partNum, error: err instanceof Error ? err.message : "Resume update failed" });
1745
+ telemetry?.emit(sessionId, "upload.retried", {
1746
+ step: "resume_update",
1747
+ part_number: result.partNum,
1748
+ error: err instanceof Error ? err.message : "Resume update failed"
1749
+ });
1715
1750
  }
1716
1751
  }
1717
1752
  } else {
@@ -1745,15 +1780,30 @@ var StorageService = class extends ServiceModule {
1745
1780
  );
1746
1781
  await resumeStore.remove(resumeKey);
1747
1782
  } catch (err) {
1748
- telemetry?.emit(sessionId, "upload.retried", { step: "resume_cleanup", error: err instanceof Error ? err.message : "Resume cleanup failed" });
1783
+ telemetry?.emit(sessionId, "upload.retried", {
1784
+ step: "resume_cleanup",
1785
+ error: err instanceof Error ? err.message : "Resume cleanup failed"
1786
+ });
1749
1787
  }
1750
1788
  }
1751
1789
  if (completeResult.error) {
1752
- telemetry?.emit(sessionId, "upload.multipart.aborted", { file_id, error: completeResult.error.message, duration_ms: Date.now() - multipartStart });
1790
+ telemetry?.emit(sessionId, "upload.multipart.aborted", {
1791
+ file_id,
1792
+ error: completeResult.error.message,
1793
+ duration_ms: Date.now() - multipartStart
1794
+ });
1753
1795
  return { data: null, error: completeResult.error };
1754
1796
  }
1755
- telemetry?.emit(sessionId, "upload.multipart.completed", { file_id, size_bytes: file.size, duration_ms: Date.now() - multipartStart });
1756
- telemetry?.emit(sessionId, "upload.completed", { file_id, size_bytes: file.size, duration_ms: Date.now() - multipartStart });
1797
+ telemetry?.emit(sessionId, "upload.multipart.completed", {
1798
+ file_id,
1799
+ size_bytes: file.size,
1800
+ duration_ms: Date.now() - multipartStart
1801
+ });
1802
+ telemetry?.emit(sessionId, "upload.completed", {
1803
+ file_id,
1804
+ size_bytes: file.size,
1805
+ duration_ms: Date.now() - multipartStart
1806
+ });
1757
1807
  options?.onProgress?.(100);
1758
1808
  const d = completeResult.data;
1759
1809
  return {
@@ -1773,10 +1823,14 @@ var StorageService = class extends ServiceModule {
1773
1823
  // --------------------------------------------------------------------------
1774
1824
  async abortMultipart(uploadSessionId, completionToken, requestOpts) {
1775
1825
  try {
1776
- await this.post("/signed-url/multipart/abort", {
1777
- upload_session_id: uploadSessionId,
1778
- ...completionToken ? { completion_token: completionToken } : {}
1779
- }, requestOpts);
1826
+ await this.post(
1827
+ "/signed-url/multipart/abort",
1828
+ {
1829
+ upload_session_id: uploadSessionId,
1830
+ ...completionToken ? { completion_token: completionToken } : {}
1831
+ },
1832
+ requestOpts
1833
+ );
1780
1834
  } catch {
1781
1835
  }
1782
1836
  }
@@ -1791,25 +1845,33 @@ var StorageService = class extends ServiceModule {
1791
1845
  * Flow: server calls getUploadUrl() → returns URL to client → client PUTs to S3 → server calls completeUpload()
1792
1846
  */
1793
1847
  async getUploadUrl(filename, contentType, options, requestOptions) {
1794
- return this.post("/signed-url/upload", {
1795
- filename,
1796
- content_type: contentType,
1797
- is_public: options?.isPublic ?? true,
1798
- expires_in: options?.expiresIn ?? 3600,
1799
- metadata: options?.metadata
1800
- }, requestOptions);
1848
+ return this.post(
1849
+ "/signed-url/upload",
1850
+ {
1851
+ filename,
1852
+ content_type: contentType,
1853
+ is_public: options?.isPublic ?? true,
1854
+ expires_in: options?.expiresIn ?? 3600,
1855
+ metadata: options?.metadata
1856
+ },
1857
+ requestOptions
1858
+ );
1801
1859
  }
1802
1860
  /**
1803
1861
  * Complete a presigned upload after the file has been uploaded to S3.
1804
1862
  * Triggers scan and makes the file available.
1805
1863
  */
1806
1864
  async completeUpload(fileId, completionToken, options, requestOptions) {
1807
- return this.post("/signed-url/complete", {
1808
- file_id: fileId,
1809
- completion_token: completionToken,
1810
- size_bytes: options?.sizeBytes,
1811
- checksum: options?.checksum
1812
- }, requestOptions);
1865
+ return this.post(
1866
+ "/signed-url/complete",
1867
+ {
1868
+ file_id: fileId,
1869
+ completion_token: completionToken,
1870
+ size_bytes: options?.sizeBytes,
1871
+ checksum: options?.checksum
1872
+ },
1873
+ requestOptions
1874
+ );
1813
1875
  }
1814
1876
  // --------------------------------------------------------------------------
1815
1877
  // Multipart Public API (for advanced/server-side usage)
@@ -1820,11 +1882,15 @@ var StorageService = class extends ServiceModule {
1820
1882
  }
1821
1883
  /** Get presigned URLs for specific part numbers. */
1822
1884
  async getMultipartPartUrls(uploadSessionId, partNumbers, completionToken, requestOptions) {
1823
- return this.post("/signed-url/multipart/part-urls", {
1824
- upload_session_id: uploadSessionId,
1825
- part_numbers: partNumbers,
1826
- ...completionToken ? { completion_token: completionToken } : {}
1827
- }, requestOptions);
1885
+ return this.post(
1886
+ "/signed-url/multipart/part-urls",
1887
+ {
1888
+ upload_session_id: uploadSessionId,
1889
+ part_numbers: partNumbers,
1890
+ ...completionToken ? { completion_token: completionToken } : {}
1891
+ },
1892
+ requestOptions
1893
+ );
1828
1894
  }
1829
1895
  /** Complete a multipart upload. */
1830
1896
  async completeMultipartUpload(params, requestOptions) {
@@ -1832,10 +1898,14 @@ var StorageService = class extends ServiceModule {
1832
1898
  }
1833
1899
  /** Abort a multipart upload. */
1834
1900
  async abortMultipartUpload(uploadSessionId, completionToken, requestOptions) {
1835
- return this.post("/signed-url/multipart/abort", {
1836
- upload_session_id: uploadSessionId,
1837
- ...completionToken ? { completion_token: completionToken } : {}
1838
- }, requestOptions);
1901
+ return this.post(
1902
+ "/signed-url/multipart/abort",
1903
+ {
1904
+ upload_session_id: uploadSessionId,
1905
+ ...completionToken ? { completion_token: completionToken } : {}
1906
+ },
1907
+ requestOptions
1908
+ );
1839
1909
  }
1840
1910
  // --------------------------------------------------------------------------
1841
1911
  // File Operations
@@ -1884,7 +1954,11 @@ var StorageService = class extends ServiceModule {
1884
1954
  * Public files get 7-day signed URLs; private files get 1-hour signed URLs.
1885
1955
  */
1886
1956
  async updateVisibility(fileId, isPublic, options) {
1887
- return this.patch(`/files/${fileId}/visibility`, { is_public: isPublic }, options);
1957
+ return this.patch(
1958
+ `/files/${fileId}/visibility`,
1959
+ { is_public: isPublic },
1960
+ options
1961
+ );
1888
1962
  }
1889
1963
  // --------------------------------------------------------------------------
1890
1964
  // Legacy methods (backward compat)
@@ -2028,10 +2102,14 @@ var StorageService = class extends ServiceModule {
2028
2102
  resolve({ data: null, error: { code: "aborted", message: "Upload aborted", status: 0 } });
2029
2103
  return;
2030
2104
  }
2031
- signal.addEventListener("abort", () => {
2032
- clearStallTimer();
2033
- xhr.abort();
2034
- }, { once: true });
2105
+ signal.addEventListener(
2106
+ "abort",
2107
+ () => {
2108
+ clearStallTimer();
2109
+ xhr.abort();
2110
+ },
2111
+ { once: true }
2112
+ );
2035
2113
  }
2036
2114
  xhr.upload.addEventListener("progress", (event) => {
2037
2115
  resetStallTimer();
@@ -2118,7 +2196,11 @@ var StorageService = class extends ServiceModule {
2118
2196
  return { error: `Part upload failed: ${response.status}`, status: response.status, code: "s3_error" };
2119
2197
  }
2120
2198
  if (attempt === RETRY_DELAYS.length - 1) {
2121
- return { error: `Part upload failed after retries: ${response.status}`, status: response.status, code: "s3_error" };
2199
+ return {
2200
+ error: `Part upload failed after retries: ${response.status}`,
2201
+ status: response.status,
2202
+ code: "s3_error"
2203
+ };
2122
2204
  }
2123
2205
  } catch (err) {
2124
2206
  clearTimeout(timer);
@@ -2158,7 +2240,7 @@ var StorageService = class extends ServiceModule {
2158
2240
  }
2159
2241
  async maybeCompress(file, config, sessionId, telemetry) {
2160
2242
  try {
2161
- const { maybeCompressImage } = await import("./upload-compression-CWKEDQYS.mjs");
2243
+ const { maybeCompressImage } = await import("./upload-compression-VOUJRAIM.mjs");
2162
2244
  return await maybeCompressImage(file, config, sessionId, telemetry);
2163
2245
  } catch {
2164
2246
  return null;
@@ -2624,14 +2706,18 @@ var VideoService = class extends ServiceModule {
2624
2706
  const chunkSize = Math.max(options?.chunkSize ?? DEFAULT_CHUNK_SIZE, MIN_CHUNK_SIZE);
2625
2707
  const totalChunks = Math.ceil(file.size / chunkSize);
2626
2708
  const filename = options?.filename || file.name || "video";
2627
- const startResult = await this.post("/upload-start", {
2628
- filename,
2629
- content_type: file.type || "video/mp4",
2630
- size_bytes: file.size,
2631
- title: options?.title,
2632
- description: options?.description,
2633
- metadata: options?.metadata
2634
- }, requestOptions);
2709
+ const startResult = await this.post(
2710
+ "/upload-start",
2711
+ {
2712
+ filename,
2713
+ content_type: file.type || "video/mp4",
2714
+ size_bytes: file.size,
2715
+ title: options?.title,
2716
+ description: options?.description,
2717
+ metadata: options?.metadata
2718
+ },
2719
+ requestOptions
2720
+ );
2635
2721
  if (startResult.error) return { data: null, error: startResult.error };
2636
2722
  const { video_id, upload_id } = startResult.data;
2637
2723
  const parts = [];
@@ -2643,13 +2729,7 @@ var VideoService = class extends ServiceModule {
2643
2729
  const end = Math.min(start + chunkSize, file.size);
2644
2730
  const chunk = file.slice(start, end);
2645
2731
  const partNumber = i + 1;
2646
- const partResult = await this.uploadPart(
2647
- video_id,
2648
- upload_id,
2649
- partNumber,
2650
- chunk,
2651
- options?.signal
2652
- );
2732
+ const partResult = await this.uploadPart(video_id, upload_id, partNumber, chunk, options?.signal);
2653
2733
  if (partResult.error) return { data: null, error: partResult.error };
2654
2734
  parts.push({
2655
2735
  part_number: partNumber,
@@ -2660,10 +2740,14 @@ var VideoService = class extends ServiceModule {
2660
2740
  options.onProgress(progress);
2661
2741
  }
2662
2742
  }
2663
- const completeResult = await this.post(`/${video_id}/upload-complete`, {
2664
- upload_id,
2665
- parts
2666
- }, requestOptions);
2743
+ const completeResult = await this.post(
2744
+ `/${video_id}/upload-complete`,
2745
+ {
2746
+ upload_id,
2747
+ parts
2748
+ },
2749
+ requestOptions
2750
+ );
2667
2751
  return completeResult;
2668
2752
  }
2669
2753
  // --------------------------------------------------------------------------
@@ -2692,7 +2776,10 @@ var VideoService = class extends ServiceModule {
2692
2776
  }
2693
2777
  /** Get video analytics (views, watch time, etc.). */
2694
2778
  async getAnalytics(videoId, options) {
2695
- return super._get(`/${videoId}/analytics`, options);
2779
+ return super._get(
2780
+ `/${videoId}/analytics`,
2781
+ options
2782
+ );
2696
2783
  }
2697
2784
  /**
2698
2785
  * Update a video's access mode (public/private).
@@ -2892,7 +2979,10 @@ var ChatService = class extends ServiceModule {
2892
2979
  return this.post(`/conversations/${conversationId}/messages`, data, options);
2893
2980
  }
2894
2981
  async getMessages(conversationId, options, requestOptions) {
2895
- return this._get(this.withQuery(`/conversations/${conversationId}/messages`, options), requestOptions);
2982
+ return this._get(
2983
+ this.withQuery(`/conversations/${conversationId}/messages`, options),
2984
+ requestOptions
2985
+ );
2896
2986
  }
2897
2987
  async editMessage(messageId, data, options) {
2898
2988
  return this.patch(`/messages/${messageId}`, data, options);
@@ -3129,7 +3219,10 @@ var BillingService = class extends ServiceModule {
3129
3219
  return this._list("/transactions", params, options);
3130
3220
  }
3131
3221
  async getTransactionSummary(params, options) {
3132
- return this._get(this.withQuery("/transactions/summary", params), options);
3222
+ return this._get(
3223
+ this.withQuery("/transactions/summary", params),
3224
+ options
3225
+ );
3133
3226
  }
3134
3227
  // --------------------------------------------------------------------------
3135
3228
  // Setup Sessions
@@ -3156,7 +3249,11 @@ var BillingService = class extends ServiceModule {
3156
3249
  return this.post(`/connected-subscriptions/${id}/cancel`, data, options);
3157
3250
  }
3158
3251
  async listConnectedSubscriptions(params, options) {
3159
- return this._list("/connected-subscriptions", params, options);
3252
+ return this._list(
3253
+ "/connected-subscriptions",
3254
+ params,
3255
+ options
3256
+ );
3160
3257
  }
3161
3258
  async createConnectedSetupIntent(data, options) {
3162
3259
  return this.post("/connected-setup-intents", data, options);
@@ -3202,7 +3299,11 @@ var AnalyticsService = class extends ServiceModule {
3202
3299
  // Identity
3203
3300
  // --------------------------------------------------------------------------
3204
3301
  async identify(userId, traits, anonymousId, options) {
3205
- return this.post("/identify", { user_id: userId, traits, anonymous_id: anonymousId }, options);
3302
+ return this.post(
3303
+ "/identify",
3304
+ { user_id: userId, traits, anonymous_id: anonymousId },
3305
+ options
3306
+ );
3206
3307
  }
3207
3308
  async alias(userId, anonymousId, options) {
3208
3309
  return this.post("/alias", { user_id: userId, anonymous_id: anonymousId }, options);
@@ -3392,22 +3493,30 @@ var PermissionsService = class extends ServiceModule {
3392
3493
  /** Check a single permission. Supports identity_type for unified model. */
3393
3494
  async check(identityId, permission, options) {
3394
3495
  const { identityType, resourceType, resourceId, ...reqOptions } = options || {};
3395
- return this.post("/check", {
3396
- identity_id: identityId,
3397
- identity_type: identityType || "user",
3398
- permission,
3399
- resource_type: resourceType,
3400
- resource_id: resourceId
3401
- }, reqOptions);
3496
+ return this.post(
3497
+ "/check",
3498
+ {
3499
+ identity_id: identityId,
3500
+ identity_type: identityType || "user",
3501
+ permission,
3502
+ resource_type: resourceType,
3503
+ resource_id: resourceId
3504
+ },
3505
+ reqOptions
3506
+ );
3402
3507
  }
3403
3508
  /** Batch check multiple permissions for an identity. */
3404
3509
  async batchCheck(identityId, permissions, options) {
3405
3510
  const { identityType, ...reqOptions } = options || {};
3406
- return this.post("/batch-check", {
3407
- identity_id: identityId,
3408
- identity_type: identityType || "user",
3409
- permissions
3410
- }, reqOptions);
3511
+ return this.post(
3512
+ "/batch-check",
3513
+ {
3514
+ identity_id: identityId,
3515
+ identity_type: identityType || "user",
3516
+ permissions
3517
+ },
3518
+ reqOptions
3519
+ );
3411
3520
  }
3412
3521
  /** Fetch the full permission matrix for an identity (single request, no N+1). */
3413
3522
  async getMatrix(identityId, identityType = "user", options) {
@@ -3851,7 +3960,7 @@ var PhotoService = class extends ServiceModule {
3851
3960
  * // Profile avatar at 48px -> snaps to 150px
3852
3961
  * const url = sm.photo.getOptimalUrl(photoId, 48)
3853
3962
  * ```
3854
- */
3963
+ */
3855
3964
  getOptimalUrl(photoId, displayWidth, options) {
3856
3965
  const requestedDpr = options?.dpr ?? 1;
3857
3966
  const dpr = Number.isFinite(requestedDpr) && requestedDpr > 0 ? requestedDpr : 1;
@@ -3880,7 +3989,9 @@ var PhotoService = class extends ServiceModule {
3880
3989
  * ```
3881
3990
  */
3882
3991
  getSrcSet(photoId) {
3883
- return PHOTO_BREAKPOINTS.map((size) => `${this.getTransformUrl(photoId, { width: size, height: size, fit: "cover" })} ${size}w`).join(", ");
3992
+ return PHOTO_BREAKPOINTS.map(
3993
+ (size) => `${this.getTransformUrl(photoId, { width: size, height: size, fit: "cover" })} ${size}w`
3994
+ ).join(", ");
3884
3995
  }
3885
3996
  /**
3886
3997
  * Register a photo from an already-uploaded storage file.
@@ -3892,10 +4003,14 @@ var PhotoService = class extends ServiceModule {
3892
4003
  * Returns the photo record with `id` that can be used with `getTransformUrl()`.
3893
4004
  */
3894
4005
  async register(registerOptions, requestOptions) {
3895
- return this.post("/register", {
3896
- file_id: registerOptions.fileId,
3897
- sm_user_id: registerOptions.userId
3898
- }, requestOptions);
4006
+ return this.post(
4007
+ "/register",
4008
+ {
4009
+ file_id: registerOptions.fileId,
4010
+ sm_user_id: registerOptions.userId
4011
+ },
4012
+ requestOptions
4013
+ );
3899
4014
  }
3900
4015
  /** @deprecated Use upload() instead */
3901
4016
  async uploadPhoto(file, options) {
@@ -4163,6 +4278,442 @@ var FlagContentService = class extends ServiceModule {
4163
4278
  }
4164
4279
  };
4165
4280
 
4281
+ // src/services/agent-auth.ts
4282
+ var AgentAuthService = class extends ServiceModule {
4283
+ constructor() {
4284
+ super(...arguments);
4285
+ this.basePath = "/v1/auth";
4286
+ }
4287
+ async registerAgent(data, options) {
4288
+ return this.post("/register/agent", data, options);
4289
+ }
4290
+ async listTokens(options) {
4291
+ return this._get("/agent-tokens", options);
4292
+ }
4293
+ async createToken(data, options) {
4294
+ return this.post("/agent-tokens", data, options);
4295
+ }
4296
+ async revokeToken(id, options) {
4297
+ return this.del(`/agent-tokens/${id}`, options);
4298
+ }
4299
+ async rotateToken(id, options) {
4300
+ return this.post(`/agent-tokens/${id}/rotate`, void 0, options);
4301
+ }
4302
+ async exchangeToken(data, options) {
4303
+ return this.post("/agent-tokens/exchange", data, options);
4304
+ }
4305
+ async listSigningKeys(options) {
4306
+ return this._get("/agent-signing-keys", options);
4307
+ }
4308
+ async addSigningKey(data, options) {
4309
+ return this.post("/agent-signing-keys", data, options);
4310
+ }
4311
+ async revokeSigningKey(id, options) {
4312
+ return this.del(`/agent-signing-keys/${id}`, options);
4313
+ }
4314
+ async getProfile(options) {
4315
+ return this._get("/agent-profile", options);
4316
+ }
4317
+ async updateProfile(data, options) {
4318
+ return this.patch("/agent-profile", data, options);
4319
+ }
4320
+ async getSecurityPolicy(appId, options) {
4321
+ return this._get(`/applications/${appId}/agent-security`, options);
4322
+ }
4323
+ async updateSecurityPolicy(appId, data, options) {
4324
+ return this.put(`/applications/${appId}/agent-security`, data, options);
4325
+ }
4326
+ };
4327
+
4328
+ // src/services/agents.ts
4329
+ var AgentsService = class extends ServiceModule {
4330
+ constructor() {
4331
+ super(...arguments);
4332
+ this.basePath = "/v1/agents";
4333
+ }
4334
+ // Orchestrated registration
4335
+ async registerAgent(data, options) {
4336
+ return this.post("/register-agent", data, options);
4337
+ }
4338
+ async deactivateAgent(id, options) {
4339
+ return this.post(`/agents/${id}/deactivate`, void 0, options);
4340
+ }
4341
+ // Agent CRUD
4342
+ async create(data, options) {
4343
+ return this.post("/agents", data, options);
4344
+ }
4345
+ async list(params, options) {
4346
+ return this._list("/agents", params, options);
4347
+ }
4348
+ async get(id, options) {
4349
+ return this._get(`/agents/${id}`, options);
4350
+ }
4351
+ async update(id, data, options) {
4352
+ return this.patch(`/agents/${id}`, data, options);
4353
+ }
4354
+ async remove(id, options) {
4355
+ return this.del(`/agents/${id}`, options);
4356
+ }
4357
+ async setDefaultWorkspace(id, data, options) {
4358
+ return this.post(`/agents/${id}/set-default-workspace`, data, options);
4359
+ }
4360
+ // Runtime Templates
4361
+ async createTemplate(data, options) {
4362
+ return this.post("/runtime-templates", data, options);
4363
+ }
4364
+ async listTemplates(params, options) {
4365
+ return this._list("/runtime-templates", params, options);
4366
+ }
4367
+ async getTemplate(id, options) {
4368
+ return this._get(
4369
+ `/runtime-templates/${id}`,
4370
+ options
4371
+ );
4372
+ }
4373
+ async createTemplateVersion(id, data, options) {
4374
+ return this.post(`/runtime-templates/${id}/versions`, data, options);
4375
+ }
4376
+ async listTemplateVersions(id, options) {
4377
+ return this._get(`/runtime-templates/${id}/versions`, options);
4378
+ }
4379
+ // Workspaces
4380
+ async createWorkspace(data, options) {
4381
+ return this.post("/workspaces", data, options);
4382
+ }
4383
+ async listWorkspaces(params, options) {
4384
+ return this._list("/workspaces", params, options);
4385
+ }
4386
+ async getWorkspace(id, options) {
4387
+ return this._get(`/workspaces/${id}`, options);
4388
+ }
4389
+ async updateWorkspace(id, data, options) {
4390
+ return this.patch(`/workspaces/${id}`, data, options);
4391
+ }
4392
+ async addOsAccount(workspaceId, data, options) {
4393
+ return this.post(`/workspaces/${workspaceId}/os-accounts`, data, options);
4394
+ }
4395
+ };
4396
+
4397
+ // src/services/agent-projects.ts
4398
+ var AgentProjectsService = class extends ServiceModule {
4399
+ constructor() {
4400
+ super(...arguments);
4401
+ this.basePath = "/v1/agent-projects";
4402
+ }
4403
+ withAppId(path, applicationId) {
4404
+ return applicationId ? this.withQuery(path, { application_id: applicationId }) : path;
4405
+ }
4406
+ // Projects
4407
+ async createProject(data, applicationId, options) {
4408
+ return this.post(this.withAppId("/projects", applicationId), data, options);
4409
+ }
4410
+ async listProjects(params, options) {
4411
+ return this._list("/projects", params, options);
4412
+ }
4413
+ async getProject(id, applicationId, options) {
4414
+ return this._get(this.withAppId(`/projects/${id}`, applicationId), options);
4415
+ }
4416
+ async updateProject(id, data, applicationId, options) {
4417
+ return this.patch(this.withAppId(`/projects/${id}`, applicationId), data, options);
4418
+ }
4419
+ // Members (use auth user_id)
4420
+ async addMember(projectId, data, applicationId, options) {
4421
+ return this.post(this.withAppId(`/projects/${projectId}/members`, applicationId), data, options);
4422
+ }
4423
+ async listMembers(projectId, applicationId, options) {
4424
+ const result = await this._get(
4425
+ this.withAppId(`/projects/${projectId}/members`, applicationId),
4426
+ options
4427
+ );
4428
+ return { data: result.data?.members ?? [], error: result.error };
4429
+ }
4430
+ async updateMember(projectId, userId, data, applicationId, options) {
4431
+ return this.patch(
4432
+ this.withAppId(`/projects/${projectId}/members/${userId}`, applicationId),
4433
+ data,
4434
+ options
4435
+ );
4436
+ }
4437
+ async removeMember(projectId, userId, applicationId, options) {
4438
+ return this.del(this.withAppId(`/projects/${projectId}/members/${userId}`, applicationId), options);
4439
+ }
4440
+ // Tasks
4441
+ async createTask(projectId, data, applicationId, options) {
4442
+ return this.post(this.withAppId(`/projects/${projectId}/tasks`, applicationId), data, options);
4443
+ }
4444
+ async listTasks(projectId, params, options) {
4445
+ return this._list(`/projects/${projectId}/tasks`, params, options);
4446
+ }
4447
+ async getTask(id, applicationId, options) {
4448
+ return this._get(this.withAppId(`/tasks/${id}`, applicationId), options);
4449
+ }
4450
+ async updateTask(id, data, applicationId, options) {
4451
+ return this.patch(this.withAppId(`/tasks/${id}`, applicationId), data, options);
4452
+ }
4453
+ // Lifecycle (use registry agent_id)
4454
+ async claimNext(agentId, applicationId, options) {
4455
+ const result = await this.post(
4456
+ this.withAppId("/tasks/next-available", applicationId),
4457
+ { agent_id: agentId },
4458
+ options
4459
+ );
4460
+ if (!result.data || typeof result.data !== "object" || !("task_id" in result.data)) {
4461
+ return { data: null, error: result.error };
4462
+ }
4463
+ return result;
4464
+ }
4465
+ async claim(taskId, agentId, applicationId, options) {
4466
+ return this.post(
4467
+ this.withAppId(`/tasks/${taskId}/claim`, applicationId),
4468
+ { agent_id: agentId },
4469
+ options
4470
+ );
4471
+ }
4472
+ async heartbeat(taskId, agentId, applicationId, options) {
4473
+ return this.post(
4474
+ this.withAppId(`/tasks/${taskId}/heartbeat`, applicationId),
4475
+ { agent_id: agentId },
4476
+ options
4477
+ );
4478
+ }
4479
+ async submit(taskId, data, applicationId, options) {
4480
+ return this.post(this.withAppId(`/tasks/${taskId}/submit`, applicationId), data, options);
4481
+ }
4482
+ async block(taskId, data, applicationId, options) {
4483
+ return this.post(this.withAppId(`/tasks/${taskId}/block`, applicationId), data, options);
4484
+ }
4485
+ // Assignment
4486
+ async assignAgent(taskId, data, applicationId, options) {
4487
+ return this.post(this.withAppId(`/tasks/${taskId}/assign`, applicationId), data, options);
4488
+ }
4489
+ async unassignAgent(taskId, agentId, applicationId, options) {
4490
+ return this.del(this.withAppId(`/tasks/${taskId}/assign/${agentId}`, applicationId), options);
4491
+ }
4492
+ // History
4493
+ async listAttempts(taskId, applicationId, options) {
4494
+ const result = await this._get(
4495
+ this.withAppId(`/tasks/${taskId}/attempts`, applicationId),
4496
+ options
4497
+ );
4498
+ return { data: result.data?.attempts ?? [], error: result.error };
4499
+ }
4500
+ async listTransitions(taskId, applicationId, options) {
4501
+ const result = await this._get(
4502
+ this.withAppId(`/tasks/${taskId}/transitions`, applicationId),
4503
+ options
4504
+ );
4505
+ return { data: result.data?.transitions ?? [], error: result.error };
4506
+ }
4507
+ // Documents
4508
+ async createDocument(projectId, data, applicationId, options) {
4509
+ return this.post(this.withAppId(`/projects/${projectId}/documents`, applicationId), data, options);
4510
+ }
4511
+ async listDocuments(projectId, applicationId, options) {
4512
+ const result = await this._get(
4513
+ this.withAppId(`/projects/${projectId}/documents`, applicationId),
4514
+ options
4515
+ );
4516
+ return { data: result.data?.documents ?? [], error: result.error };
4517
+ }
4518
+ async deleteDocument(documentId, applicationId, options) {
4519
+ return this.del(this.withAppId(`/documents/${documentId}`, applicationId), options);
4520
+ }
4521
+ // Pipelines
4522
+ async createPipeline(projectId, data, applicationId, options) {
4523
+ return this.post(this.withAppId(`/projects/${projectId}/pipelines`, applicationId), data, options);
4524
+ }
4525
+ async listPipelines(projectId, applicationId, options) {
4526
+ const result = await this._get(
4527
+ this.withAppId(`/projects/${projectId}/pipelines`, applicationId),
4528
+ options
4529
+ );
4530
+ return { data: result.data?.pipelines ?? [], error: result.error };
4531
+ }
4532
+ async createPipelineVersion(pipelineId, data, applicationId, options) {
4533
+ return this.post(
4534
+ this.withAppId(`/pipelines/${pipelineId}/versions`, applicationId),
4535
+ data,
4536
+ options
4537
+ );
4538
+ }
4539
+ async listPipelineVersions(pipelineId, applicationId, options) {
4540
+ const result = await this._get(
4541
+ this.withAppId(`/pipelines/${pipelineId}/versions`, applicationId),
4542
+ options
4543
+ );
4544
+ return { data: result.data?.versions ?? [], error: result.error };
4545
+ }
4546
+ };
4547
+
4548
+ // src/services/agent-tools.ts
4549
+ var AgentToolsService = class extends ServiceModule {
4550
+ constructor() {
4551
+ super(...arguments);
4552
+ this.basePath = "/v1/agent-tools";
4553
+ }
4554
+ // Tools
4555
+ async createTool(data, options) {
4556
+ return this.post("/tools", data, options);
4557
+ }
4558
+ async listTools(params, options) {
4559
+ return this._list("/tools", params, options);
4560
+ }
4561
+ async getTool(id, options) {
4562
+ return this._get(`/tools/${id}`, options);
4563
+ }
4564
+ async createCapability(toolId, data, options) {
4565
+ return this.post(`/tools/${toolId}/capabilities`, data, options);
4566
+ }
4567
+ async listCapabilities(toolId, options) {
4568
+ return this._get(`/tools/${toolId}/capabilities`, options);
4569
+ }
4570
+ // Tool Integrations
4571
+ async createIntegration(data, options) {
4572
+ return this.post("/tool-integrations", data, options);
4573
+ }
4574
+ async listIntegrations(params, options) {
4575
+ return this._list("/tool-integrations", params, options);
4576
+ }
4577
+ async updateIntegration(id, data, options) {
4578
+ return this.patch(`/tool-integrations/${id}`, data, options);
4579
+ }
4580
+ // Credentials
4581
+ async createCredential(data, options) {
4582
+ return this.post("/credentials", data, options);
4583
+ }
4584
+ async listCredentials(params, options) {
4585
+ return this._list("/credentials", params, options);
4586
+ }
4587
+ async updateCredential(id, data, options) {
4588
+ return this.patch(`/credentials/${id}`, data, options);
4589
+ }
4590
+ async createScope(credentialId, data, options) {
4591
+ return this.post(`/credentials/${credentialId}/scopes`, data, options);
4592
+ }
4593
+ async listScopes(credentialId, options) {
4594
+ return this._get(`/credentials/${credentialId}/scopes`, options);
4595
+ }
4596
+ // Entitlements
4597
+ async grantEntitlement(data, options) {
4598
+ return this.post("/agent-tool-entitlements", data, options);
4599
+ }
4600
+ async listEntitlements(params, options) {
4601
+ return this._list("/agent-tool-entitlements", params, options);
4602
+ }
4603
+ async revokeEntitlement(id, options) {
4604
+ return this.del(`/agent-tool-entitlements/${id}`, options);
4605
+ }
4606
+ async authorizeAction(data, options) {
4607
+ return this.post("/authorize-action", data, options);
4608
+ }
4609
+ // Data Sources
4610
+ async createDataSource(data, options) {
4611
+ return this.post("/data-sources", data, options);
4612
+ }
4613
+ async listDataSources(params, options) {
4614
+ return this._list("/data-sources", params, options);
4615
+ }
4616
+ // Data Access Policies
4617
+ async createDataAccessPolicy(data, options) {
4618
+ return this.post("/data-access-policies", data, options);
4619
+ }
4620
+ async listDataAccessPolicies(params, options) {
4621
+ return this._list("/data-access-policies", params, options);
4622
+ }
4623
+ };
4624
+
4625
+ // src/services/agent-models.ts
4626
+ var AgentModelsService = class extends ServiceModule {
4627
+ constructor() {
4628
+ super(...arguments);
4629
+ this.basePath = "/v1/agent-models";
4630
+ }
4631
+ // Providers
4632
+ async createProvider(data, options) {
4633
+ return this.post("/model-providers", data, options);
4634
+ }
4635
+ async listProviders(params, options) {
4636
+ return this._list("/model-providers", params, options);
4637
+ }
4638
+ // Models
4639
+ async createModel(data, options) {
4640
+ return this.post("/models", data, options);
4641
+ }
4642
+ async listModels(params, options) {
4643
+ return this._list("/models", params, options);
4644
+ }
4645
+ async getModel(id, options) {
4646
+ return this._get(`/models/${id}`, options);
4647
+ }
4648
+ async createPricing(modelId, data, options) {
4649
+ return this.post(`/models/${modelId}/pricing`, data, options);
4650
+ }
4651
+ async listPricing(modelId, options) {
4652
+ return this._get(`/models/${modelId}/pricing`, options);
4653
+ }
4654
+ // Entitlements
4655
+ async createEntitlement(data, options) {
4656
+ return this.post("/model-entitlements", data, options);
4657
+ }
4658
+ async listEntitlements(params, options) {
4659
+ return this._list("/model-entitlements", params, options);
4660
+ }
4661
+ async deleteEntitlement(id, options) {
4662
+ return this.del(`/model-entitlements/${id}`, options);
4663
+ }
4664
+ // Usage & Reporting
4665
+ async recordUsage(data, options) {
4666
+ return this.post("/usage-records", data, options);
4667
+ }
4668
+ async listUsage(params, options) {
4669
+ return this._list("/usage-records", params, options);
4670
+ }
4671
+ async getUsageSummary(params, options) {
4672
+ return this._get(this.withQuery("/usage-records/summary", params), options);
4673
+ }
4674
+ async getCostReport(params, options) {
4675
+ return this._get(this.withQuery("/cost-report", params), options);
4676
+ }
4677
+ };
4678
+
4679
+ // src/services/agent-sessions.ts
4680
+ var AgentSessionsService = class extends ServiceModule {
4681
+ constructor() {
4682
+ super(...arguments);
4683
+ this.basePath = "/v1/agent-sessions";
4684
+ }
4685
+ // Sessions
4686
+ async createSession(data, options) {
4687
+ return this.post("/sessions", data, options);
4688
+ }
4689
+ async listSessions(params, options) {
4690
+ return this._list("/sessions", params, options);
4691
+ }
4692
+ async getSession(id, options) {
4693
+ return this._get(`/sessions/${id}`, options);
4694
+ }
4695
+ async startSession(id, options) {
4696
+ return this.post(`/sessions/${id}/start`, void 0, options);
4697
+ }
4698
+ async endSession(id, data, options) {
4699
+ return this.post(`/sessions/${id}/end`, data, options);
4700
+ }
4701
+ // Logs
4702
+ async appendLog(sessionId, data, options) {
4703
+ return this.post(`/sessions/${sessionId}/logs`, data, options);
4704
+ }
4705
+ async listLogs(sessionId, options) {
4706
+ return this._get(`/sessions/${sessionId}/logs`, options);
4707
+ }
4708
+ // Artifacts
4709
+ async addArtifact(sessionId, data, options) {
4710
+ return this.post(`/sessions/${sessionId}/artifacts`, data, options);
4711
+ }
4712
+ async listArtifacts(sessionId, options) {
4713
+ return this._get(`/sessions/${sessionId}/artifacts`, options);
4714
+ }
4715
+ };
4716
+
4166
4717
  // src/index.ts
4167
4718
  var ScaleMule = class {
4168
4719
  constructor(config) {
@@ -4197,6 +4748,12 @@ var ScaleMule = class {
4197
4748
  this.flagContent = new FlagContentService(this._client);
4198
4749
  this.compliance = new ComplianceService(this._client);
4199
4750
  this.orchestrator = new OrchestratorService(this._client);
4751
+ this.agentAuth = new AgentAuthService(this._client);
4752
+ this.agents = new AgentsService(this._client);
4753
+ this.agentProjects = new AgentProjectsService(this._client);
4754
+ this.agentTools = new AgentToolsService(this._client);
4755
+ this.agentModels = new AgentModelsService(this._client);
4756
+ this.agentSessions = new AgentSessionsService(this._client);
4200
4757
  }
4201
4758
  /**
4202
4759
  * Initialize the client — loads persisted session from storage.
@@ -4248,6 +4805,12 @@ var ScaleMule = class {
4248
4805
  var index_default = ScaleMule;
4249
4806
  export {
4250
4807
  AccountsService,
4808
+ AgentAuthService,
4809
+ AgentModelsService,
4810
+ AgentProjectsService,
4811
+ AgentSessionsService,
4812
+ AgentToolsService,
4813
+ AgentsService,
4251
4814
  AnalyticsService,
4252
4815
  AuthService,
4253
4816
  BillingService,