konoha-mcp 2.1.4 → 2.1.5
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/.agents/skills.fingerprint +1 -1
- package/README.md +4 -4
- package/apps/web/build/adapter-node.js +1 -1
- package/apps/web/build/client/_app/immutable/entry/{app.DwlgEXmV.js → app.DLayTcYu.js} +2 -2
- package/apps/web/build/client/_app/immutable/entry/app.DLayTcYu.js.br +0 -0
- package/apps/web/build/client/_app/immutable/entry/app.DLayTcYu.js.gz +0 -0
- package/apps/web/build/client/_app/immutable/nodes/{9.CVBlvZqX.js → 9.CGMmeMVC.js} +1 -1
- package/apps/web/build/client/_app/immutable/nodes/9.CGMmeMVC.js.br +0 -0
- package/apps/web/build/client/_app/immutable/nodes/9.CGMmeMVC.js.gz +0 -0
- package/apps/web/build/client/_app/version.json +1 -1
- package/apps/web/build/client/_app/version.json.br +0 -0
- package/apps/web/build/client/_app/version.json.gz +0 -0
- package/apps/web/build/server/.vite/manifest.json +15 -15
- package/apps/web/build/server/adapter-index.js +1 -1
- package/apps/web/build/server/adapter-index.js.map +1 -1
- package/apps/web/build/server/adapter-node-env.js +1 -1
- package/apps/web/build/server/adapter-node-env.js.map +1 -1
- package/apps/web/build/server/adapter-node-handler.js +4 -4
- package/apps/web/build/server/adapter-node-handler.js.map +1 -1
- package/apps/web/build/server/chunks/exports.js +9 -9
- package/apps/web/build/server/chunks/exports.js.map +1 -1
- package/apps/web/build/server/chunks/functions.js +1 -1
- package/apps/web/build/server/chunks/functions.js.map +1 -1
- package/apps/web/build/server/chunks/instance.js +33 -33
- package/apps/web/build/server/chunks/instance.js.map +1 -1
- package/apps/web/build/server/chunks/internal.js +19 -19
- package/apps/web/build/server/chunks/internal.js.map +1 -1
- package/apps/web/build/server/chunks/server-errors.js +2 -2
- package/apps/web/build/server/chunks/server-errors.js.map +1 -1
- package/apps/web/build/server/chunks/server.js.map +1 -1
- package/apps/web/build/server/chunks/shared.js +1 -1
- package/apps/web/build/server/chunks/shared.js.map +1 -1
- package/apps/web/build/server/chunks/state.js +1 -1
- package/apps/web/build/server/chunks/state.js.map +1 -1
- package/apps/web/build/server/chunks/sweetAlert.svelte.js.map +1 -1
- package/apps/web/build/server/chunks/uiState.svelte.js.map +1 -1
- package/apps/web/build/server/entries/fallbacks/error.svelte.js +1 -1
- package/apps/web/build/server/entries/fallbacks/error.svelte.js.map +1 -1
- package/apps/web/build/server/entries/pages/_layout.svelte.js.map +1 -1
- package/apps/web/build/server/entries/pages/bridges/_page.svelte.js.map +1 -1
- package/apps/web/build/server/entries/pages/clients/_page.svelte.js.map +1 -1
- package/apps/web/build/server/entries/pages/detector/_page.svelte.js.map +1 -1
- package/apps/web/build/server/entries/pages/docs/_page.svelte.js +1 -1
- package/apps/web/build/server/entries/pages/docs/_page.svelte.js.map +1 -1
- package/apps/web/build/server/entries/pages/persona/_page.svelte.js.map +1 -1
- package/apps/web/build/server/entries/pages/search/_page.svelte.js.map +1 -1
- package/apps/web/build/server/entries/pages/semble/_page.svelte.js.map +1 -1
- package/apps/web/build/server/entries/pages/skills/_page.svelte.js.map +1 -1
- package/apps/web/build/server/entries/pages/tasks/_page.svelte.js.map +1 -1
- package/apps/web/build/server/index.js +1 -1
- package/apps/web/build/server/index.js.map +1 -1
- package/apps/web/build/server/manifest-full.js +1 -1
- package/apps/web/build/server/manifest.js +1 -1
- package/apps/web/build/server/nodes/9.js +1 -1
- package/apps/web/build/server/remote-entry.js +7 -7
- package/apps/web/build/server/remote-entry.js.map +1 -1
- package/apps/web/build/server/server.js +1 -1
- package/apps/web/package.json +2 -2
- package/bin/cli.js +6 -6
- package/bin/lib/ui_commands.js +4 -3
- package/docs/SecurityCompliance/qa_report_2.1.5_2026-10-07.md +65 -0
- package/docs/SecurityCompliance/security_compliance_report_google_policy_2.1.5_2026-10-07.md +74 -0
- package/docs/SecurityCompliance/socket_baseline_2026-10-07.md +60 -0
- package/docs/SecurityCompliance/socket_burndown_2.1.5_2026-10-07.md +73 -0
- package/docs/SecurityCompliance/socket_report_2.1.5_2026-10-07.md +54 -0
- package/docs/architecture/TOKEN-BASELINE.md +1 -1
- package/package.json +3 -17
- package/src/antigravity_manager.js +81 -15
- package/src/db.js +2 -2
- package/src/db_agents.js +1 -1
- package/src/db_bridges.js +1 -1
- package/src/db_savings.js +1 -1
- package/src/db_stats.js +1 -1
- package/src/deploy_utils.js +4 -5
- package/src/doctor.js +10 -0
- package/src/migrate.js +1 -1
- package/src/persona_memory.js +1 -1
- package/src/sqlite_driver.js +211 -0
- package/src/vector_search.js +1 -1
- package/apps/web/build/client/_app/immutable/entry/app.DwlgEXmV.js.br +0 -0
- package/apps/web/build/client/_app/immutable/entry/app.DwlgEXmV.js.gz +0 -0
- package/apps/web/build/client/_app/immutable/nodes/9.CVBlvZqX.js.br +0 -0
- package/apps/web/build/client/_app/immutable/nodes/9.CVBlvZqX.js.gz +0 -0
package/src/deploy_utils.js
CHANGED
|
@@ -66,13 +66,13 @@ function resolveWebUiDir(opts = {}) {
|
|
|
66
66
|
try {
|
|
67
67
|
const parsed = JSON.parse(fs.readFileSync(pkg, "utf8"));
|
|
68
68
|
if (parsed.name === "konoha-web") {
|
|
69
|
-
const hasRoutes = fs.existsSync(path.join(dir, "src", "routes"));
|
|
69
|
+
const hasRoutes = fs.existsSync(path.join(dir, "src", "routes")) || fs.existsSync(path.join(dir, "public", "index.html"));
|
|
70
70
|
const hasBuildScript = Boolean(parsed.scripts && parsed.scripts.build);
|
|
71
71
|
hasSources = hasRoutes && hasBuildScript;
|
|
72
72
|
}
|
|
73
73
|
} catch (_) { /* intentional best-effort fallback: failure here must never crash the CLI/MCP runtime */ }
|
|
74
74
|
}
|
|
75
|
-
const hasBuild = fs.existsSync(path.join(dir, "build", "handler.js"));
|
|
75
|
+
const hasBuild = fs.existsSync(path.join(dir, "build", "handler.js")) || fs.existsSync(path.join(dir, "public", "index.html"));
|
|
76
76
|
const qualifies = hasSources || hasBuild;
|
|
77
77
|
if (qualifies) qualifying.push({ dir, hasSources, hasBuild });
|
|
78
78
|
} catch (_) { /* intentional best-effort fallback: failure here must never crash the CLI/MCP runtime */ }
|
|
@@ -537,7 +537,6 @@ function installFileTools(silent = true, pythonCmd = null) {
|
|
|
537
537
|
private: true,
|
|
538
538
|
dependencies: {
|
|
539
539
|
"@bufbuild/protobuf": "^2.11.0",
|
|
540
|
-
"better-sqlite3": "^13.0.3",
|
|
541
540
|
"@huggingface/transformers": "^4.2.0"
|
|
542
541
|
},
|
|
543
542
|
},
|
|
@@ -546,7 +545,7 @@ function installFileTools(silent = true, pythonCmd = null) {
|
|
|
546
545
|
) + "\n",
|
|
547
546
|
);
|
|
548
547
|
}
|
|
549
|
-
if (!fileExists(nodeModulesPath) || !fileExists(path.join(nodeModulesPath, '
|
|
548
|
+
if (!fileExists(nodeModulesPath) || !fileExists(path.join(nodeModulesPath, '@bufbuild', 'protobuf'))) {
|
|
550
549
|
const isWin = process.platform === "win32";
|
|
551
550
|
// .cmd/.bat shims require shell:true since Node >= 18.20.2 (CVE-2024-27980);
|
|
552
551
|
// fall back to npm when pnpm is unavailable
|
|
@@ -810,7 +809,7 @@ function cleanKonohaRuntimeDir(options = {}) {
|
|
|
810
809
|
const activeDbPath = path.join(target, 'konoha.db');
|
|
811
810
|
if (fs.existsSync(activeDbPath)) {
|
|
812
811
|
try {
|
|
813
|
-
const Database = require('
|
|
812
|
+
const Database = require('./sqlite_driver');
|
|
814
813
|
const db = new Database(activeDbPath, { timeout: 5000 });
|
|
815
814
|
try {
|
|
816
815
|
db.pragma('wal_checkpoint(TRUNCATE)');
|
package/src/doctor.js
CHANGED
|
@@ -96,12 +96,22 @@ function getDiagnostics(autoRepair = false) {
|
|
|
96
96
|
const servers = cfg.mcpServers || {};
|
|
97
97
|
if (servers.konoha && servers.semble && servers.aislop) {
|
|
98
98
|
record('MCP Config (mcp_config.json)', 'HEALTHY', 'konoha, semble, and aislop are active');
|
|
99
|
+
} else if (autoRepair) {
|
|
100
|
+
require('./antigravity_manager').ensureAntigravitySetup({ silent: true });
|
|
101
|
+
record('MCP Config (mcp_config.json)', 'REPAIRED', 'Registered konoha, semble, and aislop in config');
|
|
99
102
|
} else {
|
|
100
103
|
record('MCP Config (mcp_config.json)', 'WARNING', 'Some MCP servers not registered');
|
|
101
104
|
}
|
|
102
105
|
} catch {
|
|
103
106
|
record('MCP Config (mcp_config.json)', 'FAILED', 'Invalid JSON config');
|
|
104
107
|
}
|
|
108
|
+
} else if (autoRepair) {
|
|
109
|
+
try {
|
|
110
|
+
require('./antigravity_manager').ensureAntigravitySetup({ silent: true });
|
|
111
|
+
record('MCP Config (mcp_config.json)', 'REPAIRED', 'Registered konoha, semble, and aislop in config');
|
|
112
|
+
} catch {
|
|
113
|
+
record('MCP Config (mcp_config.json)', 'FAILED', 'Missing mcp_config.json');
|
|
114
|
+
}
|
|
105
115
|
} else {
|
|
106
116
|
record('MCP Config (mcp_config.json)', 'FAILED', 'Missing mcp_config.json');
|
|
107
117
|
}
|
package/src/migrate.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
3
|
* Skills Migration Engine (v1.1.0 — Enhanced Token Optimization)
|
|
4
|
-
* Pure Node.js replacement for migrate.py using
|
|
4
|
+
* Pure Node.js replacement for migrate.py using the node:sqlite driver and yaml_utils.
|
|
5
5
|
* Migrates skill content from ~/.agents/skills/ into SQLite FTS5 database.
|
|
6
6
|
*/
|
|
7
7
|
|
package/src/persona_memory.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Persistent Persona Memory & Project Context Engine for Konoha.
|
|
3
|
-
* Pure Node.js replacement for persona_memory.py using
|
|
3
|
+
* Pure Node.js replacement for persona_memory.py using the node:sqlite driver and crypto.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
const fs = require('fs');
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Synchronous SQLite driver for Konoha built on Node's bundled `node:sqlite`
|
|
5
|
+
* (Node >= 22.16 ships SQLite with FTS5 enabled). Exposes the small
|
|
6
|
+
* better-sqlite3-style surface the codebase relies on — prepare, exec,
|
|
7
|
+
* pragma, transaction, loadExtension, close — so the runtime has zero native
|
|
8
|
+
* dependencies and nothing to compile at install time.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
const fs = require('fs');
|
|
12
|
+
|
|
13
|
+
const SQLITE_EXPERIMENTAL_WARNING = 'SQLite is an experimental feature';
|
|
14
|
+
const NAMED_PARAMETER = /[:@$]([A-Za-z_][A-Za-z0-9_]*)/g;
|
|
15
|
+
const DEFAULT_BUSY_TIMEOUT_MS = 5000;
|
|
16
|
+
|
|
17
|
+
// node:sqlite prints an ExperimentalWarning to stderr when first loaded on
|
|
18
|
+
// Node 22/24. Filter only that warning, only while the module loads, so MCP
|
|
19
|
+
// stdio sessions and CLI output stay clean.
|
|
20
|
+
function loadNodeSqlite() {
|
|
21
|
+
const originalEmitWarning = process.emitWarning;
|
|
22
|
+
process.emitWarning = function emitWarningWithoutSqliteNotice(warning, ...rest) {
|
|
23
|
+
const text = typeof warning === 'string' ? warning : String((warning && warning.message) || '');
|
|
24
|
+
if (text.includes(SQLITE_EXPERIMENTAL_WARNING)) return undefined;
|
|
25
|
+
return originalEmitWarning.call(process, warning, ...rest);
|
|
26
|
+
};
|
|
27
|
+
try {
|
|
28
|
+
return require('node:sqlite');
|
|
29
|
+
} catch (err) {
|
|
30
|
+
throw new Error(`Konoha requires Node.js >= 22.16 with the built-in node:sqlite module (${err.message})`);
|
|
31
|
+
} finally {
|
|
32
|
+
process.emitWarning = originalEmitWarning;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const { DatabaseSync } = loadNodeSqlite();
|
|
37
|
+
|
|
38
|
+
function isNamedParameterObject(value) {
|
|
39
|
+
return value !== null
|
|
40
|
+
&& typeof value === 'object'
|
|
41
|
+
&& !ArrayBuffer.isView(value)
|
|
42
|
+
&& !(value instanceof ArrayBuffer);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// better-sqlite3 binds `undefined` and booleans leniently; node:sqlite rejects them.
|
|
46
|
+
function toBindable(value) {
|
|
47
|
+
if (value === undefined) return null;
|
|
48
|
+
if (typeof value === 'boolean') return value ? 1 : 0;
|
|
49
|
+
return value;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// node:sqlite returns null-prototype rows and Uint8Array blobs; callers expect
|
|
53
|
+
// plain objects and Buffers (as better-sqlite3 returned).
|
|
54
|
+
function normalizeRow(row) {
|
|
55
|
+
if (row === undefined || row === null) return row;
|
|
56
|
+
const plain = {};
|
|
57
|
+
for (const key of Object.keys(row)) {
|
|
58
|
+
const value = row[key];
|
|
59
|
+
plain[key] = value instanceof Uint8Array && !Buffer.isBuffer(value)
|
|
60
|
+
? Buffer.from(value.buffer, value.byteOffset, value.byteLength)
|
|
61
|
+
: value;
|
|
62
|
+
}
|
|
63
|
+
return plain;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
class Statement {
|
|
67
|
+
constructor(statement) {
|
|
68
|
+
this._statement = statement;
|
|
69
|
+
this._parameterNames = null;
|
|
70
|
+
this.source = statement.sourceSQL;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
_namesInSql() {
|
|
74
|
+
if (!this._parameterNames) {
|
|
75
|
+
this._parameterNames = new Set();
|
|
76
|
+
for (const match of this.source.matchAll(NAMED_PARAMETER)) {
|
|
77
|
+
this._parameterNames.add(match[1]);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return this._parameterNames;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// node:sqlite throws on object keys that are not parameters of the
|
|
84
|
+
// statement; better-sqlite3 ignored them. Keep only keys the SQL references.
|
|
85
|
+
_pickNamed(params) {
|
|
86
|
+
const names = this._namesInSql();
|
|
87
|
+
const picked = {};
|
|
88
|
+
for (const key of Object.keys(params)) {
|
|
89
|
+
if (names.has(key)) picked[key] = toBindable(params[key]);
|
|
90
|
+
}
|
|
91
|
+
return picked;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
_bind(args) {
|
|
95
|
+
const positional = [];
|
|
96
|
+
let named = null;
|
|
97
|
+
for (const arg of args.flat()) {
|
|
98
|
+
if (isNamedParameterObject(arg)) {
|
|
99
|
+
named = this._pickNamed(arg);
|
|
100
|
+
} else {
|
|
101
|
+
positional.push(toBindable(arg));
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
return named ? [named, ...positional] : positional;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
run(...args) {
|
|
108
|
+
return this._statement.run(...this._bind(args));
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
get(...args) {
|
|
112
|
+
return normalizeRow(this._statement.get(...this._bind(args)));
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
all(...args) {
|
|
116
|
+
return this._statement.all(...this._bind(args)).map(normalizeRow);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
*iterate(...args) {
|
|
120
|
+
for (const row of this._statement.iterate(...this._bind(args))) {
|
|
121
|
+
yield normalizeRow(row);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
class Database {
|
|
127
|
+
constructor(filename = ':memory:', options = {}) {
|
|
128
|
+
const readOnly = Boolean(options.readonly || options.readOnly);
|
|
129
|
+
if (options.fileMustExist && filename !== ':memory:' && !fs.existsSync(filename)) {
|
|
130
|
+
throw new Error(`unable to open database file: ${filename}`);
|
|
131
|
+
}
|
|
132
|
+
this._db = new DatabaseSync(filename, { readOnly, allowExtension: true });
|
|
133
|
+
this._savepointDepth = 0;
|
|
134
|
+
this.name = filename;
|
|
135
|
+
this.readonly = readOnly;
|
|
136
|
+
this.memory = filename === ':memory:';
|
|
137
|
+
const timeout = Number.isInteger(options.timeout) ? options.timeout : DEFAULT_BUSY_TIMEOUT_MS;
|
|
138
|
+
this._db.exec(`PRAGMA busy_timeout = ${timeout}`);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
get open() {
|
|
142
|
+
return this._db.isOpen;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
get inTransaction() {
|
|
146
|
+
return this._db.isTransaction;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
prepare(sql) {
|
|
150
|
+
return new Statement(this._db.prepare(sql));
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
exec(sql) {
|
|
154
|
+
this._db.exec(sql);
|
|
155
|
+
return this;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
pragma(source, options = {}) {
|
|
159
|
+
const rows = this.prepare(`PRAGMA ${source}`).all();
|
|
160
|
+
if (!options.simple) return rows;
|
|
161
|
+
return rows.length > 0 ? Object.values(rows[0])[0] : undefined;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
transaction(fn) {
|
|
165
|
+
const database = this;
|
|
166
|
+
return function runTransaction(...args) {
|
|
167
|
+
return database._runInTransaction(fn, this, args);
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
_runInTransaction(fn, thisArg, args) {
|
|
172
|
+
const nested = this._db.isTransaction;
|
|
173
|
+
const savepoint = `konoha_sp_${this._savepointDepth}`;
|
|
174
|
+
this._db.exec(nested ? `SAVEPOINT ${savepoint}` : 'BEGIN');
|
|
175
|
+
this._savepointDepth += 1;
|
|
176
|
+
try {
|
|
177
|
+
const result = fn.apply(thisArg, args);
|
|
178
|
+
this._db.exec(nested ? `RELEASE ${savepoint}` : 'COMMIT');
|
|
179
|
+
return result;
|
|
180
|
+
} catch (err) {
|
|
181
|
+
if (this._db.isTransaction) {
|
|
182
|
+
this._db.exec(nested ? `ROLLBACK TO ${savepoint}; RELEASE ${savepoint}` : 'ROLLBACK');
|
|
183
|
+
}
|
|
184
|
+
throw err;
|
|
185
|
+
} finally {
|
|
186
|
+
this._savepointDepth -= 1;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
loadExtension(file) {
|
|
191
|
+
if (typeof file !== 'string' || file.length === 0) {
|
|
192
|
+
throw new TypeError('Extension path must be a non-empty string');
|
|
193
|
+
}
|
|
194
|
+
this._db.enableLoadExtension(true);
|
|
195
|
+
try {
|
|
196
|
+
this._db.loadExtension(file);
|
|
197
|
+
} finally {
|
|
198
|
+
this._db.enableLoadExtension(false);
|
|
199
|
+
}
|
|
200
|
+
return this;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
close() {
|
|
204
|
+
if (this._db.isOpen) this._db.close();
|
|
205
|
+
return this;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
module.exports = Database;
|
|
210
|
+
module.exports.Database = Database;
|
|
211
|
+
module.exports.normalizeRow = normalizeRow;
|
package/src/vector_search.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Hybrid semantic search, ONNX embeddings, and cross-encoder reranker for Konoha.
|
|
3
|
-
* Pure Node.js replacement for vector_search.py using @huggingface/transformers and
|
|
3
|
+
* Pure Node.js replacement for vector_search.py using @huggingface/transformers and the node:sqlite driver.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
const fs = require('fs');
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|