@getsupervisor/agents-studio-sdk 1.41.0-patch.2 → 1.41.0-patch.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -51,7 +51,9 @@ __export(index_exports, {
51
51
  createToolsApi: () => createToolsApi,
52
52
  createVoicesApi: () => createVoicesApi,
53
53
  createWebhooksApi: () => createWebhooksApi,
54
- createWorkspacesApi: () => createWorkspacesApi
54
+ createWorkspacesApi: () => createWorkspacesApi,
55
+ isApiErrorBody: () => isApiErrorBody,
56
+ isApiHttpError: () => isApiHttpError
55
57
  });
56
58
  module.exports = __toCommonJS(index_exports);
57
59
 
@@ -66,6 +68,14 @@ var HttpError = class extends Error {
66
68
  this.name = "HttpError";
67
69
  }
68
70
  };
71
+ function isApiErrorBody(body) {
72
+ if (!body || typeof body !== "object") return false;
73
+ const candidate = body;
74
+ return typeof candidate.code === "string" && typeof candidate.message === "string";
75
+ }
76
+ function isApiHttpError(err) {
77
+ return err instanceof HttpError && isApiErrorBody(err.body);
78
+ }
69
79
  var TimeoutError = class extends Error {
70
80
  constructor(ms, url) {
71
81
  super(`Timeout after ${ms}ms`);
@@ -1544,7 +1554,15 @@ function createToolsApi(cfg) {
1544
1554
  });
1545
1555
  return res.json();
1546
1556
  };
1547
- return {
1557
+ const fetchToolConnectionsPage = async (options = {}) => {
1558
+ const query = serializeListOptions(options ?? {});
1559
+ const res = await doFetch(`${base}/tools/connections`, {
1560
+ method: "GET",
1561
+ query
1562
+ });
1563
+ return res.json();
1564
+ };
1565
+ const api = {
1548
1566
  async list(options = {}) {
1549
1567
  const normalizedOptions = { ...options ?? {} };
1550
1568
  const response = await fetchToolsPage(normalizedOptions);
@@ -1558,6 +1576,17 @@ function createToolsApi(cfg) {
1558
1576
  const response = await fetchPage(normalizedOptions);
1559
1577
  return attachPaginator(response, fetchPage, normalizedOptions);
1560
1578
  },
1579
+ async listConnections(options = {}) {
1580
+ const normalizedOptions = {
1581
+ ...options ?? {}
1582
+ };
1583
+ const response = await fetchToolConnectionsPage(normalizedOptions);
1584
+ return attachPaginator(
1585
+ response,
1586
+ fetchToolConnectionsPage,
1587
+ normalizedOptions
1588
+ );
1589
+ },
1561
1590
  async uploadResource(toolId, payload) {
1562
1591
  const formData = toFormData(payload);
1563
1592
  const res = await doFetch(`${base}/tools/${toolId}/resources`, {
@@ -1632,6 +1661,18 @@ function createToolsApi(cfg) {
1632
1661
  return res.json();
1633
1662
  }
1634
1663
  };
1664
+ const connections = {
1665
+ connect: api.connect,
1666
+ create: api.createConnection,
1667
+ execute: api.executeConnection,
1668
+ list: api.listConnections,
1669
+ createConnection: api.createConnection,
1670
+ executeConnection: api.executeConnection
1671
+ };
1672
+ return {
1673
+ ...api,
1674
+ connections
1675
+ };
1635
1676
  }
1636
1677
 
1637
1678
  // src/utils/catalog-voices.ts
@@ -2202,6 +2243,8 @@ function createClient(initialCfg) {
2202
2243
  createToolsApi,
2203
2244
  createVoicesApi,
2204
2245
  createWebhooksApi,
2205
- createWorkspacesApi
2246
+ createWorkspacesApi,
2247
+ isApiErrorBody,
2248
+ isApiHttpError
2206
2249
  });
2207
2250
  //# sourceMappingURL=index.cjs.map