@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,253 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module snapshot/snapshot-manager
|
|
3
|
+
* @description 스냅샷 관리자 (파사드 패턴)
|
|
4
|
+
*/
|
|
5
|
+
import type { BlackboardState } from '../types';
|
|
6
|
+
import type { Snapshot, SnapshotMeta, CreateSnapshotOptions, RestoreSnapshotOptions, SnapshotValidationResult } from './types';
|
|
7
|
+
import type { SnapshotCreatorOptions } from './snapshot-creator';
|
|
8
|
+
import type { SnapshotRestorerOptions } from './snapshot-restorer';
|
|
9
|
+
import type { SnapshotDiff, SectionDiff, SectionData } from './snapshot-comparer';
|
|
10
|
+
import { SnapshotRestoreError } from './snapshot-restorer';
|
|
11
|
+
/**
|
|
12
|
+
* 스냅샷 목록 필터 옵션
|
|
13
|
+
*/
|
|
14
|
+
export interface ListSnapshotOptions {
|
|
15
|
+
/** 태그로 필터링 */
|
|
16
|
+
tags?: string[];
|
|
17
|
+
/** 세션 ID로 필터링 */
|
|
18
|
+
sessionId?: string;
|
|
19
|
+
/** 정렬 기준 */
|
|
20
|
+
sortBy?: 'date' | 'id';
|
|
21
|
+
/** 정렬 순서 */
|
|
22
|
+
order?: 'asc' | 'desc';
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* 스냅샷 관리자 설정
|
|
26
|
+
*/
|
|
27
|
+
export interface SnapshotManagerOptions extends SnapshotCreatorOptions, SnapshotRestorerOptions {
|
|
28
|
+
/** 자동 압축 임계값 (바이트, 기본: 10KB) */
|
|
29
|
+
autoCompressThreshold?: number;
|
|
30
|
+
/** 기본 압축 사용 */
|
|
31
|
+
defaultCompress?: boolean;
|
|
32
|
+
/** ID 생성 함수 */
|
|
33
|
+
idGenerator?: () => string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* 스냅샷 복원 에러
|
|
37
|
+
*/
|
|
38
|
+
export { SnapshotRestoreError };
|
|
39
|
+
/**
|
|
40
|
+
* 스냅샷 관리자
|
|
41
|
+
* @description Blackboard 상태의 스냅샷 생성, 검증, 복원 담당
|
|
42
|
+
*
|
|
43
|
+
* 파사드 패턴으로 각 전문 클래스를 조합하여 기존 API 유지
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```typescript
|
|
47
|
+
* const manager = new SnapshotManager();
|
|
48
|
+
*
|
|
49
|
+
* // 스냅샷 생성
|
|
50
|
+
* const snapshot = await manager.createSnapshot(board.getState(), {
|
|
51
|
+
* description: 'Before major decision',
|
|
52
|
+
* tags: ['checkpoint', 'decision-001'],
|
|
53
|
+
* compress: true,
|
|
54
|
+
* });
|
|
55
|
+
*
|
|
56
|
+
* // JSON으로 저장
|
|
57
|
+
* const json = manager.toJSON(snapshot);
|
|
58
|
+
* fs.writeFileSync('snapshot.json', json);
|
|
59
|
+
*
|
|
60
|
+
* // JSON에서 로드
|
|
61
|
+
* const loaded = manager.fromJSON(fs.readFileSync('snapshot.json', 'utf-8'));
|
|
62
|
+
*
|
|
63
|
+
* // 검증
|
|
64
|
+
* const validation = await manager.validate(loaded);
|
|
65
|
+
* if (!validation.valid) {
|
|
66
|
+
* console.error('Invalid snapshot:', validation.errors);
|
|
67
|
+
* }
|
|
68
|
+
*
|
|
69
|
+
* // 복원
|
|
70
|
+
* const restoredState = manager.restore(loaded, {
|
|
71
|
+
* newSessionId: true,
|
|
72
|
+
* });
|
|
73
|
+
* board.replaceState(restoredState);
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
export declare class SnapshotManager {
|
|
77
|
+
private creator;
|
|
78
|
+
private validator;
|
|
79
|
+
private restorer;
|
|
80
|
+
private serializer;
|
|
81
|
+
private comparer;
|
|
82
|
+
private storage;
|
|
83
|
+
constructor(options?: SnapshotManagerOptions);
|
|
84
|
+
/**
|
|
85
|
+
* 스냅샷 저장 (내부)
|
|
86
|
+
*/
|
|
87
|
+
private storeSnapshot;
|
|
88
|
+
/**
|
|
89
|
+
* 저장된 스냅샷 목록 조회
|
|
90
|
+
* @param options - 필터 및 정렬 옵션
|
|
91
|
+
* @returns 스냅샷 목록
|
|
92
|
+
*/
|
|
93
|
+
list(options?: ListSnapshotOptions): Snapshot[];
|
|
94
|
+
/**
|
|
95
|
+
* ID로 스냅샷 조회
|
|
96
|
+
* @param id - 스냅샷 ID
|
|
97
|
+
* @returns 스냅샷 또는 undefined
|
|
98
|
+
*/
|
|
99
|
+
get(id: string): Snapshot | undefined;
|
|
100
|
+
/**
|
|
101
|
+
* ID로 스냅샷 삭제
|
|
102
|
+
* @param id - 스냅샷 ID
|
|
103
|
+
* @returns 삭제 성공 여부
|
|
104
|
+
*/
|
|
105
|
+
delete(id: string): boolean;
|
|
106
|
+
/**
|
|
107
|
+
* 스냅샷 생성 (동기)
|
|
108
|
+
* @param state - 현재 Blackboard 상태
|
|
109
|
+
* @param options - 생성 옵션
|
|
110
|
+
* @returns 스냅샷
|
|
111
|
+
*/
|
|
112
|
+
createSnapshot(state: BlackboardState, options?: CreateSnapshotOptions): Snapshot;
|
|
113
|
+
/**
|
|
114
|
+
* 메타데이터만 포함된 스냅샷 생성 (동기)
|
|
115
|
+
* @param state - 현재 상태
|
|
116
|
+
* @param description - 설명
|
|
117
|
+
* @returns 메타 전용 스냅샷
|
|
118
|
+
*/
|
|
119
|
+
createMetaSnapshot(state: BlackboardState, description?: string): SnapshotMeta;
|
|
120
|
+
/**
|
|
121
|
+
* 스냅샷 검증 (동기)
|
|
122
|
+
* @param snapshot - 검증할 스냅샷
|
|
123
|
+
* @returns 검증 결과
|
|
124
|
+
*/
|
|
125
|
+
validate(snapshot: Snapshot): SnapshotValidationResult;
|
|
126
|
+
/**
|
|
127
|
+
* 스냅샷 검증 (비동기)
|
|
128
|
+
* @param snapshot - 검증할 스냅샷
|
|
129
|
+
* @returns 검증 결과
|
|
130
|
+
*/
|
|
131
|
+
validateAsync(snapshot: Snapshot): Promise<SnapshotValidationResult>;
|
|
132
|
+
/**
|
|
133
|
+
* 버전 호환성 체크
|
|
134
|
+
* @param formatVersion - 스냅샷 형식 버전
|
|
135
|
+
* @returns 호환 여부 및 상세 정보
|
|
136
|
+
*/
|
|
137
|
+
checkVersionCompatibility(formatVersion: string): {
|
|
138
|
+
compatible: boolean;
|
|
139
|
+
current: string;
|
|
140
|
+
snapshot: string;
|
|
141
|
+
migrationRequired: boolean;
|
|
142
|
+
};
|
|
143
|
+
/**
|
|
144
|
+
* 동기 체크섬 검증 (구조적 검증만, 체크섬 제외)
|
|
145
|
+
* @description restore()에서 사용하는 동기 검증 메서드
|
|
146
|
+
* @param snapshot - 검증할 스냅샷
|
|
147
|
+
* @returns 검증 결과
|
|
148
|
+
*/
|
|
149
|
+
validateSyncStructure(snapshot: Snapshot): {
|
|
150
|
+
valid: boolean;
|
|
151
|
+
errors: string[];
|
|
152
|
+
};
|
|
153
|
+
/**
|
|
154
|
+
* 스냅샷에서 상태 복원
|
|
155
|
+
* @param snapshot - 스냅샷
|
|
156
|
+
* @param options - 복원 옵션
|
|
157
|
+
* @returns 복원된 상태
|
|
158
|
+
* @throws {SnapshotRestoreError} 복원 실패 시
|
|
159
|
+
* @description
|
|
160
|
+
* **옵션 동작:**
|
|
161
|
+
* - `skipVersionCheck`: 포맷 버전 호환성 검사 건너뜀
|
|
162
|
+
* - `skipStructuralValidation`: 구조적 검증 건너뜀 (validateSync)
|
|
163
|
+
* - `resetVersion`: 상태 버전 0으로 초기화 (기본: true)
|
|
164
|
+
* - `newSessionId`: 새 세션 ID 생성 (기본: true)
|
|
165
|
+
*/
|
|
166
|
+
restore(snapshot: Snapshot, options?: RestoreSnapshotOptions): BlackboardState;
|
|
167
|
+
/**
|
|
168
|
+
* 부분 복원 (특정 섹션만)
|
|
169
|
+
* @param snapshot - 스냅샷
|
|
170
|
+
* @param currentState - 현재 상태
|
|
171
|
+
* @param sections - 복원할 섹션
|
|
172
|
+
* @returns 병합된 상태
|
|
173
|
+
*/
|
|
174
|
+
partialRestore(snapshot: Snapshot, currentState: BlackboardState, sections: ('state' | 'knowledge' | 'decisions')[]): BlackboardState;
|
|
175
|
+
/**
|
|
176
|
+
* 스냅샷 → JSON 문자열
|
|
177
|
+
* @param snapshot - 스냅샷
|
|
178
|
+
* @param pretty - 예쁜 출력 여부
|
|
179
|
+
* @returns JSON 문자열
|
|
180
|
+
*/
|
|
181
|
+
toJSON(snapshot: Snapshot, pretty?: boolean): string;
|
|
182
|
+
/**
|
|
183
|
+
* JSON 문자열 → 스냅샷
|
|
184
|
+
* @param json - JSON 문자열
|
|
185
|
+
* @returns 스냅샷
|
|
186
|
+
* @throws {Error} JSON 파싱 실패 시 명확한 에러 메시지
|
|
187
|
+
*/
|
|
188
|
+
fromJSON(json: string): Snapshot;
|
|
189
|
+
/**
|
|
190
|
+
* 스냅샷 → Uint8Array (바이너리)
|
|
191
|
+
* @param snapshot - 스냅샷
|
|
192
|
+
* @returns Uint8Array
|
|
193
|
+
*/
|
|
194
|
+
toUint8Array(snapshot: Snapshot): Uint8Array;
|
|
195
|
+
/**
|
|
196
|
+
* Uint8Array → 스냅샷
|
|
197
|
+
* @param bytes - 바이트 배열
|
|
198
|
+
* @returns 스냅샷
|
|
199
|
+
* @throws {Error} 디코딩 실패 시 명확한 에러 메시지
|
|
200
|
+
*/
|
|
201
|
+
fromUint8Array(bytes: Uint8Array): Snapshot;
|
|
202
|
+
/**
|
|
203
|
+
* 스냅샷 비교
|
|
204
|
+
* @param a - 첫 번째 스냅샷
|
|
205
|
+
* @param b - 두 번째 스냅샷
|
|
206
|
+
* @returns 차이점 목록
|
|
207
|
+
*/
|
|
208
|
+
compare(a: Snapshot, b: Snapshot): SnapshotDiff;
|
|
209
|
+
/**
|
|
210
|
+
* 섹션 차이점 생성
|
|
211
|
+
* @param data1 - 첫 번째 데이터
|
|
212
|
+
* @param data2 - 두 번째 데이터
|
|
213
|
+
* @returns 섹션 차이점
|
|
214
|
+
*/
|
|
215
|
+
createSectionDiff(data1: SectionData, data2: SectionData): SectionDiff;
|
|
216
|
+
/**
|
|
217
|
+
* 상태 데이터 추출
|
|
218
|
+
* @param snapshot - 스냅샷
|
|
219
|
+
* @returns 상태 데이터
|
|
220
|
+
*/
|
|
221
|
+
extractStateData(snapshot: Snapshot): SectionData;
|
|
222
|
+
/**
|
|
223
|
+
* 지식 데이터 추출
|
|
224
|
+
* @param snapshot - 스냅샷
|
|
225
|
+
* @returns 지식 데이터
|
|
226
|
+
*/
|
|
227
|
+
extractKnowledgeData(snapshot: Snapshot): SectionData;
|
|
228
|
+
/**
|
|
229
|
+
* 의사결정 데이터 추출
|
|
230
|
+
* @param snapshot - 스냅샷
|
|
231
|
+
* @returns 의사결정 데이터
|
|
232
|
+
*/
|
|
233
|
+
extractDecisionsData(snapshot: Snapshot): SectionData;
|
|
234
|
+
/**
|
|
235
|
+
* 스냅샷 메타데이터만 추출
|
|
236
|
+
*/
|
|
237
|
+
extractMeta(snapshot: Snapshot): SnapshotMeta;
|
|
238
|
+
/**
|
|
239
|
+
* 스냅샷 크기 계산 (숫자)
|
|
240
|
+
* @param snapshot - 스냅샷
|
|
241
|
+
* @returns 바이트 크기
|
|
242
|
+
*/
|
|
243
|
+
size(snapshot: Snapshot): number;
|
|
244
|
+
/**
|
|
245
|
+
* 스냅샷 크기 계산 (상세)
|
|
246
|
+
*/
|
|
247
|
+
calculateSize(snapshot: Snapshot): {
|
|
248
|
+
total: number;
|
|
249
|
+
data: number;
|
|
250
|
+
meta: number;
|
|
251
|
+
compressed: boolean;
|
|
252
|
+
};
|
|
253
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module snapshot/snapshot-restorer
|
|
3
|
+
* @description 스냅샷 복원 담당
|
|
4
|
+
*/
|
|
5
|
+
import type { BlackboardState } from '../types';
|
|
6
|
+
import type { Snapshot, RestoreSnapshotOptions } from './types';
|
|
7
|
+
/**
|
|
8
|
+
* 스냅샷 복원 에러
|
|
9
|
+
*/
|
|
10
|
+
export declare class SnapshotRestoreError extends Error {
|
|
11
|
+
readonly code: string;
|
|
12
|
+
readonly details?: unknown | undefined;
|
|
13
|
+
constructor(message: string, code: string, details?: unknown | undefined);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* 스냅샷 복원자 설정
|
|
17
|
+
*/
|
|
18
|
+
export interface SnapshotRestorerOptions {
|
|
19
|
+
/** ID 생성 함수 */
|
|
20
|
+
idGenerator?: () => string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* 스냅샷 복원자
|
|
24
|
+
* @description 스냅샷 복원 전담 클래스
|
|
25
|
+
*/
|
|
26
|
+
export declare class SnapshotRestorer {
|
|
27
|
+
private serializer;
|
|
28
|
+
private validator;
|
|
29
|
+
private idGenerator;
|
|
30
|
+
constructor(options?: SnapshotRestorerOptions);
|
|
31
|
+
/**
|
|
32
|
+
* 스냅샷에서 상태 복원
|
|
33
|
+
* @param snapshot - 스냅샷
|
|
34
|
+
* @param options - 복원 옵션
|
|
35
|
+
* @returns 복원된 상태
|
|
36
|
+
* @throws {SnapshotRestoreError} 복원 실패 시
|
|
37
|
+
* @description
|
|
38
|
+
* **옵션 동작:**
|
|
39
|
+
* - `skipVersionCheck`: 포맷 버전 호환성 검사 건너뜀
|
|
40
|
+
* - `skipStructuralValidation`: 구조적 검증 건너뜀 (validateSync)
|
|
41
|
+
* - 참고: 체크섬 검증은 validate()에서 수행됨
|
|
42
|
+
* - `resetVersion`: 상태 버전 0으로 초기화 (기본: true)
|
|
43
|
+
* - `newSessionId`: 새 세션 ID 생성 (기본: true)
|
|
44
|
+
*/
|
|
45
|
+
restore(snapshot: Snapshot, options?: RestoreSnapshotOptions): BlackboardState;
|
|
46
|
+
/**
|
|
47
|
+
* 부분 복원 (특정 섹션만)
|
|
48
|
+
* @param snapshot - 스냅샷
|
|
49
|
+
* @param currentState - 현재 상태
|
|
50
|
+
* @param sections - 복원할 섹션
|
|
51
|
+
* @returns 병합된 상태
|
|
52
|
+
*/
|
|
53
|
+
partialRestore(snapshot: Snapshot, currentState: BlackboardState, sections: ('state' | 'knowledge' | 'decisions')[]): BlackboardState;
|
|
54
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module snapshot/snapshot-serializer
|
|
3
|
+
* @description 스냅샷 직렬화 담당
|
|
4
|
+
*/
|
|
5
|
+
import type { Snapshot } from './types';
|
|
6
|
+
/**
|
|
7
|
+
* 스냅샷 직렬화 옵션
|
|
8
|
+
*/
|
|
9
|
+
export interface SnapshotSerializeOptions {
|
|
10
|
+
/** 예쁜 출력 여부 */
|
|
11
|
+
pretty?: boolean;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* 스냅샷 직렬화자
|
|
15
|
+
* @description 스냅샷 직렬화/역직렬화 전담 클래스
|
|
16
|
+
*/
|
|
17
|
+
export declare class SnapshotSerializer {
|
|
18
|
+
/**
|
|
19
|
+
* 스냅샷 → JSON 문자열
|
|
20
|
+
* @param snapshot - 스냅샷
|
|
21
|
+
* @param pretty - 예쁜 출력 여부
|
|
22
|
+
* @returns JSON 문자열
|
|
23
|
+
*/
|
|
24
|
+
toJSON(snapshot: Snapshot, pretty?: boolean): string;
|
|
25
|
+
/**
|
|
26
|
+
* JSON 문자열 → 스냅샷
|
|
27
|
+
* @param json - JSON 문자열
|
|
28
|
+
* @returns 스냅샷
|
|
29
|
+
* @throws {Error} JSON 파싱 실패 시 명확한 에러 메시지
|
|
30
|
+
*/
|
|
31
|
+
fromJSON(json: string): Snapshot;
|
|
32
|
+
/**
|
|
33
|
+
* 스냅샷 → Uint8Array (바이너리)
|
|
34
|
+
* @param snapshot - 스냅샷
|
|
35
|
+
* @returns Uint8Array
|
|
36
|
+
*/
|
|
37
|
+
toUint8Array(snapshot: Snapshot): Uint8Array;
|
|
38
|
+
/**
|
|
39
|
+
* Uint8Array → 스냅샷
|
|
40
|
+
* @param bytes - 바이트 배열
|
|
41
|
+
* @returns 스냅샷
|
|
42
|
+
* @throws {Error} 디코딩 실패 시 명확한 에러 메시지
|
|
43
|
+
*/
|
|
44
|
+
fromUint8Array(bytes: Uint8Array): Snapshot;
|
|
45
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module snapshot/snapshot-validator
|
|
3
|
+
* @description 스냅샷 검증 담당
|
|
4
|
+
*/
|
|
5
|
+
import type { Snapshot, SnapshotValidationResult } from "./types";
|
|
6
|
+
import { StateSerializer } from "./serializer";
|
|
7
|
+
/**
|
|
8
|
+
* 스냅샷 검증자
|
|
9
|
+
* @description 스냅샷 검증 전담 클래스
|
|
10
|
+
*/
|
|
11
|
+
export declare class SnapshotValidator {
|
|
12
|
+
private serializer;
|
|
13
|
+
constructor(serializer?: StateSerializer);
|
|
14
|
+
/**
|
|
15
|
+
* 스냅샷 검증 (비동기)
|
|
16
|
+
* @param snapshot - 검증할 스냅샷
|
|
17
|
+
* @returns 검증 결과
|
|
18
|
+
*/
|
|
19
|
+
validate(snapshot: Snapshot): Promise<SnapshotValidationResult>;
|
|
20
|
+
/**
|
|
21
|
+
* 스냅샷 검증 (동기)
|
|
22
|
+
* @param snapshot - 검증할 스냅샷
|
|
23
|
+
* @returns 검증 결과
|
|
24
|
+
* @description 테스트 환경 등에서 동기 검증이 필요한 경우 사용
|
|
25
|
+
*/
|
|
26
|
+
validateSync(snapshot: Snapshot): SnapshotValidationResult;
|
|
27
|
+
/**
|
|
28
|
+
* 버전 호환성 체크
|
|
29
|
+
* @param formatVersion - 스냅샷 형식 버전
|
|
30
|
+
* @returns 호환 여부 및 상세 정보
|
|
31
|
+
*/
|
|
32
|
+
checkVersionCompatibility(formatVersion: string): {
|
|
33
|
+
compatible: boolean;
|
|
34
|
+
current: string;
|
|
35
|
+
snapshot: string;
|
|
36
|
+
migrationRequired: boolean;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* 동기 체크섬 검증 (구조적 검증만, 체크섬 제외)
|
|
40
|
+
* @description restore()에서 사용하는 동기 검증 메서드
|
|
41
|
+
* 체크섬 검증은 비동기이므로 validate()에서 수행해야 함
|
|
42
|
+
* @param snapshot - 검증할 스냅샷
|
|
43
|
+
* @returns 검증 결과
|
|
44
|
+
*/
|
|
45
|
+
validateSyncStructure(snapshot: Snapshot): {
|
|
46
|
+
valid: boolean;
|
|
47
|
+
errors: string[];
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* 런타임 구조 검증 (P0: agents/tasks/opinions)
|
|
51
|
+
* @description 역직렬화 후 실제 데이터 구조 검증
|
|
52
|
+
* P1: 에러 수집 모드 (break 제거)
|
|
53
|
+
*/
|
|
54
|
+
private validateRuntimeStructure;
|
|
55
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module snapshot/type-guards
|
|
3
|
+
* @description 타입 가드 함수들 (중복 제거)
|
|
4
|
+
*/
|
|
5
|
+
import type { SerializedState } from './types';
|
|
6
|
+
/**
|
|
7
|
+
* 타입 가드: SerializedState 여부 확인
|
|
8
|
+
* @description P1: 검증 범위 확대 - state/knowledge/decisions 필드 검증 추가
|
|
9
|
+
* @param value - 확인할 값
|
|
10
|
+
* @returns SerializedState 타입 여부
|
|
11
|
+
*/
|
|
12
|
+
export declare function isSerializedState(value: unknown): value is SerializedState;
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module snapshot/types
|
|
3
|
+
* @description 스냅샷 타입 정의
|
|
4
|
+
*/
|
|
5
|
+
import type { SessionId } from "../types";
|
|
6
|
+
/**
|
|
7
|
+
* 스냅샷 형식 버전
|
|
8
|
+
* @description 역직렬화 시 호환성 체크에 사용
|
|
9
|
+
*/
|
|
10
|
+
export declare const SNAPSHOT_FORMAT_VERSION = "1.0.0";
|
|
11
|
+
/**
|
|
12
|
+
* 스냅샷 메타데이터
|
|
13
|
+
*/
|
|
14
|
+
export interface SnapshotMeta {
|
|
15
|
+
/** 스냅샷 ID */
|
|
16
|
+
readonly id: string;
|
|
17
|
+
/** 스냅샷 형식 버전 */
|
|
18
|
+
readonly formatVersion: string;
|
|
19
|
+
/** 생성 시간 */
|
|
20
|
+
readonly createdAt: Date;
|
|
21
|
+
/** 원본 세션 ID */
|
|
22
|
+
readonly sessionId: SessionId;
|
|
23
|
+
/** 원본 상태 버전 */
|
|
24
|
+
readonly stateVersion: number;
|
|
25
|
+
/** 스냅샷 설명 (선택) */
|
|
26
|
+
readonly description?: string;
|
|
27
|
+
/** 스냅샷 태그 (선택) */
|
|
28
|
+
readonly tags?: string[];
|
|
29
|
+
/** 체크섬 (무결성 검증용) */
|
|
30
|
+
readonly checksum: string;
|
|
31
|
+
/** 압축 데이터 체크섬 */
|
|
32
|
+
readonly compressedChecksum?: string;
|
|
33
|
+
/** 압축 여부 */
|
|
34
|
+
readonly compressed: boolean;
|
|
35
|
+
/** 원본 크기 (바이트) */
|
|
36
|
+
readonly originalSize: number;
|
|
37
|
+
/** 압축 크기 (바이트, 압축 시) */
|
|
38
|
+
readonly compressedSize?: number;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* 직렬화된 상태
|
|
42
|
+
* @description Map, Date 등이 JSON 호환 형식으로 변환됨
|
|
43
|
+
*/
|
|
44
|
+
export interface SerializedState {
|
|
45
|
+
meta: {
|
|
46
|
+
version: number;
|
|
47
|
+
lastUpdated: string;
|
|
48
|
+
sessionId: string;
|
|
49
|
+
createdAt: string;
|
|
50
|
+
};
|
|
51
|
+
state: {
|
|
52
|
+
phase: string;
|
|
53
|
+
context: Record<string, unknown>;
|
|
54
|
+
agents: Array<[string, unknown]>;
|
|
55
|
+
tasks: Array<[string, unknown]>;
|
|
56
|
+
};
|
|
57
|
+
knowledge: {
|
|
58
|
+
facts: unknown[];
|
|
59
|
+
inferences: unknown[];
|
|
60
|
+
patterns: unknown[];
|
|
61
|
+
};
|
|
62
|
+
decisions: {
|
|
63
|
+
current: unknown | null;
|
|
64
|
+
pending: unknown[];
|
|
65
|
+
opinions: Array<[string, unknown]>;
|
|
66
|
+
history: unknown[];
|
|
67
|
+
voting?: Record<string, unknown>;
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* 전체 스냅샷 구조
|
|
72
|
+
*/
|
|
73
|
+
export interface Snapshot {
|
|
74
|
+
/** 메타데이터 */
|
|
75
|
+
meta: SnapshotMeta;
|
|
76
|
+
/** 직렬화된 상태 데이터 */
|
|
77
|
+
data: SerializedState | string;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* 스냅샷 생성 옵션
|
|
81
|
+
*/
|
|
82
|
+
export interface CreateSnapshotOptions {
|
|
83
|
+
/** 스냅샷 설명 */
|
|
84
|
+
description?: string;
|
|
85
|
+
/** 태그 */
|
|
86
|
+
tags?: string[];
|
|
87
|
+
/** 압축 사용 여부 (기본: false) */
|
|
88
|
+
compress?: boolean;
|
|
89
|
+
/** 특정 섹션만 포함 */
|
|
90
|
+
includeSections?: ("state" | "knowledge" | "decisions")[];
|
|
91
|
+
/** 메타만 포함 (상태 제외) */
|
|
92
|
+
metaOnly?: boolean;
|
|
93
|
+
/** 내부 저장소에 저장 여부 */
|
|
94
|
+
store?: boolean;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* 스냅샷 복원 옵션
|
|
98
|
+
*/
|
|
99
|
+
export interface RestoreSnapshotOptions {
|
|
100
|
+
/** 버전 체크 건너뛰기 */
|
|
101
|
+
skipVersionCheck?: boolean;
|
|
102
|
+
/** 구조적 검증 건너뛰기 (validateSync) */
|
|
103
|
+
skipStructuralValidation?: boolean;
|
|
104
|
+
/** 검증 건너뛰기 (별칭: skipStructuralValidation) */
|
|
105
|
+
skipValidation?: boolean;
|
|
106
|
+
/** 특정 섹션만 복원 */
|
|
107
|
+
restoreSections?: ("state" | "knowledge" | "decisions")[];
|
|
108
|
+
/** 복원 후 버전 리셋 여부 (기본: true) */
|
|
109
|
+
resetVersion?: boolean;
|
|
110
|
+
/** 새 세션 ID 발급 (기본: true) */
|
|
111
|
+
newSessionId?: boolean;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* 스냅샷 검증 결과
|
|
115
|
+
*/
|
|
116
|
+
export interface SnapshotValidationResult {
|
|
117
|
+
/** 유효 여부 */
|
|
118
|
+
valid: boolean;
|
|
119
|
+
/** 에러 목록 */
|
|
120
|
+
errors: SnapshotValidationError[];
|
|
121
|
+
/** 경고 목록 */
|
|
122
|
+
warnings: SnapshotValidationWarning[];
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* 검증 에러
|
|
126
|
+
*/
|
|
127
|
+
export interface SnapshotValidationError {
|
|
128
|
+
code: "VERSION_MISMATCH" | "CHECKSUM_INVALID" | "DATA_CORRUPTED" | "FORMAT_INVALID" | "MISSING_FIELD";
|
|
129
|
+
message: string;
|
|
130
|
+
details?: unknown;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* 검증 경고
|
|
134
|
+
*/
|
|
135
|
+
export interface SnapshotValidationWarning {
|
|
136
|
+
code: "DEPRECATED_FORMAT" | "UNKNOWN_FIELDS" | "PARTIAL_DATA";
|
|
137
|
+
message: string;
|
|
138
|
+
details?: unknown;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* 스냅샷 마이그레이션 인터페이스
|
|
142
|
+
* @description 스냅샷 데이터 버전 간 마이그레이션을 위한 인터페이스
|
|
143
|
+
*/
|
|
144
|
+
export interface SnapshotMigration {
|
|
145
|
+
/** 원본 버전 */
|
|
146
|
+
fromVersion: number;
|
|
147
|
+
/** 대상 버전 */
|
|
148
|
+
toVersion: number;
|
|
149
|
+
/** 마이그레이션 함수 */
|
|
150
|
+
migrate(data: unknown): unknown;
|
|
151
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module snapshot/utils
|
|
3
|
+
* @description 유틸리티 함수들 (중복 제거)
|
|
4
|
+
*/
|
|
5
|
+
import type { Snapshot, SerializedState } from "./types";
|
|
6
|
+
/**
|
|
7
|
+
* JSON.stringify replacer for key sorting
|
|
8
|
+
* @param key - Property key
|
|
9
|
+
* @param value - Property value
|
|
10
|
+
* @returns Value with sorted keys for objects
|
|
11
|
+
*/
|
|
12
|
+
export declare function sortedKeyReplacer(key: string, value: unknown): unknown;
|
|
13
|
+
/**
|
|
14
|
+
* 스냅샷 데이터 압축 해제 (공통 헬퍼)
|
|
15
|
+
* @description P0: decompressData 로직 중복 제거를 위한 공통 함수
|
|
16
|
+
* @param snapshot - 스냅샷
|
|
17
|
+
* @returns 역직렬화된 상태 데이터
|
|
18
|
+
* @throws {Error} 압축 해제 실패 또는 타입 불일치 시
|
|
19
|
+
*/
|
|
20
|
+
export declare function decompressSnapshotData(snapshot: Snapshot): SerializedState;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module agent
|
|
3
|
+
* @description 에이전트 관련 타입 정의
|
|
4
|
+
*/
|
|
5
|
+
import type { Timestamped } from "./base";
|
|
6
|
+
import type { AgentId, TaskId } from "./base";
|
|
7
|
+
/**
|
|
8
|
+
* 에이전트 상태 enum
|
|
9
|
+
* @description 에이전트의 현재 활동 상태를 나타냄
|
|
10
|
+
*/
|
|
11
|
+
export declare enum AgentStatusEnum {
|
|
12
|
+
/** 유휴 상태 - 작업 대기 중 */
|
|
13
|
+
IDLE = "idle",
|
|
14
|
+
/** 작업 중 - 활성 상태 */
|
|
15
|
+
BUSY = "busy",
|
|
16
|
+
/** 오류 상태 - 복구 필요 */
|
|
17
|
+
ERROR = "error",
|
|
18
|
+
/** 중지됨 */
|
|
19
|
+
STOPPED = "stopped"
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* 에이전트 역할 타입
|
|
23
|
+
* @description 에이전트가 수행할 수 있는 역할
|
|
24
|
+
*/
|
|
25
|
+
export type AgentRole = "analyst" | "executor" | "verifier" | "director";
|
|
26
|
+
/**
|
|
27
|
+
* 에이전트 상태 정보
|
|
28
|
+
* @description 에이전트의 현재 상태와 작업 정보를 담는 인터페이스
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```typescript
|
|
32
|
+
* const agentStatus: AgentStatus = {
|
|
33
|
+
* id: createAgentId('agent-001'),
|
|
34
|
+
* role: 'analyst',
|
|
35
|
+
* status: AgentStatusEnum.BUSY,
|
|
36
|
+
* currentTask: createTaskId('task-001'),
|
|
37
|
+
* lastHeartbeat: new Date(),
|
|
38
|
+
* createdAt: new Date(),
|
|
39
|
+
* updatedAt: new Date(),
|
|
40
|
+
* metadata: { model: 'gpt-4' }
|
|
41
|
+
* };
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
export interface AgentStatus extends Timestamped {
|
|
45
|
+
/** 에이전트 고유 ID */
|
|
46
|
+
readonly id: AgentId;
|
|
47
|
+
/** 에이전트 역할 */
|
|
48
|
+
readonly role: AgentRole;
|
|
49
|
+
/** 현재 상태 */
|
|
50
|
+
status: AgentStatusEnum;
|
|
51
|
+
/** 현재 수행 중인 작업 (없으면 null) */
|
|
52
|
+
currentTask: TaskId | null;
|
|
53
|
+
/** 마지막 하트비트 시간 */
|
|
54
|
+
lastHeartbeat: Date;
|
|
55
|
+
/** 추가 메타데이터 */
|
|
56
|
+
metadata: Record<string, unknown>;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* 에이전트 상태 업데이트 옵션
|
|
60
|
+
* @description 부분 업데이트를 위한 선택적 필드 인터페이스
|
|
61
|
+
*/
|
|
62
|
+
export interface AgentStatusUpdate {
|
|
63
|
+
/** 새로운 상태 */
|
|
64
|
+
status?: AgentStatusEnum;
|
|
65
|
+
/** 새로운 현재 작업 */
|
|
66
|
+
currentTask?: TaskId | null;
|
|
67
|
+
/** 마지막 하트비트 시간 */
|
|
68
|
+
lastHeartbeat?: Date;
|
|
69
|
+
/** 업데이트할 메타데이터 */
|
|
70
|
+
metadata?: Partial<Record<string, unknown>>;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* 에이전트 통계
|
|
74
|
+
* @description 에이전트의 성능 및 활동 통계
|
|
75
|
+
*/
|
|
76
|
+
export interface AgentStats {
|
|
77
|
+
/** 에이전트 ID */
|
|
78
|
+
agentId: AgentId;
|
|
79
|
+
/** 완료한 작업 수 */
|
|
80
|
+
tasksCompleted: number;
|
|
81
|
+
/** 실패한 작업 수 */
|
|
82
|
+
tasksFailed: number;
|
|
83
|
+
/** 총 작업 시간 (밀리초) */
|
|
84
|
+
totalTaskTime: number;
|
|
85
|
+
/** 평균 작업 시간 (밀리초) */
|
|
86
|
+
averageTaskTime: number;
|
|
87
|
+
/** 마지막 활동 시간 */
|
|
88
|
+
lastActiveTime: Date;
|
|
89
|
+
}
|