synapse-kit 0.0.0-stage → 0.3.1
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.ko.md +129 -0
- package/README.md +127 -2
- package/dist/causal-memory.json +4581 -0
- package/dist/cli-memory.d.ts +5 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +3474 -0
- package/dist/compiler/causal-build.d.ts +51 -0
- package/dist/compiler/causal-graph.d.ts +6 -0
- package/dist/compiler/cli.d.ts +2 -0
- package/dist/compiler/cli.js +1299 -0
- package/dist/compiler/core/config.d.ts +16 -0
- package/dist/compiler/core/engine.d.ts +17 -0
- package/dist/compiler/core/reporter.d.ts +5 -0
- package/dist/compiler/i18n.d.ts +281 -0
- package/dist/compiler/index.d.ts +21 -0
- package/dist/compiler/index.js +1983 -0
- package/dist/compiler/plugins/cpp.d.ts +19 -0
- package/dist/compiler/plugins/csharp.d.ts +13 -0
- package/dist/compiler/plugins/go.d.ts +15 -0
- package/dist/compiler/plugins/java.d.ts +16 -0
- package/dist/compiler/plugins/native.d.ts +12 -0
- package/dist/compiler/plugins/nsis.d.ts +8 -0
- package/dist/compiler/plugins/python.d.ts +21 -0
- package/dist/compiler/plugins/rust.d.ts +9 -0
- package/dist/compiler/plugins/schema.d.ts +12 -0
- package/dist/compiler/plugins/svelte.d.ts +10 -0
- package/dist/compiler/plugins/typescript.d.ts +23 -0
- package/dist/compiler/types.d.ts +72 -0
- package/dist/compiler/virtual_120b_types.d.ts +18 -0
- package/dist/core/config.d.ts +16 -0
- package/dist/core/engine.d.ts +17 -0
- package/dist/core/reporter.d.ts +5 -0
- package/dist/db/index.js +1910 -0
- package/dist/i18n.d.ts +281 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +8282 -0
- package/dist/memory/causal-benchmark.d.ts +29 -0
- package/dist/memory/causal-branch.d.ts +79 -0
- package/dist/memory/causal-build.d.ts +51 -0
- package/dist/memory/causal-config.d.ts +38 -0
- package/dist/memory/causal-context.d.ts +113 -0
- package/dist/memory/causal-contexts.json +316 -0
- package/dist/memory/causal-graph.d.ts +6 -0
- package/dist/memory/causal-graveyard.d.ts +94 -0
- package/dist/memory/causal-lens.d.ts +133 -0
- package/dist/memory/causal-memory.json +5054 -0
- package/dist/memory/causal-migrator.d.ts +11 -0
- package/dist/memory/causal-peer.d.ts +53 -0
- package/dist/memory/causal-predictor.d.ts +42 -0
- package/dist/memory/causal-query.d.ts +21 -0
- package/dist/memory/causal-server.d.ts +578 -0
- package/dist/memory/causal-store.d.ts +280 -0
- package/dist/memory/causal-synthesizer.d.ts +96 -0
- package/dist/memory/causal-timeseries.d.ts +92 -0
- package/dist/memory/cli.d.ts +13 -0
- package/dist/memory/cli.js +5668 -0
- package/dist/memory/index.d.ts +13 -0
- package/dist/memory/index.js +4451 -0
- package/dist/plugins/cpp.d.ts +19 -0
- package/dist/plugins/csharp.d.ts +13 -0
- package/dist/plugins/go.d.ts +15 -0
- package/dist/plugins/java.d.ts +16 -0
- package/dist/plugins/native.d.ts +12 -0
- package/dist/plugins/nsis.d.ts +8 -0
- package/dist/plugins/python.d.ts +21 -0
- package/dist/plugins/rust.d.ts +9 -0
- package/dist/plugins/schema.d.ts +12 -0
- package/dist/plugins/svelte.d.ts +10 -0
- package/dist/plugins/typescript.d.ts +23 -0
- package/dist/src/cli.d.ts +2 -0
- package/dist/src/core/config.d.ts +12 -0
- package/dist/src/core/engine.d.ts +9 -0
- package/dist/src/core/reporter.d.ts +5 -0
- package/dist/src/index.d.ts +13 -0
- package/dist/src/memory/causal-graph.d.ts +6 -0
- package/dist/src/plugins/native.d.ts +12 -0
- package/dist/src/plugins/nsis.d.ts +8 -0
- package/dist/src/plugins/rust.d.ts +9 -0
- package/dist/src/plugins/schema.d.ts +12 -0
- package/dist/src/plugins/svelte.d.ts +10 -0
- package/dist/src/types.d.ts +55 -0
- package/dist/types.d.ts +72 -0
- package/package.json +87 -4
|
@@ -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
|
+
}
|