Skip to content

Commit 00d66b1

Browse files
Merge remote-tracking branch 'origin/main' into 03-24-live-cursors-2
2 parents 8caa1c3 + c9f072b commit 00d66b1

Some content is hidden

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

52 files changed

+1445
-1916
lines changed

.github/workflows/test.yml

+84-59
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,85 @@
11
# TODO: Cache both yarn & cargo
2-
#
3-
# name: 'Test'
4-
# on:
5-
# pull_request:
6-
# workflow_dispatch:
7-
#
8-
# jobs:
9-
# test:
10-
# runs-on: ubuntu-latest
11-
#
12-
# steps:
13-
# - uses: actions/checkout@v4
14-
# - uses: actions/setup-node@v4
15-
# with:
16-
# node-version: '22.14'
17-
# - run: corepack enable
18-
# - name: Install dependencies
19-
# run: yarn install --frozen-lockfile
20-
# - name: Run actor-core tests
21-
# run: yarn test
22-
# - name: Install Rust
23-
# uses: dtolnay/rust-toolchain@stable
24-
# - name: Run Rust client tests
25-
# run: cd rust/client && cargo test
26-
#
27-
# # TODO: This is broken
28-
# # test-cli:
29-
# # runs-on: ubuntu-latest
30-
# #
31-
# # services:
32-
# # verdaccio:
33-
# # image: verdaccio/verdaccio:6
34-
# # ports:
35-
# # - 4873:4873
36-
# # options: --name verdaccio
37-
# #
38-
# # steps:
39-
# # - uses: actions/checkout@v4
40-
# # - run: corepack enable
41-
# # # https://github.com/orgs/community/discussions/42127
42-
# # - run: /usr/bin/docker cp ${{ github.workspace }}/.verdaccio/conf/config.yaml verdaccio:/verdaccio/conf/config.yaml
43-
# # - run: /usr/bin/docker restart verdaccio
44-
# #
45-
# # - uses: actions/cache@v4
46-
# # with:
47-
# # path: .turbo
48-
# # key: ${{ runner.os }}-turbo-${{ github.sha }}
49-
# # restore-keys: |
50-
# # ${{ runner.os }}-turbo-
51-
# # - uses: actions/setup-node@v4
52-
# # with:
53-
# # node-version: '22.14'
54-
# # cache: 'yarn'
55-
# # - run: yarn install
56-
# # - run: yarn build
57-
# # - run: npm i -g tsx
58-
# # - run: ./scripts/e2e-publish.ts
59-
# # - run: yarn workspace @actor-core/cli run test
60-
# #
2+
3+
name: 'Test'
4+
on:
5+
pull_request:
6+
workflow_dispatch:
7+
8+
jobs:
9+
test:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
# Setup Node.js
16+
- name: Set up Node.js
17+
uses: actions/setup-node@v4
18+
with:
19+
node-version: '22.14'
20+
# Note: We're not using the built-in cache here because we need to use corepack
21+
22+
- name: Setup Corepack
23+
run: corepack enable
24+
25+
- id: yarn-cache-dir-path
26+
name: Get yarn cache directory path
27+
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
28+
29+
- name: Cache dependencies
30+
uses: actions/cache@v3
31+
id: cache
32+
with:
33+
path: |
34+
${{ steps.yarn-cache-dir-path.outputs.dir }}
35+
.turbo
36+
key: ${{ runner.os }}-deps-${{ hashFiles('**/yarn.lock') }}-${{ github.sha }}
37+
restore-keys: |
38+
${{ runner.os }}-deps-${{ hashFiles('**/yarn.lock') }}-
39+
${{ runner.os }}-deps-
40+
41+
- name: Install dependencies
42+
run: yarn install
43+
44+
- name: Run actor-core tests
45+
run: yarn test
46+
47+
# - name: Install Rust
48+
# uses: dtolnay/rust-toolchain@stable
49+
# - name: Run Rust client tests
50+
# run: cd rust/client && cargo test
51+
52+
# TODO: This is broken
53+
# test-cli:
54+
# runs-on: ubuntu-latest
55+
#
56+
# services:
57+
# verdaccio:
58+
# image: verdaccio/verdaccio:6
59+
# ports:
60+
# - 4873:4873
61+
# options: --name verdaccio
62+
#
63+
# steps:
64+
# - uses: actions/checkout@v4
65+
# - run: corepack enable
66+
# # https://github.com/orgs/community/discussions/42127
67+
# - run: /usr/bin/docker cp ${{ github.workspace }}/.verdaccio/conf/config.yaml verdaccio:/verdaccio/conf/config.yaml
68+
# - run: /usr/bin/docker restart verdaccio
69+
#
70+
# - uses: actions/cache@v4
71+
# with:
72+
# path: .turbo
73+
# key: ${{ runner.os }}-turbo-${{ github.sha }}
74+
# restore-keys: |
75+
# ${{ runner.os }}-turbo-
76+
# - uses: actions/setup-node@v4
77+
# with:
78+
# node-version: '22.14'
79+
# cache: 'yarn'
80+
# - run: yarn install
81+
# - run: yarn build
82+
# - run: npm i -g tsx
83+
# - run: ./scripts/e2e-publish.ts
84+
# - run: yarn workspace @actor-core/cli run test
85+
#

