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,188 @@
1
+ import type { InstructionStack, OperandStack } from './stack.js';
2
+
3
+ export interface KernelInstruction<TOpcode extends string = string, TMemo = unknown> {
4
+ opcode: TOpcode;
5
+ memo?: TMemo;
6
+ comment?: string;
7
+ }
8
+
9
+ export interface DispatchContext<TRuntime, TInstruction extends KernelInstruction, TValue> {
10
+ runtime: TRuntime;
11
+ instructionStack: InstructionStack<TInstruction>;
12
+ operandStack: OperandStack<TValue>;
13
+ }
14
+
15
+ export type InstructionHandler<
16
+ TRuntime,
17
+ TInstruction extends KernelInstruction,
18
+ TValue,
19
+ TEffect = unknown,
20
+ > = (args: {
21
+ runtime: TRuntime;
22
+ instruction: TInstruction;
23
+ instructionStack: InstructionStack<TInstruction>;
24
+ operandStack: OperandStack<TValue>;
25
+ }) => void | DispatchHandlerResult<TEffect>;
26
+
27
+ export interface DispatchHandlerResult<TEffect = unknown> {
28
+ effects?: TEffect[];
29
+ stop?: boolean;
30
+ stopReason?: string;
31
+ yield?: boolean;
32
+ yieldReason?: string;
33
+ }
34
+
35
+ export type InstructionHandlerResolver<
36
+ TRuntime,
37
+ TInstruction extends KernelInstruction,
38
+ TValue,
39
+ TEffect = unknown,
40
+ > = (opcode: TInstruction['opcode']) =>
41
+ | InstructionHandler<TRuntime, TInstruction, TValue, TEffect>
42
+ | undefined;
43
+
44
+ export interface DispatchOptions {
45
+ maxInstructions?: number;
46
+ shouldStop?: (args: { executed: number }) => string | false | undefined;
47
+ hooks?: DispatchLifecycleHooks<KernelInstruction, unknown>;
48
+ }
49
+
50
+ export interface InstructionExecLog<TInstruction extends KernelInstruction> {
51
+ instruction: TInstruction;
52
+ result: 'ok' | 'stop' | 'yield' | 'missing_handler' | 'error';
53
+ error?: string;
54
+ }
55
+
56
+ export type DispatchStopReason =
57
+ | 'instruction_stack_empty'
58
+ | 'budget_exhausted'
59
+ | 'handler_requested_stop'
60
+ | 'yield_requested'
61
+ | 'missing_handler'
62
+ | 'error'
63
+ | 'custom';
64
+
65
+ export type DispatchInstructionResult = InstructionExecLog<KernelInstruction>['result'];
66
+
67
+ export interface DispatchLifecycleHooks<
68
+ TInstruction extends KernelInstruction = KernelInstruction,
69
+ TEffect = unknown,
70
+ > {
71
+ beforeInstruction?: (args: { instruction: TInstruction; executed: number }) => void;
72
+ afterInstruction?: (args: {
73
+ instruction: TInstruction;
74
+ executed: number;
75
+ result: DispatchInstructionResult;
76
+ }) => void;
77
+ onHandlerEffects?: (args: { instruction: TInstruction; effects: TEffect[]; executed: number }) => void;
78
+ onStop?: (args: {
79
+ stopReason: DispatchStopReason;
80
+ stopDetail?: string;
81
+ executed: number;
82
+ }) => void;
83
+ }
84
+
85
+ export interface DispatchResult<TInstruction extends KernelInstruction, TEffect = unknown> {
86
+ executed: number;
87
+ stopReason: DispatchStopReason;
88
+ stopDetail?: string;
89
+ effects: TEffect[];
90
+ trace: InstructionExecLog<TInstruction>[];
91
+ error?: unknown;
92
+ }
93
+
94
+ export function dispatchInstructions<
95
+ TRuntime,
96
+ TInstruction extends KernelInstruction,
97
+ TValue,
98
+ TEffect = unknown,
99
+ >(
100
+ context: DispatchContext<TRuntime, TInstruction, TValue>,
101
+ resolveHandler: InstructionHandlerResolver<TRuntime, TInstruction, TValue, TEffect>,
102
+ options?: DispatchOptions & { hooks?: DispatchLifecycleHooks<TInstruction, TEffect> },
103
+ ): DispatchResult<TInstruction, TEffect> {
104
+ const maxInstructions = options?.maxInstructions ?? Number.POSITIVE_INFINITY;
105
+ const effects: TEffect[] = [];
106
+ const trace: InstructionExecLog<TInstruction>[] = [];
107
+ let executed = 0;
108
+
109
+ const finish = (
110
+ stopReason: DispatchStopReason,
111
+ stopDetail?: string,
112
+ error?: unknown,
113
+ ): DispatchResult<TInstruction, TEffect> => {
114
+ options?.hooks?.onStop?.({ stopReason, stopDetail, executed });
115
+ const result: DispatchResult<TInstruction, TEffect> = { executed, stopReason, effects, trace };
116
+ if (stopDetail !== undefined) {
117
+ result.stopDetail = stopDetail;
118
+ }
119
+ if (error !== undefined) {
120
+ result.error = error;
121
+ }
122
+ return result;
123
+ };
124
+
125
+ while (executed < maxInstructions) {
126
+ const customStop = options?.shouldStop?.({ executed });
127
+ if (customStop) {
128
+ return finish('custom', customStop);
129
+ }
130
+
131
+ const instruction = context.instructionStack.pop();
132
+ if (!instruction) {
133
+ return finish('instruction_stack_empty');
134
+ }
135
+
136
+ options?.hooks?.beforeInstruction?.({ instruction, executed });
137
+
138
+ const handler = resolveHandler(instruction.opcode);
139
+ if (!handler) {
140
+ trace.push({ instruction, result: 'missing_handler' });
141
+ options?.hooks?.afterInstruction?.({ instruction, executed, result: 'missing_handler' });
142
+ return finish('missing_handler');
143
+ }
144
+
145
+ try {
146
+ const handlerResult = handler({
147
+ runtime: context.runtime,
148
+ instruction,
149
+ instructionStack: context.instructionStack,
150
+ operandStack: context.operandStack,
151
+ });
152
+ executed += 1;
153
+ if (handlerResult?.effects) {
154
+ effects.push(...handlerResult.effects);
155
+ options?.hooks?.onHandlerEffects?.({
156
+ instruction,
157
+ effects: handlerResult.effects,
158
+ executed,
159
+ });
160
+ }
161
+ if (handlerResult?.yield) {
162
+ trace.push({ instruction, result: 'yield' });
163
+ const stopDetail = handlerResult.yieldReason;
164
+ options?.hooks?.afterInstruction?.({ instruction, executed, result: 'yield' });
165
+ return finish('yield_requested', stopDetail);
166
+ }
167
+ if (handlerResult?.stop) {
168
+ trace.push({ instruction, result: 'stop' });
169
+ const stopDetail = handlerResult.stopReason;
170
+ const stopReason = stopDetail === undefined ? 'handler_requested_stop' : 'custom';
171
+ options?.hooks?.afterInstruction?.({ instruction, executed, result: 'stop' });
172
+ return finish(stopReason, stopDetail);
173
+ }
174
+ trace.push({ instruction, result: 'ok' });
175
+ options?.hooks?.afterInstruction?.({ instruction, executed, result: 'ok' });
176
+ } catch (error) {
177
+ trace.push({
178
+ instruction,
179
+ result: 'error',
180
+ error: error instanceof Error ? error.message : String(error),
181
+ });
182
+ options?.hooks?.afterInstruction?.({ instruction, executed, result: 'error' });
183
+ return finish('error', undefined, error);
184
+ }
185
+ }
186
+
187
+ return finish('budget_exhausted');
188
+ }
@@ -0,0 +1,58 @@
1
+ export type {
2
+ StackMachine,
3
+ StackMachineState,
4
+ InstructionStack,
5
+ OperandStack,
6
+ } from './stack.js';
7
+ export {
8
+ createStackMachine,
9
+ createInstructionStack,
10
+ createOperandStack,
11
+ } from './stack.js';
12
+
13
+ export type {
14
+ CommandDeque,
15
+ CommandDequeDefinition,
16
+ CommandDequeGroup,
17
+ CommandDequeGroupMutationResult,
18
+ CommandDequeGroupOptions,
19
+ CommandDequeGroupState,
20
+ CommandDequeId,
21
+ CommandDequeItem,
22
+ CommandDequeOptions,
23
+ CommandDequeSelection,
24
+ CommandDequeSelector,
25
+ CommandDequeState,
26
+ CommandDequeMutationResult,
27
+ PushCommandOptions,
28
+ PushCommandToDequeOptions,
29
+ SelectedCommandDequeItem,
30
+ } from './commandDeque.js';
31
+ export {
32
+ createCommandDeque,
33
+ createCommandDequeGroup,
34
+ defaultCommandDequeSelector,
35
+ drainCommandDequeFromGroup,
36
+ drainWhereCommandDequeFromGroup,
37
+ popBackCommand,
38
+ popFrontCommand,
39
+ popNextCommand,
40
+ popSelectedCommandFromGroup,
41
+ pushBackCommand,
42
+ pushBackCommandToGroup,
43
+ pushFrontCommand,
44
+ pushFrontCommandToGroup,
45
+ takeNextCommandFromGroup,
46
+ } from './commandDeque.js';
47
+
48
+ export type {
49
+ DispatchContext,
50
+ DispatchHandlerResult,
51
+ DispatchOptions,
52
+ DispatchResult,
53
+ InstructionExecLog,
54
+ InstructionHandler,
55
+ InstructionHandlerResolver,
56
+ KernelInstruction,
57
+ } from './dispatcher.js';
58
+ export { dispatchInstructions } from './dispatcher.js';
@@ -0,0 +1,130 @@
1
+ export interface StackMachineState<TItem> {
2
+ items: TItem[];
3
+ frameBottoms: number[];
4
+ }
5
+
6
+ export interface StackMachine<TItem> {
7
+ readonly size: number;
8
+ readonly frameDepth: number;
9
+ push(value: TItem): void;
10
+ pushItems(values: Iterable<TItem>): void;
11
+ pop(): TItem | undefined;
12
+ peek(): TItem | undefined;
13
+ pushFrame(): void;
14
+ popFrameAllValues(): TItem[];
15
+ popFrameAndPushTopValue(): TItem | undefined;
16
+ peekBottomOfAllFrames(): TItem | undefined;
17
+ snapshot(): StackMachineState<TItem>;
18
+ loadSnapshot(state: StackMachineState<TItem>): void;
19
+ }
20
+
21
+ class ArrayStackMachine<TItem> implements StackMachine<TItem> {
22
+ private readonly items: TItem[];
23
+ private readonly frameBottoms: number[];
24
+
25
+ constructor(state?: StackMachineState<TItem>) {
26
+ this.items = [...(state?.items ?? [])];
27
+ this.frameBottoms = [...(state?.frameBottoms ?? [])];
28
+ this.validateFrameBottoms();
29
+ }
30
+
31
+ get size(): number {
32
+ return this.items.length;
33
+ }
34
+
35
+ get frameDepth(): number {
36
+ return this.frameBottoms.length;
37
+ }
38
+
39
+ push(value: TItem): void {
40
+ this.items.push(value);
41
+ }
42
+
43
+ pushItems(values: Iterable<TItem>): void {
44
+ for (const value of values) {
45
+ this.push(value);
46
+ }
47
+ }
48
+
49
+ pop(): TItem | undefined {
50
+ return this.items.pop();
51
+ }
52
+
53
+ peek(): TItem | undefined {
54
+ return this.items.at(-1);
55
+ }
56
+
57
+ pushFrame(): void {
58
+ this.frameBottoms.push(this.items.length);
59
+ }
60
+
61
+ popFrameAllValues(): TItem[] {
62
+ const frameBottom = this.popFrameBottom();
63
+ return this.items.splice(frameBottom);
64
+ }
65
+
66
+ popFrameAndPushTopValue(): TItem | undefined {
67
+ const values = this.popFrameAllValues();
68
+ const topValue = values.at(-1);
69
+ if (topValue !== undefined) {
70
+ this.items.push(topValue);
71
+ }
72
+ return topValue;
73
+ }
74
+
75
+ peekBottomOfAllFrames(): TItem | undefined {
76
+ return this.items[0];
77
+ }
78
+
79
+ snapshot(): StackMachineState<TItem> {
80
+ return {
81
+ items: [...this.items],
82
+ frameBottoms: [...this.frameBottoms],
83
+ };
84
+ }
85
+
86
+ loadSnapshot(state: StackMachineState<TItem>): void {
87
+ this.items.splice(0, this.items.length, ...(state.items ?? []));
88
+ this.frameBottoms.splice(0, this.frameBottoms.length, ...(state.frameBottoms ?? []));
89
+ this.validateFrameBottoms();
90
+ }
91
+
92
+ private popFrameBottom(): number {
93
+ const frameBottom = this.frameBottoms.pop();
94
+ if (frameBottom === undefined) {
95
+ throw new Error('Cannot pop frame: no frame is open');
96
+ }
97
+ return frameBottom;
98
+ }
99
+
100
+ private validateFrameBottoms(): void {
101
+ let previous = 0;
102
+ for (const frameBottom of this.frameBottoms) {
103
+ if (!Number.isInteger(frameBottom) || frameBottom < previous || frameBottom > this.items.length) {
104
+ throw new Error(`Invalid frame bottom index: ${frameBottom}`);
105
+ }
106
+ previous = frameBottom;
107
+ }
108
+ }
109
+ }
110
+
111
+ export type InstructionStack<TInstruction> = StackMachine<TInstruction>;
112
+ export type OperandStack<TValue> = StackMachine<TValue>;
113
+
114
+ export function createStackMachine<TItem>(
115
+ state?: StackMachineState<TItem>,
116
+ ): StackMachine<TItem> {
117
+ return new ArrayStackMachine(state);
118
+ }
119
+
120
+ export function createInstructionStack<TInstruction>(
121
+ state?: StackMachineState<TInstruction>,
122
+ ): InstructionStack<TInstruction> {
123
+ return createStackMachine(state);
124
+ }
125
+
126
+ export function createOperandStack<TValue>(
127
+ state?: StackMachineState<TValue>,
128
+ ): OperandStack<TValue> {
129
+ return createStackMachine(state);
130
+ }
package/src/index.ts CHANGED
@@ -11,22 +11,22 @@ export type {
11
11
  ActorDef,
12
12
  ActorLogKind,
13
13
  ActorLogEntry,
14
- } from './core/types';
14
+ } from './core/types.js';
15
15
 
