From e694680f3861d702c54eb8d083155360dc3776da Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 27 Mar 2026 22:50:54 +0000 Subject: [PATCH 1/8] perf(frontend): apply performance optimizations and React Compiler MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add babel-plugin-react-compiler (^1.0.0) to enable automatic memoization - Configure React Compiler in vite.engine.config.ts and inspector vite config - Increase global query staleTime (5s→30s), gcTime (60s→5min), disable refetchOnWindowFocus, enable refetchOnReconnect - Fix token cache TTLs: actorInspectorToken and engineAdminToken raised from 1s to 5min/10min - Fix blunt invalidateQueries() calls to be scoped to ["projects"] and ["namespaces"] - Reduce all 1-second polling intervals to 3 seconds (traces, queue, guard-connectable, connect form, actor metadata) - Fix missing actionsManager dependency in onMessage useMemo - Add select selector to Route.useSearch() in _context.tsx to avoid full search re-renders - Collapse redundant useCallback+useMemo into single useMemo in database-table.tsx - Replace full lodash import with named imports in json component - Replace lazy getter pattern with eager evaluation in actor-filters-context.tsx - Apply biome formatting across 524 files https://claude.ai/code/session_01XJwj6P1Gn6jgVSQ6uxFLGj --- .../actor-actions-vercel/frontend/App.tsx | 61 +- .../actor-actions-vercel/frontend/main.tsx | 2 +- examples/actor-actions-vercel/vite.config.ts | 2 +- examples/actor-actions/frontend/App.tsx | 57 +- examples/actor-actions/frontend/main.tsx | 2 +- examples/actor-actions/vite.config.ts | 2 +- examples/ai-agent-vercel/frontend/App.tsx | 24 +- examples/ai-agent-vercel/src/actors.ts | 2 +- examples/ai-agent-vercel/vite.config.ts | 2 +- examples/ai-agent/frontend/App.tsx | 24 +- examples/ai-agent/src/index.ts | 2 +- .../frontend/App.tsx | 137 +++- .../src/index.ts | 4 +- .../template/frontend/main.tsx | 2 +- .../template/src/registry.ts | 2 +- .../vite.config.ts | 2 +- examples/chat-room-vercel/frontend/App.tsx | 4 +- examples/chat-room-vercel/frontend/main.tsx | 2 +- examples/chat-room-vercel/src/actors.ts | 2 +- examples/chat-room-vercel/vite.config.ts | 2 +- examples/chat-room/frontend/main.tsx | 2 +- examples/chat-room/src/index.ts | 2 +- examples/chat-room/vite.config.ts | 2 +- examples/cloudflare-workers-hono/src/index.ts | 3 +- .../src/registry.ts | 2 +- examples/cloudflare-workers/src/actors.ts | 2 +- examples/cloudflare-workers/src/index.ts | 3 +- .../frontend/App.tsx | 145 +++- .../src/actors.ts | 15 +- .../vite.config.ts | 2 +- .../collaborative-document/frontend/App.tsx | 141 +++- examples/collaborative-document/src/index.ts | 15 +- .../collaborative-document/vite.config.ts | 2 +- .../frontend/App.tsx | 53 +- .../frontend/main.tsx | 2 +- .../cross-actor-actions-vercel/vite.config.ts | 2 +- examples/cross-actor-actions/frontend/App.tsx | 49 +- .../cross-actor-actions/frontend/main.tsx | 2 +- examples/cross-actor-actions/vite.config.ts | 2 +- .../frontend/App.tsx | 68 +- .../frontend/main.tsx | 2 +- .../src/actors.ts | 8 +- .../vite.config.ts | 2 +- .../cursors-raw-websocket/frontend/App.tsx | 68 +- .../cursors-raw-websocket/frontend/main.tsx | 2 +- examples/cursors-raw-websocket/src/index.ts | 8 +- examples/cursors-raw-websocket/vite.config.ts | 2 +- examples/cursors-vercel/frontend/App.tsx | 48 +- examples/cursors-vercel/frontend/main.tsx | 2 +- examples/cursors-vercel/src/actors.ts | 2 +- examples/cursors-vercel/vite.config.ts | 2 +- examples/cursors/frontend/App.tsx | 44 +- examples/cursors/frontend/main.tsx | 2 +- examples/cursors/src/index.ts | 2 +- examples/cursors/vite.config.ts | 2 +- examples/custom-serverless/src/index.ts | 2 +- .../frontend/App.tsx | 672 ++++++++++------ .../frontend/main.tsx | 2 +- .../src/actors.ts | 2 +- .../vite.config.ts | 2 +- .../frontend/App.tsx | 666 +++++++++++----- .../frontend/main.tsx | 2 +- .../src/index.ts | 2 +- .../vite.config.ts | 2 +- .../frontend/App.tsx | 73 +- .../src/actors.ts | 8 +- .../vite.config.ts | 2 +- .../geo-distributed-database/frontend/App.tsx | 77 +- .../geo-distributed-database/src/index.ts | 8 +- .../geo-distributed-database/vite.config.ts | 2 +- examples/hello-world-vercel/frontend/App.tsx | 17 +- examples/hello-world-vercel/frontend/main.tsx | 2 +- examples/hello-world-vercel/src/actors.ts | 2 +- examples/hello-world-vercel/vite.config.ts | 2 +- examples/hello-world/frontend/App.tsx | 13 +- examples/hello-world/frontend/main.tsx | 2 +- examples/hello-world/src/index.ts | 2 +- examples/hello-world/vite.config.ts | 2 +- examples/hono-react-vercel/frontend/App.tsx | 4 +- examples/hono-react-vercel/src/actors.ts | 2 +- examples/hono-react-vercel/vite.config.ts | 2 +- examples/hono-react/src/index.ts | 2 +- examples/hono-react/vite.config.ts | 2 +- examples/kitchen-sink-vercel/frontend/App.tsx | 219 +++--- .../frontend/components/ConnectionScreen.tsx | 378 ++++----- .../frontend/components/InteractionScreen.tsx | 372 +++++---- .../frontend/components/tabs/ActionsTab.tsx | 536 ++++++------- .../components/tabs/ConnectionsTab.tsx | 347 +++++---- .../frontend/components/tabs/EventsTab.tsx | 485 ++++++------ .../frontend/components/tabs/MetadataTab.tsx | 325 ++++---- .../frontend/components/tabs/RawHttpTab.tsx | 494 ++++++------ .../components/tabs/RawWebSocketTab.tsx | 733 ++++++++++-------- .../frontend/components/tabs/ScheduleTab.tsx | 575 +++++++------- .../frontend/components/tabs/SleepTab.tsx | 172 ++-- .../kitchen-sink-vercel/frontend/main.tsx | 18 +- examples/kitchen-sink-vercel/vite.config.ts | 2 +- examples/kitchen-sink/frontend/App.tsx | 219 +++--- .../frontend/components/ConnectionScreen.tsx | 378 ++++----- .../frontend/components/InteractionScreen.tsx | 372 +++++---- .../frontend/components/tabs/ActionsTab.tsx | 536 ++++++------- .../components/tabs/ConnectionsTab.tsx | 347 +++++---- .../frontend/components/tabs/EventsTab.tsx | 485 ++++++------ .../frontend/components/tabs/MetadataTab.tsx | 325 ++++---- .../frontend/components/tabs/RawHttpTab.tsx | 494 ++++++------ .../components/tabs/RawWebSocketTab.tsx | 733 ++++++++++-------- .../frontend/components/tabs/ScheduleTab.tsx | 575 +++++++------- .../frontend/components/tabs/SleepTab.tsx | 172 ++-- examples/kitchen-sink/frontend/main.tsx | 18 +- examples/kitchen-sink/vite.config.ts | 2 +- examples/multi-region-vercel/frontend/App.tsx | 51 +- .../multi-region-vercel/frontend/main.tsx | 2 +- examples/multi-region-vercel/src/actors.ts | 2 +- examples/multi-region-vercel/vite.config.ts | 2 +- .../frontend/App.tsx | 88 ++- .../frontend/games/arena/arena-game.ts | 60 +- .../frontend/games/arena/bot.ts | 21 +- .../frontend/games/arena/game.tsx | 6 +- .../frontend/games/arena/menu.tsx | 13 +- .../games/arena/wait-for-assignment.ts | 6 +- .../games/battle-royale/battle-royale-game.ts | 141 +++- .../frontend/games/battle-royale/bot.ts | 28 +- .../frontend/games/battle-royale/game.tsx | 10 +- .../frontend/games/battle-royale/menu.tsx | 17 +- .../frontend/games/idle/game.tsx | 128 ++- .../frontend/games/idle/menu.tsx | 13 +- .../frontend/games/io-style/bot.ts | 24 +- .../frontend/games/io-style/game.tsx | 12 +- .../frontend/games/io-style/io-game.ts | 14 +- .../frontend/games/io-style/menu.tsx | 13 +- .../frontend/games/open-world/bot.ts | 7 +- .../frontend/games/open-world/game.tsx | 15 +- .../frontend/games/open-world/menu.tsx | 14 +- .../games/open-world/open-world-game.ts | 147 +++- .../frontend/games/party/bot.ts | 32 +- .../frontend/games/party/game.tsx | 86 +- .../frontend/games/party/menu.tsx | 31 +- .../frontend/games/physics-2d/game.tsx | 9 +- .../frontend/games/physics-2d/menu.tsx | 13 +- .../games/physics-2d/physics-2d-game.ts | 25 +- .../frontend/games/physics-3d/game.tsx | 16 +- .../frontend/games/physics-3d/menu.tsx | 13 +- .../games/physics-3d/physics-3d-game.ts | 53 +- .../frontend/games/ranked/bot.ts | 16 +- .../frontend/games/ranked/game.tsx | 12 +- .../frontend/games/ranked/menu.tsx | 188 ++++- .../frontend/games/ranked/ranked-game.ts | 95 ++- .../games/ranked/wait-for-assignment.ts | 6 +- .../frontend/games/turn-based/bot.ts | 30 +- .../frontend/games/turn-based/game.tsx | 112 ++- .../frontend/games/turn-based/menu.tsx | 113 ++- .../games/turn-based/wait-for-assignment.ts | 6 +- .../frontend/utils.ts | 8 +- .../src/actors/arena/match.ts | 38 +- .../src/actors/arena/matchmaker.ts | 15 +- .../src/actors/battle-royale/match.ts | 82 +- .../src/actors/battle-royale/matchmaker.ts | 10 +- .../src/actors/idle/config.ts | 32 +- .../src/actors/idle/leaderboard.ts | 2 +- .../src/actors/idle/world.ts | 38 +- .../src/actors/io-style/match.ts | 32 +- .../src/actors/io-style/matchmaker.ts | 10 +- .../src/actors/open-world/chunk.ts | 36 +- .../src/actors/party/config.ts | 4 +- .../src/actors/party/match.ts | 106 ++- .../src/actors/party/matchmaker.ts | 27 +- .../src/actors/physics-2d/world.ts | 52 +- .../src/actors/physics-3d/world.ts | 70 +- .../src/actors/player-color.ts | 4 +- .../src/actors/ranked/leaderboard.ts | 16 +- .../src/actors/ranked/match.ts | 112 +-- .../src/actors/ranked/matchmaker.ts | 67 +- .../src/actors/ranked/player.ts | 7 +- .../src/actors/turn-based/match.ts | 50 +- .../src/actors/turn-based/matchmaker.ts | 75 +- .../matchmaking-and-session-patterns.test.ts | 181 +++-- .../vite.config.ts | 2 +- .../frontend/App.tsx | 88 ++- .../frontend/games/arena/arena-game.ts | 60 +- .../frontend/games/arena/bot.ts | 21 +- .../frontend/games/arena/game.tsx | 6 +- .../frontend/games/arena/menu.tsx | 13 +- .../games/arena/wait-for-assignment.ts | 6 +- .../games/battle-royale/battle-royale-game.ts | 141 +++- .../frontend/games/battle-royale/bot.ts | 28 +- .../frontend/games/battle-royale/game.tsx | 10 +- .../frontend/games/battle-royale/menu.tsx | 17 +- .../frontend/games/idle/game.tsx | 128 ++- .../frontend/games/idle/menu.tsx | 13 +- .../frontend/games/io-style/bot.ts | 24 +- .../frontend/games/io-style/game.tsx | 12 +- .../frontend/games/io-style/io-game.ts | 14 +- .../frontend/games/io-style/menu.tsx | 13 +- .../frontend/games/open-world/bot.ts | 7 +- .../frontend/games/open-world/game.tsx | 15 +- .../frontend/games/open-world/menu.tsx | 14 +- .../games/open-world/open-world-game.ts | 147 +++- .../frontend/games/party/bot.ts | 32 +- .../frontend/games/party/game.tsx | 86 +- .../frontend/games/party/menu.tsx | 31 +- .../frontend/games/physics-2d/game.tsx | 9 +- .../frontend/games/physics-2d/menu.tsx | 13 +- .../games/physics-2d/physics-2d-game.ts | 25 +- .../frontend/games/physics-3d/game.tsx | 16 +- .../frontend/games/physics-3d/menu.tsx | 13 +- .../games/physics-3d/physics-3d-game.ts | 53 +- .../frontend/games/ranked/bot.ts | 16 +- .../frontend/games/ranked/game.tsx | 12 +- .../frontend/games/ranked/menu.tsx | 188 ++++- .../frontend/games/ranked/ranked-game.ts | 95 ++- .../games/ranked/wait-for-assignment.ts | 6 +- .../frontend/games/turn-based/bot.ts | 30 +- .../frontend/games/turn-based/game.tsx | 112 ++- .../frontend/games/turn-based/menu.tsx | 113 ++- .../games/turn-based/wait-for-assignment.ts | 6 +- .../frontend/utils.ts | 8 +- .../src/actors/arena/match.ts | 38 +- .../src/actors/arena/matchmaker.ts | 15 +- .../src/actors/battle-royale/match.ts | 82 +- .../src/actors/battle-royale/matchmaker.ts | 10 +- .../src/actors/idle/config.ts | 32 +- .../src/actors/idle/leaderboard.ts | 2 +- .../src/actors/idle/world.ts | 38 +- .../src/actors/io-style/match.ts | 32 +- .../src/actors/io-style/matchmaker.ts | 10 +- .../src/actors/open-world/chunk.ts | 36 +- .../src/actors/party/config.ts | 4 +- .../src/actors/party/match.ts | 106 ++- .../src/actors/party/matchmaker.ts | 27 +- .../src/actors/physics-2d/world.ts | 52 +- .../src/actors/physics-3d/world.ts | 70 +- .../src/actors/player-color.ts | 4 +- .../src/actors/ranked/leaderboard.ts | 16 +- .../src/actors/ranked/match.ts | 112 +-- .../src/actors/ranked/matchmaker.ts | 67 +- .../src/actors/ranked/player.ts | 7 +- .../src/actors/turn-based/match.ts | 50 +- .../src/actors/turn-based/matchmaker.ts | 75 +- .../matchmaking-and-session-patterns.test.ts | 181 +++-- .../multiplayer-game-patterns/vite.config.ts | 2 +- .../multiplayer-game-vercel/frontend/App.tsx | 75 +- .../multiplayer-game-vercel/src/actors.ts | 90 ++- .../multiplayer-game-vercel/vite.config.ts | 2 +- examples/multiplayer-game/frontend/App.tsx | 71 +- examples/multiplayer-game/src/index.ts | 90 ++- examples/multiplayer-game/vite.config.ts | 2 +- .../native-websockets-vercel/frontend/App.tsx | 19 +- .../frontend/main.tsx | 2 +- .../native-websockets-vercel/src/actors.ts | 7 +- .../native-websockets-vercel/vite.config.ts | 2 +- examples/native-websockets/frontend/App.tsx | 19 +- examples/native-websockets/frontend/main.tsx | 2 +- examples/native-websockets/src/index.ts | 7 +- examples/native-websockets/vite.config.ts | 2 +- examples/next-js/scripts/connect.ts | 3 +- examples/next-js/src/components/Counter.tsx | 21 +- examples/next-js/src/rivet/actors.ts | 2 +- .../frontend/App.tsx | 93 ++- .../per-tenant-database-vercel/src/actors.ts | 2 +- .../per-tenant-database-vercel/vite.config.ts | 2 +- examples/per-tenant-database/frontend/App.tsx | 93 ++- examples/per-tenant-database/src/index.ts | 2 +- examples/per-tenant-database/vite.config.ts | 2 +- .../raw-fetch-handler-vercel/frontend/App.tsx | 31 +- .../frontend/main.tsx | 8 +- .../raw-fetch-handler-vercel/vite.config.ts | 2 +- examples/raw-fetch-handler/frontend/App.tsx | 27 +- examples/raw-fetch-handler/frontend/main.tsx | 8 +- examples/raw-fetch-handler/vite.config.ts | 2 +- .../frontend/App.tsx | 111 ++- .../frontend/main.tsx | 2 +- .../vite.config.ts | 2 +- .../frontend/App.tsx | 111 ++- .../frontend/main.tsx | 2 +- .../vite.config.ts | 2 +- .../frontend/App.tsx | 96 ++- .../frontend/main.tsx | 2 +- .../vite.config.ts | 2 +- .../raw-websocket-handler/frontend/App.tsx | 92 ++- .../raw-websocket-handler/frontend/main.tsx | 2 +- examples/raw-websocket-handler/vite.config.ts | 2 +- examples/react-vercel/frontend/App.tsx | 4 +- examples/react-vercel/src/actors.ts | 2 +- examples/react-vercel/vite.config.ts | 2 +- examples/react/src/index.ts | 2 +- examples/react/vite.config.ts | 2 +- .../frontend/App.tsx | 20 +- .../sandbox-coding-agent-vercel/src/actors.ts | 23 +- .../vite.config.ts | 2 +- .../sandbox-coding-agent/frontend/App.tsx | 20 +- examples/sandbox-coding-agent/src/index.ts | 23 +- examples/sandbox-coding-agent/vite.config.ts | 2 +- examples/sandbox-vercel/frontend/App.tsx | 114 ++- examples/sandbox-vercel/frontend/page-data.ts | 139 ++-- examples/sandbox-vercel/src/actors.ts | 125 ++- .../src/actors/lifecycle/scheduled.ts | 6 +- .../sandbox-vercel/src/actors/queue/worker.ts | 5 +- .../sandbox-vercel/src/actors/state/kv.ts | 2 +- .../src/actors/state/large-payloads.ts | 8 +- .../src/actors/state/sqlite-drizzle/mod.ts | 23 +- .../src/actors/state/sqlite-drizzle/schema.ts | 2 +- .../src/actors/state/sqlite-raw.ts | 9 +- .../src/actors/workflow/approval.ts | 89 ++- .../src/actors/workflow/batch.ts | 21 +- .../src/actors/workflow/dashboard.ts | 155 ++-- .../src/actors/workflow/history-examples.ts | 18 +- .../src/actors/workflow/order.ts | 60 +- .../src/actors/workflow/payment.ts | 212 ++--- .../src/actors/workflow/race.ts | 118 +-- .../src/actors/workflow/timer.ts | 36 +- .../src/actors/workflow/workflow-fixtures.ts | 96 ++- examples/sandbox-vercel/vite.config.ts | 2 +- examples/sandbox/frontend/App.tsx | 193 +++-- examples/sandbox/frontend/page-data.ts | 139 ++-- examples/sandbox/scripts/benchmark.ts | 41 +- .../sandbox/src/actors/lifecycle/scheduled.ts | 6 +- examples/sandbox/src/actors/queue/worker.ts | 5 +- examples/sandbox/src/actors/state/kv.ts | 2 +- .../src/actors/state/large-payloads.ts | 8 +- .../src/actors/state/parallelism-test.ts | 4 +- .../src/actors/state/sqlite-drizzle/mod.ts | 23 +- .../src/actors/state/sqlite-drizzle/schema.ts | 2 +- .../sandbox/src/actors/state/sqlite-raw.ts | 9 +- .../src/actors/testing/test-sqlite-load.ts | 16 +- .../sandbox/src/actors/workflow/approval.ts | 89 ++- examples/sandbox/src/actors/workflow/batch.ts | 21 +- .../sandbox/src/actors/workflow/dashboard.ts | 155 ++-- .../src/actors/workflow/history-examples.ts | 18 +- examples/sandbox/src/actors/workflow/order.ts | 60 +- .../sandbox/src/actors/workflow/payment.ts | 212 ++--- examples/sandbox/src/actors/workflow/race.ts | 118 +-- examples/sandbox/src/actors/workflow/timer.ts | 36 +- .../src/actors/workflow/workflow-fixtures.ts | 96 ++- examples/sandbox/src/index.ts | 133 ++-- examples/sandbox/vite.config.ts | 2 +- examples/scheduling-vercel/frontend/App.tsx | 108 ++- examples/scheduling-vercel/frontend/main.tsx | 2 +- examples/scheduling-vercel/src/actors.ts | 2 +- examples/scheduling-vercel/vite.config.ts | 2 +- examples/scheduling/frontend/App.tsx | 104 ++- examples/scheduling/frontend/main.tsx | 2 +- examples/scheduling/src/index.ts | 2 +- examples/scheduling/vite.config.ts | 2 +- examples/sqlite-raw/src/index.ts | 9 +- examples/state-vercel/frontend/App.tsx | 12 +- examples/state-vercel/frontend/main.tsx | 2 +- examples/state-vercel/src/actors.ts | 2 +- examples/state-vercel/vite.config.ts | 2 +- examples/state/frontend/App.tsx | 8 +- examples/state/frontend/main.tsx | 2 +- examples/state/src/index.ts | 2 +- examples/state/vite.config.ts | 2 +- examples/stream-vercel/frontend/App.tsx | 86 +- examples/stream-vercel/frontend/main.tsx | 4 +- examples/stream-vercel/src/actors.ts | 2 +- examples/stream-vercel/vite.config.ts | 2 +- examples/stream/frontend/App.tsx | 82 +- examples/stream/frontend/main.tsx | 4 +- examples/stream/src/index.ts | 2 +- examples/stream/vite.config.ts | 2 +- frontend/apps/inspector/src/app/layout.tsx | 2 +- frontend/apps/inspector/vite.config.ts | 6 +- frontend/package.json | 1 + .../data-providers/default-data-provider.tsx | 4 +- .../data-providers/engine-data-provider.tsx | 4 +- .../confirm-delete-namespace-frame.tsx | 2 +- .../dialogs/confirm-delete-project-frame.tsx | 2 +- .../forms/connect-manual-serverfull-form.tsx | 4 +- .../src/app/forms/create-api-token-form.tsx | 1 + .../src/app/forms/create-namespace-form.tsx | 3 +- .../app/forms/create-organization-form.tsx | 3 +- .../src/app/forms/create-project-form.tsx | 3 +- .../forms/edit-shared-runner-config-form.tsx | 3 +- .../forms/edit-single-runner-config-form.tsx | 3 +- .../src/app/forms/engine-credentials-form.tsx | 3 +- frontend/src/app/forms/org-sign-up-form.tsx | 3 +- .../app/forms/start-with-new-example-form.tsx | 3 +- .../src/app/forms/upsert-deployment-form.tsx | 3 +- frontend/src/app/layout.tsx | 2 +- .../src/app/metrics/chart-sync-context.tsx | 2 +- .../actors/actor-filters-context.tsx | 12 +- .../actors/actor-inspector-context.tsx | 4 +- .../src/components/actors/actor-queue-tab.tsx | 4 +- .../src/components/actors/actor-queue.tsx | 2 +- .../components/actors/actor-traces-tab.tsx | 4 +- .../src/components/actors/actor-traces.tsx | 2 +- .../actors/form/actor-create-form.tsx | 1 + .../actors/form/build-tags-form.tsx | 1 + .../actors/form/go-to-actor-form.tsx | 1 + .../actors/guard-connectable-inspector.tsx | 4 +- .../components/actors/queries/index.test.ts | 2 +- .../actors/workflow/workflow-visualizer.tsx | 2 +- .../src/components/forms/feedback-form.tsx | 1 + frontend/src/components/json/index.tsx | 34 +- frontend/src/components/layout/root.tsx | 2 +- frontend/src/components/ui/accordion.tsx | 2 +- frontend/src/components/ui/alert.tsx | 2 +- frontend/src/components/ui/avatar.tsx | 2 +- frontend/src/components/ui/card.tsx | 6 +- frontend/src/components/ui/chart.tsx | 4 +- frontend/src/components/ui/collapsible.tsx | 2 +- frontend/src/components/ui/command.tsx | 8 +- frontend/src/components/ui/dialog.tsx | 10 +- frontend/src/components/ui/dropdown-menu.tsx | 12 +- frontend/src/components/ui/field.tsx | 4 +- frontend/src/components/ui/flex.tsx | 2 +- frontend/src/components/ui/input-otp.tsx | 2 +- frontend/src/components/ui/popover.tsx | 2 +- frontend/src/components/ui/resizable.tsx | 6 +- frontend/src/components/ui/sheet.tsx | 10 +- frontend/src/components/ui/table.tsx | 6 +- frontend/src/components/ui/tabs.tsx | 2 +- frontend/src/components/ui/tooltip.tsx | 6 +- frontend/src/components/ui/typography.tsx | 26 +- frontend/src/queries/global.ts | 8 +- frontend/src/routes/_context.tsx | 4 +- frontend/vite.engine.config.ts | 6 +- frontend/vitest.config.ts | 2 +- .../cloudflare-workers/src/actor-driver.ts | 4 +- .../packages/framework-base/src/mod.ts | 12 +- rivetkit-typescript/packages/react/src/mod.ts | 6 +- .../fixtures/driver-test-suite/db-kv-stats.ts | 3 +- .../driver-test-suite/db-pragma-migration.ts | 4 +- .../rivetkit/fixtures/driver-test-suite/kv.ts | 2 +- .../fixtures/driver-test-suite/sleep.ts | 34 +- .../src/actor/conn/drivers/websocket.ts | 4 +- .../rivetkit/src/actor/contexts/base/actor.ts | 2 +- .../packages/rivetkit/src/actor/database.ts | 4 +- .../src/actor/instance/connection-manager.ts | 6 +- .../rivetkit/src/actor/instance/mod.ts | 31 +- .../src/actor/instance/preload-map.test.ts | 4 +- .../rivetkit/src/actor/instance/queue.ts | 2 +- .../src/actor/instance/schedule-manager.ts | 5 +- .../src/actor/instance/state-manager.ts | 2 +- .../src/actor/instance/tracked-websocket.ts | 50 +- .../actor/instance/write-collector.test.ts | 2 +- .../packages/rivetkit/src/actor/mod.ts | 2 +- .../packages/rivetkit/src/actor/schema.ts | 2 +- .../src/common/inline-websocket-adapter.ts | 2 +- .../src/common/websocket-interface.ts | 2 +- .../packages/rivetkit/src/db/config.ts | 5 +- .../packages/rivetkit/src/db/shared.ts | 5 +- .../rivetkit/src/driver-helpers/utils.ts | 1 + .../tests/actor-conn-hibernation.ts | 3 +- .../tests/actor-db-pragma-migration.ts | 44 +- .../src/driver-test-suite/tests/actor-kv.ts | 2 +- .../driver-test-suite/tests/actor-schedule.ts | 32 +- .../driver-test-suite/tests/actor-sleep.ts | 34 +- .../rivetkit/src/driver-test-suite/utils.ts | 2 +- .../packages/rivetkit/src/drivers/default.ts | 2 +- .../rivetkit/src/drivers/engine/mod.ts | 2 +- .../src/drivers/file-system/global-state.ts | 20 +- .../rivetkit/src/engine-process/mod.ts | 2 +- .../rivetkit/src/inspector/actor-inspector.ts | 2 +- .../packages/rivetkit/src/inspector/config.ts | 2 +- .../rivetkit/src/inspector/handler.ts | 2 +- .../packages/rivetkit/src/inspector/mod.ts | 2 +- .../packages/rivetkit/src/manager/router.ts | 2 +- .../packages/rivetkit/src/mod.ts | 14 +- .../rivetkit/src/registry/config/driver.ts | 4 +- .../rivetkit/src/registry/config/index.ts | 2 +- .../src/registry/config/serverless.ts | 4 +- .../packages/rivetkit/src/registry/index.ts | 2 +- .../src/remote-manager-driver/api-utils.ts | 2 +- .../rivetkit/src/sandbox/actor.test.ts | 2 +- .../rivetkit/src/sandbox/actor/index.ts | 6 +- .../packages/rivetkit/src/sandbox/config.ts | 10 +- .../packages/rivetkit/src/sandbox/index.ts | 44 +- .../src/sandbox/session-persist-driver.ts | 2 +- .../packages/rivetkit/src/sandbox/types.ts | 2 +- .../rivetkit/src/serverless/configure.ts | 4 +- .../packages/rivetkit/src/test/mod.ts | 2 +- .../packages/rivetkit/src/utils.ts | 6 +- .../rivetkit/src/utils/endpoint-parser.ts | 2 +- .../packages/rivetkit/src/utils/router.ts | 2 +- .../packages/rivetkit/src/utils/serve.ts | 9 +- .../packages/rivetkit/src/workflow/driver.ts | 6 +- .../rivetkit/src/workflow/inspector.ts | 6 +- .../packages/rivetkit/src/workflow/mod.ts | 18 +- .../rivetkit/tests/actor-types.test.ts | 2 +- .../rivetkit/tests/db-closed-race.test.ts | 2 +- .../rivetkit/tests/driver-file-system.test.ts | 2 +- .../tests/file-system-kv-migration.test.ts | 6 +- .../registry-config-storage-path.test.ts | 2 +- .../rivetkit/tests/sandbox-providers.test.ts | 4 +- .../sqlite-vfs-test/tests/pool.test.ts | 4 +- .../tests/sqlite-lock-repro.test.ts | 4 +- .../sqlite-vfs-test/tests/sqlite-vfs.test.ts | 2 +- .../sqlite-vfs/schemas/file-meta/mod.ts | 2 +- .../sqlite-vfs/src/generated/empty-db-page.ts | 8 +- .../packages/sqlite-vfs/src/index.ts | 8 +- .../packages/sqlite-vfs/src/pool.ts | 4 +- .../packages/sqlite-vfs/src/vfs.ts | 18 +- .../packages/traces/src/index.ts | 28 +- .../packages/traces/src/otlp-entry.ts | 2 +- .../packages/traces/src/read-range.ts | 10 +- .../packages/traces/src/traces.ts | 16 +- .../packages/traces/tests/traces.test.ts | 4 +- .../packages/workflow-engine/src/context.ts | 6 +- .../packages/workflow-engine/src/index.ts | 16 +- .../workflow-engine/tests/driver-kv.test.ts | 230 +++--- .../tests/driver-scheduling.test.ts | 70 +- .../tests/eviction-cancel.test.ts | 112 ++- .../workflow-engine/tests/messages.test.ts | 2 +- .../workflow-engine/tests/removals.test.ts | 128 ++- .../workflow-engine/tests/rollback.test.ts | 2 +- .../workflow-engine/tests/steps.test.ts | 6 +- 506 files changed, 14089 insertions(+), 9079 deletions(-) diff --git a/examples/actor-actions-vercel/frontend/App.tsx b/examples/actor-actions-vercel/frontend/App.tsx index 18a8cfc8c9..02f4c8203f 100644 --- a/examples/actor-actions-vercel/frontend/App.tsx +++ b/examples/actor-actions-vercel/frontend/App.tsx @@ -1,24 +1,27 @@ -import { ActorError, createClient } from "rivetkit/client"; import { useState } from "react"; +import { ActorError, createClient } from "rivetkit/client"; import type { CompanyProfile, EmployeeProfile, registry, } from "../src/actors.ts"; -const client = createClient(`${window.location.origin}/api/rivet`); +const client = createClient( + `${window.location.origin}/api/rivet`, +); export function App() { const [companyEin, setCompanyEin] = useState("12-3456789"); const [companyName, setCompanyName] = useState("Acme Corp"); const [companyIndustry, setCompanyIndustry] = useState("Technology"); const [companyProfile, setCompanyProfile] = useState( - null + null, ); const [employeeName, setEmployeeName] = useState("Jane Smith"); const [employeeEmail, setEmployeeEmail] = useState("jane@acme.com"); - const [employeePosition, setEmployeePosition] = useState("Software Engineer"); + const [employeePosition, setEmployeePosition] = + useState("Software Engineer"); const [createdEmployee, setCreatedEmployee] = useState(null); const [employeeList, setEmployeeList] = useState([]); @@ -44,7 +47,7 @@ export function App() { error.code === "already_exists" ) { alert( - `Company with EIN "${companyEin}" already exists. Use "Load Profile" to view it.` + `Company with EIN "${companyEin}" already exists. Use "Load Profile" to view it.`, ); } else { // Re-throw other errors @@ -85,7 +88,7 @@ export function App() { error.code === "already_exists" ) { alert( - `Employee with email "${employeeEmail}" already exists. Click on their name in the list to view their profile.` + `Employee with email "${employeeEmail}" already exists. Click on their name in the list to view their profile.`, ); } else { // Re-throw other errors @@ -100,14 +103,13 @@ export function App() { setCreatedEmployee(profile); }; - return (

