Skip to content

Commit 72a081a

Browse files
committed
feat: add actor proxy support for HTTP fallback (#951)
1 parent 320b8b6 commit 72a081a

Some content is hidden

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

69 files changed

+2980
-1285
lines changed

.github/workflows/test.yml

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -25,34 +25,34 @@ jobs:
2525
steps:
2626
- uses: actions/checkout@v4
2727

28-
# Setup Node.js
29-
- name: Set up Node.js
30-
uses: actions/setup-node@v4
31-
with:
32-
node-version: '22.14'
33-
# Note: We're not using the built-in cache here because we need to use corepack
34-
35-
- name: Setup Corepack
36-
run: corepack enable
37-
38-
- id: yarn-cache-dir-path
39-
name: Get yarn cache directory path
40-
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
41-
42-
- name: Cache dependencies
43-
uses: actions/cache@v3
44-
id: cache
45-
with:
46-
path: |
47-
${{ steps.yarn-cache-dir-path.outputs.dir }}
48-
.turbo
49-
key: ${{ runner.os }}-deps-${{ hashFiles('**/yarn.lock') }}-${{ github.sha }}
50-
restore-keys: |
51-
${{ runner.os }}-deps-${{ hashFiles('**/yarn.lock') }}-
52-
${{ runner.os }}-deps-
53-
54-
- name: Install dependencies
55-
run: yarn install
28+
# # Setup Node.js
29+
# - name: Set up Node.js
30+
# uses: actions/setup-node@v4
31+
# with:
32+
# node-version: '22.14'
33+
# # Note: We're not using the built-in cache here because we need to use corepack
34+
#
35+
# - name: Setup Corepack
36+
# run: corepack enable
37+
#
38+
# - id: yarn-cache-dir-path
39+
# name: Get yarn cache directory path
40+
# run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
41+
#
42+
# - name: Cache dependencies
43+
# uses: actions/cache@v3
44+
# id: cache
45+
# with:
46+
# path: |
47+
# ${{ steps.yarn-cache-dir-path.outputs.dir }}
48+
# .turbo
49+
# key: ${{ runner.os }}-deps-${{ hashFiles('**/yarn.lock') }}-${{ github.sha }}
50+
# restore-keys: |
51+
# ${{ runner.os }}-deps-${{ hashFiles('**/yarn.lock') }}-
52+
# ${{ runner.os }}-deps-
53+
#
54+
# - name: Install dependencies
55+
# run: yarn install
5656

5757
# - name: Run actor-core tests
5858
# # TODO: Add back

CLAUDE.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ This ensures imports resolve correctly across different build environments and p
8585
- Extend from `ActorError` base class
8686
- Use `UserError` for client-safe errors
8787
- Use `InternalError` for internal errors
88+
- Don't try to fix type issues by casting to unknown or any. If you need to do this, then stop and ask me to manually intervene.
89+
- Write log messages in lowercase
90+
- Instead of returning raw HTTP responses with c.json, use or write an error in packages/actor-core/src/actor/errors.ts and throw that instead. The middleware will automatically serialize the response for you.
8891

8992
## Project Structure
9093

examples/chat-room/scripts/cli.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ async function main() {
1010

1111
// connect to chat room - now accessed via property
1212
// can still pass parameters like room
13-
const chatRoom = await client.chatRoom.connect(room, {
13+
const chatRoom = client.chatRoom.connect(room, {
1414
params: { room },
1515
});
1616

examples/chat-room/scripts/connect.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ async function main() {
77
const client = createClient<App>(process.env.ENDPOINT ?? "http://localhost:6420");
88

99
// connect to chat room - now accessed via property
10-
const chatRoom = await client.chatRoom.connect();
10+
const chatRoom = client.chatRoom.connect();
1111

1212
// call action to get existing messages
1313
const messages = await chatRoom.getHistory();

examples/chat-room/tests/chat-room.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ test("chat room should handle messages", async (test) => {
66
const { client } = await setupTest(test, app);
77

88
// Connect to chat room
9-
const chatRoom = await client.chatRoom.connect();
9+
const chatRoom = client.chatRoom.connect();
1010

1111
// Initial history should be empty
1212
const initialMessages = await chatRoom.getHistory();

examples/counter/scripts/connect.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import type { App } from "../actors/app";
55
async function main() {
66
const client = createClient<App>(process.env.ENDPOINT ?? "http://localhost:6420");
77

8-
const counter = await client.counter.connect()
8+
const counter = client.counter.connect()
99

1010
counter.on("newCount", (count: number) => console.log("Event:", count));
1111

examples/counter/tests/counter.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { app } from "../actors/app";
44

55
test("it should count", async (test) => {
66
const { client } = await setupTest(test, app);
7-
const counter = await client.counter.connect();
7+
const counter = client.counter.connect();
88

99
// Test initial count
1010
expect(await counter.getCount()).toBe(0);

examples/linear-coding-agent/src/server/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ server.post('/api/webhook/linear', async (c) => {
7575
// Create or get a coding agent instance with the issue ID as a key
7676
// This ensures each issue gets its own actor instance
7777
console.log(`[SERVER] Getting actor for issue: ${issueId}`);
78-
const actorClient = await client.codingAgent.connect(issueId);
78+
const actorClient = client.codingAgent.connect(issueId);
7979

8080
// Initialize the agent if needed
8181
console.log(`[SERVER] Initializing actor for issue: ${issueId}`);

examples/resend-streaks/tests/user.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ beforeEach(() => {
2626

2727
test("streak tracking with time zone signups", async (t) => {
2828
const { client } = await setupTest(t, app);
29-
const actor = await client.user.connect();
29+
const actor = client.user.connect();
3030

3131
// Sign up with specific time zone
3232
const signupResult = await actor.completeSignUp(

packages/actor-core-cli/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
"bundle-require": "^5.1.0",
3939
"chokidar": "^4.0.3",
4040
"esbuild": "^0.25.1",
41+
"invariant": "^2.2.4",
4142
"open": "^10.1.0",
4243
"yoga-wasm-web": "0.3.3"
4344
},
@@ -46,6 +47,7 @@
4647
"@rivet-gg/api": "^24.6.2",
4748
"@sentry/esbuild-plugin": "^3.2.0",
4849
"@sentry/node": "^9.3.0",
50+
"@types/invariant": "^2",
4951
"@types/micromatch": "^4",
5052
"@types/react": "^18.3",
5153
"@types/semver": "^7.5.8",

0 commit comments

Comments
 (0)