Skip to content

Commit fad7dad

Browse files
authored
Merge pull request #10340 from simstudioai/chore/sync-dev-with-staging-2026-11-23
chore: sync dev with staging (2026-11-23)
2 parents a775c7b + 7823f52 commit fad7dad

10,387 files changed

Lines changed: 1310676 additions & 111682 deletions

File tree

Some content is hidden

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

‎.agents/skills/add-block/SKILL.md‎

Lines changed: 68 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@ export const {ServiceName}Block: BlockConfig = {
8383
// Multi-line input
8484
{ id: 'field', title: 'Label', type: 'long-input', placeholder: '...', rows: 6 }
8585

86-
// Password input
86+
// Password input: only for legacy blocks or a secret with no saved-credential fit
87+
// (model-provider keys, hosted-key pairs); a service token uses a saved credential
8788
{ id: 'apiKey', title: 'API Key', type: 'short-input', password: true }
8889
```
8990

@@ -136,6 +137,32 @@ export const {ServiceName}Block: BlockConfig = {
136137
}
137138
```
138139

140+
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+
139166
**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`.
140167

141168
**Scope descriptions:** When adding a new OAuth provider, also add human-readable descriptions for all scopes in `SCOPE_DESCRIPTIONS` within `lib/oauth/utils.ts`.
@@ -159,6 +186,40 @@ export const {ServiceName}Block: BlockConfig = {
159186

160187
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.
161188

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+
export const 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+
162223
### OAuth deployment availability (required for integration blocks)
163224

164225
A visible tools-category block with OAuth is deployment-gated. Its `oauth-input.serviceId` is
@@ -661,7 +722,8 @@ outputs: {
661722
When creating V2 blocks (alongside legacy V1):
662723

663724
```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.
665727
export const ServiceBlock: BlockConfig = {
666728
type: 'service',
667729
name: 'Service (Legacy)',
@@ -956,13 +1018,15 @@ When adding or changing `sunset.replacedBy`, run `bun run generate:block-success
9561018
map to resolve legacy and current block IDs consistently without importing the executable registry.
9571019
Verify it with `bun run check:block-successors`.
9581020

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+
9591023
Adding a block on its own needs no **tool metadata** regeneration — a block references existing
9601024
tool IDs through `tools.access` and does not change any tool's shape.
9611025

9621026
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`.
9631027

9641028
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`,
9661030
`bun run generate:deployment-config`, then `bun run check:audits`. Also run
9671031
`bun run apps/sim/scripts/check-block-registry.ts origin/staging` (CI runs it outside `check:audits`). Commit the
9681032
full generator output. For what each check verifies, see the `validate-integration` skill →
@@ -987,7 +1051,7 @@ Regenerate Derived Artifacts.
9871051
- [ ] Block + meta registered in registry-maps.ts (`BLOCK_REGISTRY` / `BLOCK_META_REGISTRY`)
9881052
- [ ] If `sunset.replacedBy` changed: regenerated and committed the block successor map; `bun run check:block-successors` passes
9891053
- [ ] If any tool was added, changed or removed alongside the block: ran `bun run generate:tool-metadata` and committed the artifacts
990-
- [ ] Ran `bun run scripts/generate-docs.ts`, reviewed the generated diff, and committed the integration catalog changes
1054+
- [ ] Ran `bun run generate:docs`, reviewed the generated diff, and committed the integration catalog changes
9911055
- [ ] `bun run check:integration-catalog` passes
9921056
- [ ] `bun run check:docs` passes (CI gate — fails on any stale generated docs page)
9931057
- [ ] If icon missing: asked user to provide SVG

‎.agents/skills/add-column-type/SKILL.md‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,15 @@ Registering the *type* is compiler-enforced. Registering its *metadata* is not,
141141

142142
Copy `currency`'s service function and orchestration branch.
143143

144+
## Workspace source and the workflow SDK
145+
146+
The workspace source table codec reads the registry, but the SDK restates each type: add the
147+
`column.<type>()` helper to `packages/workflow-sdk/src/workspace/table.d.ts` (the drift test in
148+
`apps/sim/lib/workspace-source/application/kinds/table/codec.test.ts` fails until you do), map the
149+
type's row value in `valueType()` (`packages/workflow-sdk/src/codegen/workspace.ts`, which defaults to
150+
`string`), and regenerate the embedded text (`bun packages/workflow-sdk/scripts/generate-embedded-text.ts`).
151+
See `.claude/rules/sim-workflow-code.md`.
152+
144153
## Checklist Before Finishing
145154

146155
- [ ] Id appended to `COLUMN_TYPES` in `column-types/types.ts`

‎.agents/skills/add-enrichment/SKILL.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ Because enrichments run on Sim's hosted keys by default, **every provider tool y
2222

2323
## Architecture (what you're plugging into)
2424

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`.
2727
- **`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.
2828
- **`enrichments/registry.ts`** — `ENRICHMENT_REGISTRY` / `ALL_ENRICHMENTS` / `getEnrichment`. Register new entries here.
2929

@@ -111,7 +111,7 @@ export { myEnrichment } from './my-enrichment'
111111
```
112112

113113
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.
115115
- `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).
116116
- Output `id`s are the keys `mapOutput` returns; output `name`s are the default column names (the user can rename them in the config).
117117

‎.agents/skills/add-integration/SKILL.md‎

Lines changed: 57 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ supported paths and choose the simplest supported setup for the intended user:
4343
| 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 |
4444
| API token or personal access token | Saved token service account when reusable connections are useful | Token permissions, identity verification, expiry and rotation |
4545
| Private key, certificate, or service-account JSON | Existing key-based service-account framework | Signing algorithm, audience, subject, tenant binding and key rotation |
46+
| 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.
4652

4753
Do not present customer-owned credentials as a way around a provider's approval requirements
4854
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
6672
region and permission selections on reconnect unless the user changes them. Verify documented
6773
identity endpoints rather than guessing which person a client-credentials token represents.
6874

75+
### Token credentials (API key, personal access token, token + host)
76+
77+
A service authenticated by a pasted key or token takes it through a saved token credential, never an
78+
inline `password` field, so one shared, verified credential serves every block. Wire it by the
79+
service id:
80+
81+
1. `apps/sim/lib/credentials/token-service-accounts/descriptors.ts`: a provider id and descriptor.
82+
Fields are `apiToken`, plus `domain` for a host, instance URL, or region and
83+
`providerWorkspaceId` for an account or org id; every listed field is required. Set `url: true`
84+
on a `domain` that is a URL whose scheme or path matters, so the connect form sends it as typed.
85+
2. `validators/token-checks.ts`: one `tokenCheckValidator` declaration (register it in
86+
`server.ts`). Make one cheap, documented read on the tools' own host with the tools' own auth,
87+
reusing their header and URL builders. `domain` and `workspaceId` normalize to exactly the form
88+
the tools build URLs from and throw for anything that could steer the host or path
89+
(`normalizeHttpBaseUrl`, `allowedDomain`, `refuseUnsafeTypedUrl`); the normalized domain is what
90+
the credential stores. Set `egress` when the user chooses the host. Add `forbiddenMeansScoped`,
91+
`rejectsKey`, or `provesKey` only for documented replies (probe a fake key to see how a bad one
92+
answers), and `errorBodyEchoesToken` when an error body echoes the token.
93+
3. `apps/sim/lib/oauth/oauth.ts` and `types.ts`: the service entry (`authType: 'service_account'`,
94+
`serviceAccountProviderId`).
95+
4. The tools' credential policy. A NEW integration's tools take a hidden `accessToken` and declare
96+
`oauth: { required: true, provider: '<service>', credentialKind: 'service-account' }`, pinning
97+
any host or account param with `authoritativeParams` (Flow's and Snowflake's tools are the
98+
pattern). `tokenCredentialOAuth('<service>', { <toolParam>: 'accessToken' | 'domain' |
99+
'providerWorkspaceId' })` in `apps/sim/tools/shared/saved-credentials.ts`, listed in
100+
`SAVED_CREDENTIAL_OAUTH`, is for existing tools that already take the token inline (successors).
101+
Either way, the executor overwrites mapped and pinned params after authorizing the credential,
102+
and `check-block-registry` probes the real URL builders of every block with a saved-credential
103+
picker and fails on a host-steering param left unmapped or unpinned.
104+
5. A credential-only block (including a successor) uses `authMode: AuthMode.OAuth`, so the
105+
generated catalog maps the service; a token-only block that keeps `AuthMode.ApiKey`, as Coda
106+
does, registers in `tokenCredentialIntegrationTypes` instead (see below). The credential picker
107+
sits directly under the operation dropdown (`add-block` → OAuth/Credentials). A new block
108+
writes the picker inline, as Higgsfield does: `{ id: 'credential', type: 'oauth-input', serviceId,
109+
credentialKind: 'service-account', canonicalParamId: 'oauthCredential', mode: 'basic',
110+
required: true }`, plus a `manualCredential` `short-input` with the same `canonicalParamId` in
111+
`mode: 'advanced'`. An existing block that already takes the secret inline is never edited in
112+
place: add a credential-only successor (`add-block` → Credential-only successor).
113+
114+
Then run `bun run generate` (every generated artifact, docs included) and
115+
`check-block-registry.ts origin/staging`. This pattern does not fit
116+
hosted-key tools, model-provider keys, two-secret or username/password logins, or a host chosen
117+
per call.
118+
69119
### Pair saved credentials with block and resource selectors
70120

71121
`oauth-input` is the shared saved-credential picker, including for service accounts that never
@@ -321,6 +371,8 @@ export const BLOCK_META_REGISTRY: Record<string, BlockMeta> = {
321371
}
322372
```
323373

374+
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+
324376
### Trigger Registry (`apps/sim/triggers/registry.ts`) - If triggers exist
325377

326378
```typescript
@@ -386,7 +438,7 @@ a resolvable capability must fail validation; an independent service account use
386438

387439
## Step 8: Generate and Validate the Catalog
388440

389-
Run `bun run generate:tool-metadata`, `bun run scripts/generate-docs.ts`,
441+
Run `bun run generate:tool-metadata`, `bun run generate:docs`,
390442
`bun run generate:deployment-config`, then `bun run check:audits` (see the `validate-integration`
391443
skill → Regenerate Derived Artifacts for the full list and what each check verifies).
392444

@@ -412,7 +464,7 @@ In Sim, the {Service} block lets your agents {concrete workflow uses}.
412464

413465
Group the bullets by what the user gets done, not one bullet per tool. Only describe operations the
414466
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.
416468

417469
The docs generator refreshes `packages/deployment-config/src/integrations.json`, and the deployment
418470
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):
425477

426478
1. **V2 Tools** - Add `_v2` suffix, version `2.0.0`, flat outputs
427479
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
429482
`sunset: { status: 'legacy', replacedBy: '{service}_v2' }` — `check-block-registry`
430483
fails a legacy block with no `replacedBy`, and the amber legacy badge plus its
431484
click-to-upgrade action read from that field.
@@ -529,7 +582,7 @@ If creating V2 versions (API-aligned outputs):
529582
- [ ] Registered all triggers in `triggers/registry.ts`
530583

531584
### Docs and deployment metadata
532-
- [ ] Ran `bun run scripts/generate-docs.ts`
585+
- [ ] Ran `bun run generate:docs`
533586
- [ ] Ran `bun run generate:deployment-config` for OAuth or service-account changes
534587
- [ ] Verified docs file created
535588
- [ ] Wrote the `{/* MANUAL-CONTENT-START:intro */}` section under `<BlockInfoCard />` and confirmed it survives a regenerate

0 commit comments

Comments
 (0)