16
- export { ActorSystem } from './core/ActorSystem';
16
+ export { ActorSystem } from './core/ActorSystem.js';
17
17
 
18
18
  // depa-actor — Runtime
19
- export type { ActorPlugin } from './runtime/ActorRuntime';
20
- export { ActorRuntime } from './runtime/ActorRuntime';
19
+ export type { ActorPlugin } from './runtime/ActorRuntime.js';
20
+ export { ActorRuntime } from './runtime/ActorRuntime.js';
21
21
  export {
22
22
  CompletionSignalRegistry,
23
23
  CompletionBindingRegistry,
24
24
  createCompletionSignalRegistry,
25
25
  createCompletionBindingRegistry,
26
- } from './runtime/completion';
26
+ } from './runtime/completion.js';
27
27
  export type {
28
28
  CompletionWaiter,
29
- } from './runtime/completion';
29
+ } from './runtime/completion.js';
30
30
  export type {
31
31
  SnapshotRecoveryState,
32
32
  RuntimeSnapshotManifestBase,
@@ -36,13 +36,65 @@ export type {
36
36
  SnapshotCodec,
37
37
  RecoveryHooks,
38
38
  PersistenceEffectPort,
39
- } from './runtime/snapshot';
39
+ } from './runtime/snapshot.js';
40
40
  export {
41
41
  createSnapshotCodec,
42
42
  createRecoveryHooks,
43
43
  createPersistenceEffectPort,
44
- } from './runtime/snapshot';
45
- export { RuntimeIndexHook, createRuntimeIndexHook } from './runtime/indexing';
44
+ } from './runtime/snapshot.js';
45
+ export { RuntimeIndexHook, createRuntimeIndexHook } from './runtime/indexing.js';
46
+
47
+ // depa-actor — Execution kernel primitives
48
+ export type {
49
+ StackMachine,
50
+ StackMachineState,
51
+ InstructionStack,
52
+ OperandStack,
53
+ CommandDeque,
54
+ CommandDequeDefinition,
55
+ CommandDequeGroup,
56
+ CommandDequeGroupMutationResult,
57
+ CommandDequeGroupOptions,
58
+ CommandDequeGroupState,
59
+ CommandDequeId,
60
+ CommandDequeItem,
61
+ CommandDequeOptions,
62
+ CommandDequeSelection,
63
+ CommandDequeSelector,
64
+ CommandDequeState,
65
+ CommandDequeMutationResult,
66
+ PushCommandOptions,
67
+ PushCommandToDequeOptions,
68
+ SelectedCommandDequeItem,
69
+ DispatchContext,
70
+ DispatchHandlerResult,
71
+ DispatchOptions,
72
+ DispatchResult,
73
+ InstructionExecLog,
74
+ InstructionHandler,
75
+ InstructionHandlerResolver,
76
+ KernelInstruction,
77
+ } from './execution/index.js';
78
+ export {
79
+ createStackMachine,
80
+ createInstructionStack,
81
+ createOperandStack,
82
+ createCommandDeque,
83
+ createCommandDequeGroup,
84
+ defaultCommandDequeSelector,
85
+ drainCommandDequeFromGroup,
86
+ drainWhereCommandDequeFromGroup,
87
+ popBackCommand,
88
+ popFrontCommand,
89
+ popNextCommand,
90
+ popSelectedCommandFromGroup,
91
+ pushBackCommand,
92
+ pushBackCommandToGroup,
93
+ pushFrontCommand,
94
+ pushFrontCommandToGroup,
95
+ takeNextCommandFromGroup,
96
+ dispatchInstructions,
97
+ } from './execution/index.js';
46
98
 
