@joai/sdk 0.3.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -360,6 +360,7 @@ type Blueprint = {
360
360
  description: string | null;
361
361
  avatar: string | null;
362
362
  settings: BlueprintSettings;
363
+ documentCount: number;
363
364
  verified: boolean;
364
365
  createdAt: string;
365
366
  locales: WarpLocale[];
@@ -798,10 +799,18 @@ declare class ContactsResource {
798
799
  declare class DocumentsResource {
799
800
  private readonly http;
800
801
  constructor(http: IHttpService);
801
- ingest(payload: {
802
+ list(agent: string, search?: string): Promise<IAppResponse<Document[]>>;
803
+ create(agent: string, data: {
802
804
  title: string;
803
805
  content: string;
806
+ blueprint?: string;
804
807
  }): Promise<IAppResponse<Document>>;
808
+ get(id: string): Promise<IAppResponse<Document>>;
809
+ update(id: string, data: {
810
+ title?: string;
811
+ content?: string;
812
+ }): Promise<IAppResponse<Document>>;
813
+ delete(id: string): Promise<IAppResponse<unknown>>;
805
814
  }
806
815
  //#endregion
807
816
  //#region src/resources/goals.d.ts
@@ -896,11 +905,12 @@ declare class SitesResource {
896
905
  private readonly http;
897
906
  constructor(http: IHttpService);
898
907
  listMine(teamSlug: string): Promise<IAppResponse<Site[]>>;
899
- resolve(teamSlug: string, brandSlug: string): Promise<IAppResponse<Site>>;
908
+ resolve(teamSlug: string, brandSlug?: string): Promise<IAppResponse<Site>>;
900
909
  resolveByDomain(domain: string): Promise<IAppResponse<Site>>;
901
910
  update(siteSlug: string, data: {
902
911
  customDomain?: string | null;
903
912
  enabled?: boolean;
913
+ modules?: string[];
904
914
  }): Promise<IAppResponse<{
905
915
  updated: boolean;
906
916
  }>>;
@@ -938,7 +948,7 @@ declare class WarpsResource {
938
948
  brand: string;
939
949
  definition: Record<string, any>;
940
950
  public?: boolean;
941
- }, authKey?: string): Promise<IAppResponse<{
951
+ }): Promise<IAppResponse<{
942
952
  id: string;
943
953
  }>>;
944
954
  destroy(identifier: string): Promise<IAppResponse<unknown>>;
@@ -949,6 +959,7 @@ interface JoAiClientConfig {
949
959
  apiToken?: string;
950
960
  team?: string;
951
961
  env?: AppEnv;
962
+ agentAuthKey?: string;
952
963
  }
953
964
  declare class JoAiClient {
954
965
  readonly http: IHttpService;
package/dist/index.mjs CHANGED
@@ -288,8 +288,22 @@ var DocumentsResource = class {
288
288
  constructor(http) {
289
289
  this.http = http;
290
290
  }
291
- ingest(payload) {
292
- return this.http.post("documents", payload);
291
+ list(agent, search) {
292
+ const params = new URLSearchParams();
293
+ if (search) params.set("search", search);
294
+ return this.http.get(`agents/${agent}/documents?${params.toString()}`);
295
+ }
296
+ create(agent, data) {
297
+ return this.http.post(`agents/${agent}/documents`, data);
298
+ }
299
+ get(id) {
300
+ return this.http.get(`documents/${id}`);
301
+ }
302
+ update(id, data) {
303
+ return this.http.put(`documents/${id}`, data);
304
+ }
305
+ delete(id) {
306
+ return this.http.delete(`documents/${id}`);
293
307
  }
294
308
  };
295
309
  //#endregion
@@ -420,7 +434,8 @@ var SitesResource = class {
420
434
  return this.http.get(`sites/mine?team=${encodeURIComponent(teamSlug)}`);
421
435
  }
422
436
  resolve(teamSlug, brandSlug) {
423
- return this.http.get(`sites/resolve?team=${encodeURIComponent(teamSlug)}&brand=${encodeURIComponent(brandSlug)}`);
437
+ const query = brandSlug ? `team=${encodeURIComponent(teamSlug)}&brand=${encodeURIComponent(brandSlug)}` : `team=${encodeURIComponent(teamSlug)}`;
438
+ return this.http.get(`sites/resolve?${query}`);
424
439
  }
425
440
  resolveByDomain(domain) {
426
441
  return this.http.get(`sites/resolve?domain=${encodeURIComponent(domain)}`);
@@ -455,8 +470,8 @@ var WarpsResource = class {
455
470
  show(identifier) {
456
471
  return this.http.get(`warps/${identifier}`);
457
472
  }
458
- create(data, authKey) {
459
- return this.http.post("warps", data, { headers: authKey ? { "X-Agent-Auth-Key": authKey } : void 0 });
473
+ create(data) {
474
+ return this.http.post("warps", data);
460
475
  }
461
476
  destroy(identifier) {
462
477
  return this.http.delete(`warps/${identifier}`);
@@ -472,7 +487,10 @@ function toWarpEnv(env) {
472
487
  var JoAiClient = class {
473
488
  constructor(config) {
474
489
  this.env = config.env ?? "mainnet";
475
- this.http = new HttpService(`${getApiBaseUrl(config.env ?? "mainnet")}/v1`, void 0, config.apiToken, { headers: config.team ? { "X-Team": config.team } : void 0 });
490
+ const headers = {};
491
+ if (config.team) headers["X-Team"] = config.team;
492
+ if (config.agentAuthKey) headers["X-Agent-Auth-Key"] = config.agentAuthKey;
493
+ this.http = new HttpService(`${getApiBaseUrl(config.env ?? "mainnet")}/v1`, void 0, config.apiToken, { headers });
476
494
  this.hub = new HubResource(this.http);
477
495
  this.teams = new TeamsResource(this.http);
478
496
  this.agents = new AgentsResource(this.http);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@joai/sdk",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "description": "JoAi public API SDK — build with your AI agents",
5
5
  "license": "MIT",
6
6
  "type": "module",