From 41c49908d68fd8fb5917cf93f92d82fbca2ffb3e Mon Sep 17 00:00:00 2001 From: Nathan Flurry Date: Thu, 19 Jun 2025 18:19:19 +0000 Subject: [PATCH] chore: rename actorcore -> rivetkit take 2 --- CHANGELOG.md | 8 +- clients/python/Cargo.toml | 2 +- clients/python/README.md | 2 +- clients/python/src/events/async/client.rs | 20 +- clients/python/src/events/async/handle.rs | 6 +- clients/python/src/events/sync/client.rs | 20 +- clients/python/src/events/sync/handle.rs | 6 +- clients/python/src/lib.rs | 2 +- clients/python/src/simple/async/client.rs | 20 +- clients/python/src/simple/async/handle.rs | 8 +- clients/python/src/simple/sync/client.rs | 20 +- clients/python/src/simple/sync/handle.rs | 8 +- clients/python/src/util.rs | 4 +- clients/python/tests/test_e2e_async.py | 2 +- clients/python/tests/test_e2e_simple_async.py | 4 +- clients/python/tests/test_e2e_simple_sync.py | 2 +- clients/python/tests/test_e2e_sync.py | 2 +- clients/rust/README.md | 2 +- clients/rust/tests/e2e.rs | 4 +- docs/clients/rust.mdx | 8 +- docs/concepts/interacting-with-workers.mdx | 30 +-- examples/chat-room-python/scripts/cli.py | 4 +- examples/chat-room-python/scripts/connect.py | 4 +- .../chat-room-python/tests/test_chat_room.py | 6 +- examples/snippets/ai-agent/App.tsx | 4 +- examples/snippets/chat-room/App.tsx | 4 +- examples/snippets/crdt/App.tsx | 4 +- examples/snippets/database/App.tsx | 4 +- examples/snippets/document/App.tsx | 4 +- examples/snippets/game/App.tsx | 4 +- examples/snippets/rate/App.tsx | 4 +- examples/snippets/stream/App.tsx | 4 +- examples/snippets/sync/App.tsx | 4 +- examples/snippets/tenant/App.tsx | 4 +- packages/frameworks/framework-base/lib/mod.ts | 14 +- packages/frameworks/react/README.md | 2 +- packages/frameworks/react/lib/mod.tsx | 8 +- packages/frameworks/react/src/App.tsx | 192 +++++++++--------- packages/frameworks/react/src/main.tsx | 18 +- packages/frameworks/react/src/mod.tsx | 2 +- .../cloudflare-workers/src/handler.ts | 8 +- turbo.json | 3 +- vitest.base.ts | 2 +- 43 files changed, 242 insertions(+), 241 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index db7c2a5bc..365683e84 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -173,7 +173,7 @@ * add ws & eventsource as dev dependencies of rivetkit so it can build ([1cdf9c4](https://github.com/rivet-gg/rivetkit/commit/1cdf9c4351367a152224697029b047e5ef66518a)) * changelog for 0.6.3 ([cf6d723](https://github.com/rivet-gg/rivetkit/commit/cf6d723a081029e8241a643186d41a09701192bd)) * fix grammar on index ([#689](https://github.com/rivet-gg/rivetkit/issues/689)) ([dac5660](https://github.com/rivet-gg/rivetkit/commit/dac566058490c28ad34511dcee77c962602c6a3e)) -* fix typo of "Actor Core" -> "ActorCore" ([#707](https://github.com/rivet-gg/rivetkit/issues/707)) ([d1e8be5](https://github.com/rivet-gg/rivetkit/commit/d1e8be523fc75e1c55ad529bd85bc832a545b12a)) +* fix typo of "Actor Core" -> "RivetKit" ([#707](https://github.com/rivet-gg/rivetkit/issues/707)) ([d1e8be5](https://github.com/rivet-gg/rivetkit/commit/d1e8be523fc75e1c55ad529bd85bc832a545b12a)) * increase RPC timeout from 5s to 60s ([#705](https://github.com/rivet-gg/rivetkit/issues/705)) ([ec6a478](https://github.com/rivet-gg/rivetkit/commit/ec6a478e9ffff91028e8f2f718c79e65d3479354)) * **main:** release 0.6.2 ([#693](https://github.com/rivet-gg/rivetkit/issues/693)) ([73c3399](https://github.com/rivet-gg/rivetkit/commit/73c3399a96a720ff5663ee359e686aa6e573737b)) * **main:** release 0.6.3 ([#697](https://github.com/rivet-gg/rivetkit/issues/697)) ([40fbcc1](https://github.com/rivet-gg/rivetkit/commit/40fbcc11d115761f27a843f6cac816449fc61ceb)) @@ -196,7 +196,7 @@ * update changelog for 0.7.0 ([#715](https://github.com/rivet-gg/rivetkit/issues/715)) ([dba8085](https://github.com/rivet-gg/rivetkit/commit/dba808513f2fb42ebd84f0d1dd21b3798223fda1)) * update changelog for 0.7.1 ([#731](https://github.com/rivet-gg/rivetkit/issues/731)) ([f2e0cb3](https://github.com/rivet-gg/rivetkit/commit/f2e0cb3b18131086765478812498e605d3be2ff8)) * update lockfile ([7b61057](https://github.com/rivet-gg/rivetkit/commit/7b6105796a2bbec69d75dbd0cae717b2e8fd7827)) -* update platforms to support `ActorCoreApp` ([#712](https://github.com/rivet-gg/rivetkit/issues/712)) ([576a101](https://github.com/rivet-gg/rivetkit/commit/576a101dcfcbe5c44ff771db1db64b275a68cf81)) +* update platforms to support `RivetKitApp` ([#712](https://github.com/rivet-gg/rivetkit/issues/712)) ([576a101](https://github.com/rivet-gg/rivetkit/commit/576a101dcfcbe5c44ff771db1db64b275a68cf81)) ## [0.7.0](https://github.com/rivet-gg/rivetkit/compare/v0.6.3...v0.7.0) (2025-03-16) @@ -226,7 +226,7 @@ ### Chores * add ws & eventsource as dev dependencies of rivetkit so it can build ([1cdf9c4](https://github.com/rivet-gg/rivetkit/commit/1cdf9c4351367a152224697029b047e5ef66518a)) -* fix typo of "Actor Core" -> "ActorCore" ([#707](https://github.com/rivet-gg/rivetkit/issues/707)) ([d1e8be5](https://github.com/rivet-gg/rivetkit/commit/d1e8be523fc75e1c55ad529bd85bc832a545b12a)) +* fix typo of "Actor Core" -> "RivetKit" ([#707](https://github.com/rivet-gg/rivetkit/issues/707)) ([d1e8be5](https://github.com/rivet-gg/rivetkit/commit/d1e8be523fc75e1c55ad529bd85bc832a545b12a)) * increase RPC timeout from 5s to 60s ([#705](https://github.com/rivet-gg/rivetkit/issues/705)) ([ec6a478](https://github.com/rivet-gg/rivetkit/commit/ec6a478e9ffff91028e8f2f718c79e65d3479354)) * release 0.7.0 ([0a9b745](https://github.com/rivet-gg/rivetkit/commit/0a9b745f966379ed324be2a354d91999cb65e1f1)) * release version 0.7.0 ([0fbc3da](https://github.com/rivet-gg/rivetkit/commit/0fbc3da0430581cc47543d2904c8241fa38d4f0e)) @@ -234,7 +234,7 @@ * rename rpcs -> actions ([#711](https://github.com/rivet-gg/rivetkit/issues/711)) ([8957e56](https://github.com/rivet-gg/rivetkit/commit/8957e560572e7594db03d9ea631bf32995a61bd0)) * show full subpath to value that cannot be serialized when setting invalid state ([#706](https://github.com/rivet-gg/rivetkit/issues/706)) ([a666bc3](https://github.com/rivet-gg/rivetkit/commit/a666bc37644966d7482f54370ab92c5b259136b9)) * update changelog for 0.7.0 ([#715](https://github.com/rivet-gg/rivetkit/issues/715)) ([dba8085](https://github.com/rivet-gg/rivetkit/commit/dba808513f2fb42ebd84f0d1dd21b3798223fda1)) -* update platforms to support `ActorCoreApp` ([#712](https://github.com/rivet-gg/rivetkit/issues/712)) ([576a101](https://github.com/rivet-gg/rivetkit/commit/576a101dcfcbe5c44ff771db1db64b275a68cf81)) +* update platforms to support `RivetKitApp` ([#712](https://github.com/rivet-gg/rivetkit/issues/712)) ([576a101](https://github.com/rivet-gg/rivetkit/commit/576a101dcfcbe5c44ff771db1db64b275a68cf81)) ## [0.6.3](https://github.com/rivet-gg/rivetkit/compare/v0.6.2...v0.6.3) (2025-03-13) diff --git a/clients/python/Cargo.toml b/clients/python/Cargo.toml index cab487f32..675d09941 100644 --- a/clients/python/Cargo.toml +++ b/clients/python/Cargo.toml @@ -10,7 +10,7 @@ edition = "2021" publish = false [lib] -name = "actor_core_client" +name = "rivetkit_client" crate-type = ["cdylib"] [dependencies] diff --git a/clients/python/README.md b/clients/python/README.md index 3a7f938eb..558375a8a 100644 --- a/clients/python/README.md +++ b/clients/python/README.md @@ -21,7 +21,7 @@ pip install python-rivetkit-client ### Step 2: Connect to Actor ```python -from python_actor_core_client import AsyncClient as ActorClient +from python_rivetkit_client import AsyncClient as ActorClient import asyncio async def main(): diff --git a/clients/python/src/events/async/client.rs b/clients/python/src/events/async/client.rs index 3096f3324..ca3db7c69 100644 --- a/clients/python/src/events/async/client.rs +++ b/clients/python/src/events/async/client.rs @@ -1,6 +1,6 @@ use std::sync::Arc; -use actor_core_client::{self as actor_core_rs, CreateOptions, GetOptions, GetWithIdOptions}; +use rivetkit_client::{self as rivetkit_rs, CreateOptions, GetOptions, GetWithIdOptions}; use pyo3::prelude::*; use crate::util::{try_opts_from_kwds, PyKwdArgs}; @@ -9,7 +9,7 @@ use super::handle::ActorHandle; #[pyclass(name = "AsyncClient")] pub struct Client { - client: Arc, + client: Arc, } #[pymethods] @@ -27,7 +27,7 @@ impl Client { ) -> PyResult { let transport_kind = try_transport_kind_from_str(&transport_kind)?; let encoding_kind = try_encoding_kind_from_str(&encoding_kind)?; - let client = actor_core_rs::Client::new( + let client = rivetkit_rs::Client::new( endpoint.to_string(), transport_kind, encoding_kind @@ -104,10 +104,10 @@ impl Client { fn try_transport_kind_from_str( transport_kind: &str -) -> PyResult { +) -> PyResult { match transport_kind { - "websocket" => Ok(actor_core_rs::TransportKind::WebSocket), - "sse" => Ok(actor_core_rs::TransportKind::Sse), + "websocket" => Ok(rivetkit_rs::TransportKind::WebSocket), + "sse" => Ok(rivetkit_rs::TransportKind::Sse), _ => Err(py_value_err!( "Invalid transport kind: {}", transport_kind @@ -117,13 +117,13 @@ fn try_transport_kind_from_str( fn try_encoding_kind_from_str( encoding_kind: &str -) -> PyResult { +) -> PyResult { match encoding_kind { - "json" => Ok(actor_core_rs::EncodingKind::Json), - "cbor" => Ok(actor_core_rs::EncodingKind::Cbor), + "json" => Ok(rivetkit_rs::EncodingKind::Json), + "cbor" => Ok(rivetkit_rs::EncodingKind::Cbor), _ => Err(py_value_err!( "Invalid encoding kind: {}", encoding_kind )), } -} \ No newline at end of file +} diff --git a/clients/python/src/events/async/handle.rs b/clients/python/src/events/async/handle.rs index 3339bca9e..9069e5d85 100644 --- a/clients/python/src/events/async/handle.rs +++ b/clients/python/src/events/async/handle.rs @@ -1,12 +1,12 @@ -use actor_core_client::{self as actor_core_rs}; +use rivetkit_client::{self as rivetkit_rs}; use pyo3::{prelude::*, types::PyTuple}; use crate::util; #[pyclass] pub struct ActorHandle { - pub handle: actor_core_rs::connection::ActorHandle, + pub handle: rivetkit_rs::connection::ActorHandle, } #[pymethods] @@ -92,4 +92,4 @@ impl ActorHandle { Ok(()) }) } -} \ No newline at end of file +} diff --git a/clients/python/src/events/sync/client.rs b/clients/python/src/events/sync/client.rs index 10065a713..b18f592b0 100644 --- a/clients/python/src/events/sync/client.rs +++ b/clients/python/src/events/sync/client.rs @@ -1,4 +1,4 @@ -use actor_core_client::{self as actor_core_rs, CreateOptions, GetOptions, GetWithIdOptions}; +use rivetkit_client::{self as rivetkit_rs, CreateOptions, GetOptions, GetWithIdOptions}; use pyo3::prelude::*; use super::handle::ActorHandle; @@ -6,7 +6,7 @@ use crate::util::{try_opts_from_kwds, PyKwdArgs, SYNC_RUNTIME}; #[pyclass(name = "Client")] pub struct Client { - client: actor_core_rs::Client, + client: rivetkit_rs::Client, } #[pymethods] @@ -24,7 +24,7 @@ impl Client { ) -> PyResult { let transport_kind = try_transport_kind_from_str(&transport_kind)?; let encoding_kind = try_encoding_kind_from_str(&encoding_kind)?; - let client = actor_core_rs::Client::new( + let client = rivetkit_rs::Client::new( endpoint.to_string(), transport_kind, encoding_kind @@ -83,10 +83,10 @@ impl Client { fn try_transport_kind_from_str( transport_kind: &str -) -> PyResult { +) -> PyResult { match transport_kind { - "websocket" => Ok(actor_core_rs::TransportKind::WebSocket), - "sse" => Ok(actor_core_rs::TransportKind::Sse), + "websocket" => Ok(rivetkit_rs::TransportKind::WebSocket), + "sse" => Ok(rivetkit_rs::TransportKind::Sse), _ => Err(py_value_err!( "Invalid transport kind: {}", transport_kind @@ -96,13 +96,13 @@ fn try_transport_kind_from_str( fn try_encoding_kind_from_str( encoding_kind: &str -) -> PyResult { +) -> PyResult { match encoding_kind { - "json" => Ok(actor_core_rs::EncodingKind::Json), - "cbor" => Ok(actor_core_rs::EncodingKind::Cbor), + "json" => Ok(rivetkit_rs::EncodingKind::Json), + "cbor" => Ok(rivetkit_rs::EncodingKind::Cbor), _ => Err(py_value_err!( "Invalid encoding kind: {}", encoding_kind )), } -} \ No newline at end of file +} diff --git a/clients/python/src/events/sync/handle.rs b/clients/python/src/events/sync/handle.rs index 233a7b5bd..1c239449a 100644 --- a/clients/python/src/events/sync/handle.rs +++ b/clients/python/src/events/sync/handle.rs @@ -1,11 +1,11 @@ -use actor_core_client::{self as actor_core_rs}; +use rivetkit_client::{self as rivetkit_rs}; use pyo3::{prelude::*, types::PyTuple}; use crate::util::{self, SYNC_RUNTIME}; #[pyclass] pub struct ActorHandle { - pub handle: actor_core_rs::connection::ActorHandle, + pub handle: rivetkit_rs::connection::ActorHandle, } #[pymethods] @@ -66,4 +66,4 @@ impl ActorHandle { self.handle.disconnect() ) } -} \ No newline at end of file +} diff --git a/clients/python/src/lib.rs b/clients/python/src/lib.rs index 97b9823e4..9072d08e4 100644 --- a/clients/python/src/lib.rs +++ b/clients/python/src/lib.rs @@ -6,7 +6,7 @@ mod simple; mod events; #[pymodule] -fn actor_core_client(m: &Bound<'_, PyModule>) -> PyResult<()> { +fn rivetkit_client(m: &Bound<'_, PyModule>) -> PyResult<()> { simple::init_module(m)?; events::init_module(m)?; diff --git a/clients/python/src/simple/async/client.rs b/clients/python/src/simple/async/client.rs index 700e727bd..2117955ad 100644 --- a/clients/python/src/simple/async/client.rs +++ b/clients/python/src/simple/async/client.rs @@ -1,6 +1,6 @@ use std::sync::Arc; -use actor_core_client::{self as actor_core_rs, CreateOptions, GetOptions, GetWithIdOptions}; +use rivetkit_client::{self as rivetkit_rs, CreateOptions, GetOptions, GetWithIdOptions}; use pyo3::prelude::*; use crate::util::{try_opts_from_kwds, PyKwdArgs}; @@ -9,7 +9,7 @@ use super::handle::ActorHandle; #[pyclass(name = "AsyncSimpleClient")] pub struct Client { - client: Arc, + client: Arc, } #[pymethods] @@ -27,7 +27,7 @@ impl Client { ) -> PyResult { let transport_kind = try_transport_kind_from_str(&transport_kind)?; let encoding_kind = try_encoding_kind_from_str(&encoding_kind)?; - let client = actor_core_rs::Client::new( + let client = rivetkit_rs::Client::new( endpoint.to_string(), transport_kind, encoding_kind @@ -98,10 +98,10 @@ impl Client { fn try_transport_kind_from_str( transport_kind: &str -) -> PyResult { +) -> PyResult { match transport_kind { - "websocket" => Ok(actor_core_rs::TransportKind::WebSocket), - "sse" => Ok(actor_core_rs::TransportKind::Sse), + "websocket" => Ok(rivetkit_rs::TransportKind::WebSocket), + "sse" => Ok(rivetkit_rs::TransportKind::Sse), _ => Err(py_value_err!( "Invalid transport kind: {}", transport_kind @@ -111,13 +111,13 @@ fn try_transport_kind_from_str( fn try_encoding_kind_from_str( encoding_kind: &str -) -> PyResult { +) -> PyResult { match encoding_kind { - "json" => Ok(actor_core_rs::EncodingKind::Json), - "cbor" => Ok(actor_core_rs::EncodingKind::Cbor), + "json" => Ok(rivetkit_rs::EncodingKind::Json), + "cbor" => Ok(rivetkit_rs::EncodingKind::Cbor), _ => Err(py_value_err!( "Invalid encoding kind: {}", encoding_kind )), } -} \ No newline at end of file +} diff --git a/clients/python/src/simple/async/handle.rs b/clients/python/src/simple/async/handle.rs index 871b02f92..2daae6fc5 100644 --- a/clients/python/src/simple/async/handle.rs +++ b/clients/python/src/simple/async/handle.rs @@ -1,4 +1,4 @@ -use actor_core_client::{self as actor_core_rs}; +use rivetkit_client::{self as rivetkit_rs}; use futures_util::FutureExt; use pyo3::{prelude::*, types::{PyList, PyString, PyTuple}}; use tokio::sync::mpsc; @@ -14,13 +14,13 @@ struct ActorEvent { #[pyclass] pub struct ActorHandle { - handle: actor_core_rs::connection::ActorHandle, + handle: rivetkit_rs::connection::ActorHandle, event_rx: Option>, event_tx: mpsc::Sender, } impl ActorHandle { - pub fn new(handle: actor_core_rs::connection::ActorHandle) -> Self { + pub fn new(handle: rivetkit_rs::connection::ActorHandle) -> Self { let (event_tx, event_rx) = mpsc::channel(EVENT_BUFFER_SIZE); Self { @@ -184,4 +184,4 @@ impl ActorHandle { Ok(()) }) } -} \ No newline at end of file +} diff --git a/clients/python/src/simple/sync/client.rs b/clients/python/src/simple/sync/client.rs index 117b86a53..8b540f1ba 100644 --- a/clients/python/src/simple/sync/client.rs +++ b/clients/python/src/simple/sync/client.rs @@ -1,4 +1,4 @@ -use actor_core_client::{self as actor_core_rs, CreateOptions, GetOptions, GetWithIdOptions}; +use rivetkit_client::{self as rivetkit_rs, CreateOptions, GetOptions, GetWithIdOptions}; use pyo3::prelude::*; use super::handle::ActorHandle; @@ -6,7 +6,7 @@ use crate::util::{try_opts_from_kwds, PyKwdArgs, SYNC_RUNTIME}; #[pyclass(name = "SimpleClient")] pub struct Client { - client: actor_core_rs::Client, + client: rivetkit_rs::Client, } #[pymethods] @@ -24,7 +24,7 @@ impl Client { ) -> PyResult { let transport_kind = try_transport_kind_from_str(&transport_kind)?; let encoding_kind = try_encoding_kind_from_str(&encoding_kind)?; - let client = actor_core_rs::Client::new( + let client = rivetkit_rs::Client::new( endpoint.to_string(), transport_kind, encoding_kind @@ -84,10 +84,10 @@ impl Client { fn try_transport_kind_from_str( transport_kind: &str -) -> PyResult { +) -> PyResult { match transport_kind { - "websocket" => Ok(actor_core_rs::TransportKind::WebSocket), - "sse" => Ok(actor_core_rs::TransportKind::Sse), + "websocket" => Ok(rivetkit_rs::TransportKind::WebSocket), + "sse" => Ok(rivetkit_rs::TransportKind::Sse), _ => Err(py_value_err!( "Invalid transport kind: {}", transport_kind @@ -97,13 +97,13 @@ fn try_transport_kind_from_str( fn try_encoding_kind_from_str( encoding_kind: &str -) -> PyResult { +) -> PyResult { match encoding_kind { - "json" => Ok(actor_core_rs::EncodingKind::Json), - "cbor" => Ok(actor_core_rs::EncodingKind::Cbor), + "json" => Ok(rivetkit_rs::EncodingKind::Json), + "cbor" => Ok(rivetkit_rs::EncodingKind::Cbor), _ => Err(py_value_err!( "Invalid encoding kind: {}", encoding_kind )), } -} \ No newline at end of file +} diff --git a/clients/python/src/simple/sync/handle.rs b/clients/python/src/simple/sync/handle.rs index 037e30892..c75c5fe77 100644 --- a/clients/python/src/simple/sync/handle.rs +++ b/clients/python/src/simple/sync/handle.rs @@ -1,4 +1,4 @@ -use actor_core_client::{self as actor_core_rs}; +use rivetkit_client::{self as rivetkit_rs}; use futures_util::FutureExt; use pyo3::{prelude::*, types::{PyList, PyString, PyTuple}}; use tokio::sync::mpsc; @@ -14,13 +14,13 @@ struct ActorEvent { #[pyclass] pub struct ActorHandle { - handle: actor_core_rs::connection::ActorHandle, + handle: rivetkit_rs::connection::ActorHandle, event_rx: Option>, event_tx: mpsc::Sender, } impl ActorHandle { - pub fn new(handle: actor_core_rs::connection::ActorHandle) -> Self { + pub fn new(handle: rivetkit_rs::connection::ActorHandle) -> Self { let (event_tx, event_rx) = mpsc::channel(EVENT_BUFFER_SIZE); Self { @@ -166,4 +166,4 @@ impl ActorHandle { self.handle.disconnect() ) } -} \ No newline at end of file +} diff --git a/clients/python/src/util.rs b/clients/python/src/util.rs index d0e78cfee..42f75b8c6 100644 --- a/clients/python/src/util.rs +++ b/clients/python/src/util.rs @@ -1,4 +1,4 @@ -use actor_core_client::{ +use rivetkit_client::{ client, CreateOptions, GetOptions, GetWithIdOptions }; use once_cell::sync::Lazy; @@ -259,4 +259,4 @@ impl TryFrom::> for GetWithIdOptions { params }) } -} \ No newline at end of file +} diff --git a/clients/python/tests/test_e2e_async.py b/clients/python/tests/test_e2e_async.py index 106440534..58f3ed95a 100644 --- a/clients/python/tests/test_e2e_async.py +++ b/clients/python/tests/test_e2e_async.py @@ -1,6 +1,6 @@ import asyncio import pytest -from actor_core_client import AsyncClient as ActorClient +from rivetkit_client import AsyncClient as ActorClient from common import start_mock_server, get_free_port, logger @pytest.mark.asyncio diff --git a/clients/python/tests/test_e2e_simple_async.py b/clients/python/tests/test_e2e_simple_async.py index 200f41c30..8dda89d1d 100644 --- a/clients/python/tests/test_e2e_simple_async.py +++ b/clients/python/tests/test_e2e_simple_async.py @@ -1,6 +1,6 @@ import asyncio import pytest -from actor_core_client import AsyncSimpleClient as ActorClient +from rivetkit_client import AsyncSimpleClient as ActorClient from common import start_mock_server, logger async def do_oneoff_increment(client): @@ -31,4 +31,4 @@ async def test_e2e_simple_async(): await handle.disconnect() - stop_mock_server() \ No newline at end of file + stop_mock_server() diff --git a/clients/python/tests/test_e2e_simple_sync.py b/clients/python/tests/test_e2e_simple_sync.py index 33f703944..b65c6089a 100644 --- a/clients/python/tests/test_e2e_simple_sync.py +++ b/clients/python/tests/test_e2e_simple_sync.py @@ -1,4 +1,4 @@ -from actor_core_client import SimpleClient as ActorClient +from rivetkit_client import SimpleClient as ActorClient from common import start_mock_server, logger diff --git a/clients/python/tests/test_e2e_sync.py b/clients/python/tests/test_e2e_sync.py index e9016ffa7..41d8be271 100644 --- a/clients/python/tests/test_e2e_sync.py +++ b/clients/python/tests/test_e2e_sync.py @@ -1,4 +1,4 @@ -from actor_core_client import Client as ActorClient +from rivetkit_client import Client as ActorClient from common import start_mock_server, logger def test_e2e_sync(): diff --git a/clients/rust/README.md b/clients/rust/README.md index cbfc409b9..bc15893fd 100644 --- a/clients/rust/README.md +++ b/clients/rust/README.md @@ -24,7 +24,7 @@ rivetkit-client = "0.1.0" ### Step 2: Connect to Actor ```rust -use actor_core_client::{Client, EncodingKind, GetOrCreateOptions, TransportKind}; +use rivetkit_client::{Client, EncodingKind, GetOrCreateOptions, TransportKind}; use serde_json::json; #[tokio::main] diff --git a/clients/rust/tests/e2e.rs b/clients/rust/tests/e2e.rs index b3cfe67a1..e5f25feb8 100644 --- a/clients/rust/tests/e2e.rs +++ b/clients/rust/tests/e2e.rs @@ -1,4 +1,4 @@ -use actor_core_client::{Client, EncodingKind, GetOrCreateOptions, TransportKind}; +use rivetkit_client::{Client, EncodingKind, GetOrCreateOptions, TransportKind}; use fs_extra; use portpicker; use serde_json::json; @@ -169,7 +169,7 @@ async fn e2e() { // Configure logging let subscriber = tracing_subscriber::fmt() .with_max_level(tracing::Level::DEBUG) - // .with_env_filter(EnvFilter::new("actor_core_client=trace,hyper=error")) + // .with_env_filter(EnvFilter::new("rivetkit_client=trace,hyper=error")) .finish(); let _guard = tracing::subscriber::set_default(subscriber); diff --git a/docs/clients/rust.mdx b/docs/clients/rust.mdx index e85bd663e..476101c86 100644 --- a/docs/clients/rust.mdx +++ b/docs/clients/rust.mdx @@ -9,7 +9,7 @@ import StepRunStudio from "/snippets/step-run-studio.mdx"; import StepDeploy from "/snippets/step-deploy.mdx"; import SetupNextSteps from "/snippets/setup-next-steps.mdx"; -The ActorCore Rust client provides a way to connect to and interact with actors from Rust applications. +The RivetKit Rust client provides a way to connect to and interact with actors from Rust applications. @@ -26,10 +26,10 @@ The ActorCore Rust client provides a way to connect to and interact with actors - Add ActorCore client & related dependencies to your project: + Add RivetKit client & related dependencies to your project: ```sh - cargo add actor-core-client + cargo add rivetkit-client cargo add serde_json cargo add tokio --features full ``` @@ -41,7 +41,7 @@ The ActorCore Rust client provides a way to connect to and interact with actors Modify `src/main.rs` to connect to your actor: ```rust src/main.rs - use actor_core_client::{Client, EncodingKind, GetOrCreateOptions, TransportKind}; + use rivetkit_client::{Client, EncodingKind, GetOrCreateOptions, TransportKind}; use serde_json::json; use std::time::Duration; diff --git a/docs/concepts/interacting-with-workers.mdx b/docs/concepts/interacting-with-workers.mdx index a833fd0e3..f1fbb7ffd 100644 --- a/docs/concepts/interacting-with-workers.mdx +++ b/docs/concepts/interacting-with-workers.mdx @@ -11,7 +11,7 @@ The first step is to create a client that will connect to your actor service: ```typescript TypeScript -import { createClient } from "actor-core/client"; +import { createClient } from "rivetkit/client"; import type { App } from "../src/index"; // Create a client with the connection address and app type @@ -19,7 +19,7 @@ const client = createClient(/* CONNECTION ADDRESS */); ``` ```rust Rust -use actor_core_client::{Client, EncodingKind, GetOrCreateOptions, TransportKind}; +use rivetkit_client::{Client, EncodingKind, GetOrCreateOptions, TransportKind}; // Create a client with connection address and configuration let client = Client::new( @@ -30,7 +30,7 @@ let client = Client::new( ``` ```python Python -from actor_core_client import AsyncClient as ActorClient +from rivetkit_client import AsyncClient as ActorClient # Create a client with the connection address client = ActorClient("http://localhost:6420") @@ -41,7 +41,7 @@ client = ActorClient("http://localhost:6420") ## Finding & Connecting to Actors -ActorCore provides several methods to connect to actors: +RivetKit provides several methods to connect to actors: ### `get(tags, opts)` - Find or Create @@ -60,7 +60,7 @@ await room.sendMessage("Alice", "Hello everyone!"); ``` ```rust Rust -use actor_core_client::GetOrCreateOptions; +use rivetkit_client::GetOrCreateOptions; use serde_json::json; // Connect to a chat room for the "general" channel @@ -115,8 +115,8 @@ await doc.initializeDocument("My New Document"); ``` ```rust Rust -use actor_core_client::CreateOptions; -use actor_core_client::client::CreateRequestMetadata; +use rivetkit_client::CreateOptions; +use rivetkit_client::client::CreateRequestMetadata; use serde_json::json; // Create a new document actor @@ -162,7 +162,7 @@ await doc.updateContent("Updated content"); ``` ```rust Rust -use actor_core_client::GetWithIdOptions; +use rivetkit_client::GetWithIdOptions; // Connect to a specific actor by its ID let my_actor_id = "55425f42-82f8-451f-82c1-6227c83c9372"; @@ -365,7 +365,7 @@ const chatRoom = await client.chatRoom.get({ channel: "super-secret" }, { ```rust Rust use serde_json::json; -use actor_core_client::GetOptions; +use rivetkit_client::GetOptions; let key = vec![ "super-secret-channel".to_string(), @@ -402,7 +402,7 @@ chat_room = await client.get( The actor can access these parameters in the `onBeforeConnect` or `createConnState` hook: ```typescript -import { actor } from "actor-core"; +import { actor } from "rivetkit"; const chatRoom = actor({ state: { messages: [] }, @@ -459,7 +459,7 @@ const client = createClient( ``` ```rust Rust -use actor_core_client::{Client, EncodingKind, GetOrCreateOptions, TransportKind}; +use rivetkit_client::{Client, EncodingKind, GetOrCreateOptions, TransportKind}; // Create client with specific options let client = Client::new( @@ -472,7 +472,7 @@ let client = Client::new( ``` ```python Python -from actor_core_client import AsyncClient as ActorClient +from rivetkit_client import AsyncClient as ActorClient # Example with all client options client = ActorClient( @@ -507,7 +507,7 @@ Default is `["websocket", "sse"]`, which automatically negotiates the best avail ## Error Handling -ActorCore provides specific error types to help you handle different failure scenarios: +RivetKit provides specific error types to help you handle different failure scenarios: ### Action Errors @@ -528,7 +528,7 @@ try { These errors can be thrown from within the actor with `UserError`: ```typescript -import { actor, UserError } from "actor-core"; +import { actor, UserError } from "rivetkit"; const documentActor = actor({ state: { content: "" }, @@ -549,7 +549,7 @@ const documentActor = actor({ }); ``` -ActorCore doesn't expose internal errors to clients for security, helping to prevent the exposure of sensitive information or internal implementation details. +RivetKit doesn't expose internal errors to clients for security, helping to prevent the exposure of sensitive information or internal implementation details. ### Other Errors diff --git a/examples/chat-room-python/scripts/cli.py b/examples/chat-room-python/scripts/cli.py index 1269e1256..73cb7e920 100644 --- a/examples/chat-room-python/scripts/cli.py +++ b/examples/chat-room-python/scripts/cli.py @@ -1,5 +1,5 @@ import asyncio -from actor_core_client import AsyncClient as ActorClient +from rivetkit_client import AsyncClient as ActorClient import prompt_toolkit from prompt_toolkit.patch_stdout import patch_stdout from typing import TypedDict, List @@ -49,4 +49,4 @@ def on_message(username: str, message: str): await chat_room.disconnect() if __name__ == "__main__": - asyncio.run(main()) \ No newline at end of file + asyncio.run(main()) diff --git a/examples/chat-room-python/scripts/connect.py b/examples/chat-room-python/scripts/connect.py index ba2482d65..b0a6fe38d 100644 --- a/examples/chat-room-python/scripts/connect.py +++ b/examples/chat-room-python/scripts/connect.py @@ -1,6 +1,6 @@ import asyncio import os -from actor_core_client import AsyncClient as ActorClient +from rivetkit_client import AsyncClient as ActorClient async def main(): # Create client @@ -27,4 +27,4 @@ def on_message(username: str, message: str): await chat_room.disconnect() if __name__ == "__main__": - asyncio.run(main()) \ No newline at end of file + asyncio.run(main()) diff --git a/examples/chat-room-python/tests/test_chat_room.py b/examples/chat-room-python/tests/test_chat_room.py index 9af59b295..5134c3dc6 100644 --- a/examples/chat-room-python/tests/test_chat_room.py +++ b/examples/chat-room-python/tests/test_chat_room.py @@ -1,6 +1,6 @@ import pytest -from actor_core_client import AsyncClient as ActorClient -from actor_core_test import setup_test +from rivetkit_client import AsyncClient as ActorClient +from rivetkit_test import setup_test from typing import TypedDict, List @@ -63,4 +63,4 @@ def on_message(username: str, message: str): assert final_history == expected_history # Cleanup - await chat_room.disconnect() \ No newline at end of file + await chat_room.disconnect() diff --git a/examples/snippets/ai-agent/App.tsx b/examples/snippets/ai-agent/App.tsx index ebb59628a..54f3dfbac 100644 --- a/examples/snippets/ai-agent/App.tsx +++ b/examples/snippets/ai-agent/App.tsx @@ -1,11 +1,11 @@ import { createClient } from "rivetkit/client"; -import { createReactActorCore } from "@rivetkit/react"; +import { createReactRivetKit } from "@rivetkit/react"; import { useState, useEffect } from "react"; import type { Registry } from "../workers/registry"; import type { Message } from "./actor"; const client = createClient("http://localhost:6420"); -const { useActor, useActorEvent } = createReactActorCore(client); +const { useActor, useActorEvent } = createReactRivetKit(client); export function AIAssistant() { const [{ actor }] = useActor("aiAgent", { tags: { conversationId: "default" } }); diff --git a/examples/snippets/chat-room/App.tsx b/examples/snippets/chat-room/App.tsx index 9bdd9ee56..c544dc3bf 100644 --- a/examples/snippets/chat-room/App.tsx +++ b/examples/snippets/chat-room/App.tsx @@ -1,11 +1,11 @@ import { createClient } from "rivetkit/client"; -import { createReactActorCore } from "@rivetkit/react"; +import { createReactRivetKit } from "@rivetkit/react"; import { useState, useEffect } from "react"; import type { Registry } from "../workers/registry"; import type { Message } from "./actor"; const client = createClient("http://localhost:6420"); -const { useActor, useActorEvent } = createReactActorCore(client); +const { useActor, useActorEvent } = createReactRivetKit(client); export function ChatRoom({ roomId = "general" }) { // Connect to specific chat room using tags diff --git a/examples/snippets/crdt/App.tsx b/examples/snippets/crdt/App.tsx index d42dfac1b..d34232ea2 100644 --- a/examples/snippets/crdt/App.tsx +++ b/examples/snippets/crdt/App.tsx @@ -1,12 +1,12 @@ import { createClient } from "rivetkit/client"; -import { createReactActorCore } from "@rivetkit/react"; +import { createReactRivetKit } from "@rivetkit/react"; import { useState, useEffect, useRef } from "react"; import * as Y from 'yjs'; import { applyUpdate, encodeStateAsUpdate } from 'yjs'; import type { Registry } from "../workers/registry"; const client = createClient("http://localhost:6420"); -const { useActor, useActorEvent } = createReactActorCore(client); +const { useActor, useActorEvent } = createReactRivetKit(client); export function YjsEditor({ documentId = "shared-doc" }) { // Connect to specific document using tags diff --git a/examples/snippets/database/App.tsx b/examples/snippets/database/App.tsx index a414b3c74..7e12ff5c8 100644 --- a/examples/snippets/database/App.tsx +++ b/examples/snippets/database/App.tsx @@ -1,9 +1,9 @@ import { createClient } from "rivetkit/client"; -import { createReactActorCore } from "@rivetkit/react"; +import { createReactRivetKit } from "@rivetkit/react"; import { useState, useEffect } from "react"; const client = createClient("http://localhost:6420"); -const { useActor, useActorEvent } = createReactActorCore(client); +const { useActor, useActorEvent } = createReactRivetKit(client); export function NotesApp({ userId }: { userId: string }) { const [notes, setNotes] = useState>([]); diff --git a/examples/snippets/document/App.tsx b/examples/snippets/document/App.tsx index 251757171..0d4d201d4 100644 --- a/examples/snippets/document/App.tsx +++ b/examples/snippets/document/App.tsx @@ -1,10 +1,10 @@ import { createClient } from "rivetkit/client"; -import { createReactActorCore } from "@rivetkit/react"; +import { createReactRivetKit } from "@rivetkit/react"; import { useState, useEffect } from "react"; import type { Registry } from "../workers/registry"; const client = createClient("http://localhost:6420"); -const { useActor, useActorEvent } = createReactActorCore(client); +const { useActor, useActorEvent } = createReactRivetKit(client); export function DocumentEditor() { // Connect to actor for this document ID from URL diff --git a/examples/snippets/game/App.tsx b/examples/snippets/game/App.tsx index f3b46fcac..8e7170615 100644 --- a/examples/snippets/game/App.tsx +++ b/examples/snippets/game/App.tsx @@ -1,10 +1,10 @@ import { createClient } from "rivetkit/client"; -import { createReactActorCore } from "@rivetkit/react"; +import { createReactRivetKit } from "@rivetkit/react"; import { useState, useEffect, useRef } from "react"; import type { Player } from "./actor"; const client = createClient("http://localhost:6420"); -const { useActor, useActorEvent } = createReactActorCore(client); +const { useActor, useActorEvent } = createReactRivetKit(client); export function MultiplayerGame() { const [{ actor, connectionId }] = useActor("gameRoom"); diff --git a/examples/snippets/rate/App.tsx b/examples/snippets/rate/App.tsx index e3ef7f5cd..844378bc6 100644 --- a/examples/snippets/rate/App.tsx +++ b/examples/snippets/rate/App.tsx @@ -1,10 +1,10 @@ import { createClient } from "rivetkit/client"; -import { createReactActorCore } from "@rivetkit/react"; +import { createReactRivetKit } from "@rivetkit/react"; import { useState } from "react"; import type { Registry } from "../workers/registry"; const client = createClient("http://localhost:6420"); -const { useActor } = createReactActorCore(client); +const { useActor } = createReactRivetKit(client); export function RateLimiter() { // Connect to API rate limiter for user-123 diff --git a/examples/snippets/stream/App.tsx b/examples/snippets/stream/App.tsx index e748d203b..0166dc044 100644 --- a/examples/snippets/stream/App.tsx +++ b/examples/snippets/stream/App.tsx @@ -1,11 +1,11 @@ import { createClient } from "rivetkit/client"; -import { createReactActorCore } from "@rivetkit/react"; +import { createReactRivetKit } from "@rivetkit/react"; import { useState, useEffect } from "react"; import type { Registry } from "../workers/registry"; import type { StreamState } from "./actor"; // Import shared types from actor const client = createClient("http://localhost:6420"); -const { useActor, useActorEvent } = createReactActorCore(client); +const { useActor, useActorEvent } = createReactRivetKit(client); export function StreamExample() { const [{ actor }] = useActor("streamProcessor"); diff --git a/examples/snippets/sync/App.tsx b/examples/snippets/sync/App.tsx index 560aae398..1e239ec29 100644 --- a/examples/snippets/sync/App.tsx +++ b/examples/snippets/sync/App.tsx @@ -1,10 +1,10 @@ import { createClient } from "rivetkit/client"; -import { createReactActorCore } from "@rivetkit/react"; +import { createReactRivetKit } from "@rivetkit/react"; import { useState, useEffect, useRef } from "react"; import type { Contact } from "./actor"; const client = createClient("http://localhost:6420"); -const { useActor, useActorEvent } = createReactActorCore(client); +const { useActor, useActorEvent } = createReactRivetKit(client); export function ContactsApp() { const { actor } = useActor("contacts"); diff --git a/examples/snippets/tenant/App.tsx b/examples/snippets/tenant/App.tsx index 441015e32..501e4c72a 100644 --- a/examples/snippets/tenant/App.tsx +++ b/examples/snippets/tenant/App.tsx @@ -1,11 +1,11 @@ import { createClient } from "rivetkit/client"; -import { createReactActorCore } from "@rivetkit/react"; +import { createReactRivetKit } from "@rivetkit/react"; import { useState, useEffect } from "react"; import type { Registry } from "../workers/registry"; // Create client and hooks const client = createClient("http://localhost:6420"); -const { useActor } = createReactActorCore(client); +const { useActor } = createReactRivetKit(client); export function OrgDashboard({ orgId }: { orgId: string }) { // State for data diff --git a/packages/frameworks/framework-base/lib/mod.ts b/packages/frameworks/framework-base/lib/mod.ts index c9fa35885..ea5bcf08f 100644 --- a/packages/frameworks/framework-base/lib/mod.ts +++ b/packages/frameworks/framework-base/lib/mod.ts @@ -1,13 +1,13 @@ import { Derived, Effect, Store, type Updater } from "@tanstack/store"; -import type { AnyWorkerDefinition, WorkerCoreApp } from "rivetkit"; +import type { AnyWorkerDefinition, Registry } from "rivetkit"; import type { Client, - ExtractWorkersFromApp, + ExtractWorkersFromRegistry, WorkerConn, WorkerHandle, } from "rivetkit/client"; -export type AnyWorkerRegistry = WorkerCoreApp; +export type AnyWorkerRegistry = Registry; interface WorkerStateReference { /** @@ -69,7 +69,7 @@ interface WorkerStateReference { interface InternalRivetKitStore< Registry extends AnyWorkerRegistry, - Workers extends ExtractWorkersFromApp, + Workers extends ExtractWorkersFromRegistry, > { workers: Record>; } @@ -79,7 +79,7 @@ interface InternalRivetKitStore< */ export interface WorkerOptions< Registry extends AnyWorkerRegistry, - WorkerName extends keyof ExtractWorkersFromApp, + WorkerName extends keyof ExtractWorkersFromRegistry, > { /** * Typesafe name of the worker. @@ -96,7 +96,7 @@ export interface WorkerOptions< /** * Parameters for the worker. */ - params?: Registry[ExtractWorkersFromApp]["params"]; + params?: Registry[ExtractWorkersFromRegistry]["params"]; /** * Whether the worker is enabled. * Defaults to true. @@ -110,7 +110,7 @@ export interface CreateRivetKitOptions { export function createRivetKit< Registry extends AnyWorkerRegistry, - Workers extends ExtractWorkersFromApp, + Workers extends ExtractWorkersFromRegistry, WorkerNames extends keyof Workers, >(client: Client, opts: CreateRivetKitOptions = {}) { type RivetKitStore = InternalRivetKitStore; diff --git a/packages/frameworks/react/README.md b/packages/frameworks/react/README.md index d8d82b1ae..3b4aeb30c 100644 --- a/packages/frameworks/react/README.md +++ b/packages/frameworks/react/README.md @@ -60,7 +60,7 @@ function Counter() { diff --git a/packages/frameworks/react/lib/mod.tsx b/packages/frameworks/react/lib/mod.tsx index 93b70a012..97be1da21 100644 --- a/packages/frameworks/react/lib/mod.tsx +++ b/packages/frameworks/react/lib/mod.tsx @@ -5,7 +5,7 @@ import { type WorkerOptions, createRivetKit as createVanillaRivetKit, } from "@rivetkit/framework-base"; -import type { Client, ExtractWorkersFromApp } from "rivetkit/client"; +import type { Client, ExtractWorkersFromRegistry } from "rivetkit/client"; import { useEffect } from "react"; export { createClient } from "rivetkit/client"; @@ -16,8 +16,8 @@ export function createRivetKit( ) { const { getOrCreateWorker } = createVanillaRivetKit< Registry, - ExtractWorkersFromApp, - keyof ExtractWorkersFromApp + ExtractWorkersFromRegistry, + keyof ExtractWorkersFromRegistry >(client, opts); /** @@ -27,7 +27,7 @@ export function createRivetKit( * @param opts - Options for the worker, including its name, key, and parameters. * @returns An object containing the worker's state and a method to listen for events. */ - function useWorker>( + function useWorker>( opts: WorkerOptions, ) { const { mount, setState, state } = getOrCreateWorker(opts); diff --git a/packages/frameworks/react/src/App.tsx b/packages/frameworks/react/src/App.tsx index c76fa901a..7b53985e6 100644 --- a/packages/frameworks/react/src/App.tsx +++ b/packages/frameworks/react/src/App.tsx @@ -1,96 +1,96 @@ -import { useState } from "react"; -import type { Registry } from "../../../../examples/chat-room/actors/app"; -import { createClient, createRivetKit } from "../lib/mod"; - -const client = createClient("http://localhost:6420", { - encoding: "json", -}); - -const { useWorker } = createRivetKit(client); - -function App() { - const [state, setState] = useState(0); - - return ( - <> - -

Rivet Kit + React

-
- - - - - - - - - - - - - -
- - ); -} - -function WorkerReceiver({ key, params }: { key: string; params: any } = {}) { - const worker = useWorker({ - name: "chatRoom", - key, - params, - }); - - const { connection, handle, ...rest } = worker || {}; - - worker.useEvent("newMessage", (...args) => { - console.log("Received message from worker:", ...args); - }); - - return ( -
-

Worker Component

-
{JSON.stringify(rest, null, 2)}
-
- ); -} - -function WorkerWriter({ key, params }: { key: string; params: any }) { - const worker = useWorker({ - name: "chatRoom", - key, - params, - }); - return ( -
-

Worker Writer Component

-
{ - e.preventDefault(); - const formData = new FormData(e.target as HTMLFormElement); - const message = formData.get("message") as string; - worker.connection?.sendMessage("username", message); - (e.target as HTMLFormElement).reset(); - }} - > - - -
-
- ); -} - -export default App; +// import { useState } from "react"; +// import type { Registry } from "../../../../examples/chat-room/workers/app"; +// import { createClient, createRivetKit } from "../lib/mod"; +// +// const client = createClient("http://localhost:6420", { +// encoding: "json", +// }); +// +// const { useWorker } = createRivetKit(client); +// +// function App() { +// const [state, setState] = useState(0); +// +// return ( +// <> +// +//