47
99
  // depa-actor — Pipeline (DOP bridge)
48
100
  export type {
@@ -53,12 +105,12 @@ export type {
53
105
  PipelineInnerConfigAdapter,
54
106
  PipelineCoreLogic,
55
107
  PipelineOutputAdapter,
56
- } from './pipeline/ActorPipeline';
57
- export { createPipelineHandler } from './pipeline/ActorPipeline';
108
+ } from './pipeline/ActorPipeline.js';
109
+ export { createPipelineHandler } from './pipeline/ActorPipeline.js';
58
110
 
59
111
  // depa-actor — Dispatch bridge
60
- export type { DispatchRoute } from './dispatch/ActorDispatchAdapter';
61
- export { createDispatchHandler } from './dispatch/ActorDispatchAdapter';
112
+ export type { DispatchRoute } from './dispatch/ActorDispatchAdapter.js';
113
+ export { createDispatchHandler } from './dispatch/ActorDispatchAdapter.js';
62
114
 
63
115
  // depa-actor — Orchestration (Fiber Scheduling)
64
116
  export type {
@@ -77,7 +129,7 @@ export type {
77
129
  FiberEffect,
78
130
  ReduceResult,
79
131
  ScheduleResult,
80
- } from './orchestration';
132
+ } from './orchestration/index.js';
81
133
 
