durable-actors 0.7.15 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/README.md +5 -5
  2. package/bin/durable-actors.js +2 -0
  3. package/dist/actor/actor.d.ts +2 -2
  4. package/dist/actor/actor.d.ts.map +1 -1
  5. package/dist/actor/actor.js +5 -3
  6. package/dist/actor/actor.js.map +1 -1
  7. package/dist/actor/database.d.ts +3 -2
  8. package/dist/actor/database.d.ts.map +1 -1
  9. package/dist/actor/database.js +21 -3
  10. package/dist/actor/database.js.map +1 -1
  11. package/dist/cli/dev.d.ts.map +1 -1
  12. package/dist/cli/dev.js +13 -42
  13. package/dist/cli/dev.js.map +1 -1
  14. package/dist/cli/python.d.ts.map +1 -1
  15. package/dist/cli/python.js +0 -1
  16. package/dist/cli/python.js.map +1 -1
  17. package/dist/cli.d.ts +1 -1
  18. package/dist/cli.js +9 -18
  19. package/dist/cli.js.map +1 -1
  20. package/dist/client-runtime/proxy.d.ts +1 -3
  21. package/dist/client-runtime/proxy.d.ts.map +1 -1
  22. package/dist/client-runtime/proxy.js +3 -10
  23. package/dist/client-runtime/proxy.js.map +1 -1
  24. package/dist/compiler/declarations.js +2648 -183
  25. package/dist/compiler/declarations.js.map +7 -1
  26. package/dist/compiler/generators/client-artifacts.d.ts.map +1 -1
  27. package/dist/compiler/generators/client-artifacts.js +0 -1
  28. package/dist/compiler/generators/client-artifacts.js.map +1 -1
  29. package/dist/generated/client-runtime.d.ts.map +1 -1
  30. package/dist/generated/client-runtime.js +1 -1
  31. package/dist/generated/client-runtime.js.map +1 -1
  32. package/dist/host/actor-runtime.d.ts.map +1 -1
  33. package/dist/host/actor-runtime.js +2 -3
  34. package/dist/host/actor-runtime.js.map +1 -1
  35. package/dist/host/sqlite.d.ts.map +1 -1
  36. package/dist/host/sqlite.js +2 -0
  37. package/dist/host/sqlite.js.map +1 -1
  38. package/dist/projectSdk.js +1 -1
  39. package/dist/projectSdk.js.map +1 -1
  40. package/dist/templates/actor/README.md +7 -9
  41. package/dist/templates/actor/bunfig +2 -0
  42. package/dist/templates/actor/package.json +6 -3
  43. package/dist/templates/ai-chat/README.md +8 -8
  44. package/dist/templates/ai-chat/bunfig +2 -0
  45. package/dist/templates/ai-chat/package.json +7 -5
  46. package/dist/templates/chat/README.md +8 -8
  47. package/dist/templates/chat/bunfig +2 -0
  48. package/dist/templates/chat/package.json +7 -5
  49. package/dist/templates/documents/README.md +8 -8
  50. package/dist/templates/documents/bunfig +2 -0
  51. package/dist/templates/documents/package.json +7 -5
  52. package/package.json +110 -108
  53. package/dist/cli/actor-source-watcher.d.ts +0 -25
  54. package/dist/cli/actor-source-watcher.d.ts.map +0 -1
  55. package/dist/cli/actor-source-watcher.js +0 -129
  56. package/dist/cli/actor-source-watcher.js.map +0 -1
  57. package/dist/templates/actor/pnpm-workspace.yaml +0 -2
  58. package/dist/templates/ai-chat/pnpm-workspace.yaml +0 -2
  59. package/dist/templates/chat/pnpm-workspace.yaml +0 -2
  60. package/dist/templates/documents/pnpm-workspace.yaml +0 -2
  61. package/dist/templates/python/README.md +0 -7
  62. package/dist/templates/python/gitignore +0 -6
  63. package/dist/templates/python/package.json +0 -11
  64. package/dist/templates/python/pnpm-workspace.yaml +0 -2
  65. package/dist/templates/python/pyproject.toml +0 -8
  66. package/dist/templates/python/src/actors.py +0 -9
@@ -3,10 +3,10 @@
3
3
  "private": true,
