@stack0/sdk 0.5.11 → 0.5.14
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/cdn/index.d.mts +62 -3
- package/dist/cdn/index.d.ts +62 -3
- package/dist/cdn/index.js +16 -0
- package/dist/cdn/index.js.map +1 -1
- package/dist/cdn/index.mjs +16 -0
- package/dist/cdn/index.mjs.map +1 -1
- package/dist/crawl/index.d.mts +206 -0
- package/dist/crawl/index.d.ts +206 -0
- package/dist/crawl/index.js +179 -0
- package/dist/crawl/index.js.map +1 -0
- package/dist/crawl/index.mjs +176 -0
- package/dist/crawl/index.mjs.map +1 -0
- package/dist/documents/index.d.mts +84 -0
- package/dist/documents/index.d.ts +84 -0
- package/dist/documents/index.js +144 -0
- package/dist/documents/index.js.map +1 -0
- package/dist/documents/index.mjs +142 -0
- package/dist/documents/index.mjs.map +1 -0
- package/dist/extraction/index.d.mts +1 -1
- package/dist/extraction/index.d.ts +1 -1
- package/dist/index.d.mts +40 -410
- package/dist/index.d.ts +40 -410
- package/dist/index.js +323 -271
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +319 -268
- package/dist/index.mjs.map +1 -1
- package/dist/mail/index.d.mts +35 -2
- package/dist/mail/index.d.ts +35 -2
- package/dist/mail/index.js +46 -0
- package/dist/mail/index.js.map +1 -1
- package/dist/mail/index.mjs +46 -0
- package/dist/mail/index.mjs.map +1 -1
- package/dist/map/index.d.mts +93 -0
- package/dist/map/index.d.ts +93 -0
- package/dist/map/index.js +151 -0
- package/dist/map/index.js.map +1 -0
- package/dist/map/index.mjs +148 -0
- package/dist/map/index.mjs.map +1 -0
- package/dist/screenshots/index.d.mts +1 -1
- package/dist/screenshots/index.d.ts +1 -1
- package/dist/{shared-types-CjKSP5Xc.d.mts → shared-types-DKqZbnMq.d.mts} +1 -1
- package/dist/{shared-types-CjKSP5Xc.d.ts → shared-types-DKqZbnMq.d.ts} +1 -1
- package/package.json +21 -4
package/dist/index.js
CHANGED
|
@@ -84,6 +84,7 @@ var Audiences = class {
|
|
|
84
84
|
constructor(http) {
|
|
85
85
|
this.http = http;
|
|
86
86
|
}
|
|
87
|
+
http;
|
|
87
88
|
/**
|
|
88
89
|
* List all audiences
|
|
89
90
|
*/
|
|
@@ -158,6 +159,7 @@ var Campaigns = class {
|
|
|
158
159
|
constructor(http) {
|
|
159
160
|
this.http = http;
|
|
160
161
|
}
|
|
162
|
+
http;
|
|
161
163
|
/**
|
|
162
164
|
* List all campaigns
|
|
163
165
|
*/
|
|
@@ -234,6 +236,7 @@ var Contacts = class {
|
|
|
234
236
|
constructor(http) {
|
|
235
237
|
this.http = http;
|
|
236
238
|
}
|
|
239
|
+
http;
|
|
237
240
|
/**
|
|
238
241
|
* List all contacts
|
|
239
242
|
*/
|
|
@@ -285,6 +288,7 @@ var Domains = class {
|
|
|
285
288
|
constructor(http) {
|
|
286
289
|
this.http = http;
|
|
287
290
|
}
|
|
291
|
+
http;
|
|
288
292
|
/**
|
|
289
293
|
* List all domains for the organization
|
|
290
294
|
*/
|
|
@@ -331,6 +335,7 @@ var Events = class {
|
|
|
331
335
|
constructor(http) {
|
|
332
336
|
this.http = http;
|
|
333
337
|
}
|
|
338
|
+
http;
|
|
334
339
|
// ============================================================================
|
|
335
340
|
// EVENT DEFINITIONS
|
|
336
341
|
// ============================================================================
|
|
@@ -425,6 +430,7 @@ var Mailboxes = class {
|
|
|
425
430
|
constructor(http) {
|
|
426
431
|
this.http = http;
|
|
427
432
|
}
|
|
433
|
+
http;
|
|
428
434
|
/**
|
|
429
435
|
* Create a new mailbox
|
|
430
436
|
*/
|
|
@@ -488,6 +494,7 @@ var Sequences = class {
|
|
|
488
494
|
constructor(http) {
|
|
489
495
|
this.http = http;
|
|
490
496
|
}
|
|
497
|
+
http;
|
|
491
498
|
// ============================================================================
|
|
492
499
|
// SEQUENCE CRUD
|
|
493
500
|
// ============================================================================
|
|
@@ -659,6 +666,7 @@ var Sequences = class {
|
|
|
659
666
|
if (params.limit) searchParams.set("limit", params.limit.toString());
|
|
660
667
|
if (params.offset) searchParams.set("offset", params.offset.toString());
|
|
661
668
|
if (params.status) searchParams.set("status", params.status);
|
|
669
|
+
if (params.search) searchParams.set("search", params.search);
|
|
662
670
|
const query = searchParams.toString();
|
|
663
671
|
return this.http.get(`/mail/sequences/${id}/entries${query ? `?${query}` : ""}`);
|
|
664
672
|
}
|
|
@@ -695,6 +703,7 @@ var Templates = class {
|
|
|
695
703
|
constructor(http) {
|
|
696
704
|
this.http = http;
|
|
697
705
|
}
|
|
706
|
+
http;
|
|
698
707
|
/**
|
|
699
708
|
* List all templates
|
|
700
709
|
*/
|
|
@@ -797,6 +806,43 @@ var Mail = class {
|
|
|
797
806
|
async send(request) {
|
|
798
807
|
return this.http.post("/mail/send", request);
|
|
799
808
|
}
|
|
809
|
+
/**
|
|
810
|
+
* Reply to an inbound email with correct RFC 5322 threading headers.
|
|
811
|
+
* Automatically derives `from`, `to`, `subject`, `inReplyTo`, and `references`
|
|
812
|
+
* from the inbound webhook payload — pass through any overrides as the second
|
|
813
|
+
* argument.
|
|
814
|
+
*
|
|
815
|
+
* @example
|
|
816
|
+
* ```typescript
|
|
817
|
+
* // In your webhook handler:
|
|
818
|
+
* await mail.reply(inboundEmail, {
|
|
819
|
+
* text: 'Thanks for the note — talk soon.',
|
|
820
|
+
* });
|
|
821
|
+
* ```
|
|
822
|
+
*/
|
|
823
|
+
async reply(inbound, body) {
|
|
824
|
+
const parentId = inbound.messageId;
|
|
825
|
+
const refs = [...inbound.references ?? [], parentId].filter(Boolean);
|
|
826
|
+
const subject = body.subject ?? (inbound.subject?.startsWith("Re:") ? inbound.subject : `Re: ${inbound.subject ?? ""}`);
|
|
827
|
+
const request = {
|
|
828
|
+
from: body.from ?? inbound.mailbox,
|
|
829
|
+
to: body.to ?? inbound.from.email,
|
|
830
|
+
subject,
|
|
831
|
+
text: body.text,
|
|
832
|
+
html: body.html,
|
|
833
|
+
replyTo: body.replyTo,
|
|
834
|
+
cc: body.cc,
|
|
835
|
+
bcc: body.bcc,
|
|
836
|
+
tags: body.tags,
|
|
837
|
+
metadata: body.metadata,
|
|
838
|
+
templateId: body.templateId,
|
|
839
|
+
templateVariables: body.templateVariables,
|
|
840
|
+
environment: body.environment,
|
|
841
|
+
inReplyTo: body.inReplyTo ?? parentId ?? void 0,
|
|
842
|
+
references: body.references ?? (refs.length ? refs.join(" ") : void 0)
|
|
843
|
+
};
|
|
844
|
+
return this.send(request);
|
|
845
|
+
}
|
|
800
846
|
/**
|
|
801
847
|
* Send multiple emails in a batch (up to 100)
|
|
802
848
|
* Each email can have different content and recipients
|
|
@@ -1303,6 +1349,22 @@ var CDN = class {
|
|
|
1303
1349
|
* });
|
|
1304
1350
|
* console.log(`Job started: ${job.id}`);
|
|
1305
1351
|
* ```
|
|
1352
|
+
*
|
|
1353
|
+
* @example Burn in a logo watermark (same config shape as image watermarks)
|
|
1354
|
+
* ```typescript
|
|
1355
|
+
* const job = await cdn.transcode({
|
|
1356
|
+
* projectSlug: 'my-project',
|
|
1357
|
+
* assetId: 'video-asset-id',
|
|
1358
|
+
* outputFormat: 'mp4',
|
|
1359
|
+
* variants: [{ quality: '1080p', codec: 'h264' }],
|
|
1360
|
+
* watermark: {
|
|
1361
|
+
* assetId: 'logo-asset-id',
|
|
1362
|
+
* position: 'bottom-right',
|
|
1363
|
+
* scale: 15, // 15% of the video width
|
|
1364
|
+
* opacity: 80,
|
|
1365
|
+
* },
|
|
1366
|
+
* });
|
|
1367
|
+
* ```
|
|
1306
1368
|
*/
|
|
1307
1369
|
async transcode(request) {
|
|
1308
1370
|
const response = await this.http.post("/cdn/video/transcode", request);
|
|
@@ -3669,6 +3731,232 @@ var Webdata = class {
|
|
|
3669
3731
|
}
|
|
3670
3732
|
};
|
|
3671
3733
|
|
|
3734
|
+
// src/crawl/client.ts
|
|
3735
|
+
var Crawl$ = class {
|
|
3736
|
+
http;
|
|
3737
|
+
constructor(config) {
|
|
3738
|
+
this.http = new HttpClient(config);
|
|
3739
|
+
}
|
|
3740
|
+
/**
|
|
3741
|
+
* Start a crawl.
|
|
3742
|
+
*
|
|
3743
|
+
* @example
|
|
3744
|
+
* ```typescript
|
|
3745
|
+
* const { id } = await stack0.crawl.start({
|
|
3746
|
+
* url: 'https://docs.example.com',
|
|
3747
|
+
* maxDepth: 3,
|
|
3748
|
+
* maxPages: 200,
|
|
3749
|
+
* formats: ['markdown', 'links'],
|
|
3750
|
+
* });
|
|
3751
|
+
* ```
|
|
3752
|
+
*/
|
|
3753
|
+
async start(request) {
|
|
3754
|
+
return this.http.post("/webdata/crawl", request);
|
|
3755
|
+
}
|
|
3756
|
+
/**
|
|
3757
|
+
* Get a crawl by ID. Pass `includePages: true` to include the scraped pages.
|
|
3758
|
+
*/
|
|
3759
|
+
async get(request) {
|
|
3760
|
+
const params = new URLSearchParams();
|
|
3761
|
+
if (request.environment) params.set("environment", request.environment);
|
|
3762
|
+
if (request.projectId) params.set("projectId", request.projectId);
|
|
3763
|
+
if (request.includePages) params.set("includePages", "true");
|
|
3764
|
+
const query = params.toString();
|
|
3765
|
+
return this.http.get(`/webdata/crawl/${request.id}${query ? `?${query}` : ""}`);
|
|
3766
|
+
}
|
|
3767
|
+
async list(request = {}) {
|
|
3768
|
+
const params = new URLSearchParams();
|
|
3769
|
+
if (request.environment) params.set("environment", request.environment);
|
|
3770
|
+
if (request.projectId) params.set("projectId", request.projectId);
|
|
3771
|
+
if (request.status) params.set("status", request.status);
|
|
3772
|
+
if (request.url) params.set("url", request.url);
|
|
3773
|
+
if (request.limit) params.set("limit", String(request.limit));
|
|
3774
|
+
if (request.cursor) params.set("cursor", request.cursor);
|
|
3775
|
+
const query = params.toString();
|
|
3776
|
+
return this.http.get(`/webdata/crawl${query ? `?${query}` : ""}`);
|
|
3777
|
+
}
|
|
3778
|
+
async listPages(request) {
|
|
3779
|
+
const params = new URLSearchParams();
|
|
3780
|
+
if (request.environment) params.set("environment", request.environment);
|
|
3781
|
+
if (request.projectId) params.set("projectId", request.projectId);
|
|
3782
|
+
if (request.limit) params.set("limit", String(request.limit));
|
|
3783
|
+
if (request.cursor) params.set("cursor", request.cursor);
|
|
3784
|
+
const query = params.toString();
|
|
3785
|
+
return this.http.get(
|
|
3786
|
+
`/webdata/crawl/${request.crawlId}/pages${query ? `?${query}` : ""}`
|
|
3787
|
+
);
|
|
3788
|
+
}
|
|
3789
|
+
async cancel(request) {
|
|
3790
|
+
return this.http.post(`/webdata/crawl/${request.id}/cancel`, {
|
|
3791
|
+
environment: request.environment,
|
|
3792
|
+
projectId: request.projectId
|
|
3793
|
+
});
|
|
3794
|
+
}
|
|
3795
|
+
async delete(request) {
|
|
3796
|
+
const params = new URLSearchParams();
|
|
3797
|
+
if (request.environment) params.set("environment", request.environment);
|
|
3798
|
+
if (request.projectId) params.set("projectId", request.projectId);
|
|
3799
|
+
const query = params.toString();
|
|
3800
|
+
return this.http.deleteWithBody(
|
|
3801
|
+
`/webdata/crawl/${request.id}${query ? `?${query}` : ""}`,
|
|
3802
|
+
request
|
|
3803
|
+
);
|
|
3804
|
+
}
|
|
3805
|
+
/**
|
|
3806
|
+
* Start a crawl and poll until it completes. Returns the full Crawl record
|
|
3807
|
+
* with pages included.
|
|
3808
|
+
*/
|
|
3809
|
+
async startAndWait(request, options = {}) {
|
|
3810
|
+
const { pollInterval = 2e3, timeout = 6e5, includePages = true } = options;
|
|
3811
|
+
const { id } = await this.start(request);
|
|
3812
|
+
const start = Date.now();
|
|
3813
|
+
while (Date.now() - start < timeout) {
|
|
3814
|
+
const crawl = await this.get({
|
|
3815
|
+
id,
|
|
3816
|
+
environment: request.environment,
|
|
3817
|
+
projectId: request.projectId,
|
|
3818
|
+
includePages
|
|
3819
|
+
});
|
|
3820
|
+
if (crawl.status === "completed" || crawl.status === "failed" || crawl.status === "cancelled") {
|
|
3821
|
+
if (crawl.status === "failed") throw new Error(crawl.error || "Crawl failed");
|
|
3822
|
+
return crawl;
|
|
3823
|
+
}
|
|
3824
|
+
await new Promise((r) => setTimeout(r, pollInterval));
|
|
3825
|
+
}
|
|
3826
|
+
throw new Error("Crawl timed out");
|
|
3827
|
+
}
|
|
3828
|
+
};
|
|
3829
|
+
|
|
3830
|
+
// src/map/client.ts
|
|
3831
|
+
var Map$ = class {
|
|
3832
|
+
http;
|
|
3833
|
+
constructor(config) {
|
|
3834
|
+
this.http = new HttpClient(config);
|
|
3835
|
+
}
|
|
3836
|
+
/**
|
|
3837
|
+
* Start a map job.
|
|
3838
|
+
*
|
|
3839
|
+
* @example
|
|
3840
|
+
* ```typescript
|
|
3841
|
+
* const { id } = await stack0.map.create({
|
|
3842
|
+
* url: 'https://docs.example.com',
|
|
3843
|
+
* search: 'api',
|
|
3844
|
+
* limit: 1000,
|
|
3845
|
+
* });
|
|
3846
|
+
* ```
|
|
3847
|
+
*/
|
|
3848
|
+
async create(request) {
|
|
3849
|
+
return this.http.post("/webdata/map", request);
|
|
3850
|
+
}
|
|
3851
|
+
async get(request) {
|
|
3852
|
+
const params = new URLSearchParams();
|
|
3853
|
+
if (request.environment) params.set("environment", request.environment);
|
|
3854
|
+
if (request.projectId) params.set("projectId", request.projectId);
|
|
3855
|
+
const query = params.toString();
|
|
3856
|
+
return this.http.get(`/webdata/map/${request.id}${query ? `?${query}` : ""}`);
|
|
3857
|
+
}
|
|
3858
|
+
async list(request = {}) {
|
|
3859
|
+
const params = new URLSearchParams();
|
|
3860
|
+
if (request.environment) params.set("environment", request.environment);
|
|
3861
|
+
if (request.projectId) params.set("projectId", request.projectId);
|
|
3862
|
+
if (request.status) params.set("status", request.status);
|
|
3863
|
+
if (request.limit) params.set("limit", String(request.limit));
|
|
3864
|
+
if (request.cursor) params.set("cursor", request.cursor);
|
|
3865
|
+
const query = params.toString();
|
|
3866
|
+
return this.http.get(`/webdata/map${query ? `?${query}` : ""}`);
|
|
3867
|
+
}
|
|
3868
|
+
async delete(request) {
|
|
3869
|
+
const params = new URLSearchParams();
|
|
3870
|
+
if (request.environment) params.set("environment", request.environment);
|
|
3871
|
+
if (request.projectId) params.set("projectId", request.projectId);
|
|
3872
|
+
const query = params.toString();
|
|
3873
|
+
return this.http.deleteWithBody(
|
|
3874
|
+
`/webdata/map/${request.id}${query ? `?${query}` : ""}`,
|
|
3875
|
+
request
|
|
3876
|
+
);
|
|
3877
|
+
}
|
|
3878
|
+
/**
|
|
3879
|
+
* Create a map job and poll until it completes. Maps usually finish in
|
|
3880
|
+
* seconds, so default timeout is generous.
|
|
3881
|
+
*/
|
|
3882
|
+
async createAndWait(request, options = {}) {
|
|
3883
|
+
const { pollInterval = 1e3, timeout = 12e4 } = options;
|
|
3884
|
+
const { id } = await this.create(request);
|
|
3885
|
+
const start = Date.now();
|
|
3886
|
+
while (Date.now() - start < timeout) {
|
|
3887
|
+
const result = await this.get({ id, environment: request.environment, projectId: request.projectId });
|
|
3888
|
+
if (result.status === "completed" || result.status === "failed") {
|
|
3889
|
+
if (result.status === "failed") throw new Error(result.error || "Map failed");
|
|
3890
|
+
return result;
|
|
3891
|
+
}
|
|
3892
|
+
await new Promise((r) => setTimeout(r, pollInterval));
|
|
3893
|
+
}
|
|
3894
|
+
throw new Error("Map timed out");
|
|
3895
|
+
}
|
|
3896
|
+
};
|
|
3897
|
+
|
|
3898
|
+
// src/documents/client.ts
|
|
3899
|
+
var Documents = class {
|
|
3900
|
+
http;
|
|
3901
|
+
constructor(config) {
|
|
3902
|
+
this.http = new HttpClient(config);
|
|
3903
|
+
}
|
|
3904
|
+
/**
|
|
3905
|
+
* Parse a document from a URL or a previously-uploaded file URL.
|
|
3906
|
+
*
|
|
3907
|
+
* @example
|
|
3908
|
+
* ```typescript
|
|
3909
|
+
* const { id } = await stack0.documents.parse({
|
|
3910
|
+
* url: 'https://example.com/whitepaper.pdf',
|
|
3911
|
+
* });
|
|
3912
|
+
* ```
|
|
3913
|
+
*/
|
|
3914
|
+
async parse(request) {
|
|
3915
|
+
return this.http.post("/webdata/documents", request);
|
|
3916
|
+
}
|
|
3917
|
+
async get(request) {
|
|
3918
|
+
const params = new URLSearchParams();
|
|
3919
|
+
if (request.environment) params.set("environment", request.environment);
|
|
3920
|
+
if (request.projectId) params.set("projectId", request.projectId);
|
|
3921
|
+
const q = params.toString();
|
|
3922
|
+
return this.http.get(`/webdata/documents/${request.id}${q ? `?${q}` : ""}`);
|
|
3923
|
+
}
|
|
3924
|
+
async list(request = {}) {
|
|
3925
|
+
const params = new URLSearchParams();
|
|
3926
|
+
if (request.environment) params.set("environment", request.environment);
|
|
3927
|
+
if (request.projectId) params.set("projectId", request.projectId);
|
|
3928
|
+
if (request.status) params.set("status", request.status);
|
|
3929
|
+
if (request.limit) params.set("limit", String(request.limit));
|
|
3930
|
+
if (request.cursor) params.set("cursor", request.cursor);
|
|
3931
|
+
const q = params.toString();
|
|
3932
|
+
return this.http.get(`/webdata/documents${q ? `?${q}` : ""}`);
|
|
3933
|
+
}
|
|
3934
|
+
async delete(request) {
|
|
3935
|
+
const params = new URLSearchParams();
|
|
3936
|
+
if (request.environment) params.set("environment", request.environment);
|
|
3937
|
+
if (request.projectId) params.set("projectId", request.projectId);
|
|
3938
|
+
const q = params.toString();
|
|
3939
|
+
return this.http.deleteWithBody(
|
|
3940
|
+
`/webdata/documents/${request.id}${q ? `?${q}` : ""}`,
|
|
3941
|
+
request
|
|
3942
|
+
);
|
|
3943
|
+
}
|
|
3944
|
+
async parseAndWait(request, options = {}) {
|
|
3945
|
+
const { pollInterval = 2e3, timeout = 18e4 } = options;
|
|
3946
|
+
const { id } = await this.parse(request);
|
|
3947
|
+
const start = Date.now();
|
|
3948
|
+
while (Date.now() - start < timeout) {
|
|
3949
|
+
const doc = await this.get({ id, environment: request.environment, projectId: request.projectId });
|
|
3950
|
+
if (doc.status === "completed" || doc.status === "failed") {
|
|
3951
|
+
if (doc.status === "failed") throw new Error(doc.error || "Document parsing failed");
|
|
3952
|
+
return doc;
|
|
3953
|
+
}
|
|
3954
|
+
await new Promise((r) => setTimeout(r, pollInterval));
|
|
3955
|
+
}
|
|
3956
|
+
throw new Error("Document parsing timed out");
|
|
3957
|
+
}
|
|
3958
|
+
};
|
|
3959
|
+
|
|
3672
3960
|
// src/integrations/client.ts
|
|
3673
3961
|
var CRM = class {
|
|
3674
3962
|
http;
|
|
@@ -5273,281 +5561,19 @@ var Workflows = class {
|
|
|
5273
5561
|
}
|
|
5274
5562
|
};
|
|
5275
5563
|
|
|
5276
|
-
// src/memory/agents.ts
|
|
5277
|
-
var MemoryAgents = class {
|
|
5278
|
-
constructor(http) {
|
|
5279
|
-
this.http = http;
|
|
5280
|
-
}
|
|
5281
|
-
/**
|
|
5282
|
-
* Create a new memory agent
|
|
5283
|
-
*/
|
|
5284
|
-
async create(request) {
|
|
5285
|
-
return this.http.post("/memory/agents", request);
|
|
5286
|
-
}
|
|
5287
|
-
/**
|
|
5288
|
-
* List all memory agents
|
|
5289
|
-
*/
|
|
5290
|
-
async list(params = {}) {
|
|
5291
|
-
const qs = new URLSearchParams();
|
|
5292
|
-
if (params.environment) qs.set("environment", params.environment);
|
|
5293
|
-
const q = qs.toString();
|
|
5294
|
-
return this.http.get(`/memory/agents${q ? `?${q}` : ""}`);
|
|
5295
|
-
}
|
|
5296
|
-
/**
|
|
5297
|
-
* Get a memory agent by ID
|
|
5298
|
-
*/
|
|
5299
|
-
async get(agentId) {
|
|
5300
|
-
return this.http.get(`/memory/agents/${agentId}`);
|
|
5301
|
-
}
|
|
5302
|
-
/**
|
|
5303
|
-
* Update a memory agent
|
|
5304
|
-
*/
|
|
5305
|
-
async update(agentId, request) {
|
|
5306
|
-
return this.http.patch(`/memory/agents/${agentId}`, request);
|
|
5307
|
-
}
|
|
5308
|
-
/**
|
|
5309
|
-
* Delete a memory agent
|
|
5310
|
-
*/
|
|
5311
|
-
async delete(agentId) {
|
|
5312
|
-
return this.http.delete(`/memory/agents/${agentId}`);
|
|
5313
|
-
}
|
|
5314
|
-
};
|
|
5315
|
-
|
|
5316
|
-
// src/memory/collections.ts
|
|
5317
|
-
var MemoryCollections = class {
|
|
5318
|
-
constructor(http) {
|
|
5319
|
-
this.http = http;
|
|
5320
|
-
}
|
|
5321
|
-
/**
|
|
5322
|
-
* Create a new collection for an agent
|
|
5323
|
-
*/
|
|
5324
|
-
async create(request) {
|
|
5325
|
-
return this.http.post(`/memory/agents/${request.agentId}/collections`, {
|
|
5326
|
-
name: request.name,
|
|
5327
|
-
slug: request.slug,
|
|
5328
|
-
description: request.description,
|
|
5329
|
-
compaction: request.compaction,
|
|
5330
|
-
retention: request.retention
|
|
5331
|
-
});
|
|
5332
|
-
}
|
|
5333
|
-
/**
|
|
5334
|
-
* List all collections for an agent
|
|
5335
|
-
*/
|
|
5336
|
-
async list(agentId) {
|
|
5337
|
-
return this.http.get(`/memory/agents/${agentId}/collections`);
|
|
5338
|
-
}
|
|
5339
|
-
/**
|
|
5340
|
-
* Get a collection by slug
|
|
5341
|
-
*/
|
|
5342
|
-
async get(agentId, collectionSlug) {
|
|
5343
|
-
return this.http.get(`/memory/agents/${agentId}/collections/${collectionSlug}`);
|
|
5344
|
-
}
|
|
5345
|
-
/**
|
|
5346
|
-
* Update a collection
|
|
5347
|
-
*/
|
|
5348
|
-
async update(agentId, collectionSlug, request) {
|
|
5349
|
-
return this.http.patch(
|
|
5350
|
-
`/memory/agents/${agentId}/collections/${collectionSlug}`,
|
|
5351
|
-
request
|
|
5352
|
-
);
|
|
5353
|
-
}
|
|
5354
|
-
/**
|
|
5355
|
-
* Delete a collection
|
|
5356
|
-
*/
|
|
5357
|
-
async delete(agentId, collectionSlug) {
|
|
5358
|
-
return this.http.delete(`/memory/agents/${agentId}/collections/${collectionSlug}`);
|
|
5359
|
-
}
|
|
5360
|
-
/**
|
|
5361
|
-
* Get collection statistics
|
|
5362
|
-
*/
|
|
5363
|
-
async stats(agentId, collectionSlug) {
|
|
5364
|
-
return this.http.get(
|
|
5365
|
-
`/memory/agents/${agentId}/collections/${collectionSlug}/stats`
|
|
5366
|
-
);
|
|
5367
|
-
}
|
|
5368
|
-
/**
|
|
5369
|
-
* Trigger compaction for a collection
|
|
5370
|
-
*/
|
|
5371
|
-
async compact(agentId, collectionSlug, request = {}) {
|
|
5372
|
-
return this.http.post(
|
|
5373
|
-
`/memory/agents/${agentId}/collections/${collectionSlug}/compact`,
|
|
5374
|
-
request
|
|
5375
|
-
);
|
|
5376
|
-
}
|
|
5377
|
-
/**
|
|
5378
|
-
* Get a compaction job by ID
|
|
5379
|
-
*/
|
|
5380
|
-
async getCompactionJob(agentId, collectionSlug, jobId) {
|
|
5381
|
-
return this.http.get(
|
|
5382
|
-
`/memory/agents/${agentId}/collections/${collectionSlug}/compact/${jobId}`
|
|
5383
|
-
);
|
|
5384
|
-
}
|
|
5385
|
-
};
|
|
5386
|
-
|
|
5387
|
-
// src/memory/entities.ts
|
|
5388
|
-
var MemoryEntities = class {
|
|
5389
|
-
constructor(http) {
|
|
5390
|
-
this.http = http;
|
|
5391
|
-
}
|
|
5392
|
-
async list(params) {
|
|
5393
|
-
const qs = new URLSearchParams();
|
|
5394
|
-
qs.set("agentId", params.agentId);
|
|
5395
|
-
if (params.type) qs.set("type", params.type);
|
|
5396
|
-
if (params.limit) qs.set("limit", params.limit.toString());
|
|
5397
|
-
if (params.offset) qs.set("offset", params.offset.toString());
|
|
5398
|
-
const q = qs.toString();
|
|
5399
|
-
return this.http.get(`/memory/entities${q ? `?${q}` : ""}`);
|
|
5400
|
-
}
|
|
5401
|
-
async get(entityId) {
|
|
5402
|
-
return this.http.get(`/memory/entities/${entityId}`);
|
|
5403
|
-
}
|
|
5404
|
-
async getRelations(entityId) {
|
|
5405
|
-
return this.http.get(`/memory/entities/${entityId}/relations`);
|
|
5406
|
-
}
|
|
5407
|
-
};
|
|
5408
|
-
|
|
5409
|
-
// src/memory/client.ts
|
|
5410
|
-
var Memory = class {
|
|
5411
|
-
http;
|
|
5412
|
-
/** Manage memory agents */
|
|
5413
|
-
agents;
|
|
5414
|
-
/** Manage memory collections */
|
|
5415
|
-
collections;
|
|
5416
|
-
/** Manage extracted entities */
|
|
5417
|
-
entities;
|
|
5418
|
-
constructor(config) {
|
|
5419
|
-
this.http = new HttpClient(config);
|
|
5420
|
-
this.agents = new MemoryAgents(this.http);
|
|
5421
|
-
this.collections = new MemoryCollections(this.http);
|
|
5422
|
-
this.entities = new MemoryEntities(this.http);
|
|
5423
|
-
}
|
|
5424
|
-
// ============================================================================
|
|
5425
|
-
// MEMORY OPERATIONS
|
|
5426
|
-
// ============================================================================
|
|
5427
|
-
/**
|
|
5428
|
-
* Store a memory
|
|
5429
|
-
*
|
|
5430
|
-
* @example
|
|
5431
|
-
* ```typescript
|
|
5432
|
-
* const memory = await stack0.memory.store({
|
|
5433
|
-
* agentId: 'agent_123',
|
|
5434
|
-
* content: 'User prefers dark mode',
|
|
5435
|
-
* type: 'preference',
|
|
5436
|
-
* tags: ['ui', 'settings'],
|
|
5437
|
-
* });
|
|
5438
|
-
* ```
|
|
5439
|
-
*/
|
|
5440
|
-
async store(request) {
|
|
5441
|
-
return this.http.post("/memory/memories", request);
|
|
5442
|
-
}
|
|
5443
|
-
/**
|
|
5444
|
-
* Store multiple memories in a batch
|
|
5445
|
-
*
|
|
5446
|
-
* @example
|
|
5447
|
-
* ```typescript
|
|
5448
|
-
* const results = await stack0.memory.storeBatch({
|
|
5449
|
-
* agentId: 'agent_123',
|
|
5450
|
-
* memories: [
|
|
5451
|
-
* { content: 'User prefers dark mode', type: 'preference' },
|
|
5452
|
-
* { content: 'User is based in NYC', type: 'fact' },
|
|
5453
|
-
* ],
|
|
5454
|
-
* });
|
|
5455
|
-
* ```
|
|
5456
|
-
*/
|
|
5457
|
-
async storeBatch(request) {
|
|
5458
|
-
return this.http.post("/memory/memories/batch", request);
|
|
5459
|
-
}
|
|
5460
|
-
/**
|
|
5461
|
-
* Recall memories using semantic search (vector similarity)
|
|
5462
|
-
*
|
|
5463
|
-
* @example
|
|
5464
|
-
* ```typescript
|
|
5465
|
-
* const results = await stack0.memory.recall({
|
|
5466
|
-
* agentId: 'agent_123',
|
|
5467
|
-
* query: 'What are the user preferences?',
|
|
5468
|
-
* limit: 10,
|
|
5469
|
-
* });
|
|
5470
|
-
* ```
|
|
5471
|
-
*/
|
|
5472
|
-
async recall(request) {
|
|
5473
|
-
return this.http.post("/memory/memories/recall", request);
|
|
5474
|
-
}
|
|
5475
|
-
/**
|
|
5476
|
-
* Search memories using full-text search
|
|
5477
|
-
*
|
|
5478
|
-
* @example
|
|
5479
|
-
* ```typescript
|
|
5480
|
-
* const results = await stack0.memory.search({
|
|
5481
|
-
* agentId: 'agent_123',
|
|
5482
|
-
* query: 'dark mode',
|
|
5483
|
-
* limit: 20,
|
|
5484
|
-
* });
|
|
5485
|
-
* ```
|
|
5486
|
-
*/
|
|
5487
|
-
async search(request) {
|
|
5488
|
-
return this.http.post("/memory/memories/search", request);
|
|
5489
|
-
}
|
|
5490
|
-
/**
|
|
5491
|
-
* Get a memory by ID
|
|
5492
|
-
*/
|
|
5493
|
-
async get(memoryId) {
|
|
5494
|
-
return this.http.get(`/memory/memories/${memoryId}`);
|
|
5495
|
-
}
|
|
5496
|
-
/**
|
|
5497
|
-
* List memories with optional filters
|
|
5498
|
-
*
|
|
5499
|
-
* @example
|
|
5500
|
-
* ```typescript
|
|
5501
|
-
* const memories = await stack0.memory.list({
|
|
5502
|
-
* agentId: 'agent_123',
|
|
5503
|
-
* type: 'preference',
|
|
5504
|
-
* limit: 50,
|
|
5505
|
-
* });
|
|
5506
|
-
* ```
|
|
5507
|
-
*/
|
|
5508
|
-
async list(params) {
|
|
5509
|
-
const qs = new URLSearchParams();
|
|
5510
|
-
qs.set("agentId", params.agentId);
|
|
5511
|
-
if (params.collectionSlug) qs.set("collectionSlug", params.collectionSlug);
|
|
5512
|
-
if (params.type) qs.set("type", params.type);
|
|
5513
|
-
if (params.tier) qs.set("tier", params.tier);
|
|
5514
|
-
if (params.limit) qs.set("limit", params.limit.toString());
|
|
5515
|
-
if (params.offset) qs.set("offset", params.offset.toString());
|
|
5516
|
-
if (params.sortBy) qs.set("sortBy", params.sortBy);
|
|
5517
|
-
if (params.sortOrder) qs.set("sortOrder", params.sortOrder);
|
|
5518
|
-
const q = qs.toString();
|
|
5519
|
-
return this.http.get(`/memory/memories${q ? `?${q}` : ""}`);
|
|
5520
|
-
}
|
|
5521
|
-
/**
|
|
5522
|
-
* Update a memory
|
|
5523
|
-
*/
|
|
5524
|
-
async update(memoryId, request) {
|
|
5525
|
-
return this.http.patch(`/memory/memories/${memoryId}`, request);
|
|
5526
|
-
}
|
|
5527
|
-
/**
|
|
5528
|
-
* Delete a memory by ID
|
|
5529
|
-
*/
|
|
5530
|
-
async delete(memoryId) {
|
|
5531
|
-
return this.http.delete(`/memory/memories/${memoryId}`);
|
|
5532
|
-
}
|
|
5533
|
-
/**
|
|
5534
|
-
* Delete multiple memories
|
|
5535
|
-
*/
|
|
5536
|
-
async deleteMany(request) {
|
|
5537
|
-
return this.http.deleteWithBody("/memory/memories", request);
|
|
5538
|
-
}
|
|
5539
|
-
};
|
|
5540
|
-
|
|
5541
5564
|
// src/index.ts
|
|
5542
5565
|
var Stack0 = class {
|
|
5566
|
+
http;
|
|
5543
5567
|
mail;
|
|
5544
5568
|
cdn;
|
|
5545
5569
|
screenshots;
|
|
5546
5570
|
extraction;
|
|
5571
|
+
crawl;
|
|
5572
|
+
map;
|
|
5573
|
+
documents;
|
|
5547
5574
|
integrations;
|
|
5548
5575
|
marketing;
|
|
5549
5576
|
workflows;
|
|
5550
|
-
memory;
|
|
5551
5577
|
/**
|
|
5552
5578
|
* @deprecated Use `screenshots` and `extraction` instead. Will be removed in a future version.
|
|
5553
5579
|
*/
|
|
@@ -5557,16 +5583,41 @@ var Stack0 = class {
|
|
|
5557
5583
|
apiKey: config.apiKey,
|
|
5558
5584
|
baseUrl: config.baseUrl
|
|
5559
5585
|
};
|
|
5586
|
+
this.http = new HttpClient(clientConfig);
|
|
5560
5587
|
this.mail = new Mail(clientConfig);
|
|
5561
5588
|
this.cdn = new CDN(clientConfig, config.cdnUrl);
|
|
5562
5589
|
this.screenshots = new Screenshots(clientConfig);
|
|
5563
5590
|
this.extraction = new Extraction(clientConfig);
|
|
5591
|
+
this.crawl = new Crawl$(clientConfig);
|
|
5592
|
+
this.map = new Map$(clientConfig);
|
|
5593
|
+
this.documents = new Documents(clientConfig);
|
|
5564
5594
|
this.integrations = new Integrations(clientConfig);
|
|
5565
5595
|
this.marketing = new Marketing(clientConfig);
|
|
5566
5596
|
this.workflows = new Workflows(clientConfig);
|
|
5567
|
-
this.memory = new Memory(clientConfig);
|
|
5568
5597
|
this.webdata = new Webdata(clientConfig);
|
|
5569
5598
|
}
|
|
5599
|
+
// ============================================================================
|
|
5600
|
+
// PROJECTS
|
|
5601
|
+
// ============================================================================
|
|
5602
|
+
async listProjects() {
|
|
5603
|
+
return this.http.get("/projects");
|
|
5604
|
+
}
|
|
5605
|
+
async getProject(id) {
|
|
5606
|
+
return this.http.get(`/projects/${id}`);
|
|
5607
|
+
}
|
|
5608
|
+
async getProjectBySlug(slug) {
|
|
5609
|
+
return this.http.get(`/projects/by-slug/${slug}`);
|
|
5610
|
+
}
|
|
5611
|
+
async createProject(request) {
|
|
5612
|
+
return this.http.post("/projects", request);
|
|
5613
|
+
}
|
|
5614
|
+
async updateProject(request) {
|
|
5615
|
+
const { id, ...data } = request;
|
|
5616
|
+
return this.http.patch(`/projects/${id}`, data);
|
|
5617
|
+
}
|
|
5618
|
+
async deleteProject(id) {
|
|
5619
|
+
return this.http.delete(`/projects/${id}`);
|
|
5620
|
+
}
|
|
5570
5621
|
};
|
|
5571
5622
|
var src_default = Stack0;
|
|
5572
5623
|
|
|
@@ -5574,17 +5625,18 @@ exports.Audiences = Audiences;
|
|
|
5574
5625
|
exports.CDN = CDN;
|
|
5575
5626
|
exports.Campaigns = Campaigns;
|
|
5576
5627
|
exports.Contacts = Contacts;
|
|
5628
|
+
exports.Crawl = Crawl$;
|
|
5629
|
+
exports.Crawl$ = Crawl$;
|
|
5630
|
+
exports.Documents = Documents;
|
|
5577
5631
|
exports.Domains = Domains;
|
|
5578
5632
|
exports.Events = Events;
|
|
5579
5633
|
exports.Extraction = Extraction;
|
|
5580
5634
|
exports.Integrations = Integrations;
|
|
5581
5635
|
exports.Mail = Mail;
|
|
5582
5636
|
exports.Mailboxes = Mailboxes;
|
|
5637
|
+
exports.Map = Map$;
|
|
5638
|
+
exports.Map$ = Map$;
|
|
5583
5639
|
exports.Marketing = Marketing;
|
|
5584
|
-
exports.Memory = Memory;
|
|
5585
|
-
exports.MemoryAgents = MemoryAgents;
|
|
5586
|
-
exports.MemoryCollections = MemoryCollections;
|
|
5587
|
-
exports.MemoryEntities = MemoryEntities;
|
|
5588
5640
|
exports.Screenshots = Screenshots;
|
|
5589
5641
|
exports.Sequences = Sequences;
|
|
5590
5642
|
exports.Stack0 = Stack0;
|