82
134
  export {
83
135
  DEFAULT_ORCHESTRATOR_OPTIONS,
@@ -89,4 +141,4 @@ export {
89
141
  scheduleOne,
90
142
  createAiAgentSchedulerHooks,
91
143
  dispatchEffects,
92
- } from './orchestration';
144
+ } from './orchestration/index.js';
@@ -15,21 +15,21 @@ export type {
15
15
  FiberAction,
16
16
  FiberEffect,
17
17
  ReduceResult,
18
- } from './types';
18
+ } from './types.js';
19
19
 
20
- export { DEFAULT_ORCHESTRATOR_OPTIONS } from './types';
20
+ export { DEFAULT_ORCHESTRATOR_OPTIONS } from './types.js';
21
21
 
22
- export { createOrchestratorState, reduceOrchestrator } from './reducer';
22
+ export { createOrchestratorState, reduceOrchestrator } from './reducer.js';
23
23
 
24
- export { applyFailure } from './recovery';
24
+ export { applyFailure } from './recovery.js';
25
25
 
26
26
  export {
27
27
  computeEffectivePriority,
28
28
  selectNextFiberId,
29
29
  scheduleOne,
30
- } from './scheduler';
31
- export type { ScheduleResult } from './scheduler';
30
+ } from './scheduler.js';
31
+ export type { ScheduleResult } from './scheduler.js';
32
32
 