4
4
  "type": "module",
5
5
  "engines": {
6
- "node": ">=22.19.0"
6
+ "bun": ">=1.4.2"
7
7
  },
8
8
  "scripts": {
9
- "dev": "tsx --env-file=.env src/backend.ts",
9
+ "dev": "bun src/backend.ts",
10
10
  "dev:actors": "durable-actors dev",
11
11
  "build": "tsc --noEmit && vite build"
12
12
  },
@@ -15,7 +15,7 @@
15
15
  "@ai-sdk/react": "^4.0.100",
16
16
  "ai": "^7.0.97",
17
17
  "express": "^5.2.1",
18
- "durable-actors": "0.7.15",
18
+ "durable-actors": "0.8.0",
19
19
  "react": "^19.3.0",
20
20
  "react-dom": "^19.3.0"
21
21
  },
@@ -24,8 +24,10 @@
24
24
  "@types/node": "^22.0.0",
25
25
  "@types/react": "^19.0.0",
26
26
  "@types/react-dom": "^19.0.0",
27
- "tsx": "^4.0.0",
28
27
  "typescript": "~5.9.3",
29
28
  "vite": "^8.3.0"
30
- }
29
+ },
30
+ "trustedDependencies": [
31
+ "esbuild"
32
+ ]
31
33
  }
@@ -6,22 +6,22 @@ An Express + React chatroom with shared messages and persistent history.
6
6
 
7
7
  ## Run locally
8
8
 
9
- Requires Node.js 22.19+ and Bun 1.3.9+.
9
+ Requires Bun 1.4.2+.
10
10
 
11
11
  ```sh
12
- npx durable-actors init chat-example --template chat
12
+ bunx durable-actors init chat-example --template chat
13
13
  cd chat-example
14
- npm install
14
+ bun install
15
15
  cp .env.example .env
16
- npm run dev:actors
16
+ bun run dev:actors
17
17
  ```
18
18
 
19
- Already in the example directory? Start at `npm install`.
19
+ Already in the example directory? Start at `bun install`.
20
20
 
21
21
  Wait for `Ready`. In another terminal in the same directory:
22
22
 
23
23
  ```sh
24
- npm run dev
24
+ bun run dev
25
25
  ```
26
26
 
27
27
  Open [localhost:3000](http://127.0.0.1:3000) in two tabs; messages stay saved after an actor server restart.
@@ -69,8 +69,8 @@ The demo joins as a guest; add authentication and room access checks before issu
69
69
 
70
70
  ## Development
71
71
 
72
- Actors reload automatically; restart `npm run dev` after changing public actor types. See [port settings](../README.md#run-the-examples-together) to run multiple examples.
72
+ Actors reload automatically; restart `bun run dev` after changing public actor types. See [port settings](../README.md#run-the-examples-together) to run multiple examples.
73
73
 
74
74
  ```sh
75
- npm run build
75
+ bun run build
76
76
  ```
@@ -0,0 +1,2 @@
1
+ [run]
2
+ bun = true
@@ -3,16 +3,16 @@
3
3
  "private": true,
4
4
  "type": "module",
5
5
  "engines": {
6
- "node": ">=22.19.0"
6
+ "bun": ">=1.4.2"
7
7
  },
8
8
  "scripts": {
9
- "dev": "durable-actors generate && tsx --env-file=.env src/backend.ts",
9
+ "dev": "durable-actors generate && bun src/backend.ts",
10
10
  "dev:actors": "durable-actors dev",
11
11
  "build": "durable-actors generate src/actors.ts && tsc --noEmit && vite build"
12
12
  },
13
13
  "dependencies": {
14
14
  "express": "^5.2.1",
15
- "durable-actors": "0.7.15",
15
+ "durable-actors": "0.8.0",
16
16
  "react": "^19.3.0",
17
17
  "react-dom": "^19.3.0"
18
18
  },
@@ -21,8 +21,10 @@
21
21
  "@types/node": "^22.0.0",
22
22
  "@types/react": "^19.0.0",
23
23
  "@types/react-dom": "^19.0.0",
24
- "tsx": "^4.0.0",
25
24
  "typescript": "~5.9.3",
26
25
  "vite": "^8.3.0"
27
- }
26
+ },
27
+ "trustedDependencies": [
28
+ "esbuild"
29
+ ]
28
30
  }