.release-please-manifest.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "0.7.3"
2+
".": "0.7.6"
33
}

CHANGELOG.md

+88
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,93 @@
11
# Changelog
22

3+
## [0.7.6](https://github.com/rivet-gg/actor-core/compare/v0.7.5...v0.7.6) (2025-03-26)
4+
5+
6+
### Features
7+
8+
* add `actor-core/test` ([#790](https://github.com/rivet-gg/actor-core/issues/790)) ([bf5e675](https://github.com/rivet-gg/actor-core/commit/bf5e6754982a286fd41bdbb7c86d45d0d55df47f))
9+
10+
11+
### Bug Fixes
12+
13+
* fix combining `CreateState` and `CreateVars` causing `V` to be `unknown` ([#794](https://github.com/rivet-gg/actor-core/issues/794)) ([61bc9ad](https://github.com/rivet-gg/actor-core/commit/61bc9ad07e1acdf950adf57346115169a2075209))
14+
15+
16+
### Documentation
17+
18+
* 0.7.5 changelog ([12db6e4](https://github.com/rivet-gg/actor-core/commit/12db6e4204d64dfa933cbfd0714655ef0c74cdaa))
19+
* document createVars & driver-specific values ([#787](https://github.com/rivet-gg/actor-core/issues/787)) ([14c2829](https://github.com/rivet-gg/actor-core/commit/14c282916ec96022c96d2da9eef83340f3d67360))
20+
* fix localhost link ([991fc99](https://github.com/rivet-gg/actor-core/commit/991fc99d584d6fa12d175d5017f4a094de9e9eb0))
21+
22+
23+
### Continuous Integration
24+
25+
* add turborepo cache ([#792](https://github.com/rivet-gg/actor-core/issues/792)) ([169260a](https://github.com/rivet-gg/actor-core/commit/169260a92ff471dad8927d9c3d782869acdbb35d))
26+
* add yarn cache ([#791](https://github.com/rivet-gg/actor-core/issues/791)) ([d65d1fa](https://github.com/rivet-gg/actor-core/commit/d65d1fa49171508bfbc19b7dead785bc6e982419))
27+
28+
29+
### Chores
30+
31+
* release 0.7.6 ([d996b39](https://github.com/rivet-gg/actor-core/commit/d996b39f1152b70a994c524bb8bc17c878de57c3))
32+
* release version 0.7.6 ([3c2c0d1](https://github.com/rivet-gg/actor-core/commit/3c2c0d1a9a30b206ca48e179b26a943db0a5fa3a))
33+
34+
## [0.7.5](https://github.com/rivet-gg/actor-core/compare/v0.7.3...v0.7.5) (2025-03-25)
35+
36+
37+
### Features
38+
39+
* add ability to access driver context ([#781](https://github.com/rivet-gg/actor-core/issues/781)) ([c86720a](https://github.com/rivet-gg/actor-core/commit/c86720a952173bb53c3fb9cf21c57a978ccacbb0))
40+
* bring actor client up to spec ([#752](https://github.com/rivet-gg/actor-core/issues/752)) ([d2a5d7e](https://github.com/rivet-gg/actor-core/commit/d2a5d7e16d11ac2e5a47d0a92eafc28b71001d03))
41+
* dynamic driver format ([#672](https://github.com/rivet-gg/actor-core/issues/672)) ([09e6fe1](https://github.com/rivet-gg/actor-core/commit/09e6fe145a221518981a0ab68b5a7f5cd49bca98))
42+
* react integration ([#674](https://github.com/rivet-gg/actor-core/issues/674)) ([de66bf9](https://github.com/rivet-gg/actor-core/commit/de66bf9ad909487210b4dc2c80edf1ab13f1e015))
43+
* **rivet:** add "framework" tag ([#754](https://github.com/rivet-gg/actor-core/issues/754)) ([412d4cc](https://github.com/rivet-gg/actor-core/commit/412d4cccf7d30d910b7a1345067fbaf5b89d10bc))
44+
* **rust:** setup rs actor handle basics ([#639](https://github.com/rivet-gg/actor-core/issues/639)) ([79f9429](https://github.com/rivet-gg/actor-core/commit/79f94290266fcbb0e6ec36c5428ee290cefe63b5))
45+
46+
47+
### Bug Fixes
48+
49+
* **cli:** add `tsx` package to CLI examples ([#772](https://github.com/rivet-gg/actor-core/issues/772)) ([ffd46df](https://github.com/rivet-gg/actor-core/commit/ffd46dfb62f008e4da986dabda47062fbaa73fa8))
50+
* **cli:** bump minimal rivet version ([#777](https://github.com/rivet-gg/actor-core/issues/777)) ([7a4ca74](https://github.com/rivet-gg/actor-core/commit/7a4ca7417813070ee654da1ff140cf83b4ba31ff))
51+
* **cli:** fix pnpm create command ([#778](https://github.com/rivet-gg/actor-core/issues/778)) ([ea21e77](https://github.com/rivet-gg/actor-core/commit/ea21e77561a0bd8378667c8ae46c02d24d0e2dfb))
52+
* **cli:** fix yarn create ([#776](https://github.com/rivet-gg/actor-core/issues/776)) ([f826681](https://github.com/rivet-gg/actor-core/commit/f826681455fce77f7b2ab8626000e1e818deee6a))
53+
54+
55+
### Documentation
56+
57+
* add changelog ([#763](https://github.com/rivet-gg/actor-core/issues/763)) ([df647b1](https://github.com/rivet-gg/actor-core/commit/df647b1f1b2d82e40bcc204048cf6901b8e039b6))
58+
* change Cloudflare Workers -> Cloudflare Durable Objects ([#766](https://github.com/rivet-gg/actor-core/issues/766)) ([78b244d](https://github.com/rivet-gg/actor-core/commit/78b244d8751ec4db4f747db1652974f4db122c61))
59+
* clean up changelog formatting ([#764](https://github.com/rivet-gg/actor-core/issues/764)) ([22fc429](https://github.com/rivet-gg/actor-core/commit/22fc429ddc58e91655a3a4dc73ffc60338132911))
60+
* rename Cloudflare Durable Objects -> Durable Objects ([#770](https://github.com/rivet-gg/actor-core/issues/770)) ([a9a5cfa](https://github.com/rivet-gg/actor-core/commit/a9a5cfa5b91aff73889bbbee965d52221f89c2c7))
61+
* rename platform page Cloudflare Workers -> Cloudflare Durable Objects ([#768](https://github.com/rivet-gg/actor-core/issues/768)) ([1a7b629](https://github.com/rivet-gg/actor-core/commit/1a7b629e7d782443eacfa39fe6f3a055ae306704))
62+
63+
64+
### Code Refactoring
65+
66+
* **cli:** remove actor-core.config file ([#775](https://github.com/rivet-gg/actor-core/issues/775)) ([8c1bb2f](https://github.com/rivet-gg/actor-core/commit/8c1bb2fa543fd0722ed1a559b29fccf3c4570c95))
67+
* **react:** update types ([#751](https://github.com/rivet-gg/actor-core/issues/751)) ([822818d](https://github.com/rivet-gg/actor-core/commit/822818dbd673015b976f99c53ec6a3ef62935fc2))
68+
69+
70+
### Continuous Integration
71+
72+
* add rust test ([#758](https://github.com/rivet-gg/actor-core/issues/758)) ([f3f73fd](https://github.com/rivet-gg/actor-core/commit/f3f73fdb50429429591eb430bdda2558e743ce2a))
73+
74+
75+
### Chores
76+
77+
* add actor-core test ([#755](https://github.com/rivet-gg/actor-core/issues/755)) ([362d713](https://github.com/rivet-gg/actor-core/commit/362d7137b35d9436342d8e445e1c6af8e28a8749))
78+
* add docs on rust client ([#757](https://github.com/rivet-gg/actor-core/issues/757)) ([2ffeb95](https://github.com/rivet-gg/actor-core/commit/2ffeb952cf89282175c999e081c2dd9e0e5c7bf3))
79+
* add e2e test for rust client ([#756](https://github.com/rivet-gg/actor-core/issues/756)) ([4057e1b](https://github.com/rivet-gg/actor-core/commit/4057e1b0f1bd05b9b361068fbf7b35f3698b0cb9))
80+
* add tracing logs ([#753](https://github.com/rivet-gg/actor-core/issues/753)) ([ec2febd](https://github.com/rivet-gg/actor-core/commit/ec2febd2cceecd5067539c45deb5c2b312179414))
81+
* disable cursor example ([#785](https://github.com/rivet-gg/actor-core/issues/785)) ([8cf2a70](https://github.com/rivet-gg/actor-core/commit/8cf2a70665427ecb4c6ca27f2267e57c2fc60631))
82+
* move rust/client/ -> clients/rust/ ([#759](https://github.com/rivet-gg/actor-core/issues/759)) ([5eabc17](https://github.com/rivet-gg/actor-core/commit/5eabc179bbf32b97487d58c32a70bc4640fa1215))
83+
* release 0.7.4 ([5186163](https://github.com/rivet-gg/actor-core/commit/518616399219935ad5fb6a9c8ea7aebf92e63b7b))
84+
* release 0.7.4 ([5c9cba8](https://github.com/rivet-gg/actor-core/commit/5c9cba8da288bf8beab02316319dc32913521bd0))
85+
* release 0.7.4 ([1168fbb](https://github.com/rivet-gg/actor-core/commit/1168fbb4dfd19d10cd891f89c110eb5f9eb6b348))
86+
* release 0.7.5 ([8e39e76](https://github.com/rivet-gg/actor-core/commit/8e39e766e3f5c733c82e319e79f321891ce66350))
87+
* release version 0.7.4 ([014b4ca](https://github.com/rivet-gg/actor-core/commit/014b4caf1af3d49cea17dc7634aa79dfeb998d61))
88+
* release version 0.7.5 ([08dfe6f](https://github.com/rivet-gg/actor-core/commit/08dfe6f33a133e49a4356f2fe59b8a8857d54a5e))
89+
* update publish script ([#760](https://github.com/rivet-gg/actor-core/issues/760)) ([6c5165e](https://github.com/rivet-gg/actor-core/commit/6c5165e40d0d47e0b347de2d8c5b4e0ff57c627a))
90+
391
## [0.7.3](https://github.com/rivet-gg/actor-core/compare/v0.7.2...v0.7.3) (2025-03-18)
492

593

clients/rust/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "actor-core-client"
3-
version = "0.7.4"
3+
version = "0.7.6"
44
description = "Rust client for ActorCore - the Stateful Serverless Framework for building AI agents, realtime apps, and game servers"
55
edition = "2021"
66
authors = ["Rivet Gaming, LLC <[email protected]>"]

cursor

-1
This file was deleted.

docs/changelog/overview.mdx

+27
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,33 @@ mode: "center"
99
Releases](https://github.com/rivet-gg/actor-core/releases) page.
1010
</Info>
1111

12+
<Update description="0.7.6" label="March 26th, 2025">
13+
## Features
14+
15+
- [**Testing with Vitest**](/concepts/testing): Write unit tests for your actors with [Vitest](https://vitest.dev/)
16+
17+
## Fixes
18+
19+
- Using `vars` and `state` in the same actor sometimes causes `unknown` types
20+
</Update>
21+
22+
<Update description="0.7.5" label="March 25th, 2025">
23+
## Features
24+
25+
- [**Driver Context**](https://actorcore.org/drivers/overview#accessing-driver-context): You can now access driver-specific context, for example:
26+
- [Rivet](/platforms/rivet#accessing-rivet-context)
27+
- [Durable Objects](/platforms/cloudflare-workers#accessing-cloudflare-context-and-bindings)
28+
29+
## Documentation
30+
31+
- [Lifecycle `createVars` and `vars`](/concepts/lifecycle#createvars-and-vars)
32+
- Fix Hono example code
33+
34+
## Fixes
35+
36+
- Add `tsx` to examples
37+
</Update>
38+
1239
<Update description="0.7.4" label="March 21st, 2025">
1340
## Features
1441

docs/concepts/lifecycle.mdx

+45
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,51 @@ Actor lifecycle hooks are defined as functions in the actor configuration.
1313

1414
The `createState` function or `state` constant defines the initial state of the actor (see [state documentation](/concepts/state)). The `createState` function is called only once when the actor is first created.
1515

16+
### `createVars` and `vars`
17+
18+
The `createVars` function or `vars` constant defines ephemeral variables for the actor (see [state documentation](/concepts/state)). These variables are not persisted and are useful for storing runtime-only objects or temporary data.
19+
20+
The `createVars` function can also receive driver-specific context as its second parameter, allowing access to driver capabilities like Rivet KV or Cloudflare Durable Object storage.
21+
22+
```typescript
23+
import { actor } from "actor-core";
24+
25+
// Using vars constant
26+
const counter1 = actor({
27+
state: { count: 0 },
28+
vars: { lastAccessTime: 0 },
29+
actions: { /* ... */ }
30+
});
31+
32+
// Using createVars function
33+
const counter2 = actor({
34+
state: { count: 0 },
35+
createVars: () => {
36+
// Initialize with non-serializable objects
37+
return {
38+
lastAccessTime: Date.now(),
39+
emitter: createNanoEvents()
40+
};
41+
},
42+
actions: { /* ... */ }
43+
});
44+
45+
// Access driver-specific context
46+
const exampleActor = actor({
47+
state: { count: 0 },
48+
// Access driver context in createVars
49+
createVars: (c, rivet) => ({
50+
ctx: rivet.ctx,
51+
}),
52+
actions: {
53+
doSomething: (c) => {
54+
// Use driver-specific context
55+
console.log(`Region: ${c.vars.rivet.metadata.region.name}`);
56+
}
57+
}
58+
});
59+
```
60+
1661
### `onCreate`
1762

1863
The `onCreate` hook is called at the same time as `createState`, but unlike `createState`, it doesn't return any value. Use this hook for initialization logic that doesn't affect the initial state.

0 commit comments

Comments
 (0)