@bis-code/deep-think 1.1.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/.claude-plugin/marketplace.json +18 -0
- package/.claude-plugin/plugin.json +19 -0
- package/.deep-think.json +24 -0
- package/.mcp.json +8 -0
- package/LICENSE +21 -0
- package/README.md +92 -0
- package/commands/checkpoints.md +13 -0
- package/commands/constraints.md +16 -0
- package/commands/practices.md +16 -0
- package/commands/start.md +15 -0
- package/hooks/hooks.json +11 -0
- package/package.json +34 -0
- package/rules/deep-think-workflow.md +35 -0
- package/server/dist/bundle.mjs +22006 -0
- package/server/dist/config/loader.d.ts +3 -0
- package/server/dist/config/loader.d.ts.map +1 -0
- package/server/dist/config/loader.js +37 -0
- package/server/dist/config/loader.js.map +1 -0
- package/server/dist/config/schema.d.ts +3 -0
- package/server/dist/config/schema.d.ts.map +1 -0
- package/server/dist/config/schema.js +33 -0
- package/server/dist/config/schema.js.map +1 -0
- package/server/dist/engine/analyzer.d.ts +15 -0
- package/server/dist/engine/analyzer.d.ts.map +1 -0
- package/server/dist/engine/analyzer.js +209 -0
- package/server/dist/engine/analyzer.js.map +1 -0
- package/server/dist/engine/strategies.d.ts +3 -0
- package/server/dist/engine/strategies.d.ts.map +1 -0
- package/server/dist/engine/strategies.js +148 -0
- package/server/dist/engine/strategies.js.map +1 -0
- package/server/dist/engine/thought-store.d.ts +33 -0
- package/server/dist/engine/thought-store.d.ts.map +1 -0
- package/server/dist/engine/thought-store.js +77 -0
- package/server/dist/engine/thought-store.js.map +1 -0
- package/server/dist/index.d.ts +3 -0
- package/server/dist/index.d.ts.map +1 -0
- package/server/dist/index.js +33 -0
- package/server/dist/index.js.map +1 -0
- package/server/dist/persistence/file-store.d.ts +15 -0
- package/server/dist/persistence/file-store.d.ts.map +1 -0
- package/server/dist/persistence/file-store.js +84 -0
- package/server/dist/persistence/file-store.js.map +1 -0
- package/server/dist/persistence/types.d.ts +8 -0
- package/server/dist/persistence/types.d.ts.map +1 -0
- package/server/dist/persistence/types.js +2 -0
- package/server/dist/persistence/types.js.map +1 -0
- package/server/dist/tools/branch.d.ts +5 -0
- package/server/dist/tools/branch.d.ts.map +1 -0
- package/server/dist/tools/branch.js +133 -0
- package/server/dist/tools/branch.js.map +1 -0
- package/server/dist/tools/checkpoint.d.ts +6 -0
- package/server/dist/tools/checkpoint.d.ts.map +1 -0
- package/server/dist/tools/checkpoint.js +95 -0
- package/server/dist/tools/checkpoint.js.map +1 -0
- package/server/dist/tools/reflect.d.ts +5 -0
- package/server/dist/tools/reflect.d.ts.map +1 -0
- package/server/dist/tools/reflect.js +41 -0
- package/server/dist/tools/reflect.js.map +1 -0
- package/server/dist/tools/strategize.d.ts +5 -0
- package/server/dist/tools/strategize.d.ts.map +1 -0
- package/server/dist/tools/strategize.js +80 -0
- package/server/dist/tools/strategize.js.map +1 -0
- package/server/dist/tools/think.d.ts +6 -0
- package/server/dist/tools/think.d.ts.map +1 -0
- package/server/dist/tools/think.js +129 -0
- package/server/dist/tools/think.js.map +1 -0
- package/server/dist/types.d.ts +148 -0
- package/server/dist/types.d.ts.map +1 -0
- package/server/dist/types.js +5 -0
- package/server/dist/types.js.map +1 -0
- package/server/package.json +36 -0
- package/skills/manage-constraints/SKILL.md +28 -0
- package/skills/manage-practices/SKILL.md +26 -0
- package/skills/restore-checkpoint/SKILL.md +25 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../src/config/loader.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAGnD,wBAAgB,UAAU,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,eAAe,CAiB/D"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { readFileSync, existsSync } from "fs";
|
|
2
|
+
import { resolve } from "path";
|
|
3
|
+
import { DEFAULT_CONFIG } from "./schema.js";
|
|
4
|
+
export function loadConfig(configPath) {
|
|
5
|
+
const path = configPath
|
|
6
|
+
?? process.env.MCP_DEEP_THINK_CONFIG
|
|
7
|
+
?? resolve(process.cwd(), ".deep-think.json");
|
|
8
|
+
if (!existsSync(path)) {
|
|
9
|
+
return { ...DEFAULT_CONFIG };
|
|
10
|
+
}
|
|
11
|
+
try {
|
|
12
|
+
const raw = readFileSync(path, "utf-8");
|
|
13
|
+
const parsed = JSON.parse(raw);
|
|
14
|
+
return mergeConfig(DEFAULT_CONFIG, parsed);
|
|
15
|
+
}
|
|
16
|
+
catch {
|
|
17
|
+
console.error(`Warning: Failed to parse config at ${path}, using defaults`);
|
|
18
|
+
return { ...DEFAULT_CONFIG };
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
function mergeConfig(defaults, overrides) {
|
|
22
|
+
return {
|
|
23
|
+
project: { ...defaults.project, ...overrides.project },
|
|
24
|
+
thinking: { ...defaults.thinking, ...overrides.thinking },
|
|
25
|
+
practices: {
|
|
26
|
+
rules: overrides.practices?.rules ?? defaults.practices.rules,
|
|
27
|
+
antiPatterns: overrides.practices?.antiPatterns ?? defaults.practices.antiPatterns,
|
|
28
|
+
reviewChecklist: overrides.practices?.reviewChecklist ?? defaults.practices.reviewChecklist,
|
|
29
|
+
},
|
|
30
|
+
strategies: {
|
|
31
|
+
custom: overrides.strategies?.custom ?? defaults.strategies.custom,
|
|
32
|
+
},
|
|
33
|
+
reflection: { ...defaults.reflection, ...overrides.reflection },
|
|
34
|
+
persistence: { ...defaults.persistence, ...overrides.persistence },
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loader.js","sourceRoot":"","sources":["../../src/config/loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAE/B,OA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EAAE,SAAS,CAAC,UAAU,EAAE,MAAM,IAAI,QAAQ,CAAC,UAAU,CAAC,MAAM;SACnE;QACD,UAAU,EAAE,EAAE,GAAG,QAAQ,CAAC,UAAU,EAAE,GAAG,SAAS,CAAC,UAAU,EAAE;QAC/D,WAAW,EAAE,EAAE,GAAG,QAAQ,CAAC,WAAW,EAAE,GAAG,SAAS,CAAC,WAAW,EAAE;KACnE,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/config/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,eAAO,MAAM,cAAc,EAAE,eA+B5B,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export const DEFAULT_CONFIG = {
|
|
2
|
+
project: {
|
|
3
|
+
name: "",
|
|
4
|
+
type: "",
|
|
5
|
+
language: "",
|
|
6
|
+
description: "",
|
|
7
|
+
},
|
|
8
|
+
thinking: {
|
|
9
|
+
defaultStrategy: null,
|
|
10
|
+
maxThoughts: 50,
|
|
11
|
+
autoCheckpointEvery: 10,
|
|
12
|
+
confidenceThreshold: 0.7,
|
|
13
|
+
},
|
|
14
|
+
practices: {
|
|
15
|
+
rules: [],
|
|
16
|
+
antiPatterns: [],
|
|
17
|
+
reviewChecklist: [],
|
|
18
|
+
},
|
|
19
|
+
strategies: {
|
|
20
|
+
custom: [],
|
|
21
|
+
},
|
|
22
|
+
reflection: {
|
|
23
|
+
alwaysCheck: ["practices.rules", "practices.antiPatterns"],
|
|
24
|
+
circularThreshold: 0.6,
|
|
25
|
+
contradictionSensitivity: "medium",
|
|
26
|
+
},
|
|
27
|
+
persistence: {
|
|
28
|
+
directory: ".deep-think/sessions",
|
|
29
|
+
maxCheckpoints: 10,
|
|
30
|
+
autoSave: true,
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/config/schema.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,cAAc,GAAoB;IAC7C,OAAO,EAAE;QACP,IAAI,EAAE,EAAE;QACR,IAAI,EAAE,EAAE;QACR,QAAQ,EAAE,EAAE;QACZ,WAAW,EAAE,EAAE;KAChB;IACD,QAAQ,EAAE;QACR,eAAe,EAAE,IAAI;QACrB,WAAW,EAAE,EAAE;QACf,mBAAmB,EAAE,EAAE;QACvB,mBAAmB,EAAE,GAAG;KACzB;IACD,SAAS,EAAE;QACT,KAAK,EAAE,EAAE;QACT,YAAY,EAAE,EAAE;QAChB,eAAe,EAAE,EAAE;KACpB;IACD,UAAU,EAAE;QACV,MAAM,EAAE,EAAE;KACX;IACD,UAAU,EAAE;QACV,WAAW,EAAE,CAAC,iBAAiB,EAAE,wBAAwB,CAAC;QAC1D,iBAAiB,EAAE,GAAG;QACtB,wBAAwB,EAAE,QAAQ;KACnC;IACD,WAAW,EAAE;QACX,SAAS,EAAE,sBAAsB;QACjC,cAAc,EAAE,EAAE;QAClB,QAAQ,EAAE,IAAI;KACf;CACF,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { StoredThought, DeepThinkConfig, ReflectionResult } from "../types.js";
|
|
2
|
+
export declare function tokenize(text: string): Set<string>;
|
|
3
|
+
export declare function jaccardSimilarity(setA: Set<string>, setB: Set<string>): number;
|
|
4
|
+
export declare class Analyzer {
|
|
5
|
+
private config;
|
|
6
|
+
constructor(config: DeepThinkConfig);
|
|
7
|
+
analyze(history: StoredThought[], branches: Record<string, StoredThought[]>, activeStrategy: string | null, focus: "all" | "progress" | "contradictions" | "gaps" | "patterns"): ReflectionResult;
|
|
8
|
+
private detectCircular;
|
|
9
|
+
private detectContradictions;
|
|
10
|
+
private detectGaps;
|
|
11
|
+
private checkPractices;
|
|
12
|
+
private summarizeProgress;
|
|
13
|
+
private buildSummary;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=analyzer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analyzer.d.ts","sourceRoot":"","sources":["../../src/engine/analyzer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,gBAAgB,EAAuD,MAAM,aAAa,CAAC;AAiBzI,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,CAOlD;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,MAAM,CAU9E;AAED,qBAAa,QAAQ;IACnB,OAAO,CAAC,MAAM,CAAkB;gBAEpB,MAAM,EAAE,eAAe;IAInC,OAAO,CACL,OAAO,EAAE,aAAa,EAAE,EACxB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,EAAE,CAAC,EACzC,cAAc,EAAE,MAAM,GAAG,IAAI,EAC7B,KAAK,EAAE,KAAK,GAAG,UAAU,GAAG,gBAAgB,GAAG,MAAM,GAAG,UAAU,GACjE,gBAAgB;IA+BnB,OAAO,CAAC,cAAc;IAsBtB,OAAO,CAAC,oBAAoB;IAuC5B,OAAO,CAAC,UAAU;IA6BlB,OAAO,CAAC,cAAc;IAyBtB,OAAO,CAAC,iBAAiB;IAuCzB,OAAO,CAAC,YAAY;CAmBrB"}
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
const STOP_WORDS = new Set([
|
|
2
|
+
"the", "a", "an", "is", "are", "was", "were", "be", "been", "being",
|
|
3
|
+
"have", "has", "had", "do", "does", "did", "will", "would", "could",
|
|
4
|
+
"should", "may", "might", "shall", "can", "need", "dare", "ought",
|
|
5
|
+
"used", "to", "of", "in", "for", "on", "with", "at", "by", "from",
|
|
6
|
+
"as", "into", "through", "during", "before", "after", "above", "below",
|
|
7
|
+
"between", "out", "off", "over", "under", "again", "further", "then",
|
|
8
|
+
"once", "here", "there", "when", "where", "why", "how", "all", "each",
|
|
9
|
+
"every", "both", "few", "more", "most", "other", "some", "such", "no",
|
|
10
|
+
"nor", "not", "only", "own", "same", "so", "than", "too", "very",
|
|
11
|
+
"just", "because", "but", "and", "or", "if", "while", "this", "that",
|
|
12
|
+
"these", "those", "it", "its", "i", "we", "you", "they", "he", "she",
|
|
13
|
+
"what", "which", "who", "whom", "think", "thought", "about",
|
|
14
|
+
]);
|
|
15
|
+
export function tokenize(text) {
|
|
16
|
+
const words = text
|
|
17
|
+
.toLowerCase()
|
|
18
|
+
.replace(/[^a-z0-9\s-]/g, "")
|
|
19
|
+
.split(/\s+/)
|
|
20
|
+
.filter(w => w.length > 2 && !STOP_WORDS.has(w));
|
|
21
|
+
return new Set(words);
|
|
22
|
+
}
|
|
23
|
+
export function jaccardSimilarity(setA, setB) {
|
|
24
|
+
if (setA.size === 0 && setB.size === 0)
|
|
25
|
+
return 0;
|
|
26
|
+
let intersection = 0;
|
|
27
|
+
for (const item of setA) {
|
|
28
|
+
if (setB.has(item))
|
|
29
|
+
intersection++;
|
|
30
|
+
}
|
|
31
|
+
const union = setA.size + setB.size - intersection;
|
|
32
|
+
return union === 0 ? 0 : intersection / union;
|
|
33
|
+
}
|
|
34
|
+
export class Analyzer {
|
|
35
|
+
config;
|
|
36
|
+
constructor(config) {
|
|
37
|
+
this.config = config;
|
|
38
|
+
}
|
|
39
|
+
analyze(history, branches, activeStrategy, focus) {
|
|
40
|
+
const patterns = [];
|
|
41
|
+
const suggestions = [];
|
|
42
|
+
const violations = [];
|
|
43
|
+
if (focus === "all" || focus === "patterns") {
|
|
44
|
+
patterns.push(...this.detectCircular(history));
|
|
45
|
+
}
|
|
46
|
+
if (focus === "all" || focus === "contradictions") {
|
|
47
|
+
patterns.push(...this.detectContradictions(history));
|
|
48
|
+
}
|
|
49
|
+
if (focus === "all" || focus === "gaps") {
|
|
50
|
+
suggestions.push(...this.detectGaps(history, activeStrategy));
|
|
51
|
+
}
|
|
52
|
+
if (focus === "all") {
|
|
53
|
+
violations.push(...this.checkPractices(history));
|
|
54
|
+
}
|
|
55
|
+
const progress = this.summarizeProgress(history, branches);
|
|
56
|
+
const summary = this.buildSummary(history, patterns, progress);
|
|
57
|
+
if (patterns.length === 0 && focus !== "progress") {
|
|
58
|
+
suggestions.push("No issues detected. Reasoning chain looks consistent so far.");
|
|
59
|
+
}
|
|
60
|
+
return { summary, patterns, suggestions, practiceViolations: violations, progress };
|
|
61
|
+
}
|
|
62
|
+
detectCircular(history) {
|
|
63
|
+
const patterns = [];
|
|
64
|
+
const threshold = this.config.reflection.circularThreshold;
|
|
65
|
+
const tokenSets = history.map(t => tokenize(t.thought));
|
|
66
|
+
for (let i = 0; i < history.length; i++) {
|
|
67
|
+
for (let j = i + 2; j < history.length; j++) {
|
|
68
|
+
const sim = jaccardSimilarity(tokenSets[i], tokenSets[j]);
|
|
69
|
+
if (sim > threshold) {
|
|
70
|
+
patterns.push({
|
|
71
|
+
type: "circular",
|
|
72
|
+
description: `Thoughts ${history[i].thoughtNumber} and ${history[j].thoughtNumber} share ${Math.round(sim * 100)}% similarity — possible circular reasoning`,
|
|
73
|
+
involvedThoughts: [history[i].thoughtNumber, history[j].thoughtNumber],
|
|
74
|
+
severity: sim > 0.8 ? "critical" : "warning",
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return patterns;
|
|
80
|
+
}
|
|
81
|
+
detectContradictions(history) {
|
|
82
|
+
const patterns = [];
|
|
83
|
+
const negationPairs = [
|
|
84
|
+
["should", "should not"], ["must", "must not"], ["can", "cannot"],
|
|
85
|
+
["will", "will not"], ["is", "is not"], ["are", "are not"],
|
|
86
|
+
["recommend", "avoid"], ["yes", "no"], ["true", "false"],
|
|
87
|
+
["good", "bad"], ["increase", "decrease"], ["add", "remove"],
|
|
88
|
+
];
|
|
89
|
+
for (let i = 0; i < history.length; i++) {
|
|
90
|
+
const textI = history[i].thought.toLowerCase();
|
|
91
|
+
for (let j = i + 1; j < history.length; j++) {
|
|
92
|
+
const textJ = history[j].thought.toLowerCase();
|
|
93
|
+
for (const [pos, neg] of negationPairs) {
|
|
94
|
+
if ((textI.includes(pos) && textJ.includes(neg)) ||
|
|
95
|
+
(textI.includes(neg) && textJ.includes(pos))) {
|
|
96
|
+
const tokensI = tokenize(history[i].thought);
|
|
97
|
+
const tokensJ = tokenize(history[j].thought);
|
|
98
|
+
const sim = jaccardSimilarity(tokensI, tokensJ);
|
|
99
|
+
// Only flag if the thoughts are about the same topic (some word overlap)
|
|
100
|
+
if (sim > 0.2) {
|
|
101
|
+
patterns.push({
|
|
102
|
+
type: "contradiction",
|
|
103
|
+
description: `Thoughts ${history[i].thoughtNumber} and ${history[j].thoughtNumber} may contradict on "${pos}/${neg}"`,
|
|
104
|
+
involvedThoughts: [history[i].thoughtNumber, history[j].thoughtNumber],
|
|
105
|
+
severity: "warning",
|
|
106
|
+
});
|
|
107
|
+
break;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return patterns;
|
|
114
|
+
}
|
|
115
|
+
detectGaps(history, activeStrategy) {
|
|
116
|
+
const gaps = [];
|
|
117
|
+
// Check if assumptions are being tracked
|
|
118
|
+
const hasAssumptions = history.some(t => t.assumptions && t.assumptions.length > 0);
|
|
119
|
+
if (!hasAssumptions && history.length >= 3) {
|
|
120
|
+
gaps.push("No assumptions have been made explicit. Consider documenting key assumptions.");
|
|
121
|
+
}
|
|
122
|
+
// Check if evidence is being tracked
|
|
123
|
+
const hasEvidence = history.some(t => t.evidence && t.evidence.length > 0);
|
|
124
|
+
if (!hasEvidence && history.length >= 5) {
|
|
125
|
+
gaps.push("No evidence has been cited. Consider linking conclusions to supporting data.");
|
|
126
|
+
}
|
|
127
|
+
// Check confidence coverage
|
|
128
|
+
const withConfidence = history.filter(t => t.confidence !== undefined);
|
|
129
|
+
if (withConfidence.length < history.length * 0.5 && history.length >= 3) {
|
|
130
|
+
gaps.push("Less than half of thoughts have confidence scores. Tracking confidence improves analysis.");
|
|
131
|
+
}
|
|
132
|
+
// Check branch exploration
|
|
133
|
+
if (history.length >= 8 && Object.keys(history.filter(t => t.branchId)).length === 0) {
|
|
134
|
+
gaps.push("No alternative approaches explored. Consider branching to evaluate alternatives.");
|
|
135
|
+
}
|
|
136
|
+
return gaps;
|
|
137
|
+
}
|
|
138
|
+
checkPractices(history) {
|
|
139
|
+
const violations = [];
|
|
140
|
+
const { rules, antiPatterns } = this.config.practices;
|
|
141
|
+
for (const thought of history) {
|
|
142
|
+
const textLower = thought.thought.toLowerCase();
|
|
143
|
+
for (const antiPattern of antiPatterns) {
|
|
144
|
+
const keywords = tokenize(antiPattern);
|
|
145
|
+
const thoughtTokens = tokenize(thought.thought);
|
|
146
|
+
const sim = jaccardSimilarity(keywords, thoughtTokens);
|
|
147
|
+
if (sim > 0.3) {
|
|
148
|
+
violations.push({
|
|
149
|
+
rule: antiPattern,
|
|
150
|
+
thoughtNumber: thought.thoughtNumber,
|
|
151
|
+
explanation: `Thought ${thought.thoughtNumber} may involve an anti-pattern: "${antiPattern}"`,
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
return violations;
|
|
157
|
+
}
|
|
158
|
+
summarizeProgress(history, branches) {
|
|
159
|
+
const confidences = history
|
|
160
|
+
.map(t => t.confidence)
|
|
161
|
+
.filter((c) => c !== undefined);
|
|
162
|
+
const avgConfidence = confidences.length > 0
|
|
163
|
+
? confidences.reduce((a, b) => a + b, 0) / confidences.length
|
|
164
|
+
: null;
|
|
165
|
+
let confidenceTrend = "unknown";
|
|
166
|
+
if (confidences.length >= 3) {
|
|
167
|
+
const firstHalf = confidences.slice(0, Math.floor(confidences.length / 2));
|
|
168
|
+
const secondHalf = confidences.slice(Math.floor(confidences.length / 2));
|
|
169
|
+
const avgFirst = firstHalf.reduce((a, b) => a + b, 0) / firstHalf.length;
|
|
170
|
+
const avgSecond = secondHalf.reduce((a, b) => a + b, 0) / secondHalf.length;
|
|
171
|
+
if (avgSecond - avgFirst > 0.1)
|
|
172
|
+
confidenceTrend = "rising";
|
|
173
|
+
else if (avgFirst - avgSecond > 0.1)
|
|
174
|
+
confidenceTrend = "falling";
|
|
175
|
+
else
|
|
176
|
+
confidenceTrend = "stable";
|
|
177
|
+
}
|
|
178
|
+
const allTags = history.flatMap(t => t.tags ?? []);
|
|
179
|
+
const uniqueTopics = new Set(allTags).size;
|
|
180
|
+
const lastThought = history[history.length - 1];
|
|
181
|
+
const estimatedCompletion = lastThought
|
|
182
|
+
? Math.min(100, Math.round((lastThought.thoughtNumber / lastThought.totalThoughts) * 100))
|
|
183
|
+
: 0;
|
|
184
|
+
return {
|
|
185
|
+
totalThoughts: history.length,
|
|
186
|
+
uniqueTopics,
|
|
187
|
+
branchesExplored: Object.keys(branches).length,
|
|
188
|
+
averageConfidence: avgConfidence,
|
|
189
|
+
confidenceTrend,
|
|
190
|
+
estimatedCompletion,
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
buildSummary(history, patterns, progress) {
|
|
194
|
+
const parts = [];
|
|
195
|
+
parts.push(`${progress.totalThoughts} thoughts recorded, ~${progress.estimatedCompletion}% complete.`);
|
|
196
|
+
if (progress.branchesExplored > 0) {
|
|
197
|
+
parts.push(`${progress.branchesExplored} branch(es) explored.`);
|
|
198
|
+
}
|
|
199
|
+
if (progress.averageConfidence !== null) {
|
|
200
|
+
parts.push(`Average confidence: ${Math.round(progress.averageConfidence * 100)}% (${progress.confidenceTrend}).`);
|
|
201
|
+
}
|
|
202
|
+
const critical = patterns.filter(p => p.severity === "critical");
|
|
203
|
+
if (critical.length > 0) {
|
|
204
|
+
parts.push(`${critical.length} critical issue(s) detected.`);
|
|
205
|
+
}
|
|
206
|
+
return parts.join(" ");
|
|
207
|
+
}
|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wBAAwB,QAAQ,CAAC,mBAAmB,aAAa,CAAC,CAAC;QAEvG,IAAI,QAAQ,CAAC,gBAAgB,GAAG,CAAC,EAAE,CAAC;YAClC,KAAK,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,gBAAgB,uBAAuB,CAAC,CAAC;QAClE,CAAC;QAED,IAAI,QAAQ,CAAC,iBAAiB,KAAK,IAAI,EAAE,CAAC;YACxC,KAAK,CAAC,IAAI,CAAC,uBAAuB,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,iBAAiB,GAAG,GAAG,CAAC,MAAM,QAAQ,CAAC,eAAe,IAAI,CAAC,CAAC;QACpH,CAAC;QAED,MAAM,QAAQ,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,UAAU,CAAC,CAAC;QACjE,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACxB,KAAK,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,MAAM,8BAA8B,CAAC,CAAC;QAC/D,CAAC;QAED,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACzB,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"strategies.d.ts","sourceRoot":"","sources":["../../src/engine/strategies.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5C,eAAO,MAAM,mBAAmB,EAAE,QAAQ,EAkJzC,CAAC"}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
export const BUILT_IN_STRATEGIES = [
|
|
2
|
+
{
|
|
3
|
+
name: "first-principles",
|
|
4
|
+
description: "Decompose assumptions and rebuild understanding from ground truth",
|
|
5
|
+
whenToUse: "When tackling complex problems where conventional wisdom may be misleading",
|
|
6
|
+
steps: [
|
|
7
|
+
"Identify the core problem or question",
|
|
8
|
+
"List all assumptions being made",
|
|
9
|
+
"Challenge each assumption — is it actually true?",
|
|
10
|
+
"Identify the fundamental truths that remain",
|
|
11
|
+
"Rebuild your understanding from these truths",
|
|
12
|
+
"Synthesize a solution based on first principles",
|
|
13
|
+
],
|
|
14
|
+
guidingQuestions: [
|
|
15
|
+
"What am I assuming that might not be true?",
|
|
16
|
+
"What is the most basic truth I can establish here?",
|
|
17
|
+
"If I started from scratch, would I arrive at the same conclusion?",
|
|
18
|
+
"What would a beginner with no assumptions think?",
|
|
19
|
+
],
|
|
20
|
+
reflectChecks: [
|
|
21
|
+
"Have assumptions been identified and challenged?",
|
|
22
|
+
"Are conclusions built on verified truths, not inherited beliefs?",
|
|
23
|
+
"Is the reasoning independent of analogies or precedent?",
|
|
24
|
+
],
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
name: "red-team",
|
|
28
|
+
description: "Attack your own conclusions to find weaknesses and blind spots",
|
|
29
|
+
whenToUse: "When validating important decisions or checking for blind spots",
|
|
30
|
+
steps: [
|
|
31
|
+
"State your current position or conclusion clearly",
|
|
32
|
+
"Assume the position is wrong — find reasons why",
|
|
33
|
+
"Identify the weakest assumptions in the argument",
|
|
34
|
+
"Consider adversarial scenarios and edge cases",
|
|
35
|
+
"Assess: does the position survive the attack?",
|
|
36
|
+
"Strengthen or revise the position based on findings",
|
|
37
|
+
],
|
|
38
|
+
guidingQuestions: [
|
|
39
|
+
"If I had to argue against this, what would I say?",
|
|
40
|
+
"What's the strongest counterargument?",
|
|
41
|
+
"Under what conditions does this fail?",
|
|
42
|
+
"Who would disagree with this and why?",
|
|
43
|
+
],
|
|
44
|
+
reflectChecks: [
|
|
45
|
+
"Has the position been attacked from multiple angles?",
|
|
46
|
+
"Were counterarguments genuinely strong, not straw men?",
|
|
47
|
+
"Have edge cases and failure modes been considered?",
|
|
48
|
+
],
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
name: "convergent",
|
|
52
|
+
description: "Narrow from many options to one decision through systematic evaluation",
|
|
53
|
+
whenToUse: "When choosing between multiple viable alternatives",
|
|
54
|
+
steps: [
|
|
55
|
+
"List all available options (exhaustively)",
|
|
56
|
+
"Define evaluation criteria with weights",
|
|
57
|
+
"Eliminate options that fail must-have criteria",
|
|
58
|
+
"Score remaining options against weighted criteria",
|
|
59
|
+
"Identify the top 2-3 options",
|
|
60
|
+
"Make a final decision with documented rationale",
|
|
61
|
+
],
|
|
62
|
+
guidingQuestions: [
|
|
63
|
+
"Have I considered all reasonable alternatives?",
|
|
64
|
+
"Are my criteria reflecting actual priorities?",
|
|
65
|
+
"Am I weighting criteria correctly?",
|
|
66
|
+
"Would I defend this choice to a skeptic?",
|
|
67
|
+
],
|
|
68
|
+
reflectChecks: [
|
|
69
|
+
"Were at least 3 alternatives considered?",
|
|
70
|
+
"Are criteria defined and weighted?",
|
|
71
|
+
"Is there a clear winner with documented rationale?",
|
|
72
|
+
],
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
name: "divergent",
|
|
76
|
+
description: "Generate ideas freely without judgment — quantity over quality",
|
|
77
|
+
whenToUse: "When brainstorming, exploring possibilities, or stuck on a problem",
|
|
78
|
+
steps: [
|
|
79
|
+
"State the seed idea or problem",
|
|
80
|
+
"Generate as many ideas as possible (no filtering)",
|
|
81
|
+
"Branch freely — wild ideas welcome",
|
|
82
|
+
"Combine and remix ideas",
|
|
83
|
+
"Group similar ideas into themes",
|
|
84
|
+
"Select promising ideas for deeper exploration",
|
|
85
|
+
],
|
|
86
|
+
guidingQuestions: [
|
|
87
|
+
"What's the most unconventional approach?",
|
|
88
|
+
"What would the opposite solution look like?",
|
|
89
|
+
"Can I combine two existing ideas into something new?",
|
|
90
|
+
"What constraint could I remove to enable new possibilities?",
|
|
91
|
+
],
|
|
92
|
+
reflectChecks: [
|
|
93
|
+
"Were at least 5 distinct ideas generated?",
|
|
94
|
+
"Was judgment deferred during ideation?",
|
|
95
|
+
"Were ideas combined or remixed?",
|
|
96
|
+
],
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
name: "root-cause",
|
|
100
|
+
description: "Systematic investigation to find the real cause, not just symptoms",
|
|
101
|
+
whenToUse: "When debugging, investigating failures, or diagnosing problems",
|
|
102
|
+
steps: [
|
|
103
|
+
"Describe the observed symptoms precisely",
|
|
104
|
+
"Ask 'why?' to dig deeper (5 whys technique)",
|
|
105
|
+
"Map potential causes (fishbone/Ishikawa)",
|
|
106
|
+
"Eliminate causes through evidence",
|
|
107
|
+
"Isolate the root cause",
|
|
108
|
+
"Verify by predicting: if this is the cause, what else should be true?",
|
|
109
|
+
],
|
|
110
|
+
guidingQuestions: [
|
|
111
|
+
"Am I solving the symptom or the root cause?",
|
|
112
|
+
"What changed recently that could explain this?",
|
|
113
|
+
"Can I reproduce this consistently?",
|
|
114
|
+
"What evidence would disprove my current theory?",
|
|
115
|
+
],
|
|
116
|
+
reflectChecks: [
|
|
117
|
+
"Were at least 3 levels of 'why' explored?",
|
|
118
|
+
"Was the root cause verified with evidence?",
|
|
119
|
+
"Were alternative causes considered and eliminated?",
|
|
120
|
+
],
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
name: "decision-matrix",
|
|
124
|
+
description: "Structured comparison of alternatives using weighted criteria",
|
|
125
|
+
whenToUse: "When making high-stakes decisions with multiple factors to balance",
|
|
126
|
+
steps: [
|
|
127
|
+
"Define the decision to be made",
|
|
128
|
+
"List all viable options",
|
|
129
|
+
"Define criteria (functional, non-functional, business, technical)",
|
|
130
|
+
"Assign weights to criteria (must total 100%)",
|
|
131
|
+
"Score each option against each criterion (1-5)",
|
|
132
|
+
"Calculate weighted scores",
|
|
133
|
+
"Document the recommendation with rationale",
|
|
134
|
+
],
|
|
135
|
+
guidingQuestions: [
|
|
136
|
+
"Are all stakeholder concerns represented in the criteria?",
|
|
137
|
+
"Am I biased toward any option?",
|
|
138
|
+
"What's the cost of being wrong?",
|
|
139
|
+
"Is there a reversible option that scores well enough?",
|
|
140
|
+
],
|
|
141
|
+
reflectChecks: [
|
|
142
|
+
"Are criteria weighted and documented?",
|
|
143
|
+
"Were scores justified, not arbitrary?",
|
|
144
|
+
"Was the recommendation clearly stated with rationale?",
|
|
145
|
+
],
|
|
146
|
+
},
|
|
147
|
+
];
|
|
148
|
+
//# sourceMappingURL=strategies.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"strategies.js","sourceRoot":"","sources":["../../src/engine/strategies.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,mBAAmB,GAAe;IAC7C;QACE,IAAI,EAAE,kBAAkB;QACxB,WAAW,EAAE,mEAAmE;QAChF,SAAS,EAAE,4EAA4E;QACvF,KAAK,EAAE;YACL,uCAAuC;YACvC,iCAAiC;YACjC,kDAAkD;YAClD,6CAA6C;YAC7C,8CAA8C;YAC9C,iDAAiD;SAClD;QACD,gBAAgB,EAAE;YAChB,4CAA4C;YAC5C,oDAAoD;YACpD,mEAAmE;YACnE,kDAAkD;SACnD;QACD,aAAa,EAAE;YACb,kDAAkD;YAClD,kEAAkE;YAClE,yDAAyD;SAC1D;KACF;IACD;QACE,IAAI,EAAE,UAAU;QAChB,WAAW,EAAE,gEAAgE;QAC7E,SAAS,EAAE,iEAAiE;QAC5E,KAAK,EAAE;YACL,mDAAmD;YACnD,iDAAiD;YACjD,kDAAkD;YAClD,+CAA+C;YAC/C,+CAA+C;YAC/C,qDAAqD;SACtD;QACD,gBAAgB,EAAE;YAChB,mDAAmD;YACnD,uCAAuC;YACvC,uCAAuC;YACvC,uCAAuC;SACxC;QACD,aAAa,EAAE;YACb,sDAAsD;YACtD,wDAAwD;YACxD,oDAAoD;SACrD;KACF;IACD;QACE,IAAI,EAAE,YAAY;QAClB,WAAW,EAAE,wEAAwE;QACrF,SAAS,EAAE,oDAAoD;QAC/D,KAAK,EAAE;YACL,2CAA2C;YAC3C,yCAAyC;YACzC,gDAAgD;YAChD,mDAAmD;YACnD,8BAA8B;YAC9B,iDAAiD;SAClD;QACD,gBAAgB,EAAE;YAChB,gDAAgD;YA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
1
|
+
import type { ThoughtData, StoredThought, DeepThinkConfig } from "../types.js";
|
|
2
|
+
export declare class ThoughtStore {
|
|
3
|
+
private thoughtHistory;
|
|
4
|
+
private branches;
|
|
5
|
+
private activeStrategy;
|
|
6
|
+
private sessionId;
|
|
7
|
+
private config;
|
|
8
|
+
constructor(config: DeepThinkConfig);
|
|
9
|
+
addThought(input: ThoughtData): StoredThought;
|
|
10
|
+
getThought(thoughtNumber: number): StoredThought | undefined;
|
|
11
|
+
getHistory(): StoredThought[];
|
|
12
|
+
getBranches(): Record<string, StoredThought[]>;
|
|
13
|
+
getBranchIds(): string[];
|
|
14
|
+
getBranch(branchId: string): StoredThought[];
|
|
15
|
+
getActiveStrategy(): string | null;
|
|
16
|
+
setActiveStrategy(strategy: string | null): void;
|
|
17
|
+
getSessionId(): string;
|
|
18
|
+
getConfig(): DeepThinkConfig;
|
|
19
|
+
clear(): void;
|
|
20
|
+
serialize(): {
|
|
21
|
+
thoughtHistory: StoredThought[];
|
|
22
|
+
branches: Record<string, StoredThought[]>;
|
|
23
|
+
activeStrategy: string | null;
|
|
24
|
+
sessionId: string;
|
|
25
|
+
};
|
|
26
|
+
restore(data: {
|
|
27
|
+
thoughtHistory: StoredThought[];
|
|
28
|
+
branches: Record<string, StoredThought[]>;
|
|
29
|
+
activeStrategy: string | null;
|
|
30
|
+
sessionId: string;
|
|
31
|
+
}): void;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=thought-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"thought-store.d.ts","sourceRoot":"","sources":["../../src/engine/thought-store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE/E,qBAAa,YAAY;IACvB,OAAO,CAAC,cAAc,CAAuB;IAC7C,OAAO,CAAC,QAAQ,CAAuC;IACvD,OAAO,CAAC,cAAc,CAAuB;IAC7C,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,MAAM,CAAkB;gBAEpB,MAAM,EAAE,eAAe;IAMnC,UAAU,CAAC,KAAK,EAAE,WAAW,GAAG,aAAa;IAuB7C,UAAU,CAAC,aAAa,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS;IAI5D,UAAU,IAAI,aAAa,EAAE;IAI7B,WAAW,IAAI,MAAM,CAAC,MAAM,EAAE,aAAa,EAAE,CAAC;IAI9C,YAAY,IAAI,MAAM,EAAE;IAIxB,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,aAAa,EAAE;IAI5C,iBAAiB,IAAI,MAAM,GAAG,IAAI;IAIlC,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAIhD,YAAY,IAAI,MAAM;IAItB,SAAS,IAAI,eAAe;IAI5B,KAAK,IAAI,IAAI;IAMb,SAAS,IAAI;QAAE,cAAc,EAAE,aAAa,EAAE,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,EAAE,CAAC,CAAC;QAAC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE;IAS7I,OAAO,CAAC,IAAI,EAAE;QAAE,cAAc,EAAE,aAAa,EAAE,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,EAAE,CAAC,CAAC;QAAC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;CAMtJ"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
export class ThoughtStore {
|
|
2
|
+
thoughtHistory = [];
|
|
3
|
+
branches = {};
|
|
4
|
+
activeStrategy = null;
|
|
5
|
+
sessionId;
|
|
6
|
+
config;
|
|
7
|
+
constructor(config) {
|
|
8
|
+
this.config = config;
|
|
9
|
+
this.sessionId = crypto.randomUUID();
|
|
10
|
+
this.activeStrategy = config.thinking.defaultStrategy;
|
|
11
|
+
}
|
|
12
|
+
addThought(input) {
|
|
13
|
+
if (input.thoughtNumber > input.totalThoughts) {
|
|
14
|
+
input.totalThoughts = input.thoughtNumber;
|
|
15
|
+
}
|
|
16
|
+
const stored = {
|
|
17
|
+
...input,
|
|
18
|
+
timestamp: new Date().toISOString(),
|
|
19
|
+
sessionId: this.sessionId,
|
|
20
|
+
};
|
|
21
|
+
this.thoughtHistory.push(stored);
|
|
22
|
+
if (input.branchFromThought && input.branchId) {
|
|
23
|
+
if (!this.branches[input.branchId]) {
|
|
24
|
+
this.branches[input.branchId] = [];
|
|
25
|
+
}
|
|
26
|
+
this.branches[input.branchId].push(stored);
|
|
27
|
+
}
|
|
28
|
+
return stored;
|
|
29
|
+
}
|
|
30
|
+
getThought(thoughtNumber) {
|
|
31
|
+
return this.thoughtHistory.find(t => t.thoughtNumber === thoughtNumber);
|
|
32
|
+
}
|
|
33
|
+
getHistory() {
|
|
34
|
+
return [...this.thoughtHistory];
|
|
35
|
+
}
|
|
36
|
+
getBranches() {
|
|
37
|
+
return { ...this.branches };
|
|
38
|
+
}
|
|
39
|
+
getBranchIds() {
|
|
40
|
+
return Object.keys(this.branches);
|
|
41
|
+
}
|
|
42
|
+
getBranch(branchId) {
|
|
43
|
+
return this.branches[branchId] ? [...this.branches[branchId]] : [];
|
|
44
|
+
}
|
|
45
|
+
getActiveStrategy() {
|
|
46
|
+
return this.activeStrategy;
|
|
47
|
+
}
|
|
48
|
+
setActiveStrategy(strategy) {
|
|
49
|
+
this.activeStrategy = strategy;
|
|
50
|
+
}
|
|
51
|
+
getSessionId() {
|
|
52
|
+
return this.sessionId;
|
|
53
|
+
}
|
|
54
|
+
getConfig() {
|
|
55
|
+
return this.config;
|
|
56
|
+
}
|
|
57
|
+
clear() {
|
|
58
|
+
this.thoughtHistory = [];
|
|
59
|
+
this.branches = {};
|
|
60
|
+
}
|
|
61
|
+
// Serialization for checkpointing
|
|
62
|
+
serialize() {
|
|
63
|
+
return {
|
|
64
|
+
thoughtHistory: this.thoughtHistory,
|
|
65
|
+
branches: this.branches,
|
|
66
|
+
activeStrategy: this.activeStrategy,
|
|
67
|
+
sessionId: this.sessionId,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
restore(data) {
|
|
71
|
+
this.thoughtHistory = data.thoughtHistory;
|
|
72
|
+
this.branches = data.branches;
|
|
73
|
+
this.activeStrategy = data.activeStrategy;
|
|
74
|
+
this.sessionId = data.sessionId;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=thought-store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"thought-store.js","sourceRoot":"","sources":["../../src/engine/thought-store.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,YAAY;IACf,cAAc,GAAoB,EAAE,CAAC;IACrC,QAAQ,GAAoC,EAAE,CAAC;IAC/C,cAAc,GAAkB,IAAI,CAAC;IACrC,SAAS,CAAS;IAClB,MAAM,CAAkB;IAEhC,YAAY,MAAuB;QACjC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;QACrC,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC,QAAQ,CAAC,eAAe,CAAC;IACxD,CAAC;IAED,UAAU,CAAC,KAAkB;QAC3B,IAAI,KAAK,CAAC,aAAa,GAAG,KAAK,CAAC,aAAa,EAAE,CAAC;YAC9C,KAAK,CAAC,aAAa,GAAG,KAAK,CAAC,aAAa,CAAC;QAC5C,CAAC;QAED,MAAM,MAAM,GAAkB;YAC5B,GAAG,KAAK;YACR,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACnC,SAAS,EAAE,IAAI,CAAC,SAAS;SAC1B,CAAC;QAEF,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAEjC,IAAI,KAAK,CAAC,iBAA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