@joai/sdk 0.17.2 → 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.
Files changed (3) hide show
  1. package/dist/index.d.mts +2841 -623
  2. package/dist/index.mjs +1785 -329
  3. package/package.json +1 -1
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 = () => {};
@@ -110,6 +111,259 @@ var HttpService = class {
110
111
  }
111
112
  };
112
113
  //#endregion
114
+ //#region src/resources/agents.ts
115
+ var AgentsResource = class {
116
+ constructor(http) {
117
+ this.http = http;
118
+ }
119
+ list(team) {
120
+ const url = team ? `agents?team=${team}` : "agents?me=true";
121
+ return this.http.get(url);
122
+ }
123
+ get(uuid) {
124
+ return this.http.get(`agents/${uuid}`);
125
+ }
126
+ getPublic(uuid) {
127
+ return this.http.get(`agents/${uuid}`);
128
+ }
129
+ create(params) {
130
+ return this.http.post("agents", params);
131
+ }
132
+ update(uuid, name, description, avatar) {
133
+ return this.http.put(`agents/${uuid}`, {
134
+ name,
135
+ description,
136
+ avatar
137
+ });
138
+ }
139
+ delete(uuid) {
140
+ return this.http.delete(`agents/${uuid}`);
141
+ }
142
+ updatePassword(uuid, password) {
143
+ return this.http.put(`agents/${uuid}/password`, { password });
144
+ }
145
+ storePassword(uuid, password) {
146
+ return this.http.post(`agents/${uuid}/password`, { password });
147
+ }
148
+ updateSetting(uuid, key, value) {
149
+ return this.http.put(`agents/${uuid}/settings/${key}`, { value });
150
+ }
151
+ updateMeta(uuid, key, value) {
152
+ return this.http.put(`agents/${uuid}/meta/${key}`, { value });
153
+ }
154
+ publish(uuid) {
155
+ return this.http.post(`agents/${uuid}/publish`, {});
156
+ }
157
+ unpublish(uuid) {
158
+ return this.http.delete(`agents/${uuid}/publish`);
159
+ }
160
+ moveToTeam(uuid, teamSlug) {
161
+ return this.http.put(`agents/${uuid}/team`, { teamSlug });
162
+ }
163
+ getActions(uuid, page = 1) {
164
+ return this.http.get(`agents/${uuid}/actions?page=${page}`);
165
+ }
166
+ provisionPhone(uuid) {
167
+ return this.http.post(`integrations/${uuid}/phone/provision`);
168
+ }
169
+ execute(agentUuid, payload) {
170
+ const { audio, media, ghost, context } = payload;
171
+ const mediaIds = media?.map((m) => m.id);
172
+ if (audio) {
173
+ const formData = new FormData();
174
+ formData.append("audio", audio, audio.name);
175
+ formData.append("sender", payload.sender);
176
+ formData.append("room", payload.room);
177
+ formData.append("message", payload.message);
178
+ if (mediaIds) formData.append("media", JSON.stringify(mediaIds));
179
+ formData.append("preferences[ghost]", ghost ? "1" : "0");
180
+ if (context) Object.entries(context).forEach(([key, value]) => {
181
+ if (Array.isArray(value)) value.forEach((v) => formData.append(`context[${key}][]`, String(v)));
182
+ else if (value != null) formData.append(`context[${key}]`, String(value));
183
+ });
184
+ return this.http.post(`agents/${agentUuid}/execute`, formData, { isJson: false });
185
+ }
186
+ return this.http.post(`agents/${agentUuid}/execute`, {
187
+ sender: payload.sender,
188
+ room: payload.room,
189
+ message: payload.message,
190
+ media: mediaIds,
191
+ context,
192
+ preferences: { ghost: ghost ?? false }
193
+ });
194
+ }
195
+ actionCallback(agent, room, action, result) {
196
+ return this.http.post(`agents/${agent}/action-callback`, {
197
+ room,
198
+ action,
199
+ result
200
+ });
201
+ }
202
+ };
203
+ //#endregion
204
+ //#region src/resources/alerts.ts
205
+ var AlertsResource = class {
206
+ constructor(http) {
207
+ this.http = http;
208
+ }
209
+ list(agent, page = 1) {
210
+ return this.http.get(`alerts?agent=${agent}&page=${page}`);
211
+ }
212
+ delete(id) {
213
+ return this.http.delete(`alerts/${id}`);
214
+ }
215
+ toggle(id) {
216
+ return this.http.post(`alerts/${id}/toggle`);
217
+ }
218
+ };
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
113
367
  //#region src/resources/appointments.ts
114
368
  const WEEKDAYS = [
115
369
  "monday",
@@ -223,23 +477,6 @@ var AppointmentsResource = class {
223
477
  }
224
478
  };
225
479
  //#endregion
226
- //#region src/resources/agents.ts
227
- var AgentsResource = class {
228
- constructor(http) {
229
- this.http = http;
230
- }
231
- list() {
232
- return this.http.get("agents");
233
- }
234
- async get(uuid) {
235
- const res = await this.http.get(`agents/${uuid}`);
236
- return res.ok ? res.data : null;
237
- }
238
- execute(agentUuid, payload) {
239
- return this.http.post(`agents/${agentUuid}/execute`, payload);
240
- }
241
- };
242
- //#endregion
243
480
  //#region src/resources/auth.ts
244
481
  var AuthResource = class {
245
482
  constructor(http) {
@@ -248,6 +485,15 @@ var AuthResource = class {
248
485
  sendCode(data) {
249
486
  return this.http.post("auth/send-code", data);
250
487
  }
488
+ requestEmail(email, redirect) {
489
+ return this.http.post("auth/email/request", {
490
+ email,
491
+ redirect
492
+ });
493
+ }
494
+ loginWithSocialAccessToken(provider, accessToken) {
495
+ return this.http.post(`auth/social/${provider}/login`, { accessToken });
496
+ }
251
497
  verify(token) {
252
498
  return this.http.get("auth/verify?token=" + token);
253
499
  }
@@ -257,6 +503,96 @@ var AuthResource = class {
257
503
  logout() {
258
504
  return this.http.post("auth/logout");
259
505
  }
506
+ createApiToken() {
507
+ return this.http.post("auth/api-tokens");
508
+ }
509
+ verifyWallet(accessToken, withMobileApiToken) {
510
+ return this.http.post("auth/wallet/verify", {
511
+ accessToken,
512
+ withMobileApiToken
513
+ });
514
+ }
515
+ };
516
+ //#endregion
517
+ //#region src/resources/billing-addresses.ts
518
+ var BillingAddressesResource = class {
519
+ constructor(http) {
520
+ this.http = http;
521
+ }
522
+ get(contact, team) {
523
+ const params = new URLSearchParams();
524
+ if (contact) params.set("contact", contact);
525
+ if (team) params.set("team", team);
526
+ const qs = params.toString();
527
+ return this.http.get(`billing/addresses${qs ? "?" + qs : ""}`);
528
+ }
529
+ store(data) {
530
+ return this.http.post("billing/addresses", data);
531
+ }
532
+ };
533
+ //#endregion
534
+ //#region src/resources/billing.ts
535
+ var BillingResource = class {
536
+ constructor(http) {
537
+ this.http = http;
538
+ }
539
+ plans(type = "current") {
540
+ return this.http.get(`billing/plans?type=${type}`);
541
+ }
542
+ checkoutProduct(id) {
543
+ return this.http.get(`billing/products/${id}`);
544
+ }
545
+ orders(team, page = 1, contactId) {
546
+ let params = `billing/orders?page=${page}`;
547
+ if (contactId) params += `&contactId=${encodeURIComponent(contactId)}`;
548
+ return this.http.get(params);
549
+ }
550
+ payOrder(id, provider) {
551
+ return this.http.post(`billing/orders/${id}/pay`, { provider });
552
+ }
553
+ deleteOrder(id) {
554
+ return this.http.delete(`billing/orders/${id}`);
555
+ }
556
+ paymentAccount(team, provider) {
557
+ return this.http.get(`payment-accounts/${provider}`, { headers: { "X-Team": team } });
558
+ }
559
+ createPaymentAccountOnboarding(team, provider) {
560
+ return this.http.post(`payment-accounts/${provider}/onboarding`, void 0, { headers: { "X-Team": team } });
561
+ }
562
+ updatePaymentAccount(team, provider, input) {
563
+ return this.http.put(`payment-accounts/${provider}`, input, { headers: { "X-Team": team } });
564
+ }
565
+ createTerminalConnectionToken(team, provider) {
566
+ return this.http.post(`payment-accounts/${provider}/terminal/connection-token`, void 0, { headers: { "X-Team": team } });
567
+ }
568
+ createTerminalPaymentIntent(orderId, provider) {
569
+ return this.http.post(`orders/${orderId}/terminal/${provider}/payment-intent`);
570
+ }
571
+ captureTerminalPaymentIntent(orderId, provider, paymentIntentId) {
572
+ return this.http.post(`orders/${orderId}/terminal/${provider}/capture`, { paymentIntentId });
573
+ }
574
+ cancelTerminalPaymentIntent(orderId, provider, paymentIntentId) {
575
+ return this.http.post(`orders/${orderId}/terminal/${provider}/cancel`, { paymentIntentId });
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
+ }
583
+ verifyIap(receipt, team, meta) {
584
+ if (receipt.platform === "ios") return this.http.post("billing/gateways/apple/validate-receipt", {
585
+ receipt_data: receipt.receipt,
586
+ team,
587
+ ...meta
588
+ });
589
+ return this.http.post("billing/gateways/google/validate-receipt", {
590
+ product_id: receipt.productId,
591
+ purchase_token: receipt.receipt,
592
+ team,
593
+ ...meta
594
+ });
595
+ }
260
596
  };
261
597
  //#endregion
262
598
  //#region src/resources/blueprints.ts
@@ -268,11 +604,55 @@ var BlueprintsResource = class {
268
604
  const query = new URLSearchParams();
269
605
  if (params?.page !== void 0) query.set("page", String(params.page));
270
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");
271
610
  const qs = query.toString();
272
611
  return this.http.get(qs ? `blueprints?${qs}` : "blueprints");
273
612
  }
274
- get(slug, locale = "en") {
275
- 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);
617
+ }
618
+ create(data) {
619
+ return this.http.post("blueprints", data);
620
+ }
621
+ assemble(blueprint, team, name) {
622
+ return this.http.post("blueprints/assemble", {
623
+ blueprint,
624
+ team,
625
+ name
626
+ });
627
+ }
628
+ };
629
+ //#endregion
630
+ //#region src/resources/cards.ts
631
+ var CardsResource = class {
632
+ constructor(http) {
633
+ this.http = http;
634
+ }
635
+ list(agent) {
636
+ return this.http.get(`cards?agent=${agent}`);
637
+ }
638
+ create(agent, warp, inputs = []) {
639
+ return this.http.post("cards", {
640
+ agent,
641
+ warp,
642
+ inputs
643
+ });
644
+ }
645
+ update(id, warp, inputs = []) {
646
+ return this.http.put(`cards/${id}`, {
647
+ warp,
648
+ inputs
649
+ });
650
+ }
651
+ delete(id) {
652
+ return this.http.delete(`cards/${id}`);
653
+ }
654
+ toggle(id) {
655
+ return this.http.post(`cards/${id}/toggle`);
276
656
  }
277
657
  };
278
658
  //#endregion
@@ -313,154 +693,130 @@ var CartsResource = class {
313
693
  }
314
694
  };
