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