@elevasis/sdk 0.7.11 → 0.7.13

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.
@@ -40,7 +40,7 @@ Both patterns return a Promise that resolves with the tool result or rejects wit
40
40
 
41
41
  ## Integration Adapters
42
42
 
43
- Eleven integration adapters give you access to 55+ tool methods covering third-party APIs. Pass the `credential` field with the name of the stored credential for that service. Supabase is listed separately under [Database Access](#database-access) below.
43
+ Twelve integration adapters give you access to 58+ tool methods covering third-party APIs. Pass the credential name once at adapter creation. Supabase is listed separately under [Database Access](#database-access) below.
44
44
 
45
45
  | Adapter | Tools | Credential Shape |
46
46
  | ------------- | ----------------------------- | ------------------------ |
@@ -49,16 +49,17 @@ Eleven integration adapters give you access to 55+ tool methods covering third-p
49
49
  | Notion | 8 (pages + blocks) | `{ token }` |
50
50
  | Stripe | 6 (payment links + checkout) | `{ secretKey }` |
51
51
  | Instantly | 5 (email campaigns) | `{ apiKey }` |
52
+ | SignatureAPI | 4 (envelopes) | `{ apiKey }` |
53
+ | Tomba | 3 (email discovery) | `api-key-secret` |
52
54
  | Gmail | 2 (send email) | OAuth2 / service account |
53
55
  | Resend | 2 (send/get email) | `{ apiKey }` |
54
- | SignatureAPI | 4 (envelopes) | `{ apiKey }` |
55
56
  | Dropbox | 2 (upload/folder) | `{ accessToken }` |
56
57
  | Apify | 1 (run actor) | `{ token }` |
57
58
  | Mailso | 1 (verify email) | `{ apiKey }` |
58
59
 
59
60
  ## Credential Security
60
61
 
61
- Integration credentials are never stored in `.env` and never available via `process.env` inside worker threads. Credentials live in the platform credential system (created via the command center UI or CLI) and are accessed through three controlled channels.
62
+ Integration credentials are never stored in `.env` and never available via `process.env` inside worker threads. Credentials live in the platform credential system and are accessed through three controlled channels.
62
63
 
63
64
  ### Layer 1: Platform Tools (Default)
64
65
 
@@ -117,7 +118,7 @@ All `getCredential()` calls are logged. Use `platform.call()` with the `http` to
117
118
 
118
119
  ### Credential Setup
119
120
 
120
- Credentials are created in the command center UI: navigate to Credentials Add Credential select type enter values save. The name you give the credential is what you pass as `credential: 'my-cred-name'` in `platform.call()`. Credential names are case-sensitive -- a mismatch causes `PlatformToolError: credential not found`.
121
+ Credentials are created in the command center UI: navigate to Credentials -> Add Credential -> select type -> enter values -> save. The name you give the credential is what you pass as `credential: 'my-cred-name'` in `platform.call()`. Credential names are case-sensitive -- a mismatch causes `PlatformToolError: credential not found`.
121
122
 
122
123
  ### Choosing a Pattern
123
124
 
@@ -135,44 +136,22 @@ Credentials are created in the command center UI: navigate to Credentials → Ad
135
136
 
136
137
  Nine built-in platform services are available without a `credential` field. All have typed singleton adapters imported from `@elevasis/sdk/worker`.
137
138
 
138
- | Tool Key | Methods | Purpose |
139
- | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------- |
140
- | `acqDb` | 35 methods (CRUD + sync) | Acquisition database -- `acqDb` singleton adapter |
141
- | `email` | `send` | Send platform email to org members -- `email` singleton adapter |
142
- | `storage` | `upload`, `download`, `createSignedUrl`, `delete`, `list` | File storage -- `storage` singleton adapter |
143
- | `pdf` | `render`, `renderToBuffer` | PDF rendering -- `pdf` singleton adapter |
144
- | `notification` | `create` | In-app notifications -- `notifications` singleton adapter |
145
- | `approval` | `create`, `deleteByMetadata` | HITL approval gates -- `approval` singleton adapter |
146
- | `scheduler` | `createSchedule`, `updateAnchor`, `deleteSchedule`, `findByIdempotencyKey`, `deleteScheduleByIdempotencyKey`, `listSchedules`, `getSchedule`, `cancelSchedule`, `cancelSchedulesByMetadata` | Task scheduling -- `scheduler` singleton adapter |
147
- | `llm` | `generate` | LLM inference -- `llm` singleton adapter |
148
- | `execution` | `trigger` | Nested child execution -- `execution` singleton adapter |
139
+ | Tool Key | Methods | Purpose |
140
+ | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------- |
141
+ | `acqDb` | 35 methods (CRUD + sync) | Acquisition database -- `acqDb` adapter |
142
+ | `email` | `send` | Send email to org members -- `email` adapter |
143
+ | `storage` | `upload`, `download`, `createSignedUrl`, `delete`, `list` | File storage -- `storage` adapter |
144
+ | `pdf` | `render`, `renderToBuffer` | PDF rendering -- `pdf` adapter |
145
+ | `notification` | `create` | In-app notifications -- `notifications` adapter |
146
+ | `approval` | `create`, `deleteByMetadata` | HITL approval gates -- `approval` adapter |
147
+ | `scheduler` | `createSchedule`, `updateAnchor`, `deleteSchedule`, `findByIdempotencyKey`, `deleteScheduleByIdempotencyKey`, `listSchedules`, `getSchedule`, `cancelSchedule`, `cancelSchedulesByMetadata` | Task scheduling -- `scheduler` adapter |
148
+ | `llm` | `generate` | LLM inference -- `llm` adapter |
149
+ | `execution` | `trigger` | Nested child execution -- `execution` adapter |
149
150
 
150
151
  ## LLM Tool
151
152
 
152
153
  Call any supported LLM from your workflow with no API keys required. Keys are resolved server-side from environment variables.
153
154
 
154
- ```typescript
155
- import { llm } from '@elevasis/sdk/worker'
156
-
157
- const result = await llm.generate({
158
- provider: 'google',
159
- model: 'gemini-3-flash-preview',
160
- messages: [
161
- { role: 'system', content: 'Classify this email reply.' },
162
- { role: 'user', content: emailText }
163
- ],
164
- responseSchema: {
165
- type: 'object',
166
- properties: {
167
- category: { type: 'string', enum: ['interested', 'not-interested', 'bounced'] },
168
- confidence: { type: 'number', minimum: 0, maximum: 1 }
169
- },
170
- required: ['category', 'confidence']
171
- },
172
- temperature: 0.2
173
- })
174
- ```
175
-
176
155
  **Supported models:**
177
156
 
178
157
  | Provider | Models |
@@ -184,21 +163,13 @@ const result = await llm.generate({
184
163
 
185
164
  **Key params:** `provider`, `model`, `messages` (`{ role, content }[]`), `responseSchema` (optional JSON Schema), `temperature` (optional).
186
165
 
166
+ See [Platform Adapters](adapters-platform.mdx#llm-adapter) for full typed usage with structured output.
167
+
187
168
  ## Execution Tool
188
169
 
189
- Trigger another resource as a nested child of the current execution. The child runs synchronously and its result is returned. Maximum depth: 5 levels.
170
+ Trigger another resource as a nested child of the current execution. The child runs synchronously and its result is returned. Maximum depth: 5 levels. The invoked resource must belong to the same organization.
190
171
 
191
- ```typescript
192
- import { execution } from '@elevasis/sdk/worker'
193
-
194
- const result = await execution.trigger({
195
- resourceId: 'my-other-workflow',
196
- input: { key: 'value' },
197
- })
198
- // result = { success: true, executionId: '...', output: { ... }, error: undefined }
199
- ```
200
-
201
- The invoked resource must belong to the same organization.
172
+ See [Platform Adapters](adapters-platform.mdx#execution-adapter) for usage.
202
173
 
203
174
  ## Database Access
204
175
 
@@ -231,123 +202,16 @@ const qualified = await platform.call({
231
202
  | `in` | `{ status: 'in.(new,contacted)' }` | In set |
232
203
  | `is` | `{ deleted_at: 'is.null' }` | Null check |
233
204
 
234
- **Credential setup:** Create a credential with provider `supabase` config fields are `url` and `serviceRoleKey`. Workflows always use the service role key (server-side, no RLS).
205
+ **Credential setup:** Create a credential with provider `supabase` -- config fields are `url` and `serviceRoleKey`. Workflows always use the service role key (server-side, no RLS).
235
206
 
236
207
  **`/database init`:** Guided setup that stores your Supabase credential, generates `data/schema.ts`, and creates `docs/database.mdx`.
237
208
 
238
- **`data/schema.ts`:** An agent-readable Zod schema documenting your table structure. Not deployed or executed — the agent reads it to understand your data model.
239
-
240
- ---
241
-
242
- ## Code Examples
243
-
244
- ### Email via Resend
245
-
246
- ```typescript
247
- import { createResendAdapter } from '@elevasis/sdk/worker'
248
-
249
- const resend = createResendAdapter('resend')
250
- await resend.sendEmail({
251
- from: 'hello@yourapp.com',
252
- to: 'customer@example.com',
253
- subject: 'Your order is confirmed',
254
- html: '\<p\>Thank you for your order!\</p\>',
255
- })
256
- ```
257
-
258
- ### CRM Record via Attio
259
-
260
- ```typescript
261
- import { createAttioAdapter } from '@elevasis/sdk/worker'
262
-
263
- const attio = createAttioAdapter('attio')
264
- const result = await attio.createRecord({
265
- object: 'people',
266
- values: {
267
- name: [{ full_name: 'Jane Smith' }],
268
- email_addresses: [{ email_address: 'jane@example.com' }],
269
- },
270
- })
271
- const recordId = result.data.id
272
- ```
273
-
274
- ### PDF Generation
275
-
276
- ```typescript
277
- import { pdf, storage } from '@elevasis/sdk/worker'
278
-
279
- // Render to storage directly
280
- const result = await pdf.render({
281
- document: proposalDocument,
282
- storage: { bucket: 'invoices', path: 'invoice-1042.pdf' },
283
- })
284
-
285
- // Or render to buffer for inline processing
286
- const { buffer } = await pdf.renderToBuffer({ document: proposalDocument })
287
- await storage.upload({ bucket: 'invoices', path: 'invoice-1042.pdf', content: buffer, contentType: 'application/pdf' })
288
- ```
289
-
290
- ### LLM with Structured Output
291
-
292
- ```typescript
293
- import { llm } from '@elevasis/sdk/worker'
294
-
295
- interface TicketClassification {
296
- priority: 'low' | 'medium' | 'high' | 'critical'
297
- category: 'billing' | 'technical' | 'account' | 'other'
298
- summary: string
299
- }
300
-
301
- const response = await llm.generate\<TicketClassification\>({
302
- provider: 'anthropic',
303
- model: 'claude-sonnet-4-5',
304
- messages: [
305
- { role: 'system', content: 'Extract structured data from support tickets.' },
306
- { role: 'user', content: ticketText },
307
- ],
308
- responseSchema: {
309
- type: 'object',
310
- properties: {
311
- priority: { type: 'string', enum: ['low', 'medium', 'high', 'critical'] },
312
- category: { type: 'string', enum: ['billing', 'technical', 'account', 'other'] },
313
- summary: { type: 'string' },
314
- },
315
- required: ['priority', 'category', 'summary'],
316
- },
317
- temperature: 0.1,
318
- })
319
- const { priority, category, summary } = response.output
320
- ```
321
-
322
- ### Triggering Another Resource
323
-
324
- ```typescript
325
- import { execution } from '@elevasis/sdk/worker'
326
-
327
- const outcome = await execution.trigger({
328
- resourceId: 'send-welcome-sequence',
329
- input: { userId: newUser.id, email: newUser.email, plan: 'pro' },
330
- })
331
- if (!outcome.success) throw new Error(`Child workflow failed: ${outcome.error}`)
332
- ```
333
-
334
- ### File Storage
335
-
336
- ```typescript
337
- import { storage } from '@elevasis/sdk/worker'
338
-
339
- const reportPath = `exports/report-${Date.now()}.csv`
340
- await storage.upload({ bucket: 'exports', path: reportPath, content: csvContent, contentType: 'text/csv' })
341
-
342
- const { signedUrl } = await storage.createSignedUrl({ bucket: 'exports', path: reportPath })
343
- // signedUrl is valid for 1 hour (3600 seconds) -- share with user or include in email
344
- ```
345
-
346
209
  ---
347
210
 
348
211
  ## Documentation
349
212
 
350
- - [Typed Adapters](adapters.mdx) - Type-safe wrappers for all 11 integrations + 9 platform services with full autocomplete (recommended)
213
+ - [Integration Adapters](adapters-integration.mdx) - All 12 integration adapters with method tables and code examples
214
+ - [Platform Adapters](adapters-platform.mdx) - All 9 platform service adapters with method tables and code examples
351
215
 
352
216
  ---
353
217
 
@@ -0,0 +1,47 @@
1
+ ---
2
+ title: Templates
3
+ description: Ready-to-use workflow templates for common automation patterns -- web scraping, data enrichment, email sending, lead scoring, PDF generation, text classification, and recurring jobs
4
+ ---
5
+
6
+ Templates are pre-built workflow definitions covering the most common SDK automation patterns. Each template includes a complete `WorkflowDefinition` with Zod schemas, step handlers, and real platform tool usage. Scaffold any template through Claude Code (`/work` then describe the template) or adapt the code manually.
7
+
8
+ Templates follow the same `WorkflowDefinition` structure as any custom resource -- they are reference implementations, not a special feature. The patterns demonstrated (multi-step chains, LLM structured output, Supabase CRUD, scheduler setup) apply directly to custom workflows you build.
9
+
10
+ All templates are available for any organization. Credentials specific to each template (Supabase, Resend, Apify, etc.) must be created in the command center before running the workflow.
11
+
12
+ ## Documentation
13
+
14
+ ### Data Collection
15
+
16
+ - [Web Scraper](web-scraper.mdx) - Apify actor runs web scrape, stores structured results in Supabase table
17
+ - [Data Enrichment](data-enrichment.mdx) - Reads Supabase records, enriches each with LLM, writes results back; supports batching
18
+
19
+ ### Communication
20
+
21
+ - [Email Sender](email-sender.mdx) - Transactional email via Resend with plain text and HTML support, single or multiple recipients
22
+ - [Lead Scorer](lead-scorer.mdx) - Multi-criteria LLM lead scoring with configurable rubric and Supabase result storage
23
+
24
+ ### Documents
25
+
26
+ - [PDF Generator](pdf-generator.mdx) - Renders structured data to PDF, uploads to platform storage, returns signed download URL
27
+ - [Text Classifier](text-classifier.mdx) - Multi-label text classification via LLM structured output, configurable categories and confidence scoring
28
+
29
+ ### Scheduling
30
+
31
+ - [Recurring Job](recurring-job.mdx) - Two-workflow setup pattern: a setup workflow creates the schedule, the job workflow runs on each trigger; uses idempotency keys for safe re-registration
32
+
33
+ ## Platform Tools Used
34
+
35
+ | Template | Platform Tools | Credentials Needed |
36
+ | --------------- | ------------------- | ------------------------------- |
37
+ | Web Scraper | `apify`, `supabase` | `apify`, `my-database` |
38
+ | Data Enrichment | `llm`, `supabase` | `my-database` (LLM server-side) |
39
+ | Email Sender | `resend` | `my-resend` |
40
+ | Lead Scorer | `llm`, `supabase` | `my-database` (LLM server-side) |
41
+ | PDF Generator | `pdf`, `storage` | None (platform services) |
42
+ | Text Classifier | `llm` | None (LLM server-side) |
43
+ | Recurring Job | `scheduler` | None (platform service) |
44
+
45
+ ---
46
+
47
+ **Last Updated:** 2026-03-19