depa-actor 0.1.2 → 0.2.1
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/addressing.d.ts +100 -0
- package/dist/addressing.d.ts.map +1 -0
- package/dist/addressing.js +409 -0
- package/dist/addressing.js.map +1 -0
- package/dist/core/ActorSystem.d.ts +1 -1
- package/dist/core/ActorSystem.d.ts.map +1 -1
- package/dist/dispatch/ActorDispatchAdapter.d.ts +75 -18
- package/dist/dispatch/ActorDispatchAdapter.d.ts.map +1 -1
- package/dist/dispatch/ActorDispatchAdapter.js +109 -24
- package/dist/dispatch/ActorDispatchAdapter.js.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 +21 -15
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15 -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 +36 -9
- package/dist/pipeline/ActorPipeline.d.ts.map +1 -1
- package/dist/pipeline/ActorPipeline.js +26 -16
- package/dist/pipeline/ActorPipeline.js.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/addressing.cjs +424 -0
- package/dist-cjs/core/ActorSystem.cjs +172 -0
- package/dist-cjs/core/types.cjs +10 -0
- package/dist-cjs/dispatch/ActorDispatchAdapter.cjs +125 -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 +77 -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 +44 -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 +9 -4
- package/src/addressing.ts +756 -0
- package/src/core/ActorSystem.ts +1 -1
- package/src/dispatch/ActorDispatchAdapter.ts +219 -48
- 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 +121 -16
- 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 +104 -58
- package/src/runtime/ActorRuntime.ts +2 -2
|
@@ -1,74 +1,106 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* depa-actor — ActorPipeline
|
|
3
3
|
*
|
|
4
|
-
* Adapts the DOP 6-step pipeline
|
|
4
|
+
* Adapts the DOP 6-step pipeline to actor context by REUSING the depa-processor
|
|
5
|
+
* `component` primitives (DEPA dimension chain Processor → Actor): the 6-step
|
|
6
|
+
* orchestration is delegated to `runByFuncStyleAdapter`, identity/null seams come
|
|
7
|
+
* from `stdMake*`, and the core-logic seam is `StdInnerLogic` verbatim — this module
|
|
8
|
+
* no longer re-implements a parallel copy of `component/types.ts`.
|
|
5
9
|
*
|
|
6
|
-
* Mapping:
|
|
10
|
+
* Mapping (outer dimension):
|
|
7
11
|
* OuterRuntime = ActorSelf
|
|
8
12
|
* OuterInput = envelope payload
|
|
9
13
|
* OuterConfig = actor state
|
|
10
14
|
*
|
|
15
|
+
* Step 6 (output) is adapted with `TOuterOutput = void`: actor output is a side
|
|
16
|
+
* effect (write `self.state` / `self.send`), not a returned value. This thinly
|
|
17
|
+
* adapts depa-processor's pure-function `StdOuterOutputAdapter` without leaking
|
|
18
|
+
* actor semantics back into the generic primitive.
|
|
19
|
+
*
|
|
11
20
|
* createPipelineHandler() wraps a pipeline definition into an ActorHandler.
|
|
12
21
|
*/
|
|
13
22
|
|
|
23
|
+
import { runByFuncStyleAdapter } from 'depa-processor';
|
|
24
|
+
import type {
|
|
25
|
+
StdOuterComputedAdapter,
|
|
26
|
+
StdInnerRuntimeAdapter,
|
|
27
|
+
StdInnerInputAdapter,
|
|
28
|
+
StdInnerConfigAdapter,
|
|
29
|
+
StdInnerLogic,
|
|
30
|
+
StdOuterOutputAdapter,
|
|
31
|
+
} from 'depa-processor';
|
|
14
32
|
import type {
|
|
15
33
|
MailboxSchema,
|
|
16
34
|
ActorSelf,
|
|
17
35
|
ActorHandler,
|
|
18
|
-
} from '../core/types';
|
|
36
|
+
} from '../core/types.js';
|
|
19
37
|
|
|
20
38
|
// ─── Pipeline Adapter Types ──────────────────────────────────────────
|
|
39
|
+
// Thin actor-flavoured aliases over the depa-processor component adapters.
|
|
40
|
+
// Outer dimension = (ActorSelf, payload, state); the seam contracts are reused
|
|
41
|
+
// 1:1 from `depa-processor` rather than re-declared.
|
|
21
42
|
|
|
22
43
|
export type PipelineDerivedAdapter<
|
|
23
44
|
TRuntime, TSchema extends MailboxSchema, TState, TDerived,
|
|
24
|
-
> =
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
45
|
+
> = StdOuterComputedAdapter<
|
|
46
|
+
ActorSelf<TRuntime, TSchema, TState>,
|
|
47
|
+
TSchema[keyof TSchema & string],
|
|
48
|
+
TState,
|
|
49
|
+
TDerived
|
|
50
|
+
>;
|
|
29
51
|
|
|
30
52
|
export type PipelineInnerRuntimeAdapter<
|
|
31
53
|
TRuntime, TSchema extends MailboxSchema, TState, TDerived, TInnerRuntime,
|
|
32
|
-
> =
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
54
|
+
> = StdInnerRuntimeAdapter<
|
|
55
|
+
ActorSelf<TRuntime, TSchema, TState>,
|
|
56
|
+
TSchema[keyof TSchema & string],
|
|
57
|
+
TState,
|
|
58
|
+
TDerived,
|
|
59
|
+
TInnerRuntime
|
|
60
|
+
>;
|
|
38
61
|
|
|
39
62
|
export type PipelineInnerInputAdapter<
|
|
40
63
|
TRuntime, TSchema extends MailboxSchema, TState, TDerived, TInnerInput,
|
|
41
|
-
> =
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
64
|
+
> = StdInnerInputAdapter<
|
|
65
|
+
ActorSelf<TRuntime, TSchema, TState>,
|
|
66
|
+
TSchema[keyof TSchema & string],
|
|
67
|
+
TState,
|
|
68
|
+
TDerived,
|
|
69
|
+
TInnerInput
|
|
70
|
+
>;
|
|
47
71
|
|
|
48
72
|
export type PipelineInnerConfigAdapter<
|
|
49
73
|
TRuntime, TSchema extends MailboxSchema, TState, TDerived, TInnerConfig,
|
|
50
|
-
> =
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
74
|
+
> = StdInnerConfigAdapter<
|
|
75
|
+
ActorSelf<TRuntime, TSchema, TState>,
|
|
76
|
+
TSchema[keyof TSchema & string],
|
|
77
|
+
TState,
|
|
78
|
+
TDerived,
|
|
79
|
+
TInnerConfig
|
|
80
|
+
>;
|
|
56
81
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
82
|
+
/**
|
|
83
|
+
* Core business logic seam — reuses depa-processor `StdInnerLogic` verbatim:
|
|
84
|
+
* (runtime, input, config) => output | Promise<output>.
|
|
85
|
+
*/
|
|
86
|
+
export type PipelineCoreLogic<TInnerRuntime, TInnerInput, TInnerConfig, TInnerOutput> =
|
|
87
|
+
StdInnerLogic<TInnerRuntime, TInnerInput, TInnerConfig, TInnerOutput>;
|
|
62
88
|
|
|
89
|
+
/**
|
|
90
|
+
* Step 6 output adapter — actor variant with `TOuterOutput = void`.
|
|
91
|
+
* The adapter performs side effects (write state / send messages) and returns
|
|
92
|
+
* nothing. This is the depa-processor `StdOuterOutputAdapter` specialised to void.
|
|
93
|
+
*/
|
|
63
94
|
export type PipelineOutputAdapter<
|
|
64
95
|
TRuntime, TSchema extends MailboxSchema, TState, TDerived, TInnerOutput,
|
|
65
|
-
> =
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
96
|
+
> = StdOuterOutputAdapter<
|
|
97
|
+
ActorSelf<TRuntime, TSchema, TState>,
|
|
98
|
+
TSchema[keyof TSchema & string],
|
|
99
|
+
TState,
|
|
100
|
+
TDerived,
|
|
101
|
+
TInnerOutput,
|
|
102
|
+
void | Promise<void>
|
|
103
|
+
>;
|
|
72
104
|
|
|
73
105
|
// ─── Pipeline Definition ─────────────────────────────────────────────
|
|
74
106
|
|
|
@@ -92,6 +124,14 @@ export interface ActorPipelineDef<
|
|
|
92
124
|
|
|
93
125
|
// ─── createPipelineHandler ───────────────────────────────────────────
|
|
94
126
|
|
|
127
|
+
/**
|
|
128
|
+
* Wrap a pipeline definition into an ActorHandler by delegating the 6-step
|
|
129
|
+
* orchestration to depa-processor `runByFuncStyleAdapter`.
|
|
130
|
+
*
|
|
131
|
+
* Outer dimension: runtime = self, input = payload, config = state.
|
|
132
|
+
* Step 6 produces `void` — `runByFuncStyleAdapter` runs the output adapter for its
|
|
133
|
+
* side effects and the (void) return value is discarded.
|
|
134
|
+
*/
|
|
95
135
|
export function createPipelineHandler<
|
|
96
136
|
TRuntime,
|
|
97
137
|
TSchema extends MailboxSchema,
|
|
@@ -108,25 +148,31 @@ export function createPipelineHandler<
|
|
|
108
148
|
>,
|
|
109
149
|
): ActorHandler<TRuntime, TSchema, TState> {
|
|
110
150
|
return async (self, envelope) => {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
//
|
|
115
|
-
const
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
151
|
+
// `runByFuncStyleAdapter` returns the output adapter's value verbatim (without
|
|
152
|
+
// awaiting it). Capture it and await so an async step-6 side effect (write
|
|
153
|
+
// state / send messages) is fully settled before the handler resolves —
|
|
154
|
+
// preserving the original `await pipeline.output(...)` semantics.
|
|
155
|
+
const outputResult = await runByFuncStyleAdapter<
|
|
156
|
+
ActorSelf<TRuntime, TSchema, TState>,
|
|
157
|
+
TSchema[keyof TSchema & string],
|
|
158
|
+
TState,
|
|
159
|
+
TDerived,
|
|
160
|
+
void | Promise<void>,
|
|
161
|
+
TInnerRuntime,
|
|
162
|
+
TInnerInput,
|
|
163
|
+
TInnerConfig,
|
|
164
|
+
TInnerOutput
|
|
165
|
+
>(
|
|
166
|
+
self,
|
|
167
|
+
envelope.payload,
|
|
168
|
+
self.state,
|
|
169
|
+
pipeline.computeDerived,
|
|
170
|
+
pipeline.innerRuntime,
|
|
171
|
+
pipeline.innerInput,
|
|
172
|
+
pipeline.innerConfig,
|
|
173
|
+
pipeline.coreLogic,
|
|
174
|
+
pipeline.output,
|
|
175
|
+
);
|
|
176
|
+
await outputResult;
|
|
131
177
|
};
|
|
132
178
|
}
|
|
@@ -12,8 +12,8 @@ import type {
|
|
|
12
12
|
ActorDef,
|
|
13
13
|
ActorRef,
|
|
14
14
|
ActorLogEntry,
|
|
15
|
-
} from '../core/types';
|
|
16
|
-
import { ActorSystem } from '../core/ActorSystem';
|
|
15
|
+
} from '../core/types.js';
|
|
16
|
+
import { ActorSystem } from '../core/ActorSystem.js';
|
|
17
17
|
|
|
18
18
|
// ─── Plugin ──────────────────────────────────────────────────────────
|
|
19
19
|
|