@stack0/sdk 0.5.12 → 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/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);
@@ -5499,271 +5561,6 @@ var Workflows = class {
5499
5561
  }
5500
5562
  };
5501
5563
 
5502
- // src/memory/agents.ts
5503
- var MemoryAgents = class {
5504
- constructor(http) {
5505
- this.http = http;
5506
- }
5507
- /**
5508
- * Create a new memory agent
5509
- */
5510
- async create(request) {
5511
- return this.http.post("/memory/agents", request);
5512
- }
5513
- /**
5514
- * List all memory agents
5515
- */
5516
- async list(params = {}) {
5517
- const qs = new URLSearchParams();
5518
- if (params.environment) qs.set("environment", params.environment);
5519
- const q = qs.toString();
5520
- return this.http.get(`/memory/agents${q ? `?${q}` : ""}`);
5521
- }
5522
- /**
5523
- * Get a memory agent by ID
5524
- */
5525
- async get(agentId) {
5526
- return this.http.get(`/memory/agents/${agentId}`);
5527
- }
5528
- /**
5529
- * Update a memory agent
5530
- */
5531
- async update(agentId, request) {
5532
- return this.http.patch(`/memory/agents/${agentId}`, request);
5533
- }
5534
- /**
5535
- * Delete a memory agent
5536
- */
5537
- async delete(agentId) {
5538
- return this.http.delete(`/memory/agents/${agentId}`);
5539
- }
5540
- };
5541
-
5542
- // src/memory/collections.ts
5543
- var MemoryCollections = class {
5544
- constructor(http) {
5545
- this.http = http;
5546
- }
5547
- /**
5548
- * Create a new collection for an agent
5549
- */
5550
- async create(request) {
5551
- return this.http.post(`/memory/agents/${request.agentId}/collections`, {
5552
- name: request.name,
5553
- slug: request.slug,
5554
- description: request.description,
5555
- compaction: request.compaction,
5556
- retention: request.retention
5557
- });
5558
- }
5559
- /**
5560
- * List all collections for an agent
5561
- */
5562
- async list(agentId) {
5563
- return this.http.get(`/memory/agents/${agentId}/collections`);
5564
- }
5565
- /**
5566
- * Get a collection by slug
5567
- */
5568
- async get(agentId, collectionSlug) {
5569
- return this.http.get(`/memory/agents/${agentId}/collections/${collectionSlug}`);
5570
- }
5571
- /**
5572
- * Update a collection
5573
- */
5574
- async update(agentId, collectionSlug, request) {
5575
- return this.http.patch(
5576
- `/memory/agents/${agentId}/collections/${collectionSlug}`,
5577
- request
5578
- );
5579
- }
5580
- /**
5581
- * Delete a collection
5582
- */
5583
- async delete(agentId, collectionSlug) {
5584
- return this.http.delete(`/memory/agents/${agentId}/collections/${collectionSlug}`);
5585
- }
5586
- /**
5587
- * Get collection statistics
5588
- */
5589
- async stats(agentId, collectionSlug) {
5590
- return this.http.get(
5591
- `/memory/agents/${agentId}/collections/${collectionSlug}/stats`
5592
- );
5593
- }
5594
- /**
5595
- * Trigger compaction for a collection
5596
- */
5597
- async compact(agentId, collectionSlug, request = {}) {
5598
- return this.http.post(
5599
- `/memory/agents/${agentId}/collections/${collectionSlug}/compact`,
5600
- request
5601
- );
5602
- }
5603
- /**
5604
- * Get a compaction job by ID
5605
- */
5606
- async getCompactionJob(agentId, collectionSlug, jobId) {
5607
- return this.http.get(
5608
- `/memory/agents/${agentId}/collections/${collectionSlug}/compact/${jobId}`
5609
- );
5610
- }
5611
- };
5612
-
5613
- // src/memory/entities.ts
5614
- var MemoryEntities = class {
5615
- constructor(http) {
5616
- this.http = http;
5617
- }
5618
- async list(params) {
5619
- const qs = new URLSearchParams();
5620
- qs.set("agentId", params.agentId);
5621
- if (params.type) qs.set("type", params.type);
5622
- if (params.limit) qs.set("limit", params.limit.toString());
5623
- if (params.offset) qs.set("offset", params.offset.toString());
5624
- const q = qs.toString();
5625
- return this.http.get(`/memory/entities${q ? `?${q}` : ""}`);
5626
- }
5627
- async get(entityId) {
5628
- return this.http.get(`/memory/entities/${entityId}`);
5629
- }
5630
- async getRelations(entityId) {
5631
- return this.http.get(`/memory/entities/${entityId}/relations`);
5632
- }
5633
- };
5634
-
5635
- // src/memory/client.ts
5636
- var Memory = class {
5637
- http;
5638
- /** Manage memory agents */
5639
- agents;
5640
- /** Manage memory collections */
5641
- collections;
5642
- /** Manage extracted entities */
5643
- entities;
5644
- constructor(config) {
5645
- this.http = new HttpClient(config);
5646
- this.agents = new MemoryAgents(this.http);
5647
- this.collections = new MemoryCollections(this.http);
5648
- this.entities = new MemoryEntities(this.http);
5649
- }
5650
- // ============================================================================
5651
- // MEMORY OPERATIONS
5652
- // ============================================================================
5653
- /**
5654
- * Store a memory
5655
- *
5656
- * @example
5657
- * ```typescript
5658
- * const memory = await stack0.memory.store({
5659
- * agentId: 'agent_123',
5660
- * content: 'User prefers dark mode',
5661
- * type: 'preference',
5662
- * tags: ['ui', 'settings'],
5663
- * });
5664
- * ```
5665
- */
5666
- async store(request) {
5667
- return this.http.post("/memory/memories", request);
5668
- }
5669
- /**
5670
- * Store multiple memories in a batch
5671
- *
5672
- * @example
5673
- * ```typescript
5674
- * const results = await stack0.memory.storeBatch({
5675
- * agentId: 'agent_123',
5676
- * memories: [
5677
- * { content: 'User prefers dark mode', type: 'preference' },
5678
- * { content: 'User is based in NYC', type: 'fact' },
5679
- * ],
5680
- * });
5681
- * ```
5682
- */
5683
- async storeBatch(request) {
5684
- return this.http.post("/memory/memories/batch", request);
5685
- }
5686
- /**
5687
- * Recall memories using semantic search (vector similarity)
5688
- *
5689
- * @example
5690
- * ```typescript
5691
- * const results = await stack0.memory.recall({
5692
- * agentId: 'agent_123',
5693
- * query: 'What are the user preferences?',
5694
- * limit: 10,
5695
- * });
5696
- * ```
5697
- */
5698
- async recall(request) {
5699
- return this.http.post("/memory/memories/recall", request);
5700
- }
5701
- /**
5702
- * Search memories using full-text search
5703
- *
5704
- * @example
5705
- * ```typescript
5706
- * const results = await stack0.memory.search({
5707
- * agentId: 'agent_123',
5708
- * query: 'dark mode',
5709
- * limit: 20,
5710
- * });
5711
- * ```
5712
- */
5713
- async search(request) {
5714
- return this.http.post("/memory/memories/search", request);
5715
- }
5716
- /**
5717
- * Get a memory by ID
5718
- */
5719
- async get(memoryId) {
5720
- return this.http.get(`/memory/memories/${memoryId}`);
5721
- }
5722
- /**
5723
- * List memories with optional filters
5724
- *
5725
- * @example
5726
- * ```typescript
5727
- * const memories = await stack0.memory.list({
5728
- * agentId: 'agent_123',
5729
- * type: 'preference',
5730
- * limit: 50,
5731
- * });
5732
- * ```
5733
- */
5734
- async list(params) {
5735
- const qs = new URLSearchParams();
5736
- qs.set("agentId", params.agentId);
5737
- if (params.collectionSlug) qs.set("collectionSlug", params.collectionSlug);
5738
- if (params.type) qs.set("type", params.type);
5739
- if (params.tier) qs.set("tier", params.tier);
5740
- if (params.limit) qs.set("limit", params.limit.toString());
5741
- if (params.offset) qs.set("offset", params.offset.toString());
5742
- if (params.sortBy) qs.set("sortBy", params.sortBy);
5743
- if (params.sortOrder) qs.set("sortOrder", params.sortOrder);
5744
- const q = qs.toString();
5745
- return this.http.get(`/memory/memories${q ? `?${q}` : ""}`);
5746
- }
5747
- /**
5748
- * Update a memory
5749
- */
5750
- async update(memoryId, request) {
5751
- return this.http.patch(`/memory/memories/${memoryId}`, request);
5752
- }
5753
- /**
5754
- * Delete a memory by ID
5755
- */
5756
- async delete(memoryId) {
5757
- return this.http.delete(`/memory/memories/${memoryId}`);
5758
- }
5759
- /**
5760
- * Delete multiple memories
5761
- */
5762
- async deleteMany(request) {
5763
- return this.http.deleteWithBody("/memory/memories", request);
5764
- }
5765
- };
5766
-
5767
5564
  // src/index.ts
