Files
sim/package.json
Vikhyath Mondreti 5f0f0edd63 improvement(repo): separate realtime into separate app (#4262)
* improvement(repo): restructuring to make realtime image narrower scoped

* improvements

* chore(repo): rebase fixes and quality improvements for realtime split

Addresses merge-time issues and gaps from the realtime app split:
- Retarget stale vi.mock paths to @sim/workflow-persistence/subblocks
- Restore README branding, fix AGENTS.md script reference
- Restore TSDoc on workflow-persistence subblocks helpers
- Use toError() from @sim/utils/errors in save.ts
- Add vitest config + local mocks so @sim/audit tests run standalone
- Move socket.io-client to devDependencies in apps/realtime
- Add missing package COPY steps to docker/app.Dockerfile
- Add check:boundaries/check:realtime-prune scripts and wire into CI

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* refactor(security): consolidate crypto primitives into @sim/security

Move general-purpose crypto primitives out of apps/sim into the
@sim/security package so both apps/sim and apps/realtime can share them.

@sim/security exports (all pure, dependency-free):
  ./compare    safeCompare (constant-time HMAC-wrapped equality)
  ./encryption encrypt/decrypt (AES-256-GCM, iv:cipher:tag format)
  ./hash       sha256Hex
  ./tokens     generateSecureToken (base64url)

Migrate apps/sim call sites to use these + @sim/utils helpers:
  crypto.randomUUID()            -> generateId() from @sim/utils/id
  createHash('sha256').digest    -> sha256Hex
  timingSafeEqual on hashed hex  -> safeCompare
  new Promise(setTimeout)        -> sleep from @sim/utils/helpers

No behavior change: encryption format, digest output, and token
length are preserved exactly.

* refactor(copilot): use toError in remaining otel/finalize sites

Replace the last two `error instanceof Error ? error : new Error(String(error))`
patterns with toError from @sim/utils/errors. Completes the sweep of clean
candidates — no behavior change.

* refactor(security): consolidate HMAC-SHA256 primitives into @sim/security

Adds hmacSha256Hex and hmacSha256Base64 to @sim/security/hmac and migrates
15 webhook providers plus 5 other hot paths (deployment token signing,
outbound webhook requests, workspace notification delivery, notification
test route, Shopify OAuth callback) off bare `createHmac` calls. Secret
parameter accepts `string | Buffer` to cover base64-decoded Svix-style
secrets (Resend) and MS Teams' HMAC scheme. AWS SigV4 signing in S3 and
Textract tools intentionally retains direct `createHmac` usage — its
multi-step key derivation chain doesn't fit a generic helper.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* chore(packages): post-audit test + packaging polish

- Add safeCompare unit tests (identity, length mismatch, hex-nibble diff).
- Add Buffer-secret cases to hmac tests to lock in Svix/MS-Teams contract.
- Declare `reactflow` as a peerDependency on @sim/workflow-types — only used for type imports.
- Add a barrel export to @sim/workflow-persistence for consumers that prefer package-level imports; subpath exports retained.
- Document the data-field invariant in load.ts for loop/parallel subflow patching.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* chore(realtime): address PR review feedback

- Remove redundant SOCKET_PORT=3002 env from Dockerfile runner stage
  (env.PORT already defaults to 3002 via zod schema).
- Reorder PORT fallback so an explicitly-set SOCKET_PORT wins over
  the schema default for PORT; keeps SOCKET_PORT functional as an
  override instead of dead code.
- Add dedicated type-check CI step for @sim/realtime so TS errors
  surface pre-deploy (the Dockerfile runs source TS via Bun and has
  no implicit build-time type check).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* chore(realtime): remove unused SOCKET_PORT env var

SOCKET_PORT has lived in the socket server since the June 2025 refactor
but was never actually set in any deploy config — docker-compose.prod,
helm values/templates, .env.example, and docs all use PORT or the 3002
default exclusively. No self-hoster was ever pointed at SOCKET_PORT, so
removing it is safe.

Simplifies realtime port resolution to `env.PORT` (zod-validated with a
3002 default) and drops the orphaned sim-side schema entry.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

---------

Co-authored-by: Waleed Latif <walif6@gmail.com>
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-22 23:06:16 -07:00

72 lines
3.0 KiB
JSON

{
"name": "simstudio",
"packageManager": "bun@1.3.11",
"version": "0.0.0",
"private": true,
"license": "Apache-2.0",
"workspaces": [
"apps/*",
"packages/*"
],
"scripts": {
"build": "turbo run build",
"dev": "turbo run dev",
"dev:sockets": "cd apps/realtime && bun run dev",
"dev:full": "bunx concurrently -n \"App,Realtime\" -c \"cyan,magenta\" \"cd apps/sim && bun run dev\" \"cd apps/realtime && bun run dev\"",
"test": "turbo run test",
"format": "turbo run format",
"format:check": "turbo run format:check",
"lint": "turbo run lint",
"lint:check": "turbo run lint:check",
"lint:helm": "helm lint ./helm/sim --strict --values ./helm/sim/test/values-lint.yaml",
"lint:all": "turbo run lint && bun run lint:helm",
"check": "turbo run format:check",
"check:boundaries": "bun run scripts/check-monorepo-boundaries.ts",
"check:realtime-prune": "bun run scripts/check-realtime-prune-graph.ts",
"mship-contracts:generate": "bun run scripts/sync-mothership-stream-contract.ts",
"mship-contracts:check": "bun run scripts/sync-mothership-stream-contract.ts --check",
"mship-tools:generate": "bun run scripts/sync-tool-catalog.ts",
"mship-tools:check": "bun run scripts/sync-tool-catalog.ts --check",
"trace-contracts:generate": "bun run scripts/sync-request-trace-contract.ts",
"trace-contracts:check": "bun run scripts/sync-request-trace-contract.ts --check",
"trace-spans-contract:generate": "bun run scripts/sync-trace-spans-contract.ts",
"trace-spans-contract:check": "bun run scripts/sync-trace-spans-contract.ts --check",
"trace-attributes-contract:generate": "bun run scripts/sync-trace-attributes-contract.ts",
"trace-attributes-contract:check": "bun run scripts/sync-trace-attributes-contract.ts --check",
"trace-attribute-values-contract:generate": "bun run scripts/sync-trace-attribute-values-contract.ts",
"trace-attribute-values-contract:check": "bun run scripts/sync-trace-attribute-values-contract.ts --check",
"trace-events-contract:generate": "bun run scripts/sync-trace-events-contract.ts",
"trace-events-contract:check": "bun run scripts/sync-trace-events-contract.ts --check",
"mship:generate": "bun run scripts/generate-mship-contracts.ts",
"mship:check": "bun run scripts/generate-mship-contracts.ts --check",
"prepare": "bun husky",
"type-check": "turbo run type-check",
"release": "bun run scripts/create-single-release.ts"
},
"overrides": {
"react": "19.2.4",
"react-dom": "19.2.4",
"next": "16.1.6",
"@next/env": "16.1.6",
"drizzle-orm": "^0.45.2",
"postgres": "^3.4.5"
},
"devDependencies": {
"@biomejs/biome": "2.0.0-beta.5",
"@octokit/rest": "^21.0.0",
"glob": "13.0.0",
"husky": "9.1.7",
"json-schema-to-typescript": "15.0.4",
"lint-staged": "16.0.0",
"turbo": "2.9.6"
},
"lint-staged": {
"*.{js,jsx,ts,tsx,json,css,scss}": [
"biome check --write --no-errors-on-unmatched --files-ignore-unknown=true"
]
},
"trustedDependencies": [
"sharp"
]
}