@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,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module blackboard
|
|
3
|
+
* @description Blackboard 인터페이스 - Actor 연결용
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Actor와 상호작용하는 Blackboard 인터페이스 (스펙 기준: IBlackboard)
|
|
7
|
+
*
|
|
8
|
+
* Actor 시스템에서 필요한 Blackboard의 기능을 정의합니다.
|
|
9
|
+
* 전체 구현은 runtime 내부 blackboard 모듈에서 제공됩니다.
|
|
10
|
+
*
|
|
11
|
+
* 참고: [[spec/13-actor.md|13-actor.md]]
|
|
12
|
+
*/
|
|
13
|
+
export interface IBlackboard {
|
|
14
|
+
/**
|
|
15
|
+
* 현재 Blackboard 버전
|
|
16
|
+
*/
|
|
17
|
+
readonly version: number;
|
|
18
|
+
/**
|
|
19
|
+
* Blackboard에서 데이터 읽기
|
|
20
|
+
* @param key - 읽을 키 또는 경로
|
|
21
|
+
* @returns 읽은 데이터
|
|
22
|
+
*/
|
|
23
|
+
read(key: string): unknown | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* Blackboard에 데이터 쓰기
|
|
26
|
+
* @param key - 쓸 키 또는 경로
|
|
27
|
+
* @param value - 쓸 데이터
|
|
28
|
+
*/
|
|
29
|
+
write(key: string, value: unknown): void;
|
|
30
|
+
/**
|
|
31
|
+
* Blackboard에서 데이터 삭제
|
|
32
|
+
* @param key - 삭제할 키 또는 경로
|
|
33
|
+
*/
|
|
34
|
+
delete(key: string): void;
|
|
35
|
+
/**
|
|
36
|
+
* 모든 키 조회
|
|
37
|
+
* @returns 모든 키 배열
|
|
38
|
+
*/
|
|
39
|
+
keys(): string[];
|
|
40
|
+
/**
|
|
41
|
+
* 특정 패턴의 키 조회
|
|
42
|
+
* @param pattern - 검색할 패턴
|
|
43
|
+
* @returns 일치하는 키 배열
|
|
44
|
+
*/
|
|
45
|
+
find(pattern: string): string[];
|
|
46
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module types
|
|
3
|
+
* @description Actor 패키지 타입 정의 모듈
|
|
4
|
+
*/
|
|
5
|
+
export * from "./actor";
|
|
6
|
+
export * from "./blackboard";
|
|
7
|
+
export * from "./observation";
|
|
8
|
+
export * from "./action";
|
|
9
|
+
export * from "./result";
|
|
10
|
+
export * from "./message";
|
|
11
|
+
export * from "./metrics";
|
|
12
|
+
export * from "./crypto";
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module message
|
|
3
|
+
* @description Message 타입 정의 - 액터 간 통신
|
|
4
|
+
*/
|
|
5
|
+
import type { ActorId } from "./actor";
|
|
6
|
+
/**
|
|
7
|
+
* Message 고유 ID 타입
|
|
8
|
+
* @description 브랜드 타입을 사용하여 타입 안전성을 확보
|
|
9
|
+
*/
|
|
10
|
+
export type MessageId = string & {
|
|
11
|
+
readonly __brand: "MessageId";
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* 메시지 우선순위 열거형
|
|
15
|
+
* @description 메시지 처리 우선순위를 정의
|
|
16
|
+
*/
|
|
17
|
+
export declare enum MessagePriority {
|
|
18
|
+
/** 낮음 */
|
|
19
|
+
LOW = 0,
|
|
20
|
+
/** 보통 */
|
|
21
|
+
NORMAL = 1,
|
|
22
|
+
/** 높음 */
|
|
23
|
+
HIGH = 2,
|
|
24
|
+
/** 매우 높음 */
|
|
25
|
+
CRITICAL = 3
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* 메시지 유형 열거형
|
|
29
|
+
* @description 메시지의 종류를 정의
|
|
30
|
+
*/
|
|
31
|
+
export declare enum MessageType {
|
|
32
|
+
/** 상태 읽기 */
|
|
33
|
+
STATE_READ = "state.read",
|
|
34
|
+
/** 상태 쓰기 */
|
|
35
|
+
STATE_WRITE = "state.write",
|
|
36
|
+
/** 상태 구독 */
|
|
37
|
+
STATE_SUBSCRIBE = "state.subscribe",
|
|
38
|
+
/** 상태 구독 취소 */
|
|
39
|
+
STATE_UNSUBSCRIBE = "state.unsubscribe",
|
|
40
|
+
/** 작업 할당 */
|
|
41
|
+
TASK_ASSIGN = "task.assign",
|
|
42
|
+
/** 작업 시작 */
|
|
43
|
+
TASK_START = "task.start",
|
|
44
|
+
/** 작업 완료 */
|
|
45
|
+
TASK_COMPLETE = "task.complete",
|
|
46
|
+
/** 작업 실패 */
|
|
47
|
+
TASK_FAILED = "task.failed",
|
|
48
|
+
/** 작업 취소 */
|
|
49
|
+
TASK_CANCEL = "task.cancel",
|
|
50
|
+
/** 의사결정 요청 */
|
|
51
|
+
DECISION_REQUEST = "decision.request",
|
|
52
|
+
/** 의견 제출 */
|
|
53
|
+
OPINION_SUBMIT = "opinion.submit",
|
|
54
|
+
/** 의견 요청 */
|
|
55
|
+
OPINION_REQUEST = "opinion.request",
|
|
56
|
+
/** 투표 제출 */
|
|
57
|
+
VOTE_SUBMIT = "vote.submit",
|
|
58
|
+
/** 투표 요청 */
|
|
59
|
+
VOTE_REQUEST = "vote.request",
|
|
60
|
+
/** 합의 도달 */
|
|
61
|
+
CONSENSUS_REACHED = "consensus.reached",
|
|
62
|
+
/** 핑 */
|
|
63
|
+
PING = "ping",
|
|
64
|
+
/** 퐁 */
|
|
65
|
+
PONG = "pong",
|
|
66
|
+
/** 하트비트 */
|
|
67
|
+
HEARTBEAT = "heartbeat",
|
|
68
|
+
/** 상태 요청 */
|
|
69
|
+
STATUS_REQUEST = "status.request",
|
|
70
|
+
/** 상태 응답 */
|
|
71
|
+
STATUS_RESPONSE = "status.response",
|
|
72
|
+
/** 에러 */
|
|
73
|
+
ERROR = "error",
|
|
74
|
+
/** 에러 승인 */
|
|
75
|
+
ERROR_ACK = "error.ack",
|
|
76
|
+
/** 시작 */
|
|
77
|
+
START = "start",
|
|
78
|
+
/** 중지 */
|
|
79
|
+
STOP = "stop",
|
|
80
|
+
/** 재시작 */
|
|
81
|
+
RESTART = "restart",
|
|
82
|
+
/** 강제 종료 */
|
|
83
|
+
KILL = "kill",
|
|
84
|
+
/** 사용자 정의 메시지 */
|
|
85
|
+
CUSTOM = "custom"
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Message 인터페이스
|
|
89
|
+
* @description 액터 간 통신에 사용되는 메시지
|
|
90
|
+
*/
|
|
91
|
+
export interface Message<T = unknown> {
|
|
92
|
+
/** 고유 식별자 */
|
|
93
|
+
id: MessageId;
|
|
94
|
+
/** 메시지 유형 */
|
|
95
|
+
type: MessageType;
|
|
96
|
+
/** 발신자 액터 ID */
|
|
97
|
+
from: ActorId;
|
|
98
|
+
/** 수신자 액터 ID ('broadcast' 시 전체 전송) */
|
|
99
|
+
to: ActorId | "broadcast";
|
|
100
|
+
/** 메시지 내용 */
|
|
101
|
+
payload: T;
|
|
102
|
+
/** 메시지 생성 시간 */
|
|
103
|
+
timestamp: Date;
|
|
104
|
+
/** 상관 관계 ID (선택적) - 응답 메시지와 요청 메시지 연결 */
|
|
105
|
+
correlationId?: string;
|
|
106
|
+
/** 응답 대상 (선택적) - 응답 메시지의 수신자 */
|
|
107
|
+
replyTo?: ActorId;
|
|
108
|
+
/** 메시지 우선순위 (선택적) */
|
|
109
|
+
priority?: MessagePriority;
|
|
110
|
+
/** Time to Live (선택적) - 메시지 유효 시간 (ms) */
|
|
111
|
+
ttl?: number;
|
|
112
|
+
/** 전달 확인 요청 (선택적) */
|
|
113
|
+
deliveryReceipt?: boolean;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* 구독 취소 함수 타입
|
|
117
|
+
* @description 메시지 구독을 취소하는 함수
|
|
118
|
+
*/
|
|
119
|
+
export type UnsubscribeFn = () => void;
|
|
120
|
+
/**
|
|
121
|
+
* IMessageBus 인터페이스
|
|
122
|
+
* @description 액터 간 메시지 전달 시스템
|
|
123
|
+
*/
|
|
124
|
+
export interface IMessageBus {
|
|
125
|
+
/**
|
|
126
|
+
* 메시지 전송
|
|
127
|
+
* @param message - 전송할 메시지
|
|
128
|
+
*/
|
|
129
|
+
send(message: Message): void;
|
|
130
|
+
/**
|
|
131
|
+
* 특정 Actor에 메시지 전송
|
|
132
|
+
* @param to - 수신자 Actor ID
|
|
133
|
+
* @param message - 전송할 메시지 (to 필드 제외)
|
|
134
|
+
*/
|
|
135
|
+
sendTo(to: ActorId, message: Omit<Message, "to">): void;
|
|
136
|
+
/**
|
|
137
|
+
* 브로드캐스트 전송
|
|
138
|
+
* @param message - 전송할 메시지 (to 필드 제외)
|
|
139
|
+
*/
|
|
140
|
+
broadcast(message: Omit<Message, "to">): void;
|
|
141
|
+
/**
|
|
142
|
+
* 메시지 수신 핸들러 등록
|
|
143
|
+
* @param handler - 메시지 처리 핸들러
|
|
144
|
+
*/
|
|
145
|
+
receive(handler: (message: Message) => void): void;
|
|
146
|
+
/**
|
|
147
|
+
* 요청-응답 패턴
|
|
148
|
+
* @param message - 요청 메시지
|
|
149
|
+
* @param timeoutMs - 타임아웃 시간 (ms)
|
|
150
|
+
* @returns 응답 메시지 Promise
|
|
151
|
+
*/
|
|
152
|
+
request<T>(message: Message, timeoutMs?: number): Promise<Message<T>>;
|
|
153
|
+
/**
|
|
154
|
+
* 메시지 타입 구독
|
|
155
|
+
* @param messageType - 구독할 메시지 타입
|
|
156
|
+
* @param handler - 메시지 처리 핸들러
|
|
157
|
+
* @returns 구독 취소 함수
|
|
158
|
+
*/
|
|
159
|
+
subscribe(messageType: MessageType, handler: (message: Message) => void): UnsubscribeFn;
|
|
160
|
+
/**
|
|
161
|
+
* 메시지 큐 크기 조회
|
|
162
|
+
* @param actorId - Actor ID
|
|
163
|
+
* @returns 큐에 대기 중인 메시지 수
|
|
164
|
+
*/
|
|
165
|
+
getQueueSize(actorId: ActorId): number;
|
|
166
|
+
/**
|
|
167
|
+
* 메시지 큐 비우기
|
|
168
|
+
* @param actorId - Actor ID
|
|
169
|
+
*/
|
|
170
|
+
clearQueue(actorId: ActorId): void;
|
|
171
|
+
/**
|
|
172
|
+
* 메시지 필터링
|
|
173
|
+
* @param predicate - 필터링 조건
|
|
174
|
+
*/
|
|
175
|
+
filter(predicate: (message: Message) => boolean): Message[];
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Message ID 생성 함수
|
|
179
|
+
* @param id - 원본 문자열 ID
|
|
180
|
+
* @returns 브랜드 타입이 적용된 MessageId
|
|
181
|
+
* @example
|
|
182
|
+
* ```typescript
|
|
183
|
+
* const messageId = createMessageId('msg-001');
|
|
184
|
+
* // 타입: MessageId
|
|
185
|
+
* ```
|
|
186
|
+
*/
|
|
187
|
+
export declare function createMessageId(id: string): MessageId;
|
|
188
|
+
/**
|
|
189
|
+
* Message ID 유효성 검사
|
|
190
|
+
* @param value - 확인할 값
|
|
191
|
+
* @returns 유효한 MessageId 여부
|
|
192
|
+
*/
|
|
193
|
+
export declare function isValidMessageId(value: unknown): value is MessageId;
|
|
194
|
+
/**
|
|
195
|
+
* Message 생성 함수
|
|
196
|
+
* @param params - Message 생성 파라미터
|
|
197
|
+
* @returns 생성된 Message 객체
|
|
198
|
+
* @example
|
|
199
|
+
* ```typescript
|
|
200
|
+
* const message = createMessage({
|
|
201
|
+
* id: createMessageId('msg-001'),
|
|
202
|
+
* type: MessageType.COMMAND,
|
|
203
|
+
* from: createActorId('analyst-550e8400-e29b-41d4-a716-446655440000'),
|
|
204
|
+
* to: createActorId('executor-550e8400-e29b-41d4-a716-446655440001'),
|
|
205
|
+
* payload: { action: 'start' }
|
|
206
|
+
* });
|
|
207
|
+
* ```
|
|
208
|
+
*/
|
|
209
|
+
export declare function createMessage<T>(params: Omit<Message<T>, "timestamp">): Message<T>;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module metrics
|
|
3
|
+
* @description Metrics 타입 정의 - 액터 성능 메트릭
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Actor 성능 메트릭 인터페이스
|
|
7
|
+
* @description 액터의 성능 및 실행 통계
|
|
8
|
+
*/
|
|
9
|
+
export interface ActorMetrics {
|
|
10
|
+
/** 총 실행 횟수 */
|
|
11
|
+
totalRuns: number;
|
|
12
|
+
/** 성공 횟수 */
|
|
13
|
+
successCount: number;
|
|
14
|
+
/** 실패 횟수 */
|
|
15
|
+
failureCount: number;
|
|
16
|
+
/** 마지막 오류 */
|
|
17
|
+
lastError: Error | null;
|
|
18
|
+
/** 평균 실행 시간 */
|
|
19
|
+
averageExecutionTime: number;
|
|
20
|
+
/** 총 실행 시간 (밀리초) */
|
|
21
|
+
totalExecutionTimeMs: number;
|
|
22
|
+
/** 마지막 실행 시간 */
|
|
23
|
+
lastRunAt?: Date;
|
|
24
|
+
/** 생성 시간 */
|
|
25
|
+
createdAt: Date;
|
|
26
|
+
/** 마지막 업데이트 시간 */
|
|
27
|
+
updatedAt: Date;
|
|
28
|
+
/** 마지막 실행 시간 (밀리초) */
|
|
29
|
+
lastExecutionTime: number | null;
|
|
30
|
+
/** 총 CPU 사용 시간 (밀리초) */
|
|
31
|
+
totalCpuTime: number;
|
|
32
|
+
/** 메모리 사용량 (바이트) */
|
|
33
|
+
memoryUsage: number;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Actor 메트릭 생성 함수
|
|
37
|
+
* @returns 생성된 ActorMetrics 객체
|
|
38
|
+
* @example
|
|
39
|
+
* ```typescript
|
|
40
|
+
* const metrics = createActorMetrics();
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export declare function createActorMetrics(): ActorMetrics;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module observation
|
|
3
|
+
* @description Observation 타입 정의 - 액터의 환경 관찰 결과
|
|
4
|
+
*/
|
|
5
|
+
import type { ActorId } from "./actor";
|
|
6
|
+
/**
|
|
7
|
+
* 관찰 인터페이스
|
|
8
|
+
* @description 액터가 환경에서 관찰한 정보
|
|
9
|
+
*/
|
|
10
|
+
export interface Observation {
|
|
11
|
+
/** 관찰을 수행한 액터 ID */
|
|
12
|
+
actorId: ActorId;
|
|
13
|
+
/** 관찰 시간 */
|
|
14
|
+
timestamp: Date;
|
|
15
|
+
/** 관찰된 상태 (선택적) */
|
|
16
|
+
state?: {
|
|
17
|
+
context: Record<string, unknown>;
|
|
18
|
+
agents: unknown[];
|
|
19
|
+
tasks: unknown[];
|
|
20
|
+
};
|
|
21
|
+
/** 획득한 지식 (선택적) */
|
|
22
|
+
knowledge?: {
|
|
23
|
+
facts: unknown[];
|
|
24
|
+
inferences: unknown[];
|
|
25
|
+
};
|
|
26
|
+
/** 관찰된 결정사항 (선택적) */
|
|
27
|
+
decisions?: {
|
|
28
|
+
currentAgenda: unknown | null;
|
|
29
|
+
opinions: unknown[];
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* 관찰 생성 함수
|
|
34
|
+
* @param params - 관찰 생성 파라미터
|
|
35
|
+
* @returns 생성된 Observation 객체
|
|
36
|
+
* @example
|
|
37
|
+
* ```typescript
|
|
38
|
+
* const observation = createObservation({
|
|
39
|
+
* actorId: createActorId('actor-001'),
|
|
40
|
+
* state: { temperature: 25 },
|
|
41
|
+
* knowledge: [{ id: 'k1', content: 'fact', confidence: 0.9 }]
|
|
42
|
+
* });
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
export declare function createObservation(params: Omit<Observation, "timestamp">): Observation;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module result
|
|
3
|
+
* @description Result 타입 정의 - Action 수행 결과
|
|
4
|
+
*/
|
|
5
|
+
import type { ActionId } from "./action";
|
|
6
|
+
import type { ActorId } from "./actor";
|
|
7
|
+
/**
|
|
8
|
+
* Result 고유 ID 타입
|
|
9
|
+
* @description 브랜드 타입을 사용하여 타입 안전성을 확보
|
|
10
|
+
*/
|
|
11
|
+
export type ResultId = string & {
|
|
12
|
+
readonly __brand: "ResultId";
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Result 상태
|
|
16
|
+
* @description 행동 수행 결과의 상태
|
|
17
|
+
*/
|
|
18
|
+
export type ResultStatus = "success" | "failure" | "partial";
|
|
19
|
+
/**
|
|
20
|
+
* Result 메트릭
|
|
21
|
+
* @description 행동 수행의 성능 메트릭
|
|
22
|
+
*/
|
|
23
|
+
export interface ResultMetrics {
|
|
24
|
+
/** 실행 시간 (밀리초) */
|
|
25
|
+
duration: number;
|
|
26
|
+
/** 메모리 사용량 (바이트) */
|
|
27
|
+
memoryUsage?: number;
|
|
28
|
+
/** 추가 메트릭 */
|
|
29
|
+
[key: string]: unknown;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Result 인터페이스
|
|
33
|
+
* @description Action 수행 결과
|
|
34
|
+
*/
|
|
35
|
+
export interface Result {
|
|
36
|
+
/** 고유 식별자 */
|
|
37
|
+
readonly id: ResultId;
|
|
38
|
+
/** 관련 Action ID */
|
|
39
|
+
actionId: ActionId;
|
|
40
|
+
/** 결과를 생성한 액터 ID */
|
|
41
|
+
actorId: ActorId;
|
|
42
|
+
/** 결과 생성 시간 */
|
|
43
|
+
timestamp: Date;
|
|
44
|
+
/** 결과 상태 */
|
|
45
|
+
status: ResultStatus;
|
|
46
|
+
/** 출력 데이터 (성공 시) */
|
|
47
|
+
output?: unknown;
|
|
48
|
+
/** 오류 정보 (실패 시) - 문자열 형태 */
|
|
49
|
+
error?: string;
|
|
50
|
+
/** 성능 메트릭 */
|
|
51
|
+
metrics?: ResultMetrics;
|
|
52
|
+
/** 보드에 기록할 데이터 */
|
|
53
|
+
toRecord?: {
|
|
54
|
+
section: "state" | "knowledge" | "decisions";
|
|
55
|
+
data: unknown;
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Result ID 생성 함수
|
|
60
|
+
* @param id - 원본 문자열 ID
|
|
61
|
+
* @returns 브랜드 타입이 적용된 ResultId
|
|
62
|
+
* @example
|
|
63
|
+
* ```typescript
|
|
64
|
+
* const resultId = createResultId('result-001');
|
|
65
|
+
* // 타입: ResultId
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
export declare function createResultId(id: string): ResultId;
|
|
69
|
+
/**
|
|
70
|
+
* Result ID 유효성 검사
|
|
71
|
+
* @param value - 확인할 값
|
|
72
|
+
* @returns 유효한 ResultId 여부
|
|
73
|
+
*/
|
|
74
|
+
export declare function isValidResultId(value: unknown): value is ResultId;
|
|
75
|
+
/**
|
|
76
|
+
* 성공 Result 생성 함수
|
|
77
|
+
* @param actionId - Action ID
|
|
78
|
+
* @param actorId - 액터 ID
|
|
79
|
+
* @param output - 출력 데이터
|
|
80
|
+
* @param duration - 실행 시간 (밀리초)
|
|
81
|
+
* @returns 생성된 성공 Result 객체
|
|
82
|
+
* @example
|
|
83
|
+
* ```typescript
|
|
84
|
+
* const result = createSuccessResult(
|
|
85
|
+
* createActionId('action-001'),
|
|
86
|
+
* createActorId('actor-001'),
|
|
87
|
+
* { data: 'analysis result' },
|
|
88
|
+
* 100
|
|
89
|
+
* );
|
|
90
|
+
* ```
|
|
91
|
+
*/
|
|
92
|
+
export declare function createSuccessResult(actionId: ActionId, actorId: ActorId, output: unknown, duration: number): Result;
|
|
93
|
+
/**
|
|
94
|
+
* 실패 Result 생성 함수
|
|
95
|
+
* @param actionId - Action ID
|
|
96
|
+
* @param actorId - 액터 ID
|
|
97
|
+
* @param error - 오류 메시지
|
|
98
|
+
* @param duration - 실행 시간 (밀리초)
|
|
99
|
+
* @returns 생성된 실패 Result 객체
|
|
100
|
+
* @example
|
|
101
|
+
* ```typescript
|
|
102
|
+
* const result = createFailureResult(
|
|
103
|
+
* createActionId('action-001'),
|
|
104
|
+
* createActorId('actor-001'),
|
|
105
|
+
* 'Analysis failed',
|
|
106
|
+
* 50
|
|
107
|
+
* );
|
|
108
|
+
* ```
|
|
109
|
+
*/
|
|
110
|
+
export declare function createFailureResult(actionId: ActionId, actorId: ActorId, error: string, duration: number): Result;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from "./BaseActor.js";
|
|
2
|
+
export * from "./CellManager.js";
|
|
3
|
+
export * from "./PoolManager.js";
|
|
4
|
+
export * from "./ExecutionCell.js";
|
|
5
|
+
export * from "./CellContext.js";
|
|
6
|
+
export * from "./types.js";
|
|
7
|
+
export * from "./internal/ActorRunnerAdapter.js";
|
|
8
|
+
export * from "./internal/CellActorFactory.js";
|
|
9
|
+
export * from "./internal/NoOpRuntimeBus.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../../_legacy/actor/runtime/utils/delay.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../_legacy/actor/pool/index.js";
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export type CellId = string;
|
|
2
|
+
export type CellStatus = "idle" | "running" | "completed" | "failed" | "suspended";
|
|
3
|
+
export interface CellConfig {
|
|
4
|
+
timeout?: number;
|
|
5
|
+
maxToolCalls?: number;
|
|
6
|
+
metadata?: Record<string, unknown>;
|
|
7
|
+
}
|
|
8
|
+
export interface StateChange {
|
|
9
|
+
path: string;
|
|
10
|
+
oldValue: unknown;
|
|
11
|
+
newValue: unknown;
|
|
12
|
+
timestamp: Date;
|
|
13
|
+
}
|
|
14
|
+
export interface ToolCallRecord {
|
|
15
|
+
id: string;
|
|
16
|
+
toolName: string;
|
|
17
|
+
params: unknown;
|
|
18
|
+
status: "success" | "error";
|
|
19
|
+
result?: unknown;
|
|
20
|
+
error?: string;
|
|
21
|
+
startedAt: Date;
|
|
22
|
+
endedAt: Date;
|
|
23
|
+
durationMs: number;
|
|
24
|
+
}
|
|
25
|
+
export interface CellMetrics {
|
|
26
|
+
startTime: Date;
|
|
27
|
+
endTime: Date;
|
|
28
|
+
durationMs: number;
|
|
29
|
+
tokenCount?: number;
|
|
30
|
+
toolCallCount: number;
|
|
31
|
+
costUsd?: number;
|
|
32
|
+
}
|
|
33
|
+
export interface CellResult {
|
|
34
|
+
success: boolean;
|
|
35
|
+
output: unknown;
|
|
36
|
+
stateChanges: StateChange[];
|
|
37
|
+
toolCalls: ToolCallRecord[];
|
|
38
|
+
metrics: CellMetrics;
|
|
39
|
+
}
|
|
40
|
+
export interface Task {
|
|
41
|
+
id: string;
|
|
42
|
+
type: string;
|
|
43
|
+
description: string;
|
|
44
|
+
input: unknown;
|
|
45
|
+
priority: number;
|
|
46
|
+
metadata?: Record<string, unknown>;
|
|
47
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* M6-02: CheckpointableFactory registry
|
|
3
|
+
*
|
|
4
|
+
* Manages type→factory mappings for restoring checkpointed state.
|
|
5
|
+
*/
|
|
6
|
+
import type { CheckpointableFactory } from "../storage/types.js";
|
|
7
|
+
export declare class CheckpointFactoryNotFoundError extends Error {
|
|
8
|
+
readonly typeName: string;
|
|
9
|
+
constructor(typeName: string);
|
|
10
|
+
}
|
|
11
|
+
export declare class CheckpointFactoryRegistry {
|
|
12
|
+
private readonly factories;
|
|
13
|
+
register<T>(typeName: string, factory: CheckpointableFactory<T>): void;
|
|
14
|
+
get<T>(typeName: string): CheckpointableFactory<T>;
|
|
15
|
+
has(typeName: string): boolean;
|
|
16
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* M6-02: CheckpointManager — Creates and restores checkpoints for run resume.
|
|
3
|
+
*
|
|
4
|
+
* Responsibilities:
|
|
5
|
+
* - Save checkpoint after each step completion
|
|
6
|
+
* - Load latest checkpoint for a run
|
|
7
|
+
* - Detect policy drift
|
|
8
|
+
* - Determine step restoration policy
|
|
9
|
+
*/
|
|
10
|
+
import type { StorageAdapter, CheckpointRecord, StepRecord, ResumeOptions } from "../storage/types.js";
|
|
11
|
+
import { type PolicyHashInput } from "./policy-hash.js";
|
|
12
|
+
export interface CheckpointStepPolicy {
|
|
13
|
+
stepName: string;
|
|
14
|
+
action: "restore" | "rerun" | "skip";
|
|
15
|
+
output?: Record<string, unknown>;
|
|
16
|
+
}
|
|
17
|
+
export interface PolicyDriftResult {
|
|
18
|
+
drifted: boolean;
|
|
19
|
+
oldHash: string;
|
|
20
|
+
newHash: string;
|
|
21
|
+
}
|
|
22
|
+
export declare class PolicyDriftError extends Error {
|
|
23
|
+
readonly oldHash: string;
|
|
24
|
+
readonly newHash: string;
|
|
25
|
+
constructor(oldHash: string, newHash: string);
|
|
26
|
+
}
|
|
27
|
+
export declare class CheckpointManager {
|
|
28
|
+
private readonly storage;
|
|
29
|
+
constructor(storage: StorageAdapter);
|
|
30
|
+
saveCheckpoint(runId: string, stepName: string, completedSteps: string[], stateSnapshot: unknown, policyConfig: PolicyHashInput): Promise<CheckpointRecord>;
|
|
31
|
+
getLatestCheckpoint(runId: string): Promise<CheckpointRecord | null>;
|
|
32
|
+
detectDrift(checkpoint: CheckpointRecord, currentPolicyConfig: PolicyHashInput): PolicyDriftResult;
|
|
33
|
+
/**
|
|
34
|
+
* Determine step restoration policy per the design spec:
|
|
35
|
+
* - completed → restore (use cached output)
|
|
36
|
+
* - failed → rerun
|
|
37
|
+
* - running → rerun
|
|
38
|
+
* - skipped → skip
|
|
39
|
+
*/
|
|
40
|
+
resolveStepPolicies(steps: StepRecord[], completedSteps: string[], allStepNames: string[], options?: ResumeOptions): CheckpointStepPolicy[];
|
|
41
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { CheckpointManager, PolicyDriftError } from "./CheckpointManager.js";
|
|
2
|
+
export type { CheckpointStepPolicy, PolicyDriftResult } from "./CheckpointManager.js";
|
|
3
|
+
export { CheckpointFactoryRegistry, CheckpointFactoryNotFoundError } from "./CheckpointFactoryRegistry.js";
|
|
4
|
+
export { computePolicyHash } from "./policy-hash.js";
|
|
5
|
+
export type { PolicyHashInput } from "./policy-hash.js";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* M6-02: Policy hash computation for drift detection.
|
|
3
|
+
*
|
|
4
|
+
* Includes resources + policies config; excludes persistence/artifacts settings.
|
|
5
|
+
* Uses deterministic JSON serialization (sorted keys) + SHA-256.
|
|
6
|
+
*/
|
|
7
|
+
export interface PolicyHashInput {
|
|
8
|
+
resources?: Record<string, unknown>;
|
|
9
|
+
policies?: Record<string, unknown>;
|
|
10
|
+
}
|
|
11
|
+
export declare function computePolicyHash(input: PolicyHashInput): string;
|