synapse-causal-memory 0.2.3 → 0.3.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/causal-memory.json +35 -2
- package/dist/causal-branch.d.ts +79 -0
- package/dist/causal-config.d.ts +10 -0
- package/dist/causal-context.d.ts +113 -0
- package/dist/causal-graveyard.d.ts +94 -0
- package/dist/causal-lens.d.ts +133 -0
- package/dist/causal-predictor.d.ts +42 -0
- package/dist/causal-server.d.ts +279 -1
- package/dist/causal-store.d.ts +7 -0
- package/dist/causal-synthesizer.d.ts +96 -0
- package/dist/causal-timeseries.d.ts +92 -0
- package/dist/cli.js +2964 -46
- package/dist/index.d.ts +7 -0
- package/dist/index.js +2402 -16
- package/package.json +1 -1
package/causal-memory.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": "2.1.0",
|
|
3
|
-
"updatedAt": "2026-11-
|
|
4
|
-
"totalRules":
|
|
3
|
+
"updatedAt": "2026-11-09T16:19:26.821Z",
|
|
4
|
+
"totalRules": 165,
|
|
5
5
|
"totalRelations": 44,
|
|
6
6
|
"rules": [
|
|
7
7
|
{
|
|
@@ -4794,6 +4794,39 @@
|
|
|
4794
4794
|
"Synapse Kit v0.2.3 3대 코어(compiler, memory, db) 통합 완료"
|
|
4795
4795
|
],
|
|
4796
4796
|
"lastVerified": "2026-11-08"
|
|
4797
|
+
},
|
|
4798
|
+
{
|
|
4799
|
+
"id": "ctx-active-session-snapshot",
|
|
4800
|
+
"domain": "User_Preferences_And_Rules",
|
|
4801
|
+
"title": "Active_Session_Context_Snapshot",
|
|
4802
|
+
"entityType": "ContextCheckpoint",
|
|
4803
|
+
"triggers": {
|
|
4804
|
+
"alwaysActive": true,
|
|
4805
|
+
"keywords": [
|
|
4806
|
+
"context",
|
|
4807
|
+
"checkpoint",
|
|
4808
|
+
"resume",
|
|
4809
|
+
"컨텍스트",
|
|
4810
|
+
"이어서",
|
|
4811
|
+
"default-session"
|
|
4812
|
+
]
|
|
4813
|
+
},
|
|
4814
|
+
"invariants": [
|
|
4815
|
+
"[최근 작업 목표] core 영역의 기능을 확장하고 변경 사항을 무결하게 정합하는 작업",
|
|
4816
|
+
"[다음 최우선 진행 과제] 추가/수정된 모듈에 대한 포괄적 통합 테스트 스위트 작성 및 회귀 방지"
|
|
4817
|
+
],
|
|
4818
|
+
"actions": [
|
|
4819
|
+
"추가/수정된 모듈에 대한 포괄적 통합 테스트 스위트 작성 및 회귀 방지",
|
|
4820
|
+
"Bun 런타임 기반 빌드 검증 (`bun run build`) 및 무오류 확인",
|
|
4821
|
+
"전역 컨텍스트 스냅샷 데이터베이스 동기화 및 기억 영속화"
|
|
4822
|
+
],
|
|
4823
|
+
"context": [
|
|
4824
|
+
"체크포인트 ID: ctx_20261110_005446_qw31 (세션: default-session, 시각: 2026-11-09T15:54:46.391Z)",
|
|
4825
|
+
"제목: Synapse Kit v0.3.0 완료 - 6대 인지 슈퍼 코어 완비 및 31개 테스트 2022개 검증 100% 통과",
|
|
4826
|
+
"완료 내역: 소스 코드 변경 및 모듈 구조 정비",
|
|
4827
|
+
"핵심 결정: 하드코딩 배제 및 환경 변수/설정 모듈 중심의 설정 아키텍처 적용 | SOLID 단일 책임 원칙(SRP)을 준수한 독립 엔진 분리"
|
|
4828
|
+
],
|
|
4829
|
+
"lastVerified": "2026-11-09"
|
|
4797
4830
|
}
|
|
4798
4831
|
],
|
|
4799
4832
|
"relations": [
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { ContextCheckpointStore, type ContextCheckpoint } from './causal-context';
|
|
2
|
+
import { CausalGraveyardStore } from './causal-graveyard';
|
|
3
|
+
/**
|
|
4
|
+
* 컨텍스트 브랜치 레코드 규격
|
|
5
|
+
*/
|
|
6
|
+
export interface ContextBranch {
|
|
7
|
+
readonly name: string;
|
|
8
|
+
readonly baseCheckpointId: string;
|
|
9
|
+
readonly headCheckpointId: string;
|
|
10
|
+
readonly createdAt: string;
|
|
11
|
+
readonly updatedAt: string;
|
|
12
|
+
readonly status: 'active' | 'merged' | 'abandoned';
|
|
13
|
+
readonly description?: string;
|
|
14
|
+
readonly mergedInto?: string;
|
|
15
|
+
readonly abandonmentReason?: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* 브랜치 데이터베이스 규격
|
|
19
|
+
*/
|
|
20
|
+
export interface BranchDatabase {
|
|
21
|
+
readonly version: string;
|
|
22
|
+
readonly updatedAt: string;
|
|
23
|
+
readonly currentBranch: string;
|
|
24
|
+
readonly branches: readonly ContextBranch[];
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* 컨텍스트 브랜칭 및 머지 관리자 클래스 (SRP 준수)
|
|
28
|
+
*/
|
|
29
|
+
export declare class CausalBranchStore {
|
|
30
|
+
private readonly dbPath;
|
|
31
|
+
private readonly contextStore;
|
|
32
|
+
private readonly graveyardStore;
|
|
33
|
+
private database;
|
|
34
|
+
private lastMtimeMs;
|
|
35
|
+
constructor(customPathOrContextStore?: string | ContextCheckpointStore, contextStoreOrGraveyard?: any, graveyardStore?: CausalGraveyardStore);
|
|
36
|
+
private loadDatabase;
|
|
37
|
+
reloadIfNeeded(): void;
|
|
38
|
+
private saveDatabase;
|
|
39
|
+
/**
|
|
40
|
+
* 신규 브랜치 분기 (Fork)
|
|
41
|
+
*/
|
|
42
|
+
createBranch(name: string, options?: {
|
|
43
|
+
baseId?: string;
|
|
44
|
+
description?: string;
|
|
45
|
+
}): Promise<ContextBranch>;
|
|
46
|
+
/**
|
|
47
|
+
* 활성 브랜치 전환 (Switch)
|
|
48
|
+
*/
|
|
49
|
+
switchBranch(name: string): ContextBranch;
|
|
50
|
+
/**
|
|
51
|
+
* 브랜치 병합 (Merge)
|
|
52
|
+
* 소스 브랜치의 핵심 의사결정 및 완료 과업을 타깃 브랜치로 통합
|
|
53
|
+
*/
|
|
54
|
+
mergeBranch(sourceName: string, targetName?: string): Promise<{
|
|
55
|
+
mergedBranch: ContextBranch;
|
|
56
|
+
resultingCheckpoint: ContextCheckpoint;
|
|
57
|
+
}>;
|
|
58
|
+
/**
|
|
59
|
+
* 실패한 브랜치 폐기 및 실패 원인 Graveyard 자동 흡수
|
|
60
|
+
*/
|
|
61
|
+
abandonBranch(name: string, failureInfo?: string | {
|
|
62
|
+
failedApproach?: string;
|
|
63
|
+
errorSignature?: string;
|
|
64
|
+
rootCause?: string;
|
|
65
|
+
counterMeasure?: string;
|
|
66
|
+
}, safeAlternative?: string): {
|
|
67
|
+
branch: ContextBranch;
|
|
68
|
+
trapRecorded?: boolean;
|
|
69
|
+
success?: boolean;
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* 브랜치 목록 조회
|
|
73
|
+
*/
|
|
74
|
+
listBranches(): ContextBranch[];
|
|
75
|
+
/**
|
|
76
|
+
* 현재 활성 브랜치 조회
|
|
77
|
+
*/
|
|
78
|
+
getCurrentBranch(): ContextBranch;
|
|
79
|
+
}
|
package/dist/causal-config.d.ts
CHANGED
|
@@ -25,4 +25,14 @@ export declare const CAUSAL_MEMORY_CONFIG: {
|
|
|
25
25
|
readonly MCP_SERVER_NAME: "synapse-causal-memory";
|
|
26
26
|
/** 공명 쿼리 시 컨텍스트 최대 노출 줄 수 (토큰 절감 임계치) */
|
|
27
27
|
readonly MAX_CONTEXT_PREVIEW_LINES: number;
|
|
28
|
+
/** 전역 컨텍스트 스냅샷(Checkpoint) 저장소 기본 경로 */
|
|
29
|
+
readonly CONTEXT_DB_PATH: string;
|
|
30
|
+
/** 패키지 내장 폴백 컨텍스트 스냅샷 경로 */
|
|
31
|
+
readonly LOCAL_CONTEXT_DB_PATH: string;
|
|
32
|
+
/** 최대 보존 컨텍스트 체크포인트 개수 */
|
|
33
|
+
readonly MAX_CHECKPOINTS_RETAINED: number;
|
|
34
|
+
/** 옵시디언(Obsidian) 볼트 기본 연동 루트 경로 */
|
|
35
|
+
readonly DEFAULT_OBSIDIAN_VAULT_PATH: string;
|
|
36
|
+
/** 옵시디언 볼트 내부 인과율 렌즈 저장 서브디렉터리 */
|
|
37
|
+
readonly OBSIDIAN_LENS_SUBDIR: string;
|
|
28
38
|
};
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 컨텍스트 스냅샷(Checkpoint) 단일 레코드 규격
|
|
3
|
+
*/
|
|
4
|
+
export interface ContextCheckpoint {
|
|
5
|
+
readonly id: string;
|
|
6
|
+
readonly sessionId: string;
|
|
7
|
+
readonly title: string;
|
|
8
|
+
readonly createdAt: string;
|
|
9
|
+
readonly cwd: string;
|
|
10
|
+
readonly gitBranch?: string;
|
|
11
|
+
readonly gitCommit?: string;
|
|
12
|
+
readonly modifiedFiles: readonly string[];
|
|
13
|
+
readonly activeFiles: readonly string[];
|
|
14
|
+
readonly goal: string;
|
|
15
|
+
readonly completedSteps: readonly string[];
|
|
16
|
+
readonly pendingTasks: readonly string[];
|
|
17
|
+
readonly keyDecisions: readonly string[];
|
|
18
|
+
readonly activeInvariants: readonly string[];
|
|
19
|
+
readonly artifacts: readonly string[];
|
|
20
|
+
readonly customMeta?: Record<string, unknown>;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* 컨텍스트 체크포인트 생성 입력 규격
|
|
24
|
+
*/
|
|
25
|
+
export interface SaveCheckpointInput {
|
|
26
|
+
readonly id?: string;
|
|
27
|
+
readonly sessionId?: string;
|
|
28
|
+
readonly title: string;
|
|
29
|
+
readonly cwd?: string;
|
|
30
|
+
readonly goal?: string;
|
|
31
|
+
readonly activeFiles?: readonly string[];
|
|
32
|
+
readonly modifiedFiles?: readonly string[];
|
|
33
|
+
readonly completedSteps?: readonly string[];
|
|
34
|
+
readonly pendingTasks?: readonly string[];
|
|
35
|
+
readonly keyDecisions?: readonly string[];
|
|
36
|
+
readonly activeInvariants?: readonly string[];
|
|
37
|
+
readonly artifacts?: readonly string[];
|
|
38
|
+
readonly keywords?: readonly string[];
|
|
39
|
+
readonly domain?: string;
|
|
40
|
+
readonly autoGit?: boolean;
|
|
41
|
+
readonly autoResonance?: boolean;
|
|
42
|
+
readonly customMeta?: Record<string, unknown>;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* 컨텍스트 체크포인트 저장소 데이터베이스 규격
|
|
46
|
+
*/
|
|
47
|
+
export interface ContextCheckpointDatabase {
|
|
48
|
+
readonly version: string;
|
|
49
|
+
readonly updatedAt: string;
|
|
50
|
+
readonly latestCheckpointId: string | null;
|
|
51
|
+
readonly totalCheckpoints: number;
|
|
52
|
+
readonly checkpoints: readonly ContextCheckpoint[];
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Git 현재 브랜치 및 최신 커밋 해시 자동 추출 헬퍼
|
|
56
|
+
*/
|
|
57
|
+
export declare function detectGitHeadInfo(cwd?: string): Promise<{
|
|
58
|
+
branch?: string;
|
|
59
|
+
commit?: string;
|
|
60
|
+
}>;
|
|
61
|
+
/**
|
|
62
|
+
* 세션 간 기억 손실 0%를 보장하는 인과율 컨텍스트 스냅샷 저장소 클래스 (SRP 준수)
|
|
63
|
+
*/
|
|
64
|
+
export declare class ContextCheckpointStore {
|
|
65
|
+
private readonly dbPath;
|
|
66
|
+
private readonly memoryDbPath?;
|
|
67
|
+
private database;
|
|
68
|
+
private lastMtimeMs;
|
|
69
|
+
constructor(customPath?: string, memoryDbPath?: string);
|
|
70
|
+
/**
|
|
71
|
+
* 디스크에서 체크포인트 데이터베이스 로드
|
|
72
|
+
*/
|
|
73
|
+
private loadDatabase;
|
|
74
|
+
/**
|
|
75
|
+
* 외부 프로세스(CLI 또는 다른 에이전트)에 의해 파일이 갱신되었으면 자동 리로드
|
|
76
|
+
*/
|
|
77
|
+
reloadIfNeeded(): void;
|
|
78
|
+
/**
|
|
79
|
+
* 원자적(Atomic) 파일 교체 방식으로 체크포인트 데이터베이스 영구 저장
|
|
80
|
+
*/
|
|
81
|
+
private saveDatabase;
|
|
82
|
+
/**
|
|
83
|
+
* 고유 체크포인트 ID 생성
|
|
84
|
+
*/
|
|
85
|
+
private static generateCheckpointId;
|
|
86
|
+
/**
|
|
87
|
+
* 현재 작업 컨텍스트를 스냅샷으로 박제하여 저장
|
|
88
|
+
*/
|
|
89
|
+
saveCheckpoint(input: SaveCheckpointInput): Promise<ContextCheckpoint>;
|
|
90
|
+
/**
|
|
91
|
+
* 최신 체크포인트 조회 (특정 세션 지정 가능)
|
|
92
|
+
*/
|
|
93
|
+
getLatestCheckpoint(sessionId?: string): ContextCheckpoint | null;
|
|
94
|
+
/**
|
|
95
|
+
* 특정 ID 또는 'latest' 키워드로 체크포인트 조회
|
|
96
|
+
*/
|
|
97
|
+
getCheckpoint(idOrTag?: string, sessionId?: string): ContextCheckpoint | null;
|
|
98
|
+
/**
|
|
99
|
+
* 저장된 체크포인트 목록 조회
|
|
100
|
+
*/
|
|
101
|
+
listCheckpoints(options?: {
|
|
102
|
+
sessionId?: string;
|
|
103
|
+
limit?: number;
|
|
104
|
+
}): ContextCheckpoint[];
|
|
105
|
+
/**
|
|
106
|
+
* 특정 체크포인트 삭제
|
|
107
|
+
*/
|
|
108
|
+
deleteCheckpoint(id: string): boolean;
|
|
109
|
+
/**
|
|
110
|
+
* 새 채팅창/에이전트 세션에서 0ms 만에 맥락을 100% 복원하기 위한 초고밀도 프롬프트 포맷터
|
|
111
|
+
*/
|
|
112
|
+
static formatForAgentResume(checkpoint: ContextCheckpoint, compact?: boolean): string;
|
|
113
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 실패 가설 및 함정(Trap) 레코드 규격 (Negative Knowledge)
|
|
3
|
+
*/
|
|
4
|
+
export interface FailureHypothesis {
|
|
5
|
+
readonly id: string;
|
|
6
|
+
readonly title: string;
|
|
7
|
+
readonly failedApproach: string;
|
|
8
|
+
readonly errorSignature?: string;
|
|
9
|
+
readonly rootCause: string;
|
|
10
|
+
readonly counterMeasure: string;
|
|
11
|
+
readonly triggerKeywords: readonly string[];
|
|
12
|
+
readonly triggerFiles?: readonly string[];
|
|
13
|
+
readonly environment?: string;
|
|
14
|
+
readonly hitCount?: number;
|
|
15
|
+
readonly createdAt: string;
|
|
16
|
+
readonly lastEncounteredAt?: string;
|
|
17
|
+
readonly trapPattern?: string;
|
|
18
|
+
readonly domain?: string;
|
|
19
|
+
readonly severity?: string;
|
|
20
|
+
readonly reason?: string;
|
|
21
|
+
readonly safeAlternative?: string;
|
|
22
|
+
readonly avoidFiles?: readonly string[];
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* 지뢰(Trap) 사전 탐지 결과 규격
|
|
26
|
+
*/
|
|
27
|
+
export interface TrapWarning {
|
|
28
|
+
readonly trapId: string;
|
|
29
|
+
readonly title: string;
|
|
30
|
+
readonly riskLevel: 'CRITICAL' | 'WARNING' | 'NOTICE';
|
|
31
|
+
readonly matchedBy: 'keyword' | 'file' | 'error_signature';
|
|
32
|
+
readonly matchedPattern: string;
|
|
33
|
+
readonly whyItFails: string;
|
|
34
|
+
readonly recommendedFix: string;
|
|
35
|
+
}
|
|
36
|
+
export type TrapScanResult = TrapWarning[] & {
|
|
37
|
+
readonly trapped: boolean;
|
|
38
|
+
readonly triggeredTraps: readonly TrapWarning[];
|
|
39
|
+
readonly highestSeverity: 'CRITICAL' | 'WARNING' | 'NOTICE' | 'NONE';
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* 실패 가설 묘지 데이터베이스 규격
|
|
43
|
+
*/
|
|
44
|
+
export interface GraveyardDatabase {
|
|
45
|
+
readonly version: string;
|
|
46
|
+
readonly updatedAt: string;
|
|
47
|
+
readonly totalTraps: number;
|
|
48
|
+
readonly traps: readonly FailureHypothesis[];
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* 실패 가설 묘지(Negative Memory) 관리 및 지뢰 사전 탐지 엔진 클래스 (SRP 준수)
|
|
52
|
+
*/
|
|
53
|
+
export declare class CausalGraveyardStore {
|
|
54
|
+
private readonly dbPath;
|
|
55
|
+
private database;
|
|
56
|
+
private lastMtimeMs;
|
|
57
|
+
constructor(customPathOrMemoryStore?: string | unknown);
|
|
58
|
+
private loadDatabase;
|
|
59
|
+
reloadIfNeeded(): void;
|
|
60
|
+
private saveDatabase;
|
|
61
|
+
/**
|
|
62
|
+
* 신규 실패 가설(Trap) 등록 또는 갱신
|
|
63
|
+
*/
|
|
64
|
+
assertTrap(input: any): FailureHypothesis;
|
|
65
|
+
/**
|
|
66
|
+
* 작업 컨텍스트(코드, 명령어, 파일, 텍스트)에서 이미 실패했던 지뢰(Trap)가 있는지 사전 스캔
|
|
67
|
+
*/
|
|
68
|
+
scanTraps(query: {
|
|
69
|
+
text?: string;
|
|
70
|
+
code?: string;
|
|
71
|
+
files?: readonly string[];
|
|
72
|
+
keywords?: readonly string[];
|
|
73
|
+
}): TrapScanResult;
|
|
74
|
+
/**
|
|
75
|
+
* 저장된 모든 실패 가설 목록 조회
|
|
76
|
+
*/
|
|
77
|
+
listTraps(): FailureHypothesis[];
|
|
78
|
+
/**
|
|
79
|
+
* 하위 호환 alias
|
|
80
|
+
*/
|
|
81
|
+
getAllTraps(): FailureHypothesis[];
|
|
82
|
+
/**
|
|
83
|
+
* 특정 실패 가설 삭제
|
|
84
|
+
*/
|
|
85
|
+
deleteTrap(id: string): boolean;
|
|
86
|
+
/**
|
|
87
|
+
* 지뢰 경고 프롬프트 포맷터
|
|
88
|
+
*/
|
|
89
|
+
static formatWarningsForAgent(warnings: readonly TrapWarning[]): string;
|
|
90
|
+
/**
|
|
91
|
+
* 하위 호환 alias
|
|
92
|
+
*/
|
|
93
|
+
static formatTrapWarnings(warnings: any): string;
|
|
94
|
+
}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { CausalMemoryStore } from './causal-store';
|
|
2
|
+
import { ContextCheckpointStore } from './causal-context';
|
|
3
|
+
import { CausalGraveyardStore } from './causal-graveyard';
|
|
4
|
+
import { CausalTimeSeriesEngine } from './causal-timeseries';
|
|
5
|
+
/**
|
|
6
|
+
* 렌즈 내보내기 결과 보고서 규격
|
|
7
|
+
*/
|
|
8
|
+
export interface LensExportResult {
|
|
9
|
+
readonly success: boolean;
|
|
10
|
+
readonly vaultPath: string;
|
|
11
|
+
readonly exportedRules: number;
|
|
12
|
+
readonly exportedGraveyard: number;
|
|
13
|
+
readonly exportedCheckpoints: number;
|
|
14
|
+
readonly canvasGenerated: boolean;
|
|
15
|
+
readonly timelineGenerated: boolean;
|
|
16
|
+
readonly durationMs: number;
|
|
17
|
+
readonly error?: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* 렌즈 가져오기 결과 보고서 규격
|
|
21
|
+
*/
|
|
22
|
+
export interface LensImportResult {
|
|
23
|
+
readonly success: boolean;
|
|
24
|
+
readonly vaultPath: string;
|
|
25
|
+
readonly importedRules: number;
|
|
26
|
+
readonly importedGraveyard: number;
|
|
27
|
+
readonly durationMs: number;
|
|
28
|
+
readonly error?: string;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* 양방향 동기화 결과 보고서 규격
|
|
32
|
+
*/
|
|
33
|
+
export interface LensSyncResult {
|
|
34
|
+
readonly success: boolean;
|
|
35
|
+
readonly exportResult: LensExportResult;
|
|
36
|
+
readonly importResult: LensImportResult;
|
|
37
|
+
readonly syncedAt: string;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* 옵시디언 캔버스 노드 규격
|
|
41
|
+
*/
|
|
42
|
+
export interface ObsidianCanvasNode {
|
|
43
|
+
readonly id: string;
|
|
44
|
+
readonly x: number;
|
|
45
|
+
readonly y: number;
|
|
46
|
+
readonly width: number;
|
|
47
|
+
readonly height: number;
|
|
48
|
+
readonly type: 'text' | 'file';
|
|
49
|
+
readonly text?: string;
|
|
50
|
+
readonly file?: string;
|
|
51
|
+
readonly color?: string;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* 옵시디언 캔버스 엣지(간선) 규격
|
|
55
|
+
*/
|
|
56
|
+
export interface ObsidianCanvasEdge {
|
|
57
|
+
readonly id: string;
|
|
58
|
+
readonly fromNode: string;
|
|
59
|
+
readonly fromSide: 'top' | 'right' | 'bottom' | 'left';
|
|
60
|
+
readonly toNode: string;
|
|
61
|
+
readonly toSide: 'top' | 'right' | 'bottom' | 'left';
|
|
62
|
+
readonly label?: string;
|
|
63
|
+
readonly color?: string;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* 옵시디언 캔버스 문서 규격 (.canvas)
|
|
67
|
+
*/
|
|
68
|
+
export interface ObsidianCanvasDocument {
|
|
69
|
+
readonly nodes: readonly ObsidianCanvasNode[];
|
|
70
|
+
readonly edges: readonly ObsidianCanvasEdge[];
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* 옵시디언(Obsidian) 지식 베이스와 인과율 메모리를 양방향 연동하는 렌즈 엔진 클래스 (SRP 준수)
|
|
74
|
+
*/
|
|
75
|
+
export declare class CausalObsidianLensEngine {
|
|
76
|
+
private readonly memoryStore;
|
|
77
|
+
private readonly contextStore;
|
|
78
|
+
private readonly graveyardStore;
|
|
79
|
+
private readonly timeSeriesEngine;
|
|
80
|
+
constructor(memoryStore?: CausalMemoryStore, contextStore?: ContextCheckpointStore, graveyardStore?: CausalGraveyardStore, timeSeriesEngine?: CausalTimeSeriesEngine);
|
|
81
|
+
/**
|
|
82
|
+
* 지정된 옵시디언 볼트 경로로 인과율 메모리 전체(규칙, 함정, 스냅샷, 타임라인, 캔버스)를 마크다운으로 내보내기
|
|
83
|
+
*/
|
|
84
|
+
exportToVault(vaultRoot?: string): Promise<LensExportResult>;
|
|
85
|
+
/**
|
|
86
|
+
* 옵시디언 볼트의 마크다운 파일들을 스캔하여 인과율 규칙 및 함정 데이터로 역가져오기 (Import)
|
|
87
|
+
*/
|
|
88
|
+
importFromVault(vaultRoot?: string): Promise<LensImportResult>;
|
|
89
|
+
/**
|
|
90
|
+
* 볼트와의 양방향 동기화 (최신성 기반 안전한 병합)
|
|
91
|
+
*/
|
|
92
|
+
syncWithVault(vaultRoot?: string): Promise<LensSyncResult>;
|
|
93
|
+
/**
|
|
94
|
+
* 단일 CausalRule을 Obsidian 마크다운으로 변환
|
|
95
|
+
*/
|
|
96
|
+
private renderRuleToMarkdown;
|
|
97
|
+
/**
|
|
98
|
+
* 단일 FailureHypothesis(함정)를 Obsidian 마크다운으로 변환
|
|
99
|
+
*/
|
|
100
|
+
private renderTrapToMarkdown;
|
|
101
|
+
/**
|
|
102
|
+
* 단일 컨텍스트 체크포인트를 Obsidian 마크다운으로 변환
|
|
103
|
+
*/
|
|
104
|
+
private renderCheckpointToMarkdown;
|
|
105
|
+
/**
|
|
106
|
+
* 타임라인 마크다운 렌더링
|
|
107
|
+
*/
|
|
108
|
+
private renderTimelineMarkdown;
|
|
109
|
+
/**
|
|
110
|
+
* 옵시디언 캔버스(Canvas) JSON 문서 생성
|
|
111
|
+
*/
|
|
112
|
+
private generateCanvasDocument;
|
|
113
|
+
/**
|
|
114
|
+
* 도메인별 캔버스 색상 코드 매핑 (1: 빨강, 2: 주황, 3: 노랑, 4: 초록, 5: 파랑, 6: 보라)
|
|
115
|
+
*/
|
|
116
|
+
private getColorForDomain;
|
|
117
|
+
/**
|
|
118
|
+
* 마크다운 텍스트로부터 CausalRule 역파싱
|
|
119
|
+
*/
|
|
120
|
+
private parseRuleMarkdown;
|
|
121
|
+
/**
|
|
122
|
+
* 마크다운 텍스트로부터 FailureHypothesis(함정) 역파싱
|
|
123
|
+
*/
|
|
124
|
+
private parseTrapMarkdown;
|
|
125
|
+
/**
|
|
126
|
+
* 원자적 파일 쓰기 (임시 파일 생성 후 renameSync로 덮어쓰기하여 정전/중단 시 손상 0% 보장)
|
|
127
|
+
*/
|
|
128
|
+
private atomicWriteFile;
|
|
129
|
+
/**
|
|
130
|
+
* 파일명에 사용할 수 없는 특수문자 및 Path Traversal 시퀀스 제거
|
|
131
|
+
*/
|
|
132
|
+
private sanitizeFileName;
|
|
133
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { CausalMemoryStore } from './causal-store';
|
|
2
|
+
import { ContextCheckpointStore } from './causal-context';
|
|
3
|
+
/**
|
|
4
|
+
* 연쇄 파급 영향 노드 규격
|
|
5
|
+
*/
|
|
6
|
+
export interface AffectedNode {
|
|
7
|
+
readonly name: string;
|
|
8
|
+
readonly domain: string;
|
|
9
|
+
readonly hopLevel: number;
|
|
10
|
+
readonly relationType: string;
|
|
11
|
+
readonly riskScore: number;
|
|
12
|
+
readonly riskReason: string;
|
|
13
|
+
readonly requiredInvariants: readonly string[];
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* 인과 연쇄 폭발 반경(Blast Radius) 분석 보고서 규격
|
|
17
|
+
*/
|
|
18
|
+
export interface BlastRadiusReport {
|
|
19
|
+
readonly triggerFiles: readonly string[];
|
|
20
|
+
readonly overallRisk: 'CRITICAL' | 'HIGH' | 'MEDIUM' | 'LOW';
|
|
21
|
+
readonly maxRiskScore: number;
|
|
22
|
+
readonly affectedNodes: readonly AffectedNode[];
|
|
23
|
+
readonly prefetchedInvariants: readonly string[];
|
|
24
|
+
readonly suggestedTargetFiles: readonly string[];
|
|
25
|
+
readonly durationMs: number;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* 인과 연쇄 파급 예측 및 Blast Radius 분석 엔진 클래스 (SRP 준수)
|
|
29
|
+
*/
|
|
30
|
+
export declare class CausalPredictorEngine {
|
|
31
|
+
private readonly memoryStore;
|
|
32
|
+
private readonly contextStore;
|
|
33
|
+
constructor(memoryStore?: CausalMemoryStore, contextStore?: ContextCheckpointStore);
|
|
34
|
+
/**
|
|
35
|
+
* 파일 수정 시 2~3단계 뒤에 발생할 연쇄 파급 반경 계산
|
|
36
|
+
*/
|
|
37
|
+
analyzeBlastRadius(files: readonly string[], maxHops?: number): BlastRadiusReport;
|
|
38
|
+
/**
|
|
39
|
+
* 예측 보고서 마크다운 포맷터
|
|
40
|
+
*/
|
|
41
|
+
static formatPredictReport(report: BlastRadiusReport): string;
|
|
42
|
+
}
|