Skip to content

Commit 8c0a2e0

Browse files
v0.5.108: workflow input params in agent tools, bun upgrade, dropdown selectors for 14 blocks
2 parents 6586c5c + 0a52b09 commit 8c0a2e0

File tree

115 files changed

+5047
-2163
lines changed

Some content is hidden

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

115 files changed

+5047
-2163
lines changed

.claude/commands/add-block.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ When the user asks you to create a block:
2020
import { {ServiceName}Icon } from '@/components/icons'
2121
import type { BlockConfig } from '@/blocks/types'
2222
import { AuthMode } from '@/blocks/types'
23+
import { getScopesForService } from '@/lib/oauth/utils'
2324

2425
export const {ServiceName}Block: BlockConfig = {
2526
type: '{service}', // snake_case identifier
@@ -115,12 +116,17 @@ export const {ServiceName}Block: BlockConfig = {
115116
id: 'credential',
116117
title: 'Account',
117118
type: 'oauth-input',
118-
serviceId: '{service}', // Must match OAuth provider
119+
serviceId: '{service}', // Must match OAuth provider service key
120+
requiredScopes: getScopesForService('{service}'), // Import from @/lib/oauth/utils
119121
placeholder: 'Select account',
120122
required: true,
121123
}
122124
```
123125

126+
**Scopes:** Always use `getScopesForService(serviceId)` from `@/lib/oauth/utils` for `requiredScopes`. Never hardcode scope arrays — the single source of truth is `OAUTH_PROVIDERS` in `lib/oauth/oauth.ts`.
127+
128+
**Scope descriptions:** When adding a new OAuth provider, also add human-readable descriptions for all scopes in `SCOPE_DESCRIPTIONS` within `lib/oauth/utils.ts`.
129+
124130
### Selectors (with dynamic options)
125131
```typescript
126132
// Channel selector (Slack, Discord, etc.)
@@ -624,6 +630,7 @@ export const registry: Record<string, BlockConfig> = {
624630
import { ServiceIcon } from '@/components/icons'
625631
import type { BlockConfig } from '@/blocks/types'
626632
import { AuthMode } from '@/blocks/types'
633+
import { getScopesForService } from '@/lib/oauth/utils'
627634

628635
export const ServiceBlock: BlockConfig = {
629636
type: 'service',
@@ -654,6 +661,7 @@ export const ServiceBlock: BlockConfig = {
654661
title: 'Service Account',
655662
type: 'oauth-input',
656663
serviceId: 'service',
664+
requiredScopes: getScopesForService('service'),
657665
placeholder: 'Select account',
658666
required: true,
659667
},
@@ -792,7 +800,8 @@ All tool IDs referenced in `tools.access` and returned by `tools.config.tool` MU
792800
- [ ] Conditions use correct syntax (field, value, not, and)
793801
- [ ] DependsOn set for fields that need other values
794802
- [ ] Required fields marked correctly (boolean or condition)
795-
- [ ] OAuth inputs have correct `serviceId`
803+
- [ ] OAuth inputs have correct `serviceId` and `requiredScopes: getScopesForService(serviceId)`
804+
- [ ] Scope descriptions added to `SCOPE_DESCRIPTIONS` in `lib/oauth/utils.ts` for any new scopes
796805
- [ ] Tools.access lists all tool IDs (snake_case)
797806
- [ ] Tools.config.tool returns correct tool ID (snake_case)
798807
- [ ] Outputs match tool outputs

.claude/commands/add-integration.md

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ export const {service}{Action}Tool: ToolConfig<Params, Response> = {
114114
import { {Service}Icon } from '@/components/icons'
115115
import type { BlockConfig } from '@/blocks/types'
116116
import { AuthMode } from '@/blocks/types'
117+
import { getScopesForService } from '@/lib/oauth/utils'
117118

118119
export const {Service}Block: BlockConfig = {
119120
type: '{service}',
@@ -144,6 +145,7 @@ export const {Service}Block: BlockConfig = {
144145
title: '{Service} Account',
145146
type: 'oauth-input',
146147
serviceId: '{service}',
148+
requiredScopes: getScopesForService('{service}'),
147149
required: true,
148150
},
149151
// Conditional fields per operation
@@ -409,7 +411,7 @@ If creating V2 versions (API-aligned outputs):
409411
### Block
410412
- [ ] Created `blocks/blocks/{service}.ts`
411413
- [ ] Defined operation dropdown with all operations
412-
- [ ] Added credential field (oauth-input or short-input)
414+
- [ ] Added credential field with `requiredScopes: getScopesForService('{service}')`
413415
- [ ] Added conditional fields per operation
414416
- [ ] Set up dependsOn for cascading selectors
415417
- [ ] Configured tools.access with all tool IDs
@@ -419,6 +421,12 @@ If creating V2 versions (API-aligned outputs):
419421
- [ ] If triggers: set `triggers.enabled` and `triggers.available`
420422
- [ ] If triggers: spread trigger subBlocks with `getTrigger()`
421423

424+
### OAuth Scopes (if OAuth service)
425+
- [ ] Defined scopes in `lib/oauth/oauth.ts` under `OAUTH_PROVIDERS`
426+
- [ ] Added scope descriptions in `SCOPE_DESCRIPTIONS` within `lib/oauth/utils.ts`
427+
- [ ] Used `getCanonicalScopesForProvider()` in `auth.ts` (never hardcode)
428+
- [ ] Used `getScopesForService()` in block `requiredScopes` (never hardcode)
429+
422430
### Icon
423431
- [ ] Asked user to provide SVG
424432
- [ ] Added icon to `components/icons.tsx`
@@ -717,6 +725,25 @@ Use `wandConfig` for fields that are hard to fill out manually:
717725
}
718726
```
719727

728+
### OAuth Scopes (Centralized System)
729+
730+
Scopes are maintained in a single source of truth and reused everywhere:
731+
732+
1. **Define scopes** in `lib/oauth/oauth.ts` under `OAUTH_PROVIDERS[provider].services[service].scopes`
733+
2. **Add descriptions** in `SCOPE_DESCRIPTIONS` within `lib/oauth/utils.ts` for the OAuth modal UI
734+
3. **Reference in auth.ts** using `getCanonicalScopesForProvider(providerId)` from `@/lib/oauth/utils`
735+
4. **Reference in blocks** using `getScopesForService(serviceId)` from `@/lib/oauth/utils`
736+
737+
**Never hardcode scope arrays** in `auth.ts` or block `requiredScopes`. Always import from the centralized source.
738+
739+
```typescript
740+
// In auth.ts (Better Auth config)
741+
scopes: getCanonicalScopesForProvider('{service}'),
742+
743+
// In block credential sub-block
744+
requiredScopes: getScopesForService('{service}'),
745+
```
746+
720747
### Common Gotchas
721748

722749
1. **OAuth serviceId must match** - The `serviceId` in oauth-input must match the OAuth provider configuration
@@ -729,3 +756,5 @@ Use `wandConfig` for fields that are hard to fill out manually:
729756
8. **Always handle legacy file params** - Keep hidden `fileContent` params for backwards compatibility
730757
9. **Optional fields use advanced mode** - Set `mode: 'advanced'` on rarely-used optional fields
731758
10. **Complex inputs need wandConfig** - Timestamps, JSON arrays, and other hard-to-type values should have `wandConfig` enabled
759+
11. **Never hardcode scopes** - Use `getScopesForService()` in blocks and `getCanonicalScopesForProvider()` in auth.ts
760+
12. **Always add scope descriptions** - New scopes must have entries in `SCOPE_DESCRIPTIONS` within `lib/oauth/utils.ts`

.claude/commands/validate-integration.md

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ apps/sim/blocks/blocks/{service}.ts # Block definition
2626
apps/sim/tools/registry.ts # Tool registry entries for this service
2727
apps/sim/blocks/registry.ts # Block registry entry for this service
2828
apps/sim/components/icons.tsx # Icon definition
29-
apps/sim/lib/auth/auth.ts # OAuth scopes (if OAuth service)
30-
apps/sim/lib/oauth/oauth.ts # OAuth provider config (if OAuth service)
29+
apps/sim/lib/auth/auth.ts # OAuth config — should use getCanonicalScopesForProvider()
30+
apps/sim/lib/oauth/oauth.ts # OAuth provider config — single source of truth for scopes
31+
apps/sim/lib/oauth/utils.ts # Scope utilities, SCOPE_DESCRIPTIONS for modal UI
3132
```
3233

3334
## Step 2: Pull API Documentation
@@ -199,11 +200,14 @@ For **each tool** in `tools.access`:
199200

200201
## Step 5: Validate OAuth Scopes (if OAuth service)
201202

202-
- [ ] `auth.ts` scopes include ALL scopes needed by ALL tools in the integration
203-
- [ ] `oauth.ts` provider config scopes match `auth.ts` scopes
204-
- [ ] Block `requiredScopes` (if defined) matches `auth.ts` scopes
203+
Scopes are centralized — the single source of truth is `OAUTH_PROVIDERS` in `lib/oauth/oauth.ts`.
204+
205+
- [ ] Scopes defined in `lib/oauth/oauth.ts` under `OAUTH_PROVIDERS[provider].services[service].scopes`
206+
- [ ] `auth.ts` uses `getCanonicalScopesForProvider(providerId)` — NOT a hardcoded array
207+
- [ ] Block `requiredScopes` uses `getScopesForService(serviceId)` — NOT a hardcoded array
208+
- [ ] No hardcoded scope arrays in `auth.ts` or block files (should all use utility functions)
209+
- [ ] Each scope has a human-readable description in `SCOPE_DESCRIPTIONS` within `lib/oauth/utils.ts`
205210
- [ ] No excess scopes that aren't needed by any tool
206-
- [ ] Each scope has a human-readable description in `oauth-required-modal.tsx`'s `SCOPE_DESCRIPTIONS`
207211

208212
## Step 6: Validate Pagination Consistency
209213

@@ -244,7 +248,8 @@ Group findings by severity:
244248
- Missing `.trim()` on ID fields in request URLs
245249
- Missing `?? null` on nullable response fields
246250
- Block condition array missing an operation that uses that field
247-
- Missing scope description in `oauth-required-modal.tsx`
251+
- Hardcoded scope arrays instead of using `getScopesForService()` / `getCanonicalScopesForProvider()`
252+
- Missing scope description in `SCOPE_DESCRIPTIONS` within `lib/oauth/utils.ts`
248253

249254
**Suggestion** (minor improvements):
250255
- Better description text
@@ -273,7 +278,8 @@ After fixing, confirm:
273278
- [ ] Validated wandConfig on timestamps and complex inputs
274279
- [ ] Validated tools.config mapping, tool selector, and type coercions
275280
- [ ] Validated block outputs match what tools return, with typed JSON where possible
276-
- [ ] Validated OAuth scopes alignment across auth.ts, oauth.ts, block, and modal (if OAuth)
281+
- [ ] Validated OAuth scopes use centralized utilities (getScopesForService, getCanonicalScopesForProvider) — no hardcoded arrays
282+
- [ ] Validated scope descriptions exist in `SCOPE_DESCRIPTIONS` within `lib/oauth/utils.ts` for all scopes
277283
- [ ] Validated pagination consistency across tools and block
278284
- [ ] Validated error handling (error checks, meaningful messages)
279285
- [ ] Validated registry entries (tools and block, alphabetical, correct imports)

.devcontainer/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM oven/bun:1.3.9-alpine
1+
FROM oven/bun:1.3.10-alpine
22

33
# Install necessary packages for development
44
RUN apk add --no-cache \

.github/workflows/docs-embeddings.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
- name: Setup Bun
2121
uses: oven-sh/setup-bun@v2
2222
with:
23-
bun-version: 1.3.9
23+
bun-version: 1.3.10
2424

2525
- name: Setup Node
2626
uses: actions/setup-node@v4

.github/workflows/i18n.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
- name: Setup Bun
2424
uses: oven-sh/setup-bun@v2
2525
with:
26-
bun-version: 1.3.9
26+
bun-version: 1.3.10
2727

2828
- name: Cache Bun dependencies
2929
uses: actions/cache@v4
@@ -122,7 +122,7 @@ jobs:
122122
- name: Setup Bun
123123
uses: oven-sh/setup-bun@v2
124124
with:
125-
bun-version: 1.3.9
125+
bun-version: 1.3.10
126126

127127
- name: Cache Bun dependencies
128128
uses: actions/cache@v4

.github/workflows/migrations.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- name: Setup Bun
2020
uses: oven-sh/setup-bun@v2
2121
with:
22-
bun-version: 1.3.9
22+
bun-version: 1.3.10
2323

2424
- name: Cache Bun dependencies
2525
uses: actions/cache@v4

.github/workflows/publish-cli.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- name: Setup Bun
2020
uses: oven-sh/setup-bun@v2
2121
with:
22-
bun-version: 1.3.9
22+
bun-version: 1.3.10
2323

2424
- name: Setup Node.js for npm publishing
2525
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
@@ -19,7 +19,7 @@ jobs:
1919
- name: Setup Bun
2020
uses: oven-sh/setup-bun@v2
2121
with:
22-
bun-version: 1.3.9
22+
bun-version: 1.3.10
2323

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

.github/workflows/test-build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- name: Setup Bun
2020
uses: oven-sh/setup-bun@v2
2121
with:
22-
bun-version: 1.3.9
22+
bun-version: 1.3.10
2323

2424
- name: Setup Node
2525
uses: actions/setup-node@v4

0 commit comments

Comments
 (0)