@elevasis/sdk 1.30.2 → 1.32.0

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.
@@ -122,7 +122,7 @@ Credentials are created in the command center UI: navigate to Credentials -> Add
122
122
 
123
123
  The SDK ships 12 platform service singletons available without a `credential` field -- imported directly from `@elevasis/sdk/worker`: `scheduler`, `llm`, `storage`, `notifications`, `acqDb`, `projects`, `crm`, `list`, `pdf`, `approval`, `execution`, and `email`. The platform injects context server-side, so no credential is passed.
124
124
 
125
- For the full per-service method tables (including the `acqDb` 41-method surface), see [Platform Adapters](adapters-platform.mdx) -- generated from the adapter source.
125
+ For the full per-service method tables (including the `acqDb` 56-method surface), see [Platform Adapters](adapters-platform.mdx) -- generated from the adapter source.
126
126
 
127
127
  ## LLM Tool
128
128
 
@@ -130,12 +130,12 @@ Call any supported LLM from your workflow with no API keys required. Keys are re
130
130
 
131
131
  **Supported models:**
132
132
 
133
- | Provider | Models |
134
- | ------------ | -------------------------------------------------------------------------------------------------------------- |
135
- | `google` | `gemini-3-flash-preview` |
136
- | `openai` | `gpt-5`, `gpt-5-mini` |
137
- | `anthropic` | `claude-opus-4-5`, `claude-sonnet-4-5`, `claude-haiku-4-5` |
138
- | `openrouter` | `openrouter/anthropic/claude-sonnet-4.5`, `openrouter/deepseek/deepseek-v3.2`, `openrouter/x-ai/grok-4.1-fast` |
133
+ | Provider | Models |
134
+ | ------------ | --------------------------------------------------------- |
135
+ | `google` | `gemini-3-flash-preview`, `gemini-3.1-flash-lite-preview` |
136
+ | `openai` | `gpt-5`, `gpt-5.4-mini`, `gpt-5.4-nano` |
137
+ | `anthropic` | `claude-sonnet-4-5` |
138
+ | `openrouter` | `openrouter/z-ai/glm-5` |
139
139
 
140
140
  **Key params:** `provider`, `model`, `messages` (`{ role, content }[]`), `responseSchema` (optional JSON Schema), `temperature` (optional).
141
141
 
