nodebench-mcp 2.30.0 → 2.31.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/README.md +7 -0
- package/dist/db.js +69 -0
- package/dist/db.js.map +1 -1
- package/dist/engine/contextBridge.d.ts +67 -0
- package/dist/engine/contextBridge.js +392 -0
- package/dist/engine/contextBridge.js.map +1 -0
- package/dist/engine/server.js +77 -0
- package/dist/engine/server.js.map +1 -1
- package/dist/engine/session.d.ts +2 -0
- package/dist/engine/session.js.map +1 -1
- package/dist/index.js +83 -6
- package/dist/index.js.map +1 -1
- package/dist/sandboxApi.d.ts +20 -0
- package/dist/sandboxApi.js +99 -0
- package/dist/sandboxApi.js.map +1 -0
- package/dist/tools/contextSandboxTools.d.ts +15 -0
- package/dist/tools/contextSandboxTools.js +469 -0
- package/dist/tools/contextSandboxTools.js.map +1 -0
- package/dist/tools/contextTools.d.ts +11 -0
- package/dist/tools/contextTools.js +175 -0
- package/dist/tools/contextTools.js.map +1 -0
- package/dist/tools/progressiveDiscoveryTools.js +3 -3
- package/dist/tools/progressiveDiscoveryTools.js.map +1 -1
- package/dist/tools/researchOptimizerTools.d.ts +17 -0
- package/dist/tools/researchOptimizerTools.js +454 -0
- package/dist/tools/researchOptimizerTools.js.map +1 -0
- package/dist/tools/scraplingTools.d.ts +15 -0
- package/dist/tools/scraplingTools.js +278 -0
- package/dist/tools/scraplingTools.js.map +1 -0
- package/dist/tools/thompsonProtocolTools.d.ts +73 -0
- package/dist/tools/thompsonProtocolTools.js +916 -0
- package/dist/tools/thompsonProtocolTools.js.map +1 -0
- package/dist/tools/toolRegistry.js +435 -0
- package/dist/tools/toolRegistry.js.map +1 -1
- package/dist/toolsetRegistry.js +10 -0
- package/dist/toolsetRegistry.js.map +1 -1
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# NodeBench MCP
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/nodebench-mcp)
|
|
4
|
+
[](https://www.npmjs.com/package/nodebench-mcp)
|
|
5
|
+
[](https://opensource.org/licenses/MIT)
|
|
6
|
+
[](https://github.com/HomenShum/nodebench-ai)
|
|
7
|
+
[](https://modelcontextprotocol.io)
|
|
8
|
+
[](https://www.npmjs.com/package/nodebench-mcp)
|
|
9
|
+
|
|
3
10
|
**Make AI agents catch the bugs they normally ship.**
|
|
4
11
|
|
|
5
12
|
One command gives your agent structured research, risk assessment, 3-layer testing, quality gates, and a persistent knowledge base — so every fix is thorough and every insight compounds into future work.
|
package/dist/db.js
CHANGED
|
@@ -652,6 +652,75 @@ CREATE TABLE IF NOT EXISTS skill_sync_history (
|
|
|
652
652
|
CREATE INDEX IF NOT EXISTS idx_skills_skill_id ON skills(skill_id);
|
|
653
653
|
CREATE INDEX IF NOT EXISTS idx_skills_status ON skills(status);
|
|
654
654
|
CREATE INDEX IF NOT EXISTS idx_skill_sync_history_skill ON skill_sync_history(skill_id);
|
|
655
|
+
|
|
656
|
+
-- ═══════════════════════════════════════════
|
|
657
|
+
-- ENGINE CONTEXT PERSISTENCE
|
|
658
|
+
-- Conformance reports, workflow runs, content archive
|
|
659
|
+
-- ═══════════════════════════════════════════
|
|
660
|
+
|
|
661
|
+
CREATE TABLE IF NOT EXISTS engine_reports (
|
|
662
|
+
id TEXT PRIMARY KEY,
|
|
663
|
+
session_id TEXT NOT NULL,
|
|
664
|
+
workflow TEXT NOT NULL,
|
|
665
|
+
preset TEXT NOT NULL,
|
|
666
|
+
score REAL NOT NULL,
|
|
667
|
+
grade TEXT NOT NULL,
|
|
668
|
+
breakdown TEXT NOT NULL,
|
|
669
|
+
summary TEXT NOT NULL,
|
|
670
|
+
total_steps INTEGER NOT NULL,
|
|
671
|
+
successful_steps INTEGER NOT NULL,
|
|
672
|
+
failed_steps INTEGER NOT NULL,
|
|
673
|
+
total_duration_ms INTEGER NOT NULL,
|
|
674
|
+
generated_at TEXT NOT NULL DEFAULT (datetime('now'))
|
|
675
|
+
);
|
|
676
|
+
|
|
677
|
+
CREATE INDEX IF NOT EXISTS idx_engine_reports_workflow ON engine_reports(workflow);
|
|
678
|
+
CREATE INDEX IF NOT EXISTS idx_engine_reports_generated ON engine_reports(generated_at);
|
|
679
|
+
|
|
680
|
+
CREATE TABLE IF NOT EXISTS engine_workflow_runs (
|
|
681
|
+
id TEXT PRIMARY KEY,
|
|
682
|
+
session_id TEXT NOT NULL,
|
|
683
|
+
workflow TEXT NOT NULL,
|
|
684
|
+
preset TEXT NOT NULL,
|
|
685
|
+
step_count INTEGER NOT NULL,
|
|
686
|
+
success_count INTEGER NOT NULL DEFAULT 0,
|
|
687
|
+
failed_count INTEGER NOT NULL DEFAULT 0,
|
|
688
|
+
duration_ms INTEGER NOT NULL DEFAULT 0,
|
|
689
|
+
context_loaded TEXT,
|
|
690
|
+
outcome_summary TEXT,
|
|
691
|
+
created_at TEXT NOT NULL DEFAULT (datetime('now'))
|
|
692
|
+
);
|
|
693
|
+
|
|
694
|
+
CREATE INDEX IF NOT EXISTS idx_engine_runs_workflow ON engine_workflow_runs(workflow);
|
|
695
|
+
CREATE INDEX IF NOT EXISTS idx_engine_runs_created ON engine_workflow_runs(created_at);
|
|
696
|
+
|
|
697
|
+
CREATE TABLE IF NOT EXISTS content_archive (
|
|
698
|
+
id TEXT PRIMARY KEY,
|
|
699
|
+
title TEXT NOT NULL,
|
|
700
|
+
content_type TEXT NOT NULL,
|
|
701
|
+
digest TEXT,
|
|
702
|
+
full_content TEXT,
|
|
703
|
+
themes TEXT,
|
|
704
|
+
workflow TEXT,
|
|
705
|
+
published_at TEXT NOT NULL DEFAULT (datetime('now')),
|
|
706
|
+
engagement TEXT
|
|
707
|
+
);
|
|
708
|
+
|
|
709
|
+
CREATE INDEX IF NOT EXISTS idx_content_archive_type ON content_archive(content_type);
|
|
710
|
+
CREATE INDEX IF NOT EXISTS idx_content_archive_published ON content_archive(published_at);
|
|
711
|
+
|
|
712
|
+
CREATE VIRTUAL TABLE IF NOT EXISTS content_archive_fts USING fts5(
|
|
713
|
+
title,
|
|
714
|
+
digest,
|
|
715
|
+
themes,
|
|
716
|
+
content='content_archive',
|
|
717
|
+
content_rowid='rowid'
|
|
718
|
+
);
|
|
719
|
+
|
|
720
|
+
CREATE TRIGGER IF NOT EXISTS content_archive_fts_insert AFTER INSERT ON content_archive BEGIN
|
|
721
|
+
INSERT INTO content_archive_fts(rowid, title, digest, themes)
|
|
722
|
+
VALUES (new.rowid, new.title, COALESCE(new.digest, ''), COALESCE(new.themes, ''));
|
|
723
|
+
END;
|
|
655
724
|
`;
|
|
656
725
|
export function getDb() {
|
|
657
726
|
if (_db)
|
package/dist/db.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"db.js","sourceRoot":"","sources":["../src/db.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEpC,IAAI,GAAG,GAA6B,IAAI,CAAC;AAEzC,MAAM,UAAU,GAAG
|
|
1
|
+
{"version":3,"file":"db.js","sourceRoot":"","sources":["../src/db.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEpC,IAAI,GAAG,GAA6B,IAAI,CAAC;AAEzC,MAAM,UAAU,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AO,CAAC,8CAA8C,CAAC,CAAC,GAAG,EAAS,CAAC;QACvF,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC;YAC9B,GAAG,CAAC,IAAI,CAAC,sEAAsE,CAAC,CAAC;QACnF,CAAC;QACD,MAAM,CAAC,GAAG,GAAG,CAAC,OAAO,CAAC,gCAAgC,CAAC,CAAC,GAAG,EAAS,CAAC;QACrE,MAAM,IAAI,GAAG,GAAG,CAAC,OAAO,CAAC,oCAAoC,CAAC,CAAC,GAAG,EAAS,CAAC;QAC5E,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC;YAC5B,GAAG,CAAC,IAAI,CAAC,kDAAkD,CAAC,CAAC;QAC/D,CAAC;IACH,CAAC;IAAC,MAAM,CAAC,CAAC,sEAAsE,CAAC,CAAC;IAElF,OAAO,GAAG,CAAC;AACb,CAAC;AAED,MAAM,UAAU,UAAU;IACxB,MAAM,EAAE,GAAG,KAAK,EAAE,CAAC;IACnB,MAAM,GAAG,GAAG,EAAE,CAAC,OAAO,CAAC,2CAA2C,CAAC,CAAC,GAAG,EAAS,CAAC;IACjF,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;AACrB,CAAC;AAED,MAAM,UAAU,KAAK,CAAC,MAAc;IAClC,OAAO,GAAG,MAAM,IAAI,IAAI,CAAC,GAAG,EAAE,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC;AAC9E,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Engine Context Bridge
|
|
3
|
+
*
|
|
4
|
+
* Connects the engine's ephemeral sessions to SQLite persistent storage.
|
|
5
|
+
* Loads accumulated context before workflow execution and persists outcomes after.
|
|
6
|
+
*/
|
|
7
|
+
import type { ConformanceReport } from "./conformance.js";
|
|
8
|
+
import type { ToolCallRecord } from "./session.js";
|
|
9
|
+
export interface SessionContext {
|
|
10
|
+
recentRuns: Array<{
|
|
11
|
+
workflow: string;
|
|
12
|
+
score: number;
|
|
13
|
+
grade: string;
|
|
14
|
+
durationMs: number;
|
|
15
|
+
createdAt: string;
|
|
16
|
+
}>;
|
|
17
|
+
relevantLearnings: Array<{
|
|
18
|
+
key: string;
|
|
19
|
+
content: string;
|
|
20
|
+
category: string;
|
|
21
|
+
}>;
|
|
22
|
+
conformanceTrend: {
|
|
23
|
+
direction: "improving" | "stable" | "regressing" | "insufficient_data";
|
|
24
|
+
avgScore: number;
|
|
25
|
+
runCount: number;
|
|
26
|
+
};
|
|
27
|
+
recentContentThemes: string[];
|
|
28
|
+
openGapCount: number;
|
|
29
|
+
}
|
|
30
|
+
export interface ContextHealth {
|
|
31
|
+
learningsCount: number;
|
|
32
|
+
recentRunScores: number[];
|
|
33
|
+
trendDirection: string;
|
|
34
|
+
contentArchiveSize: number;
|
|
35
|
+
daysSinceLastLearning: number | null;
|
|
36
|
+
workflowCoverage: Record<string, number>;
|
|
37
|
+
}
|
|
38
|
+
export declare function loadSessionContext(workflow: string, _preset: string): SessionContext;
|
|
39
|
+
export declare function persistSessionOutcome(sessionId: string, report: ConformanceReport, workflow: string, preset: string, callHistory?: ToolCallRecord[]): void;
|
|
40
|
+
export declare function getContextHealth(): ContextHealth;
|
|
41
|
+
export declare function archiveContent(title: string, contentType: string, digest: string, themes: string[], workflow?: string, fullContent?: string): void;
|
|
42
|
+
export declare function searchContentArchive(query: string, contentType?: string, limit?: number): Array<{
|
|
43
|
+
id: string;
|
|
44
|
+
title: string;
|
|
45
|
+
contentType: string;
|
|
46
|
+
digest: string;
|
|
47
|
+
themes: string[];
|
|
48
|
+
publishedAt: string;
|
|
49
|
+
}>;
|
|
50
|
+
export declare function getWorkflowHistory(workflow: string, limit?: number): Array<{
|
|
51
|
+
sessionId: string;
|
|
52
|
+
workflow: string;
|
|
53
|
+
preset: string;
|
|
54
|
+
score: number;
|
|
55
|
+
grade: string;
|
|
56
|
+
durationMs: number;
|
|
57
|
+
stepCount: number;
|
|
58
|
+
successCount: number;
|
|
59
|
+
failedCount: number;
|
|
60
|
+
createdAt: string;
|
|
61
|
+
}>;
|
|
62
|
+
export declare function searchLearnings(query: string, limit?: number): Array<{
|
|
63
|
+
key: string;
|
|
64
|
+
content: string;
|
|
65
|
+
category: string;
|
|
66
|
+
createdAt: string;
|
|
67
|
+
}>;
|
|
@@ -0,0 +1,392 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Engine Context Bridge
|
|
3
|
+
*
|
|
4
|
+
* Connects the engine's ephemeral sessions to SQLite persistent storage.
|
|
5
|
+
* Loads accumulated context before workflow execution and persists outcomes after.
|
|
6
|
+
*/
|
|
7
|
+
import { getDb, genId } from "../db.js";
|
|
8
|
+
// ── Load Context ──────────────────────────────────────────────────────
|
|
9
|
+
export function loadSessionContext(workflow, _preset) {
|
|
10
|
+
const db = getDb();
|
|
11
|
+
// Recent runs of the same workflow
|
|
12
|
+
let recentRuns = [];
|
|
13
|
+
try {
|
|
14
|
+
const rows = db.prepare(`
|
|
15
|
+
SELECT workflow, score, grade, duration_ms, created_at
|
|
16
|
+
FROM engine_workflow_runs
|
|
17
|
+
WHERE workflow = ?
|
|
18
|
+
ORDER BY created_at DESC
|
|
19
|
+
LIMIT 5
|
|
20
|
+
`).all(workflow);
|
|
21
|
+
recentRuns = rows.map((r) => ({
|
|
22
|
+
workflow: r.workflow,
|
|
23
|
+
score: r.score ?? 0,
|
|
24
|
+
grade: r.grade ?? "F",
|
|
25
|
+
durationMs: r.duration_ms,
|
|
26
|
+
createdAt: r.created_at,
|
|
27
|
+
}));
|
|
28
|
+
}
|
|
29
|
+
catch { /* table may not exist yet */ }
|
|
30
|
+
// Enrich with scores from engine_reports if workflow_runs doesn't have them
|
|
31
|
+
if (recentRuns.length > 0 && recentRuns[0].score === 0) {
|
|
32
|
+
try {
|
|
33
|
+
for (const run of recentRuns) {
|
|
34
|
+
const report = db.prepare(`
|
|
35
|
+
SELECT score, grade FROM engine_reports
|
|
36
|
+
WHERE session_id = (
|
|
37
|
+
SELECT session_id FROM engine_workflow_runs
|
|
38
|
+
WHERE workflow = ? AND created_at = ?
|
|
39
|
+
LIMIT 1
|
|
40
|
+
)
|
|
41
|
+
ORDER BY generated_at DESC LIMIT 1
|
|
42
|
+
`).get(run.workflow, run.createdAt);
|
|
43
|
+
if (report) {
|
|
44
|
+
run.score = report.score;
|
|
45
|
+
run.grade = report.grade;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
catch { /* best effort */ }
|
|
50
|
+
}
|
|
51
|
+
// Relevant learnings via FTS5
|
|
52
|
+
let relevantLearnings = [];
|
|
53
|
+
try {
|
|
54
|
+
const searchTerms = workflow.replace(/_/g, " ");
|
|
55
|
+
const rows = db.prepare(`
|
|
56
|
+
SELECT l.key, l.content, l.category
|
|
57
|
+
FROM learnings_fts fts
|
|
58
|
+
JOIN learnings l ON l.id = fts.rowid
|
|
59
|
+
WHERE learnings_fts MATCH ?
|
|
60
|
+
ORDER BY rank
|
|
61
|
+
LIMIT 10
|
|
62
|
+
`).all(searchTerms);
|
|
63
|
+
relevantLearnings = rows.map((r) => ({
|
|
64
|
+
key: r.key,
|
|
65
|
+
content: r.content,
|
|
66
|
+
category: r.category,
|
|
67
|
+
}));
|
|
68
|
+
}
|
|
69
|
+
catch {
|
|
70
|
+
// FTS5 syntax error or table missing — try LIKE fallback
|
|
71
|
+
try {
|
|
72
|
+
const pattern = `%${workflow.replace(/_/g, "%")}%`;
|
|
73
|
+
const rows = db.prepare(`
|
|
74
|
+
SELECT key, content, category FROM learnings
|
|
75
|
+
WHERE content LIKE ? OR key LIKE ? OR category LIKE ?
|
|
76
|
+
ORDER BY created_at DESC LIMIT 10
|
|
77
|
+
`).all(pattern, pattern, pattern);
|
|
78
|
+
relevantLearnings = rows.map((r) => ({
|
|
79
|
+
key: r.key,
|
|
80
|
+
content: r.content,
|
|
81
|
+
category: r.category,
|
|
82
|
+
}));
|
|
83
|
+
}
|
|
84
|
+
catch { /* no learnings available */ }
|
|
85
|
+
}
|
|
86
|
+
// Conformance trend from engine_reports
|
|
87
|
+
let conformanceTrend = {
|
|
88
|
+
direction: "insufficient_data",
|
|
89
|
+
avgScore: 0,
|
|
90
|
+
runCount: 0,
|
|
91
|
+
};
|
|
92
|
+
try {
|
|
93
|
+
const rows = db.prepare(`
|
|
94
|
+
SELECT score FROM engine_reports
|
|
95
|
+
WHERE workflow = ?
|
|
96
|
+
ORDER BY generated_at DESC
|
|
97
|
+
LIMIT 10
|
|
98
|
+
`).all(workflow);
|
|
99
|
+
if (rows.length >= 3) {
|
|
100
|
+
const scores = rows.map((r) => r.score);
|
|
101
|
+
const avgScore = scores.reduce((a, b) => a + b, 0) / scores.length;
|
|
102
|
+
const recentHalf = scores.slice(0, Math.ceil(scores.length / 2));
|
|
103
|
+
const olderHalf = scores.slice(Math.ceil(scores.length / 2));
|
|
104
|
+
const recentAvg = recentHalf.reduce((a, b) => a + b, 0) / recentHalf.length;
|
|
105
|
+
const olderAvg = olderHalf.reduce((a, b) => a + b, 0) / olderHalf.length;
|
|
106
|
+
const delta = recentAvg - olderAvg;
|
|
107
|
+
conformanceTrend = {
|
|
108
|
+
direction: delta > 5 ? "improving" : delta < -5 ? "regressing" : "stable",
|
|
109
|
+
avgScore: Math.round(avgScore * 10) / 10,
|
|
110
|
+
runCount: rows.length,
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
else if (rows.length > 0) {
|
|
114
|
+
const avgScore = rows.reduce((a, r) => a + r.score, 0) / rows.length;
|
|
115
|
+
conformanceTrend = {
|
|
116
|
+
direction: "insufficient_data",
|
|
117
|
+
avgScore: Math.round(avgScore * 10) / 10,
|
|
118
|
+
runCount: rows.length,
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
catch { /* no reports yet */ }
|
|
123
|
+
// Recent content themes
|
|
124
|
+
let recentContentThemes = [];
|
|
125
|
+
try {
|
|
126
|
+
const rows = db.prepare(`
|
|
127
|
+
SELECT themes FROM content_archive
|
|
128
|
+
ORDER BY published_at DESC
|
|
129
|
+
LIMIT 20
|
|
130
|
+
`).all();
|
|
131
|
+
const themeSet = new Set();
|
|
132
|
+
for (const row of rows) {
|
|
133
|
+
if (row.themes) {
|
|
134
|
+
try {
|
|
135
|
+
const parsed = JSON.parse(row.themes);
|
|
136
|
+
if (Array.isArray(parsed))
|
|
137
|
+
parsed.forEach((t) => themeSet.add(t));
|
|
138
|
+
}
|
|
139
|
+
catch { /* skip malformed */ }
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
recentContentThemes = Array.from(themeSet).slice(0, 30);
|
|
143
|
+
}
|
|
144
|
+
catch { /* no content archive */ }
|
|
145
|
+
// Open gap count
|
|
146
|
+
let openGapCount = 0;
|
|
147
|
+
try {
|
|
148
|
+
const row = db.prepare(`SELECT COUNT(*) as c FROM gaps WHERE status = 'open'`).get();
|
|
149
|
+
openGapCount = row.c;
|
|
150
|
+
}
|
|
151
|
+
catch { /* no gaps table */ }
|
|
152
|
+
return { recentRuns, relevantLearnings, conformanceTrend, recentContentThemes, openGapCount };
|
|
153
|
+
}
|
|
154
|
+
// ── Persist Outcome ───────────────────────────────────────────────────
|
|
155
|
+
export function persistSessionOutcome(sessionId, report, workflow, preset, callHistory) {
|
|
156
|
+
const db = getDb();
|
|
157
|
+
// Persist conformance report
|
|
158
|
+
try {
|
|
159
|
+
db.prepare(`
|
|
160
|
+
INSERT INTO engine_reports (id, session_id, workflow, preset, score, grade, breakdown, summary, total_steps, successful_steps, failed_steps, total_duration_ms, generated_at)
|
|
161
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, datetime('now'))
|
|
162
|
+
`).run(genId("rpt"), sessionId, workflow, preset, report.score, report.grade, JSON.stringify(report.breakdown), report.summary, report.totalSteps, report.successfulSteps, report.failedSteps, report.totalDurationMs);
|
|
163
|
+
}
|
|
164
|
+
catch { /* best effort */ }
|
|
165
|
+
// Persist workflow run
|
|
166
|
+
try {
|
|
167
|
+
db.prepare(`
|
|
168
|
+
INSERT INTO engine_workflow_runs (id, session_id, workflow, preset, step_count, success_count, failed_count, duration_ms, created_at)
|
|
169
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, datetime('now'))
|
|
170
|
+
`).run(genId("run"), sessionId, workflow, preset, report.totalSteps, report.successfulSteps, report.failedSteps, report.totalDurationMs);
|
|
171
|
+
}
|
|
172
|
+
catch { /* best effort */ }
|
|
173
|
+
// Auto-extract learnings from error→success recovery patterns
|
|
174
|
+
if (callHistory) {
|
|
175
|
+
autoExtractLearnings(db, sessionId, callHistory);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
function autoExtractLearnings(db, sessionId, callHistory) {
|
|
179
|
+
const errors = callHistory.filter((r) => r.status === "error");
|
|
180
|
+
for (const err of errors) {
|
|
181
|
+
const laterSuccess = callHistory.find((r) => r.toolName === err.toolName && r.status === "success" && r.timestamp > err.timestamp);
|
|
182
|
+
if (laterSuccess) {
|
|
183
|
+
try {
|
|
184
|
+
const key = `auto:${err.toolName}:${sessionId.slice(-8)}`;
|
|
185
|
+
const errMsg = typeof err.result === "object" && err.result !== null
|
|
186
|
+
? err.result.error ?? JSON.stringify(err.result)
|
|
187
|
+
: String(err.result);
|
|
188
|
+
db.prepare(`
|
|
189
|
+
INSERT OR IGNORE INTO learnings (id, key, content, category, tags, created_at, updated_at)
|
|
190
|
+
VALUES (?, ?, ?, 'gotcha', ?, datetime('now'), datetime('now'))
|
|
191
|
+
`).run(genId("lrn"), key, `Tool "${err.toolName}" failed then succeeded. Error: ${String(errMsg).slice(0, 200)}`, JSON.stringify([err.toolName, "auto-extracted"]));
|
|
192
|
+
}
|
|
193
|
+
catch { /* best-effort, duplicate keys silently ignored */ }
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
// ── Context Health ────────────────────────────────────────────────────
|
|
198
|
+
export function getContextHealth() {
|
|
199
|
+
const db = getDb();
|
|
200
|
+
let learningsCount = 0;
|
|
201
|
+
try {
|
|
202
|
+
const row = db.prepare("SELECT COUNT(*) as c FROM learnings").get();
|
|
203
|
+
learningsCount = row.c;
|
|
204
|
+
}
|
|
205
|
+
catch { /* table missing */ }
|
|
206
|
+
let recentRunScores = [];
|
|
207
|
+
try {
|
|
208
|
+
const rows = db.prepare(`
|
|
209
|
+
SELECT score FROM engine_reports
|
|
210
|
+
ORDER BY generated_at DESC LIMIT 20
|
|
211
|
+
`).all();
|
|
212
|
+
recentRunScores = rows.map((r) => r.score);
|
|
213
|
+
}
|
|
214
|
+
catch { /* no reports */ }
|
|
215
|
+
// Trend direction
|
|
216
|
+
let trendDirection = "insufficient_data";
|
|
217
|
+
if (recentRunScores.length >= 3) {
|
|
218
|
+
const half = Math.ceil(recentRunScores.length / 2);
|
|
219
|
+
const recentAvg = recentRunScores.slice(0, half).reduce((a, b) => a + b, 0) / half;
|
|
220
|
+
const olderAvg = recentRunScores.slice(half).reduce((a, b) => a + b, 0) / (recentRunScores.length - half);
|
|
221
|
+
const delta = recentAvg - olderAvg;
|
|
222
|
+
trendDirection = delta > 5 ? "improving" : delta < -5 ? "regressing" : "stable";
|
|
223
|
+
}
|
|
224
|
+
let contentArchiveSize = 0;
|
|
225
|
+
try {
|
|
226
|
+
const row = db.prepare("SELECT COUNT(*) as c FROM content_archive").get();
|
|
227
|
+
contentArchiveSize = row.c;
|
|
228
|
+
}
|
|
229
|
+
catch { /* table missing */ }
|
|
230
|
+
let daysSinceLastLearning = null;
|
|
231
|
+
try {
|
|
232
|
+
const row = db.prepare("SELECT created_at FROM learnings ORDER BY created_at DESC LIMIT 1").get();
|
|
233
|
+
if (row) {
|
|
234
|
+
const lastDate = new Date(row.created_at);
|
|
235
|
+
daysSinceLastLearning = Math.floor((Date.now() - lastDate.getTime()) / (1000 * 60 * 60 * 24));
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
catch { /* table missing */ }
|
|
239
|
+
let workflowCoverage = {};
|
|
240
|
+
try {
|
|
241
|
+
const rows = db.prepare(`
|
|
242
|
+
SELECT workflow, COUNT(*) as c FROM engine_workflow_runs
|
|
243
|
+
GROUP BY workflow ORDER BY c DESC LIMIT 15
|
|
244
|
+
`).all();
|
|
245
|
+
for (const r of rows) {
|
|
246
|
+
workflowCoverage[r.workflow] = r.c;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
catch { /* table missing */ }
|
|
250
|
+
return { learningsCount, recentRunScores, trendDirection, contentArchiveSize, daysSinceLastLearning, workflowCoverage };
|
|
251
|
+
}
|
|
252
|
+
// ── Content Archive ───────────────────────────────────────────────────
|
|
253
|
+
export function archiveContent(title, contentType, digest, themes, workflow, fullContent) {
|
|
254
|
+
const db = getDb();
|
|
255
|
+
try {
|
|
256
|
+
db.prepare(`
|
|
257
|
+
INSERT INTO content_archive (id, title, content_type, digest, full_content, themes, workflow, published_at)
|
|
258
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, datetime('now'))
|
|
259
|
+
`).run(genId("cnt"), title, contentType, digest, fullContent ?? null, JSON.stringify(themes), workflow ?? null);
|
|
260
|
+
}
|
|
261
|
+
catch { /* best effort */ }
|
|
262
|
+
}
|
|
263
|
+
export function searchContentArchive(query, contentType, limit = 10) {
|
|
264
|
+
const db = getDb();
|
|
265
|
+
try {
|
|
266
|
+
let rows;
|
|
267
|
+
if (query) {
|
|
268
|
+
rows = db.prepare(`
|
|
269
|
+
SELECT c.id, c.title, c.content_type, c.digest, c.themes, c.published_at
|
|
270
|
+
FROM content_archive_fts fts
|
|
271
|
+
JOIN content_archive c ON c.rowid = fts.rowid
|
|
272
|
+
WHERE content_archive_fts MATCH ?
|
|
273
|
+
${contentType ? "AND c.content_type = ?" : ""}
|
|
274
|
+
ORDER BY rank
|
|
275
|
+
LIMIT ?
|
|
276
|
+
`).all(...(contentType ? [query, contentType, limit] : [query, limit]));
|
|
277
|
+
}
|
|
278
|
+
else {
|
|
279
|
+
rows = db.prepare(`
|
|
280
|
+
SELECT id, title, content_type, digest, themes, published_at
|
|
281
|
+
FROM content_archive
|
|
282
|
+
${contentType ? "WHERE content_type = ?" : ""}
|
|
283
|
+
ORDER BY published_at DESC
|
|
284
|
+
LIMIT ?
|
|
285
|
+
`).all(...(contentType ? [contentType, limit] : [limit]));
|
|
286
|
+
}
|
|
287
|
+
return rows.map((r) => ({
|
|
288
|
+
id: r.id,
|
|
289
|
+
title: r.title,
|
|
290
|
+
contentType: r.content_type,
|
|
291
|
+
digest: r.digest ?? "",
|
|
292
|
+
themes: r.themes ? (() => { try {
|
|
293
|
+
return JSON.parse(r.themes);
|
|
294
|
+
}
|
|
295
|
+
catch {
|
|
296
|
+
return [];
|
|
297
|
+
} })() : [],
|
|
298
|
+
publishedAt: r.published_at,
|
|
299
|
+
}));
|
|
300
|
+
}
|
|
301
|
+
catch {
|
|
302
|
+
// FTS5 syntax error — LIKE fallback
|
|
303
|
+
try {
|
|
304
|
+
const pattern = `%${query}%`;
|
|
305
|
+
const rows = db.prepare(`
|
|
306
|
+
SELECT id, title, content_type, digest, themes, published_at
|
|
307
|
+
FROM content_archive
|
|
308
|
+
WHERE title LIKE ? OR digest LIKE ? OR themes LIKE ?
|
|
309
|
+
${contentType ? "AND content_type = ?" : ""}
|
|
310
|
+
ORDER BY published_at DESC LIMIT ?
|
|
311
|
+
`).all(...(contentType ? [pattern, pattern, pattern, contentType, limit] : [pattern, pattern, pattern, limit]));
|
|
312
|
+
return rows.map((r) => ({
|
|
313
|
+
id: r.id,
|
|
314
|
+
title: r.title,
|
|
315
|
+
contentType: r.content_type,
|
|
316
|
+
digest: r.digest ?? "",
|
|
317
|
+
themes: r.themes ? (() => { try {
|
|
318
|
+
return JSON.parse(r.themes);
|
|
319
|
+
}
|
|
320
|
+
catch {
|
|
321
|
+
return [];
|
|
322
|
+
} })() : [],
|
|
323
|
+
publishedAt: r.published_at,
|
|
324
|
+
}));
|
|
325
|
+
}
|
|
326
|
+
catch {
|
|
327
|
+
return [];
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
// ── Workflow History ──────────────────────────────────────────────────
|
|
332
|
+
export function getWorkflowHistory(workflow, limit = 10) {
|
|
333
|
+
const db = getDb();
|
|
334
|
+
try {
|
|
335
|
+
const rows = db.prepare(`
|
|
336
|
+
SELECT r.session_id, r.workflow, r.preset,
|
|
337
|
+
COALESCE(rp.score, 0) as score,
|
|
338
|
+
COALESCE(rp.grade, '-') as grade,
|
|
339
|
+
r.duration_ms, r.step_count, r.success_count, r.failed_count, r.created_at
|
|
340
|
+
FROM engine_workflow_runs r
|
|
341
|
+
LEFT JOIN engine_reports rp ON rp.session_id = r.session_id AND rp.workflow = r.workflow
|
|
342
|
+
WHERE r.workflow = ?
|
|
343
|
+
ORDER BY r.created_at DESC
|
|
344
|
+
LIMIT ?
|
|
345
|
+
`).all(workflow, limit);
|
|
346
|
+
return rows.map((r) => ({
|
|
347
|
+
sessionId: r.session_id,
|
|
348
|
+
workflow: r.workflow,
|
|
349
|
+
preset: r.preset,
|
|
350
|
+
score: r.score,
|
|
351
|
+
grade: r.grade,
|
|
352
|
+
durationMs: r.duration_ms,
|
|
353
|
+
stepCount: r.step_count,
|
|
354
|
+
successCount: r.success_count,
|
|
355
|
+
failedCount: r.failed_count,
|
|
356
|
+
createdAt: r.created_at,
|
|
357
|
+
}));
|
|
358
|
+
}
|
|
359
|
+
catch {
|
|
360
|
+
return [];
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
// ── Search Learnings (for API) ────────────────────────────────────────
|
|
364
|
+
export function searchLearnings(query, limit = 10) {
|
|
365
|
+
const db = getDb();
|
|
366
|
+
try {
|
|
367
|
+
const rows = db.prepare(`
|
|
368
|
+
SELECT l.key, l.content, l.category, l.created_at
|
|
369
|
+
FROM learnings_fts fts
|
|
370
|
+
JOIN learnings l ON l.id = fts.rowid
|
|
371
|
+
WHERE learnings_fts MATCH ?
|
|
372
|
+
ORDER BY rank
|
|
373
|
+
LIMIT ?
|
|
374
|
+
`).all(query, limit);
|
|
375
|
+
return rows.map((r) => ({ key: r.key, content: r.content, category: r.category, createdAt: r.created_at }));
|
|
376
|
+
}
|
|
377
|
+
catch {
|
|
378
|
+
try {
|
|
379
|
+
const pattern = `%${query}%`;
|
|
380
|
+
const rows = db.prepare(`
|
|
381
|
+
SELECT key, content, category, created_at
|
|
382
|
+
FROM learnings WHERE content LIKE ? OR key LIKE ?
|
|
383
|
+
ORDER BY created_at DESC LIMIT ?
|
|
384
|
+
`).all(pattern, pattern, limit);
|
|
385
|
+
return rows.map((r) => ({ key: r.key, content: r.content, category: r.category, createdAt: r.created_at }));
|
|
386
|
+
}
|
|
387
|
+
catch {
|
|
388
|
+
return [];
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
//# sourceMappingURL=contextBridge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contextBridge.js","sourceRoot":"","sources":["../../src/engine/contextBridge.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAqCxC,yEAAyE;AAEzE,MAAM,UAAU,kBAAkB,CAAC,QAAgB,EAAE,OAAe;IAClE,MAAM,EAAE,GAAG,KAAK,EAAE,CAAC;IAEnB,mCAAmC;IACnC,IAAI,UAAU,GAAiC,EAAE,CAAC;IAClD,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,EAAE,CAAC,OAAO,CAAC;;;;;;KAMvB,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAU,CAAC;QAC1B,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YAC5B,QAAQ,EAAE,CAAC,CAAC,QAAQ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