5768
5565
  var Stack0 = class {
5769
5566
  http;
@@ -5777,7 +5574,6 @@ var Stack0 = class {
5777
5574
  integrations;
5778
5575
  marketing;
5779
5576
  workflows;
5780
- memory;
5781
5577
  /**
5782
5578
  * @deprecated Use `screenshots` and `extraction` instead. Will be removed in a future version.
5783
5579
  */
@@ -5798,7 +5594,6 @@ var Stack0 = class {
5798
5594
  this.integrations = new Integrations(clientConfig);
5799
5595
  this.marketing = new Marketing(clientConfig);
5800
5596
  this.workflows = new Workflows(clientConfig);
5801
- this.memory = new Memory(clientConfig);
5802
5597
  this.webdata = new Webdata(clientConfig);
5803
5598
  }
5804
5599
  // ============================================================================
@@ -5842,10 +5637,6 @@ exports.Mailboxes = Mailboxes;
5842
5637
  exports.Map = Map$;
5843
5638
  exports.Map$ = Map$;
5844
5639
  exports.Marketing = Marketing;
5845
- exports.Memory = Memory;
5846
- exports.MemoryAgents = MemoryAgents;
5847
- exports.MemoryCollections = MemoryCollections;
5848
- exports.MemoryEntities = MemoryEntities;
5849
5640
  exports.Screenshots = Screenshots;
5850
5641
  exports.Sequences = Sequences;
5851
5642
  exports.Stack0 = Stack0;