@joai/sdk 0.20.0 → 1.0.1

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.d.mts CHANGED
@@ -121,7 +121,7 @@ type Flow = {
121
121
  updatedAt: string;
122
122
  steps: FlowStep[];
123
123
  locales: WarpLocale[];
124
- marketplace: StoreInfo;
124
+ store: StoreInfo;
125
125
  screenshots: string[];
126
126
  };
127
127
  type FlowStep = {
@@ -775,7 +775,7 @@ type Skill = {
775
775
  sourcePath: string | null;
776
776
  scope?: SkillScopeValue;
777
777
  active: boolean;
778
- marketplace: StoreInfo;
778
+ store: StoreInfo;
779
779
  createdAt: string;
780
780
  media?: Media[];
781
781
  screenshots: string[];
@@ -806,7 +806,7 @@ type Integration = {
806
806
  meta?: IntegrationMeta;
807
807
  details?: IntegrationDetails;
808
808
  };
809
- type SocialPlatform = 'telegram' | 'slack' | 'whatsapp' | 'twilio' | 'discord' | 'github';
809
+ type SocialPlatform = 'telegram' | 'slack' | 'whatsapp' | 'sms' | 'discord' | 'github';
810
810
  type SocialBot = {
811
811
  name: string;
812
812
  createdAt: string;
@@ -875,7 +875,7 @@ type Agent = {
875
875
  avatar: string;
876
876
  wallets: Wallet[];
877
877
  settings: AgentSettings;
878
- marketplace: StoreInfo;
878
+ store: StoreInfo;
879
879
  character?: AgentCharacter | null;
880
880
  room: Room;
881
881
  role: string | null;
@@ -889,7 +889,7 @@ type AgentPrivate = {
889
889
  avatar: string;
890
890
  wallets: Wallet[];
891
891
  settings: AgentSettings;
892
- marketplace: StoreInfo;
892
+ store: StoreInfo;
893
893
  password: string | null;
894
894
  authKey: string | null;
895
895
  secKey: string;
@@ -924,7 +924,7 @@ type AgentSettings = {
924
924
  auto: boolean;
925
925
  'model.url': string;
926
926
  'voice.output': boolean;
927
- 'voice.id': string;
927
+ 'voice.id': string | null;
928
928
  'agent.gender'?: AgentGender;
929
929
  'proactivity.enabled': boolean;
930
930
  'proactivity.quietHoursStart'?: number;
@@ -1106,7 +1106,7 @@ type StoreAgent = {
1106
1106
  name: string | null;
1107
1107
  bio: string | null;
1108
1108
  } | null;
1109
- marketplace: StoreInfo;
1109
+ store: StoreInfo;
1110
1110
  screenshots: string[];
1111
1111
  mcpEndpoint: string;
1112
1112
  a2aCard: string;
@@ -1139,8 +1139,8 @@ type StorePriceTier = {
1139
1139
  label: string;
1140
1140
  };
1141
1141
  /**
1142
- * Normalized representation of any marketplace entity for use in checkout flows.
1143
- * All marketplace entities share a `.marketplace: StoreInfo` property —
1142
+ * Normalized representation of any store entity for use in checkout flows.
1143
+ * All store entities share a `.store: StoreInfo` property —
1144
1144
  * combine that with the entity type and ID to construct this.
1145
1145
  */
1146
1146
  type StorePurchaseResult = {
@@ -1189,7 +1189,7 @@ type Blueprint = {
1189
1189
  verified: boolean;
1190
1190
  createdAt: string;
1191
1191
  locales: WarpLocale[];
1192
- marketplace: StoreInfo;
1192
+ store: StoreInfo;
1193
1193
  tags: string[];
1194
1194
  screenshots: string[];
1195
1195
  };
@@ -2312,6 +2312,7 @@ type LoyaltyReward = {
2312
2312
  pointsCost: number;
2313
2313
  config: Record<string, JsonValue> | null;
2314
2314
  sortOrder: number;
2315
+ createdAt: string;
2315
2316
  };
2316
2317
  type LoyaltyTier = {
2317
2318
  id: string;
@@ -2392,10 +2393,21 @@ type Pass = {
2392
2393
  team: Team;
2393
2394
  points: number;
2394
2395
  tier: string | null;
2395
- walletUrl: string | null;
2396
+ benefit: {
2397
+ pointName: string | null;
2398
+ earning: {
2399
+ type: 'per_visit' | 'per_spend' | 'per_item' | 'per_category';
2400
+ value: number;
2401
+ minimumSpendCents: number | null;
2402
+ currency: string | null;
2403
+ };
2404
+ reward: {
2405
+ name: string;
2406
+ pointsCost: number;
2407
+ };
2408
+ } | null;
2396
2409
  };
2397
2410
  type LoyaltyMember = {
2398
- id: string;
2399
2411
  contactId: string;
2400
2412
  contactName: string;
2401
2413
  points: number;
@@ -2607,7 +2619,7 @@ declare class AgentsResource {
2607
2619
  delete(uuid: string): Promise<IAppResponse<void>>;
2608
2620
  updatePassword(uuid: string, password: string): Promise<IAppResponse<void>>;
2609
2621
  storePassword(uuid: string, password: string): Promise<IAppResponse<AgentPrivate>>;
2610
- updateSetting(uuid: string, key: keyof AgentSettings, value: boolean | string | number | string[] | null): Promise<IAppResponse<AgentPrivate>>;
2622
+ updateSetting<K extends keyof AgentSettings>(uuid: string, key: K, value: AgentSettings[K]): Promise<IAppResponse<AgentPrivate>>;
2611
2623
  updateMeta(uuid: string, key: string, value: Record<string, unknown> | null): Promise<IAppResponse<AgentPrivate>>;
2612
2624
  publish(uuid: string): Promise<IAppResponse<AgentPrivate>>;
2613
2625
  unpublish(uuid: string): Promise<IAppResponse<AgentPrivate>>;
@@ -3244,7 +3256,9 @@ declare class LinksResource {
3244
3256
  declare class LoyaltyResource {
3245
3257
  private readonly http;
3246
3258
  constructor(http: IHttpService);
3247
- getProgram(): Promise<IAppResponse<LoyaltyProgram>>;
3259
+ getProgram(params?: {
3260
+ team?: string;
3261
+ }): Promise<IAppResponse<LoyaltyProgram>>;
3248
3262
  updateProgram(data: {
3249
3263
  name?: string;
3250
3264
  settings?: ProgramSettings;
@@ -3317,7 +3331,7 @@ declare class LoyaltyResource {
3317
3331
  redeem(contactId: string, rewardId: string): Promise<IAppResponse<RedeemResponse>>;
3318
3332
  adjustPoints(contactId: string, points: number, reason: string): Promise<IAppResponse<LoyaltyAccount>>;
3319
3333
  getTransactionHistory(contactId: string): Promise<IAppResponse<LoyaltyTransaction[]>>;
3320
- listMembers(): Promise<IAppResponse<LoyaltyMember[]>>;
3334
+ listMembers(): Promise<IAppResponse<PaginatedResponse<LoyaltyMember>>>;
3321
3335
  getPass(contact: string): Promise<IAppResponse<Pass>>;
3322
3336
  generatePass(contact: string, platform: 'apple' | 'google'): Promise<IAppResponse<{
3323
3337
  url: string | null;
@@ -3613,6 +3627,7 @@ declare class RemindersResource {
3613
3627
  declare class RoomsResource {
3614
3628
  private readonly http;
3615
3629
  constructor(http: IHttpService);
3630
+ get(id: string): Promise<IAppResponse<Room>>;
3616
3631
  list(options?: {
3617
3632
  team?: string;
3618
3633
  agent?: string;
@@ -3712,7 +3727,7 @@ declare class SkillsResource {
3712
3727
  isPublic?: boolean;
3713
3728
  price?: number;
3714
3729
  }): Promise<IAppResponse<Skill>>;
3715
- update(id: string, data: Partial<Omit<Skill, 'media' | 'marketplace'>> & {
3730
+ update(id: string, data: Partial<Omit<Skill, 'media' | 'store'>> & {
3716
3731
  media?: MediaLibraryItems;
3717
3732
  public?: boolean;
3718
3733
  price?: number;
@@ -4177,6 +4192,7 @@ declare class CachedHttpService implements IHttpService {
4177
4192
  private cache;
4178
4193
  private ttlMap;
4179
4194
  private defaultTtl;
4195
+ private cacheVersion;
4180
4196
  onNetworkError: (error: Error) => void;
4181
4197
  onUnauthorized: (response: IAppResponse<JsonValue>) => void;
4182
4198
  onSuccessfulResponse: (response: IAppResponse<JsonValue>) => void;
@@ -4189,6 +4205,8 @@ declare class CachedHttpService implements IHttpService {
4189
4205
  put<T>(url: string, data?: JsonValue | FormData, options?: IRequestOptions): Promise<IAppResponse<T>>;
4190
4206
  patch<T>(url: string, data?: JsonValue | FormData, options?: IRequestOptions): Promise<IAppResponse<T>>;
4191
4207
  delete<T>(url: string, options?: IRequestOptions): Promise<IAppResponse<T>>;
4208
+ private mutate;
4209
+ private bust;
4192
4210
  }
4193
4211
  //#endregion
4194
4212
  //#region src/resources/distribution.d.ts
package/dist/index.mjs CHANGED
@@ -130,7 +130,7 @@ var AgentsResource = class {
130
130
  return this.http.post("agents", params);
131
131
  }
132
132
  update(uuid, name, description, avatar) {
133
- return this.http.put(`agents/${uuid}`, {
133
+ return this.http.patch(`agents/${uuid}`, {
134
134
  name,
135
135
  description,
136
136
  avatar
@@ -540,18 +540,18 @@ var BillingResource = class {
540
540
  return this.http.get(`billing/plans?type=${type}`);
541
541
  }
542
542
  checkoutProduct(id) {
543
- return this.http.get(`billing/products/${id}`);
543
+ return this.http.get(`products/${id}`);
544
544
  }
545
545
  orders(team, page = 1, contactId) {
546
- let params = `billing/orders?page=${page}`;
546
+ let params = `orders?page=${page}`;
547
547
  if (contactId) params += `&contactId=${encodeURIComponent(contactId)}`;
548
548
  return this.http.get(params);
549
549
  }
550
550
  payOrder(id, provider) {
551
- return this.http.post(`billing/orders/${id}/pay`, { provider });
551
+ return this.http.post(`orders/${id}/pay`, { provider });
552
552
  }
553
553
  deleteOrder(id) {
554
- return this.http.delete(`billing/orders/${id}`);
554
+ return this.http.delete(`orders/${id}`);
555
555
  }
556
556
  paymentAccount(team, provider) {
557
557
  return this.http.get(`payment-accounts/${provider}`, { headers: { "X-Team": team } });
@@ -619,8 +619,7 @@ var BlueprintsResource = class {
619
619
  return this.http.post("blueprints", data);
620
620
  }
621
621
  assemble(blueprint, team, name) {
622
- return this.http.post("blueprints/assemble", {
623
- blueprint,
622
+ return this.http.post(`blueprints/${blueprint}/assemble`, {
624
623
  team,
625
624
  name
626
625
  });
@@ -856,7 +855,7 @@ var DocumentsResource = class {
856
855
  });
857
856
  }
858
857
  uploadFile(agentUuid, name, document) {
859
- return this.http.post("documents", {
858
+ return this.http.post("documents/upload", {
860
859
  agent: agentUuid,
861
860
  name,
862
861
  document
@@ -1115,8 +1114,9 @@ var LoyaltyResource = class {
1115
1114
  constructor(http) {
1116
1115
  this.http = http;
1117
1116
  }
1118
- getProgram() {
1119
- return this.http.get("loyalty/program");
1117
+ getProgram(params) {
1118
+ const query = params?.team ? `?team=${encodeURIComponent(params.team)}` : "";
1119
+ return this.http.get(`loyalty/program${query}`);
1120
1120
  }
1121
1121
  updateProgram(data) {
1122
1122
  return this.http.patch("loyalty/program", data);
@@ -1202,7 +1202,7 @@ var StoreResource = class {
1202
1202
  this.http = http;
1203
1203
  }
1204
1204
  async get(locale = "en") {
1205
- const res = await this.http.get(`store?locale=${locale}`);
1205
+ const res = await this.http.get(`billing/catalog?locale=${locale}`);
1206
1206
  if (!res.ok || !res.data) return {
1207
1207
  blueprints: [],
1208
1208
  skills: [],
@@ -1248,10 +1248,10 @@ var StoreResource = class {
1248
1248
  return this.http.get(`billing/commissions?team=${encodeURIComponent(teamSlug)}`);
1249
1249
  }
1250
1250
  priceTiers() {
1251
- return this.http.get("marketplace/price-tiers");
1251
+ return this.http.get("billing/price-tiers");
1252
1252
  }
1253
1253
  purchase(entityType, entityId, paymentMethod = "balance") {
1254
- return this.http.post("marketplace/purchase", {
1254
+ return this.http.post("billing/purchase", {
1255
1255
  entityType,
1256
1256
  entityId,
1257
1257
  paymentMethod
@@ -1355,7 +1355,7 @@ var MemoriesResource = class {
1355
1355
  return this.http.get(`memories${qs ? "?" + qs : ""}`);
1356
1356
  }
1357
1357
  add(payload) {
1358
- return this.http.post("memories", payload);
1358
+ return this.http.post(`agents/${payload.agentId}/memories`, payload);
1359
1359
  }
1360
1360
  update(id, data) {
1361
1361
  return this.http.put(`memories/${id}`, data);
@@ -1516,41 +1516,41 @@ var ProductsResource = class {
1516
1516
  this.http = http;
1517
1517
  }
1518
1518
  list() {
1519
- return this.http.get("billing/products");
1519
+ return this.http.get("products");
1520
1520
  }
1521
1521
  get(id) {
1522
- return this.http.get(`billing/products/${id}`);
1522
+ return this.http.get(`products/${id}`);
1523
1523
  }
1524
1524
  create(data, teamSlug) {
1525
- const url = teamSlug ? `billing/products?team=${teamSlug}` : "billing/products";
1525
+ const url = teamSlug ? `products?team=${teamSlug}` : "products";
1526
1526
  return this.http.post(url, data);
1527
1527
  }
1528
1528
  update(id, data) {
1529
- return this.http.put(`billing/products/${id}`, data);
1529
+ return this.http.put(`products/${id}`, data);
1530
1530
  }
1531
1531
  delete(id) {
1532
- return this.http.delete(`billing/products/${id}`);
1532
+ return this.http.delete(`products/${id}`);
1533
1533
  }
1534
1534
  createVariation(productSlug, data) {
1535
- return this.http.post(`billing/products/${productSlug}/variations`, data);
1535
+ return this.http.post(`products/${productSlug}/variations`, data);
1536
1536
  }
1537
1537
  updateVariation(variationId, data) {
1538
- return this.http.put(`billing/products/variations/${variationId}`, data);
1538
+ return this.http.put(`products/variations/${variationId}`, data);
1539
1539
  }
1540
1540
  sortVariations(ids) {
1541
- return this.http.post("billing/products/variations/sort", { ids });
1541
+ return this.http.post("products/variations/sort", { ids });
1542
1542
  }
1543
1543
  deleteVariation(variationId) {
1544
- return this.http.delete(`billing/products/variations/${variationId}`);
1544
+ return this.http.delete(`products/variations/${variationId}`);
1545
1545
  }
1546
1546
  createRelation(productSlug, data) {
1547
- return this.http.post(`billing/products/${productSlug}/relations`, data);
1547
+ return this.http.post(`products/${productSlug}/relations`, data);
1548
1548
  }
1549
1549
  deleteRelation(productSlug, relatedProductId) {
1550
- return this.http.delete(`billing/products/${productSlug}/relations?relatedProductId=${relatedProductId}`);
1550
+ return this.http.delete(`products/${productSlug}/relations?relatedProductId=${relatedProductId}`);
1551
1551
  }
1552
1552
  updateVolumePrices(productSlug, data) {
1553
- return this.http.put(`billing/products/${productSlug}/volume-prices`, { prices: data });
1553
+ return this.http.put(`products/${productSlug}/volume-prices`, { prices: data });
1554
1554
  }
1555
1555
  };
1556
1556
  //#endregion
@@ -1587,7 +1587,10 @@ var ProjectsResource = class {
1587
1587
  return this.http.delete(`teams/${team}/projects/${projectId}`);
1588
1588
  }
1589
1589
  produce(team, agent, projectId) {
1590
- return this.http.post(`teams/${team}/projects/${projectId}/produce`, { agentId: agent });
1590
+ return this.http.post(`studio/projects/${projectId}/produce`, {
1591
+ agentId: agent,
1592
+ team
1593
+ });
1591
1594
  }
1592
1595
  exportProject(team, agent, projectId) {
1593
1596
  return this.http.post(`teams/${team}/projects/${projectId}/export`, { agentId: agent });
@@ -1603,7 +1606,7 @@ var RemindersResource = class {
1603
1606
  return this.http.get("reminders");
1604
1607
  }
1605
1608
  add(payload) {
1606
- return this.http.post("reminders", payload);
1609
+ return this.http.post(`agents/${payload.agentId}/reminders`, payload);
1607
1610
  }
1608
1611
  delete(id) {
1609
1612
  return this.http.delete(`reminders/${id}`);
@@ -1615,6 +1618,9 @@ var RoomsResource = class {
1615
1618
  constructor(http) {
1616
1619
  this.http = http;
1617
1620
  }
1621
+ get(id) {
1622
+ return this.http.get(`rooms/${id}`);
1623
+ }
1618
1624
  list(options) {
1619
1625
  const params = new URLSearchParams();
1620
1626
  if (options) {
@@ -1781,10 +1787,10 @@ var KvResource = class {
1781
1787
  this.http = http;
1782
1788
  }
1783
1789
  list() {
1784
- return this.http.get("stores");
1790
+ return this.http.get("kv");
1785
1791
  }
1786
1792
  create(payload) {
1787
- return this.http.post("stores", payload);
1793
+ return this.http.post("kv", payload);
1788
1794
  }
1789
1795
  entries(params) {
1790
1796
  const query = new URLSearchParams();
@@ -2224,7 +2230,7 @@ var WarpsResource = class {
2224
2230
  return this.http.post("warps", data);
2225
2231
  }
2226
2232
  update(identifier, data) {
2227
- return this.http.put(`warps/${identifier}`, data);
2233
+ return this.http.patch(`warps/${identifier}`, data);
2228
2234
  }
2229
2235
  destroy(identifier) {
2230
2236
  return this.http.delete(`warps/${identifier}`);
@@ -2314,7 +2320,7 @@ var WebhooksResource = class {
2314
2320
  });
2315
2321
  }
2316
2322
  update(agentId, webhookId, updates) {
2317
- return this.http.put(`agents/${agentId}/webhooks/${webhookId}`, updates);
2323
+ return this.http.patch(`agents/${agentId}/webhooks/${webhookId}`, updates);
2318
2324
  }
2319
2325
  delete(agentId, webhookId) {
2320
2326
  return this.http.delete(`agents/${agentId}/webhooks/${webhookId}`);
@@ -2366,7 +2372,7 @@ const DEFAULT_TTL = 15e3;
2366
2372
  const DEFAULTS = {
2367
2373
  blueprints: 3e5,
2368
2374
  flows: 3e5,
2369
- marketplace: 3e5,
2375
+ "billing/catalog": 3e5,
2370
2376
  skills: 3e5,
2371
2377
  sites: 3e5,
2372
2378
  stores: 3e4,
@@ -2394,6 +2400,7 @@ var CachedHttpService = class {
2394
2400
  constructor(inner, overrides, defaultTtl) {
2395
2401
  this.inner = inner;
2396
2402
  this.cache = new MemoryCache();
2403
+ this.cacheVersion = 0;
2397
2404
  this.onNetworkError = () => {};
2398
2405
  this.onUnauthorized = () => {};
2399
2406
  this.onSuccessfulResponse = () => {};
@@ -2408,34 +2415,40 @@ var CachedHttpService = class {
2408
2415
  this.defaultTtl = defaultTtl ?? DEFAULT_TTL;
2409
2416
  }
2410
2417
  clearCache() {
2418
+ this.cacheVersion++;
2411
2419
  this.cache.clear();
2412
2420
  }
2413
2421
  async get(url, options) {
2414
2422
  const cached = this.cache.get(url);
2415
2423
  if (cached !== void 0) return cached;
2424
+ const cacheVersion = this.cacheVersion;
2416
2425
  const response = await this.inner.get(url, options);
2417
- if (response.ok) this.cache.set(url, response, getTtl(url, this.ttlMap, this.defaultTtl));
2426
+ if (response.ok && cacheVersion === this.cacheVersion) this.cache.set(url, response, getTtl(url, this.ttlMap, this.defaultTtl));
2418
2427
  return response;
2419
2428
  }
2420
2429
  async post(url, data, options) {
2421
- const response = await this.inner.post(url, data, options);
2422
- this.cache.bust(getUrlPrefix(url));
2423
- return response;
2430
+ return this.mutate(getUrlPrefix(url), () => this.inner.post(url, data, options));
2424
2431
  }
2425
2432
  async put(url, data, options) {
2426
- const response = await this.inner.put(url, data, options);
2427
- this.cache.bust(getUrlPrefix(url));
2428
- return response;
2433
+ return this.mutate(getUrlPrefix(url), () => this.inner.put(url, data, options));
2429
2434
  }
2430
2435
  async patch(url, data, options) {
2431
- const response = await this.inner.patch(url, data, options);
2432
- this.cache.bust(getUrlPrefix(url));
2433
- return response;
2436
+ return this.mutate(getUrlPrefix(url), () => this.inner.patch(url, data, options));
2434
2437
  }
2435
2438
  async delete(url, options) {
2436
- const response = await this.inner.delete(url, options);
2437
- this.cache.bust(getUrlPrefix(url));
2438
- return response;
2439
+ return this.mutate(getUrlPrefix(url), () => this.inner.delete(url, options));
2440
+ }
2441
+ async mutate(prefix, request) {
2442
+ this.bust(prefix);
2443
+ try {
2444
+ return await request();
2445
+ } finally {
2446
+ this.bust(prefix);
2447
+ }
2448
+ }
2449
+ bust(prefix) {
2450
+ this.cacheVersion++;
2451
+ this.cache.bust(prefix);
2439
2452
  }
2440
2453
  };
2441
2454
  //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@joai/sdk",
3
- "version": "0.20.0",
3
+ "version": "1.0.1",
4
4
  "description": "JoAi public API SDK — build with your AI agents",
5
5
  "license": "MIT",
6
6
  "type": "module",