Skip to content

Commit 490ae31

Browse files
Merge remote-tracking branch 'origin/staging' into codex/slack-lists-canvas-blocks
# Conflicts: # apps/sim/tools/generated/tool-metadata.ts # apps/sim/tools/generated/tool-outputs.ts # apps/sim/tools/index.test.ts
2 parents 922ec97 + f734ba5 commit 490ae31

2,334 files changed

Lines changed: 215907 additions & 64586 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-connector/SKILL.md‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ argument-hint: <service-name> [api-docs-url]
66

77
# Add Connector Skill
88

9+
## Choose the connector runtime first
10+
11+
For **Sim Search**, use the live provider workflow in [the federated Search developer guide](../../../apps/sim/lib/sim-search/live/README.md#adding-a-live-search-connector). Its browser-safe provider catalog owns provider IDs, API origins, credential aliases, and account modes; its typed runtime registry requires both search and read handlers. `ConnectorMeta` remains the owner of logos and setup fields. Member mode has no admin resource filters. Service mode requires independent live source verification and shared selectors. Do not implement a Search source by adding a crawler, embeddings, or a scheduled ACL build.
12+
13+
The ingestion instructions below apply to **ordinary knowledge-base connectors** and the explicit legacy Search backend (`SIM_SEARCH_LIVE=false`). If a provider supports both, implement and test both runtimes; adding `search: true` to metadata alone does not implement federated search. Preserve indexing documentation and behavior for those KB/legacy callers.
14+
915
You are an expert at adding knowledge base connectors to Sim. A connector syncs documents from an external source (Confluence, Google Drive, Notion, etc.) into a knowledge base.
1016

1117
## Your Task

‎.agents/skills/validate-connector/SKILL.md‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ argument-hint: <service-name> [api-docs-url]
66

77
# Validate Connector Skill
88

9+
## Identify the runtime under review
10+
11+
For **Sim Search**, validate the [live provider registration and access pipeline](../../../apps/sim/lib/sim-search/live/README.md#adding-a-live-search-connector): catalog and metadata parity, both search/read handlers, current member grants, service-source restrictions, safe scoped references, pagination, provenance, and provider failure behavior. Test real localhost setup/search/read with authorized fixtures when available, and distinguish those results from mocked provider tests. Live Search must not enqueue content indexing or background ACL/directory builds; GitLab still computes request-time permissions or uses current CSV grants.
12+
13+
The ingestion-specific checks below apply to ordinary workspace KB connectors and legacy Search selected with `SIM_SEARCH_LIVE=false`. Keep those checks for providers supporting both runtimes; do not require a live-only provider to implement content hashes, ingestion cursors, embeddings, or stored ACL snapshots.
14+
915
You are an expert auditor for Sim knowledge base connectors. Your job is to thoroughly validate that an existing connector is correct, complete, and follows all conventions.
1016

1117
## Your Task

‎.github/CONTRIBUTING.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,8 @@ If you prefer not to use Docker. **All commands run from the repository root unl
256256

257257
For ad-hoc schema iteration during development you can also use `bun run db:push` from `packages/db`, but `db:migrate` is the canonical command for staging and production. `db:push` reconciles directly to the current schema without running versioned migration guards. For disposable local/dev databases, `bun run db:push --force` accepts Drizzle's data-loss prompts, including column drops.
258258

259+
`db:push` treats added and removed columns, tables, and other schema objects as separate creations and deletions. It never infers a rename. For an intentional rename during local development, run `bun run db:push --interactive-renames` in a terminal and select the old object in Drizzle's chooser. This flag does not approve data loss; `--force` controls that separately. After schema reconciliation succeeds, the wrapper reconciles credential policies and OAuth providers, then backfills search vectors. A failure stops subsequent steps. Staging and production changes still use reviewed versioned migrations with expand/contract deployment steps.
260+
259261
4. **Run the Development Servers:**
260262

261263
```bash

‎.github/actions/docker-build/action.yml‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ inputs:
1919
tags:
2020
description: Comma-separated list of tags to push.
2121
required: true
22+
build-args:
23+
description: Newline-separated Docker build arguments.
24+
required: false
25+
default: ''
2226
max-cache-size-mb:
2327
description: >-
2428
Layer cache to retain after this action prunes, in MB. Must stay above one
@@ -72,6 +76,7 @@ runs:
7276
platforms: ${{ inputs.platforms }}
7377
push: true
7478
tags: ${{ inputs.tags }}
79+
build-args: ${{ inputs.build-args }}
7580
provenance: false
7681
sbom: false
7782

@@ -177,5 +182,6 @@ runs:
177182
platforms: ${{ inputs.platforms }}
178183
push: true
179184
tags: ${{ inputs.tags }}
185+
build-args: ${{ inputs.build-args }}
180186
provenance: false
181187
sbom: false

‎.github/workflows/ci.yml‎

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ jobs:
103103
echo "ℹ️ No comparable base commit; skipping desktop prerelease"
104104
exit 0
105105
fi
106-
if git diff --name-only "$BEFORE" HEAD | grep -qE '^(apps/desktop/|packages/desktop-bridge/|packages/browser-protocol/)'; then
106+
if git diff --name-only "$BEFORE" HEAD | grep -qE '^(apps/desktop/|packages/desktop-bridge/|packages/browser-protocol/|\.github/workflows/(ci|desktop-release)\.yml$)'; then
107107
echo "changed=true" >> "$GITHUB_OUTPUT"
108108
echo "✅ Desktop shell code changed"
109109
else
@@ -221,15 +221,18 @@ jobs:
221221
file: ${{ matrix.dockerfile }}
222222
platforms: linux/amd64
223223
tags: ${{ steps.login-ecr.outputs.registry }}/${{ steps.ecr-repo.outputs.name }}:${{ github.sha }}-dev
224+
build-args: |
225+
SIM_SEARCH_LIVE_DEFAULT=true
226+
MSHIP_PLAN_MODE_DEFAULT=true
224227
max-cache-size-mb: ${{ matrix.cache_mb }}
225228

226-
# Build and upload tasks alongside tests and images. The unpromoted version
227-
# cannot serve new runs; promote-images waits for it and successful migrations.
229+
# Staging/production coordinate task releases with app traffic cutover.
230+
# Dev tasks deploy independently in deploy-trigger-dev.yml.
228231
prepare-trigger:
229232
name: Prepare Trigger.dev
230233
if: >-
231234
github.event_name == 'push' &&
232-
(github.ref == 'refs/heads/main' || github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/dev')
235+
(github.ref == 'refs/heads/main' || github.ref == 'refs/heads/staging')
233236
runs-on: ${{ (vars.CI_PROVIDER == '' || vars.CI_PROVIDER == 'blacksmith') && 'blacksmith-4vcpu-ubuntu-2404' || 'ubuntu-latest' }}
234237
timeout-minutes: 30
235238
outputs:
@@ -265,7 +268,6 @@ jobs:
265268
case "$GITHUB_REF" in
266269
refs/heads/main) TRIGGER_ENV=prod; TRIGGER_BRANCH='' ;;
267270
refs/heads/staging) TRIGGER_ENV=staging; TRIGGER_BRANCH='' ;;
268-
refs/heads/dev) TRIGGER_ENV=preview; TRIGGER_BRANCH=dev-sim ;;
269271
*) echo "ERROR: unsupported Trigger release ref: $GITHUB_REF" >&2; exit 1 ;;
270272
esac
271273
echo "environment=$TRIGGER_ENV" >> "$GITHUB_OUTPUT"
@@ -426,8 +428,9 @@ jobs:
426428
tags: ${{ steps.meta.outputs.tags }}
427429
max-cache-size-mb: ${{ matrix.cache_mb }}
428430

429-
# Promote the sha-tagged ECR images once tests, migrations, and the Trigger
430-
# upload pass. Pushing the ECR latest/staging tag is what triggers
431+
# Promote the sha-tagged ECR images once their build and migrations pass.
432+
# Staging/production also require the Trigger upload; dev never waits for it.
433+
# Pushing the ECR latest/staging/dev tag is what triggers
431434
# CodePipeline, so this seconds-long manifest retag is the deploy gate —
432435
# the image builds themselves run in parallel with the tests. A single job
433436
# (not a matrix) so all four sha manifests are verified before any tag
@@ -438,9 +441,9 @@ jobs:
438441
# Explicit results: see migrate's comment.
439442
if: >-
440443
!cancelled() && github.event_name == 'push' &&
441-
needs.prepare-trigger.result == 'success' &&
442444
(
443445
((github.ref == 'refs/heads/main' || github.ref == 'refs/heads/staging') &&
446+
needs.prepare-trigger.result == 'success' &&
444447
needs.migrate.result == 'success' &&
445448
needs.build-amd64.result == 'success') ||
446449
(github.ref == 'refs/heads/dev' &&
@@ -546,7 +549,7 @@ jobs:
546549
fi
547550
done
548551
549-
# Promote the parked Trigger.dev version after observing the ECS
552+
# Staging/production: promote the parked Trigger.dev version after observing the ECS
550553
# traffic cutover (CodeDeploy AllowTraffic on every target). The image retag
551554
# triggers the ECS pipeline; this job correlates it via the digest + retag epoch
552555
# (rejecting a stale execution reusing the digest) and promotes at cutover.
@@ -560,14 +563,13 @@ jobs:
560563
if: >-
561564
!cancelled() &&
562565
github.event_name == 'push' &&
563-
(github.ref == 'refs/heads/main' || github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/dev') &&
566+
(github.ref == 'refs/heads/main' || github.ref == 'refs/heads/staging') &&
564567
needs.promote-images.result == 'success' &&
565568
needs.prepare-trigger.result == 'success' &&
566569
needs.promote-images.outputs.promoted == 'true'
567570
runs-on: ${{ (vars.CI_PROVIDER == '' || vars.CI_PROVIDER == 'blacksmith') && 'blacksmith-4vcpu-ubuntu-2404' || 'ubuntu-latest' }}
568-
# Leave setup/promotion headroom above the cutover poll (dev: 20 min;
569-
# staging/prod: 70 min, including a deploy queued behind a long bake).
570-
timeout-minutes: ${{ github.ref == 'refs/heads/dev' && 40 || 90 }}
571+
# Leave setup/promotion headroom above the 70-minute cutover poll.
572+
timeout-minutes: 90
571573
permissions:
572574
contents: read
573575
id-token: write
@@ -599,14 +601,13 @@ jobs:
599601
with:
600602
role-to-assume: ${{ github.ref == 'refs/heads/main' && secrets.AWS_ROLE_TO_ASSUME || github.ref == 'refs/heads/dev' && secrets.DEV_AWS_ROLE_TO_ASSUME || secrets.STAGING_AWS_ROLE_TO_ASSUME }}
601603
aws-region: ${{ github.ref == 'refs/heads/main' && secrets.AWS_REGION || github.ref == 'refs/heads/dev' && secrets.DEV_AWS_REGION || secrets.STAGING_AWS_REGION }}
602-
# Match each environment's session budget; both outlast their polls.
603-
role-duration-seconds: ${{ github.ref == 'refs/heads/dev' && 2400 || 5400 }}
604+
role-duration-seconds: 5400
604605

605606
# An unchanged tag may belong to a failed or still-running earlier deploy.
606607
# Verify its latest cutover rather than treating tag equality as success.
607608
- name: Wait for ECS traffic cutover
608609
env:
609-
OVERALL_TIMEOUT: ${{ github.ref == 'refs/heads/dev' && 1200 || 4200 }}
610+
OVERALL_TIMEOUT: 4200
610611
APP_IMAGE_CHANGED: ${{ needs.promote-images.outputs.app_image_changed }}
611612
DIGEST: ${{ needs.promote-images.outputs.app_image_digest }}
612613
PIPELINE: sim-${{ github.ref == 'refs/heads/main' && 'production' || github.ref == 'refs/heads/dev' && 'dev' || 'staging' }}-us-east-1-app-deployment
@@ -1311,24 +1312,30 @@ jobs:
13111312
name: Prune Desktop Prereleases
13121313
runs-on: ${{ (vars.CI_PROVIDER == '' || vars.CI_PROVIDER == 'blacksmith') && 'blacksmith-2vcpu-ubuntu-2404' || 'ubuntu-latest' }}
13131314
timeout-minutes: 5
1314-
needs: [publish-desktop-prerelease]
1315+
needs: [create-desktop-prerelease, publish-desktop-prerelease]
13151316
permissions:
13161317
contents: read
13171318
env:
13181319
GH_TOKEN: ${{ secrets.DESKTOP_RELEASE_TOKEN }}
13191320
GH_REPO: simstudioai/sim-desktop-releases
1321+
CURRENT_TAG: ${{ needs.create-desktop-prerelease.outputs.version }}
13201322
steps:
13211323
- name: Delete stale prereleases
13221324
run: |
1325+
set -euo pipefail
1326+
: "${CURRENT_TAG:?Current publication tag is required before pruning}"
13231327
if [ -z "$GH_TOKEN" ]; then
13241328
echo "::error::DESKTOP_RELEASE_TOKEN is required to prune desktop prereleases."
13251329
exit 1
13261330
fi
13271331
if [ "$GITHUB_REF" = "refs/heads/dev" ]; then CHANNELS='(dev|alpha)'; else CHANNELS='(staging|beta)'; fi
1328-
gh release list --limit 100 --json tagName,isPrerelease,isDraft,createdAt \
1329-
--jq "[.[] | select(.isPrerelease and (.isDraft | not) and (.tagName | test(\"-${CHANNELS}\\\\.\")))] | sort_by(.createdAt) | reverse | .[5:] | .[].tagName" |
1332+
# createdAt follows the tag's commit: published releases in the release-only
1333+
# repository can all share it. Retain by publication time, with deterministic ties.
1334+
gh release list --limit 100 --json tagName,isPrerelease,isDraft,publishedAt \
1335+
--jq "[.[] | select(.isPrerelease and (.isDraft | not) and (.tagName | test(\"-${CHANNELS}\\\\.\")))] | sort_by(.publishedAt, .tagName) | reverse | .[5:] | .[].tagName" |
13301336
while read -r TAG; do
13311337
[ -n "$TAG" ] || continue
1338+
[ "$TAG" != "$CURRENT_TAG" ] || continue
13321339
echo "Deleting stale prerelease $TAG"
13331340
gh release delete "$TAG" --cleanup-tag --yes
13341341
done
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: Deploy Dev Tasks
2+
3+
# Independent of app CI: task packaging and deployment must never delay dev images.
4+
on:
5+
push:
6+
branches: [dev]
7+
8+
permissions:
9+
contents: read
10+
11+
# Serialize promotions without cancelling an external deployment in flight.
12+
# Pending pushes coalesce to the newest run while the current run finishes.
13+
concurrency:
14+
group: deploy-trigger-dev
15+
cancel-in-progress: false
16+
17+
jobs:
18+
deploy:
19+
name: Deploy Trigger.dev preview
20+
runs-on: ${{ (vars.CI_PROVIDER == '' || vars.CI_PROVIDER == 'blacksmith') && 'blacksmith-4vcpu-ubuntu-2404' || 'ubuntu-latest' }}
21+
timeout-minutes: 30
22+
steps:
23+
- name: Checkout code
24+
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
25+
26+
- name: Setup Bun
27+
uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
28+
with:
29+
bun-version: 1.4.1
30+
31+
- name: Cache Bun dependencies
32+
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
33+
with:
34+
path: |
35+
~/.bun/install/cache
36+
node_modules
37+
**/node_modules
38+
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lock') }}
39+
restore-keys: |
40+
${{ runner.os }}-bun-
41+
42+
- name: Install dependencies
43+
run: bun install --frozen-lockfile --ignore-scripts
44+
45+
- name: Upload preview version
46+
id: deploy
47+
working-directory: ./apps/sim
48+
env:
49+
TRIGGER_ACCESS_TOKEN: ${{ secrets.TRIGGER_ACCESS_TOKEN }}
50+
TRIGGER_PROJECT_ID: ${{ secrets.TRIGGER_PROJECT_ID }}
51+
run: |
52+
set -euo pipefail
53+
: "${TRIGGER_ACCESS_TOKEN:?TRIGGER_ACCESS_TOKEN must be configured}"
54+
: "${TRIGGER_PROJECT_ID:?TRIGGER_PROJECT_ID must be configured}"
55+
bunx trigger.dev@4.5.16 deploy --env preview --branch dev-sim --skip-promotion
56+
57+
- name: Promote current dev preview
58+
working-directory: ./apps/sim
59+
env:
60+
GH_TOKEN: ${{ github.token }}
61+
TRIGGER_ACCESS_TOKEN: ${{ secrets.TRIGGER_ACCESS_TOKEN }}
62+
TRIGGER_PROJECT_ID: ${{ secrets.TRIGGER_PROJECT_ID }}
63+
VERSION: ${{ steps.deploy.outputs.deploymentVersion }}
64+
run: |
65+
set -euo pipefail
66+
if ! [[ "$VERSION" =~ ^[0-9]{8}\.[0-9]+$ ]]; then
67+
echo "ERROR: Trigger.dev did not report a valid deploymentVersion output" >&2
68+
exit 1
69+
fi
70+
CURRENT_SHA=$(gh api "repos/$GITHUB_REPOSITORY/git/ref/heads/dev" --jq '.object.sha')
71+
if [ "$CURRENT_SHA" != "$GITHUB_SHA" ]; then
72+
echo "::notice::Skipping superseded dev task version $VERSION"
73+
exit 0
74+
fi
75+
bunx trigger.dev@4.5.16 promote "$VERSION" --env preview --branch dev-sim

‎.github/workflows/migrations.yml‎

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ jobs:
6464
MIGRATION_DATABASE_URL: ${{ inputs.environment == 'production' && secrets.MIGRATION_DATABASE_URL || inputs.environment == 'staging' && secrets.STAGING_MIGRATION_DATABASE_URL || '' }}
6565
ENVIRONMENT: ${{ inputs.environment }}
6666
run: |
67+
set -euo pipefail
68+
6769
if [ -z "$DATABASE_URL" ]; then
6870
echo "ERROR: no database URL secret resolved for environment '${ENVIRONMENT}'" >&2
6971
exit 1
@@ -73,16 +75,7 @@ jobs:
7375
echo "Dev environment — pushing schema directly (db:push)"
7476
# Dev deliberately forces direct schema reconciliation; staging and
7577
# production use guarded versioned migrations in the other branch.
76-
# drizzle-kit push needs a TTY to resolve ambiguous renames (--force only
77-
# covers data-loss). In CI it throws "Interactive prompts require a TTY
78-
# terminal" but still exits 0, so the job goes green without applying the
79-
# change. tee keeps the output live in the log; we then fail on drizzle's
80-
# own TTY error. A genuine non-zero exit already fails via `set -e`.
81-
bun run db:push --force < /dev/null 2>&1 | tee /tmp/db-push.log
82-
if grep -q "Interactive prompts require a TTY terminal" /tmp/db-push.log; then
83-
echo "ERROR: db:push needs an interactive rename decision; land it as a versioned migration instead of relying on push." >&2
84-
exit 1
85-
fi
78+
SIM_DEV_DB_PUSH=1 bun run db:push --force < /dev/null
8679
else
8780
echo "Applying versioned migrations (db:migrate)"
8881
bun run ./scripts/migrate.ts

‎.github/workflows/test-build.yml‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,12 @@ jobs:
8383
- name: Install dependencies
8484
run: bun install --frozen-lockfile --ignore-scripts
8585

86+
- name: Verify direct schema push compatibility
87+
working-directory: packages/db
88+
env:
89+
DB_PUSH_TEST_DATABASE_URL: postgresql://postgres:postgres@127.0.0.1:5432/postgres
90+
run: bunx vitest run scripts/push.postgres.test.ts
91+
8692
- name: Provision a fresh database through the supported command
8793
working-directory: packages/db
8894
run: |
@@ -233,14 +239,16 @@ jobs:
233239
if-no-files-found: ignore
234240
retention-days: 7
235241

236-
- name: Verify durable provenance, concurrent memory writes, and attachment replay
242+
- name: Verify durable provenance, concurrent memory writes, and browser download admission
237243
working-directory: apps/sim
238244
env:
245+
BROWSER_FILE_TRANSFER_TEST_DATABASE_URL: postgresql://postgres:postgres@127.0.0.1:5432/sim_auth_scim
239246
TABLE_PROVENANCE_TEST_DATABASE_URL: postgresql://postgres:postgres@127.0.0.1:5432/sim_auth_scim
240247
MEMORY_PROVENANCE_TEST_DATABASE_URL: postgresql://postgres:postgres@127.0.0.1:5432/sim_auth_scim
241248
AGENT_MEMORY_TEST_DATABASE_URL: postgresql://postgres:postgres@127.0.0.1:5432/sim_auth_scim
242249
run: >-
243250
bunx vitest run
251+
lib/mothership/async-runs/browser-download-claim.postgres.test.ts
244252
lib/table/rows/secret-provenance.postgres.test.ts
245253
lib/memory/message-provenance.postgres.test.ts
246254
lib/memory/conversation-store.postgres.test.ts
@@ -256,6 +264,7 @@ jobs:
256264
script-migrations/0016_backfill_search_vectors.postgres.test.ts
257265
script-migrations/0018_repair_workspace_file_content_revision.postgres.test.ts
258266
script-migrations/0019_tin_keyword_projection.postgres.test.ts
267+
member-sync-status-migration.postgres.test.ts
259268
260269
- name: Verify Search progress, pagination, and outbox scheduling in PostgreSQL
261270
working-directory: apps/sim

0 commit comments

Comments
 (0)