33
- export { createAiAgentSchedulerHooks } from './presets/aiAgent';
33
+ export { createAiAgentSchedulerHooks } from './presets/aiAgent.js';
34
34
 
35
- export { dispatchEffects } from './runtimeAdapter';
35
+ export { dispatchEffects } from './runtimeAdapter.js';
@@ -1,6 +1,6 @@
1
- import type { MailboxSchema } from '../../core/types';
1
+ import type { MailboxSchema } from '../../core/types.js';
2
2
 
3
- import type { FiberRecord, OrchestratorState, SchedulerHooks, SuspendPolicy } from '../types';
3
+ import type { FiberRecord, OrchestratorState, SchedulerHooks, SuspendPolicy } from '../types.js';
4
4
 
5
5
  function isAiHumanWaitReason(reason: unknown): boolean {
6
6
  return reason === 'human_clarification' || reason === 'human_approval' || reason === 'human_answer';
@@ -1,5 +1,5 @@
1
- import type { MailboxSchema } from '../core/types';
2
- import type { FiberEffect, FiberId, FiberRecord, OrchestratorState, ReduceResult } from './types';
1
+ import type { MailboxSchema } from '../core/types.js';
2
+ import type { FiberEffect, FiberId, FiberRecord, OrchestratorState, ReduceResult } from './types.js';
3
3
 
4
4
  function cloneFiberMap<TSchema extends MailboxSchema>(
5
5
  state: OrchestratorState<TSchema>,
@@ -1,5 +1,5 @@
1
- import type { MailboxSchema } from '../core/types';
2
- import { applyFailure } from './recovery';
1
+ import type { MailboxSchema } from '../core/types.js';
2
+ import { applyFailure } from './recovery.js';
3
3
  import {
4
4
  DEFAULT_ORCHESTRATOR_OPTIONS,
5
5
  type FiberAction,
@@ -10,7 +10,7 @@ import {
10
10
  type ReduceResult,
11
11
  type SpawnFiberInput,
12
12
  type SuspendPolicy,
13
- } from './types';
13
+ } from './types.js';
14
14
 
15
15
  function isTerminalStatus(status: FiberRecord<MailboxSchema>['status']): boolean {
16
16
  return status === 'completed' || status === 'cancelled' || status === 'failed' || status === 'dead_letter';
@@ -1,6 +1,6 @@
1
- import type { MailboxSchema } from '../core/types';
2
- import type { ActorRuntime } from '../runtime/ActorRuntime';
3
- import type { FiberEffect } from './types';
1
+ import type { MailboxSchema } from '../core/types.js';
2
+ import type { ActorRuntime } from '../runtime/ActorRuntime.js';
3
+ import type { FiberEffect } from './types.js';
4
4
 
5
5
  export function dispatchEffects<TRuntime, TSchema extends MailboxSchema>(
6
6
  runtime: ActorRuntime<TRuntime, TSchema>,
@@ -1,5 +1,5 @@
1
- import type { MailboxSchema } from '../core/types';
2
- import type { FiberEffect, FiberId, FiberRecord, OrchestratorState } from './types';
1
+ import type { MailboxSchema } from '../core/types.js';
2
+ import type { FiberEffect, FiberId, FiberRecord, OrchestratorState } from './types.js';
3
3
 
4
4
  export interface ScheduleResult<TSchema extends MailboxSchema> {
5
5
  state: OrchestratorState<TSchema>;
@@ -1,4 +1,4 @@
1
- import type { MailboxSchema } from '../core/types';
1
+ import type { MailboxSchema } from '../core/types.js';
2
2
 
3
3
  export type FiberId = string;
4
4
 
@@ -15,7 +15,7 @@ import type {
15
15
  MailboxSchema,
16
16
  ActorSelf,
17
17
  ActorHandler,
18
- } from '../core/types';
18
+ } from '../core/types.js';
19
19
 
20
20
  // ─── Pipeline Adapter Types ──────────────────────────────────────────
21
21
 
@@ -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