@joai/sdk 0.18.0 → 0.19.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.mjs CHANGED
@@ -37,7 +37,7 @@ var HttpService = class {
37
37
  return response;
38
38
  };
39
39
  this.refreshCsrfToken = async () => {
40
- await this.fetchFn(`${this.baseUrl}/sanctum/csrf-cookie`, {
40
+ await this.fetchFn(`${this.csrfBaseUrl}/sanctum/csrf-cookie`, {
41
41
  method: "GET",
42
42
  credentials: "include",
43
43
  headers: {
@@ -97,6 +97,7 @@ var HttpService = class {
97
97
  this.baseUrl = baseUrl;
98
98
  this.authToken = authToken || null;
99
99
  this.fetchFn = options?.customFetch ?? globalThis.fetch.bind(globalThis);
100
+ this.csrfBaseUrl = options?.csrfBaseUrl ?? baseUrl;
100
101
  this.onNetworkError = () => {};
101
102
  this.onSuccessfulResponse = () => {};
102
103
  this.onUnauthorized = () => {};
@@ -119,9 +120,11 @@ var AgentsResource = class {
119
120
  const url = team ? `agents?team=${team}` : "agents?me=true";
120
121
  return this.http.get(url);
121
122
  }
122
- async get(uuid) {
123
- const res = await this.http.get(`agents/${uuid}`);
124
- return res.ok ? res.data : null;
123
+ get(uuid) {
124
+ return this.http.get(`agents/${uuid}`);
125
+ }
126
+ getPublic(uuid) {
127
+ return this.http.get(`agents/${uuid}`);
125
128
  }
126
129
  create(params) {
127
130
  return this.http.post("agents", params);
@@ -214,6 +217,153 @@ var AlertsResource = class {
214
217
  }
215
218
  };
216
219
  //#endregion
220
+ //#region src/resources/api-tokens.ts
221
+ var ApiTokensResource = class {
222
+ constructor(http) {
223
+ this.http = http;
224
+ }
225
+ list() {
226
+ return this.http.get("api-tokens");
227
+ }
228
+ create(name, teams) {
229
+ return this.http.post("api-tokens", {
230
+ name,
231
+ teams
232
+ });
233
+ }
234
+ update(id, teams) {
235
+ return this.http.put(`api-tokens/${id}`, { teams });
236
+ }
237
+ delete(id) {
238
+ return this.http.delete(`api-tokens/${id}`);
239
+ }
240
+ };
241
+ //#endregion
242
+ //#region src/resources/characters.ts
243
+ var CharactersResource = class {
244
+ constructor(http) {
245
+ this.http = http;
246
+ }
247
+ getByAgent(agent) {
248
+ return this.http.get(`agents/${agent}/character`);
249
+ }
250
+ create(agent, name, system, bio) {
251
+ return this.http.post("agents/characters", {
252
+ agent,
253
+ name,
254
+ system,
255
+ bio
256
+ });
257
+ }
258
+ update(id, name, system, bio) {
259
+ return this.http.put(`agents/characters/${id}`, {
260
+ name,
261
+ system,
262
+ bio
263
+ });
264
+ }
265
+ };
266
+ //#endregion
267
+ //#region src/resources/desk.ts
268
+ var DeskResource = class {
269
+ constructor(http) {
270
+ this.http = http;
271
+ }
272
+ upload(agentUuid, roomId, files) {
273
+ const formData = new FormData();
274
+ formData.append("room", roomId);
275
+ files.forEach((file) => formData.append("files[]", file, file.name));
276
+ return this.http.post(`agents/${agentUuid}/desk/upload`, formData, { isJson: false });
277
+ }
278
+ };
279
+ //#endregion
280
+ //#region src/resources/elements.ts
281
+ var ElementsResource = class {
282
+ constructor(http) {
283
+ this.http = http;
284
+ }
285
+ generateSpec(team, payload) {
286
+ return this.http.post(`teams/${team}/elements/generate-spec`, payload);
287
+ }
288
+ list(team) {
289
+ return this.http.get(`teams/${team}/elements`);
290
+ }
291
+ get(team, elementId) {
292
+ return this.http.get(`teams/${team}/elements/${elementId}`);
293
+ }
294
+ create(team, payload) {
295
+ return this.http.post(`teams/${team}/elements`, payload);
296
+ }
297
+ update(team, elementId, payload) {
298
+ return this.http.put(`teams/${team}/elements/${elementId}`, payload);
299
+ }
300
+ delete(team, elementId) {
301
+ return this.http.delete(`teams/${team}/elements/${elementId}`);
302
+ }
303
+ generateVariation(team, elementId, payload) {
304
+ return this.http.post(`teams/${team}/elements/${elementId}/generate-variation`, payload ?? {});
305
+ }
306
+ updateVariation(team, elementId, variationId, payload) {
307
+ return this.http.put(`teams/${team}/elements/${elementId}/variations/${variationId}`, payload);
308
+ }
309
+ deleteVariation(team, elementId, variationId) {
310
+ return this.http.delete(`teams/${team}/elements/${elementId}/variations/${variationId}`);
311
+ }
312
+ regenerateVariation(team, elementId, variationId) {
313
+ return this.http.post(`teams/${team}/elements/${elementId}/variations/${variationId}/regenerate`, {});
314
+ }
315
+ reorderVariations(team, elementId, orderedIds) {
316
+ return this.http.put(`teams/${team}/elements/${elementId}/variations/reorder`, { orderedIds });
317
+ }
318
+ setVariationPrimaryImage(team, elementId, variationId, mediaId) {
319
+ return this.http.put(`teams/${team}/elements/${elementId}/variations/${variationId}/primary/${mediaId}`, {});
320
+ }
321
+ };
322
+ //#endregion
323
+ //#region src/resources/entities.ts
324
+ var EntitiesResource = class {
325
+ constructor(http) {
326
+ this.http = http;
327
+ }
328
+ get(entityId, withParams) {
329
+ const queries = withParams && withParams.length > 0 ? `with=${withParams.join(",")}` : "";
330
+ return this.http.get(`entities/${entityId}?${queries}`);
331
+ }
332
+ listProposals(entityId, page = 1) {
333
+ return this.http.get(`proposals?entity=${entityId}&page=${page}`);
334
+ }
335
+ getProposal(proposalId, withParams) {
336
+ const queries = withParams && withParams.length > 0 ? `with=${withParams.join(",")}` : "";
337
+ return this.http.get(`proposals/${proposalId}?${queries}`);
338
+ }
339
+ };
340
+ //#endregion
341
+ //#region src/resources/mcp.ts
342
+ var McpResource = class {
343
+ constructor(http) {
344
+ this.http = http;
345
+ }
346
+ listToolCalls(agent, page = 1, integration) {
347
+ return this.http.get(`mcp/tool-calls?agent=${agent}&page=${page}${integration ? `&integration=${integration}` : ""}`);
348
+ }
349
+ };
350
+ //#endregion
351
+ //#region src/resources/secrets/index.ts
352
+ var SecretsResource = class {
353
+ constructor(http) {
354
+ this.http = http;
355
+ }
356
+ getStatus(agent, keys) {
357
+ return this.http.get(`agents/${agent}/secrets/status?keys=${keys.join(",")}`);
358
+ }
359
+ set(agent, key, value) {
360
+ return this.http.put(`agents/${agent}/secrets/${key}`, { value });
361
+ }
362
+ clear(agent, key) {
363
+ return this.http.delete(`agents/${agent}/secrets/${key}`);
364
+ }
365
+ };
366
+ //#endregion
217
367
  //#region src/resources/appointments.ts
218
368
  const WEEKDAYS = [
219
369
  "monday",
@@ -342,7 +492,7 @@ var AuthResource = class {
342
492
  });
343
493
  }
344
494
  loginWithSocialAccessToken(provider, accessToken) {
345
- return this.http.get(`auth/social/${provider}/callback?access_token=${accessToken}`);
495
+ return this.http.post(`auth/social/${provider}/login`, { accessToken });
346
496
  }
347
497
  verify(token) {
348
498
  return this.http.get("auth/verify?token=" + token);
@@ -393,7 +543,7 @@ var BillingResource = class {
393
543
  return this.http.get(`billing/products/${id}`);
394
544
  }
395
545
  orders(team, page = 1, contactId) {
396
- let params = team ? `billing/orders?team=${team.slug}&page=${page}` : `billing/orders?page=${page}`;
546
+ let params = `billing/orders?page=${page}`;
397
547
  if (contactId) params += `&contactId=${encodeURIComponent(contactId)}`;
398
548
  return this.http.get(params);
399
549
  }
@@ -424,6 +574,12 @@ var BillingResource = class {
424
574
  cancelTerminalPaymentIntent(orderId, provider, paymentIntentId) {
425
575
  return this.http.post(`orders/${orderId}/terminal/${provider}/cancel`, { paymentIntentId });
426
576
  }
577
+ cancelSubscription(teamSlug) {
578
+ return this.http.post("billing/plans/cancel", { team: teamSlug });
579
+ }
580
+ resumeSubscription(teamSlug) {
581
+ return this.http.post("billing/plans/resume", { team: teamSlug });
582
+ }
427
583
  verifyIap(receipt, team, meta) {
428
584
  if (receipt.platform === "ios") return this.http.post("billing/gateways/apple/validate-receipt", {
429
585
  receipt_data: receipt.receipt,
@@ -448,11 +604,16 @@ var BlueprintsResource = class {
448
604
  const query = new URLSearchParams();
449
605
  if (params?.page !== void 0) query.set("page", String(params.page));
450
606
  if (params?.size !== void 0) query.set("size", String(params.size));
607
+ if (params?.locale) query.set("locale", params.locale);
608
+ if (params?.team) query.set("team", params.team);
609
+ if (params?.verified) query.set("verified", "true");
451
610
  const qs = query.toString();
452
611
  return this.http.get(qs ? `blueprints?${qs}` : "blueprints");
453
612
  }
454
- get(slug, locale = "en") {
455
- return this.http.get(`blueprints/${slug}?locale=${locale}`);
613
+ get(slug, locale = "en", team) {
614
+ let path = `blueprints/${slug}?locale=${locale}`;
615
+ if (team) path += `&team=${team}`;
616
+ return this.http.get(path);
456
617
  }
457
618
  create(data) {
458
619
  return this.http.post("blueprints", data);
@@ -638,6 +799,25 @@ var ContractsResource = class {
638
799
  listVersions(uuid) {
639
800
  return this.http.get(`contracts/${uuid}/versions`);
640
801
  }
802
+ uploadAbi(uuid, file) {
803
+ const fd = new FormData();
804
+ fd.append("abi", file);
805
+ return this.http.post(`contracts/${uuid}/abi`, fd, { isJson: false });
806
+ }
807
+ uploadCode(uuid, versionId, file) {
808
+ const fd = new FormData();
809
+ fd.append("wasm", file);
810
+ return this.http.post(`contracts/${uuid}/versions/${versionId}/code`, fd, { isJson: false });
811
+ }
812
+ getCode(uuid, versionId) {
813
+ return this.http.get(`contracts/${uuid}/versions/${versionId}/code`);
814
+ }
815
+ prepareVerification(uuid, data) {
816
+ return this.http.post(`contracts/${uuid}/verify/prepare`, data);
817
+ }
818
+ submitVerification(uuid, data) {
819
+ return this.http.post(`contracts/${uuid}/verify`, data);
820
+ }
641
821
  };
642
822
  //#endregion
643
823
  //#region src/resources/documents.ts
@@ -668,6 +848,13 @@ var DocumentsResource = class {
668
848
  url
669
849
  });
670
850
  }
851
+ uploadFile(agentUuid, name, document) {
852
+ return this.http.post("documents", {
853
+ agent: agentUuid,
854
+ name,
855
+ document
856
+ });
857
+ }
671
858
  };
672
859
  //#endregion
673
860
  //#region src/resources/flows.ts
@@ -679,12 +866,23 @@ var FlowsResource = class {
679
866
  const query = new URLSearchParams();
680
867
  if (params?.locale) query.set("locale", params.locale);
681
868
  if (params?.page !== void 0) query.set("page", String(params.page));
869
+ if (params?.team) query.set("team", params.team);
870
+ if (params?.all) query.set("all", "true");
682
871
  const qs = query.toString();
683
872
  return this.http.get(qs ? `flows?${qs}` : "flows");
684
873
  }
685
874
  get(slug, locale = "en") {
686
875
  return this.http.get(`flows/${slug}?locale=${locale}`);
687
876
  }
877
+ create(data) {
878
+ return this.http.post("flows", data);
879
+ }
880
+ update(slug, data) {
881
+ return this.http.put(`flows/${slug}`, data);
882
+ }
883
+ delete(slug) {
884
+ return this.http.delete(`flows/${slug}`);
885
+ }
688
886
  };
689
887
  //#endregion
690
888
  //#region src/resources/goals.ts
@@ -728,11 +926,24 @@ var IngestionsResource = class {
728
926
  const query = new URLSearchParams({ public: "true" });
729
927
  if (params?.page !== void 0) query.set("page", String(params.page));
730
928
  if (params?.size !== void 0) query.set("size", String(params.size));
929
+ if (params?.agent) query.set("agent", params.agent);
731
930
  return this.http.get(`ingestions?${query}`);
732
931
  }
932
+ get(id) {
933
+ return this.http.get(`ingestions/${id}`);
934
+ }
733
935
  getShared(shareToken) {
734
936
  return this.http.get(`ingestions/${shareToken}`);
735
937
  }
938
+ delete(id) {
939
+ return this.http.delete(`ingestions/${id}`);
940
+ }
941
+ publish(id) {
942
+ return this.http.post(`ingestions/${id}/publish`, {});
943
+ }
944
+ unpublish(id) {
945
+ return this.http.post(`ingestions/${id}/unpublish`, {});
946
+ }
736
947
  };
737
948
  //#endregion
738
949
  //#region src/resources/inquiries.ts
@@ -796,6 +1007,30 @@ var IntegrationsResource = class {
796
1007
  setupEmbed(agentUuid, allowedDomains) {
797
1008
  return this.http.post("integrations/embed/" + agentUuid + "/setup", { allowedDomains });
798
1009
  }
1010
+ connectDeviceCalendar(agent, timezone) {
1011
+ return this.http.post("integrations/calendar/" + agent + "/connect/apple", { timezone });
1012
+ }
1013
+ pushCalendarEvents(agent, payload) {
1014
+ return this.http.post("integrations/calendar/" + agent + "/push-events", payload);
1015
+ }
1016
+ confirmDevicePush(agent, eventIds) {
1017
+ return this.http.post("integrations/calendar/" + agent + "/confirm-push", { eventIds });
1018
+ }
1019
+ updateEmailHandle(agent, handle) {
1020
+ return this.http.put("agents/" + agent + "/email", { handle });
1021
+ }
1022
+ generateEmailHandle(agent) {
1023
+ return this.http.post("agents/" + agent + "/email/generate");
1024
+ }
1025
+ getSecretStatus(agent, keys) {
1026
+ return this.http.get("agents/" + agent + "/secrets/status?keys=" + keys.join(","));
1027
+ }
1028
+ setSecret(agent, key, value) {
1029
+ return this.http.put("agents/" + agent + "/secrets/" + key, { value });
1030
+ }
1031
+ clearSecret(agent, key) {
1032
+ return this.http.delete("agents/" + agent + "/secrets/" + key);
1033
+ }
799
1034
  };
800
1035
  //#endregion
801
1036
  //#region src/resources/intents.ts
@@ -957,13 +1192,13 @@ var LoyaltyResource = class {
957
1192
  }
958
1193
  };
959
1194
  //#endregion
960
- //#region src/resources/marketplace.ts
961
- var MarketplaceResource = class {
1195
+ //#region src/resources/store.ts
1196
+ var StoreResource = class {
962
1197
  constructor(http) {
963
1198
  this.http = http;
964
1199
  }
965
1200
  async get(locale = "en") {
966
- const res = await this.http.get(`marketplace?locale=${locale}`);
1201
+ const res = await this.http.get(`store?locale=${locale}`);
967
1202
  if (!res.ok || !res.data) return {
968
1203
  blueprints: [],
969
1204
  skills: [],
@@ -999,6 +1234,25 @@ var MarketplaceResource = class {
999
1234
  ]
1000
1235
  };
1001
1236
  }
1237
+ earnings(teamSlug, page = 1) {
1238
+ return this.http.get(`earnings?team=${teamSlug}&page=${page}`);
1239
+ }
1240
+ earningsBalance(teamSlug) {
1241
+ return this.http.get(`earnings/balance?team=${teamSlug}`);
1242
+ }
1243
+ commissions(teamSlug) {
1244
+ return this.http.get(`billing/commissions?team=${encodeURIComponent(teamSlug)}`);
1245
+ }
1246
+ priceTiers() {
1247
+ return this.http.get("marketplace/price-tiers");
1248
+ }
1249
+ purchase(entityType, entityId, paymentMethod = "balance") {
1250
+ return this.http.post("marketplace/purchase", {
1251
+ entityType,
1252
+ entityId,
1253
+ paymentMethod
1254
+ });
1255
+ }
1002
1256
  };
1003
1257
  //#endregion
1004
1258
  //#region src/resources/media.ts
@@ -1114,7 +1368,7 @@ var MessagesResource = class {
1114
1368
  return this.http.get(`messages?team=${team}&room=${room}&page=${page}&perPage=${perPage}`);
1115
1369
  }
1116
1370
  search(team, search) {
1117
- return this.http.get(`messages/search?team=${team}&search=${encodeURIComponent(search)}`);
1371
+ return this.http.get(`messages/search?search=${encodeURIComponent(search)}`);
1118
1372
  }
1119
1373
  delete(messageId) {
1120
1374
  return this.http.delete(`messages/${messageId}`);
@@ -1127,6 +1381,14 @@ var MessagesResource = class {
1127
1381
  generateAudio(messageId) {
1128
1382
  return this.http.post(`messages/${messageId}/audio`, {});
1129
1383
  }
1384
+ storeFeedback(agent, message, positive, inquiry) {
1385
+ return this.http.post("feedback", {
1386
+ agent,
1387
+ message,
1388
+ positive,
1389
+ inquiry: inquiry?.id || null
1390
+ });
1391
+ }
1130
1392
  };
1131
1393
  //#endregion
1132
1394
  //#region src/resources/missions.ts
@@ -1242,20 +1504,42 @@ var ProductsResource = class {
1242
1504
  this.http = http;
1243
1505
  }
1244
1506
  list(team) {
1245
- const url = team ? `products?team=${encodeURIComponent(team)}` : "products";
1507
+ const url = team ? `billing/products?team=${team}` : "billing/products";
1246
1508
  return this.http.get(url);
1247
1509
  }
1248
1510
  get(id) {
1249
- return this.http.get(`products/${id}`);
1511
+ return this.http.get(`billing/products/${id}`);
1250
1512
  }
1251
- create(data) {
1252
- return this.http.post("products", data);
1513
+ create(data, teamSlug) {
1514
+ const url = teamSlug ? `billing/products?team=${teamSlug}` : "billing/products";
1515
+ return this.http.post(url, data);
1253
1516
  }
1254
1517
  update(id, data) {
1255
- return this.http.put(`products/${id}`, data);
1518
+ return this.http.put(`billing/products/${id}`, data);
1256
1519
  }
1257
1520
  delete(id) {
1258
- return this.http.delete(`products/${id}`);
1521
+ return this.http.delete(`billing/products/${id}`);
1522
+ }
1523
+ createVariation(productSlug, data) {
1524
+ return this.http.post(`billing/products/${productSlug}/variations`, data);
1525
+ }
1526
+ updateVariation(variationId, data) {
1527
+ return this.http.put(`billing/products/variations/${variationId}`, data);
1528
+ }
1529
+ sortVariations(ids) {
1530
+ return this.http.post("billing/products/variations/sort", { ids });
1531
+ }
1532
+ deleteVariation(variationId) {
1533
+ return this.http.delete(`billing/products/variations/${variationId}`);
1534
+ }
1535
+ createRelation(productSlug, data) {
1536
+ return this.http.post(`billing/products/${productSlug}/relations`, data);
1537
+ }
1538
+ deleteRelation(productSlug, relatedProductId) {
1539
+ return this.http.delete(`billing/products/${productSlug}/relations?relatedProductId=${relatedProductId}`);
1540
+ }
1541
+ updateVolumePrices(productSlug, data) {
1542
+ return this.http.put(`billing/products/${productSlug}/volume-prices`, { prices: data });
1259
1543
  }
1260
1544
  };
1261
1545
  //#endregion
@@ -1320,8 +1604,30 @@ var RoomsResource = class {
1320
1604
  constructor(http) {
1321
1605
  this.http = http;
1322
1606
  }
1323
- list() {
1324
- return this.http.get("rooms");
1607
+ list(options) {
1608
+ const params = new URLSearchParams();
1609
+ if (options) {
1610
+ for (const [key, value] of Object.entries(options)) if (value !== void 0) params.set(key, String(value));
1611
+ }
1612
+ const qs = params.toString();
1613
+ return this.http.get(`rooms${qs ? "?" + qs : ""}`);
1614
+ }
1615
+ create(agent, name, description, isPublic, kind, archivedAt, meta) {
1616
+ return this.http.post("rooms", {
1617
+ agent,
1618
+ name,
1619
+ description,
1620
+ public: isPublic,
1621
+ kind,
1622
+ archivedAt,
1623
+ meta
1624
+ });
1625
+ }
1626
+ update(id, data) {
1627
+ return this.http.put(`rooms/${id}`, data);
1628
+ }
1629
+ delete(id) {
1630
+ return this.http.delete(`rooms/${id}`);
1325
1631
  }
1326
1632
  messages(roomId, params) {
1327
1633
  const query = new URLSearchParams();
@@ -1337,8 +1643,7 @@ var ServicesResource = class {
1337
1643
  this.http = http;
1338
1644
  }
1339
1645
  list(team) {
1340
- const url = team ? `services?team=${encodeURIComponent(team)}` : "services";
1341
- return this.http.get(url);
1646
+ return this.http.get("services");
1342
1647
  }
1343
1648
  get(slug) {
1344
1649
  return this.http.get(`services/${slug}`);
@@ -1394,6 +1699,9 @@ var SitesResource = class {
1394
1699
  constructor(http) {
1395
1700
  this.http = http;
1396
1701
  }
1702
+ brands() {
1703
+ return this.http.get("sites/brands");
1704
+ }
1397
1705
  listMine(teamSlug) {
1398
1706
  return this.http.get(`sites/mine?team=${encodeURIComponent(teamSlug)}`);
1399
1707
  }
@@ -1404,8 +1712,8 @@ var SitesResource = class {
1404
1712
  resolveByDomain(domain) {
1405
1713
  return this.http.get(`sites/resolve?domain=${encodeURIComponent(domain)}`);
1406
1714
  }
1407
- update(siteSlug, data) {
1408
- return this.http.put(`sites/${encodeURIComponent(siteSlug)}`, data);
1715
+ update(siteId, data) {
1716
+ return this.http.put(`sites/${siteId}`, data);
1409
1717
  }
1410
1718
  };
1411
1719
  //#endregion
@@ -1456,8 +1764,8 @@ var StatsResource = class {
1456
1764
  }
1457
1765
  };
1458
1766
  //#endregion
1459
- //#region src/resources/stores.ts
1460
- var StoresResource = class {
1767
+ //#region src/resources/kv.ts
1768
+ var KvResource = class {
1461
1769
  constructor(http) {
1462
1770
  this.http = http;
1463
1771
  }
@@ -1474,19 +1782,19 @@ var StoresResource = class {
1474
1782
  if (params?.until) query.set("until", params.until);
1475
1783
  if (params?.last != null) query.set("last", String(params.last));
1476
1784
  const qs = query.toString();
1477
- return this.http.get(`stores/entries${qs ? "?" + qs : ""}`);
1785
+ return this.http.get(`kv/entries${qs ? "?" + qs : ""}`);
1478
1786
  }
1479
1787
  setEntry(payload) {
1480
- return this.http.post("stores/entries", payload);
1788
+ return this.http.post("kv/entries", payload);
1481
1789
  }
1482
1790
  appendEntry(payload) {
1483
- return this.http.post("stores/entries/append", payload);
1791
+ return this.http.post("kv/entries/append", payload);
1484
1792
  }
1485
1793
  toggle(storeName) {
1486
- return this.http.post("stores/toggle", { storeName });
1794
+ return this.http.post("kv/toggle", { storeName });
1487
1795
  }
1488
1796
  delete(storeName) {
1489
- return this.http.delete(`stores/${storeName}`);
1797
+ return this.http.delete(`kv/${storeName}`);
1490
1798
  }
1491
1799
  };
1492
1800
  //#endregion
@@ -1496,7 +1804,7 @@ var SubscriptionsResource = class {
1496
1804
  this.http = http;
1497
1805
  }
1498
1806
  list(team) {
1499
- return this.http.get(`subscriptions?team=${encodeURIComponent(team)}`);
1807
+ return this.http.get("subscriptions");
1500
1808
  }
1501
1809
  get(id) {
1502
1810
  return this.http.get(`subscriptions/${id}`);
@@ -1600,15 +1908,39 @@ var TeamsResource = class {
1600
1908
  get(slug) {
1601
1909
  return this.http.get(`teams/${encodeURIComponent(slug)}`);
1602
1910
  }
1911
+ getPublic(slug) {
1912
+ return this.http.get(`teams/public/${encodeURIComponent(slug)}`);
1913
+ }
1603
1914
  create(data) {
1604
1915
  return this.http.post("teams", data);
1605
1916
  }
1917
+ delete(teamSlug) {
1918
+ return this.http.delete(`teams/${teamSlug}`);
1919
+ }
1606
1920
  update(teamSlug, data) {
1607
1921
  return this.http.patch(`teams/${teamSlug}`, data);
1608
1922
  }
1923
+ updateDescription(teamSlug, description) {
1924
+ return this.http.post(`teams/${teamSlug}/update`, { description });
1925
+ }
1926
+ updateTagline(teamSlug, tagline) {
1927
+ return this.http.post(`teams/${teamSlug}/update`, { tagline });
1928
+ }
1609
1929
  invite(teamSlug, payload) {
1610
1930
  return this.http.post(`teams/${teamSlug}/invitations`, payload);
1611
1931
  }
1932
+ inviteMember(teamSlug, email, role) {
1933
+ return this.http.post(`teams/${teamSlug}/members/invite`, {
1934
+ email,
1935
+ role
1936
+ });
1937
+ }
1938
+ removeMember(teamSlug, memberId) {
1939
+ return this.http.post(`teams/${teamSlug}/members/remove`, { member: memberId });
1940
+ }
1941
+ listMembers(teamSlug) {
1942
+ return this.http.get(`teams/${teamSlug}/members`);
1943
+ }
1612
1944
  updateLogo(teamSlug, logo) {
1613
1945
  return this.http.post(`teams/${teamSlug}/logo`, { logo });
1614
1946
  }
@@ -1627,6 +1959,18 @@ var TeamsResource = class {
1627
1959
  acceptInvite(slug) {
1628
1960
  return this.http.post(`teams/${slug}/members/accept`);
1629
1961
  }
1962
+ usage(teamSlug) {
1963
+ return this.http.get(`teams/${teamSlug}/usage`);
1964
+ }
1965
+ featureUsage(teamSlug, feature) {
1966
+ return this.http.get(`teams/${teamSlug}/usage/${feature}`);
1967
+ }
1968
+ aiCosts(teamSlug, page = 1) {
1969
+ return this.http.get(`teams/${teamSlug}/usage/ai-costs?page=${page}`);
1970
+ }
1971
+ topupFinalize(tx) {
1972
+ return this.http.post("teams/finalize/topup", { tx });
1973
+ }
1630
1974
  };
1631
1975
  //#endregion
1632
1976
  //#region src/resources/updates.ts
@@ -1799,14 +2143,65 @@ var WalletsResource = class {
1799
2143
  }
1800
2144
  };
1801
2145
  //#endregion
2146
+ //#region src/resources/workspace.ts
2147
+ var WorkspaceResource = class {
2148
+ constructor(http) {
2149
+ this.http = http;
2150
+ }
2151
+ register(teamId, deviceId, deviceName, deviceType, workspacePath, encryptionKeyHash, platformVersion, name) {
2152
+ const isNumeric = /^\d+$/.test(teamId);
2153
+ const body = {
2154
+ deviceId,
2155
+ deviceName,
2156
+ deviceType,
2157
+ workspacePath,
2158
+ encryptionKeyHash,
2159
+ platformVersion,
2160
+ ...name != null ? { name } : {}
2161
+ };
2162
+ if (isNumeric) body.teamId = Number(teamId);
2163
+ else body.team = teamId;
2164
+ return this.http.post("workspaces/register", body);
2165
+ }
2166
+ get(teamIdOrSlug) {
2167
+ const query = /^\d+$/.test(teamIdOrSlug) ? `teamId=${teamIdOrSlug}` : `team=${encodeURIComponent(teamIdOrSlug)}`;
2168
+ return this.http.get(`workspaces?${query}`);
2169
+ }
2170
+ files(workspaceId, opts) {
2171
+ const params = new URLSearchParams();
2172
+ if (opts?.path != null) params.set("path", opts.path);
2173
+ if (opts?.offset != null) params.set("offset", String(opts.offset));
2174
+ if (opts?.limit != null) params.set("limit", String(opts.limit));
2175
+ const q = params.toString();
2176
+ return this.http.get(`workspaces/${workspaceId}/files${q ? `?${q}` : ""}`);
2177
+ }
2178
+ uploadFile(workspaceId, file, pathOverride) {
2179
+ const path = pathOverride ?? file.name;
2180
+ const form = new FormData();
2181
+ form.append("file", file);
2182
+ form.append("path", path);
2183
+ return this.http.post(`workspaces/${workspaceId}/files/upload`, form, { isJson: false });
2184
+ }
2185
+ delete(id) {
2186
+ return this.http.delete(`workspaces/${id}`);
2187
+ }
2188
+ };
2189
+ //#endregion
1802
2190
  //#region src/resources/warps.ts
1803
2191
  var WarpsResource = class {
1804
2192
  constructor(http) {
1805
2193
  this.http = http;
1806
2194
  }
1807
- list(brand) {
1808
- const url = brand ? `warps?brand=${encodeURIComponent(brand)}` : "warps";
1809
- return this.http.get(url);
2195
+ list(options) {
2196
+ const params = new URLSearchParams();
2197
+ if (options?.brand) params.set("brand", options.brand);
2198
+ if (options?.creator) params.set("creator", options.creator);
2199
+ if (options?.primaryAddress) params.set("primaryAddress", options.primaryAddress);
2200
+ if (options?.status) params.set("status", options.status);
2201
+ if (options?.page) params.set("page", options.page.toString());
2202
+ if (options?.perPage) params.set("perPage", options.perPage.toString());
2203
+ const qs = params.toString();
2204
+ return this.http.get(`warps${qs ? "?" + qs : ""}`);
1810
2205
  }
1811
2206
  show(identifier) {
1812
2207
  return this.http.get(`warps/${identifier}`);
@@ -1826,6 +2221,66 @@ var WarpsResource = class {
1826
2221
  ...room ? { room } : {}
1827
2222
  });
1828
2223
  }
2224
+ sync(tx) {
2225
+ return this.http.post("warps/sync", { tx });
2226
+ }
2227
+ listBrands(locale, options) {
2228
+ const params = new URLSearchParams();
2229
+ params.set("locale", locale);
2230
+ if (options?.chain) {
2231
+ const chainValue = Array.isArray(options.chain) ? options.chain.join(",") : options.chain;
2232
+ params.set("chain", chainValue);
2233
+ }
2234
+ return this.http.get(`brands?${params.toString()}`);
2235
+ }
2236
+ getBrand(slug, locale) {
2237
+ return this.http.get(`brands/${slug}?with=warps,external&locale=${locale}`);
2238
+ }
2239
+ lookupBrand(hash, locale) {
2240
+ return this.http.get(`brands/lookup?hash=${hash}&locale=${locale}`);
2241
+ }
2242
+ listPopularBrands(locale) {
2243
+ return this.http.get(`brands/popular?locale=${locale}`);
2244
+ }
2245
+ previewBrandInvite(code) {
2246
+ return this.http.get(`brands/preview?code=${code}`);
2247
+ }
2248
+ joinBrand(inviteCode, teamSlug) {
2249
+ return this.http.post("brands/join", {
2250
+ invite_code: inviteCode,
2251
+ team_slug: teamSlug
2252
+ });
2253
+ }
2254
+ listTeamBrands(teamSlug) {
2255
+ return this.http.get(`teams/${teamSlug}/brands`);
2256
+ }
2257
+ getTeamBrand(teamSlug, brandSlug) {
2258
+ return this.http.get(`teams/${teamSlug}/brands/${brandSlug}?with=warps,external`);
2259
+ }
2260
+ createTeamBrand(teamSlug, data) {
2261
+ return this.http.post(`teams/${teamSlug}/brands`, data);
2262
+ }
2263
+ updateTeamBrand(teamSlug, brandSlug, data) {
2264
+ return this.http.put(`teams/${teamSlug}/brands/${brandSlug}`, data);
2265
+ }
2266
+ deleteTeamBrand(teamSlug, brandSlug) {
2267
+ return this.http.delete(`teams/${teamSlug}/brands/${brandSlug}`);
2268
+ }
2269
+ regenerateBrandInvite(teamSlug, brandSlug) {
2270
+ return this.http.post(`teams/${teamSlug}/brands/${brandSlug}/regenerate-invite`, {});
2271
+ }
2272
+ createBrandWarp(teamSlug, brandSlug, data) {
2273
+ return this.http.post(`teams/${teamSlug}/brands/${brandSlug}/warps`, data);
2274
+ }
2275
+ updateBrandWarp(teamSlug, brandSlug, warpHash, data) {
2276
+ return this.http.put(`teams/${teamSlug}/brands/${brandSlug}/warps/${warpHash}`, data);
2277
+ }
2278
+ deleteBrandWarp(teamSlug, brandSlug, warpHash) {
2279
+ return this.http.delete(`teams/${teamSlug}/brands/${brandSlug}/warps/${warpHash}`);
2280
+ }
2281
+ fetchSourceSchemaFromUrl(url) {
2282
+ return this.http.post("schema/fetch-url", { url });
2283
+ }
1829
2284
  };
1830
2285
  //#endregion
1831
2286
  //#region src/resources/webhooks.ts
@@ -1978,15 +2433,27 @@ function toWarpEnv(env) {
1978
2433
  }
1979
2434
  var JoAiClient = class {
1980
2435
  constructor(config) {
2436
+ this.isReady = true;
2437
+ this.hasApiToken = false;
1981
2438
  this.env = config.env ?? "mainnet";
2439
+ const apiBaseUrl = getApiBaseUrl(config.env ?? "mainnet");
1982
2440
  const headers = {};
1983
2441
  if (config.team) headers["X-Team"] = config.team;
1984
2442
  if (config.agentAuthKey) headers["X-Agent-Auth-Key"] = config.agentAuthKey;
1985
- const http = new HttpService(`${getApiBaseUrl(config.env ?? "mainnet")}/v1`, void 0, config.apiToken, { headers });
2443
+ const http = new HttpService(`${apiBaseUrl}/v1`, void 0, config.apiToken, {
2444
+ headers,
2445
+ csrfBaseUrl: apiBaseUrl
2446
+ });
1986
2447
  const cache = config.cache;
1987
2448
  this.http = cache?.enabled !== false ? new CachedHttpService(http, cache?.overrides, cache?.defaultTtl) : http;
1988
2449
  this.agents = new AgentsResource(this.http);
1989
2450
  this.alerts = new AlertsResource(this.http);
2451
+ this.apiTokens = new ApiTokensResource(this.http);
2452
+ this.characters = new CharactersResource(this.http);
2453
+ this.desk = new DeskResource(this.http);
2454
+ this.elements = new ElementsResource(this.http);
2455
+ this.entities = new EntitiesResource(this.http);
2456
+ this.mcp = new McpResource(this.http);
1990
2457
  this.appointments = new AppointmentsResource(this.http, config);
1991
2458
  this.auth = new AuthResource(this.http);
1992
2459
  this.billing = new BillingResource(this.http);
@@ -2008,7 +2475,7 @@ var JoAiClient = class {
2008
2475
  this.items = new ItemsResource(this.http);
2009
2476
  this.links = new LinksResource(this.http);
2010
2477
  this.loyalty = new LoyaltyResource(this.http);
2011
- this.marketplace = new MarketplaceResource(this.http);
2478
+ this.store = new StoreResource(this.http);
2012
2479
  this.media = new MediaResource(this.http);
2013
2480
  this.meetings = new MeetingsResource(this.http, config);
2014
2481
  this.memories = new MemoriesResource(this.http);
@@ -2023,12 +2490,13 @@ var JoAiClient = class {
2023
2490
  this.projects = new ProjectsResource(this.http);
2024
2491
  this.reminders = new RemindersResource(this.http);
2025
2492
  this.rooms = new RoomsResource(this.http);
2493
+ this.secrets = new SecretsResource(this.http);
2026
2494
  this.services = new ServicesResource(this.http);
2027
2495
  this.shortcuts = new ShortcutsResource(this.http);
2028
2496
  this.sites = new SitesResource(this.http);
2029
2497
  this.skills = new SkillsResource(this.http);
2030
2498
  this.stats = new StatsResource(this.http);
2031
- this.stores = new StoresResource(this.http);
2499
+ this.kv = new KvResource(this.http);
2032
2500
  this.subscriptions = new SubscriptionsResource(this.http);
2033
2501
  this.swarms = new SwarmsResource(this.http);
2034
2502
  this.tasks = new TasksResource(this.http);
@@ -2039,6 +2507,7 @@ var JoAiClient = class {
2039
2507
  this.voice = new VoiceResource(this.http);
2040
2508
  this.wallets = new WalletsResource(this.http);
2041
2509
  this.webhooks = new WebhooksResource(this.http);
2510
+ this.workspace = new WorkspaceResource(this.http);
2042
2511
  }
2043
2512
  clearCache() {
2044
2513
  if (this.http instanceof CachedHttpService) this.http.clearCache();
@@ -2083,4 +2552,4 @@ var DistributionResource = class {
2083
2552
  }
2084
2553
  };
2085
2554
  //#endregion
2086
- export { AgentsResource, AlertsResource, AppointmentsResource, AuthResource, BillingAddressesResource, BillingResource, BlueprintsResource, CachedHttpService, CardsResource, CartsResource, ChangelogResource, ContactsResource, ContractsResource, DistributionResource, DocumentsResource, FlowsResource, GoalsResource, IngestionsResource, InquiriesResource, IntegrationsResource, IntentsResource, ItemsResource, JoAiClient, LinksResource, LoyaltyResource, MarketplaceResource, MeetingsResource, MemoriesResource, MessagesResource, MissionsResource, NotificationsResource, OfficeResource, OrdersResource, PersonaResource, ProductsResource, ProjectsResource, RemindersResource, ServicesResource, ShortcutsResource, SitesResource, SkillsResource, StatsResource, StoresResource, SubscriptionsResource, SwarmsResource, TasksResource, TeamsResource, UpdatesResource, UpgradesResource, UsersResource, VoiceResource, WalletsResource, WarpsResource, WebhooksResource, createClient, formatOpeningHours };
2555
+ export { AgentsResource, AlertsResource, ApiTokensResource, AppointmentsResource, AuthResource, BillingAddressesResource, BillingResource, BlueprintsResource, CachedHttpService, CardsResource, CartsResource, ChangelogResource, CharactersResource, ContactsResource, ContractsResource, DeskResource, DistributionResource, DocumentsResource, ElementsResource, EntitiesResource, FlowsResource, GoalsResource, IngestionsResource, InquiriesResource, IntegrationsResource, IntentsResource, ItemsResource, JoAiClient, KvResource, LinksResource, LoyaltyResource, McpResource, MeetingsResource, MemoriesResource, MessagesResource, MissionsResource, NotificationsResource, OfficeResource, OrdersResource, PersonaResource, ProductsResource, ProjectsResource, RemindersResource, ServicesResource, ShortcutsResource, SitesResource, SkillsResource, StatsResource, StoreResource, SubscriptionsResource, SwarmsResource, TasksResource, TeamsResource, UpdatesResource, UpgradesResource, UsersResource, VoiceResource, WalletsResource, WarpsResource, WebhooksResource, WorkspaceResource, createClient, formatOpeningHours };