@@ -4,22 +4,22 @@ A Tiptap editor with Yjs for concurrent edits and durable actors for saved docum
4
4
 
5
5
  ## Run locally
6
6
 
7
- Requires Node.js 22.19+ and Bun 1.3.9+.
7
+ Requires Bun 1.4.2+.
8
8
 
9
9
  ```sh
10
- npx durable-actors init documents-example --template documents
10
+ bunx durable-actors init documents-example --template documents
11
11
  cd documents-example
12
- npm install
12
+ bun install
13
13
  cp .env.example .env
14
- npm run dev:actors
14
+ bun run dev:actors
15
15
  ```
16
16
 
17
- Already in the example directory? Start at `npm install`.
17
+ Already in the example directory? Start at `bun install`.
18
18
 
19
19
  Wait for `Ready`. In another terminal in the same directory:
20
20
 
21
21
  ```sh
22
- npm run dev
22
+ bun run dev
23
23
  ```
24
24
 
25
25
  Open [localhost:3000](http://127.0.0.1:3000) in two tabs. Edit **Welcome** from both, add another document, and switch between them. Restart the servers and reload to restore saved documents.
@@ -48,6 +48,6 @@ Editing pauses while disconnected. Reload to reconnect; unsaved edits are not st
48
48
 
49
49
  ## Development
50
50
 
51
- Both processes read `.env`; saved state lives in `.durable-actors/`. Actor code reloads automatically. After changing public actor types, restart `npm run dev` to regenerate the client. For multiple examples, set distinct `PORT`, `DURABLE_ACTORS_PORT`, and matching control-plane URLs; see [Run the examples together](https://github.com/TerseAI/durable-actors/tree/main/examples#run-the-examples-together).
51
+ Both processes read `.env`; saved state lives in `.durable-actors/`. Actor code reloads automatically. After changing public actor types, restart `bun run dev` to regenerate the client. For multiple examples, set distinct `PORT`, `DURABLE_ACTORS_PORT`, and matching control-plane URLs; see [Run the examples together](https://github.com/TerseAI/durable-actors/tree/main/examples#run-the-examples-together).
52
52
 
53
- `npm run build` generates clients, checks TypeScript, and builds the frontend.
53
+ `bun run build` generates clients, checks TypeScript, and builds the frontend.
@@ -0,0 +1,2 @@
1
+ [run]
2
+ bun = true
@@ -3,10 +3,10 @@
3
3
  "private": true,
4
4
  "type": "module",
5
5
  "engines": {
6
- "node": ">=22.19.0"
6
+ "bun": ">=1.4.2"
7
7
  },
8
8
  "scripts": {
9
- "dev": "durable-actors generate && tsx --env-file=.env src/backend.ts",
9
+ "dev": "durable-actors generate && bun src/backend.ts",
10
10
  "dev:actors": "durable-actors dev",
11
11
  "build": "durable-actors generate src/actors.ts && tsc --noEmit && vite build"
12
12
  },
@@ -19,7 +19,7 @@
19
19
  "@tiptap/y-tiptap": "^3.0.7",
20
20
  "express": "^5.2.1",
21
21
  "lib0": "^0.2.117",
22
- "durable-actors": "0.7.15",
22
+ "durable-actors": "0.8.0",
23
23
  "react": "^19.3.0",
24
24
  "react-dom": "^19.3.0",
25
25
  "yjs": "^13.6.32"
@@ -29,8 +29,10 @@
29
29
  "@types/node": "^22.0.0",
30
30
  "@types/react": "^19.0.0",
31
31
  "@types/react-dom": "^19.0.0",
32
- "tsx": "^4.0.0",
33
32
  "typescript": "~5.9.3",
34
33
  "vite": "^8.3.0"
35
- }
34
+ },
35
+ "trustedDependencies": [
36
+ "esbuild"
37
+ ]
36
38
  }
