Skip to content

Commit c0f5ba7

Browse files
authored
v0.4.11: webhook, knowledgebase, billing fixes & redis for sessions
2 parents c04eb01 + 5a943bc commit c0f5ba7

File tree

85 files changed

+9928
-1170
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+9928
-1170
lines changed

.github/workflows/docs-embeddings.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
- name: Setup Bun
1818
uses: oven-sh/setup-bun@v2
1919
with:
20-
bun-version: latest
20+
bun-version: 1.2.22
2121

2222
- name: Setup Node
2323
uses: actions/setup-node@v4

.github/workflows/i18n.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
- name: Setup Bun
2828
uses: oven-sh/setup-bun@v2
2929
with:
30-
bun-version: latest
30+
bun-version: 1.2.22
3131

3232
- name: Run Lingo.dev translations
3333
env:
@@ -116,7 +116,7 @@ jobs:
116116
- name: Setup Bun
117117
uses: oven-sh/setup-bun@v2
118118
with:
119-
bun-version: latest
119+
bun-version: 1.2.22
120120

121121
- name: Install dependencies
122122
run: |

.github/workflows/migrations.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- name: Setup Bun
1717
uses: oven-sh/setup-bun@v2
1818
with:
19-
bun-version: latest
19+
bun-version: 1.2.22
2020

2121
- name: Install dependencies
2222
run: bun install

.github/workflows/publish-cli.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- name: Setup Bun
1717
uses: oven-sh/setup-bun@v2
1818
with:
19-
bun-version: latest
19+
bun-version: 1.2.22
2020

2121
- name: Setup Node.js for npm publishing
2222
uses: actions/setup-node@v4

.github/workflows/publish-ts-sdk.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- name: Setup Bun
1717
uses: oven-sh/setup-bun@v2
1818
with:
19-
bun-version: latest
19+
bun-version: 1.2.22
2020

2121
- name: Setup Node.js for npm publishing
2222
uses: actions/setup-node@v4

.github/workflows/test-build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- name: Setup Bun
1717
uses: oven-sh/setup-bun@v2
1818
with:
19-
bun-version: latest
19+
bun-version: 1.2.22
2020

2121
- name: Setup Node
2222
uses: actions/setup-node@v4

.github/workflows/trigger-deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
- name: Setup Bun
2828
uses: oven-sh/setup-bun@v2
2929
with:
30-
bun-version: latest
30+
bun-version: 1.2.22
3131

3232
- name: Install dependencies
3333
run: bun install

apps/docs/content/docs/en/execution/costs.mdx

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,38 @@ Different subscription plans have different usage limits:
166166
| **Team** | $500 (pooled) | 50 sync, 100 async |
167167
| **Enterprise** | Custom | Custom |
168168

169+
## Billing Model
170+
171+
Sim uses a **base subscription + overage** billing model:
172+
173+
### How It Works
174+
175+
**Pro Plan ($20/month):**
176+
- Monthly subscription includes $20 of usage
177+
- Usage under $20 → No additional charges
178+
- Usage over $20 → Pay the overage at month end
179+
- Example: $35 usage = $20 (subscription) + $15 (overage)
180+
181+
**Team Plan ($40/seat/month):**
182+
- Pooled usage across all team members
183+
- Overage calculated from total team usage
184+
- Organization owner receives one bill
185+
186+
**Enterprise Plans:**
187+
- Fixed monthly price, no overages
188+
- Custom usage limits per agreement
189+
190+
### Threshold Billing
191+
192+
When unbilled overage reaches $50, Sim automatically bills the full unbilled amount.
193+
194+
**Example:**
195+
- Day 10: $70 overage → Bill $70 immediately
196+
- Day 15: Additional $35 usage ($105 total) → Already billed, no action
197+
- Day 20: Another $50 usage ($155 total, $85 unbilled) → Bill $85 immediately
198+
199+
This spreads large overage charges throughout the month instead of one large bill at period end.
200+
169201
## Cost Management Best Practices
170202

171203
1. **Monitor Regularly**: Check your usage dashboard frequently to avoid surprises

apps/docs/content/docs/en/sdks/typescript.mdx

Lines changed: 79 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -593,14 +593,91 @@ async function executeClientSideWorkflow() {
593593
});
594594

