Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@

### Features

* **@actor-core/cli:** add cli ([#642](https://github.com/rivet-gg/actor-core/issues/642)) ([d919f1a](https://github.com/rivet-gg/actor-core/commit/d919f1aa11972f0513f6ad5851965b7f469624cd))
* **rivetkit/cli:** add cli ([#642](https://github.com/rivet-gg/actor-core/issues/642)) ([d919f1a](https://github.com/rivet-gg/actor-core/commit/d919f1aa11972f0513f6ad5851965b7f469624cd))
* add config validation ([#648](https://github.com/rivet-gg/actor-core/issues/648)) ([3323988](https://github.com/rivet-gg/actor-core/commit/3323988f6ab3d5d9ba99ba113f6b8e4a7f4c5ec7))
* add cors support ([#647](https://github.com/rivet-gg/actor-core/issues/647)) ([ef13939](https://github.com/rivet-gg/actor-core/commit/ef13939f57c333d19b1cafc29b003bce1ccb8cf9))
* add release candidate support to publish script ([#660](https://github.com/rivet-gg/actor-core/issues/660)) ([f6c6adc](https://github.com/rivet-gg/actor-core/commit/f6c6adc8dd8fe9ceb237ba55be7f5953fe8047ec))
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ $ ./scripts/e2e-publish.ts
- Modifies yarnrc to point to the local registry, publishes the package, and then restores the original yarnrc.

5. ```bash
$ yarn workspace @actor-core/cli run test
$ yarn workspace rivetkit/cli run test
```
- Runs the tests for the CLI, which includes running the CLI (inside Docker) with different arguments and checking the output.
4 changes: 2 additions & 2 deletions clients/python/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[project]
name = "actor-core-client"
name = "@rivetkit/actor-client"
version = "0.9.0-rc.1"
authors = [
{ name="Rivet Gaming, LLC", email="[email protected]" },
Expand Down Expand Up @@ -41,4 +41,4 @@ features = ["pyo3/extension-module"]
testpaths = ["tests"]
python_files = ["test_*.py"]
log_cli = true
log_level = "DEBUG"
log_level = "DEBUG"
18 changes: 9 additions & 9 deletions clients/python/tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def start_mock_server():
# Build actor-core
logger.info("Building actor-core")
subprocess.run(
["yarn", "build", "-F", "actor-core"],
["yarn", "build", "-F", "@rivetkit/actor"],
cwd=repo_root,
check=True
)
Expand All @@ -58,15 +58,15 @@ def start_mock_server():

# Pack packages
packages = [
("actor-core", repo_root / "packages/actor-core"),
("@rivetkit/actor", repo_root / "packages/actor-core"),
("nodejs", repo_root / "packages/platforms/nodejs"),
("memory", repo_root / "packages/drivers/memory"),
("file-system", repo_root / "packages/drivers/file-system")
]

logger.info("Packing packages (3 total)")
for name, path in packages:
output_path = vendor_dir / f"actor-core-{name}.tgz"
output_path = vendor_dir / f"@rivetkit/actor-{name}.tgz"
subprocess.run(
["yarn", "pack", "--out", str(output_path)],
cwd=path,
Expand All @@ -88,7 +88,7 @@ def start_mock_server():
port = get_free_port()
server_script = f"""
import {{ app }} from "./actors/app.ts";
import {{ serve }} from "@actor-core/nodejs";
import {{ serve }} from "@rivetkit/nodejs";

serve(app, {{ port: {port}, mode: "memory" }});
"""
Expand All @@ -98,15 +98,15 @@ def start_mock_server():
# Create package.json
logger.info("Creating package.json")
package_json = {
"name": "actor-core-python-test",
"name": "@rivetkit/actor-python-test",
"packageManager": "[email protected]",
"private": True,
"type": "module",
"dependencies": {
"actor-core": f"file:{vendor_dir}/actor-core-actor-core.tgz",
"@actor-core/nodejs": f"file:{vendor_dir}/actor-core-nodejs.tgz",
"@actor-core/memory": f"file:{vendor_dir}/actor-core-memory.tgz",
"@actor-core/file-system": f"file:{vendor_dir}/actor-core-file-system.tgz",
"@rivetkit/actor": f"file:{vendor_dir}/actor-core-actor-core.tgz",
"@rivetkit/nodejs": f"file:{vendor_dir}/actor-core-nodejs.tgz",
"@rivetkit/memory": f"file:{vendor_dir}/actor-core-memory.tgz",
"@rivetkit/file-system": f"file:{vendor_dir}/actor-core-file-system.tgz",
},
"devDependencies": {
"tsx": "^3.12.7"
Expand Down
2 changes: 1 addition & 1 deletion clients/rust/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "actor-core-client"
name = "@rivetkit/actor-client"
version = "0.9.0-rc.1"
description = "Rust client for ActorCore - the Stateful Serverless Framework for building AI agents, realtime apps, and game servers"
edition = "2021"
Expand Down
26 changes: 13 additions & 13 deletions clients/rust/tests/e2e.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ impl MockServer {

// Run `yarn build -F actor-core` in the root of this repo
let status = Command::new("yarn")
.args(["build", "-F", "actor-core"])
.args(["build", "-F", "@rivetkit/actor"])
.current_dir(&repo_root)
.status()
.expect("Failed to build actor-core");
Expand All @@ -46,15 +46,15 @@ impl MockServer {

// Define packages to pack
let packages = [
("actor-core", repo_root.join("packages/actor-core")),
("@rivetkit/actor", repo_root.join("packages/actor-core")),
("nodejs", repo_root.join("packages/platforms/nodejs")),
("memory", repo_root.join("packages/drivers/memory")),
("file-system", repo_root.join("packages/drivers/file-system")),
];

// Pack each package to the vendor directory
for (name, path) in packages.iter() {
let output_path = vendor_dir.join(format!("actor-core-{}.tgz", name));
let output_path = vendor_dir.join(format!("@rivetkit/actor-{}.tgz", name));
println!(
"Packing {} from {} to {}",
name,
Expand Down Expand Up @@ -86,7 +86,7 @@ impl MockServer {
// Write the server script
let server_script = r#"
import { app } from "./actors/app.ts";
import { serve } from "@actor-core/nodejs";
import { serve } from "@rivetkit/nodejs";

serve(app, { port: PORT, mode: "memory" });
"#
Expand All @@ -98,24 +98,24 @@ serve(app, { port: PORT, mode: "memory" });
let package_json_path = server_dir.join("package.json");
let package_json = format!(
r#"{{
"name": "actor-core-rust-test",
"name": "@rivetkit/actor-rust-test",
"packageManager": "[email protected]",
"private": true,
"type": "module",
"dependencies": {{
"actor-core": "file:{}",
"@actor-core/nodejs": "file:{}",
"@actor-core/memory": "file:{}",
"@actor-core/file-system": "file:{}"
"@rivetkit/actor": "file:{}",
"@rivetkit/nodejs": "file:{}",
"@rivetkit/memory": "file:{}",
"@rivetkit/file-system": "file:{}"
}},
"devDependencies": {{
"tsx": "^3.12.7"
}}
}}"#,
vendor_dir.join("actor-core-actor-core.tgz").display(),
vendor_dir.join("actor-core-nodejs.tgz").display(),
vendor_dir.join("actor-core-memory.tgz").display(),
vendor_dir.join("actor-core-file-system.tgz").display()
vendor_dir.join("@rivetkit/actor-actor-core.tgz").display(),
vendor_dir.join("@rivetkit/actor-nodejs.tgz").display(),
vendor_dir.join("@rivetkit/actor-memory.tgz").display(),
vendor_dir.join("@rivetkit/actor-file-system.tgz").display()
);

std::fs::write(&package_json_path, package_json).expect("Failed to write package.json");
Expand Down
20 changes: 10 additions & 10 deletions docs/concepts/actions.mdx → docs/actor/actions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ actor.
Actions are defined in the `actions` object when creating an actor:

```typescript
import { actor } from "actor-core";
import { actor } from "@rivetkit/actor";

const mathUtils = actor({
state: {},
Expand All @@ -37,7 +37,7 @@ Each action receives a context object (commonly named `c`) as its first paramete
You can define helper functions outside the actions object to keep your code organized. These functions cannot be called directly by clients:

```typescript
import { actor } from "actor-core";
import { actor } from "@rivetkit/actor";

// Private helper function - not callable by clients
const calculateFee = (amount) => {
Expand Down Expand Up @@ -69,7 +69,7 @@ Actions have a single return value. To stream realtime data in response to an ac
Calling actions from the client is simple:

```typescript
import { createClient } from "actor-core/client";
import { createClient } from "@rivetkit/actor/client";
import type { App } from "./src/index";

const client = createClient<App>("http://localhost:6420");
Expand All @@ -89,7 +89,7 @@ The actor client includes type safety out of the box. When you use `createClient
<CodeGroup>

```typescript src/index.ts
import { setup } from "actor-core";
import { setup } from "@rivetkit/actor";

// Create simple counter
const counter = actor({
Expand All @@ -111,7 +111,7 @@ export type App = typeof app;
```

```typescript client.ts
import { createClient } from "actor-core/client";
import { createClient } from "@rivetkit/actor/client";
import type { App } from "./src/index";

const client = createClient<App>("http://localhost:6420");
Expand Down Expand Up @@ -142,7 +142,7 @@ For example:
<CodeGroup>

```typescript actor.ts
import { actor, UserError } from "actor-core";
import { actor, UserError } from "@rivetkit/actor";

const user = actor({
state: { users: [] },
Expand Down Expand Up @@ -190,7 +190,7 @@ Data schemas are not validated by default. For production applications, use a li
For example, to validate action parameters:

```typescript
import { actor, UserError } from "actor-core";
import { actor, UserError } from "@rivetkit/actor";
import { z } from "zod";

// Define schema for action parameters
Expand Down Expand Up @@ -219,7 +219,7 @@ const counter = actor({
```

<Note>
Native runtime type validation is coming soon to ActorCore.
Native runtime type validation is coming soon to RivetKit.
</Note>

## Authentication
Expand All @@ -230,10 +230,10 @@ By default, clients can call all actions on an actor without restriction. Make s

When writing complex logic for actions, you may want to extract parts of your implementation into separate helper functions. When doing this, you'll need a way to properly type the context parameter.

ActorCore provides the `ActionContextOf` utility type for exactly this purpose:
RivetKit provides the `ActionContextOf` utility type for exactly this purpose:

```typescript
import { actor, ActionContextOf } from "actor-core";
import { actor, ActionContextOf } from "@rivetkit/actor";

const counter = actor({
state: { count: 0 },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Throwing an error in `onBeforeConnect` or `createConnState` will abort the conne
Here's a basic example:

```typescript
import { actor } from "actor-core";
import { actor } from "@rivetkit/actor";

const exampleActor = actor({
state: {
Expand Down Expand Up @@ -46,7 +46,7 @@ const exampleActor = actor({
After authentication, you can access the connection state in any action through the context object:

```typescript
import { actor } from "actor-core";
import { actor } from "@rivetkit/actor";

const authenticatedActor = actor({
state: {
Expand Down Expand Up @@ -80,7 +80,7 @@ const authenticatedActor = actor({
### With API Server Authentication

```typescript
import { actor } from "actor-core";
import { actor } from "@rivetkit/actor";

const apiAuthenticatedActor = actor({
state: {
Expand Down Expand Up @@ -118,7 +118,7 @@ When authentication fails, throwing an error in `createConnState` will prevent t
### With JWT Authentication

```typescript
import { actor } from "actor-core";
import { actor } from "@rivetkit/actor";
import jwt from "jsonwebtoken";

const JWT_SECRET = process.env.JWT_SECRET;
Expand Down
12 changes: 6 additions & 6 deletions docs/concepts/connections.mdx → docs/actor/connections.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ For example:
<CodeGroup>

```typescript actor.ts
import { actor } from "actor-core";
import { actor } from "@rivetkit/actor";

const gameRoom = actor({
state: {},
Expand All @@ -39,7 +39,7 @@ const gameRoom = actor({
```

```typescript client.ts
import { createClient } from "actor-core/client";
import { createClient } from "@rivetkit/actor/client";
import type { App } from "./src/index";

const client = createClient<App>("http://localhost:6420");
Expand All @@ -57,7 +57,7 @@ There are two ways to define an actor's connection state:
### Method 1: `ConnState` constant

```typescript
import { actor } from "actor-core";
import { actor } from "@rivetkit/actor";

const chatRoom = actor({
state: { messages: [] },
Expand All @@ -84,7 +84,7 @@ const chatRoom = actor({
The data returned from `createConnState` is used as the initial state of the connection. The connection state can be accessed through `conn.state`.

```typescript
import { actor } from "actor-core";
import { actor } from "@rivetkit/actor";

const chatRoom = actor({
state: { messages: [] },
Expand Down Expand Up @@ -131,7 +131,7 @@ This is frequently used with `conn.send(name, event)` to send messages directly
For example:

```typescript
import { actor } from "actor-core";
import { actor } from "@rivetkit/actor";

const chatRoom = actor({
state: { users: {} },
Expand All @@ -158,7 +158,7 @@ const chatRoom = actor({
Connections can be disconnected from within an action:

```typescript
import { actor } from "actor-core";
import { actor } from "@rivetkit/actor";

const secureRoom = actor({
state: {},
Expand Down
Loading
Loading