package/package.json CHANGED
@@ -1,116 +1,118 @@
1
1
  {
2
- "name": "durable-actors",
3
- "version": "0.7.15",
4
- "description": "Provider-neutral actors for sandbox compute",
5
- "type": "module",
6
- "license": "MIT",
7
- "sideEffects": false,
8
- "engines": {
9
- "node": "^20.19.0 || >=22.12.0"
10
- },
11
- "keywords": [
12
- "actors",
13
- "distributed-systems",
14
- "durable-actors",
15
- "kubernetes",
16
- "serverless"
17
- ],
18
- "repository": {
19
- "type": "git",
20
- "url": "git+https://github.com/TerseAI/durable-actors.git",
21
- "directory": "sdk"
22
- },
23
- "homepage": "https://github.com/TerseAI/durable-actors#readme",
24
- "bugs": {
25
- "url": "https://github.com/TerseAI/durable-actors/issues"
26
- },
27
- "publishConfig": {
28
- "access": "public"
29
- },
30
- "main": "dist/index.js",
31
- "types": "dist/index.d.ts",
32
- "bin": {
33
- "durable-actors": "dist/cli.js"
34
- },
35
- "exports": {
36
- "./backend": {
37
- "types": "./dist/backend.d.ts",
38
- "import": "./dist/backend.js",
39
- "default": "./dist/backend.js"
2
+ "name": "durable-actors",
3
+ "version": "0.8.0",
4
+ "description": "Provider-neutral actors for sandbox compute",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "sideEffects": false,
8
+ "engines": {
9
+ "bun": ">=1.4.2"
40
10
  },
41
- "./dev": {
42
- "types": "./dist/localRuntime.d.ts",
43
- "import": "./dist/localRuntime.js",
44
- "default": "./dist/localRuntime.js"
11
+ "packageManager": "bun@1.4.2",
12
+ "keywords": [
13
+ "actors",
14
+ "distributed-systems",
15
+ "durable-actors",
16
+ "kubernetes",
17
+ "serverless"
18
+ ],
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "git+https://github.com/TerseAI/durable-actors.git",
22
+ "directory": "sdk"
45
23
  },
46
- "./proxy": {
47
- "types": "./dist/proxy.d.ts",
48
- "import": "./dist/proxy.js",
49
- "default": "./dist/proxy.js"
24
+ "homepage": "https://github.com/TerseAI/durable-actors#readme",
25
+ "bugs": {
26
+ "url": "https://github.com/TerseAI/durable-actors/issues"
50
27
  },
51
- ".": {
52
- "types": "./dist/index.d.ts",
53
- "import": "./dist/index.js",
54
- "default": "./dist/index.js"
28
+ "publishConfig": {
29
+ "access": "public"
55
30
  },
56
- "./host": {
57
- "types": "./dist/host.d.ts",
58
- "import": "./dist/host.js",
59
- "default": "./dist/host.js"
31
+ "main": "dist/index.js",
32
+ "types": "dist/index.d.ts",
33
+ "bin": {
34
+ "durable-actors": "bin/durable-actors.js"
60
35
  },
61
- "./compiler": {
62
- "types": "./dist/compiler/actor-compiler.d.ts",
63
- "import": "./dist/compiler/actor-compiler.js",
64
- "default": "./dist/compiler/actor-compiler.js"
36
+ "exports": {
37
+ "./backend": {
38
+ "types": "./dist/backend.d.ts",
39
+ "import": "./dist/backend.js",
40
+ "default": "./dist/backend.js"
41
+ },
42
+ "./dev": {
43
+ "types": "./dist/localRuntime.d.ts",
44
+ "import": "./dist/localRuntime.js",
45
+ "default": "./dist/localRuntime.js"
46
+ },
47
+ "./proxy": {
48
+ "types": "./dist/proxy.d.ts",
49
+ "import": "./dist/proxy.js",
50
+ "default": "./dist/proxy.js"
51
+ },
52
+ ".": {
53
+ "types": "./dist/index.d.ts",
54
+ "import": "./dist/index.js",
55
+ "default": "./dist/index.js"
56
+ },
57
+ "./host": {
58
+ "types": "./dist/host.d.ts",
59
+ "import": "./dist/host.js",
60
+ "default": "./dist/host.js"
61
+ },
62
+ "./compiler": {
63
+ "types": "./dist/compiler/actor-compiler.d.ts",
64
+ "import": "./dist/compiler/actor-compiler.js",
65
+ "default": "./dist/compiler/actor-compiler.js"
66
+ },
67
+ "./codegen": {
68
+ "types": "./dist/compiler/generators/client-artifacts.d.ts",
69
+ "import": "./dist/compiler/generators/client-artifacts.js",
70
+ "default": "./dist/compiler/generators/client-artifacts.js"
71
+ }
65
72
  },
66
- "./codegen": {
67
- "types": "./dist/compiler/generators/client-artifacts.d.ts",
68
- "import": "./dist/compiler/generators/client-artifacts.js",
69
- "default": "./dist/compiler/generators/client-artifacts.js"
73
+ "files": [
74
+ "bin",
75
+ "dist",
76
+ "README.md",
77
+ "LICENSE.md"
78
+ ],
79
+ "scripts": {
80
+ "build": "bun run --bun build:observer && bun run --bun build:client && tsc -p tsconfig.build.json && bun run --bun build:declarations && bun scripts/build-template.mjs",
81
+ "check": "bun run --bun format:check && bun run --bun test && bun run --bun package:check",
82
+ "clean": "rm -rf dist .test-dist",
83
+ "package:check": "bun test --timeout 60000 tests/scripts/codegen-api.test.mjs tests/scripts/build-artifact.test.mjs tests/scripts/standalone-client.test.mjs tests/scripts/host-runtime.test.mjs",
84
+ "prepack": "bun run --bun clean && bun run --bun build && bun run --bun package:check",
85
+ "test": "bun run --bun clean && bun run --bun build && bun tests/prepare.mjs && tsc -p tsconfig.test.json && bun test --parallel=1 --timeout 60000 ./.test-dist/tests",
86
+ "format": "prettier --config ../.prettierrc --write \"src/**/*.ts\" \"tests/**/*.ts\" \"scripts/*.mjs\" \"tests/**/*.mjs\"",
87
+ "format:check": "prettier --config ../.prettierrc --check \"src/**/*.ts\" \"tests/**/*.ts\" \"scripts/*.mjs\" \"tests/**/*.mjs\"",
88
+ "build:observer": "bun run --bun --cwd ../packages/observer-ui build",
89
+ "docs": "typedoc --options typedoc.json",
90
+ "build:client": "bun scripts/build-client-runtime.mjs",
91
+ "build:declarations": "bun scripts/build-declaration-compiler.mjs"
92
+ },
93
+ "dependencies": {
94
+ "@types/json-schema": "^7.0.15",
95
+ "ajv": "^8.20.0",
96
+ "commander": "^14.0.3",
97
+ "durable-actors-observer": "0.8.0",
98
+ "esbuild": "^0.28.2",
99
+ "import-meta-resolve": "^4.2.0",
100
+ "open": "^10.2.0",
101
+ "prettier": "^3.9.6",
102
+ "tar": "^7.5.22",
103
+ "typescript": "~5.9.3",
104
+ "typescript-json-schema": "^0.68.0",
105
+ "validate-npm-package-name": "^6.0.2",
106
+ "vite": "^8.3.0",
107
+ "ws": "^8.18.3",
108
+ "zod": "^4.3.6"
109
+ },
110
+ "devDependencies": {
111
+ "@types/node": "^22.0.0",
112
+ "@types/validate-npm-package-name": "^4.0.2",
113
+ "@types/ws": "^8.18.1",
114
+ "dts-bundle-generator": "9.5.1",
115
+ "typedoc": "^0.28.20",
116
+ "typedoc-plugin-missing-exports": "^4.1.4"
70
117
  }
71
- },
72
- "files": [
73
- "dist",
74
- "README.md",
75
- "LICENSE.md"
76
- ],
77
- "dependencies": {
78
- "@types/json-schema": "^7.0.15",
79
- "ajv": "^8.20.0",
80
- "chokidar": "^4.0.3",
81
- "commander": "^14.0.3",
82
- "dotenv": "^18.0.0",
83
- "dts-bundle-generator": "9.5.1",
84
- "esbuild": "^0.28.2",
85
- "import-meta-resolve": "^4.2.0",
86
- "open": "^10.2.0",
87
- "prettier": "^3.9.6",
88
- "tar": "^7.5.22",
89
- "typescript": "~5.9.3",
90
- "typescript-json-schema": "^0.68.0",
91
- "validate-npm-package-name": "^6.0.2",
92
- "vite": "^8.3.0",
93
- "ws": "^8.18.3",
94
- "zod": "^4.3.6",
95
- "durable-actors-observer": "0.7.15"
96
- },
97
- "devDependencies": {
98
- "@types/node": "^22.0.0",
99
- "@types/validate-npm-package-name": "^4.0.2",
100
- "@types/ws": "^8.18.1",
101
- "typedoc": "^0.28.20",
102
- "typedoc-plugin-missing-exports": "^4.1.4"
103
- },
104
- "scripts": {
105
- "build": "pnpm run build:observer && pnpm run build:client && tsc -p tsconfig.build.json && node scripts/build-template.mjs && pnpm --dir .. install --offline --frozen-lockfile --ignore-scripts",
106
- "check": "pnpm run format:check && pnpm run test && pnpm run package:check",
107
- "clean": "rm -rf dist .test-dist",
108
- "package:check": "node --test tests/scripts/codegen-api.test.mjs tests/scripts/build-artifact.test.mjs tests/scripts/standalone-client.test.mjs",
109
- "test": "pnpm run clean && pnpm run build && node tests/prepare.mjs && tsc -p tsconfig.test.json && node scripts/test.mjs",
110
- "format": "prettier --config ../.prettierrc --write \"src/**/*.ts\" \"tests/**/*.ts\" \"scripts/*.mjs\" \"tests/**/*.mjs\"",
111
- "format:check": "prettier --config ../.prettierrc --check \"src/**/*.ts\" \"tests/**/*.ts\" \"scripts/*.mjs\" \"tests/**/*.mjs\"",
112
- "build:observer": "pnpm --filter durable-actors-observer build",
113
- "docs": "typedoc --options typedoc.json",
114
- "build:client": "node scripts/build-client-runtime.mjs"
115
- }
116
- }
118
+ }
@@ -1,25 +0,0 @@
1
- import { watch } from "chokidar";
2
- interface ActorSourceWatcherOptions {
3
- projectDirectory: string;
4
- dataDirectory?: string;
5
- }
6
- declare function watchActorSources(options: ActorSourceWatcherOptions, refresh: () => Promise<void>): Promise<ActorSourceWatcher>;
7
- declare class ActorSourceWatcher {
8
- private readonly options;
9
- private readonly refresh;
10
- private readonly createWatcher;
11
- private readonly warn;
12
- private watcher?;
13
- private timer?;
14
- private updates;
15
- private closing?;
16
- private disabled;
17
- constructor(options: ActorSourceWatcherOptions, refresh: () => Promise<void>, createWatcher: typeof watch, warn: (message: string) => void);
18
- start(): Promise<void>;
19
- close(): Promise<void>;
20
- private scheduleRefresh;
21
- private waitUntilReady;
22
- private disable;
23
- }
24
- export { ActorSourceWatcher, watchActorSources };
25
- //# sourceMappingURL=actor-source-watcher.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"actor-source-watcher.d.ts","sourceRoot":"","sources":["../../src/cli/actor-source-watcher.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,EAAE,MAAM,UAAU,CAAA;AAIhD,UAAU,yBAAyB;IAC/B,gBAAgB,EAAE,MAAM,CAAA;IACxB,aAAa,CAAC,EAAE,MAAM,CAAA;CACzB;AAED,iBAAe,iBAAiB,CAC5B,OAAO,EAAE,yBAAyB,EAClC,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAC7B,OAAO,CAAC,kBAAkB,CAAC,CAI7B;AAED,cAAM,kBAAkB;IAQhB,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,aAAa;IAC9B,OAAO,CAAC,QAAQ,CAAC,IAAI;IAVzB,OAAO,CAAC,OAAO,CAAC,CAAW;IAC3B,OAAO,CAAC,KAAK,CAAC,CAA+B;IAC7C,OAAO,CAAC,OAAO,CAAoB;IACnC,OAAO,CAAC,OAAO,CAAC,CAAe;IAC/B,OAAO,CAAC,QAAQ,CAAQ;gBAGH,OAAO,EAAE,yBAAyB,EAClC,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,EAC5B,aAAa,EAAE,OAAO,KAAK,EAC3B,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI;IAG9C,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAuBtB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAY5B,OAAO,CAAC,eAAe;IAQvB,OAAO,CAAC,cAAc;YAgBR,OAAO;CAUxB;AA0CD,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,CAAA"}
@@ -1,129 +0,0 @@
1
- import { watch } from "chokidar";
2
- import { existsSync } from "node:fs";
3
- import path from "node:path";
4
- async function watchActorSources(options, refresh) {
5
- const watcher = new ActorSourceWatcher(options, refresh, watch, message => console.warn(message));
6
- await watcher.start();
7
- return watcher;
8
- }
9
- class ActorSourceWatcher {
10
- options;
11
- refresh;
12
- createWatcher;
13
- warn;
14
- watcher;
15
- timer;
16
- updates = Promise.resolve();
17
- closing;
18
- disabled = false;
19
- constructor(options, refresh, createWatcher, warn) {
20
- this.options = options;
21
- this.refresh = refresh;
22
- this.createWatcher = createWatcher;
23
- this.warn = warn;
24
- }
25
- async start() {
26
- try {
27
- this.watcher = this.createWatcher(this.options.projectDirectory, {
28
- ignored: (watchedPath, stats) => ignoredActorPath(watchedPath, this.options) ||
29
- (stats?.isDirectory() === true && existsSync(path.join(watchedPath, "pyvenv.cfg"))) ||
30
- (stats !== undefined && !stats.isDirectory() && (!stats.isFile() || !isActorSource(watchedPath))),
31
- ignoreInitial: true,
32
- followSymlinks: false,
33
- atomic: true,
34
- awaitWriteFinish: { stabilityThreshold: 100, pollInterval: 20 }
35
- });
36
- this.watcher.on("all", (_event, changedPath) => this.scheduleRefresh(changedPath));
37
- await this.waitUntilReady(this.watcher);
38
- }
39
- catch (error) {
40
- if (isWatchLimit(error))
41
- await this.disable(error);
42
- else {
43
- await this.close();
44
- throw error;
45
- }
46
- }
47
- }
48
- async close() {
49
- this.disabled = true;
50
- clearTimeout(this.timer);
51
- if (!this.closing) {
52
- this.closing = this.watcher?.close() ?? Promise.resolve();
53
- // Chokidar removes listeners on close, but pending filesystem operations can still emit errors.
54
- this.watcher?.on("error", () => { });
55
- }
56
- await this.closing;
57
- await this.updates;
58
- }
59
- scheduleRefresh(changedPath) {
60
- if (this.disabled || !isActorSource(changedPath))
61
- return;
62
- clearTimeout(this.timer);
63
- this.timer = setTimeout(() => {
64
- this.updates = this.updates.then(this.refresh).catch(reportWatchError);
65
- }, 75);
66
- }
67
- waitUntilReady(watcher) {
68
- return new Promise((resolve, reject) => {
69
- let ready = false;
70
- watcher.once("ready", () => {
71
- ready = true;
72
- resolve();
73
- });
74
- watcher.on("error", error => {
75
- if (this.disabled)
76
- return;
77
- if (isWatchLimit(error))
78
- void this.disable(error).then(resolve, reject);
79
- else if (!ready)
80
- reject(error);
81
- else
82
- reportWatchError(error);
83
- });
84
- });
85
- }
86
- async disable(error) {
87
- if (!this.disabled)
88
- this.warn(`Actor source watcher reached the OS file/watch limit (${error.code}). Automatic reload is disabled; ` +
89
- "the development server will continue running. Restart it to apply source changes. " +
90
- "Close other watchers or raise your OS file/watch limit, then restart to restore automatic reload. " +
91
- "Use --no-watch to disable watching explicitly.");
92
- await this.close();
93
- }
94
- }
95
- function isWatchLimit(error) {
96
- return error instanceof Error && "code" in error && ["EMFILE", "ENFILE", "ENOSPC"].includes(String(error.code));
97
- }
98
- function ignoredActorPath(candidate, options) {
99
- const relative = path.relative(options.projectDirectory, candidate);
100
- if (!relative || relative.startsWith(`..${path.sep}`) || path.isAbsolute(relative))
101
- return false;
102
- const components = relative.split(path.sep);
103
- if (components.some(component => [
104
- ".git",
105
- "node_modules",
106
- ".venv",
107
- "venv",
108
- "__pycache__",
109
- ".mypy_cache",
110
- ".pytest_cache",
111
- ".ruff_cache"
112
- ].includes(component)))
113
- return true;
114
- if ([".durable-actors", "generated"].includes(components[0]))
115
- return true;
116
- if (!options.dataDirectory)
117
- return false;
118
- const state = path.resolve(options.dataDirectory);
119
- return candidate === state || candidate.startsWith(`${state}${path.sep}`);
120
- }
121
- function isActorSource(candidate) {
122
- return (/\.(?:[cm]?[jt]sx?|json|ya?ml|py|toml)$/u.test(candidate) ||
123
- ["bun.lock", "uv.lock", "requirements.txt"].includes(path.basename(candidate)));
124
- }
125
- function reportWatchError(error) {
126
- console.error(`Actor source update failed: ${error instanceof Error ? error.message : String(error)}`);
127
- }
128
- export { ActorSourceWatcher, watchActorSources };
129
- //# sourceMappingURL=actor-source-watcher.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"actor-source-watcher.js","sourceRoot":"","sources":["../../src/cli/actor-source-watcher.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,EAAE,MAAM,UAAU,CAAA;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO,IAAI,MAAM,WAAW,CAAA;AAO5B,KAAK,UAAU,iBAAiB,CAC5B,OAAkC,EAClC,OAA4B;IAE5B,MAAM,OAAO,GAAG,IAAI,kBAAkB,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAA;IACjG,MAAM,OAAO,CAAC,KAAK,EAAE,CAAA;IACrB,OAAO,OAAO,CAAA;AAClB,CAAC;AAED,MAAM,kBAAkB;IAQC;IACA;IACA;IACA;IAVb,OAAO,CAAY;IACnB,KAAK,CAAgC;IACrC,OAAO,GAAG,OAAO,CAAC,OAAO,EAAE,CAAA;IAC3B,OAAO,CAAgB;IACvB,QAAQ,GAAG,KAAK,CAAA;IAExB,YACqB,OAAkC,EAClC,OAA4B,EAC5B,aAA2B,EA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-1,7 +0,0 @@
1
- # Python actors
2
-
3
- Install Node.js 22+, Python 3.11+, and uv. Run `pnpm install`, `uv sync`, then `pnpm exec durable-actors dev`. The shared TypeScript CLI selects `.venv` and checks actor types before starting and reloading.
4
-
5
- Edit `src/actors.py`. Write synchronous actor methods with ordinary `def`. Every instance field must use `persisted()` or `ephemeral()`. Use `emitted(persisted(...))` for state broadcasts and `ephemeral()` for temporary values such as caches and service clients. From your client application, install `durable-actors[codegen]` and run `pnpm exec durable-actors generate` against the running server. Generated Python clients include synchronous typed methods and models. Import `actors` from the generated package and use `actors.Counter.get("one")`; the SDK manages the HTTP connection pool. Actors with emitted fields also expose `actor.subscribe(callback)` for typed live state; close the returned subscription when finished. The CLI runs strict mypy after generation.
6
-
7
- Set `DURABLE_ACTORS_PYTHON` to select another interpreter. `DURABLE_ACTORS_BINARY` selects a locally built runtime.
@@ -1,6 +0,0 @@
1
- node_modules/
2
- .venv/
3
- .durable-actors/
4
- .mypy_cache/
5
- __pycache__/
6
- generated/
@@ -1,11 +0,0 @@
1
- {
2
- "name": "durable-actors-example-python",
3
- "private": true,
4
- "dependencies": {
5
- "durable-actors": "0.7.15"
6
- },
7
- "scripts": {
8
- "dev": "durable-actors dev",
9
- "generate": "durable-actors generate"
10
- }
11
- }
@@ -1,2 +0,0 @@
1
- allowBuilds:
2
- esbuild: true
@@ -1,8 +0,0 @@
1
- [project]
2
- name = "durable-actors-example"
3
- version = "0.1.0"
4
- requires-python = ">=3.11"
5
- dependencies = ["durable-actors[codegen]==0.7.15"]
6
-
7
- [tool.mypy]
8
- strict = true