315
695
  //#endregion
316
- //#region src/resources/flows.ts
317
- var FlowsResource = class {
696
+ //#region src/resources/changelog.ts
697
+ var ChangelogResource = class {
318
698
  constructor(http) {
319
699
  this.http = http;
320
700
  }
321
- list(params) {
322
- const query = new URLSearchParams();
323
- if (params?.locale) query.set("locale", params.locale);
324
- if (params?.page !== void 0) query.set("page", String(params.page));
325
- const qs = query.toString();
326
- return this.http.get(qs ? `flows?${qs}` : "flows");
701
+ get(locale) {
702
+ return this.http.get(`changelog?locale=${locale}`);
327
703
  }
328
- get(slug, locale = "en") {
329
- return this.http.get(`flows/${slug}?locale=${locale}`);
704
+ subscribe(email) {
705
+ return this.http.post("changelog/subscribe", { email });
330
706
  }
331
707
  };
332
708
  //#endregion
333
- //#region src/resources/marketplace.ts
334
- var MarketplaceResource = class {
709
+ //#region src/resources/contacts.ts
710
+ var ContactsResource = class {
335
711
  constructor(http) {
336
712
  this.http = http;
337
713
  }
338
- async get(locale = "en") {
339
- const res = await this.http.get(`marketplace?locale=${locale}`);
340
- if (!res.ok || !res.data) return {
341
- blueprints: [],
342
- skills: [],
343
- flows: [],
344
- creators: [],
345
- agents: [],
346
- items: []
347
- };
348
- const { blueprints = [], skills = [], flows = [], creators = [], agents = [] } = res.data;
349
- return {
350
- blueprints,
351
- skills,
352
- flows,
353
- creators,
354
- agents,
355
- items: [
356
- ...agents.map((item) => ({
357
- type: "agent",
358
- item
359
- })),
360
- ...blueprints.map((item) => ({
361
- type: "blueprint",
362
- item
363
- })),
364
- ...flows.map((item) => ({
365
- type: "flow",
366
- item
367
- })),
368
- ...skills.map((item) => ({
369
- type: "skill",
370
- item
371
- }))
372
- ]
373
- };
714
+ list(params) {
715
+ const query = new URLSearchParams();
716
+ if (params?.search) query.set("filter[search]", params.search);
717
+ if (params?.page) query.set("page", String(params.page));
718
+ const qs = query.toString();
719
+ return this.http.get(`contacts${qs ? "?" + qs : ""}`);
374
720
  }
375
- };
376
- //#endregion
377
- //#region src/resources/services.ts
378
- var ServicesResource = class {
379
- constructor(http) {
380
- this.http = http;
721
+ get(id) {
722
+ return this.http.get(`contacts/${id}`);
381
723
  }
382
- list(team) {
383
- const url = team ? `services?team=${encodeURIComponent(team)}` : "services";
384
- return this.http.get(url);
724
+ create(payload) {
725
+ return this.http.post("contacts", payload);
385
726
  }
386
- get(slug) {
387
- return this.http.get(`services/${slug}`);
727
+ update(id, data) {
728
+ return this.http.put(`contacts/${id}`, data);
388
729
  }
389
- store(team, data) {
390
- return this.http.post("services", {
391
- team,
392
- ...data
393
- });
730
+ delete(id) {
731
+ return this.http.delete(`contacts/${id}`);
394
732
  }
395
- update(id, data) {
396
- return this.http.put(`services/${id}`, data);
733
+ listActivities(id) {
734
+ return this.http.get(`contacts/${id}/activities`);
397
735
  }
398
- delete(id) {
399
- return this.http.delete(`services/${id}`);
736
+ getTimeline(id, page = 1) {
737
+ return this.http.get(`contacts/${id}/timeline?page=${page}`);
400
738
  }
401
- };
402
- //#endregion
403
- //#region src/resources/skills.ts
404
- var SkillsResource = class {
405
- constructor(http) {
406
- this.http = http;
739
+ addActivity(id, data) {
740
+ return this.http.post(`contacts/${id}/activities`, data);
407
741
  }
408
- get(id) {
409
- return this.http.get(`skills/${id}`);
742
+ updateActivity(id, activityId, data) {
743
+ return this.http.put(`contacts/${id}/activities/${activityId}`, data);
410
744
  }
411
- };
412
- //#endregion
413
- //#region src/resources/hub.ts
414
- var HubResource = class {
415
- constructor(http) {
416
- this.http = http;
745
+ deleteActivity(id, activityId) {
746
+ return this.http.delete(`contacts/${id}/activities/${activityId}`);
417
747
  }
418
- subscribe(email, tag) {
419
- return this.http.post("hub/subscribe", {
420
- email,
421
- tag
748
+ send(id, message, integration) {
749
+ return this.http.post(`contacts/${id}/send`, {
750
+ message,
751
+ integration
422
752
  });
423
753
  }
424
754
  };
425
755
  //#endregion
426
- //#region src/resources/contacts.ts
427
- var ContactsResource = class {
756
+ //#region src/resources/contracts.ts
757
+ var ContractsResource = class {
428
758
  constructor(http) {
429
759
  this.http = http;
430
760
  }
431
- list(params) {
432
- const query = new URLSearchParams();
433
- if (params?.search) query.set("search", params.search);
434
- if (params?.page) query.set("page", String(params.page));
435
- const qs = query.toString();
436
- return this.http.get(`contacts${qs ? "?" + qs : ""}`);
761
+ list(agentUuid) {
762
+ return this.http.get(`contracts?agent=${agentUuid}`);
437
763
  }
438
- get(id) {
439
- return this.http.get(`contacts/${id}`);
764
+ get(uuid) {
765
+ return this.http.get(`contracts/${uuid}`);
440
766
  }
441
- create(payload) {
442
- return this.http.post("contacts", payload);
767
+ create(agentUuid, name, chain, category = "default", isPublic = false, description) {
768
+ return this.http.post("contracts", {
769
+ agent: agentUuid,
770
+ name,
771
+ chain,
772
+ category,
773
+ public: isPublic,
774
+ description
775
+ });
443
776
  }
444
- update(id, data) {
445
- return this.http.put(`contacts/${id}`, data);
777
+ update(uuid, data) {
778
+ return this.http.put(`contracts/${uuid}`, data);
446
779
  }
447
- delete(id) {
448
- return this.http.delete(`contacts/${id}`);
780
+ delete(uuid) {
781
+ return this.http.delete(`contracts/${uuid}`);
449
782
  }
450
- listActivities(id) {
451
- return this.http.get(`contacts/${id}/activities`);
783
+ deploy(uuid, env, txHash, type) {
784
+ return this.http.post(`contracts/${uuid}/deployment`, {
785
+ env,
786
+ tx: txHash,
787
+ type
788
+ });
452
789
  }
453
- getTimeline(id, page = 1) {
454
- return this.http.get(`contacts/${id}/timeline?page=${page}`);
790
+ setAddress(uuid, env, address) {
791
+ return this.http.post(`contracts/${uuid}/addresses`, {
792
+ env,
793
+ address
794
+ });
455
795
  }
456
- addActivity(id, data) {
457
- return this.http.post(`contacts/${id}/activities`, data);
796
+ resetAddress(uuid, env) {
797
+ return this.http.post(`contracts/${uuid}/reset`, { env });
458
798
  }
459
- updateActivity(id, activityId, data) {
460
- return this.http.put(`contacts/${id}/activities/${activityId}`, data);
799
+ listVersions(uuid) {
800
+ return this.http.get(`contracts/${uuid}/versions`);
461
801
  }
462
- deleteActivity(id, activityId) {
463
- return this.http.delete(`contacts/${id}/activities/${activityId}`);
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);
464
820
  }
465
821
  };
466
822
  //#endregion
@@ -486,6 +842,47 @@ var DocumentsResource = class {
486
842
  delete(id) {
487
843
  return this.http.delete(`documents/${id}`);
488
844
  }
845
+ trainFromUrl(agent, url) {
846
+ return this.http.post("documents/training/url", {
847
+ agent,
848
+ url
849
+ });
850
+ }
851
+ uploadFile(agentUuid, name, document) {
852
+ return this.http.post("documents", {
853
+ agent: agentUuid,
854
+ name,
855
+ document
856
+ });
857
+ }
858
+ };
859
+ //#endregion
860
+ //#region src/resources/flows.ts
861
+ var FlowsResource = class {
862
+ constructor(http) {
863
+ this.http = http;
864
+ }
865
+ list(params) {
866
+ const query = new URLSearchParams();
867
+ if (params?.locale) query.set("locale", params.locale);
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");
871
+ const qs = query.toString();
872
+ return this.http.get(qs ? `flows?${qs}` : "flows");
873
+ }
874
+ get(slug, locale = "en") {
875
+ return this.http.get(`flows/${slug}?locale=${locale}`);
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
+ }
489
886
  };
490
887
  //#endregion
491
888
  //#region src/resources/goals.ts
@@ -502,80 +899,147 @@ var GoalsResource = class {
502
899
  update(id, data) {
503
900
  return this.http.put(`goals/${id}`, data);
504
901
  }
902
+ delete(id) {
903
+ return this.http.delete(`goals/${id}`);
904
+ }
505
905
  };
506
906
  //#endregion
507
- //#region src/resources/meetings.ts
508
- var MeetingsResource = class {
509
- constructor(http, config) {
907
+ //#region src/resources/hub.ts
908
+ var HubResource = class {
909
+ constructor(http) {
510
910
  this.http = http;
511
- this.config = config;
512
911
  }
513
- listUpcoming() {
514
- return this.http.get(`teams/${this.config.team}/meetings/upcoming`);
912
+ subscribe(email, tag) {
913
+ return this.http.post("hub/subscribe", {
914
+ email,
915
+ tag
916
+ });
917
+ }
918
+ };
919
+ //#endregion
920
+ //#region src/resources/ingestions.ts
921
+ var IngestionsResource = class {
922
+ constructor(http) {
923
+ this.http = http;
924
+ }
925
+ list(params) {
926
+ const query = new URLSearchParams({ public: "true" });
927
+ if (params?.page !== void 0) query.set("page", String(params.page));
928
+ if (params?.size !== void 0) query.set("size", String(params.size));
929
+ if (params?.agent) query.set("agent", params.agent);
930
+ return this.http.get(`ingestions?${query}`);
515
931
  }
516
932
  get(id) {
517
- return this.http.get(`meetings/${id}`);
933
+ return this.http.get(`ingestions/${id}`);
518
934
  }
519
- getSummary(id) {
520
- return this.http.get(`meetings/${id}/summary`);
935
+ getShared(shareToken) {
936
+ return this.http.get(`ingestions/${shareToken}`);
521
937
  }
522
- join(code) {
523
- return this.http.get(`meetings/join/${code}`);
938
+ delete(id) {
939
+ return this.http.delete(`ingestions/${id}`);
524
940
  }
525
- cancel(code) {
526
- return this.http.post(`meetings/cancel/${code}`, {});
941
+ publish(id) {
942
+ return this.http.post(`ingestions/${id}/publish`, {});
527
943
  }
528
- share(id, recipients) {
529
- return this.http.post(`meetings/${id}/share`, { recipients });
944
+ unpublish(id) {
945
+ return this.http.post(`ingestions/${id}/unpublish`, {});
530
946
  }
531
- update(id, name, notify, speakers) {
532
- return this.http.put(`meetings/${id}`, {
533
- name,
534
- ...notify !== void 0 && { notify },
535
- ...speakers !== void 0 && { speakers }
536
- });
947
+ };
948
+ //#endregion
949
+ //#region src/resources/inquiries.ts
950
+ var InquiriesResource = class {
951
+ constructor(http) {
952
+ this.http = http;
537
953
  }
538
- finalize(id, notify) {
539
- return this.http.post(`meetings/${id}/finalize`, { notify });
954
+ create(content, type, message) {
955
+ return this.http.post("inquiries", {
956
+ content,
957
+ type,
958
+ message
959
+ });
540
960
  }
541
961
  };
542
962
  //#endregion
543
- //#region src/resources/media.ts
544
- var MediaResource = class {
963
+ //#region src/resources/integrations.ts
964
+ var IntegrationsResource = class {
545
965
  constructor(http) {
546
966
  this.http = http;
547
967
  }
548
- listPublic(params) {
549
- const query = new URLSearchParams();
550
- if (params?.tags) query.set("tags", params.tags);
551
- if (params?.team) query.set("team", params.team);
552
- if (params?.mime) query.set("mime", params.mime);
553
- const qs = query.toString();
554
- return this.http.get(`media/public${qs ? "?" + qs : ""}`);
968
+ list(agent, page = 1) {
969
+ return this.http.get(`integrations?agent=${agent}&page=${page}`);
555
970
  }
556
- upload(data) {
557
- const formData = new FormData();
558
- formData.append("file", data.file, data.file.name);
559
- formData.append("type", data.type);
560
- if (data.label) formData.append("label", data.label);
561
- if (data.tags) data.tags.forEach((t) => formData.append("tags[]", t));
562
- return this.http.post("media", formData, { headers: { "X-Team": data.team } });
971
+ delete(id) {
972
+ return this.http.delete(`integrations/${id}`);
973
+ }
974
+ toggle(id) {
975
+ return this.http.post(`integrations/${id}/toggle`);
976
+ }
977
+ storeBot(platform, agent, data) {
978
+ return this.http.post(`integrations/${platform}/${agent}/bot`, data);
979
+ }
980
+ getBot(platform, agent) {
981
+ return this.http.get(`integrations/${platform}/${agent}/bot`);
982
+ }
983
+ storeWhatsAppEmbeddedSignup(agent, data) {
984
+ return this.http.post("integrations/whatsapp/" + agent + "/embedded-signup", data);
985
+ }
986
+ reconfigureWhatsAppWebhook(agent) {
987
+ return this.http.post("integrations/whatsapp/" + agent + "/reconfigure");
988
+ }
989
+ getXStatus(agent) {
990
+ return this.http.get("integrations/x/" + agent + "/status");
991
+ }
992
+ setupX(agent) {
993
+ return this.http.post("integrations/x/" + agent + "/setup");
994
+ }
995
+ getCalendarStatus(agent) {
996
+ return this.http.get("integrations/calendar/" + agent);
997
+ }
998
+ syncCalendar(agent) {
999
+ return this.http.post("integrations/calendar/" + agent + "/sync");
1000
+ }
1001
+ deleteCalendar(agent) {
1002
+ return this.http.delete("integrations/calendar/" + agent);
1003
+ }
1004
+ getEmbedStatus(agentUuid) {
1005
+ return this.http.get("integrations/embed/" + agentUuid);
1006
+ }
1007
+ setupEmbed(agentUuid, allowedDomains) {
1008
+ return this.http.post("integrations/embed/" + agentUuid + "/setup", { allowedDomains });
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);
563
1033
  }
564
1034
  };
565
1035
  //#endregion
566
- //#region src/resources/ingestions.ts
567
- var IngestionsResource = class {
1036
+ //#region src/resources/intents.ts
1037
+ var IntentsResource = class {
568
1038
  constructor(http) {
569
1039
  this.http = http;
570
1040
  }
571
- list(params) {
572
- const query = new URLSearchParams({ public: "true" });
573
- if (params?.page !== void 0) query.set("page", String(params.page));
574
- if (params?.size !== void 0) query.set("size", String(params.size));
575
- return this.http.get(`ingestions?${query}`);
576
- }
577
- getShared(shareToken) {
578
- return this.http.get(`ingestions/${shareToken}`);
1041
+ getUnseen(agent) {
1042
+ return this.http.get(`intents?agent=${agent}&unseen`);
579
1043
  }
580
1044
  };
581
1045
  //#endregion
@@ -602,119 +1066,830 @@ var ItemsResource = class {
602
1066
  delete(id) {
603
1067
  return this.http.delete(`items/${id}`);
604
1068
  }
1069
+ sort(team, itemIds) {
1070
+ return this.http.post("items/sort", {
1071
+ team,
1072
+ itemIds
1073
+ });
1074
+ }
605
1075
  };
606
1076
  //#endregion
607
- //#region src/resources/memories.ts
608
- var MemoriesResource = class {
1077
+ //#region src/resources/links.ts
1078
+ var LinksResource = class {
609
1079
  constructor(http) {
610
1080
  this.http = http;
611
1081
  }
612
1082
  list(params) {
613
1083
  const query = new URLSearchParams();
614
- if (params?.search) query.set("search", params.search);
615
- if (params?.contactId) query.set("contactId", params.contactId);
1084
+ if (params?.type) query.set("type", params.type);
1085
+ if (params?.active != null) query.set("active", String(params.active));
616
1086
  const qs = query.toString();
617
- return this.http.get(`memories${qs ? "?" + qs : ""}`);
1087
+ return this.http.get(`links${qs ? "?" + qs : ""}`);
618
1088
  }
619
- add(payload) {
620
- return this.http.post("memories", payload);
1089
+ create(payload) {
1090
+ return this.http.post("links", payload);
621
1091
  }
622
- update(id, data) {
623
- return this.http.put(`memories/${id}`, data);
1092
+ update(id, payload) {
1093
+ return this.http.patch(`links/${id}`, payload);
624
1094
  }
625
1095
  delete(id) {
626
- return this.http.delete(`memories/${id}`);
1096
+ return this.http.delete(`links/${id}`);
1097
+ }
1098
+ stats() {
1099
+ return this.http.get("links/stats");
1100
+ }
1101
+ variations(linkId) {
1102
+ return this.http.get(`links/${linkId}/variations`);
1103
+ }
1104
+ createVariation(linkId, payload) {
1105
+ return this.http.post(`links/${linkId}/variations`, payload);
1106
+ }
1107
+ createVariationBatch(linkId, payload) {
1108
+ return this.http.post(`links/${linkId}/variations/batch`, payload);
1109
+ }
1110
+ deleteVariation(linkId, variationId) {
1111
+ return this.http.delete(`links/${linkId}/variations/${variationId}`);
627
1112
  }
628
1113
  };
629
1114
  //#endregion
630
- //#region src/resources/orders.ts
631
- var OrdersResource = class {
1115
+ //#region src/resources/loyalty.ts
1116
+ var LoyaltyResource = class {
1117
+ constructor(http) {
1118
+ this.http = http;
1119
+ }
1120
+ getProgram() {
1121
+ return this.http.get("loyalty/program");
1122
+ }
1123
+ updateProgram(data) {
1124
+ return this.http.patch("loyalty/program", data);
1125
+ }
1126
+ getRewards() {
1127
+ return this.http.get("loyalty/rewards");
1128
+ }
1129
+ createReward(data) {
1130
+ return this.http.post("loyalty/rewards", data);
1131
+ }
1132
+ updateReward(id, data) {
1133
+ return this.http.patch(`loyalty/rewards/${id}`, data);
1134
+ }
1135
+ deleteReward(id) {
1136
+ return this.http.delete(`loyalty/rewards/${id}`);
1137
+ }
1138
+ getTiers() {
1139
+ return this.http.get("loyalty/tiers");
1140
+ }
1141
+ createTier(data) {
1142
+ return this.http.post("loyalty/tiers", data);
1143
+ }
1144
+ updateTier(id, data) {
1145
+ return this.http.patch(`loyalty/tiers/${id}`, data);
1146
+ }
1147
+ deleteTier(id) {
1148
+ return this.http.delete(`loyalty/tiers/${id}`);
1149
+ }
1150
+ getPromotions() {
1151
+ return this.http.get("loyalty/promotions");
1152
+ }
1153
+ createPromotion(data) {
1154
+ return this.http.post("loyalty/promotions", data);
1155
+ }
1156
+ updatePromotion(id, data) {
1157
+ return this.http.patch(`loyalty/promotions/${id}`, data);
1158
+ }
1159
+ deletePromotion(id) {
1160
+ return this.http.delete(`loyalty/promotions/${id}`);
1161
+ }
1162
+ enroll(contactId) {
1163
+ return this.http.post("loyalty/enroll", { contactId });
1164
+ }
1165
+ getAccount(contactId) {
1166
+ return this.http.get(`loyalty/accounts/${contactId}`);
1167
+ }
1168
+ earn(contactId, context) {
1169
+ return this.http.post("loyalty/earn", {
1170
+ contactId,
1171
+ ...context
1172
+ });
1173
+ }
1174
+ redeem(contactId, rewardId) {
1175
+ return this.http.post("loyalty/redeem", {
1176
+ contactId,
1177
+ rewardId
1178
+ });
1179
+ }
1180
+ adjustPoints(contactId, points, reason) {
1181
+ return this.http.post("loyalty/adjust", {
1182
+ contactId,
1183
+ points,
1184
+ reason
1185
+ });
1186
+ }
1187
+ getTransactionHistory(contactId) {
1188
+ return this.http.get(`loyalty/accounts/${contactId}/history`);
1189
+ }
1190
+ listMembers() {
1191
+ return this.http.get("loyalty/members");
1192
+ }
1193
+ };
1194
+ //#endregion
1195
+ //#region src/resources/store.ts
1196
+ var StoreResource = class {
1197
+ constructor(http) {
1198
+ this.http = http;
1199
+ }
1200
+ async get(locale = "en") {
1201
+ const res = await this.http.get(`store?locale=${locale}`);
1202
+ if (!res.ok || !res.data) return {
1203
+ blueprints: [],
1204
+ skills: [],
1205
+ flows: [],
1206
+ creators: [],
1207
+ agents: [],
1208
+ items: []
1209
+ };
1210
+ const { blueprints = [], skills = [], flows = [], creators = [], agents = [] } = res.data;
1211
+ return {
1212
+ blueprints,
1213
+ skills,
1214
+ flows,
1215
+ creators,
1216
+ agents,
1217
+ items: [
1218
+ ...agents.map((item) => ({
1219
+ type: "agent",
1220
+ item
1221
+ })),
1222
+ ...blueprints.map((item) => ({
1223
+ type: "blueprint",
1224
+ item
1225
+ })),
1226
+ ...flows.map((item) => ({
1227
+ type: "flow",
1228
+ item
1229
+ })),
1230
+ ...skills.map((item) => ({
1231
+ type: "skill",
1232
+ item
1233
+ }))
1234
+ ]
1235
+ };
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
+ }
1256
+ };
1257
+ //#endregion
1258
+ //#region src/resources/media.ts
1259
+ var MediaResource = class {
1260
+ constructor(http) {
1261
+ this.http = http;
1262
+ }
1263
+ listPublic(params) {
1264
+ const query = new URLSearchParams();
1265
+ if (params?.tags) query.set("tags", params.tags);
1266
+ if (params?.team) query.set("team", params.team);
1267
+ if (params?.mime) query.set("mime", params.mime);
1268
+ const qs = query.toString();
1269
+ return this.http.get(`media/public${qs ? "?" + qs : ""}`);
1270
+ }
1271
+ upload(data) {
1272
+ const formData = new FormData();
1273
+ formData.append("file", data.file, data.file.name);
1274
+ formData.append("type", data.type);
1275
+ if (data.label) formData.append("label", data.label);
1276
+ if (data.tags) data.tags.forEach((t) => formData.append("tags[]", t));
1277
+ return this.http.post("media", formData, { headers: { "X-Team": data.team } });
1278
+ }
1279
+ listTeam(team, params) {
1280
+ const query = new URLSearchParams();
1281
+ query.set("page", String(params?.page ?? 1));
1282
+ if (params?.mime) query.set("mime", params.mime);
1283
+ return this.http.get(`teams/${team}/media?${query.toString()}`);
1284
+ }
1285
+ uploadTeam(team, media, tags, options) {
1286
+ return this.http.post(`teams/${team}/media/upload`, {
1287
+ media,
1288
+ tags,
1289
+ preserveOriginal: options?.preserveOriginal
1290
+ });
1291
+ }
1292
+ deleteTeam(team, mediaId) {
1293
+ return this.http.delete(`teams/${team}/media/${mediaId}`);
1294
+ }
1295
+ updateTeamMedia(team, mediaId, data) {
1296
+ return this.http.put(`teams/${team}/media/${mediaId}`, data);
1297
+ }
1298
+ updateTeamMediaTags(team, mediaId, tags) {
1299
+ return this.http.put(`teams/${team}/media/${mediaId}/tags`, { tags });
1300
+ }
1301
+ };
1302
+ //#endregion
1303
+ //#region src/resources/meetings.ts
1304
+ var MeetingsResource = class {
1305
+ constructor(http, config) {
1306
+ this.http = http;
1307
+ this.config = config;
1308
+ }
1309
+ listUpcoming() {
1310
+ return this.http.get(`teams/${this.config.team}/meetings/upcoming`);
1311
+ }
1312
+ get(id) {
1313
+ return this.http.get(`meetings/${id}`);
1314
+ }
1315
+ getSummary(id) {
1316
+ return this.http.get(`meetings/${id}/summary`);
1317
+ }
1318
+ join(code) {
1319
+ return this.http.get(`meetings/join/${code}`);
1320
+ }
1321
+ cancel(code) {
1322
+ return this.http.post(`meetings/cancel/${code}`, {});
1323
+ }
1324
+ share(id, recipients) {
1325
+ return this.http.post(`meetings/${id}/share`, { recipients });
1326
+ }
1327
+ update(id, name, notify, speakers) {
1328
+ return this.http.put(`meetings/${id}`, {
1329
+ name,
1330
+ ...notify !== void 0 && { notify },
1331
+ ...speakers !== void 0 && { speakers }
1332
+ });
1333
+ }
1334
+ finalize(id, notify) {
1335
+ return this.http.post(`meetings/${id}/finalize`, { notify });
1336
+ }
1337
+ };
1338
+ //#endregion
1339
+ //#region src/resources/memories.ts
1340
+ var MemoriesResource = class {
1341
+ constructor(http) {
1342
+ this.http = http;
1343
+ }
1344
+ list(params) {
1345
+ const query = new URLSearchParams();
1346
+ if (params?.search) query.set("search", params.search);
1347
+ if (params?.contactId) query.set("contactId", params.contactId);
1348
+ const qs = query.toString();
1349
+ return this.http.get(`memories${qs ? "?" + qs : ""}`);
1350
+ }
1351
+ add(payload) {
1352
+ return this.http.post("memories", payload);
1353
+ }
1354
+ update(id, data) {
1355
+ return this.http.put(`memories/${id}`, data);
1356
+ }
1357
+ delete(id) {
1358
+ return this.http.delete(`memories/${id}`);
1359
+ }
1360
+ };
1361
+ //#endregion
1362
+ //#region src/resources/messages.ts
1363
+ var MessagesResource = class {
1364
+ constructor(http) {
1365
+ this.http = http;
1366
+ }
1367
+ list(team, room, page = 1, perPage = 20) {
1368
+ return this.http.get(`messages?team=${team}&room=${room}&page=${page}&perPage=${perPage}`);
1369
+ }
1370
+ search(team, search) {
1371
+ return this.http.get(`messages/search?search=${encodeURIComponent(search)}`);
1372
+ }
1373
+ delete(messageId) {
1374
+ return this.http.delete(`messages/${messageId}`);
1375
+ }
1376
+ pendingApprovals(teams) {
1377
+ const params = new URLSearchParams();
1378
+ teams.forEach((t) => params.append("teams[]", t));
1379
+ return this.http.get(`messages/pending-approvals?${params.toString()}`);
1380
+ }
1381
+ generateAudio(messageId) {
1382
+ return this.http.post(`messages/${messageId}/audio`, {});
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
+ }
1392
+ };
1393
+ //#endregion
1394
+ //#region src/resources/missions.ts
1395
+ var MissionsResource = class {
1396
+ constructor(http) {
1397
+ this.http = http;
1398
+ }
1399
+ list(agent, page = 1) {
1400
+ return this.http.get(`missions?agent=${agent}&page=${page}`);
1401
+ }
1402
+ get(missionId) {
1403
+ return this.http.get(`missions/${missionId}`);
1404
+ }
1405
+ create(agent, data) {
1406
+ return this.http.post("missions", {
1407
+ agent,
1408
+ ...data
1409
+ });
1410
+ }
1411
+ cancel(missionId) {
1412
+ return this.http.delete(`missions/${missionId}`);
1413
+ }
1414
+ pause(missionId) {
1415
+ return this.http.put(`missions/${missionId}`, { status: "paused" });
1416
+ }
1417
+ resume(missionId) {
1418
+ return this.http.put(`missions/${missionId}`, { status: "active" });
1419
+ }
1420
+ };
1421
+ //#endregion
1422
+ //#region src/resources/notifications.ts
1423
+ var NotificationsResource = class {
1424
+ constructor(http) {
1425
+ this.http = http;
1426
+ }
1427
+ list(page = 1) {
1428
+ return this.http.get(`notifications?page=${page}`);
1429
+ }
1430
+ getUnread() {
1431
+ return this.http.get("notifications?unread");
1432
+ }
1433
+ getSettings() {
1434
+ return this.http.get("notifications/settings");
1435
+ }
1436
+ updateSettings(notificationType, channel) {
1437
+ return this.http.post("notifications/settings", {
1438
+ ntype: notificationType,
1439
+ nchannel: channel
1440
+ });
1441
+ }
1442
+ getAgentSettings() {
1443
+ return this.http.get("notifications/settings/agents");
1444
+ }
1445
+ toggleAgent(agentUuid) {
1446
+ return this.http.post("notifications/settings/agents", { agent: agentUuid });
1447
+ }
1448
+ };
1449
+ //#endregion
1450
+ //#region src/resources/office.ts
1451
+ var OfficeResource = class {
1452
+ constructor(http) {
1453
+ this.http = http;
1454
+ }
1455
+ getSnapshot(team) {
1456
+ return this.http.get(`teams/${team}/office`);
1457
+ }
1458
+ };
1459
+ //#endregion
1460
+ //#region src/resources/orders.ts
1461
+ var OrdersResource = class {
1462
+ constructor(http) {
1463
+ this.http = http;
1464
+ }
1465
+ list(team) {
1466
+ return this.http.get("orders", { headers: { "X-Team": team } });
1467
+ }
1468
+ get(id) {
1469
+ return this.http.get(`orders/${id}`);
1470
+ }
1471
+ create(data) {
1472
+ return this.http.post("orders", data, { headers: { "X-Team": data.team } });
1473
+ }
1474
+ update(id, data) {
1475
+ return this.http.put(`orders/${id}`, data);
1476
+ }
1477
+ delete(id) {
1478
+ return this.http.delete(`orders/${id}`);
1479
+ }
1480
+ pay(id, provider) {
1481
+ return this.http.post(`orders/${id}/pay`, { provider });
1482
+ }
1483
+ };
1484
+ //#endregion
1485
+ //#region src/resources/persona.ts
1486
+ var PersonaResource = class {
1487
+ constructor(http) {
1488
+ this.http = http;
1489
+ }
1490
+ recordAnswer(questionKey, answer) {
1491
+ return this.http.post("persona/answer", {
1492
+ questionKey,
1493
+ answer
1494
+ });
1495
+ }
1496
+ dismiss(questionKey) {
1497
+ return this.http.post("persona/dismiss", { questionKey });
1498
+ }
1499
+ };
1500
+ //#endregion
1501
+ //#region src/resources/products.ts
1502
+ var ProductsResource = class {
1503
+ constructor(http) {
1504
+ this.http = http;
1505
+ }
1506
+ list(team) {
1507
+ const url = team ? `billing/products?team=${team}` : "billing/products";
1508
+ return this.http.get(url);
1509
+ }
1510
+ get(id) {
1511
+ return this.http.get(`billing/products/${id}`);
1512
+ }
1513
+ create(data, teamSlug) {
1514
+ const url = teamSlug ? `billing/products?team=${teamSlug}` : "billing/products";
1515
+ return this.http.post(url, data);
1516
+ }
1517
+ update(id, data) {
1518
+ return this.http.put(`billing/products/${id}`, data);
1519
+ }
1520
+ delete(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 });
1543
+ }
1544
+ };
1545
+ //#endregion
1546
+ //#region src/resources/projects.ts
1547
+ var ProjectsResource = class {
1548
+ constructor(http) {
1549
+ this.http = http;
1550
+ }
1551
+ list(team) {
1552
+ return this.http.get(`teams/${team}/projects`);
1553
+ }
1554
+ get(team, projectId) {
1555
+ return this.http.get(`teams/${team}/projects/${projectId}`);
1556
+ }
1557
+ update(team, agent, projectId, payload) {
1558
+ return this.http.put(`teams/${team}/projects/${projectId}`, {
1559
+ ...payload,
1560
+ agentId: agent
1561
+ });
1562
+ }
1563
+ orchestrate(team, agent, payload) {
1564
+ return this.http.post(`teams/${team}/projects/studio`, {
1565
+ ...payload,
1566
+ agentId: agent
1567
+ });
1568
+ }
1569
+ assist(team, agent, payload) {
1570
+ return this.http.post(`teams/${team}/projects/assist`, {
1571
+ ...payload,
1572
+ agentId: agent
1573
+ });
1574
+ }
1575
+ delete(team, projectId) {
1576
+ return this.http.delete(`teams/${team}/projects/${projectId}`);
1577
+ }
1578
+ produce(team, agent, projectId) {
1579
+ return this.http.post(`teams/${team}/projects/${projectId}/produce`, { agentId: agent });
1580
+ }
1581
+ exportProject(team, agent, projectId) {
1582
+ return this.http.post(`teams/${team}/projects/${projectId}/export`, { agentId: agent });
1583
+ }
1584
+ };
1585
+ //#endregion
1586
+ //#region src/resources/reminders.ts
1587
+ var RemindersResource = class {
1588
+ constructor(http) {
1589
+ this.http = http;
1590
+ }
1591
+ list() {
1592
+ return this.http.get("reminders");
1593
+ }
1594
+ add(payload) {
1595
+ return this.http.post("reminders", payload);
1596
+ }
1597
+ delete(id) {
1598
+ return this.http.delete(`reminders/${id}`);
1599
+ }
1600
+ };
1601
+ //#endregion
1602
+ //#region src/resources/rooms.ts
1603
+ var RoomsResource = class {
1604
+ constructor(http) {
1605
+ this.http = http;
1606
+ }
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}`);
1631
+ }
1632
+ messages(roomId, params) {
1633
+ const query = new URLSearchParams();
1634
+ if (params?.perPage) query.set("perPage", String(params.perPage));
1635
+ const qs = query.toString();
1636
+ return this.http.get(`rooms/${roomId}/messages${qs ? "?" + qs : ""}`);
1637
+ }
1638
+ };
1639
+ //#endregion
1640
+ //#region src/resources/services.ts
1641
+ var ServicesResource = class {
1642
+ constructor(http) {
1643
+ this.http = http;
1644
+ }
1645
+ list(team) {
1646
+ return this.http.get("services");
1647
+ }
1648
+ get(slug) {
1649
+ return this.http.get(`services/${slug}`);
1650
+ }
1651
+ store(team, data) {
1652
+ return this.http.post("services", {
1653
+ team,
1654
+ ...data
1655
+ });
1656
+ }
1657
+ update(id, data) {
1658
+ return this.http.put(`services/${id}`, data);
1659
+ }
1660
+ delete(id) {
1661
+ return this.http.delete(`services/${id}`);
1662
+ }
1663
+ };
1664
+ //#endregion
1665
+ //#region src/resources/shortcuts.ts
1666
+ var ShortcutsResource = class {
1667
+ constructor(http) {
1668
+ this.http = http;
1669
+ }
1670
+ list(agent, page = 1) {
1671
+ return this.http.get(`shortcuts?agent=${agent}&page=${page}`);
1672
+ }
1673
+ create(agent, name, warp, options = {}) {
1674
+ return this.http.post("shortcuts", {
1675
+ agent,
1676
+ name,
1677
+ warp,
1678
+ description: options.description ?? null,
1679
+ inputs: options.inputs ?? null,
1680
+ chat: options.chat ?? false
1681
+ });
1682
+ }
1683
+ update(id, name, warp, options = {}) {
1684
+ return this.http.put(`shortcuts/${id}`, {
1685
+ name,
1686
+ warp,
1687
+ description: options.description ?? null,
1688
+ inputs: options.inputs ?? null,
1689
+ chat: options.chat ?? false
1690
+ });
1691
+ }
1692
+ delete(id) {
1693
+ return this.http.delete(`shortcuts/${id}`);
1694
+ }
1695
+ };
1696
+ //#endregion
1697
+ //#region src/resources/sites.ts
1698
+ var SitesResource = class {
1699
+ constructor(http) {
1700
+ this.http = http;
1701
+ }
1702
+ brands() {
1703
+ return this.http.get("sites/brands");
1704
+ }
1705
+ listMine(teamSlug) {
1706
+ return this.http.get(`sites/mine?team=${encodeURIComponent(teamSlug)}`);
1707
+ }
1708
+ resolve(teamSlug, brandSlug) {
1709
+ const query = brandSlug ? `team=${encodeURIComponent(teamSlug)}&brand=${encodeURIComponent(brandSlug)}` : `team=${encodeURIComponent(teamSlug)}`;
1710
+ return this.http.get(`sites/resolve?${query}`);
1711
+ }
1712
+ resolveByDomain(domain) {
1713
+ return this.http.get(`sites/resolve?domain=${encodeURIComponent(domain)}`);
1714
+ }
1715
+ update(siteId, data) {
1716
+ return this.http.put(`sites/${siteId}`, data);
1717
+ }
1718
+ };
1719
+ //#endregion
1720
+ //#region src/resources/skills.ts
1721
+ var SkillsResource = class {
1722
+ constructor(http) {
1723
+ this.http = http;
1724
+ }
1725
+ list(agent) {
1726
+ return this.http.get(`skills?agent=${encodeURIComponent(agent)}`);
1727
+ }
1728
+ get(id) {
1729
+ return this.http.get(`skills/${id}`);
1730
+ }
1731
+ create(params) {
1732
+ return this.http.post("skills", params);
1733
+ }
1734
+ update(id, data) {
1735
+ return this.http.put(`skills/${id}`, data);
1736
+ }
1737
+ delete(id) {
1738
+ return this.http.delete(`skills/${id}`);
1739
+ }
1740
+ toggle(id) {
1741
+ return this.http.post(`skills/${id}/toggle`);
1742
+ }
1743
+ parseFile(content) {
1744
+ return this.http.post("skills/parse", { content });
1745
+ }
1746
+ importSkill(agent, content) {
1747
+ return this.http.post("skills/import", {
1748
+ agent,
1749
+ content
1750
+ });
1751
+ }
1752
+ exportSkill(id) {
1753
+ return this.http.get(`skills/${id}/export`);
1754
+ }
1755
+ };
1756
+ //#endregion
1757
+ //#region src/resources/stats.ts
1758
+ var StatsResource = class {
1759
+ constructor(http) {
1760
+ this.http = http;
1761
+ }
1762
+ getGamification() {
1763
+ return this.http.get("me/stats");
1764
+ }
1765
+ };
1766
+ //#endregion
1767
+ //#region src/resources/kv.ts
1768
+ var KvResource = class {
632
1769
  constructor(http) {
633
1770
  this.http = http;
634
1771
  }
635
- list(team) {
636
- return this.http.get("orders", { headers: { "X-Team": team } });
1772
+ list() {
1773
+ return this.http.get("stores");
637
1774
  }
638
- get(id) {
639
- return this.http.get(`orders/${id}`);
1775
+ create(payload) {
1776
+ return this.http.post("stores", payload);
640
1777
  }
641
- create(data) {
642
- return this.http.post("orders", data, { headers: { "X-Team": data.team } });
1778
+ entries(params) {
1779
+ const query = new URLSearchParams();
1780
+ if (params?.storeName) query.set("storeName", params.storeName);
1781
+ if (params?.since) query.set("since", params.since);
1782
+ if (params?.until) query.set("until", params.until);
1783
+ if (params?.last != null) query.set("last", String(params.last));
1784
+ const qs = query.toString();
1785
+ return this.http.get(`kv/entries${qs ? "?" + qs : ""}`);
1786
+ }
1787
+ setEntry(payload) {
1788
+ return this.http.post("kv/entries", payload);
1789
+ }
1790
+ appendEntry(payload) {
1791
+ return this.http.post("kv/entries/append", payload);
1792
+ }
1793
+ toggle(storeName) {
1794
+ return this.http.post("kv/toggle", { storeName });
1795
+ }
1796
+ delete(storeName) {
1797
+ return this.http.delete(`kv/${storeName}`);
643
1798
  }
644
1799
  };
645
1800
  //#endregion
646
- //#region src/resources/products.ts
647
- var ProductsResource = class {
1801
+ //#region src/resources/subscriptions.ts
1802
+ var SubscriptionsResource = class {
648
1803
  constructor(http) {
649
1804
  this.http = http;
650
1805
  }
651
1806
  list(team) {
652
- const url = team ? `products?team=${encodeURIComponent(team)}` : "products";
653
- return this.http.get(url);
1807
+ return this.http.get("subscriptions");
654
1808
  }
655
1809
  get(id) {
656
- return this.http.get(`products/${id}`);
1810
+ return this.http.get(`subscriptions/${id}`);
657
1811
  }
658
- create(data) {
659
- return this.http.post("products", data);
1812
+ cancel(id) {
1813
+ return this.http.post(`subscriptions/${id}/cancel`);
660
1814
  }
661
- update(id, data) {
662
- return this.http.put(`products/${id}`, data);
1815
+ resume(id) {
1816
+ return this.http.post(`subscriptions/${id}/resume`);
663
1817
  }
664
- delete(id) {
665
- return this.http.delete(`products/${id}`);
1818
+ cancelPlan(team) {
1819
+ return this.http.post("billing/plans/cancel", { team });
1820
+ }
1821
+ resumePlan(team) {
1822
+ return this.http.post("billing/plans/resume", { team });
666
1823
  }
667
1824
  };
668
1825
  //#endregion
669
- //#region src/resources/reminders.ts
670
- var RemindersResource = class {
1826
+ //#region src/resources/swarms.ts
1827
+ var SwarmsResource = class {
671
1828
  constructor(http) {
672
1829
  this.http = http;
673
1830
  }
674
- list() {
675
- return this.http.get("reminders");
1831
+ listSwarms(team) {
1832
+ return this.http.get(`swarms?team=${team}`);
676
1833
  }
677
- add(payload) {
678
- return this.http.post("reminders", payload);
1834
+ listAgents(swarm) {
1835
+ return this.http.get(`swarms/${swarm}/agents`);
679
1836
  }
680
- delete(id) {
681
- return this.http.delete(`reminders/${id}`);
1837
+ storeProposal(agent, swarm, title, description, actions, attachments, poll) {
1838
+ return this.http.post(`swarms/${swarm}/entities/proposals`, {
1839
+ agent,
1840
+ title,
1841
+ description,
1842
+ actions,
1843
+ attachments,
1844
+ poll
1845
+ });
682
1846
  }
683
- };
684
- //#endregion
685
- //#region src/resources/rooms.ts
686
- var RoomsResource = class {
687
- constructor(http) {
688
- this.http = http;
1847
+ finalizeProposal(swarm, txHash, proposal) {
1848
+ return this.http.post(`swarms/${swarm}/entities/finalize-proposal`, {
1849
+ tx: txHash,
1850
+ proposal
1851
+ });
689
1852
  }
690
- list() {
691
- return this.http.get("rooms");
1853
+ finalizeSignature(swarm, txHash, proposal) {
1854
+ return this.http.post(`swarms/${swarm}/entities/finalize-signature`, {
1855
+ tx: txHash,
1856
+ proposal
1857
+ });
692
1858
  }
693
- messages(roomId, params) {
694
- const query = new URLSearchParams();
695
- if (params?.perPage) query.set("perPage", String(params.perPage));
696
- const qs = query.toString();
697
- return this.http.get(`rooms/${roomId}/messages${qs ? "?" + qs : ""}`);
1859
+ finalizeExecution(chain, txHash, actions) {
1860
+ return this.http.post("swarms/finalize-exec", {
1861
+ chain,
1862
+ tx: txHash,
1863
+ actions: actions || []
1864
+ });
698
1865
  }
699
1866
  };
700
1867
  //#endregion
701
- //#region src/resources/sites.ts
702
- var SitesResource = class {
1868
+ //#region src/resources/tasks.ts
1869
+ var TasksResource = class {
703
1870
  constructor(http) {
704
1871
  this.http = http;
705
1872
  }
706
- listMine(teamSlug) {
707
- return this.http.get(`sites/mine?team=${encodeURIComponent(teamSlug)}`);
708
- }
709
- resolve(teamSlug, brandSlug) {
710
- const query = brandSlug ? `team=${encodeURIComponent(teamSlug)}&brand=${encodeURIComponent(brandSlug)}` : `team=${encodeURIComponent(teamSlug)}`;
711
- return this.http.get(`sites/resolve?${query}`);
1873
+ list(agent, page = 1) {
1874
+ return this.http.get(`tasks?agent=${agent}&page=${page}`);
1875
+ }
1876
+ create(agent, room, warp, options = {}) {
1877
+ return this.http.post("tasks", {
1878
+ agent,
1879
+ room,
1880
+ warp,
1881
+ cron_expression: options.cronExpression,
1882
+ inputs: options.inputs,
1883
+ max_runs: options.maxRuns,
1884
+ starts_at: options.startsAt,
1885
+ ends_at: options.endsAt
1886
+ });
712
1887
  }
713
- resolveByDomain(domain) {
714
- return this.http.get(`sites/resolve?domain=${encodeURIComponent(domain)}`);
1888
+ delete(id) {
1889
+ return this.http.delete(`tasks/${id}`);
715
1890
  }
716
- update(siteSlug, data) {
717
- return this.http.put(`sites/${encodeURIComponent(siteSlug)}`, data);
1891
+ toggle(id) {
1892
+ return this.http.post(`tasks/${id}/toggle`);
718
1893
  }
719
1894
  };
720
1895
  //#endregion
@@ -733,9 +1908,39 @@ var TeamsResource = class {
733
1908
  get(slug) {
734
1909
  return this.http.get(`teams/${encodeURIComponent(slug)}`);
735
1910
  }
1911
+ getPublic(slug) {
1912
+ return this.http.get(`teams/public/${encodeURIComponent(slug)}`);
1913
+ }
1914
+ create(data) {
1915
+ return this.http.post("teams", data);
1916
+ }
1917
+ delete(teamSlug) {
1918
+ return this.http.delete(`teams/${teamSlug}`);
1919
+ }
1920
+ update(teamSlug, data) {
1921
+ return this.http.patch(`teams/${teamSlug}`, data);
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
+ }
736
1929
  invite(teamSlug, payload) {
737
1930
  return this.http.post(`teams/${teamSlug}/invitations`, payload);
738
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
+ }
739
1944
  updateLogo(teamSlug, logo) {
740
1945
  return this.http.post(`teams/${teamSlug}/logo`, { logo });
741
1946
  }
@@ -745,39 +1950,26 @@ var TeamsResource = class {
745
1950
  updateSetting(teamSlug, key, value) {
746
1951
  return this.http.put(`teams/${teamSlug}/settings/${key}`, { value });
747
1952
  }
748
- };
749
- //#endregion
750
- //#region src/resources/stores.ts
751
- var StoresResource = class {
752
- constructor(http) {
753
- this.http = http;
1953
+ listPrivate() {
1954
+ return this.http.get("teams?me=true");
754
1955
  }
755
- list() {
756
- return this.http.get("stores");
757
- }
758
- create(payload) {
759
- return this.http.post("stores", payload);
1956
+ getInviteByToken(token) {
1957
+ return this.http.get(`teams/invite/${token}`);
760
1958
  }
761
- entries(params) {
762
- const query = new URLSearchParams();
763
- if (params?.storeName) query.set("storeName", params.storeName);
764
- if (params?.since) query.set("since", params.since);
765
- if (params?.until) query.set("until", params.until);
766
- if (params?.last != null) query.set("last", String(params.last));
767
- const qs = query.toString();
768
- return this.http.get(`stores/entries${qs ? "?" + qs : ""}`);
1959
+ acceptInvite(slug) {
1960
+ return this.http.post(`teams/${slug}/members/accept`);
769
1961
  }
770
- setEntry(payload) {
771
- return this.http.post("stores/entries", payload);
1962
+ usage(teamSlug) {
1963
+ return this.http.get(`teams/${teamSlug}/usage`);
772
1964
  }
773
- appendEntry(payload) {
774
- return this.http.post("stores/entries/append", payload);
1965
+ featureUsage(teamSlug, feature) {
1966
+ return this.http.get(`teams/${teamSlug}/usage/${feature}`);
775
1967
  }
776
- toggle(storeName) {
777
- return this.http.post("stores/toggle", { storeName });
1968
+ aiCosts(teamSlug, page = 1) {
1969
+ return this.http.get(`teams/${teamSlug}/usage/ai-costs?page=${page}`);
778
1970
  }
779
- delete(storeName) {
780
- return this.http.delete(`stores/${storeName}`);
1971
+ topupFinalize(tx) {
1972
+ return this.http.post("teams/finalize/topup", { tx });
781
1973
  }
782
1974
  };
783
1975
  //#endregion
@@ -816,41 +2008,182 @@ var UpdatesResource = class {
816
2008
  }
817
2009
  };
818
2010
  //#endregion
819
- //#region src/resources/links.ts
820
- var LinksResource = class {
2011
+ //#region src/resources/upgrades.ts
2012
+ var UpgradesResource = class {
821
2013
  constructor(http) {
822
2014
  this.http = http;
823
2015
  }
824
- list(params) {
825
- const query = new URLSearchParams();
826
- if (params?.type) query.set("type", params.type);
827
- if (params?.active != null) query.set("active", String(params.active));
828
- const qs = query.toString();
829
- return this.http.get(`links${qs ? "?" + qs : ""}`);
2016
+ listPendingByTeam(teamSlug) {
2017
+ return this.http.get(`teams/${teamSlug}/upgrades/pending`);
830
2018
  }
831
- create(payload) {
832
- return this.http.post("links", payload);
2019
+ listPendingByAgent(agentId, entityType, status) {
2020
+ const params = new URLSearchParams();
2021
+ if (entityType) params.set("entityType", entityType);
2022
+ if (status) params.set("status", status);
2023
+ const query = params.toString();
2024
+ return this.http.get(`agents/${agentId}/upgrades${query ? `?${query}` : ""}`);
2025
+ }
2026
+ get(agentId, upgradeId) {
2027
+ return this.http.get(`agents/${agentId}/upgrades/${upgradeId}`);
2028
+ }
2029
+ accept(agentId, upgradeId) {
2030
+ return this.http.post(`agents/${agentId}/upgrades/${upgradeId}/accept`);
2031
+ }
2032
+ reject(agentId, upgradeId) {
2033
+ return this.http.post(`agents/${agentId}/upgrades/${upgradeId}/reject`);
2034
+ }
2035
+ propose(agentId, entityType, proposedContent, reason, entityId) {
2036
+ return this.http.post(`agents/${agentId}/upgrades`, {
2037
+ entityType,
2038
+ entityId: entityId || null,
2039
+ proposedContent,
2040
+ reason: reason || null
2041
+ });
833
2042
  }
834
- update(id, payload) {
835
- return this.http.patch(`links/${id}`, payload);
2043
+ };
2044
+ //#endregion
2045
+ //#region src/resources/users.ts
2046
+ var UsersResource = class {
2047
+ constructor(http) {
2048
+ this.http = http;
836
2049
  }
837
- delete(id) {
838
- return this.http.delete(`links/${id}`);
2050
+ getPreference(key) {
2051
+ return this.http.get(`me/preferences/${key}`);
839
2052
  }
840
- stats() {
841
- return this.http.get("links/stats");
2053
+ updatePreference(key, value) {
2054
+ return this.http.put(`me/preferences/${key}`, { value });
842
2055
  }
843
- variations(linkId) {
844
- return this.http.get(`links/${linkId}/variations`);
2056
+ getMe() {
2057
+ return this.http.get("me");
845
2058
  }
846
- createVariation(linkId, payload) {
847
- return this.http.post(`links/${linkId}/variations`, payload);
2059
+ updateMe(name, timezone) {
2060
+ return this.http.post("me/update", {
2061
+ name,
2062
+ timezone
2063
+ });
848
2064
  }
849
- createVariationBatch(linkId, payload) {
850
- return this.http.post(`links/${linkId}/variations/batch`, payload);
2065
+ updateEmail(email) {
2066
+ return this.http.post("me/update-email", { email });
851
2067
  }
852
- deleteVariation(linkId, variationId) {
853
- return this.http.delete(`links/${linkId}/variations/${variationId}`);
2068
+ resendEmailVerification() {
2069
+ return this.http.post("me/resend-email-verification");
2070
+ }
2071
+ deleteMe() {
2072
+ return this.http.post("me/request-delete");
2073
+ }
2074
+ updatePayoutAddress(address, chain) {
2075
+ return this.http.put("me/payout-address", {
2076
+ payoutAddress: address,
2077
+ payoutChain: chain
2078
+ });
2079
+ }
2080
+ getAffiliate(code) {
2081
+ return this.http.get(`affiliates/${code}`);
2082
+ }
2083
+ getAffiliateTiers() {
2084
+ return this.http.get("affiliates/tiers");
2085
+ }
2086
+ storeAffiliate(name, email, application) {
2087
+ return this.http.post("affiliates", {
2088
+ name,
2089
+ email,
2090
+ application
2091
+ });
2092
+ }
2093
+ getEarnings(page) {
2094
+ return this.http.get(`earnings?page=${page}`);
2095
+ }
2096
+ getPayouts(page) {
2097
+ return this.http.get(`payouts?page=${page}`);
2098
+ }
2099
+ requestPayout() {
2100
+ return this.http.post("payouts");
2101
+ }
2102
+ };
2103
+ //#endregion
2104
+ //#region src/resources/voice.ts
2105
+ var VoiceResource = class {
2106
+ constructor(http) {
2107
+ this.http = http;
2108
+ }
2109
+ transcribe(teamSlug, audio, language, prompt) {
2110
+ const formData = new FormData();
2111
+ formData.append("audio", audio, audio.name);
2112
+ formData.append("team", teamSlug);
2113
+ if (language) formData.append("language", language);
2114
+ if (prompt) formData.append("prompt", prompt);
2115
+ return this.http.post("transcribe", formData, { isJson: false });
2116
+ }
2117
+ };
2118
+ //#endregion
2119
+ //#region src/resources/wallets.ts
2120
+ var WalletsResource = class {
2121
+ constructor(http) {
2122
+ this.http = http;
2123
+ }
2124
+ store(agentUuid, provider, chain, address) {
2125
+ return this.http.post("wallets", {
2126
+ agent: agentUuid,
2127
+ provider,
2128
+ chain,
2129
+ address
2130
+ });
2131
+ }
2132
+ delete(agentUuid, chain) {
2133
+ return this.http.delete(`wallets?agent=${agentUuid}&chain=${chain}`);
2134
+ }
2135
+ sort(agentUuid, walletOrders) {
2136
+ return this.http.post("wallets/sort", {
2137
+ agent: agentUuid,
2138
+ walletOrders
2139
+ });
2140
+ }
2141
+ getProviders(agentUuid) {
2142
+ return this.http.get(`wallets/providers?agent=${agentUuid}`);
2143
+ }
2144
+ };
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}`);
854
2187
  }
855
2188
  };
856
2189
  //#endregion
@@ -859,9 +2192,16 @@ var WarpsResource = class {
859
2192
  constructor(http) {
860
2193
  this.http = http;
861
2194
  }
862
- list(brand) {
863
- const url = brand ? `warps?brand=${encodeURIComponent(brand)}` : "warps";
864
- 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 : ""}`);
865
2205
  }
866
2206
  show(identifier) {
867
2207
  return this.http.get(`warps/${identifier}`);
@@ -881,24 +2221,101 @@ var WarpsResource = class {
881
2221
  ...room ? { room } : {}
882
2222
  });
883
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
+ }
884
2284
  };
885
2285
  //#endregion
886
- //#region src/resources/subscriptions.ts
887
- var SubscriptionsResource = class {
2286
+ //#region src/resources/webhooks.ts
2287
+ var WebhooksResource = class {
888
2288
  constructor(http) {
889
2289
  this.http = http;
890
2290
  }
891
- list(team) {
892
- return this.http.get(`subscriptions?team=${encodeURIComponent(team)}`);
2291
+ list(agentId) {
2292
+ return this.http.get(`agents/${agentId}/webhooks`);
893
2293
  }
894
- get(id) {
895
- return this.http.get(`subscriptions/${id}`);
2294
+ create(agentId, name, url, trigger, options) {
2295
+ return this.http.post(`agents/${agentId}/webhooks`, {
2296
+ name,
2297
+ url,
2298
+ trigger,
2299
+ ...options
2300
+ });
896
2301
  }
897
- cancel(id) {
898
- return this.http.post(`subscriptions/${id}/cancel`);
2302
+ update(agentId, webhookId, updates) {
2303
+ return this.http.put(`agents/${agentId}/webhooks/${webhookId}`, updates);
899
2304
  }
900
- resume(id) {
901
- return this.http.post(`subscriptions/${id}/resume`);
2305
+ delete(agentId, webhookId) {
2306
+ return this.http.delete(`agents/${agentId}/webhooks/${webhookId}`);
2307
+ }
2308
+ listWarps(agentId) {
2309
+ return this.http.get(`agents/${agentId}/webhook-warps`);
2310
+ }
2311
+ activateWarp(agentId, payload) {
2312
+ return this.http.post(`agents/${agentId}/webhook-warps`, payload);
2313
+ }
2314
+ deactivateWarp(agentId, warpIdentifier) {
2315
+ return this.http.delete(`agents/${agentId}/webhook-warps?warpIdentifier=${encodeURIComponent(warpIdentifier)}`);
2316
+ }
2317
+ deleteWarpHook(agentId, webhookId) {
2318
+ return this.http.delete(`agents/${agentId}/webhook-warps?webhookId=${encodeURIComponent(webhookId)}`);
902
2319
  }
903
2320
  };
904
2321
  //#endregion
@@ -1016,42 +2433,81 @@ function toWarpEnv(env) {
1016
2433
  }
1017
2434
  var JoAiClient = class {
1018
2435
  constructor(config) {
2436
+ this.isReady = true;
2437
+ this.hasApiToken = false;
1019
2438
  this.env = config.env ?? "mainnet";
2439
+ const apiBaseUrl = getApiBaseUrl(config.env ?? "mainnet");
1020
2440
  const headers = {};
1021
2441
  if (config.team) headers["X-Team"] = config.team;
1022
2442
  if (config.agentAuthKey) headers["X-Agent-Auth-Key"] = config.agentAuthKey;
1023
- 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
+ });
1024
2447
  const cache = config.cache;
1025
2448
  this.http = cache?.enabled !== false ? new CachedHttpService(http, cache?.overrides, cache?.defaultTtl) : http;
1026
- this.appointments = new AppointmentsResource(this.http, config);
1027
- this.hub = new HubResource(this.http);
1028
- this.teams = new TeamsResource(this.http);
1029
2449
  this.agents = new AgentsResource(this.http);
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);
2457
+ this.appointments = new AppointmentsResource(this.http, config);
2458
+ this.auth = new AuthResource(this.http);
2459
+ this.billing = new BillingResource(this.http);
2460
+ this.billingAddresses = new BillingAddressesResource(this.http);
1030
2461
  this.blueprints = new BlueprintsResource(this.http);
2462
+ this.cards = new CardsResource(this.http);
2463
+ this.cart = new CartsResource(this.http);
2464
+ this.changelog = new ChangelogResource(this.http);
2465
+ this.contacts = new ContactsResource(this.http);
2466
+ this.contracts = new ContractsResource(this.http);
2467
+ this.documents = new DocumentsResource(this.http);
1031
2468
  this.flows = new FlowsResource(this.http);
1032
- this.marketplace = new MarketplaceResource(this.http);
1033
- this.services = new ServicesResource(this.http);
1034
- this.skills = new SkillsResource(this.http);
2469
+ this.goals = new GoalsResource(this.http);
2470
+ this.hub = new HubResource(this.http);
1035
2471
  this.ingestions = new IngestionsResource(this.http);
1036
- this.rooms = new RoomsResource(this.http);
1037
- this.contacts = new ContactsResource(this.http);
2472
+ this.inquiries = new InquiriesResource(this.http);
2473
+ this.integrations = new IntegrationsResource(this.http);
2474
+ this.intents = new IntentsResource(this.http);
1038
2475
  this.items = new ItemsResource(this.http);
1039
- this.memories = new MemoriesResource(this.http);
1040
- this.goals = new GoalsResource(this.http);
1041
- this.reminders = new RemindersResource(this.http);
1042
- this.sites = new SitesResource(this.http);
1043
- this.documents = new DocumentsResource(this.http);
1044
- this.meetings = new MeetingsResource(this.http, config);
2476
+ this.links = new LinksResource(this.http);
2477
+ this.loyalty = new LoyaltyResource(this.http);
2478
+ this.store = new StoreResource(this.http);
1045
2479
  this.media = new MediaResource(this.http);
1046
- this.stores = new StoresResource(this.http);
1047
- this.products = new ProductsResource(this.http);
2480
+ this.meetings = new MeetingsResource(this.http, config);
2481
+ this.memories = new MemoriesResource(this.http);
2482
+ this.messages = new MessagesResource(this.http);
2483
+ this.missions = new MissionsResource(this.http);
2484
+ this.notifications = new NotificationsResource(this.http);
2485
+ this.office = new OfficeResource(this.http);
1048
2486
  this.orders = new OrdersResource(this.http);
1049
- this.updates = new UpdatesResource(this.http);
1050
- this.links = new LinksResource(this.http);
2487
+ this.persona = new PersonaResource(this.http);
1051
2488
  this.privateWarps = new WarpsResource(this.http);
2489
+ this.products = new ProductsResource(this.http);
2490
+ this.projects = new ProjectsResource(this.http);
2491
+ this.reminders = new RemindersResource(this.http);
2492
+ this.rooms = new RoomsResource(this.http);
2493
+ this.secrets = new SecretsResource(this.http);
2494
+ this.services = new ServicesResource(this.http);
2495
+ this.shortcuts = new ShortcutsResource(this.http);
2496
+ this.sites = new SitesResource(this.http);
2497
+ this.skills = new SkillsResource(this.http);
2498
+ this.stats = new StatsResource(this.http);
2499
+ this.kv = new KvResource(this.http);
1052
2500
  this.subscriptions = new SubscriptionsResource(this.http);
1053
- this.cart = new CartsResource(this.http);
1054
- this.auth = new AuthResource(this.http);
2501
+ this.swarms = new SwarmsResource(this.http);
2502
+ this.tasks = new TasksResource(this.http);
2503
+ this.teams = new TeamsResource(this.http);
2504
+ this.updates = new UpdatesResource(this.http);
2505
+ this.upgrades = new UpgradesResource(this.http);
2506
+ this.users = new UsersResource(this.http);
2507
+ this.voice = new VoiceResource(this.http);
2508
+ this.wallets = new WalletsResource(this.http);
2509
+ this.webhooks = new WebhooksResource(this.http);
2510
+ this.workspace = new WorkspaceResource(this.http);
1055
2511
  }
1056
2512
  clearCache() {
1057
2513
  if (this.http instanceof CachedHttpService) this.http.clearCache();
@@ -1096,4 +2552,4 @@ var DistributionResource = class {
1096
2552
  }
1097
2553
  };
1098
2554
  //#endregion
1099
- export { AppointmentsResource, AuthResource, BlueprintsResource, CachedHttpService, CartsResource, ContactsResource, DistributionResource, FlowsResource, IngestionsResource, JoAiClient, LinksResource, MarketplaceResource, MeetingsResource, OrdersResource, ProductsResource, ServicesResource, SitesResource, SkillsResource, StoresResource, SubscriptionsResource, WarpsResource, 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 };