@@ -219,11 +219,11 @@ const routerStep: WorkflowStep = {
219
219
  type: 'conditional',
220
220
  routes: [
221
221
  {
222
- condition: (output) => (output as { score: number }).score \>= 80,
222
+ condition: (output) => (output as { score: number }).score >= 80,
223
223
  target: 'highScorePath',
224
224
  },
225
225
  {
226
- condition: (output) => (output as { score: number }).score \>= 50,
226
+ condition: (output) => (output as { score: number }).score >= 50,
227
227
  target: 'mediumScorePath',
228
228
  },
229
229
  ],
@@ -285,7 +285,7 @@ const myAgent: AgentDefinition = {
285
285
  status: 'dev',
286
286
  },
287
287
  agentConfig: {
288
- model: { provider: 'openai', model: 'gpt-4o' },
288
+ model: { provider: 'openai', model: 'gpt-5' },
289
289
  systemPrompt: 'You are a helpful assistant.',
290
290
  maxIterations: 10,
291
291
  },
@@ -1,162 +1,162 @@
1
- ---
2
- title: "Template: Data Enrichment"
3
- description: "LLM-powered enrichment of existing database records -- read rows, enrich each with an LLM, write results back to Supabase"
4
- loadWhen: "Applying the data-enrichment workflow template"
5
- ---
6
-
7
- **Category:** Data Processing
8
-
9
- **Platform Tools:** `llm` (text generation), `supabase` (select and update)
10
-
11
- **Credentials Required:**
12
-
13
- - `my-database` -- Supabase project URL and service role key
14
- - LLM API keys are resolved server-side from platform configuration (no credential name needed)
15
-
16
- ---
17
-
18
- ## What This Workflow Does
19
-
20
- Fetches records from a Supabase table that need enrichment, sends each record to an LLM with a custom prompt, and writes the enriched field back to the table. Supports batching to process multiple records per execution. Suitable for enriching leads with AI-generated summaries, classifying records, extracting structured data from text fields, or scoring records.
21
-
22
- ---
23
-
24
- ## Input Schema
25
-
26
- ```typescript
27
- z.object({
28
- table: z.string(), // Supabase table to enrich
29
- filter: z.record(z.string()).optional(), // Filter rows to enrich (PostgREST format)
30
- sourceField: z.string(), // Field to send to the LLM as input
31
- targetField: z.string(), // Field to write enriched output to
32
- prompt: z.string(), // LLM prompt template (use {value} as placeholder)
33
- limit: z.number().optional(), // Max rows to process (default: 20)
34
- })
35
- ```
36
-
37
- ## Output Schema
38
-
39
- ```typescript
40
- z.object({
41
- processed: z.number(), // Rows successfully enriched
42
- skipped: z.number(), // Rows skipped (missing source field, LLM error)
43
- errors: z.array(z.string()), // Error messages for skipped rows
44
- })
45
- ```
46
-
47
- ---
48
-
49
- ## Workflow Code Pattern
50
-
51
- ```typescript
52
- import type { WorkflowDefinition } from '@elevasis/sdk'
53
- import { platform } from '@elevasis/sdk/worker'
54
- import { z } from 'zod'
55
-
56
- const inputSchema = z.object({
57
- table: z.string(),
58
- filter: z.record(z.string()).optional(),
59
- sourceField: z.string(),
60
- targetField: z.string(),
61
- prompt: z.string(),
62
- limit: z.number().optional(),
63
- })
64
- const outputSchema = z.object({
65
- processed: z.number(),
66
- skipped: z.number(),
67
- errors: z.array(z.string()),
68
- })
69
-
70
- type Input = z.infer<typeof inputSchema>
71
-
72
- export const dataEnrichment: WorkflowDefinition = {
73
- config: {
74
- resourceId: 'data-enrichment',
75
- name: 'Data Enrichment',
76
- type: 'workflow',
77
- description: 'Enriches database records using an LLM',
78
- version: '1.0.0',
79
- status: 'dev',
80
- },
81
- contract: { inputSchema, outputSchema },
82
- steps: {
83
- enrich: {
84
- id: 'enrich',
85
- name: 'Enrich Records',
86
- description: 'Fetch records, call LLM for each, write results back',
87
- inputSchema,
88
- outputSchema,
89
- handler: async (input, context) => {
90
- const { table, filter, sourceField, targetField, prompt, limit } = input as Input
91
-
92
- // Fetch rows to enrich
93
- const rows = await platform.call({
94
- tool: 'supabase',
95
- method: 'select',
96
- credential: 'my-database',
97
- params: { table, filter, limit: limit ?? 20 },
98
- }) as Array<Record<string, unknown>>
99
-
100
- let processed = 0
101
- const errors: string[] = []
102
-
103
- for (const row of rows) {
104
- const sourceValue = row[sourceField]
105
- if (!sourceValue || typeof sourceValue !== 'string') {
106
- errors.push(`Row ${String(row.id)}: missing ${sourceField}`)
107
- continue
108
- }
109
-
110
- try {
111
- const enrichedPrompt = prompt.replace('{value}', sourceValue)
112
- const result = await platform.call({
113
- tool: 'llm',
114
- method: 'generate',
115
- params: {
116
- provider: 'openai',
117
- model: 'gpt-4o-mini',
118
- messages: [{ role: 'user', content: enrichedPrompt }],
119
- },
120
- }) as string
121
-
122
- await platform.call({
123
- tool: 'supabase',
124
- method: 'update',
125
- credential: 'my-database',
126
- params: {
127
- table,
128
- filter: { id: `eq.${String(row.id)}` },
129
- data: { [targetField]: result },
130
- },
131
- })
132
-
133
- context.logger.info('Enriched row', { id: row.id })
134
- processed++
135
- } catch (err) {
136
- const msg = err instanceof Error ? err.message : String(err)
137
- errors.push(`Row ${String(row.id)}: ${msg}`)
138
- }
139
- }
140
-
141
- return { processed, skipped: errors.length, errors }
142
- },
143
- next: null,
144
- },
145
- },
146
- entryPoint: 'enrich',
147
- }
148
- ```
149
-
150
- ---
151
-
152
- ## Adaptation Notes
153
-
154
- - **Credential name:** Replace `'my-database'` with the user's database credential name.
155
- - **LLM provider and model:** Default uses `openai` / `gpt-4o-mini`. Adapt to the user's preference or available providers.
156
- - **Prompt template:** The `{value}` placeholder is replaced with the source field's value at runtime. Adapt the prompt for the user's specific enrichment task.
157
- - **Batch size:** Default limit is 20 rows. Increase for bulk processing, decrease for expensive LLM calls.
158
- - **Skill adaptation:** For beginners, explain what "enrichment" means and give concrete examples (adding a summary field, scoring, categorizing) before generating code.
159
-
160
- ---
161
-
162
- **Last Updated:** 2026-02-26
1
+ ---
2
+ title: "Template: Data Enrichment"
3
+ description: "LLM-powered enrichment of existing database records -- read rows, enrich each with an LLM, write results back to Supabase"
4
+ loadWhen: "Applying the data-enrichment workflow template"
5
+ ---
6
+
7
+ **Category:** Data Processing
8
+
9
+ **Platform Tools:** `llm` (text generation), `supabase` (select and update)
10
+
11
+ **Credentials Required:**
12
+
13
+ - `my-database` -- Supabase project URL and service role key
14
+ - LLM API keys are resolved server-side from platform configuration (no credential name needed)
15
+
16
+ ---
17
+
18
+ ## What This Workflow Does
19
+
20
+ Fetches records from a Supabase table that need enrichment, sends each record to an LLM with a custom prompt, and writes the enriched field back to the table. Supports batching to process multiple records per execution. Suitable for enriching leads with AI-generated summaries, classifying records, extracting structured data from text fields, or scoring records.
21
+
22
+ ---
23
+
24
+ ## Input Schema
25
+
26
+ ```typescript
27
+ z.object({
28
+ table: z.string(), // Supabase table to enrich
29
+ filter: z.record(z.string()).optional(), // Filter rows to enrich (PostgREST format)
30
+ sourceField: z.string(), // Field to send to the LLM as input
31
+ targetField: z.string(), // Field to write enriched output to
32
+ prompt: z.string(), // LLM prompt template (use {value} as placeholder)
33
+ limit: z.number().optional(), // Max rows to process (default: 20)
34
+ })
35
+ ```
36
+
37
+ ## Output Schema
38
+
39
+ ```typescript
40
+ z.object({
41
+ processed: z.number(), // Rows successfully enriched
42
+ skipped: z.number(), // Rows skipped (missing source field, LLM error)
43
+ errors: z.array(z.string()), // Error messages for skipped rows
44
+ })
45
+ ```
46
+
47
+ ---
48
+
49
+ ## Workflow Code Pattern
50
+
51
+ ```typescript
52
+ import type { WorkflowDefinition } from '@elevasis/sdk'
53
+ import { platform } from '@elevasis/sdk/worker'
54
+ import { z } from 'zod'
55
+
56
+ const inputSchema = z.object({
57
+ table: z.string(),
58
+ filter: z.record(z.string()).optional(),
59
+ sourceField: z.string(),
60
+ targetField: z.string(),
61
+ prompt: z.string(),
62
+ limit: z.number().optional(),
63
+ })
64
+ const outputSchema = z.object({
65
+ processed: z.number(),
66
+ skipped: z.number(),
67
+ errors: z.array(z.string()),
68
+ })
69
+
70
+ type Input = z.infer<typeof inputSchema>
71
+
72
+ export const dataEnrichment: WorkflowDefinition = {
73
+ config: {
74
+ resourceId: 'data-enrichment',
75
+ name: 'Data Enrichment',
76
+ type: 'workflow',
77
+ description: 'Enriches database records using an LLM',
78
+ version: '1.0.0',
79
+ status: 'dev',
80
+ },
81
+ contract: { inputSchema, outputSchema },
82
+ steps: {
83
+ enrich: {
84
+ id: 'enrich',
85
+ name: 'Enrich Records',
86
+ description: 'Fetch records, call LLM for each, write results back',
87
+ inputSchema,
88
+ outputSchema,
89
+ handler: async (input, context) => {
90
+ const { table, filter, sourceField, targetField, prompt, limit } = input as Input
91
+
92
+ // Fetch rows to enrich
93
+ const rows = await platform.call({
94
+ tool: 'supabase',
95
+ method: 'select',
96
+ credential: 'my-database',
97
+ params: { table, filter, limit: limit ?? 20 },
98
+ }) as Array<Record<string, unknown>>
99
+
100
+ let processed = 0
101
+ const errors: string[] = []
102
+
103
+ for (const row of rows) {
104
+ const sourceValue = row[sourceField]
105
+ if (!sourceValue || typeof sourceValue !== 'string') {
106
+ errors.push(`Row ${String(row.id)}: missing ${sourceField}`)
107
+ continue
108
+ }
109
+
110
+ try {
111
+ const enrichedPrompt = prompt.replace('{value}', sourceValue)
112
+ const result = await platform.call({
113
+ tool: 'llm',
114
+ method: 'generate',
115
+ params: {
116
+ provider: 'openai',
117
+ model: 'gpt-5.4-mini',
118
+ messages: [{ role: 'user', content: enrichedPrompt }],
119
+ },
120
+ }) as string
121
+
122
+ await platform.call({
123
+ tool: 'supabase',
124
+ method: 'update',
125
+ credential: 'my-database',
126
+ params: {
127
+ table,
128
+ filter: { id: `eq.${String(row.id)}` },
129
+ data: { [targetField]: result },
130
+ },
131
+ })
132
+
133
+ context.logger.info('Enriched row', { id: row.id })
134
+ processed++
135
+ } catch (err) {
136
+ const msg = err instanceof Error ? err.message : String(err)
137
+ errors.push(`Row ${String(row.id)}: ${msg}`)
138
+ }
139
+ }
140
+
141
+ return { processed, skipped: errors.length, errors }
142
+ },
143
+ next: null,
144
+ },
145
+ },
146
+ entryPoint: 'enrich',
147
+ }
148
+ ```
149
+
150
+ ---
151
+
152
+ ## Adaptation Notes
153
+
154
+ - **Credential name:** Replace `'my-database'` with the user's database credential name.
155
+ - **LLM provider and model:** Default uses `openai` / `gpt-5.4-mini`. Adapt to the user's preference or available providers.
156
+ - **Prompt template:** The `{value}` placeholder is replaced with the source field's value at runtime. Adapt the prompt for the user's specific enrichment task.
157
+ - **Batch size:** Default limit is 20 rows. Increase for bulk processing, decrease for expensive LLM calls.
158
+ - **Skill adaptation:** For beginners, explain what "enrichment" means and give concrete examples (adding a summary field, scoring, categorizing) before generating code.
159
+
160
+ ---
161
+
162
+ **Last Updated:** 2026-02-26