595595
console.log('Workflow result:', result);
596-
596+
597597
// Update UI with result
598-
document.getElementById('result')!.textContent =
598+
document.getElementById('result')!.textContent =
599599
JSON.stringify(result.output, null, 2);
600600
} catch (error) {
601601
console.error('Error:', error);
602602
}
603603
}
604+
```
605+
606+
### File Upload
607+
608+
File objects are automatically detected and converted to base64 format. Include them in your input under the field name matching your workflow's API trigger input format.
609+
610+
The SDK converts File objects to this format:
611+
```typescript
612+
{
613+
type: 'file',
614+
data: 'data:mime/type;base64,base64data',
615+
name: 'filename',
616+
mime: 'mime/type'
617+
}
618+
```
619+
620+
Alternatively, you can manually provide files using the URL format:
621+
```typescript
622+
{
623+
type: 'url',
624+
data: 'https://example.com/file.pdf',
625+
name: 'file.pdf',
626+
mime: 'application/pdf'
627+
}
628+
```
629+
630+
<Tabs items={['Browser', 'Node.js']}>
631+
<Tab value="Browser">
632+
```typescript
633+
import { SimStudioClient } from 'simstudio-ts-sdk';
634+
635+
const client = new SimStudioClient({
636+
apiKey: process.env.NEXT_PUBLIC_SIM_API_KEY!
637+
});
638+
639+
// From file input
640+
async function handleFileUpload(event: Event) {
641+
const input = event.target as HTMLInputElement;
642+
const files = Array.from(input.files || []);
643+
644+
// Include files under the field name from your API trigger's input format
645+
const result = await client.executeWorkflow('workflow-id', {
646+
input: {
647+
documents: files, // Must match your workflow's "files" field name
648+
instructions: 'Analyze these documents'
649+
}
650+
});
651+
652+
console.log('Result:', result);
653+
}
654+
```
655+
</Tab>
656+
<Tab value="Node.js">
657+
```typescript
658+
import { SimStudioClient } from 'simstudio-ts-sdk';
659+
import fs from 'fs';
660+
661+
const client = new SimStudioClient({
662+
apiKey: process.env.SIM_API_KEY!
663+
});
664+
665+
// Read file and create File object
666+
const fileBuffer = fs.readFileSync('./document.pdf');
667+
const file = new File([fileBuffer], 'document.pdf', {
668+
type: 'application/pdf'
669+
});
670+
671+
// Include files under the field name from your API trigger's input format
672+
const result = await client.executeWorkflow('workflow-id', {
673+
input: {
674+
documents: [file], // Must match your workflow's "files" field name
675+
query: 'Summarize this document'
676+
}
677+
});
678+
```
679+
</Tab>
680+
</Tabs>
604681

605682
// Attach to button click
606683
document.getElementById('executeBtn')?.addEventListener('click', executeClientSideWorkflow);

apps/docs/content/docs/en/triggers/api.mdx

Lines changed: 57 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,17 @@ The API trigger exposes your workflow as a secure HTTP endpoint. Send JSON data
2222
/>
2323
</div>
2424

25-
Add an **Input Format** field for each parameter. Runtime output keys mirror the schema and are also available under `<api.input>`.
25+
Add an **Input Format** field for each parameter. Supported types:
2626

27-
Manual runs in the editor use the `value` column so you can test without sending a request. During execution the resolver populates both `<api.userId>` and `<api.input.userId>`.
27+
- **string** - Text values
28+
- **number** - Numeric values
29+
- **boolean** - True/false values
30+
- **json** - JSON objects
31+
- **files** - File uploads (access via `<api.fieldName[0].url>`, `<api.fieldName[0].name>`, etc.)
32+
33+
Runtime output keys mirror the schema and are available under `<api.input>`.
34+
35+
Manual runs in the editor use the `value` column so you can test without sending a request. During execution the resolver populates both `<api.fieldName>` and `<api.input.fieldName>`.
2836

2937
## Request Example
3038

@@ -123,6 +131,53 @@ data: {"blockId":"agent1-uuid","chunk":" complete"}
123131
| `<api.field>` | Field defined in the Input Format |
124132
| `<api.input>` | Entire structured request body |
125133

134+
### File Upload Format
135+
136+
The API accepts files in two formats:
137+
138+
**1. Base64-encoded files** (recommended for SDKs):
139+
```json
140+
{
141+
"documents": [{
142+
"type": "file",
143+
"data": "data:application/pdf;base64,JVBERi0xLjQK...",
144+
"name": "document.pdf",
145+
"mime": "application/pdf"
146+
}]
147+
}
148+
```
149+
- Maximum file size: 20MB per file
150+
- Files are uploaded to cloud storage and converted to UserFile objects with all properties
151+
152+
**2. Direct URL references**:
153+
```json
154+
{
155+
"documents": [{
156+
"type": "url",
157+
"data": "https://example.com/document.pdf",
158+
"name": "document.pdf",
159+
"mime": "application/pdf"
160+
}]
161+
}
162+
```
163+
- File is not uploaded, URL is passed through directly
164+
- Useful for referencing existing files
165+
166+
### File Properties
167+
168+
For files, access all properties:
169+
170+
| Property | Description | Type |
171+
|----------|-------------|------|
172+
| `<api.fieldName[0].url>` | Signed download URL | string |
173+
| `<api.fieldName[0].name>` | Original filename | string |
174+
| `<api.fieldName[0].size>` | File size in bytes | number |
175+
| `<api.fieldName[0].type>` | MIME type | string |
176+
| `<api.fieldName[0].uploadedAt>` | Upload timestamp (ISO 8601) | string |
177+
| `<api.fieldName[0].expiresAt>` | URL expiry timestamp (ISO 8601) | string |
178+
179+
For URL-referenced files, the same properties are available except `uploadedAt` and `expiresAt` since the file is not uploaded to our storage.
180+
126181
If no Input Format is defined, the executor exposes the raw JSON at `<api.input>` only.
127182

128183
<Callout type="warning">

0 commit comments

Comments
 (0)