depa-actor 0.1.1 → 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.
- package/dist/core/ActorSystem.d.ts +1 -1
- package/dist/core/ActorSystem.d.ts.map +1 -1
- package/dist/dispatch/ActorDispatchAdapter.d.ts +1 -1
- package/dist/dispatch/ActorDispatchAdapter.d.ts.map +1 -1
- package/dist/execution/commandDeque.d.ts +121 -0
- package/dist/execution/commandDeque.d.ts.map +1 -0
- package/dist/execution/commandDeque.js +415 -0
- package/dist/execution/commandDeque.js.map +1 -0
- package/dist/execution/dispatcher.d.ts +72 -0
- package/dist/execution/dispatcher.d.ts.map +1 -0
- package/dist/execution/dispatcher.js +77 -0
- package/dist/execution/dispatcher.js.map +1 -0
- package/dist/execution/index.d.ts +7 -0
- package/dist/execution/index.d.ts.map +1 -0
- package/dist/execution/index.js +4 -0
- package/dist/execution/index.js.map +1 -0
- package/dist/execution/stack.d.ts +24 -0
- package/dist/execution/stack.d.ts.map +1 -0
- package/dist/execution/stack.js +84 -0
- package/dist/execution/stack.js.map +1 -0
- package/dist/index.d.ts +17 -15
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -8
- package/dist/index.js.map +1 -1
- package/dist/orchestration/index.d.ts +8 -8
- package/dist/orchestration/index.d.ts.map +1 -1
- package/dist/orchestration/index.js +6 -6
- package/dist/orchestration/index.js.map +1 -1
- package/dist/orchestration/presets/aiAgent.d.ts +2 -2
- package/dist/orchestration/presets/aiAgent.d.ts.map +1 -1
- package/dist/orchestration/recovery.d.ts +2 -2
- package/dist/orchestration/recovery.d.ts.map +1 -1
- package/dist/orchestration/reducer.d.ts +2 -2
- package/dist/orchestration/reducer.d.ts.map +1 -1
- package/dist/orchestration/reducer.js +2 -2
- package/dist/orchestration/reducer.js.map +1 -1
- package/dist/orchestration/runtimeAdapter.d.ts +3 -3
- package/dist/orchestration/runtimeAdapter.d.ts.map +1 -1
- package/dist/orchestration/scheduler.d.ts +2 -2
- package/dist/orchestration/scheduler.d.ts.map +1 -1
- package/dist/orchestration/types.d.ts +1 -1
- package/dist/orchestration/types.d.ts.map +1 -1
- package/dist/pipeline/ActorPipeline.d.ts +1 -1
- package/dist/pipeline/ActorPipeline.d.ts.map +1 -1
- package/dist/runtime/ActorRuntime.d.ts +2 -2
- package/dist/runtime/ActorRuntime.d.ts.map +1 -1
- package/dist/runtime/ActorRuntime.js +1 -1
- package/dist/runtime/ActorRuntime.js.map +1 -1
- package/dist-cjs/core/ActorSystem.cjs +172 -0
- package/dist-cjs/core/types.cjs +10 -0
- package/dist-cjs/dispatch/ActorDispatchAdapter.cjs +40 -0
- package/dist-cjs/execution/commandDeque.cjs +430 -0
- package/dist-cjs/execution/dispatcher.cjs +79 -0
- package/dist-cjs/execution/index.cjs +24 -0
- package/dist-cjs/execution/stack.cjs +88 -0
- package/dist-cjs/index.cjs +52 -0
- package/dist-cjs/orchestration/index.cjs +19 -0
- package/dist-cjs/orchestration/presets/aiAgent.cjs +40 -0
- package/dist-cjs/orchestration/recovery.cjs +112 -0
- package/dist-cjs/orchestration/reducer.cjs +276 -0
- package/dist-cjs/orchestration/runtimeAdapter.cjs +14 -0
- package/dist-cjs/orchestration/scheduler.cjs +86 -0
- package/dist-cjs/orchestration/types.cjs +14 -0
- package/dist-cjs/package.json +3 -0
- package/dist-cjs/pipeline/ActorPipeline.cjs +34 -0
- package/dist-cjs/runtime/ActorRuntime.cjs +77 -0
- package/dist-cjs/runtime/completion.cjs +75 -0
- package/dist-cjs/runtime/indexing.cjs +34 -0
- package/dist-cjs/runtime/snapshot.cjs +14 -0
- package/package.json +14 -4
- package/src/core/ActorSystem.ts +1 -1
- package/src/dispatch/ActorDispatchAdapter.ts +1 -1
- package/src/execution/commandDeque.ts +656 -0
- package/src/execution/dispatcher.ts +188 -0
- package/src/execution/index.ts +58 -0
- package/src/execution/stack.ts +130 -0
- package/src/index.ts +67 -15
- package/src/orchestration/index.ts +8 -8
- package/src/orchestration/presets/aiAgent.ts +2 -2
- package/src/orchestration/recovery.ts +2 -2
- package/src/orchestration/reducer.ts +3 -3
- package/src/orchestration/runtimeAdapter.ts +3 -3
- package/src/orchestration/scheduler.ts +2 -2
- package/src/orchestration/types.ts +1 -1
- package/src/pipeline/ActorPipeline.ts +1 -1
- 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.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"main": "./dist/index.
|
|
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"
|
|
@@ -24,5 +26,13 @@
|
|
|
24
26
|
"devDependencies": {
|
|
25
27
|
"typescript": "^5.8.3"
|
|
26
28
|
},
|
|
29
|
+
"repository": {
|
|
30
|
+
"type": "git",
|
|
31
|
+
"url": "https://github.com/seerkong/depa-actor.git"
|
|
32
|
+
},
|
|
33
|
+
"bugs": {
|
|
34
|
+
"url": "https://github.com/seerkong/depa-actor/issues"
|
|
35
|
+
},
|
|
36
|
+
"homepage": "https://github.com/seerkong/depa-actor#readme",
|
|
27
37
|
"license": "MIT"
|
|
28
38
|
}
|
package/src/core/ActorSystem.ts
CHANGED