You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 7823f52
Browse filesBrowse the repository at this point in the historyBrowse files
A service-account-only picker (a saved token or key credential) instead sets
141
+
`credentialKind: 'service-account'` and `mode: 'basic'` (no scopes), and pairs with an advanced
142
+
twin; `isSavedCredentialPicker` matches only this shape:
143
+
```typescript
144
+
{
145
+
id: 'credential',
146
+
title: '{Service} Account',
147
+
type: 'oauth-input',
148
+
serviceId: '{service}',
149
+
credentialKind: 'service-account',
150
+
canonicalParamId: 'oauthCredential',
151
+
mode: 'basic',
152
+
placeholder: 'Select {Service} credential',
153
+
required: true,
154
+
},
155
+
{
156
+
id: 'manualCredential',
157
+
title: '{Service} Account',
158
+
type: 'short-input',
159
+
canonicalParamId: 'oauthCredential',
160
+
mode: 'advanced',
161
+
placeholder: 'Enter credential ID',
162
+
required: true,
163
+
}
164
+
```
165
+
139
166
**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`.
140
167
141
168
**Scope descriptions:** When adding a new OAuth provider, also add human-readable descriptions for all scopes in `SCOPE_DESCRIPTIONS` within `lib/oauth/utils.ts`.
Optional companions: `credentialLabels` (override the picker's section/connect-row copy) and `allowServiceAccounts: true` (trigger-mode only — list service accounts, which triggers otherwise exclude; set only when the trigger's polling path can resolve a service-account token). The connect modal, provider families (Google JSON key, Atlassian token, token-paste, client-credential, Slack bot), and the preview gate are all resolved from `serviceAccountProviderId` — you don't wire them per block.
161
188
189
+
### Credential-only successor (replacing inline secrets)
190
+
191
+
A block that takes a secret inline keeps running for existing workflows; the saved-credential
192
+
version is a new block type that spreads it. Keep the successor an object literal with the picker
193
+
written inline, because the docs generator reads the source text:
194
+
195
+
```typescript
196
+
exportconst ServiceV2Block:BlockConfig= {
197
+
...ServiceBlock,
198
+
type: 'service_v2',
199
+
authMode: AuthMode.OAuth,
200
+
hideFromToolbar: false,
201
+
sunset: undefined,
202
+
...withSavedCredential(ServiceBlock, {
203
+
id: 'credential',
204
+
type: 'oauth-input',
205
+
serviceId: 'service',
206
+
title: 'Service Credential',
207
+
}),
208
+
}
209
+
```
210
+
211
+
- The legacy block changes only by `hideFromToolbar: true` and `sunset: { status: 'legacy',
212
+
replacedBy: 'service_v2' }` (an older `_v2` points at the new `_v3`). Register both types.
213
+
-`withSavedCredential` (`blocks/utils.ts`) swaps exactly the fields its policy in
214
+
`SAVED_CREDENTIAL_OAUTH` supplies for the picker, places it directly under the operation
215
+
dropdown, inherits the replaced fields' `condition` and `required`, and leaves trigger-mode
216
+
fields alone. Pass `required` when the replaced fields disagree (an optional host), and `params`
217
+
only when the legacy params builder validates the secret: extract that builder so the legacy
218
+
block calls it unchanged (`blocks/legacy-builders.test.ts`) and the successor skips the check.
219
+
- Add the pair to `serializer/saved-credentials.test.ts` (`optionalIds` for replaced fields the
220
+
legacy block never required), and grep for code that hard-codes the legacy type (`getBlock`,
221
+
`integration.type ===`, availability lookups), which now resolves to the successor.
222
+
162
223
### OAuth deployment availability (required for integration blocks)
163
224
164
225
A visible tools-category block with OAuth is deployment-gated. Its `oauth-input.serviceId` is
@@ -661,7 +722,8 @@ outputs: {
661
722
When creating V2 blocks (alongside legacy V1):
662
723
663
724
```typescript
664
-
// V1 Block - mark as legacy
725
+
// V1 Block - mark as legacy. A credential-only successor is the exception: the
726
+
// successor keeps the legacy block's name, so neither block is renamed.
665
727
exportconst ServiceBlock:BlockConfig= {
666
728
type: 'service',
667
729
name: 'Service (Legacy)',
@@ -956,13 +1018,15 @@ When adding or changing `sunset.replacedBy`, run `bun run generate:block-success
956
1018
map to resolve legacy and current block IDs consistently without importing the executable registry.
957
1019
Verify it with `bun run check:block-successors`.
958
1020
1021
+
A new block type also needs `bun run generate:sdk-names` (commit the new `apps/sim/blocks/sdk-names/<type>.json` and the regenerated `apps/sim/blocks/sdk-names.generated.ts`; names are add-only, and a merge conflict in the generated module is resolved by rerunning the generator) so workflow source gets a typed builder for it; `check:sdk-names` fails CI until it runs.
1022
+
959
1023
Adding a block on its own needs no **tool metadata** regeneration — a block references existing
960
1024
tool IDs through `tools.access` and does not change any tool's shape.
961
1025
962
1026
But if the same change also adds, edits **or removes** a tool, run `bun run generate:tool-metadata` and commit the result, or CI fails on stale artifacts. That matters here because a block's `outputs` are authored to match its tools' outputs, and the UI reads those from the generated metadata, not the executable registry — an unregenerated tool change makes the block's outputs disagree with what the panel renders. See `.agents/skills/tool-registry-boundary/SKILL.md`.
963
1027
964
1028
A visible integration block does require the generated integration catalog and docs to be refreshed:
965
-
`bun run generate:tool-metadata` (only when a tool changed), `bun run scripts/generate-docs.ts`,
1029
+
`bun run generate:tool-metadata` (only when a tool changed), `bun run generate:docs`,
966
1030
`bun run generate:deployment-config`, then `bun run check:audits`. Also run
967
1031
`bun run apps/sim/scripts/check-block-registry.ts origin/staging` (CI runs it outside `check:audits`). Commit the
968
1032
full generator output. For what each check verifies, see the `validate-integration` skill →
Copy file name to clipboardExpand all lines: .agents/skills/add-enrichment/SKILL.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,8 +22,8 @@ Because enrichments run on Sim's hosted keys by default, **every provider tool y
22
22
23
23
## Architecture (what you're plugging into)
24
24
25
-
-**`enrichments/types.ts`** — `EnrichmentConfig { id, name, description, icon, inputs, outputs, providers }` and `EnrichmentProvider { id, label, toolId, buildParams, projectFailure, mapOutput, isVerified? }` — `toolProvider` fills `projectFailure` with the standard HTTP projection; override it only for a provider whose failure shape is nonstandard (see `enrichments/provider-failures/`). Providers are **plain data** (no `@/tools` import) so the catalog stays client-safe.
26
-
-**`enrichments/providers.ts`** — `toolProvider(...)` (typed passthrough) plus shared input helpers: `str(v)`, `normalizeDomain(v)`, `firstNonEmpty(arr)`, `splitName(fullName)`, and `projectEnrichmentProviderFailure`.
25
+
-**`enrichments/types.ts`** — `EnrichmentConfig { id, name, description, icon, inputs, outputs, providers }` and `EnrichmentProvider { id, label, toolId, buildParams, projectFailure, mapOutput, isVerified? }` — `toolProvider` fills `projectFailure` with the standard HTTP projection; override it only for a provider whose failure shape is nonstandard. Providers are **plain data** (no `@/tools` import) so the catalog stays client-safe.
26
+
-**`enrichments/providers.ts`** — `toolProvider(...)` (typed passthrough) plus shared input helpers: `str(v)`, `normalizeDomain(v)`, `splitName(fullName)`, and `projectEnrichmentProviderFailure`.
27
27
-**`enrichments/run.ts`** — the server-only cascade runner. Calls `executeTool(provider.toolId, { ...params, _context: { workspaceId, userId } })`, accumulates hosted-key cost, returns the first non-empty mapped result. **You do not edit this** — it works for any registry entry.
@@ -111,7 +111,7 @@ export { myEnrichment } from './my-enrichment'
111
111
```
112
112
113
113
Rules:
114
-
- Keep the file **client-safe**: import only `@sim/emcn/icons`, `@sim/utils/*`, `@/enrichments/providers`, `@/enrichments/provider-failures/*`, and the types. **Never import `@/tools`** here — the runner does the tool call.
114
+
- Keep the file **client-safe**: import only `@sim/emcn/icons`, `@sim/utils/*`, `@/enrichments/providers`, and the types. **Never import `@/tools`** here — the runner does the tool call.
115
115
-`buildParams` returns `null` when inputs are insufficient (provider skipped). `mapOutput` returns `null`/empty for a miss (falls through). Use `filterUndefined` when assembling optional tool params; coerce numbers explicitly (don't pass `''` to number outputs).
116
116
- Output `id`s are the keys `mapOutput` returns; output `name`s are the default column names (the user can rename them in the config).
Copy file name to clipboardExpand all lines: .agents/skills/add-integration/SKILL.md
+57-4Lines changed: 57 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -43,6 +43,12 @@ supported paths and choose the simplest supported setup for the intended user:
43
43
| Customer-owned client credentials | Saved `service_account` credential with a client ID and secret | Internal-app eligibility, grant activation, scope syntax, token lifetime and revocation behavior |
44
44
| API token or personal access token | Saved token service account when reusable connections are useful | Token permissions, identity verification, expiry and rotation |
| Cloud workload identity (AWS role, Databricks/Snowflake/Entra/GCP federation) | Keyless saved credential: Sim signs a short-lived OIDC token the customer's cloud trusts. Add the provider to every table in `lib/credentials/workload-identity/audiences.ts` (`WORKLOAD_IDENTITY_PROVIDERS`, its service-account provider ID map, `WORKLOAD_IDENTITY_KEYLESS_CONFIGS`, `WORKLOAD_IDENTITY_AUDIENCES`) and to `MIXED_MODE_PROVIDERS` in `lib/credentials/application/prepare-workload-identity.ts`| Issuer and audience the provider accepts, how the trust pins the subject, token lifetime |
47
+
48
+
API, CLI, and MCP callers set up keyless in two steps: `POST /api/v2/credentials/workload-identity/subjects`
49
+
(or `sim credentials keyless-subject <providerId> --output json`) returns the subject to trust and a
50
+
`keylessConfig`; they add its `requiredConfigFields` and create the credential with it. The provider
51
+
catalog advertises `keyless` only when the deployment can sign tokens.
46
52
47
53
Do not present customer-owned credentials as a way around a provider's approval requirements
48
54
for a shared public integration. Explain the supported account/app type in the setup docs. Keep
@@ -66,6 +72,50 @@ Use explicit permission choices when the supported operations have different acc
66
72
region and permission selections on reconnect unless the user changes them. Verify documented
67
73
identity endpoints rather than guessing which person a client-credentials token represents.
Then run `bun run generate:sdk-names` and commit the new `apps/sim/blocks/sdk-names/<type>.json` and the regenerated `apps/sim/blocks/sdk-names.generated.ts` (names are add-only: never edit or delete an existing entry; on a merge conflict in the generated module, rerun the generator), so workflow source gets a typed builder for the new block (`check:sdk-names` fails CI until it runs).
375
+
324
376
### Trigger Registry (`apps/sim/triggers/registry.ts`) - If triggers exist
325
377
326
378
```typescript
@@ -386,7 +438,7 @@ a resolvable capability must fail validation; an independent service account use
386
438
387
439
## Step 8: Generate and Validate the Catalog
388
440
389
-
Run `bun run generate:tool-metadata`, `bun run scripts/generate-docs.ts`,
441
+
Run `bun run generate:tool-metadata`, `bun run generate:docs`,
390
442
`bun run generate:deployment-config`, then `bun run check:audits` (see the `validate-integration`
391
443
skill → Regenerate Derived Artifacts for the full list and what each check verifies).
392
444
@@ -412,7 +464,7 @@ In Sim, the {Service} block lets your agents {concrete workflow uses}.
412
464
413
465
Group the bullets by what the user gets done, not one bullet per tool. Only describe operations the
414
466
block actually ships. Follow `.claude/rules/constitution.md` for voice. Re-run
415
-
`bun run scripts/generate-docs.ts` afterwards and confirm the section survived unchanged.
467
+
`bun run generate:docs` afterwards and confirm the section survived unchanged.
416
468
417
469
The docs generator refreshes `packages/deployment-config/src/integrations.json`, and the deployment
418
470
config generator projects service-account provider IDs from that catalog plus the canonical OAuth
@@ -425,7 +477,8 @@ If creating V2 versions (API-aligned outputs):
425
477
426
478
1.**V2 Tools** - Add `_v2` suffix, version `2.0.0`, flat outputs
427
479
2.**V2 Block** - Add `_v2` type, use `createVersionedToolSelector`
428
-
3.**V1 Block** - Add `(Legacy)` to name, set `hideFromToolbar: true`, and add
480
+
3.**V1 Block** - Add `(Legacy)` to name (a credential-only successor is the exception: it keeps
481
+
the legacy block's name), set `hideFromToolbar: true`, and add
0 commit comments