Skip to content

Commit 9942243

Browse files
committed
cleanup canonical tool param resolution code
1 parent a021023 commit 9942243

Some content is hidden

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

49 files changed

+821
-539
lines changed

.claude/commands/add-integration.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -206,10 +206,15 @@ export const {Service}Block: BlockConfig = {
206206
}
207207
```
208208

209-
**Critical:**
210-
- `canonicalParamId` must NOT match any other subblock's `id`, must be unique per block, and should only be used to link basic/advanced alternatives for the same parameter.
211-
- `mode` only controls UI visibility, NOT serialization. Without `canonicalParamId`, both basic and advanced field values would be sent.
212-
- Every subblock `id` must be unique within the block. Duplicate IDs cause conflicts even with different conditions.
209+
**Critical Canonical Param Rules:**
210+
- `canonicalParamId` must NOT match any subblock's `id` in the block
211+
- `canonicalParamId` must be unique per operation/condition context
212+
- Only use `canonicalParamId` to link basic/advanced alternatives for the same logical parameter
213+
- `mode` only controls UI visibility, NOT serialization. Without `canonicalParamId`, both basic and advanced field values would be sent
214+
- Every subblock `id` must be unique within the block. Duplicate IDs cause conflicts even with different conditions
215+
- **Required consistency:** If one subblock in a canonical group has `required: true`, ALL subblocks in that group must have `required: true` (prevents bypassing validation by switching modes)
216+
- **Inputs section:** Must list canonical param IDs (e.g., `fileId`), NOT raw subblock IDs (e.g., `fileSelector`, `manualFileId`)
217+
- **Params function:** Must use canonical param IDs, NOT raw subblock IDs (raw IDs are deleted after canonical transformation)
213218

214219
## Step 4: Add Icon
215220

.claude/rules/sim-integrations.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,36 @@ dependsOn: { all: ['authMethod'], any: ['credential', 'botToken'] }
157157
- `'both'` - Show in both modes (default)
158158
- `'trigger'` - Only when block is used as trigger
159159

160+
### `canonicalParamId` - Link basic/advanced alternatives
161+
162+
Use to map multiple UI inputs to a single logical parameter:
163+
164+
```typescript
165+
// Basic mode: Visual selector
166+
{
167+
id: 'fileSelector',
168+
type: 'file-selector',
169+
mode: 'basic',
170+
canonicalParamId: 'fileId',
171+
required: true,
172+
},
173+
// Advanced mode: Manual input
174+
{
175+
id: 'manualFileId',
176+
type: 'short-input',
177+
mode: 'advanced',
178+
canonicalParamId: 'fileId',
179+
required: true,
180+
},
181+
```
182+
183+
**Critical Rules:**
184+
- `canonicalParamId` must NOT match any subblock's `id`
185+
- `canonicalParamId` must be unique per operation/condition context
186+
- **Required consistency:** All subblocks in a canonical group must have the same `required` status
187+
- **Inputs section:** Must list canonical param IDs (e.g., `fileId`), NOT raw subblock IDs
188+
- **Params function:** Must use canonical param IDs (raw IDs are deleted after canonical transformation)
189+
160190
**Register in `blocks/registry.ts`:**
161191

162192
```typescript

.cursor/rules/sim-integrations.mdc

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,36 @@ dependsOn: { all: ['authMethod'], any: ['credential', 'botToken'] }
155155
- `'both'` - Show in both modes (default)
156156
- `'trigger'` - Only when block is used as trigger
157157

158+
### `canonicalParamId` - Link basic/advanced alternatives
159+
160+
Use to map multiple UI inputs to a single logical parameter:
161+
162+
```typescript
163+
// Basic mode: Visual selector
164+
{
165+
id: 'fileSelector',
166+
type: 'file-selector',
167+
mode: 'basic',
168+
canonicalParamId: 'fileId',
169+
required: true,
170+
},
171+
// Advanced mode: Manual input
172+
{
173+
id: 'manualFileId',
174+
type: 'short-input',
175+
mode: 'advanced',
176+
canonicalParamId: 'fileId',
177+
required: true,
178+
},
179+
```
180+
181+
**Critical Rules:**
182+
- `canonicalParamId` must NOT match any subblock's `id`
183+
- `canonicalParamId` must be unique per operation/condition context
184+
- **Required consistency:** All subblocks in a canonical group must have the same `required` status
185+
- **Inputs section:** Must list canonical param IDs (e.g., `fileId`), NOT raw subblock IDs
186+
- **Params function:** Must use canonical param IDs (raw IDs are deleted after canonical transformation)
187+
158188
**Register in `blocks/registry.ts`:**
159189

160190
```typescript

0 commit comments

Comments
 (0)