depa-actor 0.2.0 → 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.
@@ -2,33 +2,43 @@
2
2
  /**
3
3
  * depa-actor — ActorPipeline
4
4
  *
5
- * Adapts the DOP 6-step pipeline (from depa-processor) to actor context.
5
+ * Adapts the DOP 6-step pipeline to actor context by REUSING the depa-processor
6
+ * `component` primitives (DEPA dimension chain Processor → Actor): the 6-step
7
+ * orchestration is delegated to `runByFuncStyleAdapter`, identity/null seams come
8
+ * from `stdMake*`, and the core-logic seam is `StdInnerLogic` verbatim — this module
9
+ * no longer re-implements a parallel copy of `component/types.ts`.
6
10
  *
7
- * Mapping:
11
+ * Mapping (outer dimension):
8
12
  * OuterRuntime = ActorSelf
9
13
  * OuterInput = envelope payload
10
14
  * OuterConfig = actor state
11
15
  *
16
+ * Step 6 (output) is adapted with `TOuterOutput = void`: actor output is a side
17
+ * effect (write `self.state` / `self.send`), not a returned value. This thinly
18
+ * adapts depa-processor's pure-function `StdOuterOutputAdapter` without leaking
19
+ * actor semantics back into the generic primitive.
20
+ *
12
21
  * createPipelineHandler() wraps a pipeline definition into an ActorHandler.
13
22
  */
14
23
  Object.defineProperty(exports, "__esModule", { value: true });
15
24
  exports.createPipelineHandler = createPipelineHandler;
25
+ const depa_processor_1 = require("depa-processor");
16
26
  // ─── createPipelineHandler ───────────────────────────────────────────
27
+ /**
28
+ * Wrap a pipeline definition into an ActorHandler by delegating the 6-step
29
+ * orchestration to depa-processor `runByFuncStyleAdapter`.
30
+ *
31
+ * Outer dimension: runtime = self, input = payload, config = state.
32
+ * Step 6 produces `void` — `runByFuncStyleAdapter` runs the output adapter for its
33
+ * side effects and the (void) return value is discarded.
34
+ */
17
35
  function createPipelineHandler(pipeline) {
18
36
  return async (self, envelope) => {
19
- const payload = envelope.payload;
20
- const state = self.state;
21
- // Step 1: Compute derived
22
- const derived = pipeline.computeDerived(self, payload, state);
23
- // Step 2: Transform runtime
24
- const innerRuntime = pipeline.innerRuntime(self, payload, state, derived);
25
- // Step 3: Transform input
26
- const innerInput = pipeline.innerInput(self, payload, state, derived);
27
- // Step 4: Transform config
28
- const innerConfig = pipeline.innerConfig(self, payload, state, derived);
29
- // Step 5: Core logic
30
- const innerOutput = await pipeline.coreLogic(innerRuntime, innerInput, innerConfig);
31
- // Step 6: Output (side effects on actor state / send messages)
32
- await pipeline.output(self, payload, state, derived, innerOutput);
37
+ // `runByFuncStyleAdapter` returns the output adapter's value verbatim (without
38
+ // awaiting it). Capture it and await so an async step-6 side effect (write
39
+ // state / send messages) is fully settled before the handler resolves —
40
+ // preserving the original `await pipeline.output(...)` semantics.
41
+ const outputResult = await (0, depa_processor_1.runByFuncStyleAdapter)(self, envelope.payload, self.state, pipeline.computeDerived, pipeline.innerRuntime, pipeline.innerInput, pipeline.innerConfig, pipeline.coreLogic, pipeline.output);
42
+ await outputResult;
33
43
  };
34
44
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "depa-actor",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "type": "module",
5
5
  "main": "./dist-cjs/index.cjs",
6
6
  "module": "./dist/index.js",
@@ -17,6 +17,9 @@
17
17
  "dist-cjs",
18
18
  "src"
19
19
  ],
20
+ "dependencies": {
21
+ "depa-processor": "0.1.1"
22
+ },
20
23
  "scripts": {
21
24
  "build": "tsc && tsc -p tsconfig.cjs.json && node scripts/build-cjs.mjs",
22
25
  "dev": "tsc --watch",