Rivet Kit + React

+//
+// +// +// +// +// +// +// +// +// +// +// +// +// +//
+// +// ); +// } +// +// function WorkerReceiver({ key, params }: { key: string; params: any } = {}) { +// const worker = useWorker({ +// name: "chatRoom", +// key, +// params, +// }); +// +// const { connection, handle, ...rest } = worker || {}; +// +// worker.useEvent("newMessage", (...args) => { +// console.log("Received message from worker:", ...args); +// }); +// +// return ( +//
+//

Worker Component

+//
{JSON.stringify(rest, null, 2)}
+//
+// ); +// } +// +// function WorkerWriter({ key, params }: { key: string; params: any }) { +// const worker = useWorker({ +// name: "chatRoom", +// key, +// params, +// }); +// return ( +//
+//

Worker Writer Component

+//
{ +// e.preventDefault(); +// const formData = new FormData(e.target as HTMLFormElement); +// const message = formData.get("message") as string; +// worker.connection?.sendMessage("username", message); +// (e.target as HTMLFormElement).reset(); +// }} +// > +// +// +//
+//
+// ); +// } +// +// export default App; diff --git a/packages/frameworks/react/src/main.tsx b/packages/frameworks/react/src/main.tsx index f371e13b0..f9cc37fcc 100644 --- a/packages/frameworks/react/src/main.tsx +++ b/packages/frameworks/react/src/main.tsx @@ -1,9 +1,9 @@ -import { StrictMode } from "react"; -import { createRoot } from "react-dom/client"; -import App from "./App"; - -createRoot(document.getElementById("root")!).render( - - - , -); +// import { StrictMode } from "react"; +// import { createRoot } from "react-dom/client"; +// import App from "./App"; +// +// createRoot(document.getElementById("root")!).render( +// +// +// , +// ); diff --git a/packages/frameworks/react/src/mod.tsx b/packages/frameworks/react/src/mod.tsx index f04ae2c6b..0001db620 100644 --- a/packages/frameworks/react/src/mod.tsx +++ b/packages/frameworks/react/src/mod.tsx @@ -15,7 +15,7 @@ // useSyncExternalStore, //} from "react"; // -//export function createReactActorCore(client: Client) { +//export function createReactRivetKit(client: Client) { // type Registry = ExtractAppFromClient; // type Registry = ExtractActorsFromRegistry; // return { diff --git a/packages/platforms/cloudflare-workers/src/handler.ts b/packages/platforms/cloudflare-workers/src/handler.ts index c6a6d5bc7..705276d6e 100644 --- a/packages/platforms/cloudflare-workers/src/handler.ts +++ b/packages/platforms/cloudflare-workers/src/handler.ts @@ -20,6 +20,7 @@ import { upgradeWebSocket } from "./websocket"; import invariant from "invariant"; import { AsyncLocalStorage } from "node:async_hooks"; import { InternalError } from "rivetkit/errors"; +import type { WebSocket } from "ws"; /** Cloudflare Workers env */ export interface Bindings { @@ -155,13 +156,14 @@ export function createRouter( webSocket.accept(); + // TODO: Is this still needed? // HACK: Cloudflare does not call onopen automatically, so we need // to call this on the next tick setTimeout(() => { - webSocket.onopen?.(new Event("open")); - }, 100); + (webSocket as any).onopen?.(new Event("open")); + }, 0); - return webSocket; + return webSocket as unknown as WebSocket; }, proxyRequest: async (c, workerRequest, workerId): Promise => { diff --git a/turbo.json b/turbo.json index ed780730f..38be5c39c 100644 --- a/turbo.json +++ b/turbo.json @@ -26,8 +26,7 @@ "dependsOn": ["^check-types", "check-types", "build"] }, "test": { - "dependsOn": ["^build", "check-types"], - "env": ["_RIVETKIT_ERROR_STACK"] + "dependsOn": ["^build", "check-types"] } } } diff --git a/vitest.base.ts b/vitest.base.ts index f69bd00ea..260f56afd 100644 --- a/vitest.base.ts +++ b/vitest.base.ts @@ -9,7 +9,7 @@ export default { env: { // Enable logging _LOG_LEVEL: "DEBUG", - _ACTOR_CORE_ERROR_STACK: "1" + _RIVETKIT_ERROR_STACK: "1" } }, } satisfies ViteUserConfig;