depa-actor 0.1.2 → 0.2.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 (86) hide show
  1. package/dist/core/ActorSystem.d.ts +1 -1
  2. package/dist/core/ActorSystem.d.ts.map +1 -1
  3. package/dist/dispatch/ActorDispatchAdapter.d.ts +1 -1
  4. package/dist/dispatch/ActorDispatchAdapter.d.ts.map +1 -1
  5. package/dist/execution/commandDeque.d.ts +121 -0
  6. package/dist/execution/commandDeque.d.ts.map +1 -0
  7. package/dist/execution/commandDeque.js +415 -0
  8. package/dist/execution/commandDeque.js.map +1 -0
  9. package/dist/execution/dispatcher.d.ts +72 -0
  10. package/dist/execution/dispatcher.d.ts.map +1 -0
  11. package/dist/execution/dispatcher.js +77 -0
  12. package/dist/execution/dispatcher.js.map +1 -0
  13. package/dist/execution/index.d.ts +7 -0
  14. package/dist/execution/index.d.ts.map +1 -0
  15. package/dist/execution/index.js +4 -0
  16. package/dist/execution/index.js.map +1 -0
  17. package/dist/execution/stack.d.ts +24 -0
  18. package/dist/execution/stack.d.ts.map +1 -0
  19. package/dist/execution/stack.js +84 -0
  20. package/dist/execution/stack.js.map +1 -0
  21. package/dist/index.d.ts +17 -15
  22. package/dist/index.d.ts.map +1 -1
  23. package/dist/index.js +9 -8
  24. package/dist/index.js.map +1 -1
  25. package/dist/orchestration/index.d.ts +8 -8
  26. package/dist/orchestration/index.d.ts.map +1 -1
  27. package/dist/orchestration/index.js +6 -6
  28. package/dist/orchestration/index.js.map +1 -1
  29. package/dist/orchestration/presets/aiAgent.d.ts +2 -2
  30. package/dist/orchestration/presets/aiAgent.d.ts.map +1 -1
  31. package/dist/orchestration/recovery.d.ts +2 -2
  32. package/dist/orchestration/recovery.d.ts.map +1 -1
  33. package/dist/orchestration/reducer.d.ts +2 -2
  34. package/dist/orchestration/reducer.d.ts.map +1 -1
  35. package/dist/orchestration/reducer.js +2 -2
  36. package/dist/orchestration/reducer.js.map +1 -1
  37. package/dist/orchestration/runtimeAdapter.d.ts +3 -3
  38. package/dist/orchestration/runtimeAdapter.d.ts.map +1 -1
  39. package/dist/orchestration/scheduler.d.ts +2 -2
  40. package/dist/orchestration/scheduler.d.ts.map +1 -1
  41. package/dist/orchestration/types.d.ts +1 -1
  42. package/dist/orchestration/types.d.ts.map +1 -1
  43. package/dist/pipeline/ActorPipeline.d.ts +1 -1
  44. package/dist/pipeline/ActorPipeline.d.ts.map +1 -1
  45. package/dist/runtime/ActorRuntime.d.ts +2 -2
  46. package/dist/runtime/ActorRuntime.d.ts.map +1 -1
  47. package/dist/runtime/ActorRuntime.js +1 -1
  48. package/dist/runtime/ActorRuntime.js.map +1 -1
  49. package/dist-cjs/core/ActorSystem.cjs +172 -0
  50. package/dist-cjs/core/types.cjs +10 -0
  51. package/dist-cjs/dispatch/ActorDispatchAdapter.cjs +40 -0
  52. package/dist-cjs/execution/commandDeque.cjs +430 -0
  53. package/dist-cjs/execution/dispatcher.cjs +79 -0
  54. package/dist-cjs/execution/index.cjs +24 -0
  55. package/dist-cjs/execution/stack.cjs +88 -0
  56. package/dist-cjs/index.cjs +52 -0
  57. package/dist-cjs/orchestration/index.cjs +19 -0
  58. package/dist-cjs/orchestration/presets/aiAgent.cjs +40 -0
  59. package/dist-cjs/orchestration/recovery.cjs +112 -0
  60. package/dist-cjs/orchestration/reducer.cjs +276 -0
  61. package/dist-cjs/orchestration/runtimeAdapter.cjs +14 -0
  62. package/dist-cjs/orchestration/scheduler.cjs +86 -0
  63. package/dist-cjs/orchestration/types.cjs +14 -0
  64. package/dist-cjs/package.json +3 -0
  65. package/dist-cjs/pipeline/ActorPipeline.cjs +34 -0
  66. package/dist-cjs/runtime/ActorRuntime.cjs +77 -0
  67. package/dist-cjs/runtime/completion.cjs +75 -0
  68. package/dist-cjs/runtime/indexing.cjs +34 -0
  69. package/dist-cjs/runtime/snapshot.cjs +14 -0
  70. package/package.json +6 -4
  71. package/src/core/ActorSystem.ts +1 -1
  72. package/src/dispatch/ActorDispatchAdapter.ts +1 -1
  73. package/src/execution/commandDeque.ts +656 -0
  74. package/src/execution/dispatcher.ts +188 -0
  75. package/src/execution/index.ts +58 -0
  76. package/src/execution/stack.ts +130 -0
  77. package/src/index.ts +67 -15
  78. package/src/orchestration/index.ts +8 -8
  79. package/src/orchestration/presets/aiAgent.ts +2 -2
  80. package/src/orchestration/recovery.ts +2 -2
  81. package/src/orchestration/reducer.ts +3 -3
  82. package/src/orchestration/runtimeAdapter.ts +3 -3
  83. package/src/orchestration/scheduler.ts +2 -2
  84. package/src/orchestration/types.ts +1 -1
  85. package/src/pipeline/ActorPipeline.ts +1 -1
  86. package/src/runtime/ActorRuntime.ts +2 -2
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CompletionBindingRegistry = exports.CompletionSignalRegistry = void 0;
4
+ exports.createCompletionSignalRegistry = createCompletionSignalRegistry;
5
+ exports.createCompletionBindingRegistry = createCompletionBindingRegistry;
6
+ class CompletionSignalRegistry {
7
+ waiters = new Map();
8
+ subscribe(key, waiter) {
9
+ const current = this.waiters.get(key) ?? new Set();
10
+ current.add(waiter);
11
+ this.waiters.set(key, current);
12
+ return () => {
13
+ const next = this.waiters.get(key);
14
+ if (!next) {
15
+ return;
16
+ }
17
+ next.delete(waiter);
18
+ if (next.size === 0) {
19
+ this.waiters.delete(key);
20
+ }
21
+ };
22
+ }
23
+ resolve(key, result) {
24
+ const waiters = this.waiters.get(key);
25
+ if (!waiters || waiters.size === 0) {
26
+ return;
27
+ }
28
+ this.waiters.delete(key);
29
+ for (const waiter of Array.from(waiters)) {
30
+ waiter(result);
31
+ }
32
+ }
33
+ has(key) {
34
+ return (this.waiters.get(key)?.size ?? 0) > 0;
35
+ }
36
+ count(key) {
37
+ return this.waiters.get(key)?.size ?? 0;
38
+ }
39
+ clear(key) {
40
+ if (key !== undefined) {
41
+ this.waiters.delete(key);
42
+ return;
43
+ }
44
+ this.waiters.clear();
45
+ }
46
+ }
47
+ exports.CompletionSignalRegistry = CompletionSignalRegistry;
48
+ function createCompletionSignalRegistry() {
49
+ return new CompletionSignalRegistry();
50
+ }
51
+ class CompletionBindingRegistry {
52
+ bindings;
53
+ constructor(initial) {
54
+ this.bindings = Object.assign(Object.create(null), initial ?? {});
55
+ }
56
+ get(key) {
57
+ return this.bindings[key];
58
+ }
59
+ set(key, binding) {
60
+ this.bindings[key] = binding;
61
+ }
62
+ delete(key) {
63
+ delete this.bindings[key];
64
+ }
65
+ has(key) {
66
+ return key in this.bindings;
67
+ }
68
+ snapshot() {
69
+ return { ...this.bindings };
70
+ }
71
+ }
72
+ exports.CompletionBindingRegistry = CompletionBindingRegistry;
73
+ function createCompletionBindingRegistry(initial) {
74
+ return new CompletionBindingRegistry(initial);
75
+ }
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RuntimeIndexHook = void 0;
4
+ exports.createRuntimeIndexHook = createRuntimeIndexHook;
5
+ class RuntimeIndexHook {
6
+ entries = new Map();
7
+ constructor(initial) {
8
+ for (const [key, value] of Object.entries(initial ?? {})) {
9
+ this.entries.set(key, value);
10
+ }
11
+ }
12
+ get(key) {
13
+ return this.entries.get(key);
14
+ }
15
+ set(key, value) {
16
+ this.entries.set(key, value);
17
+ }
18
+ delete(key) {
19
+ this.entries.delete(key);
20
+ }
21
+ has(key) {
22
+ return this.entries.has(key);
23
+ }
24
+ values() {
25
+ return Array.from(this.entries.values());
26
+ }
27
+ snapshot() {
28
+ return Object.fromEntries(this.entries.entries());
29
+ }
30
+ }
31
+ exports.RuntimeIndexHook = RuntimeIndexHook;
32
+ function createRuntimeIndexHook(initial) {
33
+ return new RuntimeIndexHook(initial);
34
+ }
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createSnapshotCodec = createSnapshotCodec;
4
+ exports.createRecoveryHooks = createRecoveryHooks;
5
+ exports.createPersistenceEffectPort = createPersistenceEffectPort;
6
+ function createSnapshotCodec(codec) {
7
+ return codec;
8
+ }
9
+ function createRecoveryHooks(hooks) {
10
+ return hooks;
11
+ }
12
+ function createPersistenceEffectPort(port) {
13
+ return port;
14
+ }
package/package.json CHANGED
@@ -1,22 +1,24 @@
1
1
  {
2
2
  "name": "depa-actor",
3
- "version": "0.1.2",
3
+ "version": "0.2.0",
4
4
  "type": "module",
5
- "main": "./dist/index.js",
5
+ "main": "./dist-cjs/index.cjs",
6
6
  "module": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",
8
8
  "exports": {
9
9
  ".": {
10
10
  "types": "./dist/index.d.ts",
11
- "import": "./dist/index.js"
11
+ "import": "./dist/index.js",
12
+ "require": "./dist-cjs/index.cjs"
12
13
  }
13
14
  },
14
15
  "files": [
15
16
  "dist",
17
+ "dist-cjs",
16
18
  "src"
17
19
  ],
18
20
  "scripts": {
19
- "build": "tsc",
21
+ "build": "tsc && tsc -p tsconfig.cjs.json && node scripts/build-cjs.mjs",
20
22
  "dev": "tsc --watch",
21
23
  "test": "bun test",
22
24
  "test:watch": "bun test --watch"
@@ -14,7 +14,7 @@ import type {
14
14
  ActorSelf,
15
15
  TaggedEnvelope,
16
16
  TagHandler,
17
- } from './types';
17
+ } from './types.js';
18
18
 
19
19
  // ─── ActorCell (internal) ────────────────────────────────────────────
20
20
 
@@ -11,7 +11,7 @@ import type {
11
11
  ActorSelf,
12
12
  ActorEnvelope,
13
13
  ActorHandler,
14
- } from '../core/types';
14
+ } from '../core/types.js';
15
15
 
16
16
  // ─── DispatchRoute (structural, no import) ───────────────────────────
17
17