@stack0/sdk 0.5.8 → 0.5.11
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/README.md +1026 -369
- package/dist/cdn/index.d.mts +316 -1
- package/dist/cdn/index.d.ts +316 -1
- package/dist/cdn/index.js +219 -0
- package/dist/cdn/index.js.map +1 -1
- package/dist/cdn/index.mjs +219 -0
- package/dist/cdn/index.mjs.map +1 -1
- package/dist/index.d.mts +934 -8
- package/dist/index.d.ts +934 -8
- package/dist/index.js +927 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +922 -1
- package/dist/index.mjs.map +1 -1
- package/dist/mail/index.d.mts +147 -1
- package/dist/mail/index.d.ts +147 -1
- package/dist/mail/index.js +67 -0
- package/dist/mail/index.js.map +1 -1
- package/dist/mail/index.mjs +67 -1
- package/dist/mail/index.mjs.map +1 -1
- package/package.json +9 -6
package/dist/index.js
CHANGED
|
@@ -420,6 +420,69 @@ var Events = class {
|
|
|
420
420
|
}
|
|
421
421
|
};
|
|
422
422
|
|
|
423
|
+
// src/mail/mailboxes.ts
|
|
424
|
+
var Mailboxes = class {
|
|
425
|
+
constructor(http) {
|
|
426
|
+
this.http = http;
|
|
427
|
+
}
|
|
428
|
+
/**
|
|
429
|
+
* Create a new mailbox
|
|
430
|
+
*/
|
|
431
|
+
async create(request) {
|
|
432
|
+
return this.http.post("/mail/mailboxes", request);
|
|
433
|
+
}
|
|
434
|
+
/**
|
|
435
|
+
* Get a mailbox by ID
|
|
436
|
+
*/
|
|
437
|
+
async get(id) {
|
|
438
|
+
return this.http.get(`/mail/mailboxes/${id}`);
|
|
439
|
+
}
|
|
440
|
+
/**
|
|
441
|
+
* List mailboxes with optional filters
|
|
442
|
+
*/
|
|
443
|
+
async list(request) {
|
|
444
|
+
const params = new URLSearchParams();
|
|
445
|
+
if (request?.projectSlug) params.set("projectSlug", request.projectSlug);
|
|
446
|
+
if (request?.environment) params.set("environment", request.environment);
|
|
447
|
+
if (request?.domain) params.set("domain", request.domain);
|
|
448
|
+
if (request?.status) params.set("status", request.status);
|
|
449
|
+
if (request?.limit) params.set("limit", String(request.limit));
|
|
450
|
+
if (request?.cursor) params.set("cursor", request.cursor);
|
|
451
|
+
const qs = params.toString();
|
|
452
|
+
return this.http.get(`/mail/mailboxes${qs ? `?${qs}` : ""}`);
|
|
453
|
+
}
|
|
454
|
+
/**
|
|
455
|
+
* Update a mailbox
|
|
456
|
+
*/
|
|
457
|
+
async update(request) {
|
|
458
|
+
const { id, ...data } = request;
|
|
459
|
+
return this.http.patch(`/mail/mailboxes/${id}`, data);
|
|
460
|
+
}
|
|
461
|
+
/**
|
|
462
|
+
* Delete a mailbox
|
|
463
|
+
*/
|
|
464
|
+
async delete(id) {
|
|
465
|
+
return this.http.delete(`/mail/mailboxes/${id}`);
|
|
466
|
+
}
|
|
467
|
+
/**
|
|
468
|
+
* List inbound messages across mailboxes
|
|
469
|
+
*/
|
|
470
|
+
async listMessages(request) {
|
|
471
|
+
const params = new URLSearchParams();
|
|
472
|
+
if (request?.mailboxId) params.set("mailboxId", request.mailboxId);
|
|
473
|
+
if (request?.limit) params.set("limit", String(request.limit));
|
|
474
|
+
if (request?.cursor) params.set("cursor", request.cursor);
|
|
475
|
+
const qs = params.toString();
|
|
476
|
+
return this.http.get(`/mail/mailboxes/messages${qs ? `?${qs}` : ""}`);
|
|
477
|
+
}
|
|
478
|
+
/**
|
|
479
|
+
* Get an inbound message by ID
|
|
480
|
+
*/
|
|
481
|
+
async getMessage(id) {
|
|
482
|
+
return this.http.get(`/mail/mailboxes/messages/${id}`);
|
|
483
|
+
}
|
|
484
|
+
};
|
|
485
|
+
|
|
423
486
|
// src/mail/sequences.ts
|
|
424
487
|
var Sequences = class {
|
|
425
488
|
constructor(http) {
|
|
@@ -702,6 +765,8 @@ var Mail = class {
|
|
|
702
765
|
sequences;
|
|
703
766
|
/** Track and manage custom events */
|
|
704
767
|
events;
|
|
768
|
+
/** Manage agent mailboxes */
|
|
769
|
+
mailboxes;
|
|
705
770
|
constructor(config) {
|
|
706
771
|
this.http = new HttpClient(config);
|
|
707
772
|
this.domains = new Domains(this.http);
|
|
@@ -711,6 +776,7 @@ var Mail = class {
|
|
|
711
776
|
this.campaigns = new Campaigns(this.http);
|
|
712
777
|
this.sequences = new Sequences(this.http);
|
|
713
778
|
this.events = new Events(this.http);
|
|
779
|
+
this.mailboxes = new Mailboxes(this.http);
|
|
714
780
|
}
|
|
715
781
|
// ============================================================================
|
|
716
782
|
// TRANSACTIONAL EMAILS
|
|
@@ -963,6 +1029,27 @@ var CDN = class {
|
|
|
963
1029
|
}
|
|
964
1030
|
return this.confirmUpload(assetId);
|
|
965
1031
|
}
|
|
1032
|
+
/**
|
|
1033
|
+
* Upload a file from a remote URL (server-side fetch).
|
|
1034
|
+
* The server streams the file directly from the source URL into storage,
|
|
1035
|
+
* so the client never touches the bytes. Ideal for serverless environments
|
|
1036
|
+
* with tight memory limits.
|
|
1037
|
+
*
|
|
1038
|
+
* @example
|
|
1039
|
+
* ```typescript
|
|
1040
|
+
* const asset = await cdn.uploadFromUrl({
|
|
1041
|
+
* projectSlug: 'my-project',
|
|
1042
|
+
* sourceUrl: 'https://replicate.delivery/output/video.mp4',
|
|
1043
|
+
* filename: 'video.mp4',
|
|
1044
|
+
* mimeType: 'video/mp4',
|
|
1045
|
+
* });
|
|
1046
|
+
* console.log(asset.cdnUrl);
|
|
1047
|
+
* ```
|
|
1048
|
+
*/
|
|
1049
|
+
async uploadFromUrl(request) {
|
|
1050
|
+
const response = await this.http.post("/cdn/upload-from-url", request);
|
|
1051
|
+
return this.convertAssetDates(response);
|
|
1052
|
+
}
|
|
966
1053
|
/**
|
|
967
1054
|
* Get an asset by ID
|
|
968
1055
|
*
|
|
@@ -2015,6 +2102,204 @@ var CDN = class {
|
|
|
2015
2102
|
convertMergeJobWithOutputDates(job) {
|
|
2016
2103
|
return this.convertMergeJobDates(job);
|
|
2017
2104
|
}
|
|
2105
|
+
// ============================================================================
|
|
2106
|
+
// S3 Import Methods
|
|
2107
|
+
// ============================================================================
|
|
2108
|
+
/**
|
|
2109
|
+
* Create an S3 import job to bulk import files from an external S3 bucket.
|
|
2110
|
+
* Requires Pro plan or higher.
|
|
2111
|
+
*
|
|
2112
|
+
* @example
|
|
2113
|
+
* ```typescript
|
|
2114
|
+
* // Using IAM credentials
|
|
2115
|
+
* const job = await cdn.createImport({
|
|
2116
|
+
* projectSlug: 'my-project',
|
|
2117
|
+
* sourceBucket: 'my-external-bucket',
|
|
2118
|
+
* sourceRegion: 'us-east-1',
|
|
2119
|
+
* sourcePrefix: 'images/',
|
|
2120
|
+
* authType: 'iam_credentials',
|
|
2121
|
+
* accessKeyId: 'AKIA...',
|
|
2122
|
+
* secretAccessKey: 'secret...',
|
|
2123
|
+
* pathMode: 'flatten',
|
|
2124
|
+
* notifyEmail: 'admin@example.com',
|
|
2125
|
+
* });
|
|
2126
|
+
*
|
|
2127
|
+
* // Using role assumption
|
|
2128
|
+
* const job = await cdn.createImport({
|
|
2129
|
+
* projectSlug: 'my-project',
|
|
2130
|
+
* sourceBucket: 'partner-bucket',
|
|
2131
|
+
* sourceRegion: 'eu-west-1',
|
|
2132
|
+
* authType: 'role_assumption',
|
|
2133
|
+
* roleArn: 'arn:aws:iam::123456789012:role/Stack0ImportRole',
|
|
2134
|
+
* externalId: 'optional-external-id',
|
|
2135
|
+
* pathMode: 'preserve',
|
|
2136
|
+
* targetFolder: '/imported',
|
|
2137
|
+
* });
|
|
2138
|
+
*
|
|
2139
|
+
* console.log(`Import job started: ${job.importId}`);
|
|
2140
|
+
* ```
|
|
2141
|
+
*/
|
|
2142
|
+
async createImport(request) {
|
|
2143
|
+
const response = await this.http.post("/cdn/imports", request);
|
|
2144
|
+
return this.convertCreateImportDates(response);
|
|
2145
|
+
}
|
|
2146
|
+
/**
|
|
2147
|
+
* Get an import job by ID
|
|
2148
|
+
*
|
|
2149
|
+
* @example
|
|
2150
|
+
* ```typescript
|
|
2151
|
+
* const job = await cdn.getImport('import-id');
|
|
2152
|
+
* console.log(`Status: ${job.status}`);
|
|
2153
|
+
* console.log(`Progress: ${job.processedFiles}/${job.totalFiles} files`);
|
|
2154
|
+
* console.log(`Bytes: ${job.processedBytes}/${job.totalBytes}`);
|
|
2155
|
+
* ```
|
|
2156
|
+
*/
|
|
2157
|
+
async getImport(importId) {
|
|
2158
|
+
const response = await this.http.get(`/cdn/imports/${importId}`);
|
|
2159
|
+
return response ? this.convertImportJobDates(response) : null;
|
|
2160
|
+
}
|
|
2161
|
+
/**
|
|
2162
|
+
* List import jobs with pagination and filters
|
|
2163
|
+
*
|
|
2164
|
+
* @example
|
|
2165
|
+
* ```typescript
|
|
2166
|
+
* const { imports, total, hasMore } = await cdn.listImports({
|
|
2167
|
+
* projectSlug: 'my-project',
|
|
2168
|
+
* status: 'importing',
|
|
2169
|
+
* limit: 20,
|
|
2170
|
+
* });
|
|
2171
|
+
*
|
|
2172
|
+
* for (const job of imports) {
|
|
2173
|
+
* console.log(`${job.sourceBucket}: ${job.processedFiles}/${job.totalFiles}`);
|
|
2174
|
+
* }
|
|
2175
|
+
* ```
|
|
2176
|
+
*/
|
|
2177
|
+
async listImports(request) {
|
|
2178
|
+
const params = new URLSearchParams();
|
|
2179
|
+
params.set("projectSlug", request.projectSlug);
|
|
2180
|
+
if (request.environment) params.set("environment", request.environment);
|
|
2181
|
+
if (request.status) params.set("status", request.status);
|
|
2182
|
+
if (request.sortBy) params.set("sortBy", request.sortBy);
|
|
2183
|
+
if (request.sortOrder) params.set("sortOrder", request.sortOrder);
|
|
2184
|
+
if (request.limit) params.set("limit", request.limit.toString());
|
|
2185
|
+
if (request.offset) params.set("offset", request.offset.toString());
|
|
2186
|
+
const response = await this.http.get(`/cdn/imports?${params.toString()}`);
|
|
2187
|
+
return {
|
|
2188
|
+
...response,
|
|
2189
|
+
imports: response.imports.map((job) => this.convertImportJobSummaryDates(job))
|
|
2190
|
+
};
|
|
2191
|
+
}
|
|
2192
|
+
/**
|
|
2193
|
+
* Cancel a running import job
|
|
2194
|
+
*
|
|
2195
|
+
* Files already imported will remain. Only pending/validating/importing jobs can be cancelled.
|
|
2196
|
+
*
|
|
2197
|
+
* @example
|
|
2198
|
+
* ```typescript
|
|
2199
|
+
* const result = await cdn.cancelImport('import-id');
|
|
2200
|
+
* console.log(`Cancelled: ${result.success}`);
|
|
2201
|
+
* ```
|
|
2202
|
+
*/
|
|
2203
|
+
async cancelImport(importId) {
|
|
2204
|
+
return this.http.post(`/cdn/imports/${importId}/cancel`, {});
|
|
2205
|
+
}
|
|
2206
|
+
/**
|
|
2207
|
+
* Retry failed files in a completed or failed import job
|
|
2208
|
+
*
|
|
2209
|
+
* This resets failed files to pending and re-queues the import for processing.
|
|
2210
|
+
*
|
|
2211
|
+
* @example
|
|
2212
|
+
* ```typescript
|
|
2213
|
+
* const result = await cdn.retryImport('import-id');
|
|
2214
|
+
* console.log(`Retrying ${result.retriedCount} files`);
|
|
2215
|
+
* ```
|
|
2216
|
+
*/
|
|
2217
|
+
async retryImport(importId) {
|
|
2218
|
+
return this.http.post(`/cdn/imports/${importId}/retry`, {});
|
|
2219
|
+
}
|
|
2220
|
+
/**
|
|
2221
|
+
* List files in an import job with optional status filter
|
|
2222
|
+
*
|
|
2223
|
+
* @example
|
|
2224
|
+
* ```typescript
|
|
2225
|
+
* // List all files
|
|
2226
|
+
* const { files, total } = await cdn.listImportFiles({
|
|
2227
|
+
* importId: 'import-id',
|
|
2228
|
+
* limit: 100,
|
|
2229
|
+
* });
|
|
2230
|
+
*
|
|
2231
|
+
* // List only failed files
|
|
2232
|
+
* const { files: failedFiles } = await cdn.listImportFiles({
|
|
2233
|
+
* importId: 'import-id',
|
|
2234
|
+
* status: 'failed',
|
|
2235
|
+
* });
|
|
2236
|
+
*
|
|
2237
|
+
* for (const file of failedFiles) {
|
|
2238
|
+
* console.log(`${file.sourceKey}: ${file.errorMessage}`);
|
|
2239
|
+
* }
|
|
2240
|
+
* ```
|
|
2241
|
+
*/
|
|
2242
|
+
async listImportFiles(request) {
|
|
2243
|
+
const params = new URLSearchParams();
|
|
2244
|
+
if (request.status) params.set("status", request.status);
|
|
2245
|
+
if (request.sortBy) params.set("sortBy", request.sortBy);
|
|
2246
|
+
if (request.sortOrder) params.set("sortOrder", request.sortOrder);
|
|
2247
|
+
if (request.limit) params.set("limit", request.limit.toString());
|
|
2248
|
+
if (request.offset) params.set("offset", request.offset.toString());
|
|
2249
|
+
const query = params.toString();
|
|
2250
|
+
const response = await this.http.get(
|
|
2251
|
+
`/cdn/imports/${request.importId}/files${query ? `?${query}` : ""}`
|
|
2252
|
+
);
|
|
2253
|
+
return {
|
|
2254
|
+
...response,
|
|
2255
|
+
files: response.files.map((file) => this.convertImportFileDates(file))
|
|
2256
|
+
};
|
|
2257
|
+
}
|
|
2258
|
+
convertCreateImportDates(response) {
|
|
2259
|
+
if (typeof response.createdAt === "string") {
|
|
2260
|
+
response.createdAt = new Date(response.createdAt);
|
|
2261
|
+
}
|
|
2262
|
+
return response;
|
|
2263
|
+
}
|
|
2264
|
+
convertImportJobDates(job) {
|
|
2265
|
+
if (typeof job.createdAt === "string") {
|
|
2266
|
+
job.createdAt = new Date(job.createdAt);
|
|
2267
|
+
}
|
|
2268
|
+
if (job.updatedAt && typeof job.updatedAt === "string") {
|
|
2269
|
+
job.updatedAt = new Date(job.updatedAt);
|
|
2270
|
+
}
|
|
2271
|
+
if (job.startedAt && typeof job.startedAt === "string") {
|
|
2272
|
+
job.startedAt = new Date(job.startedAt);
|
|
2273
|
+
}
|
|
2274
|
+
if (job.completedAt && typeof job.completedAt === "string") {
|
|
2275
|
+
job.completedAt = new Date(job.completedAt);
|
|
2276
|
+
}
|
|
2277
|
+
return job;
|
|
2278
|
+
}
|
|
2279
|
+
convertImportJobSummaryDates(job) {
|
|
2280
|
+
if (typeof job.createdAt === "string") {
|
|
2281
|
+
job.createdAt = new Date(job.createdAt);
|
|
2282
|
+
}
|
|
2283
|
+
if (job.startedAt && typeof job.startedAt === "string") {
|
|
2284
|
+
job.startedAt = new Date(job.startedAt);
|
|
2285
|
+
}
|
|
2286
|
+
if (job.completedAt && typeof job.completedAt === "string") {
|
|
2287
|
+
job.completedAt = new Date(job.completedAt);
|
|
2288
|
+
}
|
|
2289
|
+
return job;
|
|
2290
|
+
}
|
|
2291
|
+
convertImportFileDates(file) {
|
|
2292
|
+
if (typeof file.createdAt === "string") {
|
|
2293
|
+
file.createdAt = new Date(file.createdAt);
|
|
2294
|
+
}
|
|
2295
|
+
if (file.completedAt && typeof file.completedAt === "string") {
|
|
2296
|
+
file.completedAt = new Date(file.completedAt);
|
|
2297
|
+
}
|
|
2298
|
+
if (file.lastAttemptAt && typeof file.lastAttemptAt === "string") {
|
|
2299
|
+
file.lastAttemptAt = new Date(file.lastAttemptAt);
|
|
2300
|
+
}
|
|
2301
|
+
return file;
|
|
2302
|
+
}
|
|
2018
2303
|
};
|
|
2019
2304
|
|
|
2020
2305
|
// src/screenshots/client.ts
|
|
@@ -3607,18 +3892,104 @@ var Productivity = class {
|
|
|
3607
3892
|
return this.http.delete(`/integrations/productivity/tables/${tableId}/rows/${rowId}?connectionId=${connectionId}`);
|
|
3608
3893
|
}
|
|
3609
3894
|
};
|
|
3895
|
+
var CalendarClient = class {
|
|
3896
|
+
http;
|
|
3897
|
+
constructor(http) {
|
|
3898
|
+
this.http = http;
|
|
3899
|
+
}
|
|
3900
|
+
async listCalendars(connectionId, options) {
|
|
3901
|
+
const params = new URLSearchParams({ connectionId });
|
|
3902
|
+
if (options?.cursor) params.set("cursor", options.cursor);
|
|
3903
|
+
if (options?.limit) params.set("limit", String(options.limit));
|
|
3904
|
+
return this.http.get(`/integrations/calendar/calendars?${params}`);
|
|
3905
|
+
}
|
|
3906
|
+
async listEvents(connectionId, calendarId, options) {
|
|
3907
|
+
const params = new URLSearchParams({ connectionId, calendarId });
|
|
3908
|
+
if (options?.cursor) params.set("cursor", options.cursor);
|
|
3909
|
+
if (options?.limit) params.set("limit", String(options.limit));
|
|
3910
|
+
if (options?.timeMin) params.set("timeMin", options.timeMin.toISOString());
|
|
3911
|
+
if (options?.timeMax) params.set("timeMax", options.timeMax.toISOString());
|
|
3912
|
+
if (options?.query) params.set("query", options.query);
|
|
3913
|
+
return this.http.get(`/integrations/calendar/events?${params}`);
|
|
3914
|
+
}
|
|
3915
|
+
async getEvent(connectionId, calendarId, eventId) {
|
|
3916
|
+
return this.http.get(
|
|
3917
|
+
`/integrations/calendar/events/${eventId}?connectionId=${connectionId}&calendarId=${calendarId}`
|
|
3918
|
+
);
|
|
3919
|
+
}
|
|
3920
|
+
async createEvent(connectionId, calendarId, data) {
|
|
3921
|
+
return this.http.post("/integrations/calendar/events", { connectionId, calendarId, data });
|
|
3922
|
+
}
|
|
3923
|
+
async updateEvent(connectionId, calendarId, eventId, data) {
|
|
3924
|
+
return this.http.patch(`/integrations/calendar/events/${eventId}`, { connectionId, calendarId, data });
|
|
3925
|
+
}
|
|
3926
|
+
async deleteEvent(connectionId, calendarId, eventId) {
|
|
3927
|
+
return this.http.delete(
|
|
3928
|
+
`/integrations/calendar/events/${eventId}?connectionId=${connectionId}&calendarId=${calendarId}`
|
|
3929
|
+
);
|
|
3930
|
+
}
|
|
3931
|
+
};
|
|
3932
|
+
var Mail2 = class {
|
|
3933
|
+
http;
|
|
3934
|
+
constructor(http) {
|
|
3935
|
+
this.http = http;
|
|
3936
|
+
}
|
|
3937
|
+
async listMessages(connectionId, options) {
|
|
3938
|
+
const params = new URLSearchParams({ connectionId });
|
|
3939
|
+
if (options?.cursor) params.set("cursor", options.cursor);
|
|
3940
|
+
if (options?.limit) params.set("limit", String(options.limit));
|
|
3941
|
+
if (options?.query) params.set("query", options.query);
|
|
3942
|
+
if (options?.labelIds) {
|
|
3943
|
+
for (const labelId of options.labelIds) {
|
|
3944
|
+
params.append("labelIds", labelId);
|
|
3945
|
+
}
|
|
3946
|
+
}
|
|
3947
|
+
return this.http.get(`/integrations/email/messages?${params}`);
|
|
3948
|
+
}
|
|
3949
|
+
async getMessage(connectionId, messageId) {
|
|
3950
|
+
return this.http.get(`/integrations/email/messages/${messageId}?connectionId=${connectionId}`);
|
|
3951
|
+
}
|
|
3952
|
+
async sendMessage(connectionId, data) {
|
|
3953
|
+
return this.http.post("/integrations/email/messages/send", { connectionId, data });
|
|
3954
|
+
}
|
|
3955
|
+
async listThreads(connectionId, options) {
|
|
3956
|
+
const params = new URLSearchParams({ connectionId });
|
|
3957
|
+
if (options?.cursor) params.set("cursor", options.cursor);
|
|
3958
|
+
if (options?.limit) params.set("limit", String(options.limit));
|
|
3959
|
+
if (options?.query) params.set("query", options.query);
|
|
3960
|
+
if (options?.labelIds) {
|
|
3961
|
+
for (const labelId of options.labelIds) {
|
|
3962
|
+
params.append("labelIds", labelId);
|
|
3963
|
+
}
|
|
3964
|
+
}
|
|
3965
|
+
return this.http.get(`/integrations/email/threads?${params}`);
|
|
3966
|
+
}
|
|
3967
|
+
async getThread(connectionId, threadId) {
|
|
3968
|
+
return this.http.get(`/integrations/email/threads/${threadId}?connectionId=${connectionId}`);
|
|
3969
|
+
}
|
|
3970
|
+
async listLabels(connectionId) {
|
|
3971
|
+
const result = await this.http.get(
|
|
3972
|
+
`/integrations/email/labels?connectionId=${connectionId}`
|
|
3973
|
+
);
|
|
3974
|
+
return result.labels;
|
|
3975
|
+
}
|
|
3976
|
+
};
|
|
3610
3977
|
var Integrations = class {
|
|
3611
3978
|
http;
|
|
3612
3979
|
crm;
|
|
3613
3980
|
storage;
|
|
3614
3981
|
communication;
|
|
3615
3982
|
productivity;
|
|
3983
|
+
calendar;
|
|
3984
|
+
mail;
|
|
3616
3985
|
constructor(config) {
|
|
3617
3986
|
this.http = new HttpClient(config);
|
|
3618
3987
|
this.crm = new CRM(this.http);
|
|
3619
3988
|
this.storage = new Storage(this.http);
|
|
3620
3989
|
this.communication = new Communication(this.http);
|
|
3621
3990
|
this.productivity = new Productivity(this.http);
|
|
3991
|
+
this.calendar = new CalendarClient(this.http);
|
|
3992
|
+
this.mail = new Mail2(this.http);
|
|
3622
3993
|
}
|
|
3623
3994
|
// ============================================================================
|
|
3624
3995
|
// CONNECTORS
|
|
@@ -3656,6 +4027,7 @@ var Integrations = class {
|
|
|
3656
4027
|
if (request?.environment) params.set("environment", request.environment);
|
|
3657
4028
|
if (request?.connectorSlug) params.set("connectorSlug", request.connectorSlug);
|
|
3658
4029
|
if (request?.status) params.set("status", request.status);
|
|
4030
|
+
if (request?.endUserId) params.set("endUserId", request.endUserId);
|
|
3659
4031
|
if (request?.limit) params.set("limit", request.limit.toString());
|
|
3660
4032
|
const queryString = params.toString();
|
|
3661
4033
|
const response = await this.http.get(
|
|
@@ -3689,6 +4061,22 @@ var Integrations = class {
|
|
|
3689
4061
|
async initiateOAuth(request) {
|
|
3690
4062
|
return this.http.post("/integrations/connections/oauth/initiate", request);
|
|
3691
4063
|
}
|
|
4064
|
+
/**
|
|
4065
|
+
* Create a connection session for an end user
|
|
4066
|
+
*
|
|
4067
|
+
* @example
|
|
4068
|
+
* ```typescript
|
|
4069
|
+
* const { authUrl, sessionId } = await integrations.createConnectionSession({
|
|
4070
|
+
* endUserId: 'user_123',
|
|
4071
|
+
* connectorSlug: 'google-calendar',
|
|
4072
|
+
* redirectUrl: 'https://yourapp.com/oauth/callback',
|
|
4073
|
+
* });
|
|
4074
|
+
* // Redirect user to authUrl
|
|
4075
|
+
* ```
|
|
4076
|
+
*/
|
|
4077
|
+
async createConnectionSession(request) {
|
|
4078
|
+
return this.http.post("/integrations/connections/session", request);
|
|
4079
|
+
}
|
|
3692
4080
|
/**
|
|
3693
4081
|
* Complete OAuth flow with callback data
|
|
3694
4082
|
*
|
|
@@ -4621,6 +5009,535 @@ var Marketing = class {
|
|
|
4621
5009
|
}
|
|
4622
5010
|
};
|
|
4623
5011
|
|
|
5012
|
+
// src/workflows/client.ts
|
|
5013
|
+
var Workflows = class {
|
|
5014
|
+
http;
|
|
5015
|
+
constructor(config) {
|
|
5016
|
+
this.http = new HttpClient(config);
|
|
5017
|
+
}
|
|
5018
|
+
// ==========================================================================
|
|
5019
|
+
// WORKFLOW CRUD
|
|
5020
|
+
// ==========================================================================
|
|
5021
|
+
/**
|
|
5022
|
+
* Create a new workflow
|
|
5023
|
+
*
|
|
5024
|
+
* @example
|
|
5025
|
+
* ```typescript
|
|
5026
|
+
* const workflow = await workflows.create({
|
|
5027
|
+
* slug: 'content-pipeline',
|
|
5028
|
+
* name: 'Content Generation Pipeline',
|
|
5029
|
+
* steps: [
|
|
5030
|
+
* {
|
|
5031
|
+
* id: 'generate',
|
|
5032
|
+
* name: 'Generate Content',
|
|
5033
|
+
* type: 'llm',
|
|
5034
|
+
* provider: 'anthropic',
|
|
5035
|
+
* model: 'claude-sonnet-4-20250514',
|
|
5036
|
+
* config: {
|
|
5037
|
+
* prompt: 'Write a blog post about {{topic}}',
|
|
5038
|
+
* maxTokens: 2000,
|
|
5039
|
+
* },
|
|
5040
|
+
* },
|
|
5041
|
+
* ],
|
|
5042
|
+
* variables: [
|
|
5043
|
+
* { name: 'topic', type: 'string', required: true },
|
|
5044
|
+
* ],
|
|
5045
|
+
* });
|
|
5046
|
+
* ```
|
|
5047
|
+
*/
|
|
5048
|
+
async create(request) {
|
|
5049
|
+
return this.http.post("/workflows/workflows", request);
|
|
5050
|
+
}
|
|
5051
|
+
/**
|
|
5052
|
+
* Get a workflow by ID or slug
|
|
5053
|
+
*
|
|
5054
|
+
* @example
|
|
5055
|
+
* ```typescript
|
|
5056
|
+
* const workflow = await workflows.get({ slug: 'content-pipeline' });
|
|
5057
|
+
* console.log(workflow.steps);
|
|
5058
|
+
* ```
|
|
5059
|
+
*/
|
|
5060
|
+
async get(request) {
|
|
5061
|
+
const params = new URLSearchParams();
|
|
5062
|
+
if (request.slug) params.set("slug", request.slug);
|
|
5063
|
+
if (request.environment) params.set("environment", request.environment);
|
|
5064
|
+
if (request.projectSlug) params.set("projectSlug", request.projectSlug);
|
|
5065
|
+
const path = request.id ? `/workflows/workflows/${request.id}` : `/workflows/workflows?${params.toString()}`;
|
|
5066
|
+
const response = await this.http.get(path);
|
|
5067
|
+
return this.convertDates(response);
|
|
5068
|
+
}
|
|
5069
|
+
/**
|
|
5070
|
+
* List workflows with pagination
|
|
5071
|
+
*
|
|
5072
|
+
* @example
|
|
5073
|
+
* ```typescript
|
|
5074
|
+
* const { items, nextCursor } = await workflows.list({
|
|
5075
|
+
* environment: 'production',
|
|
5076
|
+
* isActive: true,
|
|
5077
|
+
* limit: 20,
|
|
5078
|
+
* });
|
|
5079
|
+
* ```
|
|
5080
|
+
*/
|
|
5081
|
+
async list(request = {}) {
|
|
5082
|
+
const params = new URLSearchParams();
|
|
5083
|
+
if (request.projectSlug) params.set("projectSlug", request.projectSlug);
|
|
5084
|
+
if (request.environment) params.set("environment", request.environment);
|
|
5085
|
+
if (request.isActive !== void 0) params.set("isActive", request.isActive.toString());
|
|
5086
|
+
if (request.limit) params.set("limit", request.limit.toString());
|
|
5087
|
+
if (request.cursor) params.set("cursor", request.cursor);
|
|
5088
|
+
const query = params.toString();
|
|
5089
|
+
const response = await this.http.get(
|
|
5090
|
+
`/workflows/workflows${query ? `?${query}` : ""}`
|
|
5091
|
+
);
|
|
5092
|
+
return {
|
|
5093
|
+
...response,
|
|
5094
|
+
items: response.items.map((item) => this.convertDates(item))
|
|
5095
|
+
};
|
|
5096
|
+
}
|
|
5097
|
+
/**
|
|
5098
|
+
* Update a workflow
|
|
5099
|
+
*
|
|
5100
|
+
* @example
|
|
5101
|
+
* ```typescript
|
|
5102
|
+
* await workflows.update({
|
|
5103
|
+
* id: 'workflow-id',
|
|
5104
|
+
* name: 'Updated Pipeline',
|
|
5105
|
+
* isActive: false,
|
|
5106
|
+
* });
|
|
5107
|
+
* ```
|
|
5108
|
+
*/
|
|
5109
|
+
async update(request) {
|
|
5110
|
+
const { id, ...data } = request;
|
|
5111
|
+
return this.http.post(
|
|
5112
|
+
`/workflows/workflows/${id}`,
|
|
5113
|
+
data
|
|
5114
|
+
);
|
|
5115
|
+
}
|
|
5116
|
+
/**
|
|
5117
|
+
* Delete a workflow
|
|
5118
|
+
*
|
|
5119
|
+
* @example
|
|
5120
|
+
* ```typescript
|
|
5121
|
+
* await workflows.delete({ id: 'workflow-id' });
|
|
5122
|
+
* ```
|
|
5123
|
+
*/
|
|
5124
|
+
async delete(request) {
|
|
5125
|
+
return this.http.deleteWithBody(
|
|
5126
|
+
`/workflows/workflows/${request.id}`,
|
|
5127
|
+
request
|
|
5128
|
+
);
|
|
5129
|
+
}
|
|
5130
|
+
// ==========================================================================
|
|
5131
|
+
// WORKFLOW EXECUTION
|
|
5132
|
+
// ==========================================================================
|
|
5133
|
+
/**
|
|
5134
|
+
* Run a workflow
|
|
5135
|
+
*
|
|
5136
|
+
* @example
|
|
5137
|
+
* ```typescript
|
|
5138
|
+
* const run = await workflows.run({
|
|
5139
|
+
* workflowSlug: 'content-pipeline',
|
|
5140
|
+
* variables: {
|
|
5141
|
+
* topic: 'artificial intelligence',
|
|
5142
|
+
* },
|
|
5143
|
+
* webhook: {
|
|
5144
|
+
* url: 'https://example.com/webhook',
|
|
5145
|
+
* secret: 'webhook-secret',
|
|
5146
|
+
* },
|
|
5147
|
+
* });
|
|
5148
|
+
* console.log(run.id, run.status);
|
|
5149
|
+
* ```
|
|
5150
|
+
*/
|
|
5151
|
+
async run(request) {
|
|
5152
|
+
return this.http.post("/workflows/workflows/run", request);
|
|
5153
|
+
}
|
|
5154
|
+
/**
|
|
5155
|
+
* Get a workflow run by ID
|
|
5156
|
+
*
|
|
5157
|
+
* @example
|
|
5158
|
+
* ```typescript
|
|
5159
|
+
* const run = await workflows.getRun({ id: 'run-id' });
|
|
5160
|
+
* if (run.status === 'completed') {
|
|
5161
|
+
* console.log(run.output);
|
|
5162
|
+
* }
|
|
5163
|
+
* ```
|
|
5164
|
+
*/
|
|
5165
|
+
async getRun(request) {
|
|
5166
|
+
const params = new URLSearchParams();
|
|
5167
|
+
if (request.environment) params.set("environment", request.environment);
|
|
5168
|
+
if (request.projectSlug) params.set("projectSlug", request.projectSlug);
|
|
5169
|
+
const query = params.toString();
|
|
5170
|
+
const response = await this.http.get(
|
|
5171
|
+
`/workflows/workflows/runs/${request.id}${query ? `?${query}` : ""}`
|
|
5172
|
+
);
|
|
5173
|
+
return this.convertRunDates(response);
|
|
5174
|
+
}
|
|
5175
|
+
/**
|
|
5176
|
+
* List workflow runs with pagination
|
|
5177
|
+
*
|
|
5178
|
+
* @example
|
|
5179
|
+
* ```typescript
|
|
5180
|
+
* const { items } = await workflows.listRuns({
|
|
5181
|
+
* workflowId: 'workflow-id',
|
|
5182
|
+
* status: 'completed',
|
|
5183
|
+
* });
|
|
5184
|
+
* ```
|
|
5185
|
+
*/
|
|
5186
|
+
async listRuns(request = {}) {
|
|
5187
|
+
const params = new URLSearchParams();
|
|
5188
|
+
if (request.workflowId) params.set("workflowId", request.workflowId);
|
|
5189
|
+
if (request.workflowSlug) params.set("workflowSlug", request.workflowSlug);
|
|
5190
|
+
if (request.projectSlug) params.set("projectSlug", request.projectSlug);
|
|
5191
|
+
if (request.environment) params.set("environment", request.environment);
|
|
5192
|
+
if (request.status) params.set("status", request.status);
|
|
5193
|
+
if (request.limit) params.set("limit", request.limit.toString());
|
|
5194
|
+
if (request.cursor) params.set("cursor", request.cursor);
|
|
5195
|
+
const query = params.toString();
|
|
5196
|
+
const response = await this.http.get(
|
|
5197
|
+
`/workflows/workflows/runs${query ? `?${query}` : ""}`
|
|
5198
|
+
);
|
|
5199
|
+
return {
|
|
5200
|
+
...response,
|
|
5201
|
+
items: response.items.map((item) => this.convertRunDates(item))
|
|
5202
|
+
};
|
|
5203
|
+
}
|
|
5204
|
+
/**
|
|
5205
|
+
* Cancel a running workflow
|
|
5206
|
+
*
|
|
5207
|
+
* @example
|
|
5208
|
+
* ```typescript
|
|
5209
|
+
* await workflows.cancelRun({ id: 'run-id' });
|
|
5210
|
+
* ```
|
|
5211
|
+
*/
|
|
5212
|
+
async cancelRun(request) {
|
|
5213
|
+
return this.http.post(
|
|
5214
|
+
`/workflows/workflows/runs/${request.id}/cancel`,
|
|
5215
|
+
{}
|
|
5216
|
+
);
|
|
5217
|
+
}
|
|
5218
|
+
/**
|
|
5219
|
+
* Run a workflow and wait for completion
|
|
5220
|
+
*
|
|
5221
|
+
* @example
|
|
5222
|
+
* ```typescript
|
|
5223
|
+
* const run = await workflows.runAndWait({
|
|
5224
|
+
* workflowSlug: 'content-pipeline',
|
|
5225
|
+
* variables: { topic: 'AI' },
|
|
5226
|
+
* });
|
|
5227
|
+
* console.log(run.output);
|
|
5228
|
+
* ```
|
|
5229
|
+
*/
|
|
5230
|
+
async runAndWait(request, options = {}) {
|
|
5231
|
+
const { pollInterval = 2e3, timeout = 6e5 } = options;
|
|
5232
|
+
const startTime = Date.now();
|
|
5233
|
+
const { id } = await this.run(request);
|
|
5234
|
+
while (Date.now() - startTime < timeout) {
|
|
5235
|
+
const run = await this.getRun({
|
|
5236
|
+
id,
|
|
5237
|
+
environment: request.environment,
|
|
5238
|
+
projectSlug: request.projectSlug
|
|
5239
|
+
});
|
|
5240
|
+
if (run.status === "completed" || run.status === "failed" || run.status === "cancelled") {
|
|
5241
|
+
if (run.status === "failed") {
|
|
5242
|
+
throw new Error(run.error || "Workflow execution failed");
|
|
5243
|
+
}
|
|
5244
|
+
return run;
|
|
5245
|
+
}
|
|
5246
|
+
await new Promise((resolve) => setTimeout(resolve, pollInterval));
|
|
5247
|
+
}
|
|
5248
|
+
throw new Error("Workflow execution timed out");
|
|
5249
|
+
}
|
|
5250
|
+
// ==========================================================================
|
|
5251
|
+
// HELPERS
|
|
5252
|
+
// ==========================================================================
|
|
5253
|
+
convertDates(workflow) {
|
|
5254
|
+
if (typeof workflow.createdAt === "string") {
|
|
5255
|
+
workflow.createdAt = new Date(workflow.createdAt);
|
|
5256
|
+
}
|
|
5257
|
+
if (typeof workflow.updatedAt === "string") {
|
|
5258
|
+
workflow.updatedAt = new Date(workflow.updatedAt);
|
|
5259
|
+
}
|
|
5260
|
+
return workflow;
|
|
5261
|
+
}
|
|
5262
|
+
convertRunDates(run) {
|
|
5263
|
+
if (typeof run.createdAt === "string") {
|
|
5264
|
+
run.createdAt = new Date(run.createdAt);
|
|
5265
|
+
}
|
|
5266
|
+
if (run.startedAt && typeof run.startedAt === "string") {
|
|
5267
|
+
run.startedAt = new Date(run.startedAt);
|
|
5268
|
+
}
|
|
5269
|
+
if (run.completedAt && typeof run.completedAt === "string") {
|
|
5270
|
+
run.completedAt = new Date(run.completedAt);
|
|
5271
|
+
}
|
|
5272
|
+
return run;
|
|
5273
|
+
}
|
|
5274
|
+
};
|
|
5275
|
+
|
|
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
|
+
|
|
4624
5541
|
// src/index.ts
|
|
4625
5542
|
var Stack0 = class {
|
|
4626
5543
|
mail;
|
|
@@ -4629,6 +5546,8 @@ var Stack0 = class {
|
|
|
4629
5546
|
extraction;
|
|
4630
5547
|
integrations;
|
|
4631
5548
|
marketing;
|
|
5549
|
+
workflows;
|
|
5550
|
+
memory;
|
|
4632
5551
|
/**
|
|
4633
5552
|
* @deprecated Use `screenshots` and `extraction` instead. Will be removed in a future version.
|
|
4634
5553
|
*/
|
|
@@ -4644,6 +5563,8 @@ var Stack0 = class {
|
|
|
4644
5563
|
this.extraction = new Extraction(clientConfig);
|
|
4645
5564
|
this.integrations = new Integrations(clientConfig);
|
|
4646
5565
|
this.marketing = new Marketing(clientConfig);
|
|
5566
|
+
this.workflows = new Workflows(clientConfig);
|
|
5567
|
+
this.memory = new Memory(clientConfig);
|
|
4647
5568
|
this.webdata = new Webdata(clientConfig);
|
|
4648
5569
|
}
|
|
4649
5570
|
};
|
|
@@ -4658,12 +5579,18 @@ exports.Events = Events;
|
|
|
4658
5579
|
exports.Extraction = Extraction;
|
|
4659
5580
|
exports.Integrations = Integrations;
|
|
4660
5581
|
exports.Mail = Mail;
|
|
5582
|
+
exports.Mailboxes = Mailboxes;
|
|
4661
5583
|
exports.Marketing = Marketing;
|
|
5584
|
+
exports.Memory = Memory;
|
|
5585
|
+
exports.MemoryAgents = MemoryAgents;
|
|
5586
|
+
exports.MemoryCollections = MemoryCollections;
|
|
5587
|
+
exports.MemoryEntities = MemoryEntities;
|
|
4662
5588
|
exports.Screenshots = Screenshots;
|
|
4663
5589
|
exports.Sequences = Sequences;
|
|
4664
5590
|
exports.Stack0 = Stack0;
|
|
4665
5591
|
exports.Templates = Templates;
|
|
4666
5592
|
exports.Webdata = Webdata;
|
|
5593
|
+
exports.Workflows = Workflows;
|
|
4667
5594
|
exports.default = src_default;
|
|
4668
5595
|
//# sourceMappingURL=index.js.map
|
|
4669
5596
|
//# sourceMappingURL=index.js.map
|