Quickstart: Actions

- Demonstrates creating actors with input parameters and calling - type-safe actions between actors + Demonstrates creating actors with input parameters and + calling type-safe actions between actors

@@ -143,15 +145,10 @@ export function App() { />
- -
@@ -166,11 +163,14 @@ export function App() { Name: {companyProfile.name}
- Industry: {companyProfile.industry} + Industry:{" "} + {companyProfile.industry}
Founded:{" "} - {new Date(companyProfile.foundedAt).toLocaleString()} + {new Date( + companyProfile.foundedAt, + ).toLocaleString()}
)} @@ -178,7 +178,13 @@ export function App() { {employeeList.length > 0 && (

Employees ({employeeList.length})

-
+
{employeeList.map((email) => (
@@ -240,7 +248,8 @@ export function App() {

Employee Profile

- Employee ID: {createdEmployee.employeeId} + Employee ID:{" "} + {createdEmployee.employeeId}
Name: {createdEmployee.name} @@ -249,14 +258,18 @@ export function App() { Email: {createdEmployee.email}
- Position: {createdEmployee.position} + Position:{" "} + {createdEmployee.position}
- Company ID: {createdEmployee.companyId} + Company ID:{" "} + {createdEmployee.companyId}
Hired:{" "} - {new Date(createdEmployee.hiredAt).toLocaleString()} + {new Date( + createdEmployee.hiredAt, + ).toLocaleString()}
)} diff --git a/examples/actor-actions-vercel/frontend/main.tsx b/examples/actor-actions-vercel/frontend/main.tsx index 372f49c622..2efcb334fc 100644 --- a/examples/actor-actions-vercel/frontend/main.tsx +++ b/examples/actor-actions-vercel/frontend/main.tsx @@ -8,5 +8,5 @@ if (!root) throw new Error("Root element not found"); createRoot(root).render( - + , ); diff --git a/examples/actor-actions-vercel/vite.config.ts b/examples/actor-actions-vercel/vite.config.ts index f9f0d5ec2f..58bd0a948a 100644 --- a/examples/actor-actions-vercel/vite.config.ts +++ b/examples/actor-actions-vercel/vite.config.ts @@ -1,5 +1,5 @@ -import { defineConfig } from "vite"; import react from "@vitejs/plugin-react"; +import { defineConfig } from "vite"; export default defineConfig({ plugins: [react()], diff --git a/examples/actor-actions/frontend/App.tsx b/examples/actor-actions/frontend/App.tsx index caccf5fc10..c7a0814410 100644 --- a/examples/actor-actions/frontend/App.tsx +++ b/examples/actor-actions/frontend/App.tsx @@ -1,5 +1,5 @@ -import { ActorError, createClient } from "rivetkit/client"; import { useState } from "react"; +import { ActorError, createClient } from "rivetkit/client"; import type { CompanyProfile, EmployeeProfile, @@ -13,12 +13,13 @@ export function App() { const [companyName, setCompanyName] = useState("Acme Corp"); const [companyIndustry, setCompanyIndustry] = useState("Technology"); const [companyProfile, setCompanyProfile] = useState( - null + null, ); const [employeeName, setEmployeeName] = useState("Jane Smith"); const [employeeEmail, setEmployeeEmail] = useState("jane@acme.com"); - const [employeePosition, setEmployeePosition] = useState("Software Engineer"); + const [employeePosition, setEmployeePosition] = + useState("Software Engineer"); const [createdEmployee, setCreatedEmployee] = useState(null); const [employeeList, setEmployeeList] = useState([]); @@ -44,7 +45,7 @@ export function App() { error.code === "already_exists" ) { alert( - `Company with EIN "${companyEin}" already exists. Use "Load Profile" to view it.` + `Company with EIN "${companyEin}" already exists. Use "Load Profile" to view it.`, ); } else { // Re-throw other errors @@ -85,7 +86,7 @@ export function App() { error.code === "already_exists" ) { alert( - `Employee with email "${employeeEmail}" already exists. Click on their name in the list to view their profile.` + `Employee with email "${employeeEmail}" already exists. Click on their name in the list to view their profile.`, ); } else { // Re-throw other errors @@ -100,14 +101,13 @@ export function App() { setCreatedEmployee(profile); }; - return (

Quickstart: Actions

- Demonstrates creating actors with input parameters and calling - type-safe actions between actors + Demonstrates creating actors with input parameters and + calling type-safe actions between actors

@@ -143,15 +143,10 @@ export function App() { />
- -
@@ -166,11 +161,14 @@ export function App() { Name: {companyProfile.name}
- Industry: {companyProfile.industry} + Industry:{" "} + {companyProfile.industry}
Founded:{" "} - {new Date(companyProfile.foundedAt).toLocaleString()} + {new Date( + companyProfile.foundedAt, + ).toLocaleString()}
)} @@ -178,7 +176,13 @@ export function App() { {employeeList.length > 0 && (

Employees ({employeeList.length})

-
+
{employeeList.map((email) => (
@@ -240,7 +246,8 @@ export function App() {

Employee Profile

- Employee ID: {createdEmployee.employeeId} + Employee ID:{" "} + {createdEmployee.employeeId}
Name: {createdEmployee.name} @@ -249,14 +256,18 @@ export function App() { Email: {createdEmployee.email}
- Position: {createdEmployee.position} + Position:{" "} + {createdEmployee.position}
- Company ID: {createdEmployee.companyId} + Company ID:{" "} + {createdEmployee.companyId}
Hired:{" "} - {new Date(createdEmployee.hiredAt).toLocaleString()} + {new Date( + createdEmployee.hiredAt, + ).toLocaleString()}
)} diff --git a/examples/actor-actions/frontend/main.tsx b/examples/actor-actions/frontend/main.tsx index 372f49c622..2efcb334fc 100644 --- a/examples/actor-actions/frontend/main.tsx +++ b/examples/actor-actions/frontend/main.tsx @@ -8,5 +8,5 @@ if (!root) throw new Error("Root element not found"); createRoot(root).render( - + , ); diff --git a/examples/actor-actions/vite.config.ts b/examples/actor-actions/vite.config.ts index bd1498f19b..d87206ae8e 100644 --- a/examples/actor-actions/vite.config.ts +++ b/examples/actor-actions/vite.config.ts @@ -1,5 +1,5 @@ -import { defineConfig } from "vite"; import react from "@vitejs/plugin-react"; +import { defineConfig } from "vite"; export default defineConfig({ plugins: [react()], diff --git a/examples/ai-agent-vercel/frontend/App.tsx b/examples/ai-agent-vercel/frontend/App.tsx index a8fe34fcb2..8f056086f7 100644 --- a/examples/ai-agent-vercel/frontend/App.tsx +++ b/examples/ai-agent-vercel/frontend/App.tsx @@ -43,15 +43,15 @@ function AgentPanel({ info }: { info: AgentInfo }) { agent.useEvent("messageAdded", (message: AgentMessage) => { setMessages((prev) => { - const existingIndex = prev.findIndex((item) => item.id === message.id); + const existingIndex = prev.findIndex( + (item) => item.id === message.id, + ); if (existingIndex !== -1) { const next = [...prev]; next[existingIndex] = message; return next; } - return [...prev, message].sort( - (a, b) => a.createdAt - b.createdAt, - ); + return [...prev, message].sort((a, b) => a.createdAt - b.createdAt); }); }); @@ -122,12 +122,16 @@ function AgentPanel({ info }: { info: AgentInfo }) { className={`message message--${message.role}`} >
- {message.sender} + + {message.sender} + {formatTime(message.createdAt)}
-

{message.content}

+

+ {message.content} +

)) )} @@ -198,8 +202,8 @@ export function App() {

AI Agent

Spin up AI agents and message them in parallel.

- Each Rivet Actor keeps its own memory and streams responses - as queue messages arrive. + Each Rivet Actor keeps its own memory and streams + responses as queue messages arrive.

@@ -207,7 +211,9 @@ export function App() { Agent name setAgentName(event.target.value)} + onChange={(event) => + setAgentName(event.target.value) + } onKeyDown={handleCreateKeyDown} placeholder="Ops Analyst" disabled={!manager.connection} diff --git a/examples/ai-agent-vercel/src/actors.ts b/examples/ai-agent-vercel/src/actors.ts index b1ebd29171..7064b11f8c 100644 --- a/examples/ai-agent-vercel/src/actors.ts +++ b/examples/ai-agent-vercel/src/actors.ts @@ -1,5 +1,5 @@ import { openai } from "@ai-sdk/openai"; -import { streamText, type CoreMessage } from "ai"; +import { type CoreMessage, streamText } from "ai"; import { actor, event, queue, setup } from "rivetkit"; export type AgentMessage = { diff --git a/examples/ai-agent-vercel/vite.config.ts b/examples/ai-agent-vercel/vite.config.ts index f9f0d5ec2f..58bd0a948a 100644 --- a/examples/ai-agent-vercel/vite.config.ts +++ b/examples/ai-agent-vercel/vite.config.ts @@ -1,5 +1,5 @@ -import { defineConfig } from "vite"; import react from "@vitejs/plugin-react"; +import { defineConfig } from "vite"; export default defineConfig({ plugins: [react()], diff --git a/examples/ai-agent/frontend/App.tsx b/examples/ai-agent/frontend/App.tsx index 728b7c6b24..5ab2e1934d 100644 --- a/examples/ai-agent/frontend/App.tsx +++ b/examples/ai-agent/frontend/App.tsx @@ -41,15 +41,15 @@ function AgentPanel({ info }: { info: AgentInfo }) { agent.useEvent("messageAdded", (message: AgentMessage) => { setMessages((prev) => { - const existingIndex = prev.findIndex((item) => item.id === message.id); + const existingIndex = prev.findIndex( + (item) => item.id === message.id, + ); if (existingIndex !== -1) { const next = [...prev]; next[existingIndex] = message; return next; } - return [...prev, message].sort( - (a, b) => a.createdAt - b.createdAt, - ); + return [...prev, message].sort((a, b) => a.createdAt - b.createdAt); }); }); @@ -120,12 +120,16 @@ function AgentPanel({ info }: { info: AgentInfo }) { className={`message message--${message.role}`} >
- {message.sender} + + {message.sender} + {formatTime(message.createdAt)}
-

{message.content}

+

+ {message.content} +

)) )} @@ -196,8 +200,8 @@ export function App() {

AI Agent

Spin up AI agents and message them in parallel.

- Each Rivet Actor keeps its own memory and streams responses - as queue messages arrive. + Each Rivet Actor keeps its own memory and streams + responses as queue messages arrive.

@@ -205,7 +209,9 @@ export function App() { Agent name setAgentName(event.target.value)} + onChange={(event) => + setAgentName(event.target.value) + } onKeyDown={handleCreateKeyDown} placeholder="Ops Analyst" disabled={!manager.connection} diff --git a/examples/ai-agent/src/index.ts b/examples/ai-agent/src/index.ts index 3c5ae76f9d..9780d0f7ca 100644 --- a/examples/ai-agent/src/index.ts +++ b/examples/ai-agent/src/index.ts @@ -1,5 +1,5 @@ import { openai } from "@ai-sdk/openai"; -import { streamText, type CoreMessage } from "ai"; +import { type CoreMessage, streamText } from "ai"; import { actor, event, queue, setup } from "rivetkit"; export type AgentMessage = { diff --git a/examples/ai-and-user-generated-actors-freestyle/frontend/App.tsx b/examples/ai-and-user-generated-actors-freestyle/frontend/App.tsx index c4a6bbb57b..05b05bf839 100644 --- a/examples/ai-and-user-generated-actors-freestyle/frontend/App.tsx +++ b/examples/ai-and-user-generated-actors-freestyle/frontend/App.tsx @@ -1,9 +1,9 @@ -import { useState } from "react"; import Editor, { type OnMount } from "@monaco-editor/react"; +import { useState } from "react"; import "./App.css"; -import DEFAULT_REGISTRY from "../template/src/registry.ts?raw"; -import DEFAULT_APP from "../template/frontend/App.tsx?raw"; import type { DeployRequest } from "../src/utils.ts"; +import DEFAULT_APP from "../template/frontend/App.tsx?raw"; +import DEFAULT_REGISTRY from "../template/src/registry.ts?raw"; type DeploymentTarget = "cloud" | "selfHosted"; @@ -41,15 +41,22 @@ export function App() { target: "cloud", freestyleDomain: "", freestyleApiKey: "", - cloudApiUrl: import.meta.env.VITE_RIVET_CLOUD_ENDPOINT || "https://api-cloud.rivet.dev", + cloudApiUrl: + import.meta.env.VITE_RIVET_CLOUD_ENDPOINT || + "https://api-cloud.rivet.dev", cloudApiToken: "", - cloudEngineEndpoint: import.meta.env.VITE_RIVET_ENGINE_ENDPOINT || "https://api.rivet.dev", + cloudEngineEndpoint: + import.meta.env.VITE_RIVET_ENGINE_ENDPOINT || + "https://api.rivet.dev", selfHostedEndpoint: "", selfHostedToken: "", }); const addLog = (message: string) => { - setDeploymentLog((prev) => [...prev, `[${new Date().toLocaleTimeString()}] ${message}`]); + setDeploymentLog((prev) => [ + ...prev, + `[${new Date().toLocaleTimeString()}] ${message}`, + ]); }; const handleDeploy = async () => { @@ -60,7 +67,8 @@ export function App() { setFreestyleUrl(null); try { - const datacenter = import.meta.env.VITE_RIVET_DATACENTER || "us-west-1"; + const datacenter = + import.meta.env.VITE_RIVET_DATACENTER || "us-west-1"; // Build request payload const payload: DeployRequest = { @@ -69,20 +77,21 @@ export function App() { datacenter, freestyleDomain: config.freestyleDomain, freestyleApiKey: config.freestyleApiKey, - kind: config.target === "cloud" - ? { - cloud: { - cloudEndpoint: config.cloudApiUrl, - cloudToken: config.cloudApiToken, - engineEndpoint: config.cloudEngineEndpoint, - } - } - : { - selfHosted: { - endpoint: config.selfHostedEndpoint, - token: config.selfHostedToken, - } - } + kind: + config.target === "cloud" + ? { + cloud: { + cloudEndpoint: config.cloudApiUrl, + cloudToken: config.cloudApiToken, + engineEndpoint: config.cloudEngineEndpoint, + }, + } + : { + selfHosted: { + endpoint: config.selfHostedEndpoint, + token: config.selfHostedToken, + }, + }, }; const response = await fetch("/api/deploy", { @@ -124,7 +133,9 @@ export function App() { addLog(data); } else if (currentEvent === "result") { const result = JSON.parse(data); - setDeploymentUrl(`https://${config.freestyleDomain}/`); + setDeploymentUrl( + `https://${config.freestyleDomain}/`, + ); if (result.dashboardUrl) { setDashboardUrl(result.dashboardUrl); } @@ -139,7 +150,9 @@ export function App() { } } } catch (error) { - addLog(`Error: ${error instanceof Error ? error.message : String(error)}`); + addLog( + `Error: ${error instanceof Error ? error.message : String(error)}`, + ); } finally { setDeploying(false); } @@ -150,7 +163,9 @@ export function App() {
-
src/backend/registry.ts
+
+ src/backend/registry.ts +
-
src/frontend/App.tsx
+
+ src/frontend/App.tsx +
@@ -217,7 +242,11 @@ export function App() { type="password" value={config.cloudApiToken} onChange={(e) => - setConfig({ ...config, cloudApiToken: e.target.value }) + setConfig({ + ...config, + cloudApiToken: + e.target.value, + }) } placeholder="Required" /> @@ -229,9 +258,15 @@ export function App() { - setConfig({ ...config, selfHostedEndpoint: e.target.value }) + setConfig({ + ...config, + selfHostedEndpoint: + e.target.value, + }) } placeholder="Required" /> @@ -242,7 +277,11 @@ export function App() { type="password" value={config.selfHostedToken} onChange={(e) => - setConfig({ ...config, selfHostedToken: e.target.value }) + setConfig({ + ...config, + selfHostedToken: + e.target.value, + }) } placeholder="Required" /> @@ -255,7 +294,10 @@ export function App() { type="text" value={config.freestyleDomain} onChange={(e) => - setConfig({ ...config, freestyleDomain: e.target.value }) + setConfig({ + ...config, + freestyleDomain: e.target.value, + }) } placeholder="myapp.style.dev" /> @@ -266,7 +308,10 @@ export function App() { type="password" value={config.freestyleApiKey} onChange={(e) => - setConfig({ ...config, freestyleApiKey: e.target.value }) + setConfig({ + ...config, + freestyleApiKey: e.target.value, + }) } placeholder="Required" /> @@ -285,7 +330,9 @@ export function App() {
{deploymentLog.length > 0 && ( -
+

Deployment Log

{deploymentLog.map((log, i) => (
{log}
@@ -296,16 +343,28 @@ export function App() { {deploymentUrl && (

Deployment Complete

- + Open App › {dashboardUrl && ( - + Rivet Namespace › )} {freestyleUrl && ( - + Freestyle Deployment › )} diff --git a/examples/ai-and-user-generated-actors-freestyle/src/index.ts b/examples/ai-and-user-generated-actors-freestyle/src/index.ts index 93fb5e2a57..aa242bdd4b 100644 --- a/examples/ai-and-user-generated-actors-freestyle/src/index.ts +++ b/examples/ai-and-user-generated-actors-freestyle/src/index.ts @@ -29,7 +29,9 @@ const server = createServer(async (req, res) => { for await (const chunk of req) { chunks.push(chunk as Buffer); } - const body: DeployRequest = JSON.parse(Buffer.concat(chunks).toString()); + const body: DeployRequest = JSON.parse( + Buffer.concat(chunks).toString(), + ); // Set up SSE response res.writeHead(200, { diff --git a/examples/ai-and-user-generated-actors-freestyle/template/frontend/main.tsx b/examples/ai-and-user-generated-actors-freestyle/template/frontend/main.tsx index bd39f29eec..0ce6067a4b 100644 --- a/examples/ai-and-user-generated-actors-freestyle/template/frontend/main.tsx +++ b/examples/ai-and-user-generated-actors-freestyle/template/frontend/main.tsx @@ -8,5 +8,5 @@ if (!root) throw new Error("Root element not found"); createRoot(root).render( - + , ); diff --git a/examples/ai-and-user-generated-actors-freestyle/template/src/registry.ts b/examples/ai-and-user-generated-actors-freestyle/template/src/registry.ts index 6e23e6b9a6..97d80c86c9 100644 --- a/examples/ai-and-user-generated-actors-freestyle/template/src/registry.ts +++ b/examples/ai-and-user-generated-actors-freestyle/template/src/registry.ts @@ -1,4 +1,4 @@ -import { actor, setup, event } from "rivetkit"; +import { actor, event, setup } from "rivetkit"; export const counter = actor({ state: { diff --git a/examples/ai-and-user-generated-actors-freestyle/vite.config.ts b/examples/ai-and-user-generated-actors-freestyle/vite.config.ts index 8d662bfdb1..b8a8853640 100644 --- a/examples/ai-and-user-generated-actors-freestyle/vite.config.ts +++ b/examples/ai-and-user-generated-actors-freestyle/vite.config.ts @@ -1,5 +1,5 @@ -import { defineConfig } from "vite"; import react from "@vitejs/plugin-react"; +import { defineConfig } from "vite"; export default defineConfig({ plugins: [react()], diff --git a/examples/chat-room-vercel/frontend/App.tsx b/examples/chat-room-vercel/frontend/App.tsx index e8971e199e..4874571fac 100644 --- a/examples/chat-room-vercel/frontend/App.tsx +++ b/examples/chat-room-vercel/frontend/App.tsx @@ -2,7 +2,9 @@ import { createRivetKit } from "@rivetkit/react"; import { useEffect, useState } from "react"; import type { Message, registry } from "../src/actors.ts"; -const { useActor } = createRivetKit(`${location.origin}/api/rivet`); +const { useActor } = createRivetKit( + `${location.origin}/api/rivet`, +); export function App() { const [roomId, setRoomId] = useState("general"); diff --git a/examples/chat-room-vercel/frontend/main.tsx b/examples/chat-room-vercel/frontend/main.tsx index 372f49c622..2efcb334fc 100644 --- a/examples/chat-room-vercel/frontend/main.tsx +++ b/examples/chat-room-vercel/frontend/main.tsx @@ -8,5 +8,5 @@ if (!root) throw new Error("Root element not found"); createRoot(root).render( - + , ); diff --git a/examples/chat-room-vercel/src/actors.ts b/examples/chat-room-vercel/src/actors.ts index 8261daa4af..6029674a00 100644 --- a/examples/chat-room-vercel/src/actors.ts +++ b/examples/chat-room-vercel/src/actors.ts @@ -1,4 +1,4 @@ -import { actor, setup, event } from "rivetkit"; +import { actor, event, setup } from "rivetkit"; export type Message = { sender: string; text: string; timestamp: number }; diff --git a/examples/chat-room-vercel/vite.config.ts b/examples/chat-room-vercel/vite.config.ts index f9f0d5ec2f..58bd0a948a 100644 --- a/examples/chat-room-vercel/vite.config.ts +++ b/examples/chat-room-vercel/vite.config.ts @@ -1,5 +1,5 @@ -import { defineConfig } from "vite"; import react from "@vitejs/plugin-react"; +import { defineConfig } from "vite"; export default defineConfig({ plugins: [react()], diff --git a/examples/chat-room/frontend/main.tsx b/examples/chat-room/frontend/main.tsx index 372f49c622..2efcb334fc 100644 --- a/examples/chat-room/frontend/main.tsx +++ b/examples/chat-room/frontend/main.tsx @@ -8,5 +8,5 @@ if (!root) throw new Error("Root element not found"); createRoot(root).render( - + , ); diff --git a/examples/chat-room/src/index.ts b/examples/chat-room/src/index.ts index e87d6bae0a..7262c37b57 100644 --- a/examples/chat-room/src/index.ts +++ b/examples/chat-room/src/index.ts @@ -1,4 +1,4 @@ -import { actor, setup, event } from "rivetkit"; +import { actor, event, setup } from "rivetkit"; export type Message = { sender: string; text: string; timestamp: number }; diff --git a/examples/chat-room/vite.config.ts b/examples/chat-room/vite.config.ts index 6c2888182d..70a30ddd4b 100644 --- a/examples/chat-room/vite.config.ts +++ b/examples/chat-room/vite.config.ts @@ -1,5 +1,5 @@ -import { defineConfig } from "vite"; import react from "@vitejs/plugin-react"; +import { defineConfig } from "vite"; export default defineConfig({ plugins: [react()], diff --git a/examples/cloudflare-workers-hono/src/index.ts b/examples/cloudflare-workers-hono/src/index.ts index c19d76fc32..6df4eb2b1e 100644 --- a/examples/cloudflare-workers-hono/src/index.ts +++ b/examples/cloudflare-workers-hono/src/index.ts @@ -19,4 +19,5 @@ app.post("/increment/:name", async (c) => { }); const { handler, ActorHandler } = createHandler(registry, { fetch: app.fetch }); -export { handler as default, ActorHandler }; + +export { ActorHandler, handler as default }; diff --git a/examples/cloudflare-workers-inline-client/src/registry.ts b/examples/cloudflare-workers-inline-client/src/registry.ts index 5939fc3512..953d6d51a9 100644 --- a/examples/cloudflare-workers-inline-client/src/registry.ts +++ b/examples/cloudflare-workers-inline-client/src/registry.ts @@ -1,4 +1,4 @@ -import { actor, setup, event } from "rivetkit"; +import { actor, event, setup } from "rivetkit"; export const counter = actor({ state: { count: 0 }, diff --git a/examples/cloudflare-workers/src/actors.ts b/examples/cloudflare-workers/src/actors.ts index 753e9fe32b..585772e9b2 100644 --- a/examples/cloudflare-workers/src/actors.ts +++ b/examples/cloudflare-workers/src/actors.ts @@ -1,4 +1,4 @@ -import { actor, setup, event } from "rivetkit"; +import { actor, event, setup } from "rivetkit"; import { db } from "rivetkit/db"; const COUNTER_ROW_ID = 1; diff --git a/examples/cloudflare-workers/src/index.ts b/examples/cloudflare-workers/src/index.ts index bd2759ac2a..2c2102eb70 100644 --- a/examples/cloudflare-workers/src/index.ts +++ b/examples/cloudflare-workers/src/index.ts @@ -2,4 +2,5 @@ import { createHandler } from "@rivetkit/cloudflare-workers"; import { registry } from "./actors"; const { handler, ActorHandler } = createHandler(registry); -export { handler as default, ActorHandler }; + +export { ActorHandler, handler as default }; diff --git a/examples/collaborative-document-vercel/frontend/App.tsx b/examples/collaborative-document-vercel/frontend/App.tsx index 88e8fd4779..3307c871dd 100644 --- a/examples/collaborative-document-vercel/frontend/App.tsx +++ b/examples/collaborative-document-vercel/frontend/App.tsx @@ -1,16 +1,22 @@ import { createRivetKit } from "@rivetkit/react"; -import { useEffect, useMemo, useRef, useState } from "react"; import type { CSSProperties, ReactNode } from "react"; +import { useEffect, useMemo, useRef, useState } from "react"; +import { + Awareness, + applyAwarenessUpdate, + encodeAwarenessUpdate, +} from "y-protocols/awareness"; +import * as Y from "yjs"; import type { AwarenessEvent, DocumentSummary, - SyncEvent, registry, + SyncEvent, } from "../src/actors.ts"; -import { Awareness, applyAwarenessUpdate, encodeAwarenessUpdate } from "y-protocols/awareness"; -import * as Y from "yjs"; -const { useActor } = createRivetKit(`${location.origin}/api/rivet`); +const { useActor } = createRivetKit( + `${location.origin}/api/rivet`, +); const CURSOR_COLORS = [ "#f97316", @@ -40,13 +46,15 @@ const toNumbers = (update: Uint8Array) => Array.from(update); const toBytes = (update: number[]) => Uint8Array.from(update); const buildPresence = (awareness: Awareness): PresenceEntry[] => { - return Array.from(awareness.getStates().entries()).map(([clientId, state]) => { - return { - clientId, - user: state.user as PresenceEntry["user"], - cursor: state.cursor as PresenceEntry["cursor"], - }; - }); + return Array.from(awareness.getStates().entries()).map( + ([clientId, state]) => { + return { + clientId, + user: state.user as PresenceEntry["user"], + cursor: state.cursor as PresenceEntry["cursor"], + }; + }, + ); }; const renderWithCursors = (text: string, cursors: RemoteCursor[]) => { @@ -69,9 +77,11 @@ const renderWithCursors = (text: string, cursors: RemoteCursor[]) => { key={`cursor-${cursor.clientId}-${clamped}`} className="cursor-marker" data-name={cursor.name} - style={{ - "--cursor-color": cursor.color, - } as CSSProperties} + style={ + { + "--cursor-color": cursor.color, + } as CSSProperties + } />, ); lastIndex = clamped; @@ -136,7 +146,11 @@ function DocumentEditor({ }; const handleAwarenessUpdate = ( - { added, updated, removed }: { added: number[]; updated: number[]; removed: number[] }, + { + added, + updated, + removed, + }: { added: number[]; updated: number[]; removed: number[] }, origin: unknown, ) => { setPresence(buildPresence(awareness)); @@ -152,7 +166,11 @@ function DocumentEditor({ ...updated, ...removed, ]); - connection.applyUpdate(toNumbers(update), "awareness", awareness.clientID); + connection.applyUpdate( + toNumbers(update), + "awareness", + awareness.clientID, + ); }; doc.on("update", handleDocUpdate); @@ -171,7 +189,10 @@ function DocumentEditor({ if (!awareness) { return; } - awareness.setLocalStateField("user", { name: username, color: userColor }); + awareness.setLocalStateField("user", { + name: username, + color: userColor, + }); }, [username, userColor, document.id, documentActor.connection]); useEffect(() => { @@ -302,7 +323,9 @@ function DocumentEditor({