@triedotdev/mcp 1.0.130 → 1.0.133
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/dist/{chunk-WIMNGEY2.js → chunk-3DPVJQNM.js} +3 -3
- package/dist/{chunk-7TTVDHXO.js → chunk-6OUWNVLX.js} +2 -2
- package/dist/{chunk-K5EXATBF.js → chunk-JAKMZI5S.js} +2 -2
- package/dist/{chunk-WMI44VIC.js → chunk-JCU6REX7.js} +6 -2
- package/dist/{chunk-WMI44VIC.js.map → chunk-JCU6REX7.js.map} +1 -1
- package/dist/{chunk-SUPXBOJD.js → chunk-LMFREFAP.js} +294 -84
- package/dist/chunk-LMFREFAP.js.map +1 -0
- package/dist/{chunk-W2DEBKZ2.js → chunk-LRQV7SGQ.js} +3 -3
- package/dist/{chunk-7Q6I2CB4.js → chunk-PEJEYWVR.js} +7 -2
- package/dist/{chunk-7Q6I2CB4.js.map → chunk-PEJEYWVR.js.map} +1 -1
- package/dist/{chunk-TRIJC5MW.js → chunk-T4THB2OR.js} +2 -2
- package/dist/{chunk-CDU4B7AC.js → chunk-T62V4H5O.js} +7 -7
- package/dist/cli/main.js +5 -5
- package/dist/cli/yolo-daemon.js +9 -9
- package/dist/{client-EWP4SIG3.js → client-OVI6TBX7.js} +2 -2
- package/dist/{goal-manager-RREOIX6U.js → goal-manager-FAK7H4RR.js} +4 -4
- package/dist/{goal-validator-NLOJJ7FF.js → goal-validator-KLAK5TZN.js} +9 -3
- package/dist/goal-validator-KLAK5TZN.js.map +1 -0
- package/dist/{guardian-agent-Q34YVH4J.js → guardian-agent-3EUJUAJ2.js} +8 -8
- package/dist/{hypothesis-HFYZNIMZ.js → hypothesis-I276JIDW.js} +4 -4
- package/dist/index.js +16 -16
- package/dist/{ledger-JMPGJGLB.js → ledger-WKVJWHBX.js} +4 -2
- package/package.json +1 -1
- package/dist/chunk-SUPXBOJD.js.map +0 -1
- package/dist/goal-validator-NLOJJ7FF.js.map +0 -1
- /package/dist/{chunk-WIMNGEY2.js.map → chunk-3DPVJQNM.js.map} +0 -0
- /package/dist/{chunk-7TTVDHXO.js.map → chunk-6OUWNVLX.js.map} +0 -0
- /package/dist/{chunk-K5EXATBF.js.map → chunk-JAKMZI5S.js.map} +0 -0
- /package/dist/{chunk-W2DEBKZ2.js.map → chunk-LRQV7SGQ.js.map} +0 -0
- /package/dist/{chunk-TRIJC5MW.js.map → chunk-T4THB2OR.js.map} +0 -0
- /package/dist/{chunk-CDU4B7AC.js.map → chunk-T62V4H5O.js.map} +0 -0
- /package/dist/{client-EWP4SIG3.js.map → client-OVI6TBX7.js.map} +0 -0
- /package/dist/{goal-manager-RREOIX6U.js.map → goal-manager-FAK7H4RR.js.map} +0 -0
- /package/dist/{guardian-agent-Q34YVH4J.js.map → guardian-agent-3EUJUAJ2.js.map} +0 -0
- /package/dist/{hypothesis-HFYZNIMZ.js.map → hypothesis-I276JIDW.js.map} +0 -0
- /package/dist/{ledger-JMPGJGLB.js.map → ledger-WKVJWHBX.js.map} +0 -0
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-4YJ6KLGI.js";
|
|
4
4
|
import {
|
|
5
5
|
searchIssues
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-JAKMZI5S.js";
|
|
7
7
|
import {
|
|
8
8
|
getGuardianState
|
|
9
9
|
} from "./chunk-UHMMANC2.js";
|
|
@@ -133,7 +133,7 @@ var HypothesisEngine = class {
|
|
|
133
133
|
* This enables fully agentic hypothesis creation based on actual codebase observations
|
|
134
134
|
*/
|
|
135
135
|
async generateHypothesesWithAI(context) {
|
|
136
|
-
const { isAIAvailable, runAIAnalysis } = await import("./client-
|
|
136
|
+
const { isAIAvailable, runAIAnalysis } = await import("./client-OVI6TBX7.js");
|
|
137
137
|
if (!isAIAvailable()) {
|
|
138
138
|
return [];
|
|
139
139
|
}
|
|
@@ -718,4 +718,4 @@ export {
|
|
|
718
718
|
clearHypothesisEngines,
|
|
719
719
|
gatherEvidenceForHypothesis
|
|
720
720
|
};
|
|
721
|
-
//# sourceMappingURL=chunk-
|
|
721
|
+
//# sourceMappingURL=chunk-LRQV7SGQ.js.map
|
|
@@ -114,6 +114,10 @@ async function loadLedger(projectDir) {
|
|
|
114
114
|
return [];
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
|
+
async function getLedgerBlocks(workDir) {
|
|
118
|
+
const projectDir = workDir || getWorkingDirectory(void 0, true);
|
|
119
|
+
return loadLedger(projectDir);
|
|
120
|
+
}
|
|
117
121
|
async function saveLedger(blocks, projectDir) {
|
|
118
122
|
const ledgerPath = join(getTrieDirectory(projectDir), "memory", LEDGER_FILENAME);
|
|
119
123
|
await atomicWriteJSON(ledgerPath, blocks);
|
|
@@ -125,6 +129,7 @@ function sha256(input) {
|
|
|
125
129
|
export {
|
|
126
130
|
appendIssuesToLedger,
|
|
127
131
|
verifyLedger,
|
|
128
|
-
computeMerkleRoot
|
|
132
|
+
computeMerkleRoot,
|
|
133
|
+
getLedgerBlocks
|
|
129
134
|
};
|
|
130
|
-
//# sourceMappingURL=chunk-
|
|
135
|
+
//# sourceMappingURL=chunk-PEJEYWVR.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/memory/ledger.ts"],"sourcesContent":["import { createHash } from 'crypto';\nimport { mkdir, readFile } from 'fs/promises';\nimport { existsSync } from 'fs';\nimport { join } from 'path';\nimport { atomicWriteJSON } from '../utils/atomic-write.js';\nimport { getWorkingDirectory, getTrieDirectory } from '../utils/workspace.js';\nimport type { StoredIssue } from './issue-store.js';\n\nconst LEDGER_FILENAME = 'ledger.json';\nconst GENESIS_HASH = '0'.repeat(64);\nconst LEDGER_VERSION = 1;\n\nexport interface LedgerEntry {\n id: string;\n hash: string;\n severity: string;\n file: string;\n agent: string;\n timestamp: string;\n}\n\nexport interface LedgerBlock {\n version: number;\n date: string;\n entries: LedgerEntry[];\n previousHash: string;\n merkleRoot: string;\n blockHash: string;\n createdAt: string;\n updatedAt: string;\n}\n\nexport interface LedgerVerificationResult {\n valid: boolean;\n error?: string;\n}\n\nexport async function appendIssuesToLedger(\n issues: StoredIssue[],\n workDir?: string\n): Promise<LedgerBlock | null> {\n if (issues.length === 0) return null;\n\n const projectDir = workDir || getWorkingDirectory(undefined, true);\n const memoryDir = join(getTrieDirectory(projectDir), 'memory');\n await mkdir(memoryDir, { recursive: true });\n\n const blocks = await loadLedger(projectDir);\n const today = new Date().toISOString().slice(0, 10);\n const now = new Date().toISOString();\n\n const entries: LedgerEntry[] = issues.map(issue => ({\n id: issue.id,\n hash: issue.hash,\n severity: issue.severity,\n file: issue.file,\n agent: issue.agent,\n timestamp: issue.timestamp,\n }));\n\n const previousBlock = blocks[blocks.length - 1];\n const block = previousBlock && previousBlock.date === today\n ? previousBlock\n : createBlock(today, now, previousBlock?.blockHash ?? GENESIS_HASH);\n\n if (block !== previousBlock) {\n blocks.push(block);\n }\n\n block.entries = [...block.entries, ...entries];\n block.merkleRoot = computeMerkleRoot(block.entries.map(entry => entry.hash));\n block.blockHash = computeBlockHash(block.previousHash, block.merkleRoot, block.date, block.version);\n block.updatedAt = now;\n\n await saveLedger(blocks, projectDir);\n return block;\n}\n\nexport async function verifyLedger(workDir?: string): Promise<LedgerVerificationResult> {\n const projectDir = workDir || getWorkingDirectory(undefined, true);\n const blocks = await loadLedger(projectDir);\n\n if (blocks.length === 0) {\n return { valid: true };\n }\n\n for (let i = 0; i < blocks.length; i += 1) {\n const block = blocks[i];\n if (!block) {\n return { valid: false, error: `Block ${i} missing` };\n }\n const expectedPreviousHash = i === 0\n ? GENESIS_HASH\n : blocks[i - 1]?.blockHash;\n\n if (!expectedPreviousHash) {\n return { valid: false, error: `Block ${i} missing previous block` };\n }\n\n if (block.previousHash !== expectedPreviousHash) {\n return { valid: false, error: `Block ${i} previous hash mismatch` };\n }\n\n const computedMerkleRoot = computeMerkleRoot(block.entries.map(entry => entry.hash));\n if (block.merkleRoot !== computedMerkleRoot) {\n return { valid: false, error: `Block ${i} merkle root mismatch` };\n }\n\n const computedBlockHash = computeBlockHash(block.previousHash, block.merkleRoot, block.date, block.version);\n if (block.blockHash !== computedBlockHash) {\n return { valid: false, error: `Block ${i} hash mismatch` };\n }\n }\n\n return { valid: true };\n}\n\nexport function computeMerkleRoot(hashes: string[]): string {\n if (hashes.length === 0) {\n return sha256('');\n }\n\n let level = hashes.slice();\n while (level.length > 1) {\n const nextLevel: string[] = [];\n for (let i = 0; i < level.length; i += 2) {\n const left = level[i];\n const right = level[i + 1] ?? left;\n nextLevel.push(sha256(`${left}:${right}`));\n }\n level = nextLevel;\n }\n\n return level[0]!;\n}\n\nfunction computeBlockHash(previousHash: string, merkleRoot: string, date: string, version: number): string {\n return sha256(`${version}:${date}:${previousHash}:${merkleRoot}`);\n}\n\nfunction createBlock(date: string, now: string, previousHash: string): LedgerBlock {\n return {\n version: LEDGER_VERSION,\n date,\n entries: [],\n previousHash,\n merkleRoot: '',\n blockHash: '',\n createdAt: now,\n updatedAt: now,\n };\n}\n\nasync function loadLedger(projectDir: string): Promise<LedgerBlock[]> {\n const ledgerPath = join(getTrieDirectory(projectDir), 'memory', LEDGER_FILENAME);\n try {\n if (!existsSync(ledgerPath)) return [];\n const content = await readFile(ledgerPath, 'utf-8');\n const parsed = JSON.parse(content);\n if (!Array.isArray(parsed)) return [];\n return parsed as LedgerBlock[];\n } catch {\n return [];\n }\n}\n\nasync function saveLedger(blocks: LedgerBlock[], projectDir: string): Promise<void> {\n const ledgerPath = join(getTrieDirectory(projectDir), 'memory', LEDGER_FILENAME);\n await atomicWriteJSON(ledgerPath, blocks);\n}\n\nfunction sha256(input: string): string {\n return createHash('sha256').update(input).digest('hex');\n}\n"],"mappings":";;;;;;;;;AAAA,SAAS,kBAAkB;AAC3B,SAAS,OAAO,gBAAgB;AAChC,SAAS,kBAAkB;AAC3B,SAAS,YAAY;AAKrB,IAAM,kBAAkB;AACxB,IAAM,eAAe,IAAI,OAAO,EAAE;AAClC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;AAAA,EACV;AAEA,SAAO,MAAM,CAAC;AAChB;AAEA,SAAS,iBAAiB,cAAsB,YAAoB,MAAc,SAAyB;AACzG,SAAO,OAAO,GAAG,OAAO,IAAI,IAAI,IAAI,YAAY,IAAI,UAAU,EAAE;AAClE;AAEA,SAAS,YAAY,MAAc,KAAa,cAAmC;AACjF,SAAO;AAAA,IACL,SAAS;AAAA,IACT;AAAA,IACA,SAAS,CAAC;AAAA,IACV;AAAA,IACA,YAAY;AAAA,IACZ,WAAW;AAAA,IACX,WAAW;AAAA,IACX,WAAW;AAAA,EACb;AACF;AAEA,eAAe,WAAW,YAA4C;AACpE,QAAM,aAAa,KAAK,iBAAiB,UAAU,GAAG,UAAU,eAAe;AAC/E,MAAI;AACF,QAAI,CAAC,WAAW,UAAU,EAAG,QAAO,CAAC;AACrC,UAAM,UAAU,MAAM,SAAS,YAAY,OAAO;AAClD,UAAM,SAAS,KAAK,MAAM,OAAO;AACjC,QAAI,CAAC,MAAM,QAAQ,MAAM,EAAG,QAAO,CAAC;AACpC,WAAO;AAAA,EACT,QAAQ;AACN,WAAO,CAAC;AAAA,EACV;AACF;AAEA,eAAe,WAAW,QAAuB,YAAmC;AAClF,QAAM,aAAa,KAAK,iBAAiB,UAAU,GAAG,UAAU,eAAe;AAC/E,QAAM,gBAAgB,YAAY,MAAM;AAC1C;AAEA,SAAS,OAAO,OAAuB;AACrC,SAAO,WAAW,QAAQ,EAAE,OAAO,KAAK,EAAE,OAAO,KAAK;AACxD;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/memory/ledger.ts"],"sourcesContent":["import { createHash } from 'crypto';\nimport { mkdir, readFile } from 'fs/promises';\nimport { existsSync } from 'fs';\nimport { join } from 'path';\nimport { atomicWriteJSON } from '../utils/atomic-write.js';\nimport { getWorkingDirectory, getTrieDirectory } from '../utils/workspace.js';\nimport type { StoredIssue } from './issue-store.js';\n\nconst LEDGER_FILENAME = 'ledger.json';\nconst GENESIS_HASH = '0'.repeat(64);\nconst LEDGER_VERSION = 1;\n\nexport interface LedgerEntry {\n id: string;\n hash: string;\n severity: string;\n file: string;\n agent: string;\n timestamp: string;\n}\n\nexport interface LedgerBlock {\n version: number;\n date: string;\n entries: LedgerEntry[];\n previousHash: string;\n merkleRoot: string;\n blockHash: string;\n createdAt: string;\n updatedAt: string;\n}\n\nexport interface LedgerVerificationResult {\n valid: boolean;\n error?: string;\n}\n\nexport async function appendIssuesToLedger(\n issues: StoredIssue[],\n workDir?: string\n): Promise<LedgerBlock | null> {\n if (issues.length === 0) return null;\n\n const projectDir = workDir || getWorkingDirectory(undefined, true);\n const memoryDir = join(getTrieDirectory(projectDir), 'memory');\n await mkdir(memoryDir, { recursive: true });\n\n const blocks = await loadLedger(projectDir);\n const today = new Date().toISOString().slice(0, 10);\n const now = new Date().toISOString();\n\n const entries: LedgerEntry[] = issues.map(issue => ({\n id: issue.id,\n hash: issue.hash,\n severity: issue.severity,\n file: issue.file,\n agent: issue.agent,\n timestamp: issue.timestamp,\n }));\n\n const previousBlock = blocks[blocks.length - 1];\n const block = previousBlock && previousBlock.date === today\n ? previousBlock\n : createBlock(today, now, previousBlock?.blockHash ?? GENESIS_HASH);\n\n if (block !== previousBlock) {\n blocks.push(block);\n }\n\n block.entries = [...block.entries, ...entries];\n block.merkleRoot = computeMerkleRoot(block.entries.map(entry => entry.hash));\n block.blockHash = computeBlockHash(block.previousHash, block.merkleRoot, block.date, block.version);\n block.updatedAt = now;\n\n await saveLedger(blocks, projectDir);\n return block;\n}\n\nexport async function verifyLedger(workDir?: string): Promise<LedgerVerificationResult> {\n const projectDir = workDir || getWorkingDirectory(undefined, true);\n const blocks = await loadLedger(projectDir);\n\n if (blocks.length === 0) {\n return { valid: true };\n }\n\n for (let i = 0; i < blocks.length; i += 1) {\n const block = blocks[i];\n if (!block) {\n return { valid: false, error: `Block ${i} missing` };\n }\n const expectedPreviousHash = i === 0\n ? GENESIS_HASH\n : blocks[i - 1]?.blockHash;\n\n if (!expectedPreviousHash) {\n return { valid: false, error: `Block ${i} missing previous block` };\n }\n\n if (block.previousHash !== expectedPreviousHash) {\n return { valid: false, error: `Block ${i} previous hash mismatch` };\n }\n\n const computedMerkleRoot = computeMerkleRoot(block.entries.map(entry => entry.hash));\n if (block.merkleRoot !== computedMerkleRoot) {\n return { valid: false, error: `Block ${i} merkle root mismatch` };\n }\n\n const computedBlockHash = computeBlockHash(block.previousHash, block.merkleRoot, block.date, block.version);\n if (block.blockHash !== computedBlockHash) {\n return { valid: false, error: `Block ${i} hash mismatch` };\n }\n }\n\n return { valid: true };\n}\n\nexport function computeMerkleRoot(hashes: string[]): string {\n if (hashes.length === 0) {\n return sha256('');\n }\n\n let level = hashes.slice();\n while (level.length > 1) {\n const nextLevel: string[] = [];\n for (let i = 0; i < level.length; i += 2) {\n const left = level[i];\n const right = level[i + 1] ?? left;\n nextLevel.push(sha256(`${left}:${right}`));\n }\n level = nextLevel;\n }\n\n return level[0]!;\n}\n\nfunction computeBlockHash(previousHash: string, merkleRoot: string, date: string, version: number): string {\n return sha256(`${version}:${date}:${previousHash}:${merkleRoot}`);\n}\n\nfunction createBlock(date: string, now: string, previousHash: string): LedgerBlock {\n return {\n version: LEDGER_VERSION,\n date,\n entries: [],\n previousHash,\n merkleRoot: '',\n blockHash: '',\n createdAt: now,\n updatedAt: now,\n };\n}\n\nasync function loadLedger(projectDir: string): Promise<LedgerBlock[]> {\n const ledgerPath = join(getTrieDirectory(projectDir), 'memory', LEDGER_FILENAME);\n try {\n if (!existsSync(ledgerPath)) return [];\n const content = await readFile(ledgerPath, 'utf-8');\n const parsed = JSON.parse(content);\n if (!Array.isArray(parsed)) return [];\n return parsed as LedgerBlock[];\n } catch {\n return [];\n }\n}\n\n/** Load ledger blocks for UI display (block hashes, merkle roots, chain) */\nexport async function getLedgerBlocks(workDir?: string): Promise<LedgerBlock[]> {\n const projectDir = workDir || getWorkingDirectory(undefined, true);\n return loadLedger(projectDir);\n}\n\nasync function saveLedger(blocks: LedgerBlock[], projectDir: string): Promise<void> {\n const ledgerPath = join(getTrieDirectory(projectDir), 'memory', LEDGER_FILENAME);\n await atomicWriteJSON(ledgerPath, blocks);\n}\n\nfunction sha256(input: string): string {\n return createHash('sha256').update(input).digest('hex');\n}\n"],"mappings":";;;;;;;;;AAAA,SAAS,kBAAkB;AAC3B,SAAS,OAAO,gBAAgB;AAChC,SAAS,kBAAkB;AAC3B,SAAS,YAAY;AAKrB,IAAM,kBAAkB;AACxB,IAAM,eAAe,IAAI,OAAO,EAAE;AAClC,IAAM,iBAAiB;AA2BvB,eAAsB,qBACpB,QACA,SAC6B;AAC7B,MAAI,OAAO,WAAW,EAAG,QAAO;AAEhC,QAAM,aAAa,WAAW,oBAAoB,QAAW,IAAI;AACjE,QAAM,YAAY,KAAK,iBAAiB,UAAU,GAAG,QAAQ;AAC7D,QAAM,MAAM,WAAW,EAAE,WAAW,KAAK,CAAC;AAE1C,QAAM,SAAS,MAAM,WAAW,UAAU;AAC1C,QAAM,SAAQ,oBAAI,KAAK,GAAE,YAAY,EAAE,MAAM,GAAG,EAAE;AAClD,QAAM,OAAM,oBAAI,KAAK,GAAE,YAAY;AAEnC,QAAM,UAAyB,OAAO,IAAI,YAAU;AAAA,IAClD,IAAI,MAAM;AAAA,IACV,MAAM,MAAM;AAAA,IACZ,UAAU,MAAM;AAAA,IAChB,MAAM,MAAM;AAAA,IACZ,OAAO,MAAM;AAAA,IACb,WAAW,MAAM;AAAA,EACnB,EAAE;AAEF,QAAM,gBAAgB,OAAO,OAAO,SAAS,CAAC;AAC9C,QAAM,QAAQ,iBAAiB,cAAc,SAAS,QAClD,gBACA,YAAY,OAAO,KAAK,eAAe,aAAa,YAAY;AAEpE,MAAI,UAAU,eAAe;AAC3B,WAAO,KAAK,KAAK;AAAA,EACnB;AAEA,QAAM,UAAU,CAAC,GAAG,MAAM,SAAS,GAAG,OAAO;AAC7C,QAAM,aAAa,kBAAkB,MAAM,QAAQ,IAAI,WAAS,MAAM,IAAI,CAAC;AAC3E,QA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AgB,YAAY,MAAM;AAC1C;AAEA,SAAS,OAAO,OAAuB;AACrC,SAAO,WAAW,QAAQ,EAAE,OAAO,KAAK,EAAE,OAAO,KAAK;AACxD;","names":[]}
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
getMemoryStats,
|
|
6
6
|
searchIssues
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-JAKMZI5S.js";
|
|
8
8
|
import {
|
|
9
9
|
getGuardianState
|
|
10
10
|
} from "./chunk-UHMMANC2.js";
|
|
@@ -627,4 +627,4 @@ export {
|
|
|
627
627
|
getGoalManager,
|
|
628
628
|
clearGoalManagers
|
|
629
629
|
};
|
|
630
|
-
//# sourceMappingURL=chunk-
|
|
630
|
+
//# sourceMappingURL=chunk-T4THB2OR.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getGoalManager
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-T4THB2OR.js";
|
|
4
4
|
import {
|
|
5
5
|
getHypothesisEngine
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-LRQV7SGQ.js";
|
|
7
7
|
import {
|
|
8
8
|
getInsightStore
|
|
9
9
|
} from "./chunk-4YJ6KLGI.js";
|
|
@@ -11,18 +11,18 @@ import {
|
|
|
11
11
|
GotchaPredictor,
|
|
12
12
|
findCrossProjectPatterns,
|
|
13
13
|
recordToGlobalMemory
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-3DPVJQNM.js";
|
|
15
15
|
import {
|
|
16
16
|
isAIAvailable,
|
|
17
17
|
runAIAnalysis
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-JCU6REX7.js";
|
|
19
19
|
import {
|
|
20
20
|
autoResolveIssues,
|
|
21
21
|
getHistoricalInsights,
|
|
22
22
|
getIssueHash,
|
|
23
23
|
searchIssues,
|
|
24
24
|
storeIssues
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-JAKMZI5S.js";
|
|
26
26
|
import {
|
|
27
27
|
getGuardianState
|
|
28
28
|
} from "./chunk-UHMMANC2.js";
|
|
@@ -1910,7 +1910,7 @@ var GuardianAgent = class {
|
|
|
1910
1910
|
await this.guardianState.recordScan();
|
|
1911
1911
|
try {
|
|
1912
1912
|
const riskLevel = issues.filter((i) => i.severity === "critical").length > 0 ? "critical" : issues.filter((i) => i.severity === "serious").length >= 3 ? "high" : issues.length > 10 ? "medium" : "low";
|
|
1913
|
-
const { calculateAdaptiveScanFrequency } = await import("./goal-manager-
|
|
1913
|
+
const { calculateAdaptiveScanFrequency } = await import("./goal-manager-FAK7H4RR.js");
|
|
1914
1914
|
const result = await calculateAdaptiveScanFrequency(riskLevel);
|
|
1915
1915
|
await this.guardianState.setScanFrequency(result.frequencyMs);
|
|
1916
1916
|
} catch {
|
|
@@ -2143,4 +2143,4 @@ export {
|
|
|
2143
2143
|
GuardianAgent,
|
|
2144
2144
|
getGuardian
|
|
2145
2145
|
};
|
|
2146
|
-
//# sourceMappingURL=chunk-
|
|
2146
|
+
//# sourceMappingURL=chunk-T62V4H5O.js.map
|
package/dist/cli/main.js
CHANGED
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
isTrieInitialized,
|
|
35
35
|
perceiveCurrentChanges,
|
|
36
36
|
reasonAboutChangesHumanReadable
|
|
37
|
-
} from "../chunk-
|
|
37
|
+
} from "../chunk-6OUWNVLX.js";
|
|
38
38
|
import {
|
|
39
39
|
IncidentIndex
|
|
40
40
|
} from "../chunk-WHIQAGB7.js";
|
|
@@ -46,8 +46,8 @@ import {
|
|
|
46
46
|
listTrackedProjects,
|
|
47
47
|
searchGlobalPatterns,
|
|
48
48
|
updateGlobalMemoryMd
|
|
49
|
-
} from "../chunk-
|
|
50
|
-
import "../chunk-
|
|
49
|
+
} from "../chunk-3DPVJQNM.js";
|
|
50
|
+
import "../chunk-JCU6REX7.js";
|
|
51
51
|
import {
|
|
52
52
|
getDailyLogs,
|
|
53
53
|
getMemoryStats,
|
|
@@ -55,7 +55,7 @@ import {
|
|
|
55
55
|
markIssueResolved,
|
|
56
56
|
purgeIssues,
|
|
57
57
|
searchIssues
|
|
58
|
-
} from "../chunk-
|
|
58
|
+
} from "../chunk-JAKMZI5S.js";
|
|
59
59
|
import {
|
|
60
60
|
getGuardianState
|
|
61
61
|
} from "../chunk-UHMMANC2.js";
|
|
@@ -67,7 +67,7 @@ import "../chunk-Z4DN527J.js";
|
|
|
67
67
|
import {
|
|
68
68
|
ContextGraph
|
|
69
69
|
} from "../chunk-55CBWOEZ.js";
|
|
70
|
-
import "../chunk-
|
|
70
|
+
import "../chunk-PEJEYWVR.js";
|
|
71
71
|
import "../chunk-43X6JBEM.js";
|
|
72
72
|
import {
|
|
73
73
|
getTrieDirectory,
|
package/dist/cli/yolo-daemon.js
CHANGED
|
@@ -3,20 +3,20 @@ import {
|
|
|
3
3
|
InteractiveDashboard,
|
|
4
4
|
StreamingManager,
|
|
5
5
|
TrieScanTool
|
|
6
|
-
} from "../chunk-
|
|
7
|
-
import "../chunk-
|
|
6
|
+
} from "../chunk-LMFREFAP.js";
|
|
7
|
+
import "../chunk-T62V4H5O.js";
|
|
8
8
|
import "../chunk-DFPVUMVE.js";
|
|
9
|
-
import "../chunk-
|
|
10
|
-
import "../chunk-
|
|
9
|
+
import "../chunk-T4THB2OR.js";
|
|
10
|
+
import "../chunk-LRQV7SGQ.js";
|
|
11
11
|
import "../chunk-4YJ6KLGI.js";
|
|
12
12
|
import {
|
|
13
13
|
isTrieInitialized
|
|
14
|
-
} from "../chunk-
|
|
14
|
+
} from "../chunk-6OUWNVLX.js";
|
|
15
15
|
import "../chunk-WHIQAGB7.js";
|
|
16
16
|
import "../chunk-ZV2K6M7T.js";
|
|
17
|
-
import "../chunk-
|
|
18
|
-
import "../chunk-
|
|
19
|
-
import "../chunk-
|
|
17
|
+
import "../chunk-3DPVJQNM.js";
|
|
18
|
+
import "../chunk-JCU6REX7.js";
|
|
19
|
+
import "../chunk-JAKMZI5S.js";
|
|
20
20
|
import "../chunk-UHMMANC2.js";
|
|
21
21
|
import "../chunk-WS6OA7H6.js";
|
|
22
22
|
import "../chunk-F4NJ4CBP.js";
|
|
@@ -25,7 +25,7 @@ import "../chunk-6NLHFIYA.js";
|
|
|
25
25
|
import "../chunk-Z4DN527J.js";
|
|
26
26
|
import "../chunk-55CBWOEZ.js";
|
|
27
27
|
import "../chunk-VRLMTOB6.js";
|
|
28
|
-
import "../chunk-
|
|
28
|
+
import "../chunk-PEJEYWVR.js";
|
|
29
29
|
import "../chunk-43X6JBEM.js";
|
|
30
30
|
import {
|
|
31
31
|
getWorkingDirectory
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
saveKeyToKeychain,
|
|
10
10
|
setAPIKey,
|
|
11
11
|
tryGetClient
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-JCU6REX7.js";
|
|
13
13
|
import "./chunk-45Y5TLQZ.js";
|
|
14
14
|
import "./chunk-APMV77PU.js";
|
|
15
15
|
import "./chunk-DGUM43GV.js";
|
|
@@ -25,4 +25,4 @@ export {
|
|
|
25
25
|
setAPIKey,
|
|
26
26
|
tryGetClient
|
|
27
27
|
};
|
|
28
|
-
//# sourceMappingURL=client-
|
|
28
|
+
//# sourceMappingURL=client-OVI6TBX7.js.map
|
|
@@ -4,12 +4,12 @@ import {
|
|
|
4
4
|
calculateAdaptiveScanFrequency,
|
|
5
5
|
clearGoalManagers,
|
|
6
6
|
getGoalManager
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-T4THB2OR.js";
|
|
8
8
|
import "./chunk-4YJ6KLGI.js";
|
|
9
|
-
import "./chunk-
|
|
9
|
+
import "./chunk-JAKMZI5S.js";
|
|
10
10
|
import "./chunk-UHMMANC2.js";
|
|
11
11
|
import "./chunk-WS6OA7H6.js";
|
|
12
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-PEJEYWVR.js";
|
|
13
13
|
import "./chunk-43X6JBEM.js";
|
|
14
14
|
import "./chunk-45Y5TLQZ.js";
|
|
15
15
|
import "./chunk-APMV77PU.js";
|
|
@@ -21,4 +21,4 @@ export {
|
|
|
21
21
|
clearGoalManagers,
|
|
22
22
|
getGoalManager
|
|
23
23
|
};
|
|
24
|
-
//# sourceMappingURL=goal-manager-
|
|
24
|
+
//# sourceMappingURL=goal-manager-FAK7H4RR.js.map
|
|
@@ -55,14 +55,15 @@ async function recordGoalViolationFixed(goal, file, projectPath) {
|
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
|
-
async function checkFilesForGoalViolations(goals, projectPath, filesToCheck) {
|
|
59
|
-
const { isAIAvailable, runAIAnalysis } = await import("./client-
|
|
58
|
+
async function checkFilesForGoalViolations(goals, projectPath, filesToCheck, onProgress) {
|
|
59
|
+
const { isAIAvailable, runAIAnalysis } = await import("./client-OVI6TBX7.js");
|
|
60
60
|
const { CodebaseIndex } = await import("./codebase-index-CR6Q2HEI.js");
|
|
61
61
|
if (!isAIAvailable()) {
|
|
62
62
|
throw new Error("AI not available - ANTHROPIC_API_KEY not set");
|
|
63
63
|
}
|
|
64
64
|
const codebaseIndex = new CodebaseIndex(projectPath);
|
|
65
65
|
if (codebaseIndex.isEmpty()) {
|
|
66
|
+
onProgress?.("Building codebase index (first-time, may take a minute)...");
|
|
66
67
|
console.error("[Goal Check] Codebase index is empty - building index first...");
|
|
67
68
|
console.error("[Goal Check] This is a one-time operation. Future checks will be much faster.");
|
|
68
69
|
const { glob } = await import("glob");
|
|
@@ -81,6 +82,7 @@ async function checkFilesForGoalViolations(goals, projectPath, filesToCheck) {
|
|
|
81
82
|
const result = await codebaseIndex.indexFile(relativePath);
|
|
82
83
|
if (result) indexed++;
|
|
83
84
|
if (indexed % 50 === 0) {
|
|
85
|
+
onProgress?.(`Indexing files (${indexed}/${total})...`);
|
|
84
86
|
console.error(`[Goal Check] Indexed ${indexed}/${total} files...`);
|
|
85
87
|
}
|
|
86
88
|
}
|
|
@@ -148,6 +150,7 @@ async function checkFilesForGoalViolations(goals, projectPath, filesToCheck) {
|
|
|
148
150
|
}
|
|
149
151
|
}
|
|
150
152
|
}
|
|
153
|
+
onProgress?.(`Checking ${filesToScan.length} files for violations...`);
|
|
151
154
|
console.error(`[Goal Check] ${files.length} files total, ${filesToScan.length} need scanning, ${files.length - filesToScan.length} using cache`);
|
|
152
155
|
const allViolations = [...cachedViolations];
|
|
153
156
|
if (filesToScan.length === 0) {
|
|
@@ -155,7 +158,10 @@ async function checkFilesForGoalViolations(goals, projectPath, filesToCheck) {
|
|
|
155
158
|
return allViolations;
|
|
156
159
|
}
|
|
157
160
|
const BATCH_SIZE = 25;
|
|
161
|
+
const totalBatches = Math.ceil(filesToScan.length / BATCH_SIZE);
|
|
158
162
|
for (let batchStart = 0; batchStart < filesToScan.length; batchStart += BATCH_SIZE) {
|
|
163
|
+
const batchNum = Math.floor(batchStart / BATCH_SIZE) + 1;
|
|
164
|
+
onProgress?.(`Analyzing files (batch ${batchNum}/${totalBatches})...`);
|
|
159
165
|
const batchFiles = filesToScan.slice(batchStart, batchStart + BATCH_SIZE);
|
|
160
166
|
const { readFile } = await import("fs/promises");
|
|
161
167
|
const fileContents = await Promise.all(
|
|
@@ -288,4 +294,4 @@ export {
|
|
|
288
294
|
recordGoalViolationCaught,
|
|
289
295
|
recordGoalViolationFixed
|
|
290
296
|
};
|
|
291
|
-
//# sourceMappingURL=goal-validator-
|
|
297
|
+
//# sourceMappingURL=goal-validator-KLAK5TZN.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/guardian/goal-validator.ts"],"sourcesContent":["/**\n * Goal Validator - Helpers for goal tracking\n * \n * Goal detection is handled entirely by the AI watcher in watch.ts.\n * The AI (Anthropic) checks every changed file against user-defined goals,\n * using the Trie's priority scoring for cost control.\n * \n * This module provides:\n * - getActiveGoals: loads active goals for the AI prompt\n * - recordGoalViolationCaught: tracks when a violation is detected\n * - recordGoalViolationFixed: tracks when a violation is auto-fixed\n */\n\nimport type { Goal } from './guardian-state.js';\nimport { getGuardianState } from './guardian-state.js';\n\n/**\n * Get active goals for a project (used by the AI watcher)\n */\nexport async function getActiveGoals(projectPath: string): Promise<Goal[]> {\n const guardianState = getGuardianState(projectPath);\n await guardianState.load();\n return guardianState.getAllGoals().filter(g => g.status === 'active');\n}\n\nexport async function recordGoalViolationCaught(\n goal: Goal,\n file: string,\n projectPath: string\n): Promise<void> {\n const guardianState = getGuardianState(projectPath);\n await guardianState.load();\n \n const metadata = goal.metadata || {};\n const caughtCount = (metadata.caughtCount || 0) + 1;\n \n await guardianState.updateGoal(goal.id, {\n metadata: {\n ...metadata,\n caughtCount,\n lastCaught: new Date().toISOString(),\n lastCaughtFile: file,\n },\n });\n}\n\nexport async function recordGoalViolationFixed(\n goal: Goal,\n file: string,\n projectPath: string\n): Promise<void> {\n const guardianState = getGuardianState(projectPath);\n await guardianState.load();\n \n const metadata = goal.metadata || {};\n const caughtCount = (metadata.caughtCount || 0) + 1;\n const fixedCount = (metadata.fixedCount || 0) + 1;\n \n await guardianState.updateGoal(goal.id, {\n metadata: {\n ...metadata,\n caughtCount,\n fixedCount,\n lastFixed: new Date().toISOString(),\n lastFixedFile: file,\n },\n });\n \n if (goal.type === 'reduction') {\n const newValue = Math.max(0, goal.currentValue - 1);\n await guardianState.updateGoal(goal.id, {\n currentValue: newValue,\n });\n \n if (newValue <= goal.target) {\n await guardianState.updateGoal(goal.id, {\n status: 'achieved',\n achievedAt: new Date().toISOString(),\n });\n }\n }\n}\n\n/**\n * Manually check files against goals\n * Returns violations found\n * \n * NOW WITH CACHING: Uses CodebaseIndex to avoid re-scanning unchanged files\n */\nexport async function checkFilesForGoalViolations(\n goals: Goal[],\n projectPath: string,\n filesToCheck?: string[],\n onProgress?: (message: string) => void\n): Promise<Array<{ file: string; message: string; severity: 'critical' | 'warning' | 'info' }>> {\n // Import AI client and codebase index\n const { isAIAvailable, runAIAnalysis } = await import('../ai/client.js');\n const { CodebaseIndex } = await import('../context/codebase-index.js');\n \n if (!isAIAvailable()) {\n throw new Error('AI not available - ANTHROPIC_API_KEY not set');\n }\n \n // Initialize codebase index for caching\n const codebaseIndex = new CodebaseIndex(projectPath);\n \n // Check if index needs to be built\n if (codebaseIndex.isEmpty()) {\n onProgress?.('Building codebase index (first-time, may take a minute)...');\n console.error('[Goal Check] Codebase index is empty - building index first...');\n console.error('[Goal Check] This is a one-time operation. Future checks will be much faster.');\n \n // Auto-index the codebase\n const { glob } = await import('glob');\n const indexPattern = `${projectPath}/**/*.{ts,tsx,js,jsx,mjs,vue,svelte,astro,py,go,rs,java,c,cpp,h,hpp,cs,rb,php,css,scss,html}`;\n const indexFiles = await glob(indexPattern, {\n ignore: ['**/node_modules/**', '**/dist/**', '**/build/**', '**/.git/**', '**/.trie/**', '**/coverage/**'],\n nodir: true,\n });\n \n let indexed = 0;\n const total = Math.min(indexFiles.length, 500); // Cap at 500 files for initial index\n for (const filePath of indexFiles.slice(0, 500)) {\n let relativePath = filePath;\n if (filePath.toLowerCase().startsWith(projectPath.toLowerCase() + '/')) {\n relativePath = filePath.slice(projectPath.length + 1);\n }\n const result = await codebaseIndex.indexFile(relativePath);\n if (result) indexed++;\n \n // Progress indicator every 50 files\n if (indexed % 50 === 0) {\n onProgress?.(`Indexing files (${indexed}/${total})...`);\n console.error(`[Goal Check] Indexed ${indexed}/${total} files...`);\n }\n }\n \n await codebaseIndex.save();\n console.error(`[Goal Check] Index built: ${indexed} files indexed`);\n }\n \n // Get files to check\n let files: string[] = [];\n if (filesToCheck && filesToCheck.length > 0) {\n files = filesToCheck;\n } else {\n // MANUAL CHECK MODE: Scan ALL relevant files, not just recently modified\n const { glob } = await import('glob');\n \n const pattern = `${projectPath}/**/*.{ts,tsx,js,jsx,py,go,rs,java,c,cpp,h,hpp,cs,rb,php,css,scss,html,vue,svelte}`;\n const allFiles = await glob(pattern, {\n ignore: ['**/node_modules/**', '**/dist/**', '**/build/**', '**/.git/**', '**/.trie/**', '**/coverage/**'],\n nodir: true,\n });\n \n // For manual checks, use more files but still reasonable limit\n // Sort by modification time to prioritize recently modified\n const { stat } = await import('fs/promises');\n const withStats = await Promise.all(\n allFiles.map(async (f) => {\n try {\n const stats = await stat(f);\n return { file: f, mtime: stats.mtime.getTime() };\n } catch {\n return null;\n }\n })\n );\n \n files = withStats\n .filter((f): f is { file: string; mtime: number } => f !== null)\n .sort((a, b) => b.mtime - a.mtime)\n .slice(0, 100) // Check up to 100 files for manual scans\n .map(f => f.file);\n }\n \n if (files.length === 0) {\n throw new Error('No files found to check');\n }\n \n // Check which files need scanning vs can use cached results\n const filesToScan: string[] = [];\n const cachedViolations: Array<{ file: string; message: string; severity: 'critical' | 'warning' | 'info' }> = [];\n \n for (const filePath of files) {\n // Handle case-insensitive filesystems (macOS) and ensure we get a proper relative path\n let relativePath = filePath;\n if (filePath.toLowerCase().startsWith(projectPath.toLowerCase() + '/')) {\n relativePath = filePath.slice(projectPath.length + 1);\n } else if (filePath.startsWith('/')) {\n // Already absolute but doesn't match projectPath - skip this file\n // This can happen with stale cache entries from different projects\n continue;\n }\n const hasChanged = await codebaseIndex.hasChanged(relativePath);\n \n if (hasChanged) {\n // File changed or not indexed - needs scanning\n // Try to index the file first; skip if it doesn't exist\n const indexed = await codebaseIndex.indexFile(relativePath);\n if (indexed) {\n filesToScan.push(filePath);\n }\n // If indexFile returns null, file doesn't exist - skip it silently\n } else {\n // File unchanged - check cache for each goal\n for (const goal of goals) {\n const cached = codebaseIndex.getCachedViolations(relativePath, goal.id);\n if (cached && cached.length > 0) {\n const violation = cached[0];\n if (violation && violation.found) {\n cachedViolations.push({\n file: relativePath,\n message: `Goal \"${goal.description}\" violated in ${relativePath}: ${violation.details || 'Violation found'} [${violation.confidence || 90}% confidence] (cached)`,\n severity: 'warning',\n });\n }\n } else {\n // No cache for this goal - needs scanning\n if (!filesToScan.includes(filePath)) {\n filesToScan.push(filePath);\n }\n }\n }\n }\n }\n \n onProgress?.(`Checking ${filesToScan.length} files for violations...`);\n console.error(`[Goal Check] ${files.length} files total, ${filesToScan.length} need scanning, ${files.length - filesToScan.length} using cache`);\n \n // Process files that need scanning in batches\n const allViolations: Array<{ file: string; message: string; severity: 'critical' | 'warning' | 'info' }> = [...cachedViolations];\n \n if (filesToScan.length === 0) {\n // All results from cache!\n await codebaseIndex.save();\n return allViolations;\n }\n \n // For large file sets, process in batches to avoid token limits\n const BATCH_SIZE = 25; // Process 25 files at a time\n \n const totalBatches = Math.ceil(filesToScan.length / BATCH_SIZE);\n for (let batchStart = 0; batchStart < filesToScan.length; batchStart += BATCH_SIZE) {\n const batchNum = Math.floor(batchStart / BATCH_SIZE) + 1;\n onProgress?.(`Analyzing files (batch ${batchNum}/${totalBatches})...`);\n const batchFiles = filesToScan.slice(batchStart, batchStart + BATCH_SIZE);\n \n // Read file contents for this batch\n const { readFile } = await import('fs/promises');\n const fileContents = await Promise.all(\n batchFiles.map(async (filePath) => {\n try {\n const content = await readFile(filePath, 'utf-8');\n const relativePath = filePath.replace(projectPath + '/', '');\n return {\n path: relativePath,\n content: content.slice(0, 10000), // Increased limit for manual checks\n };\n } catch {\n return null;\n }\n })\n );\n \n const validFiles = fileContents.filter((f): f is { path: string; content: string } => f !== null);\n \n if (validFiles.length === 0) continue;\n \n // Build files block for AI\n const filesBlock = validFiles\n .map(f => `--- ${f.path} ---\\n${f.content}`)\n .join('\\n\\n');\n \n // Build goals section\n const goalsSection = `\nUSER-DEFINED GOALS (check EVERY file against ALL goals):\n${goals.map((g, i) => ` ${i + 1}. \"${g.description}\"`).join('\\n')}\n\nThis is a MANUAL CHECK requested by the user. Report ALL goal violations you find.\nFor emoji detection, look for Unicode emoji characters.\n`;\n \n // Run AI analysis\n const result = await runAIAnalysis({\n systemPrompt: `You are checking code for GOAL VIOLATIONS ONLY.\n${goalsSection}\nReply ONLY with a JSON array. Each element must have:\n- \"file\": relative file path\n- \"severity\": \"critical\" | \"major\" | \"minor\"\n- \"description\": 1-sentence description of the goal violation with specific examples\n- \"confidence\": number 0-100, how confident you are this is a violation\n- \"isGoalViolation\": true (always true for this scan)\n- \"goalIndex\": 0-based index of the violated goal\n\nCRITICAL DETECTION RULES:\n\n**EMOJIS**: Any Unicode emoji characters including but not limited to:\n- Emoticons: 😀😃😄😊🙂🙃😉😇🥰😍🤩😘😗☺️😚😙🥲\n- Symbols: ⚡️⚠️✅❌➜→←↑↓►◄▲▼★☆●○◆◇■□▪️▫️\n- Objects: 📊📈📉💻🖥️📱⌨️🖱️💾💿📀🔧🔨⚙️🛠️\n- Actions: 🔥💪👍👎👏🙌🤝✊👊🎯🎉🎊🚀\n- Weather: ☀️🌤️⛅☁️🌦️🌧️⛈️🌩️🌨️❄️\n- ALL OTHER Unicode emoji in ranges U+1F300-U+1F9FF, U+2600-U+27BF, U+2B00-U+2BFF\n\n**COLORS**: For \"purple\" or \"gradient\" goals, check:\n- CSS: purple, #purple, hsl(purple), rgb(purple), violet, #8B00FF, #9B59D6, etc.\n- Gradients: linear-gradient, radial-gradient, conic-gradient, background-image with gradients\n- Tailwind: purple-*, violet-*, bg-gradient-*\n- Styled components or CSS-in-JS with purple/violet/gradient\n\nBe EXTREMELY thorough. Check:\n1. String literals and template literals\n2. JSX/HTML content\n3. CSS files and style blocks\n4. Comments (emojis in comments still violate \"no emojis\")\n5. console.log statements\n6. Component names, variable names (if they contain emojis)\n\nIf a goal says \"no emojis\" and you see ANY emoji ANYWHERE in the file, report it.\nIf a goal says \"no console.log\" and you see console.log ANYWHERE, report it.\nIf a goal says \"no purple/gradient\" and you see ANY purple color or gradient, report it.\n\nIf no violations found, reply with: []\nOutput ONLY the JSON array, no markdown fences, no commentary.`,\n userPrompt: `Check these ${validFiles.length} files for goal violations:\\n\\n${filesBlock}`,\n maxTokens: 8192, // Increased for larger codebases\n temperature: 0.1,\n });\n \n // Parse response\n let issues: Array<{\n file: string;\n severity: 'critical' | 'major' | 'minor';\n description: string;\n confidence: number;\n isGoalViolation: boolean;\n goalIndex?: number;\n }> = [];\n \n try {\n const cleaned = result.content.replace(/```json?\\n?|\\n?```/g, '').trim();\n issues = JSON.parse(cleaned);\n if (!Array.isArray(issues)) issues = [];\n } catch {\n // Parse failed - continue to next batch\n continue;\n }\n \n // Convert to violation format and record\n for (const issue of issues) {\n if (!issue.isGoalViolation || issue.confidence < 50) continue;\n if (issue.goalIndex == null || issue.goalIndex < 0 || issue.goalIndex >= goals.length) continue;\n \n const goal = goals[issue.goalIndex]!;\n const severity = issue.severity === 'critical' ? 'critical' : 'warning';\n const message = `Goal \"${goal.description}\" violated in ${issue.file}: ${issue.description} [${issue.confidence}% confidence]`;\n \n allViolations.push({\n file: issue.file,\n message,\n severity,\n });\n \n // Cache the result in codebase index\n codebaseIndex.recordViolation(\n issue.file,\n goal.id,\n goal.description,\n true, // found\n issue.description,\n issue.confidence\n );\n \n // Record violation\n await recordGoalViolationCaught(goal, issue.file, projectPath);\n }\n \n // Also record \"no violation\" for scanned files\n for (const file of validFiles) {\n for (const goal of goals) {\n const hasViolation = issues.some(i => i.file === file.path && i.goalIndex === goals.indexOf(goal));\n if (!hasViolation) {\n codebaseIndex.recordViolation(\n file.path,\n goal.id,\n goal.description,\n false, // not found\n undefined,\n 100\n );\n }\n }\n }\n }\n \n // Save updated index\n await codebaseIndex.save();\n \n return allViolations;\n}\n"],"mappings":";;;;;;;;;;AAmBA,eAAsB,eAAe,aAAsC;AACzE,QAAM,gBAAgB,iBAAiB,WAAW;AAClD,QAAM,cAAc,KAAK;AACzB,SAAO,cAAc,YAAY,EAAE,OAAO,OAAK,EAAE,WAAW,QAAQ;AACtE;AAEA,eAAsB,0BACpB,MACA,MACA,aACe;AACf,QAAM,gBAAgB,iBAAiB,WAAW;AAClD,QAAM,cAAc,KAAK;AAEzB,QAAM,WAAW,KAAK,YAAY,CAAC;AACnC,QAAM,eAAe,SAAS,eAAe,KAAK;AAElD,QAAM,cAAc,WAAW,KAAK,IAAI;AAAA,IACtC,UAAU;AAAA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,QACL;AAAA;AAAA,QACA,MAAM;AAAA,QACN,MAAM;AAAA,MACR;AAGA,YAAM,0BAA0B,MAAM,MAAM,MAAM,WAAW;AAAA,IAC/D;AAGA,eAAW,QAAQ,YAAY;AAC7B,iBAAW,QAAQ,OAAO;AACxB,cAAM,eAAe,OAAO,KAAK,OAAK,EAAE,SAAS,KAAK,QAAQ,EAAE,cAAc,MAAM,QAAQ,IAAI,CAAC;AACjG,YAAI,CAAC,cAAc;AACjB,wBAAc;AAAA,YACZ,KAAK;AAAA,YACL,KAAK;AAAA,YACL,KAAK;AAAA,YACL;AAAA;AAAA,YACA;AAAA,YACA;AAAA,UACF;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAGA,QAAM,cAAc,KAAK;AAEzB,SAAO;AACT;","names":[]}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
GuardianAgent,
|
|
3
3
|
getGuardian
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-T62V4H5O.js";
|
|
5
|
+
import "./chunk-T4THB2OR.js";
|
|
6
|
+
import "./chunk-LRQV7SGQ.js";
|
|
7
7
|
import "./chunk-4YJ6KLGI.js";
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-3DPVJQNM.js";
|
|
9
|
+
import "./chunk-JCU6REX7.js";
|
|
10
|
+
import "./chunk-JAKMZI5S.js";
|
|
11
11
|
import "./chunk-UHMMANC2.js";
|
|
12
12
|
import "./chunk-WS6OA7H6.js";
|
|
13
13
|
import "./chunk-F4NJ4CBP.js";
|
|
@@ -15,7 +15,7 @@ import "./chunk-IXO4G4D3.js";
|
|
|
15
15
|
import "./chunk-6NLHFIYA.js";
|
|
16
16
|
import "./chunk-Z4DN527J.js";
|
|
17
17
|
import "./chunk-55CBWOEZ.js";
|
|
18
|
-
import "./chunk-
|
|
18
|
+
import "./chunk-PEJEYWVR.js";
|
|
19
19
|
import "./chunk-43X6JBEM.js";
|
|
20
20
|
import "./chunk-45Y5TLQZ.js";
|
|
21
21
|
import "./chunk-APMV77PU.js";
|
|
@@ -24,4 +24,4 @@ export {
|
|
|
24
24
|
GuardianAgent,
|
|
25
25
|
getGuardian
|
|
26
26
|
};
|
|
27
|
-
//# sourceMappingURL=guardian-agent-
|
|
27
|
+
//# sourceMappingURL=guardian-agent-3EUJUAJ2.js.map
|
|
@@ -3,12 +3,12 @@ import {
|
|
|
3
3
|
clearHypothesisEngines,
|
|
4
4
|
gatherEvidenceForHypothesis,
|
|
5
5
|
getHypothesisEngine
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-LRQV7SGQ.js";
|
|
7
7
|
import "./chunk-4YJ6KLGI.js";
|
|
8
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-JAKMZI5S.js";
|
|
9
9
|
import "./chunk-UHMMANC2.js";
|
|
10
10
|
import "./chunk-WS6OA7H6.js";
|
|
11
|
-
import "./chunk-
|
|
11
|
+
import "./chunk-PEJEYWVR.js";
|
|
12
12
|
import "./chunk-43X6JBEM.js";
|
|
13
13
|
import "./chunk-45Y5TLQZ.js";
|
|
14
14
|
import "./chunk-APMV77PU.js";
|
|
@@ -19,4 +19,4 @@ export {
|
|
|
19
19
|
gatherEvidenceForHypothesis,
|
|
20
20
|
getHypothesisEngine
|
|
21
21
|
};
|
|
22
|
-
//# sourceMappingURL=hypothesis-
|
|
22
|
+
//# sourceMappingURL=hypothesis-I276JIDW.js.map
|
package/dist/index.js
CHANGED
|
@@ -41,11 +41,11 @@ import {
|
|
|
41
41
|
getPrompt,
|
|
42
42
|
getSystemPrompt,
|
|
43
43
|
handleCheckpointTool
|
|
44
|
-
} from "./chunk-
|
|
45
|
-
import "./chunk-
|
|
44
|
+
} from "./chunk-LMFREFAP.js";
|
|
45
|
+
import "./chunk-T62V4H5O.js";
|
|
46
46
|
import "./chunk-DFPVUMVE.js";
|
|
47
|
-
import "./chunk-
|
|
48
|
-
import "./chunk-
|
|
47
|
+
import "./chunk-T4THB2OR.js";
|
|
48
|
+
import "./chunk-LRQV7SGQ.js";
|
|
49
49
|
import "./chunk-4YJ6KLGI.js";
|
|
50
50
|
import {
|
|
51
51
|
exportToJson,
|
|
@@ -55,7 +55,7 @@ import {
|
|
|
55
55
|
importFromJson,
|
|
56
56
|
isTrieInitialized,
|
|
57
57
|
runShellCommandSync
|
|
58
|
-
} from "./chunk-
|
|
58
|
+
} from "./chunk-6OUWNVLX.js";
|
|
59
59
|
import "./chunk-WHIQAGB7.js";
|
|
60
60
|
import "./chunk-ZV2K6M7T.js";
|
|
61
61
|
import {
|
|
@@ -63,11 +63,11 @@ import {
|
|
|
63
63
|
getGlobalMemoryStats,
|
|
64
64
|
listTrackedProjects,
|
|
65
65
|
searchGlobalPatterns
|
|
66
|
-
} from "./chunk-
|
|
66
|
+
} from "./chunk-3DPVJQNM.js";
|
|
67
67
|
import {
|
|
68
68
|
isAIAvailable,
|
|
69
69
|
runAIAnalysis
|
|
70
|
-
} from "./chunk-
|
|
70
|
+
} from "./chunk-JCU6REX7.js";
|
|
71
71
|
import {
|
|
72
72
|
findSimilarIssues,
|
|
73
73
|
getMemoryStats,
|
|
@@ -75,7 +75,7 @@ import {
|
|
|
75
75
|
markIssueResolved,
|
|
76
76
|
purgeIssues,
|
|
77
77
|
searchIssues
|
|
78
|
-
} from "./chunk-
|
|
78
|
+
} from "./chunk-JAKMZI5S.js";
|
|
79
79
|
import "./chunk-UHMMANC2.js";
|
|
80
80
|
import "./chunk-WS6OA7H6.js";
|
|
81
81
|
import "./chunk-F4NJ4CBP.js";
|
|
@@ -93,7 +93,7 @@ import {
|
|
|
93
93
|
import {
|
|
94
94
|
getOutputManager
|
|
95
95
|
} from "./chunk-VRLMTOB6.js";
|
|
96
|
-
import "./chunk-
|
|
96
|
+
import "./chunk-PEJEYWVR.js";
|
|
97
97
|
import "./chunk-43X6JBEM.js";
|
|
98
98
|
import {
|
|
99
99
|
getTrieDirectory,
|
|
@@ -1465,7 +1465,7 @@ ${f.content.slice(0, 1e3)}`
|
|
|
1465
1465
|
async checkAndGenerateHypotheses(projectPath) {
|
|
1466
1466
|
if (!isAIAvailable()) return;
|
|
1467
1467
|
try {
|
|
1468
|
-
const { getHypothesisEngine } = await import("./hypothesis-
|
|
1468
|
+
const { getHypothesisEngine } = await import("./hypothesis-I276JIDW.js");
|
|
1469
1469
|
const { getOutputManager: getOutputManager2 } = await import("./output-manager-BOTMXSND.js");
|
|
1470
1470
|
const hypothesisEngine = getHypothesisEngine(projectPath);
|
|
1471
1471
|
const recentIssues = Array.from(this.state.issueCache.values()).flat();
|
|
@@ -1674,8 +1674,8 @@ ${f.content.slice(0, 1e3)}`
|
|
|
1674
1674
|
this.state.lastAutoScan = now;
|
|
1675
1675
|
try {
|
|
1676
1676
|
const graph = new ContextGraph(projectPath);
|
|
1677
|
-
const { getActiveGoals, recordGoalViolationCaught } = await import("./goal-validator-
|
|
1678
|
-
const { appendIssuesToLedger } = await import("./ledger-
|
|
1677
|
+
const { getActiveGoals, recordGoalViolationCaught } = await import("./goal-validator-KLAK5TZN.js");
|
|
1678
|
+
const { appendIssuesToLedger } = await import("./ledger-WKVJWHBX.js");
|
|
1679
1679
|
console.debug("[AI Watcher] Loading active goals...");
|
|
1680
1680
|
const activeGoals = await getActiveGoals(projectPath);
|
|
1681
1681
|
const hasGoals = activeGoals.length > 0;
|
|
@@ -1929,7 +1929,7 @@ ${filesBlock}`,
|
|
|
1929
1929
|
const projectPath = this.watchedDirectory || getWorkingDirectory(void 0, true);
|
|
1930
1930
|
console.debug("[Initial Hypothesis] Starting initial hypothesis generation", { projectPath });
|
|
1931
1931
|
try {
|
|
1932
|
-
const { getHypothesisEngine } = await import("./hypothesis-
|
|
1932
|
+
const { getHypothesisEngine } = await import("./hypothesis-I276JIDW.js");
|
|
1933
1933
|
const hypothesisEngine = getHypothesisEngine(projectPath);
|
|
1934
1934
|
console.debug("[Initial Hypothesis] Running AI-powered hypothesis generation...");
|
|
1935
1935
|
const generated = await hypothesisEngine.generateHypothesesWithAI({
|
|
@@ -1987,7 +1987,7 @@ ${filesBlock}`,
|
|
|
1987
1987
|
const projectPath = this.watchedDirectory || getWorkingDirectory(void 0, true);
|
|
1988
1988
|
console.debug("[Initial Scan] Starting initial goal compliance scan", { projectPath });
|
|
1989
1989
|
try {
|
|
1990
|
-
const { getActiveGoals, recordGoalViolationCaught } = await import("./goal-validator-
|
|
1990
|
+
const { getActiveGoals, recordGoalViolationCaught } = await import("./goal-validator-KLAK5TZN.js");
|
|
1991
1991
|
const activeGoals = await getActiveGoals(projectPath);
|
|
1992
1992
|
console.debug("[Initial Scan] Loaded goals for initial scan:", {
|
|
1993
1993
|
goalCount: activeGoals.length,
|
|
@@ -2089,7 +2089,7 @@ ${filesBlock}`,
|
|
|
2089
2089
|
} catch {
|
|
2090
2090
|
return;
|
|
2091
2091
|
}
|
|
2092
|
-
const { appendIssuesToLedger } = await import("./ledger-
|
|
2092
|
+
const { appendIssuesToLedger } = await import("./ledger-WKVJWHBX.js");
|
|
2093
2093
|
const issuesForLedger = [];
|
|
2094
2094
|
let violationsFound = 0;
|
|
2095
2095
|
for (const issue of issues) {
|
|
@@ -2212,7 +2212,7 @@ Use \`trie_watch start\` to begin autonomous scanning.`
|
|
|
2212
2212
|
).join("\n");
|
|
2213
2213
|
let agencyStatus = "";
|
|
2214
2214
|
try {
|
|
2215
|
-
const { getGuardian } = await import("./guardian-agent-
|
|
2215
|
+
const { getGuardian } = await import("./guardian-agent-3EUJUAJ2.js");
|
|
2216
2216
|
const trieAgent = getGuardian(this.watchedDirectory || getWorkingDirectory(void 0, true));
|
|
2217
2217
|
await trieAgent.initialize();
|
|
2218
2218
|
const status = await trieAgent.getAgencyStatus();
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
appendIssuesToLedger,
|
|
3
3
|
computeMerkleRoot,
|
|
4
|
+
getLedgerBlocks,
|
|
4
5
|
verifyLedger
|
|
5
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-PEJEYWVR.js";
|
|
6
7
|
import "./chunk-43X6JBEM.js";
|
|
7
8
|
import "./chunk-45Y5TLQZ.js";
|
|
8
9
|
import "./chunk-APMV77PU.js";
|
|
@@ -10,6 +11,7 @@ import "./chunk-DGUM43GV.js";
|
|
|
10
11
|
export {
|
|
11
12
|
appendIssuesToLedger,
|
|
12
13
|
computeMerkleRoot,
|
|
14
|
+
getLedgerBlocks,
|
|
13
15
|
verifyLedger
|
|
14
16
|
};
|
|
15
|
-
//# sourceMappingURL=ledger-
|
|
17
|
+
//# sourceMappingURL=ledger-WKVJWHBX.js.map
|