@obora/runtime 0.1.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/LICENSE +21 -0
- package/README.md +183 -0
- package/dist/_legacy/actor/base/BaseActor.d.ts +87 -0
- package/dist/_legacy/actor/pool/ActorPool.d.ts +194 -0
- package/dist/_legacy/actor/pool/NoOpMessageBus.d.ts +16 -0
- package/dist/_legacy/actor/pool/PoolManager.d.ts +76 -0
- package/dist/_legacy/actor/pool/index.d.ts +3 -0
- package/dist/_legacy/actor/runtime/ActorRunner.d.ts +54 -0
- package/dist/_legacy/actor/runtime/ActorRuntime.d.ts +161 -0
- package/dist/_legacy/actor/runtime/DefaultActorFactory.d.ts +44 -0
- package/dist/_legacy/actor/runtime/types.d.ts +41 -0
- package/dist/_legacy/actor/runtime/utils/delay.d.ts +7 -0
- package/dist/_legacy/actor/supervision/Supervisor.d.ts +102 -0
- package/dist/_legacy/actor/supervision/SupervisorTree.d.ts +54 -0
- package/dist/_legacy/actor/supervision/types.d.ts +130 -0
- package/dist/_legacy/actor/types/action.d.ts +65 -0
- package/dist/_legacy/actor/types/actor.d.ts +251 -0
- package/dist/_legacy/actor/types/blackboard.d.ts +46 -0
- package/dist/_legacy/actor/types/crypto.d.ts +6 -0
- package/dist/_legacy/actor/types/message.d.ts +209 -0
- package/dist/_legacy/actor/types/metrics.d.ts +43 -0
- package/dist/_legacy/actor/types/observation.d.ts +45 -0
- package/dist/_legacy/actor/types/result.d.ts +110 -0
- package/dist/_legacy/agents/roles/analyst-agent.d.ts +18 -0
- package/dist/_legacy/agents/roles/base-agent.d.ts +320 -0
- package/dist/_legacy/agents/roles/director-agent.d.ts +26 -0
- package/dist/_legacy/agents/roles/executor-agent.d.ts +26 -0
- package/dist/_legacy/agents/roles/factory.d.ts +30 -0
- package/dist/_legacy/agents/roles/index.d.ts +6 -0
- package/dist/_legacy/agents/roles/verifier-agent.d.ts +18 -0
- package/dist/_legacy/blackboard/core/accessors/decisions-accessor.d.ts +190 -0
- package/dist/_legacy/blackboard/core/accessors/index.d.ts +7 -0
- package/dist/_legacy/blackboard/core/accessors/knowledge-accessor.d.ts +154 -0
- package/dist/_legacy/blackboard/core/accessors/state-accessor.d.ts +173 -0
- package/dist/_legacy/blackboard/core/blackboard-events.d.ts +105 -0
- package/dist/_legacy/blackboard/core/blackboard.d.ts +286 -0
- package/dist/_legacy/blackboard/core/id-generator.d.ts +53 -0
- package/dist/_legacy/blackboard/core/immutable.d.ts +45 -0
- package/dist/_legacy/blackboard/core/index.d.ts +13 -0
- package/dist/_legacy/blackboard/core/path-utils.d.ts +75 -0
- package/dist/_legacy/blackboard/core/tkg.d.ts +50 -0
- package/dist/_legacy/blackboard/core/versioning.d.ts +80 -0
- package/dist/_legacy/blackboard/domains/agenda/AgendaStore.d.ts +34 -0
- package/dist/_legacy/blackboard/domains/agenda/events.d.ts +12 -0
- package/dist/_legacy/blackboard/domains/agenda/index.d.ts +6 -0
- package/dist/_legacy/blackboard/domains/agenda/types.d.ts +26 -0
- package/dist/_legacy/blackboard/domains/consensus/ConsensusRuleEngine.d.ts +10 -0
- package/dist/_legacy/blackboard/domains/consensus/index.d.ts +4 -0
- package/dist/_legacy/blackboard/domains/consensus/types.d.ts +27 -0
- package/dist/_legacy/blackboard/domains/tkg/InMemoryTKG.d.ts +38 -0
- package/dist/_legacy/blackboard/domains/tkg/JsonFileReflectorStateStore.d.ts +9 -0
- package/dist/_legacy/blackboard/domains/tkg/ObserverReflector.d.ts +114 -0
- package/dist/_legacy/blackboard/domains/tkg/index.d.ts +4 -0
- package/dist/_legacy/blackboard/domains/voting/VotingSessionStore.d.ts +14 -0
- package/dist/_legacy/blackboard/domains/voting/index.d.ts +3 -0
- package/dist/_legacy/blackboard/domains/voting/types.d.ts +32 -0
- package/dist/_legacy/blackboard/events/event-bus.d.ts +254 -0
- package/dist/_legacy/blackboard/events/event-factory.d.ts +80 -0
- package/dist/_legacy/blackboard/events/index.d.ts +17 -0
- package/dist/_legacy/blackboard/events/types.d.ts +554 -0
- package/dist/_legacy/blackboard/snapshot/compression.d.ts +170 -0
- package/dist/_legacy/blackboard/snapshot/id-utils.d.ts +20 -0
- package/dist/_legacy/blackboard/snapshot/index.d.ts +21 -0
- package/dist/_legacy/blackboard/snapshot/serializer.d.ts +123 -0
- package/dist/_legacy/blackboard/snapshot/snapshot-comparer.d.ts +102 -0
- package/dist/_legacy/blackboard/snapshot/snapshot-creator.d.ts +49 -0
- package/dist/_legacy/blackboard/snapshot/snapshot-manager.d.ts +253 -0
- package/dist/_legacy/blackboard/snapshot/snapshot-restorer.d.ts +54 -0
- package/dist/_legacy/blackboard/snapshot/snapshot-serializer.d.ts +45 -0
- package/dist/_legacy/blackboard/snapshot/snapshot-validator.d.ts +55 -0
- package/dist/_legacy/blackboard/snapshot/type-guards.d.ts +12 -0
- package/dist/_legacy/blackboard/snapshot/types.d.ts +151 -0
- package/dist/_legacy/blackboard/snapshot/utils.d.ts +20 -0
- package/dist/_legacy/blackboard/types/agent.d.ts +89 -0
- package/dist/_legacy/blackboard/types/base.d.ts +213 -0
- package/dist/_legacy/blackboard/types/blackboard.d.ts +217 -0
- package/dist/_legacy/blackboard/types/decision.d.ts +260 -0
- package/dist/_legacy/blackboard/types/index.d.ts +12 -0
- package/dist/_legacy/blackboard/types/knowledge.d.ts +224 -0
- package/dist/_legacy/blackboard/types/message.d.ts +162 -0
- package/dist/_legacy/blackboard/types/task.d.ts +154 -0
- package/dist/_legacy/blackboard/types/tkg.d.ts +189 -0
- package/dist/_legacy/blackboard/workflow/meeting-state-machine/MeetingStateMachine.d.ts +22 -0
- package/dist/_legacy/blackboard/workflow/meeting-state-machine/types.d.ts +30 -0
- package/dist/_legacy/cli-runtime/runtime/agent-registry.d.ts +33 -0
- package/dist/_legacy/cli-runtime/runtime/blackboard.d.ts +41 -0
- package/dist/_legacy/cli-runtime/runtime/context-builder.d.ts +88 -0
- package/dist/_legacy/cli-runtime/runtime/retry-policy.d.ts +8 -0
- package/dist/_legacy/cli-runtime/runtime/step-executor.d.ts +33 -0
- package/dist/_legacy/cli-runtime/runtime/types.d.ts +12 -0
- package/dist/_legacy/cli-runtime/runtime/utils.d.ts +2 -0
- package/dist/_legacy/database/src/duckdb-client.d.ts +178 -0
- package/dist/_legacy/workflow/errors/diagnosis.d.ts +32 -0
- package/dist/_legacy/workflow/errors/index.d.ts +52 -0
- package/dist/_legacy/workflow/graph/index.d.ts +57 -0
- package/dist/_legacy/workflow/index.d.ts +9 -0
- package/dist/_legacy/workflow/parser/workflow-parser.d.ts +13 -0
- package/dist/_legacy/workflow/resolver/dependency-resolver.d.ts +83 -0
- package/dist/_legacy/workflow/types/workflow.d.ts +173 -0
- package/dist/_legacy/workflow/utils.d.ts +2 -0
- package/dist/_legacy/workflow/validator/workflow-validator.d.ts +71 -0
- package/dist/artifacts/index.d.ts +2 -0
- package/dist/artifacts/local-file-artifact-store.d.ts +22 -0
- package/dist/artifacts/types.d.ts +19 -0
- package/dist/audit/AuditReplay.d.ts +4 -0
- package/dist/audit/AuditStore.d.ts +13 -0
- package/dist/audit/AuditTrail.d.ts +28 -0
- package/dist/audit/DefaultAuditRecorder.d.ts +10 -0
- package/dist/audit/EventBusAdapter.d.ts +12 -0
- package/dist/audit/InMemoryAuditStore.d.ts +9 -0
- package/dist/audit/ReExecutionDiffReport.d.ts +24 -0
- package/dist/audit/ReExecutionPlanner.d.ts +30 -0
- package/dist/audit/ReExecutionRuntime.d.ts +35 -0
- package/dist/audit/database-api.d.ts +32 -0
- package/dist/audit/database-index.d.ts +5 -0
- package/dist/audit/event-bus.d.ts +1 -0
- package/dist/audit/event-factory.d.ts +1 -0
- package/dist/audit/index.d.ts +12 -0
- package/dist/audit/testing.d.ts +15 -0
- package/dist/audit/tkg/InMemoryTKG.d.ts +1 -0
- package/dist/audit/tkg/JsonFileReflectorStateStore.d.ts +1 -0
- package/dist/audit/tkg/ObserverReflector.d.ts +1 -0
- package/dist/audit/tkg/index.d.ts +1 -0
- package/dist/audit/types.d.ts +23 -0
- package/dist/blackboard/core/accessors/decisions-accessor.d.ts +190 -0
- package/dist/blackboard/core/accessors/index.d.ts +7 -0
- package/dist/blackboard/core/accessors/knowledge-accessor.d.ts +154 -0
- package/dist/blackboard/core/accessors/state-accessor.d.ts +173 -0
- package/dist/blackboard/core/blackboard-events.d.ts +105 -0
- package/dist/blackboard/core/blackboard.d.ts +286 -0
- package/dist/blackboard/core/id-generator.d.ts +53 -0
- package/dist/blackboard/core/immutable.d.ts +45 -0
- package/dist/blackboard/core/index.d.ts +13 -0
- package/dist/blackboard/core/path-utils.d.ts +75 -0
- package/dist/blackboard/core/tkg.d.ts +50 -0
- package/dist/blackboard/core/versioning.d.ts +80 -0
- package/dist/blackboard/events/event-bus.d.ts +254 -0
- package/dist/blackboard/events/event-factory.d.ts +80 -0
- package/dist/blackboard/events/index.d.ts +17 -0
- package/dist/blackboard/events/types.d.ts +554 -0
- package/dist/blackboard/index.d.ts +20 -0
- package/dist/blackboard/observer-reflector.d.ts +114 -0
- package/dist/blackboard/snapshot/compression.d.ts +170 -0
- package/dist/blackboard/snapshot/id-utils.d.ts +20 -0
- package/dist/blackboard/snapshot/index.d.ts +21 -0
- package/dist/blackboard/snapshot/serializer.d.ts +123 -0
- package/dist/blackboard/snapshot/snapshot-comparer.d.ts +102 -0
- package/dist/blackboard/snapshot/snapshot-creator.d.ts +49 -0
- package/dist/blackboard/snapshot/snapshot-manager.d.ts +253 -0
- package/dist/blackboard/snapshot/snapshot-restorer.d.ts +54 -0
- package/dist/blackboard/snapshot/snapshot-serializer.d.ts +45 -0
- package/dist/blackboard/snapshot/snapshot-validator.d.ts +55 -0
- package/dist/blackboard/snapshot/type-guards.d.ts +12 -0
- package/dist/blackboard/snapshot/types.d.ts +151 -0
- package/dist/blackboard/snapshot/utils.d.ts +20 -0
- package/dist/blackboard/types/agent.d.ts +89 -0
- package/dist/blackboard/types/base.d.ts +213 -0
- package/dist/blackboard/types/blackboard.d.ts +217 -0
- package/dist/blackboard/types/decision.d.ts +260 -0
- package/dist/blackboard/types/index.d.ts +12 -0
- package/dist/blackboard/types/knowledge.d.ts +224 -0
- package/dist/blackboard/types/message.d.ts +162 -0
- package/dist/blackboard/types/task.d.ts +154 -0
- package/dist/blackboard/types/tkg.d.ts +189 -0
- package/dist/cell/ActorPool.d.ts +1 -0
- package/dist/cell/AgentFactory.d.ts +1 -0
- package/dist/cell/AgentRegistry.d.ts +1 -0
- package/dist/cell/BaseActor.d.ts +1 -0
- package/dist/cell/CellContext.d.ts +39 -0
- package/dist/cell/CellManager.d.ts +80 -0
- package/dist/cell/ExecutionCell.d.ts +44 -0
- package/dist/cell/PoolManager.d.ts +1 -0
- package/dist/cell/actor-types/action.d.ts +65 -0
- package/dist/cell/actor-types/actor.d.ts +251 -0
- package/dist/cell/actor-types/blackboard.d.ts +46 -0
- package/dist/cell/actor-types/crypto.d.ts +6 -0
- package/dist/cell/actor-types/index.d.ts +12 -0
- package/dist/cell/actor-types/message.d.ts +209 -0
- package/dist/cell/actor-types/metrics.d.ts +43 -0
- package/dist/cell/actor-types/observation.d.ts +45 -0
- package/dist/cell/actor-types/result.d.ts +110 -0
- package/dist/cell/agents/AnalystCellAgent.d.ts +2 -0
- package/dist/cell/agents/BaseRuntimeAgent.d.ts +2 -0
- package/dist/cell/agents/DirectorCellAgent.d.ts +2 -0
- package/dist/cell/agents/ExecutorCellAgent.d.ts +2 -0
- package/dist/cell/agents/VerifierCellAgent.d.ts +2 -0
- package/dist/cell/agents/index.d.ts +5 -0
- package/dist/cell/index.d.ts +9 -0
- package/dist/cell/internal/ActorRunnerAdapter.d.ts +2 -0
- package/dist/cell/internal/CellActorFactory.d.ts +2 -0
- package/dist/cell/internal/NoOpRuntimeBus.d.ts +2 -0
- package/dist/cell/internal/delay.d.ts +1 -0
- package/dist/cell/pool-index.d.ts +1 -0
- package/dist/cell/types.d.ts +47 -0
- package/dist/checkpoint/CheckpointFactoryRegistry.d.ts +16 -0
- package/dist/checkpoint/CheckpointManager.d.ts +41 -0
- package/dist/checkpoint/index.d.ts +5 -0
- package/dist/checkpoint/policy-hash.d.ts +11 -0
- package/dist/consensus/ConsensusGate.d.ts +83 -0
- package/dist/consensus/ConsensusRuleEngine.d.ts +1 -0
- package/dist/consensus/agenda/AgendaStore.d.ts +1 -0
- package/dist/consensus/agenda/events.d.ts +1 -0
- package/dist/consensus/agenda/index.d.ts +1 -0
- package/dist/consensus/agenda/types.d.ts +1 -0
- package/dist/consensus/index.d.ts +2 -0
- package/dist/consensus/types.d.ts +1 -0
- package/dist/consensus/voting/VotingSessionStore.d.ts +1 -0
- package/dist/consensus/voting/index.d.ts +1 -0
- package/dist/consensus/voting/types.d.ts +1 -0
- package/dist/errors/OboraErrorCode.d.ts +28 -0
- package/dist/errors/index.d.ts +1 -0
- package/dist/gates/GateAssignment.d.ts +28 -0
- package/dist/gates/MultiStageApproval.d.ts +74 -0
- package/dist/gates/SLAManager.d.ts +21 -0
- package/dist/gates/index.d.ts +4 -0
- package/dist/gates/types.d.ts +19 -0
- package/dist/index.cjs +26588 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +39 -0
- package/dist/index.js +26330 -0
- package/dist/index.js.map +1 -0
- package/dist/judgment/JudgmentEngine.d.ts +24 -0
- package/dist/judgment/JudgmentNormalizer.d.ts +37 -0
- package/dist/judgment/JudgmentPolicy.d.ts +74 -0
- package/dist/judgment/JudgmentReporter.d.ts +70 -0
- package/dist/judgment/OperationalLogger.d.ts +68 -0
- package/dist/judgment/index.d.ts +6 -0
- package/dist/judgment/types.d.ts +42 -0
- package/dist/orchestrator/ExecutionContextBuilder.d.ts +1 -0
- package/dist/orchestrator/RuntimeOrchestrator.d.ts +94 -0
- package/dist/orchestrator/StepScheduler.d.ts +2 -0
- package/dist/orchestrator/index.d.ts +4 -0
- package/dist/orchestrator/types.d.ts +80 -0
- package/dist/orchestrator/utils.d.ts +1 -0
- package/dist/patterns/CustomPatternAPI.d.ts +10 -0
- package/dist/patterns/PatternRegistry.d.ts +19 -0
- package/dist/patterns/builtin/BrainstormPattern.d.ts +13 -0
- package/dist/patterns/builtin/CompositePattern.d.ts +11 -0
- package/dist/patterns/builtin/ConsensusPattern.d.ts +17 -0
- package/dist/patterns/builtin/DiscussionPattern.d.ts +13 -0
- package/dist/patterns/builtin/FanOutFanInPattern.d.ts +21 -0
- package/dist/patterns/builtin/PeerReviewPattern.d.ts +40 -0
- package/dist/patterns/builtin/PipelinePattern.d.ts +6 -0
- package/dist/patterns/builtin/RedBluePattern.d.ts +13 -0
- package/dist/patterns/builtin/SupervisorPattern.d.ts +13 -0
- package/dist/patterns/builtin/discussion/MeetingStateMachine.d.ts +1 -0
- package/dist/patterns/builtin/discussion/index.d.ts +2 -0
- package/dist/patterns/builtin/discussion/types.d.ts +1 -0
- package/dist/patterns/examples/OxfordDebatePattern.d.ts +11 -0
- package/dist/patterns/examples/index.d.ts +1 -0
- package/dist/patterns/index.d.ts +14 -0
- package/dist/patterns/resolveCustomPattern.d.ts +22 -0
- package/dist/patterns/types.d.ts +252 -0
- package/dist/plugins/PluginLoader.d.ts +16 -0
- package/dist/plugins/PluginRegistry.d.ts +15 -0
- package/dist/plugins/builtins.d.ts +137 -0
- package/dist/plugins/index.d.ts +5 -0
- package/dist/plugins/types.d.ts +52 -0
- package/dist/plugins/validator.d.ts +3 -0
- package/dist/policy/DefaultPolicyEngine.d.ts +43 -0
- package/dist/policy/DynamicPolicyContext.d.ts +21 -0
- package/dist/policy/DynamicQuotaEvaluator.d.ts +9 -0
- package/dist/policy/DynamicToolPolicy.d.ts +10 -0
- package/dist/policy/PolicyEngine.d.ts +14 -0
- package/dist/policy/PolicyLoader.d.ts +3 -0
- package/dist/policy/expressions/ExpressionEvaluator.d.ts +37 -0
- package/dist/policy/expressions/ExpressionParser.d.ts +35 -0
- package/dist/policy/expressions/constants.d.ts +5 -0
- package/dist/policy/expressions/index.d.ts +2 -0
- package/dist/policy/index.d.ts +9 -0
- package/dist/policy/rules/GateRule.d.ts +7 -0
- package/dist/policy/rules/ResourceRule.d.ts +7 -0
- package/dist/policy/rules/SandboxRule.d.ts +7 -0
- package/dist/policy/rules/ToolRule.d.ts +23 -0
- package/dist/policy/rules/index.d.ts +4 -0
- package/dist/policy/types.d.ts +156 -0
- package/dist/recovery/RecoveryEngine.d.ts +11 -0
- package/dist/recovery/RetryStrategy.d.ts +2 -0
- package/dist/recovery/SupervisionTree.d.ts +1 -0
- package/dist/recovery/index.d.ts +4 -0
- package/dist/recovery/types.d.ts +103 -0
- package/dist/state/RuntimeBlackboardCompat.d.ts +1 -0
- package/dist/state/StateBinder.d.ts +40 -0
- package/dist/state/StateManager.d.ts +1 -0
- package/dist/state/accessors/decisions-accessor.d.ts +1 -0
- package/dist/state/accessors/index.d.ts +1 -0
- package/dist/state/accessors/knowledge-accessor.d.ts +1 -0
- package/dist/state/accessors/state-accessor.d.ts +1 -0
- package/dist/state/blackboard-events.d.ts +1 -0
- package/dist/state/core-index.d.ts +1 -0
- package/dist/state/id-generator.d.ts +1 -0
- package/dist/state/immutable.d.ts +1 -0
- package/dist/state/index.d.ts +6 -0
- package/dist/state/path-utils.d.ts +1 -0
- package/dist/state/snapshot/compression.d.ts +1 -0
- package/dist/state/snapshot/id-utils.d.ts +1 -0
- package/dist/state/snapshot/index.d.ts +1 -0
- package/dist/state/snapshot/serializer.d.ts +1 -0
- package/dist/state/snapshot/snapshot-comparer.d.ts +1 -0
- package/dist/state/snapshot/snapshot-creator.d.ts +1 -0
- package/dist/state/snapshot/snapshot-manager.d.ts +1 -0
- package/dist/state/snapshot/snapshot-restorer.d.ts +1 -0
- package/dist/state/snapshot/snapshot-serializer.d.ts +1 -0
- package/dist/state/snapshot/snapshot-validator.d.ts +1 -0
- package/dist/state/snapshot/type-guards.d.ts +1 -0
- package/dist/state/snapshot/types.d.ts +1 -0
- package/dist/state/snapshot/utils.d.ts +1 -0
- package/dist/state/tkg.d.ts +1 -0
- package/dist/state/types/agent.d.ts +1 -0
- package/dist/state/types/base.d.ts +1 -0
- package/dist/state/types/blackboard.d.ts +1 -0
- package/dist/state/types/decision.d.ts +1 -0
- package/dist/state/types/index.d.ts +1 -0
- package/dist/state/types/knowledge.d.ts +1 -0
- package/dist/state/types/message.d.ts +1 -0
- package/dist/state/types/task.d.ts +1 -0
- package/dist/state/types/tkg.d.ts +1 -0
- package/dist/state/versioning.d.ts +1 -0
- package/dist/storage/index.d.ts +3 -0
- package/dist/storage/inmemory-adapter.d.ts +27 -0
- package/dist/storage/sqlite-adapter.d.ts +43 -0
- package/dist/storage/types.d.ts +129 -0
- package/package.json +76 -0
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { ActorLifecycleStatus } from "../types/actor";
|
|
2
|
+
import type { Actor, ActorId, ActorRole } from "../types/actor";
|
|
3
|
+
import type { IBlackboard } from "../types/actor";
|
|
4
|
+
import type { IMessageBus } from "../types/message";
|
|
5
|
+
import type { ActorFactory, ActorConfig } from "./types";
|
|
6
|
+
export declare class ActorStopTimeoutError extends Error {
|
|
7
|
+
constructor(actorId: ActorId);
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Actor runtime configuration.
|
|
11
|
+
*/
|
|
12
|
+
export interface RuntimeConfig {
|
|
13
|
+
/** Maximum number of concurrent actors. */
|
|
14
|
+
maxActors?: number;
|
|
15
|
+
/** Default timeout for actor spawn/start in milliseconds. */
|
|
16
|
+
spawnTimeout?: number;
|
|
17
|
+
/** Default timeout for actor stop in milliseconds. */
|
|
18
|
+
stopTimeout?: number;
|
|
19
|
+
/** Maximum number of restart attempts. */
|
|
20
|
+
maxRestarts?: number;
|
|
21
|
+
/** Initial restart backoff in milliseconds. */
|
|
22
|
+
initialBackoff?: number;
|
|
23
|
+
/** Maximum restart backoff in milliseconds. */
|
|
24
|
+
maxBackoff?: number;
|
|
25
|
+
/** Enables debug logging. */
|
|
26
|
+
debug?: boolean;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Actor runtime.
|
|
30
|
+
*
|
|
31
|
+
* Responsible for actor creation, management, and shutdown.
|
|
32
|
+
*/
|
|
33
|
+
export interface RuntimeStopResult {
|
|
34
|
+
stopped: ActorId[];
|
|
35
|
+
failed: Array<{
|
|
36
|
+
id: ActorId;
|
|
37
|
+
error: unknown;
|
|
38
|
+
}>;
|
|
39
|
+
}
|
|
40
|
+
export declare class ActorRuntime {
|
|
41
|
+
private readonly actors;
|
|
42
|
+
private readonly actorConfigs;
|
|
43
|
+
private readonly spawningActorIds;
|
|
44
|
+
private readonly zombies;
|
|
45
|
+
private readonly board;
|
|
46
|
+
private readonly messageBus;
|
|
47
|
+
private readonly config;
|
|
48
|
+
private readonly factory;
|
|
49
|
+
private isRunning;
|
|
50
|
+
constructor(board: IBlackboard, messageBus: IMessageBus, factory: ActorFactory, config?: RuntimeConfig);
|
|
51
|
+
/**
|
|
52
|
+
* Starts the runtime.
|
|
53
|
+
*/
|
|
54
|
+
start(): Promise<void>;
|
|
55
|
+
/**
|
|
56
|
+
* Stops the runtime.
|
|
57
|
+
*/
|
|
58
|
+
stop(): Promise<RuntimeStopResult>;
|
|
59
|
+
/**
|
|
60
|
+
* Stops a specific actor by ID.
|
|
61
|
+
* @param actorId Actor ID.
|
|
62
|
+
*/
|
|
63
|
+
stopById(actorId: ActorId): Promise<void>;
|
|
64
|
+
/**
|
|
65
|
+
* Spawns a new actor.
|
|
66
|
+
* @param config Actor configuration.
|
|
67
|
+
* @returns The created actor.
|
|
68
|
+
*/
|
|
69
|
+
spawn(config: ActorConfig): Promise<Actor>;
|
|
70
|
+
/**
|
|
71
|
+
* Restarts an actor.
|
|
72
|
+
*
|
|
73
|
+
* Total restart attempts are capped at `maxRestarts`.
|
|
74
|
+
* @param actorId Actor ID.
|
|
75
|
+
* @param restartCount Current restart attempt count (internal use).
|
|
76
|
+
* @internal
|
|
77
|
+
*/
|
|
78
|
+
restart(actorId: ActorId, restartCount?: number): Promise<Actor>;
|
|
79
|
+
/**
|
|
80
|
+
* Retries actor spawn with exponential backoff.
|
|
81
|
+
* @param actorId Actor ID.
|
|
82
|
+
* @param config Actor configuration.
|
|
83
|
+
* @param restartCount Current restart attempt count.
|
|
84
|
+
*/
|
|
85
|
+
private retryRestart;
|
|
86
|
+
/**
|
|
87
|
+
* Gets an actor by ID.
|
|
88
|
+
* @param actorId Actor ID.
|
|
89
|
+
* @returns Actor instance.
|
|
90
|
+
*/
|
|
91
|
+
getActor(actorId: ActorId): Actor;
|
|
92
|
+
/**
|
|
93
|
+
* Checks whether an actor exists.
|
|
94
|
+
* @param actorId Actor ID.
|
|
95
|
+
* @returns True if the actor exists.
|
|
96
|
+
*/
|
|
97
|
+
hasActor(actorId: ActorId): boolean;
|
|
98
|
+
/**
|
|
99
|
+
* Returns all actor IDs.
|
|
100
|
+
* @returns Array of actor IDs.
|
|
101
|
+
*/
|
|
102
|
+
listActors(): ActorId[];
|
|
103
|
+
/**
|
|
104
|
+
* Returns actors filtered by role.
|
|
105
|
+
* @param role Actor role.
|
|
106
|
+
* @returns Array of actor IDs.
|
|
107
|
+
*/
|
|
108
|
+
listActorsByRole(role: ActorRole): ActorId[];
|
|
109
|
+
/**
|
|
110
|
+
* Returns actors filtered by lifecycle status.
|
|
111
|
+
* @param status Actor lifecycle status.
|
|
112
|
+
* @returns Array of actor IDs.
|
|
113
|
+
*/
|
|
114
|
+
listActorsByStatus(status: ActorLifecycleStatus): ActorId[];
|
|
115
|
+
/**
|
|
116
|
+
* Returns the current number of actors.
|
|
117
|
+
*/
|
|
118
|
+
size(): number;
|
|
119
|
+
/**
|
|
120
|
+
* Returns runtime status.
|
|
121
|
+
*/
|
|
122
|
+
getStatus(): {
|
|
123
|
+
running: boolean;
|
|
124
|
+
actorCount: number;
|
|
125
|
+
};
|
|
126
|
+
/**
|
|
127
|
+
* Returns actor IDs that timed out during stop and may still be running.
|
|
128
|
+
*/
|
|
129
|
+
getZombies(): ActorId[];
|
|
130
|
+
/**
|
|
131
|
+
* Stops a managed actor and releases runtime references.
|
|
132
|
+
*
|
|
133
|
+
* Timeout trade-off:
|
|
134
|
+
* - `actor.stop()` is raced against `stopTimeout`.
|
|
135
|
+
* - In `finally`, the runtime always removes actor/config map entries, even when
|
|
136
|
+
* stop fails or times out.
|
|
137
|
+
*
|
|
138
|
+
* Why: keeping stale map entries blocks respawn/restart paths and leaks management state.
|
|
139
|
+
* Trade-off: the underlying actor implementation might still be running after timeout
|
|
140
|
+
* ("zombie" actor) because JavaScript promises are not force-cancelled.
|
|
141
|
+
*/
|
|
142
|
+
private stopActor;
|
|
143
|
+
private isStopTimeoutError;
|
|
144
|
+
/**
|
|
145
|
+
* Calculates exponential backoff for restart attempts.
|
|
146
|
+
* @param restartCount Current restart attempt count.
|
|
147
|
+
* @returns Backoff duration in milliseconds.
|
|
148
|
+
*/
|
|
149
|
+
private calculateBackoff;
|
|
150
|
+
/**
|
|
151
|
+
* Validates ActorConfig input.
|
|
152
|
+
* @param config ActorConfig to validate.
|
|
153
|
+
*/
|
|
154
|
+
private validateConfig;
|
|
155
|
+
/**
|
|
156
|
+
* Validates RuntimeConfig input.
|
|
157
|
+
* @param config RuntimeConfig to validate.
|
|
158
|
+
*/
|
|
159
|
+
private validateRuntimeConfig;
|
|
160
|
+
private log;
|
|
161
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { Actor, ActorId, ActorRole, IBlackboard } from "../types/actor";
|
|
2
|
+
import type { IMessageBus } from "../types/message";
|
|
3
|
+
import type { ActorFactory, ActorConfig } from "./types";
|
|
4
|
+
/**
|
|
5
|
+
* Actor 클래스 등록소
|
|
6
|
+
*/
|
|
7
|
+
type ActorConstructor = new (id: ActorId, name: string, role: ActorRole, board: IBlackboard, messageBus: IMessageBus, config?: Record<string, unknown>) => Actor;
|
|
8
|
+
/**
|
|
9
|
+
* 기본 Actor 팩토리
|
|
10
|
+
*
|
|
11
|
+
* Actor 클래스를 등록하고 생성할 수 있는 팩토리입니다.
|
|
12
|
+
*/
|
|
13
|
+
export declare class DefaultActorFactory implements ActorFactory {
|
|
14
|
+
private readonly registry;
|
|
15
|
+
constructor();
|
|
16
|
+
/**
|
|
17
|
+
* Actor 클래스 등록
|
|
18
|
+
* @param type Actor 유형 식별자
|
|
19
|
+
* @param constructor Actor 생성자
|
|
20
|
+
*/
|
|
21
|
+
register(type: string, constructor: ActorConstructor): void;
|
|
22
|
+
/**
|
|
23
|
+
* Actor 클래스 등록 해제
|
|
24
|
+
* @param type Actor 유형 식별자
|
|
25
|
+
*/
|
|
26
|
+
unregister(type: string): void;
|
|
27
|
+
/**
|
|
28
|
+
* Actor 인스턴스 생성
|
|
29
|
+
* @param config Actor 설정
|
|
30
|
+
* @param board Blackboard 인스턴스
|
|
31
|
+
* @param messageBus MessageBus 인스턴스
|
|
32
|
+
* @returns 생성된 Actor 인스턴스
|
|
33
|
+
*/
|
|
34
|
+
create(config: ActorConfig, board: IBlackboard, messageBus: IMessageBus, _options?: {
|
|
35
|
+
signal?: AbortSignal;
|
|
36
|
+
}): Promise<Actor>;
|
|
37
|
+
/**
|
|
38
|
+
* Actor ID 생성
|
|
39
|
+
* @param role Actor 역할
|
|
40
|
+
* @returns Actor ID
|
|
41
|
+
*/
|
|
42
|
+
private generateId;
|
|
43
|
+
}
|
|
44
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { Actor, ActorId, ActorRole } from "../types/actor";
|
|
2
|
+
import type { IBlackboard } from "../types/actor";
|
|
3
|
+
import type { IMessageBus } from "../types/message";
|
|
4
|
+
/**
|
|
5
|
+
* Actor 생성 설정
|
|
6
|
+
*/
|
|
7
|
+
export interface ActorConfig {
|
|
8
|
+
/** Actor ID (생략 시 자동 생성) */
|
|
9
|
+
id?: ActorId;
|
|
10
|
+
/** Actor 이름 */
|
|
11
|
+
name: string;
|
|
12
|
+
/** Actor 역할 */
|
|
13
|
+
role: ActorRole;
|
|
14
|
+
/** Actor 유형 (구체적인 Actor 클래스 식별자) */
|
|
15
|
+
type: string;
|
|
16
|
+
/** Actor 초기 설정 */
|
|
17
|
+
config?: Record<string, unknown>;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Actor 팩토리
|
|
21
|
+
*
|
|
22
|
+
* Actor 인스턴스 생성을 담당하는 인터페이스입니다.
|
|
23
|
+
* 구체적인 Actor 구현은 이 팩토리를 통해 생성됩니다.
|
|
24
|
+
*/
|
|
25
|
+
export interface ActorFactory {
|
|
26
|
+
/**
|
|
27
|
+
* Actor 인스턴스 생성
|
|
28
|
+
*
|
|
29
|
+
* Factory implementations SHOULD abort actor creation when `options.signal`
|
|
30
|
+
* is aborted.
|
|
31
|
+
*
|
|
32
|
+
* @param config Actor 설정
|
|
33
|
+
* @param board Blackboard 인스턴스
|
|
34
|
+
* @param messageBus MessageBus 인스턴스
|
|
35
|
+
* @param options 생성 옵션
|
|
36
|
+
* @returns 생성된 Actor 인스턴스
|
|
37
|
+
*/
|
|
38
|
+
create(config: ActorConfig, board: IBlackboard, messageBus: IMessageBus, options?: {
|
|
39
|
+
signal?: AbortSignal;
|
|
40
|
+
}): Promise<Actor>;
|
|
41
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { EventEmitter } from "events";
|
|
2
|
+
import type { ActorRuntime } from "../runtime/ActorRuntime";
|
|
3
|
+
import type { ActorId } from "../types/actor";
|
|
4
|
+
import { SupervisorConfig, RestartHistory, DeadLetter } from "./types";
|
|
5
|
+
/**
|
|
6
|
+
* Supervisor
|
|
7
|
+
*
|
|
8
|
+
* Actor의 실패를 감지하고 재시작 전략에 따라 복구합니다.
|
|
9
|
+
*/
|
|
10
|
+
export declare class Supervisor extends EventEmitter {
|
|
11
|
+
private readonly config;
|
|
12
|
+
private readonly runtime;
|
|
13
|
+
private readonly restartCounts;
|
|
14
|
+
private readonly restartTimestamps;
|
|
15
|
+
private readonly restartHistory;
|
|
16
|
+
private readonly deadLetterQueue;
|
|
17
|
+
private readonly watchedActors;
|
|
18
|
+
private isRunning;
|
|
19
|
+
constructor(runtime: ActorRuntime, config?: Partial<SupervisorConfig>);
|
|
20
|
+
/**
|
|
21
|
+
* Supervisor 시작
|
|
22
|
+
*/
|
|
23
|
+
start(): void;
|
|
24
|
+
/**
|
|
25
|
+
* Supervisor 종료
|
|
26
|
+
*/
|
|
27
|
+
stop(): void;
|
|
28
|
+
/**
|
|
29
|
+
* Actor 감시 시작
|
|
30
|
+
* @param actorId 감시할 Actor ID
|
|
31
|
+
*/
|
|
32
|
+
watch(actorId: ActorId): void;
|
|
33
|
+
/**
|
|
34
|
+
* Actor 감시 종료
|
|
35
|
+
* @param actorId 감시 종료할 Actor ID
|
|
36
|
+
*/
|
|
37
|
+
unwatch(actorId: ActorId): void;
|
|
38
|
+
/**
|
|
39
|
+
* Actor 실패 처리
|
|
40
|
+
* @param actorId 실패한 Actor ID
|
|
41
|
+
* @param error 실패 원인
|
|
42
|
+
*/
|
|
43
|
+
handleFailure(actorId: ActorId, error: Error): Promise<void>;
|
|
44
|
+
/**
|
|
45
|
+
* Dead Letter Queue 조회
|
|
46
|
+
*/
|
|
47
|
+
getDeadLetters(): DeadLetter[];
|
|
48
|
+
/**
|
|
49
|
+
* Dead Letter Queue 비우기
|
|
50
|
+
*/
|
|
51
|
+
clearDeadLetters(): void;
|
|
52
|
+
/**
|
|
53
|
+
* 재시작 이력 조회
|
|
54
|
+
*/
|
|
55
|
+
getRestartHistory(actorId?: ActorId): RestartHistory[];
|
|
56
|
+
/**
|
|
57
|
+
* 감시 중인 Actor 목록
|
|
58
|
+
*/
|
|
59
|
+
getWatchedActors(): ActorId[];
|
|
60
|
+
/**
|
|
61
|
+
* 재시작 결정
|
|
62
|
+
*/
|
|
63
|
+
private decideRestart;
|
|
64
|
+
/**
|
|
65
|
+
* 재시작 수행
|
|
66
|
+
*/
|
|
67
|
+
private performRestart;
|
|
68
|
+
/**
|
|
69
|
+
* OneForOne: 해당 Actor만 재시작
|
|
70
|
+
*/
|
|
71
|
+
private restartOne;
|
|
72
|
+
/**
|
|
73
|
+
* AllForOne: 모든 감시 중인 Actor 재시작
|
|
74
|
+
*/
|
|
75
|
+
private restartAll;
|
|
76
|
+
/**
|
|
77
|
+
* RestForOne: 해당 Actor와 이후 생성된 Actor들 재시작
|
|
78
|
+
*/
|
|
79
|
+
private restartRest;
|
|
80
|
+
/**
|
|
81
|
+
* 정지 수행
|
|
82
|
+
*/
|
|
83
|
+
private performStop;
|
|
84
|
+
/**
|
|
85
|
+
* 에스컬레이션
|
|
86
|
+
*/
|
|
87
|
+
private escalate;
|
|
88
|
+
/**
|
|
89
|
+
* 백오프 계산
|
|
90
|
+
*/
|
|
91
|
+
private calculateBackoff;
|
|
92
|
+
/**
|
|
93
|
+
* 이력 기록
|
|
94
|
+
*/
|
|
95
|
+
private recordHistory;
|
|
96
|
+
/**
|
|
97
|
+
* Dead Letter 추가
|
|
98
|
+
*/
|
|
99
|
+
private addDeadLetter;
|
|
100
|
+
private delay;
|
|
101
|
+
private log;
|
|
102
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { ActorRuntime } from "../runtime/ActorRuntime";
|
|
2
|
+
import { Supervisor } from "./Supervisor";
|
|
3
|
+
import type { SupervisorConfig } from "./types";
|
|
4
|
+
/**
|
|
5
|
+
* Supervisor Tree
|
|
6
|
+
*
|
|
7
|
+
* 계층적인 Supervisor 구조를 관리합니다.
|
|
8
|
+
* 상위 Supervisor가 하위 Supervisor와 Actor들을 감독합니다.
|
|
9
|
+
*/
|
|
10
|
+
export declare class SupervisorTree {
|
|
11
|
+
private readonly nodes;
|
|
12
|
+
private readonly runtime;
|
|
13
|
+
private rootId;
|
|
14
|
+
constructor(runtime: ActorRuntime);
|
|
15
|
+
/**
|
|
16
|
+
* 루트 Supervisor 생성
|
|
17
|
+
* @param config Supervisor 설정
|
|
18
|
+
* @returns 루트 Supervisor ID
|
|
19
|
+
*/
|
|
20
|
+
createRoot(config?: Partial<SupervisorConfig>): string;
|
|
21
|
+
/**
|
|
22
|
+
* 자식 Supervisor 생성
|
|
23
|
+
* @param parentId 부모 Supervisor ID
|
|
24
|
+
* @param config Supervisor 설정
|
|
25
|
+
* @returns 자식 Supervisor ID
|
|
26
|
+
*/
|
|
27
|
+
createChild(parentId: string, config?: Partial<SupervisorConfig>): string;
|
|
28
|
+
/**
|
|
29
|
+
* Supervisor 조회
|
|
30
|
+
* @param id Supervisor ID
|
|
31
|
+
* @returns Supervisor 인스턴스
|
|
32
|
+
*/
|
|
33
|
+
getSupervisor(id: string): Supervisor;
|
|
34
|
+
/**
|
|
35
|
+
* 루트 Supervisor 조회
|
|
36
|
+
*/
|
|
37
|
+
getRoot(): Supervisor | null;
|
|
38
|
+
/**
|
|
39
|
+
* Supervisor 제거
|
|
40
|
+
* @param id Supervisor ID
|
|
41
|
+
*/
|
|
42
|
+
remove(id: string): void;
|
|
43
|
+
/**
|
|
44
|
+
* 전체 트리 정지
|
|
45
|
+
*/
|
|
46
|
+
shutdown(): void;
|
|
47
|
+
/**
|
|
48
|
+
* 트리 구조 출력 (디버그용)
|
|
49
|
+
*/
|
|
50
|
+
printTree(): string;
|
|
51
|
+
private handleEscalation;
|
|
52
|
+
private printNode;
|
|
53
|
+
private generateId;
|
|
54
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import type { ActorId, Actor } from "../types/actor";
|
|
2
|
+
/**
|
|
3
|
+
* 재시작 전략 유형
|
|
4
|
+
*/
|
|
5
|
+
export declare enum RestartStrategy {
|
|
6
|
+
/**
|
|
7
|
+
* OneForOne: 실패한 Actor만 재시작
|
|
8
|
+
* - 다른 Actor에 영향 없음
|
|
9
|
+
* - 독립적인 Actor에 적합
|
|
10
|
+
*/
|
|
11
|
+
ONE_FOR_ONE = "one-for-one",
|
|
12
|
+
/**
|
|
13
|
+
* AllForOne: 하나가 실패하면 모든 Actor 재시작
|
|
14
|
+
* - 강한 의존성이 있는 Actor 그룹에 적합
|
|
15
|
+
* - 일관된 상태 복원 필요 시 사용
|
|
16
|
+
*/
|
|
17
|
+
ALL_FOR_ONE = "all-for-one",
|
|
18
|
+
/**
|
|
19
|
+
* RestForOne: 실패한 Actor와 이후 생성된 Actor들 재시작
|
|
20
|
+
* - 순서 의존성이 있는 Actor에 적합
|
|
21
|
+
*/
|
|
22
|
+
REST_FOR_ONE = "rest-for-one"
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* 재시작 지시
|
|
26
|
+
*/
|
|
27
|
+
export declare enum RestartDirective {
|
|
28
|
+
/** 재시작 */
|
|
29
|
+
RESTART = "restart",
|
|
30
|
+
/** 재시작하지 않음 (정상 종료 처리) */
|
|
31
|
+
STOP = "stop",
|
|
32
|
+
/** 상위 Supervisor로 에스컬레이션 */
|
|
33
|
+
ESCALATE = "escalate"
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* 백오프 정책 유형
|
|
37
|
+
*/
|
|
38
|
+
export declare enum BackoffPolicy {
|
|
39
|
+
/** 고정 대기 시간 */
|
|
40
|
+
FIXED = "fixed",
|
|
41
|
+
/** 지수 백오프 */
|
|
42
|
+
EXPONENTIAL = "exponential",
|
|
43
|
+
/** 선형 백오프 */
|
|
44
|
+
LINEAR = "linear",
|
|
45
|
+
/** 지터가 포함된 지수 백오프 */
|
|
46
|
+
EXPONENTIAL_JITTER = "exponential-jitter"
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* 백오프 설정
|
|
50
|
+
*/
|
|
51
|
+
export interface BackoffConfig {
|
|
52
|
+
/** 백오프 정책 */
|
|
53
|
+
policy: BackoffPolicy;
|
|
54
|
+
/** 초기 대기 시간 (ms) */
|
|
55
|
+
initialDelay: number;
|
|
56
|
+
/** 최대 대기 시간 (ms) */
|
|
57
|
+
maxDelay: number;
|
|
58
|
+
/** 지수/선형 배율 */
|
|
59
|
+
multiplier?: number;
|
|
60
|
+
/** 지터 범위 (0-1) */
|
|
61
|
+
jitterFactor?: number;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Supervisor 설정
|
|
65
|
+
*/
|
|
66
|
+
export interface SupervisorConfig {
|
|
67
|
+
/** 재시작 전략 */
|
|
68
|
+
strategy: RestartStrategy;
|
|
69
|
+
/** 백오프 설정 */
|
|
70
|
+
backoff: BackoffConfig;
|
|
71
|
+
/** 최대 재시작 횟수 (기간 내) */
|
|
72
|
+
maxRestarts: number;
|
|
73
|
+
/** 재시작 횟수 리셋 기간 (ms) */
|
|
74
|
+
restartWindow: number;
|
|
75
|
+
/** 재시작 결정 함수 (커스텀 로직) */
|
|
76
|
+
decider?: (error: Error, actor: Actor) => RestartDirective;
|
|
77
|
+
/** Dead Letter Queue 활성화 */
|
|
78
|
+
enableDeadLetterQueue?: boolean;
|
|
79
|
+
/** Dead Letter Queue 최대 크기 */
|
|
80
|
+
deadLetterQueueSize?: number;
|
|
81
|
+
/** 디버그 모드 */
|
|
82
|
+
debug?: boolean;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* 재시작 이력
|
|
86
|
+
*/
|
|
87
|
+
export interface RestartHistory {
|
|
88
|
+
/** Actor ID */
|
|
89
|
+
actorId: ActorId;
|
|
90
|
+
/** 재시작 시간 */
|
|
91
|
+
timestamp: Date;
|
|
92
|
+
/** 재시작 원인 에러 */
|
|
93
|
+
error: Error;
|
|
94
|
+
/** 재시작 시도 횟수 */
|
|
95
|
+
attempt: number;
|
|
96
|
+
/** 재시작 성공 여부 */
|
|
97
|
+
success: boolean;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Dead Letter
|
|
101
|
+
*/
|
|
102
|
+
export interface DeadLetter {
|
|
103
|
+
/** 원본 메시지/작업 */
|
|
104
|
+
payload: unknown;
|
|
105
|
+
/** 실패한 Actor ID */
|
|
106
|
+
actorId: ActorId;
|
|
107
|
+
/** 실패 에러 */
|
|
108
|
+
error: Error;
|
|
109
|
+
/** 실패 시간 */
|
|
110
|
+
timestamp: Date;
|
|
111
|
+
/** 재시도 횟수 */
|
|
112
|
+
retryCount: number;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Supervisor 이벤트
|
|
116
|
+
*/
|
|
117
|
+
export interface SupervisorEvents {
|
|
118
|
+
/** Actor 실패 시 */
|
|
119
|
+
"actor:failed": (actorId: ActorId, error: Error) => void;
|
|
120
|
+
/** Actor 재시작 시 */
|
|
121
|
+
"actor:restarted": (actorId: ActorId, attempt: number) => void;
|
|
122
|
+
/** Actor 영구 정지 시 */
|
|
123
|
+
"actor:stopped": (actorId: ActorId, reason: string) => void;
|
|
124
|
+
/** Dead Letter 발생 시 */
|
|
125
|
+
"dead-letter": (letter: DeadLetter) => void;
|
|
126
|
+
/** 최대 재시작 초과 시 */
|
|
127
|
+
"max-restarts-exceeded": (actorId: ActorId) => void;
|
|
128
|
+
/** 에스컬레이션 */
|
|
129
|
+
escalate: (actorId: ActorId, error: Error) => void;
|
|
130
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module action
|
|
3
|
+
* @description Action 타입 정의 - 액터가 수행하는 행동
|
|
4
|
+
*/
|
|
5
|
+
import type { ActorId } from "./actor";
|
|
6
|
+
/**
|
|
7
|
+
* Action 고유 ID 타입
|
|
8
|
+
* @description 브랜드 타입을 사용하여 타입 안전성을 확보
|
|
9
|
+
*/
|
|
10
|
+
export type ActionId = string & {
|
|
11
|
+
readonly __brand: "ActionId";
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Action 유형
|
|
15
|
+
* @description 액터가 수행할 수 있는 행동의 종류
|
|
16
|
+
*/
|
|
17
|
+
export type ActionType = "analyze" | "execute" | "verify" | "coordinate" | "submit_opinion" | "submit_vote" | "create_agenda" | "unknown";
|
|
18
|
+
/**
|
|
19
|
+
* Action 인터페이스
|
|
20
|
+
* @description 액터가 수행하는 행동의 정의
|
|
21
|
+
*/
|
|
22
|
+
export interface Action {
|
|
23
|
+
/** 고유 식별자 */
|
|
24
|
+
readonly id: ActionId;
|
|
25
|
+
/** 행동을 수행하는 액터 ID */
|
|
26
|
+
actorId: ActorId;
|
|
27
|
+
/** 행동 유형 */
|
|
28
|
+
type: ActionType;
|
|
29
|
+
/** 행동 생성 시간 */
|
|
30
|
+
timestamp: Date;
|
|
31
|
+
/** 행동 파라미터 (선택적) */
|
|
32
|
+
params?: Record<string, unknown>;
|
|
33
|
+
/** 관련 작업 ID (선택적) */
|
|
34
|
+
taskId?: string;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Action ID 생성 함수
|
|
38
|
+
* @param id - 원본 문자열 ID
|
|
39
|
+
* @returns 브랜드 타입이 적용된 ActionId
|
|
40
|
+
* @example
|
|
41
|
+
* ```typescript
|
|
42
|
+
* const actionId = createActionId('action-001');
|
|
43
|
+
* // 타입: ActionId
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
export declare function createActionId(id: string): ActionId;
|
|
47
|
+
/**
|
|
48
|
+
* Action ID 유효성 검사
|
|
49
|
+
* @param value - 확인할 값
|
|
50
|
+
* @returns 유효한 ActionId 여부
|
|
51
|
+
*/
|
|
52
|
+
export declare function isValidActionId(value: unknown): value is ActionId;
|
|
53
|
+
/**
|
|
54
|
+
* Action 생성 함수
|
|
55
|
+
* @param actorId - 액터 ID
|
|
56
|
+
* @param type - 행동 유형
|
|
57
|
+
* @param params - 행동 파라미터 (선택적)
|
|
58
|
+
* @param taskId - 관련 작업 ID (선택적)
|
|
59
|
+
* @returns 생성된 Action 객체
|
|
60
|
+
* @example
|
|
61
|
+
* ```typescript
|
|
62
|
+
* const action = createAction('actor-001', 'analyze', { target: 'data-001' });
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
export declare function createAction(actorId: ActorId, type: ActionType, params?: Record<string, unknown>, taskId?: string): Action;
|