@plumpslabs/kuma 2.3.18 → 2.3.19
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-3TX6Q37T.js → chunk-3BRBJZ7P.js} +3 -3
- package/dist/{chunk-SPHI2BOO.js → chunk-3OHYYXYN.js} +1 -1
- package/dist/{chunk-ZIXY2COZ.js → chunk-ABKE45T4.js} +38 -3
- package/dist/{chunk-Q2444HWO.js → chunk-FKRSI5U5.js} +1 -1
- package/dist/{chunk-RI3DKY62.js → chunk-GFLSAXAH.js} +1 -1
- package/dist/{chunk-OJALFQ4H.js → chunk-L7F67KUP.js} +2 -2
- package/dist/{chunk-R6B3VUSB.js → chunk-LVKOGXLC.js} +2 -2
- package/dist/{chunk-ZKDYTYMS.js → chunk-PRUTTZBS.js} +143 -4
- package/dist/{contextDigest-5JXLH56Z.js → contextDigest-QB5XHPXE.js} +3 -3
- package/dist/{domainRules-ED6EOFVY.js → domainRules-QLPAQASB.js} +2 -2
- package/dist/index.js +87 -49
- package/dist/{init-RUKOPMX6.js → init-PL4XL662.js} +1 -1
- package/dist/{kumaCheckpoint-XIQWRMGV.js → kumaCheckpoint-J2LDQMEO.js} +2 -2
- package/dist/{kumaCodeScanner-2RDHZ5F4.js → kumaCodeScanner-J6B2EHGI.js} +2 -2
- package/dist/{kumaDb-IC7UX7PU.js → kumaDb-4XZ5S2LH.js} +1 -1
- package/dist/{kumaDriftDetector-QBY6OJOO.js → kumaDriftDetector-TOORILSZ.js} +1 -1
- package/dist/{kumaGotchas-5HODT5RI.js → kumaGotchas-XRGFFBTA.js} +3 -3
- package/dist/{kumaGraph-GUQM75WL.js → kumaGraph-UMXZNGYF.js} +4 -2
- package/dist/{kumaMemory-FMOWIODH.js → kumaMemory-FBJMV77G.js} +2 -2
- package/dist/{kumaMiner-3RXEOCBP.js → kumaMiner-XJETL7TL.js} +3 -3
- package/dist/{kumaPolicyEngine-ORBWL5PT.js → kumaPolicyEngine-2QDJDLM7.js} +2 -2
- package/dist/{kumaProgressiveContext-CVSNPY3W.js → kumaProgressiveContext-MWEDRXOH.js} +4 -4
- package/dist/{kumaSearch-B5WVYHHD.js → kumaSearch-PV4QTKE7.js} +1 -1
- package/dist/{kumaTrajectory-T6DXGOG4.js → kumaTrajectory-7NOAVNG2.js} +2 -2
- package/dist/{kumaVerifier-6NTJQU7B.js → kumaVerifier-6YEGC77M.js} +2 -2
- package/dist/{kumaVisualize-AFL7STLL.js → kumaVisualize-264OEBGJ.js} +17 -1
- package/dist/{safetyAudit-32WSA4Z5.js → safetyAudit-O45SPNTS.js} +2 -2
- package/dist/{safetyScore-WU27EOG4.js → safetyScore-TMMRD2MV.js} +5 -5
- package/dist/{sessionMemory-4UWA3E5J.js → sessionMemory-YPKVIOMV.js} +1 -1
- package/package.json +1 -1
|
@@ -78,7 +78,7 @@ function createSchema(db) {
|
|
|
78
78
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
79
79
|
source_id TEXT NOT NULL REFERENCES nodes(id),
|
|
80
80
|
target_id TEXT NOT NULL REFERENCES nodes(id),
|
|
81
|
-
type TEXT NOT NULL CHECK(type IN ('calls','imports','defines','tests','routes','implements','extends','depends_on','owns','modified_by','contains','composes')),
|
|
81
|
+
type TEXT NOT NULL CHECK(type IN ('calls','imports','defines','tests','routes','implements','extends','depends_on','owns','modified_by','contains','composes','flows_through','triggers','syncs_with')),
|
|
82
82
|
weight REAL DEFAULT 1.0,
|
|
83
83
|
metadata TEXT DEFAULT '{}',
|
|
84
84
|
created_at INTEGER NOT NULL DEFAULT (strftime('%s','now')),
|
|
@@ -87,13 +87,13 @@ function createSchema(db) {
|
|
|
87
87
|
try {
|
|
88
88
|
const schema = db.exec(`SELECT sql FROM sqlite_master WHERE type='table' AND name='edges'`);
|
|
89
89
|
const edgeSql = schema[0]?.values?.[0]?.[0] || "";
|
|
90
|
-
if (edgeSql.includes("
|
|
90
|
+
if (edgeSql.includes("flows_through") === false) {
|
|
91
91
|
db.run(`ALTER TABLE edges RENAME TO edges_old`);
|
|
92
92
|
db.run(`CREATE TABLE IF NOT EXISTS edges (
|
|
93
93
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
94
94
|
source_id TEXT NOT NULL REFERENCES nodes(id),
|
|
95
95
|
target_id TEXT NOT NULL REFERENCES nodes(id),
|
|
96
|
-
type TEXT NOT NULL CHECK(type IN ('calls','imports','defines','tests','routes','implements','extends','depends_on','owns','modified_by','contains','composes')),
|
|
96
|
+
type TEXT NOT NULL CHECK(type IN ('calls','imports','defines','tests','routes','implements','extends','depends_on','owns','modified_by','contains','composes','flows_through','triggers','syncs_with')),
|
|
97
97
|
weight REAL DEFAULT 1.0,
|
|
98
98
|
metadata TEXT DEFAULT '{}',
|
|
99
99
|
created_at INTEGER NOT NULL DEFAULT (strftime('%s','now')),
|
|
@@ -121,7 +121,7 @@ function windsurfRulesTemplate() {
|
|
|
121
121
|
"",
|
|
122
122
|
"Windsurf Cascade agent: Kuma MCP tools are installed.",
|
|
123
123
|
"All behavioral rules are in `.kuma/init.md`.",
|
|
124
|
-
|
|
124
|
+
'**Before coding, call `kuma_context({ action: "init" })`** to load project context and session memory.',
|
|
125
125
|
"Project knowledge persists in `.kuma/memories/*.md` across sessions.",
|
|
126
126
|
"",
|
|
127
127
|
"Also auto-detected as SKILL.md in `.windsurf/skills/` and `.agents/skills/`."
|
|
@@ -155,11 +155,37 @@ function aiderTemplate() {
|
|
|
155
155
|
].join("\n");
|
|
156
156
|
}
|
|
157
157
|
function opencodeAgentsMdTemplate() {
|
|
158
|
+
const opencodeLines = [
|
|
159
|
+
"Kuma MCP tools are installed (kuma_kuma_context, kuma_kuma_memory, kuma_kuma_safety).",
|
|
160
|
+
'**Before coding, call `kuma_kuma_context({ action: "init" })`** to load project context.',
|
|
161
|
+
"Project knowledge persists in `.kuma/memories/*.md` across sessions.",
|
|
162
|
+
"",
|
|
163
|
+
"\u26A0\uFE0F **MANDATORY WORKFLOW** \u2014 Follow in order every session (including research-only):",
|
|
164
|
+
"",
|
|
165
|
+
' 1. `kuma_kuma_context({ action: "init" })` \u2014 Load context (START HERE)',
|
|
166
|
+
' 2. `kuma_kuma_safety({ action: "guard" })` \u2014 Safety check before work',
|
|
167
|
+
' 3. `kuma_kuma_context({ action: "research", scope: "<area>" })` \u2014 Research before editing',
|
|
168
|
+
" 4. *(edit/read using native tools)*",
|
|
169
|
+
' 5. `kuma_kuma_memory({ action: "research_save", ... })` \u2014 After exploring area (creates search cache)',
|
|
170
|
+
' 6. `kuma_kuma_memory({ action: "gotcha" })` \u2014 \u{1F525} IMMEDIATELY when bug found (exponential value)',
|
|
171
|
+
' 7. `kuma_kuma_memory({ action: "arch_flow" })` \u2014 \u{1F525} IMMEDIATELY after each flow hop (exponential value)',
|
|
172
|
+
' 8. `kuma_kuma_memory({ action: "decision" })` \u2014 When choosing between options (preserves rationale)',
|
|
173
|
+
' 9. `kuma_kuma_safety({ action: "verify", ... })` \u2014 Run tests / confirm nothing broken',
|
|
174
|
+
' 10. `kuma_kuma_context({ action: "changes" })` \u2014 Review session activity',
|
|
175
|
+
"",
|
|
176
|
+
"\u{1F525} **Power Curve:** `arch_flow` + `gotcha` are EXPONENTIAL \u2014 each record saves 5-10 files next session.",
|
|
177
|
+
" The more you record, the more overpowered the agent becomes. These are the highest-value actions.",
|
|
178
|
+
"\u{1F7E2} **SKIP** recording function/class/component nodes \u2014 grep/glob is faster.",
|
|
179
|
+
"\u{1F9E0} Knowledge graph is persistent \u2014 nodes/edges accumulate across sessions, getting richer over time.",
|
|
180
|
+
"",
|
|
181
|
+
"\u26A0\uFE0F **OpenCode platform note:** Tool names use `kuma_kuma_*` prefix",
|
|
182
|
+
" (server name `kuma` + already-prefixed tool name `kuma_context`).",
|
|
183
|
+
""
|
|
184
|
+
].join("\n");
|
|
158
185
|
return [
|
|
159
186
|
"## Kuma MCP \u2014 OpenCode",
|
|
160
187
|
"",
|
|
161
|
-
|
|
162
|
-
"",
|
|
188
|
+
opencodeLines,
|
|
163
189
|
"\u{1F4D6} Rules: `.kuma/init.md`",
|
|
164
190
|
"\u{1F9E0} Skill: `.agents/skills/kuma/SKILL.md`"
|
|
165
191
|
].join("\n");
|
|
@@ -277,6 +303,13 @@ function generateInitMdContent() {
|
|
|
277
303
|
"",
|
|
278
304
|
"---",
|
|
279
305
|
"",
|
|
306
|
+
"> \u26A0\uFE0F **Platform Tool Names:**",
|
|
307
|
+
'> \u2022 **OpenCode / Antigravity:** Use `kuma_kuma_*` prefix (e.g. `kuma_kuma_context({ action: "init" })`)',
|
|
308
|
+
'> \u2022 **Other platforms (Claude, Cursor, Cline, etc.):** Use `kuma_*` directly (e.g. `kuma_context({ action: "init" })`)',
|
|
309
|
+
"> \u2022 **Replace `kuma_` with `kuma_kuma_` in all examples below if you're on OpenCode.**",
|
|
310
|
+
"",
|
|
311
|
+
"---",
|
|
312
|
+
"",
|
|
280
313
|
"## \u26A0\uFE0F SESSION WORKFLOW \u2014 Follow Steps in Order",
|
|
281
314
|
"",
|
|
282
315
|
"### STEP 1: Init Session (ALWAYS \u2014 Start of Session)",
|
|
@@ -457,6 +490,8 @@ function generateInitMdContent() {
|
|
|
457
490
|
"| \u25B2 `triangle` | route | API routes | AUTO by scanner |",
|
|
458
491
|
"| \u2B52 `star` | test | Test files/describes | AUTO by scanner |",
|
|
459
492
|
"| \u{1F4C4} `note` | context | Manual context notes | MANUAL \u2014 kuma_memory context |",
|
|
493
|
+
"| \u{1F3DB}\uFE0F `feature_domain` | FeatureDomain | High-level feature domain anchor | MANUAL \u2014 kuma_memory arch_flow (domain:) |",
|
|
494
|
+
"| \u{1F517} `cross_service_link` | Workflow hop | Cross-service/inter-file flow step | MANUAL \u2014 kuma_memory arch_flow (hops:) |",
|
|
460
495
|
"| \u{1F3F7}\uFE0F `tag` | domain_rule | Business rules (Layer 1) | MANUAL \u2014 kuma_memory domain_rules |",
|
|
461
496
|
"| \u{1F500} `flow` | arch_flow | Architecture flows (Layer 2) | MANUAL \u2014 kuma_memory arch_flow |",
|
|
462
497
|
"| \u26A0\uFE0F `warning` | gotcha | Known gotchas (Layer 3) | MANUAL \u2014 kuma_memory gotcha |",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
sessionMemory
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-LVKOGXLC.js";
|
|
4
4
|
import {
|
|
5
5
|
getProjectRoot
|
|
6
6
|
} from "./chunk-E2KFPEBT.js";
|
|
@@ -82,7 +82,7 @@ function recordDecision(decision) {
|
|
|
82
82
|
}
|
|
83
83
|
async function recordDecisionToGraph(decision) {
|
|
84
84
|
try {
|
|
85
|
-
const { upsertNode, addEdge } = await import("./kumaGraph-
|
|
85
|
+
const { upsertNode, addEdge } = await import("./kumaGraph-UMXZNGYF.js");
|
|
86
86
|
const decisionId = `decision::${decision.title.replace(/[^a-zA-Z0-9_\-\s]/g, "").trim().replace(/\s+/g, "-")}`;
|
|
87
87
|
await upsertNode({
|
|
88
88
|
id: decisionId,
|
|
@@ -320,7 +320,7 @@ No unresolved issues.`;
|
|
|
320
320
|
*/
|
|
321
321
|
async autoTrackToDb(toolName, params, timestamp) {
|
|
322
322
|
try {
|
|
323
|
-
const { getDb, saveDb } = await import("./kumaDb-
|
|
323
|
+
const { getDb, saveDb } = await import("./kumaDb-4XZ5S2LH.js");
|
|
324
324
|
const db = await getDb();
|
|
325
325
|
db.run(
|
|
326
326
|
`INSERT INTO tool_calls (tool_name, params, success, duration_ms, created_at) VALUES (?, ?, 1, 0, ?)`,
|
|
@@ -605,7 +605,7 @@ No unresolved issues.`;
|
|
|
605
605
|
this.addModifiedFile(filePath);
|
|
606
606
|
}
|
|
607
607
|
try {
|
|
608
|
-
const { recordChange } = await import("./kumaDb-
|
|
608
|
+
const { recordChange } = await import("./kumaDb-4XZ5S2LH.js");
|
|
609
609
|
const gitHash = this.getGitHead();
|
|
610
610
|
await recordChange({ filePath, changeType, symbol, gitCommitHash: gitHash || void 0 });
|
|
611
611
|
} catch {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getDb,
|
|
3
3
|
saveDb
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-3BRBJZ7P.js";
|
|
5
5
|
import {
|
|
6
6
|
getProjectRoot
|
|
7
7
|
} from "./chunk-E2KFPEBT.js";
|
|
@@ -319,6 +319,144 @@ async function recordApiRoute(route, handler) {
|
|
|
319
319
|
await upsertNode({ id: handlerId, type: "function", name: handler });
|
|
320
320
|
await addEdge({ sourceId: routeId, targetId: handlerId, type: "routes" });
|
|
321
321
|
}
|
|
322
|
+
async function recordDomainFlow(params) {
|
|
323
|
+
let nodeCount = 0;
|
|
324
|
+
let edgeCount = 0;
|
|
325
|
+
try {
|
|
326
|
+
const domainId = nodeId("feature_domain", params.domain);
|
|
327
|
+
await upsertNode({
|
|
328
|
+
id: domainId,
|
|
329
|
+
type: "feature_domain",
|
|
330
|
+
name: params.domain,
|
|
331
|
+
metadata: {
|
|
332
|
+
hops: params.hops.length,
|
|
333
|
+
gotchas: params.gotchas?.length || 0,
|
|
334
|
+
decisions: params.decisions?.length || 0,
|
|
335
|
+
filePaths: params.filePaths || []
|
|
336
|
+
}
|
|
337
|
+
});
|
|
338
|
+
nodeCount++;
|
|
339
|
+
for (let i = 0; i < params.hops.length; i++) {
|
|
340
|
+
const hop = params.hops[i];
|
|
341
|
+
const fromId = nodeId("cross_service_link", `${params.domain}::${hop.from}`);
|
|
342
|
+
await upsertNode({
|
|
343
|
+
id: fromId,
|
|
344
|
+
type: "cross_service_link",
|
|
345
|
+
name: hop.from,
|
|
346
|
+
metadata: {
|
|
347
|
+
domain: params.domain,
|
|
348
|
+
relation: hop.relation,
|
|
349
|
+
description: hop.description || "",
|
|
350
|
+
hopIndex: i
|
|
351
|
+
}
|
|
352
|
+
});
|
|
353
|
+
nodeCount++;
|
|
354
|
+
const toId = nodeId("cross_service_link", `${params.domain}::${hop.to}`);
|
|
355
|
+
await upsertNode({
|
|
356
|
+
id: toId,
|
|
357
|
+
type: "cross_service_link",
|
|
358
|
+
name: hop.to,
|
|
359
|
+
metadata: {
|
|
360
|
+
domain: params.domain,
|
|
361
|
+
relation: hop.relation,
|
|
362
|
+
description: hop.description || "",
|
|
363
|
+
hopIndex: i
|
|
364
|
+
}
|
|
365
|
+
});
|
|
366
|
+
nodeCount++;
|
|
367
|
+
await addEdge({
|
|
368
|
+
sourceId: fromId,
|
|
369
|
+
targetId: toId,
|
|
370
|
+
type: "flows_through",
|
|
371
|
+
metadata: { relation: hop.relation, description: hop.description }
|
|
372
|
+
});
|
|
373
|
+
edgeCount++;
|
|
374
|
+
await addEdge({
|
|
375
|
+
sourceId: domainId,
|
|
376
|
+
targetId: fromId,
|
|
377
|
+
type: "contains",
|
|
378
|
+
metadata: { hopIndex: i }
|
|
379
|
+
});
|
|
380
|
+
edgeCount++;
|
|
381
|
+
await addEdge({
|
|
382
|
+
sourceId: domainId,
|
|
383
|
+
targetId: toId,
|
|
384
|
+
type: "contains",
|
|
385
|
+
metadata: { hopIndex: i }
|
|
386
|
+
});
|
|
387
|
+
edgeCount++;
|
|
388
|
+
}
|
|
389
|
+
if (params.gotchas) {
|
|
390
|
+
for (const gotcha of params.gotchas) {
|
|
391
|
+
const gotchaId = `gotcha::${params.domain}::${gotcha.substring(0, 40)}`;
|
|
392
|
+
try {
|
|
393
|
+
await upsertNode({
|
|
394
|
+
id: gotchaId,
|
|
395
|
+
type: "variable",
|
|
396
|
+
name: `gotcha:${gotcha.substring(0, 60)}`,
|
|
397
|
+
metadata: { domain: params.domain, gotcha, source: "arch_flow" }
|
|
398
|
+
});
|
|
399
|
+
nodeCount++;
|
|
400
|
+
await addEdge({
|
|
401
|
+
sourceId: domainId,
|
|
402
|
+
targetId: gotchaId,
|
|
403
|
+
type: "depends_on",
|
|
404
|
+
metadata: { type: "gotcha" }
|
|
405
|
+
});
|
|
406
|
+
edgeCount++;
|
|
407
|
+
} catch {
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
if (params.decisions) {
|
|
412
|
+
for (const decision of params.decisions) {
|
|
413
|
+
const decisionId = `decision::${params.domain}::${decision.substring(0, 40)}`;
|
|
414
|
+
try {
|
|
415
|
+
await upsertNode({
|
|
416
|
+
id: decisionId,
|
|
417
|
+
type: "variable",
|
|
418
|
+
name: `decision:${decision.substring(0, 60)}`,
|
|
419
|
+
metadata: { domain: params.domain, decision, source: "arch_flow" }
|
|
420
|
+
});
|
|
421
|
+
nodeCount++;
|
|
422
|
+
await addEdge({
|
|
423
|
+
sourceId: domainId,
|
|
424
|
+
targetId: decisionId,
|
|
425
|
+
type: "depends_on",
|
|
426
|
+
metadata: { type: "decision" }
|
|
427
|
+
});
|
|
428
|
+
edgeCount++;
|
|
429
|
+
} catch {
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
if (params.filePaths) {
|
|
434
|
+
for (const fp of params.filePaths) {
|
|
435
|
+
const fileId = nodeId("file", fp);
|
|
436
|
+
try {
|
|
437
|
+
await upsertNode({
|
|
438
|
+
id: fileId,
|
|
439
|
+
type: "file",
|
|
440
|
+
name: fp
|
|
441
|
+
});
|
|
442
|
+
nodeCount++;
|
|
443
|
+
await addEdge({
|
|
444
|
+
sourceId: domainId,
|
|
445
|
+
targetId: fileId,
|
|
446
|
+
type: "owns",
|
|
447
|
+
metadata: { domain: params.domain }
|
|
448
|
+
});
|
|
449
|
+
edgeCount++;
|
|
450
|
+
} catch {
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
return { nodeCount, edgeCount };
|
|
455
|
+
} catch (err) {
|
|
456
|
+
console.error(`[KumaGraph] Failed to record domain flow: ${err}`);
|
|
457
|
+
return { nodeCount, edgeCount };
|
|
458
|
+
}
|
|
459
|
+
}
|
|
322
460
|
async function queryGraph(params) {
|
|
323
461
|
try {
|
|
324
462
|
const db = await getDb();
|
|
@@ -353,7 +491,7 @@ Try a different search term or check if the graph has been built by using tools
|
|
|
353
491
|
""
|
|
354
492
|
];
|
|
355
493
|
for (const r of results) {
|
|
356
|
-
const typeEmoji = r.type === "function" ? "\u{1F527}" : r.type === "file" ? "\u{1F4C4}" : r.type === "test" ? "\u{1F9EA}" : r.type === "api_route" ? "\u{1F310}" : r.type === "db_table" ? "\u{1F5C4}\uFE0F" : r.type === "class" ? "\u{1F3D7}\uFE0F" : "\u{1F4CC}";
|
|
494
|
+
const typeEmoji = r.type === "function" ? "\u{1F527}" : r.type === "file" ? "\u{1F4C4}" : r.type === "test" ? "\u{1F9EA}" : r.type === "api_route" ? "\u{1F310}" : r.type === "db_table" ? "\u{1F5C4}\uFE0F" : r.type === "class" ? "\u{1F3D7}\uFE0F" : r.type === "feature_domain" ? "\u{1F3DB}\uFE0F" : r.type === "workflow" ? "\u{1F504}" : r.type === "cross_service_link" ? "\u{1F517}" : "\u{1F4CC}";
|
|
357
495
|
lines.push(`${typeEmoji} **${r.name}** (${r.type})`);
|
|
358
496
|
if (r.file_path) lines.push(` \u{1F4CD} ${r.file_path}`);
|
|
359
497
|
}
|
|
@@ -458,7 +596,7 @@ The two nodes may not be connected in the knowledge graph yet. Use more tools to
|
|
|
458
596
|
}
|
|
459
597
|
async function buildFromSessionMemory() {
|
|
460
598
|
try {
|
|
461
|
-
const { sessionMemory } = await import("./sessionMemory-
|
|
599
|
+
const { sessionMemory } = await import("./sessionMemory-YPKVIOMV.js");
|
|
462
600
|
const toolCalls = sessionMemory.getToolCallHistory(50);
|
|
463
601
|
let edgeCount = 0;
|
|
464
602
|
for (const call of toolCalls) {
|
|
@@ -757,7 +895,7 @@ async function getGraphStats() {
|
|
|
757
895
|
if (typeCounts.length > 0) {
|
|
758
896
|
lines.push("**Node Types:**");
|
|
759
897
|
for (const t of typeCounts) {
|
|
760
|
-
const emoji = t.type === "function" ? "\u{1F527}" : t.type === "file" ? "\u{1F4C4}" : t.type === "test" ? "\u{1F9EA}" : t.type === "api_route" ? "\u{1F310}" : t.type === "db_table" ? "\u{1F5C4}\uFE0F" : t.type === "class" ? "\u{1F3D7}\uFE0F" : "\u{1F4CC}";
|
|
898
|
+
const emoji = t.type === "function" ? "\u{1F527}" : t.type === "file" ? "\u{1F4C4}" : t.type === "test" ? "\u{1F9EA}" : t.type === "api_route" ? "\u{1F310}" : t.type === "db_table" ? "\u{1F5C4}\uFE0F" : t.type === "class" ? "\u{1F3D7}\uFE0F" : t.type === "feature_domain" ? "\u{1F3DB}\uFE0F" : t.type === "workflow" ? "\u{1F504}" : t.type === "cross_service_link" ? "\u{1F517}" : "\u{1F4CC}";
|
|
761
899
|
lines.push(` ${emoji} ${t.type}: ${t.cnt}`);
|
|
762
900
|
}
|
|
763
901
|
}
|
|
@@ -961,6 +1099,7 @@ export {
|
|
|
961
1099
|
recordImport,
|
|
962
1100
|
recordTestRelation,
|
|
963
1101
|
recordApiRoute,
|
|
1102
|
+
recordDomainFlow,
|
|
964
1103
|
queryGraph,
|
|
965
1104
|
buildFromSessionMemory,
|
|
966
1105
|
searchGraph,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getActiveGotchas
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-FKRSI5U5.js";
|
|
4
4
|
import {
|
|
5
5
|
sessionMemory
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-LVKOGXLC.js";
|
|
7
7
|
import {
|
|
8
8
|
getDb
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-3BRBJZ7P.js";
|
|
10
10
|
import {
|
|
11
11
|
getProjectRoot
|
|
12
12
|
} from "./chunk-E2KFPEBT.js";
|
package/dist/index.js
CHANGED
|
@@ -3,27 +3,27 @@ import {
|
|
|
3
3
|
auditStats,
|
|
4
4
|
queryAudit,
|
|
5
5
|
recordAudit
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-GFLSAXAH.js";
|
|
7
7
|
import {
|
|
8
8
|
ALL_CONFIG_TYPES,
|
|
9
9
|
formatInitResults,
|
|
10
10
|
runInit
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-ABKE45T4.js";
|
|
12
12
|
import {
|
|
13
13
|
formatDecisionTemplate,
|
|
14
14
|
getProactiveMemories,
|
|
15
15
|
recordDecision,
|
|
16
16
|
scoreMemoryRelevance
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-L7F67KUP.js";
|
|
18
18
|
import {
|
|
19
19
|
buildDriftMessages,
|
|
20
20
|
getGitDiffStat,
|
|
21
21
|
getSessionStats,
|
|
22
22
|
getUnresolvedCount
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-3OHYYXYN.js";
|
|
24
24
|
import {
|
|
25
25
|
sessionMemory
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-LVKOGXLC.js";
|
|
27
27
|
import {
|
|
28
28
|
analyzeImpact,
|
|
29
29
|
autoHeal,
|
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
getGraphStats,
|
|
35
35
|
searchGraph,
|
|
36
36
|
traceFlow
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-PRUTTZBS.js";
|
|
38
38
|
import {
|
|
39
39
|
addContextNote,
|
|
40
40
|
addSecurityFinding,
|
|
@@ -59,7 +59,7 @@ import {
|
|
|
59
59
|
saveResearchCache,
|
|
60
60
|
updateDecisionStatus,
|
|
61
61
|
updateTodoStatus
|
|
62
|
-
} from "./chunk-
|
|
62
|
+
} from "./chunk-3BRBJZ7P.js";
|
|
63
63
|
import {
|
|
64
64
|
getProjectRoot,
|
|
65
65
|
validateFilePath
|
|
@@ -240,8 +240,8 @@ async function handleInit(_params) {
|
|
|
240
240
|
lines.push(` \u{1F4DD} Modified: ${summary.modifiedFiles?.length || 0} file(s)`);
|
|
241
241
|
lines.push(` \u{1F6E0}\uFE0F Tool calls: ${summary.toolCallCount}`);
|
|
242
242
|
try {
|
|
243
|
-
const { computeSafetyScore, formatSafetyScore } = await import("./safetyScore-
|
|
244
|
-
const { saveHealthSnapshot: saveHealthSnapshot2 } = await import("./kumaDb-
|
|
243
|
+
const { computeSafetyScore, formatSafetyScore } = await import("./safetyScore-TMMRD2MV.js");
|
|
244
|
+
const { saveHealthSnapshot: saveHealthSnapshot2 } = await import("./kumaDb-4XZ5S2LH.js");
|
|
245
245
|
const score = await computeSafetyScore(_params.goal);
|
|
246
246
|
const checksStr = JSON.stringify(score.checks);
|
|
247
247
|
await saveHealthSnapshot2(score.score, score.risk, checksStr, score.summary);
|
|
@@ -336,7 +336,7 @@ async function handleResearch(params) {
|
|
|
336
336
|
lines.push(" \u26A0\uFE0F Graph query failed");
|
|
337
337
|
}
|
|
338
338
|
try {
|
|
339
|
-
const { scanCodebase } = await import("./kumaCodeScanner-
|
|
339
|
+
const { scanCodebase } = await import("./kumaCodeScanner-J6B2EHGI.js");
|
|
340
340
|
const scanResult = await scanCodebase({ scope, maxFiles: 100 });
|
|
341
341
|
if (scanResult.nodeCount > 0 || scanResult.edgeCount > 0) {
|
|
342
342
|
lines.push(` \u{1F52C} Auto-scanned ${scanResult.filesScanned} files \u2192 ${scanResult.nodeCount} nodes, ${scanResult.edgeCount} edges`);
|
|
@@ -422,8 +422,8 @@ async function handleResearches(_params) {
|
|
|
422
422
|
async function handleHealth(_params) {
|
|
423
423
|
sessionMemory.recordToolCall("kuma_context_health", {});
|
|
424
424
|
try {
|
|
425
|
-
const { computeSafetyScore, formatSafetyScore } = await import("./safetyScore-
|
|
426
|
-
const { saveHealthSnapshot: saveHealthSnapshot2 } = await import("./kumaDb-
|
|
425
|
+
const { computeSafetyScore, formatSafetyScore } = await import("./safetyScore-TMMRD2MV.js");
|
|
426
|
+
const { saveHealthSnapshot: saveHealthSnapshot2 } = await import("./kumaDb-4XZ5S2LH.js");
|
|
427
427
|
const score = await computeSafetyScore();
|
|
428
428
|
const checksStr = JSON.stringify(score.checks);
|
|
429
429
|
await saveHealthSnapshot2(score.score, score.risk, checksStr, score.summary);
|
|
@@ -450,8 +450,8 @@ async function handleSync(params) {
|
|
|
450
450
|
lines.push(` \u{1F6E0}\uFE0F Tool calls: ${summary.toolCallCount}`);
|
|
451
451
|
lines.push("");
|
|
452
452
|
try {
|
|
453
|
-
const { computeSafetyScore, formatSafetyScore } = await import("./safetyScore-
|
|
454
|
-
const { saveHealthSnapshot: saveHealthSnapshot2 } = await import("./kumaDb-
|
|
453
|
+
const { computeSafetyScore, formatSafetyScore } = await import("./safetyScore-TMMRD2MV.js");
|
|
454
|
+
const { saveHealthSnapshot: saveHealthSnapshot2 } = await import("./kumaDb-4XZ5S2LH.js");
|
|
455
455
|
const score = await computeSafetyScore(params.goal);
|
|
456
456
|
const checksStr = JSON.stringify(score.checks);
|
|
457
457
|
await saveHealthSnapshot2(score.score, score.risk, checksStr, score.summary);
|
|
@@ -462,14 +462,14 @@ async function handleSync(params) {
|
|
|
462
462
|
}
|
|
463
463
|
lines.push("");
|
|
464
464
|
try {
|
|
465
|
-
const { getGraphStats: getGraphStats2 } = await import("./kumaGraph-
|
|
465
|
+
const { getGraphStats: getGraphStats2 } = await import("./kumaGraph-UMXZNGYF.js");
|
|
466
466
|
lines.push("**Knowledge Graph**");
|
|
467
467
|
lines.push(await getGraphStats2());
|
|
468
468
|
} catch {
|
|
469
469
|
}
|
|
470
470
|
lines.push("");
|
|
471
471
|
try {
|
|
472
|
-
const { getProactiveMemories: getProactiveMemories2 } = await import("./kumaMemory-
|
|
472
|
+
const { getProactiveMemories: getProactiveMemories2 } = await import("./kumaMemory-FBJMV77G.js");
|
|
473
473
|
const memories = getProactiveMemories2();
|
|
474
474
|
if (memories) {
|
|
475
475
|
lines.push("**Relevant Memories**");
|
|
@@ -483,7 +483,7 @@ async function handleSync(params) {
|
|
|
483
483
|
}
|
|
484
484
|
async function handleVisualize(params) {
|
|
485
485
|
const scope = params.scope;
|
|
486
|
-
const { generateVisualizeReport } = await import("./kumaVisualize-
|
|
486
|
+
const { generateVisualizeReport } = await import("./kumaVisualize-264OEBGJ.js");
|
|
487
487
|
return await generateVisualizeReport({
|
|
488
488
|
scope,
|
|
489
489
|
type: "flowchart",
|
|
@@ -493,11 +493,11 @@ async function handleVisualize(params) {
|
|
|
493
493
|
async function handleDigest(_params) {
|
|
494
494
|
sessionMemory.recordToolCall("kuma_context_digest", {});
|
|
495
495
|
try {
|
|
496
|
-
const { generateContextDigest } = await import("./contextDigest-
|
|
496
|
+
const { generateContextDigest } = await import("./contextDigest-QB5XHPXE.js");
|
|
497
497
|
return await generateContextDigest();
|
|
498
498
|
} catch (err) {
|
|
499
499
|
try {
|
|
500
|
-
const { generateDigest } = await import("./domainRules-
|
|
500
|
+
const { generateDigest } = await import("./domainRules-QLPAQASB.js");
|
|
501
501
|
return generateDigest();
|
|
502
502
|
} catch {
|
|
503
503
|
return `Error generating digest: ${err}`;
|
|
@@ -507,7 +507,7 @@ async function handleDigest(_params) {
|
|
|
507
507
|
async function handleDrift(_params) {
|
|
508
508
|
sessionMemory.recordToolCall("kuma_context_drift", {});
|
|
509
509
|
try {
|
|
510
|
-
const { detectDrift, formatDriftReport, flagStaleRecords } = await import("./kumaDriftDetector-
|
|
510
|
+
const { detectDrift, formatDriftReport, flagStaleRecords } = await import("./kumaDriftDetector-TOORILSZ.js");
|
|
511
511
|
await flagStaleRecords();
|
|
512
512
|
const records = await detectDrift();
|
|
513
513
|
return formatDriftReport(records);
|
|
@@ -518,7 +518,7 @@ async function handleDrift(_params) {
|
|
|
518
518
|
async function handleProgressive(params) {
|
|
519
519
|
sessionMemory.recordToolCall("kuma_context_progressive", { scope: params.scope, section: params.section });
|
|
520
520
|
try {
|
|
521
|
-
const { getProgressiveContext, loadSection } = await import("./kumaProgressiveContext-
|
|
521
|
+
const { getProgressiveContext, loadSection } = await import("./kumaProgressiveContext-MWEDRXOH.js");
|
|
522
522
|
if (params.section) {
|
|
523
523
|
const validSections = ["domain_rules", "architecture", "gotchas", "decisions", "graph", "changes", "health"];
|
|
524
524
|
if (!validSections.includes(params.section)) {
|
|
@@ -734,7 +734,7 @@ async function handleDecision(params) {
|
|
|
734
734
|
case "template":
|
|
735
735
|
return formatDecisionTemplate();
|
|
736
736
|
case "suggest": {
|
|
737
|
-
const { shouldRecordDecision } = await import("./kumaMemory-
|
|
737
|
+
const { shouldRecordDecision } = await import("./kumaMemory-FBJMV77G.js");
|
|
738
738
|
const check = shouldRecordDecision();
|
|
739
739
|
return check.worth ? `\u{1F4A1} Decision suggested: "${check.title}"
|
|
740
740
|
Use kuma_memory({ action: 'decision', title: '...', context: '...', rationale: '...', outcome: '...' }) to record.` : "\u2705 No decision needed at this time.";
|
|
@@ -763,7 +763,7 @@ async function handleResearchSave(params) {
|
|
|
763
763
|
});
|
|
764
764
|
await saveResearchCache(scope, record, void 0, params.confidence);
|
|
765
765
|
try {
|
|
766
|
-
const { upsertNode, nodeId } = await import("./kumaGraph-
|
|
766
|
+
const { upsertNode, nodeId } = await import("./kumaGraph-UMXZNGYF.js");
|
|
767
767
|
await upsertNode({ id: nodeId("file", scope), type: "file", name: scope });
|
|
768
768
|
await upsertNode({
|
|
769
769
|
id: `research::${scope}`,
|
|
@@ -823,11 +823,11 @@ async function handleSearch(params) {
|
|
|
823
823
|
if (!query) return "\u26A0\uFE0F query or scope parameter required.";
|
|
824
824
|
const limit = params.limit || 20;
|
|
825
825
|
const memResults = sessionMemory.searchMemory(query, limit);
|
|
826
|
-
const { searchGraph: searchGraph2 } = await import("./kumaGraph-
|
|
826
|
+
const { searchGraph: searchGraph2 } = await import("./kumaGraph-UMXZNGYF.js");
|
|
827
827
|
const graphResults = await searchGraph2(query, Math.min(limit, 10));
|
|
828
828
|
let hybridResults = "";
|
|
829
829
|
try {
|
|
830
|
-
const { hybridSearch, formatHybridResults } = await import("./kumaSearch-
|
|
830
|
+
const { hybridSearch, formatHybridResults } = await import("./kumaSearch-PV4QTKE7.js");
|
|
831
831
|
const semanticResults = await hybridSearch(query, 8);
|
|
832
832
|
if (semanticResults.length > 0) {
|
|
833
833
|
hybridResults = "\n" + formatHybridResults(query, semanticResults);
|
|
@@ -911,7 +911,7 @@ async function handleDecisionLog(params) {
|
|
|
911
911
|
}
|
|
912
912
|
async function handleMine(params) {
|
|
913
913
|
sessionMemory.recordToolCall("kuma_memory_mine", { scope: params.scope });
|
|
914
|
-
const { mineHistoricalDecisions } = await import("./kumaMiner-
|
|
914
|
+
const { mineHistoricalDecisions } = await import("./kumaMiner-XJETL7TL.js");
|
|
915
915
|
return await mineHistoricalDecisions({
|
|
916
916
|
scope: params.scope,
|
|
917
917
|
since: typeof params.since === "string" ? params.since : void 0,
|
|
@@ -920,7 +920,45 @@ async function handleMine(params) {
|
|
|
920
920
|
});
|
|
921
921
|
}
|
|
922
922
|
async function handleLayerAction(layer, params) {
|
|
923
|
-
const { readLayer, writeLayer } = await import("./domainRules-
|
|
923
|
+
const { readLayer, writeLayer } = await import("./domainRules-QLPAQASB.js");
|
|
924
|
+
if (layer === "arch_flow" && params.content) {
|
|
925
|
+
const content = params.content;
|
|
926
|
+
const domainMatch = content.match(/domain\s*[:]\s*([^|\n]+)/i);
|
|
927
|
+
const hopsMatch = content.match(/hops\s*[:]\s*([^|\n]+)/i);
|
|
928
|
+
const gotchasMatch = content.match(/gotchas?\s*[:]\s*([^|\n]+)/i);
|
|
929
|
+
const decisionsMatch = content.match(/decisions?\s*[:]\s*([^|\n]+)/i);
|
|
930
|
+
const filesMatch = content.match(/files?\s*[:]\s*([^|\n]+)/i);
|
|
931
|
+
if (domainMatch) {
|
|
932
|
+
const domain = domainMatch[1].trim();
|
|
933
|
+
const hopsStr = hopsMatch ? hopsMatch[1].trim() : "";
|
|
934
|
+
const gotchasStr = gotchasMatch ? gotchasMatch[1].trim() : "";
|
|
935
|
+
const decisionsStr = decisionsMatch ? decisionsMatch[1].trim() : "";
|
|
936
|
+
const filesStr = filesMatch ? filesMatch[1].trim() : "";
|
|
937
|
+
const hops = hopsStr ? hopsStr.split("\u2192").map((h) => h.trim()).filter(Boolean).map((h, i, arr) => ({
|
|
938
|
+
from: i === 0 ? domain : arr[i - 1],
|
|
939
|
+
to: h,
|
|
940
|
+
relation: "flows",
|
|
941
|
+
description: h
|
|
942
|
+
})) : [];
|
|
943
|
+
const gotchas = gotchasStr ? gotchasStr.split(",").map((g) => g.trim()).filter(Boolean) : [];
|
|
944
|
+
const decisions = decisionsStr ? decisionsStr.split(",").map((d) => d.trim()).filter(Boolean) : [];
|
|
945
|
+
const filePaths = filesStr ? filesStr.split(",").map((f) => f.trim()).filter(Boolean) : [];
|
|
946
|
+
try {
|
|
947
|
+
const { recordDomainFlow } = await import("./kumaGraph-UMXZNGYF.js");
|
|
948
|
+
const flow = await recordDomainFlow({ domain, hops, gotchas, decisions, filePaths });
|
|
949
|
+
await writeLayer("arch_flow", content);
|
|
950
|
+
return `\u2705 Domain flow "${domain}" recorded \u2014 ${flow.nodeCount} nodes, ${flow.edgeCount} edges created.
|
|
951
|
+
\u{1F3DB}\uFE0F **Domain Anchor:** ${domain}
|
|
952
|
+
\u{1F504} **Hops:** ${hops.length}
|
|
953
|
+
\u26A0\uFE0F **Gotchas:** ${gotchas.length}
|
|
954
|
+
\u{1F4C1} **Files:** ${filePaths.length}`;
|
|
955
|
+
} catch (err) {
|
|
956
|
+
await writeLayer("arch_flow", content);
|
|
957
|
+
return `\u2705 Architecture flow saved (text only). Graph recording failed: ${err}`;
|
|
958
|
+
}
|
|
959
|
+
}
|
|
960
|
+
return writeLayer("arch_flow", content);
|
|
961
|
+
}
|
|
924
962
|
if (params.content) {
|
|
925
963
|
return writeLayer(layer, params.content);
|
|
926
964
|
}
|
|
@@ -928,7 +966,7 @@ async function handleLayerAction(layer, params) {
|
|
|
928
966
|
}
|
|
929
967
|
async function handleGotchaAction(params) {
|
|
930
968
|
if (params.content && params.scope) {
|
|
931
|
-
const { addGotcha } = await import("./kumaGotchas-
|
|
969
|
+
const { addGotcha } = await import("./kumaGotchas-XRGFFBTA.js");
|
|
932
970
|
return await addGotcha({
|
|
933
971
|
filePath: params.scope,
|
|
934
972
|
description: params.content,
|
|
@@ -936,7 +974,7 @@ async function handleGotchaAction(params) {
|
|
|
936
974
|
workaround: params.description
|
|
937
975
|
});
|
|
938
976
|
}
|
|
939
|
-
const { listGotchas, syncGotchasToDb } = await import("./kumaGotchas-
|
|
977
|
+
const { listGotchas, syncGotchasToDb } = await import("./kumaGotchas-XRGFFBTA.js");
|
|
940
978
|
await syncGotchasToDb();
|
|
941
979
|
return await listGotchas({
|
|
942
980
|
filePath: params.scope,
|
|
@@ -946,10 +984,10 @@ async function handleGotchaAction(params) {
|
|
|
946
984
|
async function handleFederated(params) {
|
|
947
985
|
sessionMemory.recordToolCall("kuma_memory_federated", { scope: params.scope, uri: params.uri });
|
|
948
986
|
if (params.uri) {
|
|
949
|
-
const { resolveFederatedNode } = await import("./kumaGraph-
|
|
987
|
+
const { resolveFederatedNode } = await import("./kumaGraph-UMXZNGYF.js");
|
|
950
988
|
return await resolveFederatedNode(params.uri);
|
|
951
989
|
}
|
|
952
|
-
const { listFederatedReferences } = await import("./kumaGraph-
|
|
990
|
+
const { listFederatedReferences } = await import("./kumaGraph-UMXZNGYF.js");
|
|
953
991
|
return await listFederatedReferences();
|
|
954
992
|
}
|
|
955
993
|
async function handleGenTest(params) {
|
|
@@ -957,21 +995,21 @@ async function handleGenTest(params) {
|
|
|
957
995
|
if (params.target) {
|
|
958
996
|
const id = parseInt(params.target, 10);
|
|
959
997
|
if (!isNaN(id)) {
|
|
960
|
-
const { generateTestFromTrajectoryId } = await import("./kumaTrajectory-
|
|
998
|
+
const { generateTestFromTrajectoryId } = await import("./kumaTrajectory-7NOAVNG2.js");
|
|
961
999
|
return await generateTestFromTrajectoryId(id);
|
|
962
1000
|
}
|
|
963
1001
|
}
|
|
964
|
-
const { listGeneratedTests } = await import("./kumaTrajectory-
|
|
1002
|
+
const { listGeneratedTests } = await import("./kumaTrajectory-7NOAVNG2.js");
|
|
965
1003
|
return await listGeneratedTests();
|
|
966
1004
|
}
|
|
967
1005
|
async function handleTrajectoryList(params) {
|
|
968
1006
|
sessionMemory.recordToolCall("kuma_memory_trajectory", {});
|
|
969
|
-
const { listTrajectories } = await import("./kumaTrajectory-
|
|
1007
|
+
const { listTrajectories } = await import("./kumaTrajectory-7NOAVNG2.js");
|
|
970
1008
|
return await listTrajectories(params.limit || 10);
|
|
971
1009
|
}
|
|
972
1010
|
async function handleSkillsList(_params) {
|
|
973
1011
|
sessionMemory.recordToolCall("kuma_memory_skills", {});
|
|
974
|
-
const { listDistilledSkills } = await import("./kumaTrajectory-
|
|
1012
|
+
const { listDistilledSkills } = await import("./kumaTrajectory-7NOAVNG2.js");
|
|
975
1013
|
return await listDistilledSkills();
|
|
976
1014
|
}
|
|
977
1015
|
async function handleAddNode(params) {
|
|
@@ -986,7 +1024,7 @@ async function handleAddNode(params) {
|
|
|
986
1024
|
return `\u26A0\uFE0F Invalid type "${type}". Valid types: ${validTypes.join(", ")}`;
|
|
987
1025
|
}
|
|
988
1026
|
try {
|
|
989
|
-
const { upsertNode, nodeId, addEdge } = await import("./kumaGraph-
|
|
1027
|
+
const { upsertNode, nodeId, addEdge } = await import("./kumaGraph-UMXZNGYF.js");
|
|
990
1028
|
const nodeIdStr = filePath ? `${type}::${filePath}::${name}` : nodeId(type, name);
|
|
991
1029
|
await upsertNode({
|
|
992
1030
|
id: nodeIdStr,
|
|
@@ -1008,7 +1046,7 @@ async function handleAddNode(params) {
|
|
|
1008
1046
|
}
|
|
1009
1047
|
}
|
|
1010
1048
|
async function handleLayersSummary(_params) {
|
|
1011
|
-
const { getLayersSummary } = await import("./domainRules-
|
|
1049
|
+
const { getLayersSummary } = await import("./domainRules-QLPAQASB.js");
|
|
1012
1050
|
return getLayersSummary();
|
|
1013
1051
|
}
|
|
1014
1052
|
|
|
@@ -2008,7 +2046,7 @@ async function handleLock(params) {
|
|
|
2008
2046
|
}
|
|
2009
2047
|
async function handleHealth2(_params) {
|
|
2010
2048
|
try {
|
|
2011
|
-
const { computeSafetyScore, formatSafetyScore } = await import("./safetyScore-
|
|
2049
|
+
const { computeSafetyScore, formatSafetyScore } = await import("./safetyScore-TMMRD2MV.js");
|
|
2012
2050
|
const score = await computeSafetyScore();
|
|
2013
2051
|
await saveHealthSnapshot(score.score, score.risk, JSON.stringify(score.checks), score.summary);
|
|
2014
2052
|
return formatSafetyScore(score);
|
|
@@ -2115,7 +2153,7 @@ async function handleClean(_params) {
|
|
|
2115
2153
|
async function handlePolicy(params) {
|
|
2116
2154
|
sessionMemory.recordToolCall("kuma_safety_policy", {});
|
|
2117
2155
|
if (params.command) {
|
|
2118
|
-
const { evaluateCommand, evaluateFilePath } = await import("./kumaPolicyEngine-
|
|
2156
|
+
const { evaluateCommand, evaluateFilePath } = await import("./kumaPolicyEngine-2QDJDLM7.js");
|
|
2119
2157
|
const commandVerdict = evaluateCommand(params.command);
|
|
2120
2158
|
const lines = [];
|
|
2121
2159
|
lines.push(`\u{1F4DC} **Policy Check**: ${commandVerdict.allowed ? "\u2705 Allowed" : "\u26D4 Blocked"}`);
|
|
@@ -2142,7 +2180,7 @@ async function handlePolicy(params) {
|
|
|
2142
2180
|
}
|
|
2143
2181
|
return lines.join("\n");
|
|
2144
2182
|
}
|
|
2145
|
-
const { formatPolicyStatus } = await import("./kumaPolicyEngine-
|
|
2183
|
+
const { formatPolicyStatus } = await import("./kumaPolicyEngine-2QDJDLM7.js");
|
|
2146
2184
|
return formatPolicyStatus();
|
|
2147
2185
|
}
|
|
2148
2186
|
async function handleAstValidation(params) {
|
|
@@ -2161,18 +2199,18 @@ async function handleAstValidation(params) {
|
|
|
2161
2199
|
async function handleCheckpoint(params) {
|
|
2162
2200
|
sessionMemory.recordToolCall("kuma_safety_checkpoint", { label: params.label });
|
|
2163
2201
|
if (!params.label) return "\u26A0\uFE0F label parameter required. Example: kuma_safety({ action: 'checkpoint', label: 'pre-feature-x' })";
|
|
2164
|
-
const { createCheckpoint } = await import("./kumaCheckpoint-
|
|
2202
|
+
const { createCheckpoint } = await import("./kumaCheckpoint-J2LDQMEO.js");
|
|
2165
2203
|
return await createCheckpoint(params.label, params.description);
|
|
2166
2204
|
}
|
|
2167
2205
|
async function handleRollbackLabel(params) {
|
|
2168
2206
|
sessionMemory.recordToolCall("kuma_safety_rollback_label", { label: params.label });
|
|
2169
2207
|
if (!params.label) return "\u26A0\uFE0F label parameter required. Example: kuma_safety({ action: 'rollback_label', label: 'pre-feature-x' })";
|
|
2170
|
-
const { rollbackToCheckpoint } = await import("./kumaCheckpoint-
|
|
2208
|
+
const { rollbackToCheckpoint } = await import("./kumaCheckpoint-J2LDQMEO.js");
|
|
2171
2209
|
return await rollbackToCheckpoint(params.label);
|
|
2172
2210
|
}
|
|
2173
2211
|
async function handleCheckpointList(_params) {
|
|
2174
2212
|
sessionMemory.recordToolCall("kuma_safety_checkpoint_list", {});
|
|
2175
|
-
const { listCheckpoints } = await import("./kumaCheckpoint-
|
|
2213
|
+
const { listCheckpoints } = await import("./kumaCheckpoint-J2LDQMEO.js");
|
|
2176
2214
|
return listCheckpoints();
|
|
2177
2215
|
}
|
|
2178
2216
|
async function handleContract(params) {
|
|
@@ -2201,7 +2239,7 @@ async function handleVerify(params) {
|
|
|
2201
2239
|
}
|
|
2202
2240
|
_lastVerifyCall = now;
|
|
2203
2241
|
sessionMemory.recordToolCall("kuma_safety_verify", { scope: params.scope || params.filePath });
|
|
2204
|
-
const { runAutoVerification } = await import("./kumaVerifier-
|
|
2242
|
+
const { runAutoVerification } = await import("./kumaVerifier-6YEGC77M.js");
|
|
2205
2243
|
return await runAutoVerification({
|
|
2206
2244
|
scope: params.scope || params.filePath,
|
|
2207
2245
|
force: params.force,
|
|
@@ -2414,7 +2452,7 @@ async function main() {
|
|
|
2414
2452
|
console.error("");
|
|
2415
2453
|
let killedCount = 0;
|
|
2416
2454
|
try {
|
|
2417
|
-
const { getRunningVerificationPid } = await import("./kumaVerifier-
|
|
2455
|
+
const { getRunningVerificationPid } = await import("./kumaVerifier-6YEGC77M.js");
|
|
2418
2456
|
const pid = getRunningVerificationPid();
|
|
2419
2457
|
if (pid) {
|
|
2420
2458
|
try {
|
|
@@ -2623,7 +2661,7 @@ async function main() {
|
|
|
2623
2661
|
});
|
|
2624
2662
|
(async () => {
|
|
2625
2663
|
try {
|
|
2626
|
-
const { generateInitMdContent } = await import("./init-
|
|
2664
|
+
const { generateInitMdContent } = await import("./init-PL4XL662.js");
|
|
2627
2665
|
const fs7 = await import("fs");
|
|
2628
2666
|
const path7 = await import("path");
|
|
2629
2667
|
const initMdPath = path7.resolve(process.cwd(), ".kuma/init.md");
|
|
@@ -2681,7 +2719,7 @@ async function main() {
|
|
|
2681
2719
|
console.error(`[${SERVER_NAME}] \u2705 Restored session (${sessionInfo.toolCallCount} previous tool calls)`);
|
|
2682
2720
|
}
|
|
2683
2721
|
try {
|
|
2684
|
-
const { buildFromSessionMemory } = await import("./kumaGraph-
|
|
2722
|
+
const { buildFromSessionMemory } = await import("./kumaGraph-UMXZNGYF.js");
|
|
2685
2723
|
const edgeCount = await buildFromSessionMemory();
|
|
2686
2724
|
if (edgeCount > 0) {
|
|
2687
2725
|
console.error(`[${SERVER_NAME}] \u2705 Graph auto-populated with ${edgeCount} entries from session memory`);
|
|
@@ -2701,7 +2739,7 @@ async function main() {
|
|
|
2701
2739
|
console.error(`[${SERVER_NAME}] \u26A0\uFE0F Scratch directory setup: ${err}`);
|
|
2702
2740
|
}
|
|
2703
2741
|
try {
|
|
2704
|
-
const { getDb: getDb2, saveDb } = await import("./kumaDb-
|
|
2742
|
+
const { getDb: getDb2, saveDb } = await import("./kumaDb-4XZ5S2LH.js");
|
|
2705
2743
|
const db = await getDb2();
|
|
2706
2744
|
db.run(
|
|
2707
2745
|
`INSERT INTO sessions (started_at, goal, tool_calls) VALUES (?, ?, ?)`,
|
|
@@ -2741,7 +2779,7 @@ fi
|
|
|
2741
2779
|
console.error(`[${SERVER_NAME}] \u26A0\uFE0F Auto-capture hook setup: ${err}`);
|
|
2742
2780
|
}
|
|
2743
2781
|
try {
|
|
2744
|
-
const { buildSearchVectors } = await import("./kumaSearch-
|
|
2782
|
+
const { buildSearchVectors } = await import("./kumaSearch-PV4QTKE7.js");
|
|
2745
2783
|
const vectors = await buildSearchVectors();
|
|
2746
2784
|
if (vectors.length > 0) {
|
|
2747
2785
|
console.error(`[${SERVER_NAME}] \u2705 Search vector cache pre-warmed (${vectors.length} documents)`);
|
|
@@ -2,14 +2,14 @@ import {
|
|
|
2
2
|
appendToLayer,
|
|
3
3
|
checkFileGotchas,
|
|
4
4
|
getActiveGotchas
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-FKRSI5U5.js";
|
|
6
6
|
import {
|
|
7
7
|
sessionMemory
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-LVKOGXLC.js";
|
|
9
9
|
import {
|
|
10
10
|
getDb,
|
|
11
11
|
saveDb
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-3BRBJZ7P.js";
|
|
13
13
|
import "./chunk-E2KFPEBT.js";
|
|
14
14
|
|
|
15
15
|
// src/engine/kumaGotchas.ts
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
nodeId,
|
|
10
10
|
queryGraph,
|
|
11
11
|
recordApiRoute,
|
|
12
|
+
recordDomainFlow,
|
|
12
13
|
recordFileDefinition,
|
|
13
14
|
recordFunctionCall,
|
|
14
15
|
recordImport,
|
|
@@ -17,8 +18,8 @@ import {
|
|
|
17
18
|
searchGraph,
|
|
18
19
|
traceFlow,
|
|
19
20
|
upsertNode
|
|
20
|
-
} from "./chunk-
|
|
21
|
-
import "./chunk-
|
|
21
|
+
} from "./chunk-PRUTTZBS.js";
|
|
22
|
+
import "./chunk-3BRBJZ7P.js";
|
|
22
23
|
import "./chunk-E2KFPEBT.js";
|
|
23
24
|
export {
|
|
24
25
|
addEdge,
|
|
@@ -31,6 +32,7 @@ export {
|
|
|
31
32
|
nodeId,
|
|
32
33
|
queryGraph,
|
|
33
34
|
recordApiRoute,
|
|
35
|
+
recordDomainFlow,
|
|
34
36
|
recordFileDefinition,
|
|
35
37
|
recordFunctionCall,
|
|
36
38
|
recordImport,
|
|
@@ -4,8 +4,8 @@ import {
|
|
|
4
4
|
recordDecision,
|
|
5
5
|
scoreMemoryRelevance,
|
|
6
6
|
shouldRecordDecision
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-L7F67KUP.js";
|
|
8
|
+
import "./chunk-LVKOGXLC.js";
|
|
9
9
|
import "./chunk-E2KFPEBT.js";
|
|
10
10
|
export {
|
|
11
11
|
formatDecisionTemplate,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
recordDecision
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-L7F67KUP.js";
|
|
4
|
+
import "./chunk-LVKOGXLC.js";
|
|
5
5
|
import {
|
|
6
6
|
recordDecisionLog
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-3BRBJZ7P.js";
|
|
8
8
|
import "./chunk-E2KFPEBT.js";
|
|
9
9
|
|
|
10
10
|
// src/engine/kumaMiner.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
sessionMemory
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-LVKOGXLC.js";
|
|
4
4
|
import {
|
|
5
5
|
getProjectRoot
|
|
6
6
|
} from "./chunk-E2KFPEBT.js";
|
|
@@ -215,7 +215,7 @@ function evaluateDatabaseAction(action) {
|
|
|
215
215
|
};
|
|
216
216
|
}
|
|
217
217
|
async function processOverride(request) {
|
|
218
|
-
const { recordAudit } = await import("./safetyAudit-
|
|
218
|
+
const { recordAudit } = await import("./safetyAudit-O45SPNTS.js");
|
|
219
219
|
await recordAudit({
|
|
220
220
|
timestamp: Math.floor(Date.now() / 1e3),
|
|
221
221
|
toolName: request.toolName,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getActiveGotchas,
|
|
3
3
|
readLayer
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-FKRSI5U5.js";
|
|
5
|
+
import "./chunk-LVKOGXLC.js";
|
|
6
6
|
import {
|
|
7
7
|
getDb
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-3BRBJZ7P.js";
|
|
9
9
|
import {
|
|
10
10
|
getProjectRoot
|
|
11
11
|
} from "./chunk-E2KFPEBT.js";
|
|
@@ -155,7 +155,7 @@ ${lines.join("\n")}`;
|
|
|
155
155
|
}
|
|
156
156
|
case "health": {
|
|
157
157
|
try {
|
|
158
|
-
const { computeSafetyScore } = await import("./safetyScore-
|
|
158
|
+
const { computeSafetyScore } = await import("./safetyScore-TMMRD2MV.js");
|
|
159
159
|
const score = await computeSafetyScore();
|
|
160
160
|
return `\u{1F3E5} **Health**: ${score.score}/100 (${score.risk})`;
|
|
161
161
|
} catch {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
sessionMemory
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-LVKOGXLC.js";
|
|
4
4
|
import {
|
|
5
5
|
getLatestVerifications,
|
|
6
6
|
saveVerification
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-3BRBJZ7P.js";
|
|
8
8
|
import "./chunk-E2KFPEBT.js";
|
|
9
9
|
|
|
10
10
|
// src/engine/kumaVerifier.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getDb
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-3BRBJZ7P.js";
|
|
4
4
|
import "./chunk-E2KFPEBT.js";
|
|
5
5
|
|
|
6
6
|
// src/engine/kumaVisualize.ts
|
|
@@ -181,6 +181,15 @@ function getNodeShape(type) {
|
|
|
181
181
|
return "[";
|
|
182
182
|
case "variable":
|
|
183
183
|
return "(";
|
|
184
|
+
// Domain Flow shapes (V4)
|
|
185
|
+
case "feature_domain":
|
|
186
|
+
return "[";
|
|
187
|
+
// box with rounded corners
|
|
188
|
+
case "workflow":
|
|
189
|
+
return "([";
|
|
190
|
+
// stadium shape
|
|
191
|
+
case "cross_service_link":
|
|
192
|
+
return "[";
|
|
184
193
|
default:
|
|
185
194
|
return "[";
|
|
186
195
|
}
|
|
@@ -218,6 +227,13 @@ function getEdgeStyle(type) {
|
|
|
218
227
|
return " --- ";
|
|
219
228
|
case "modified_by":
|
|
220
229
|
return " -.-> ";
|
|
230
|
+
// Domain Flow edge styles (V4)
|
|
231
|
+
case "flows_through":
|
|
232
|
+
return " ==> ";
|
|
233
|
+
case "triggers":
|
|
234
|
+
return " -.-> ";
|
|
235
|
+
case "syncs_with":
|
|
236
|
+
return " <==> ";
|
|
221
237
|
default:
|
|
222
238
|
return " --- ";
|
|
223
239
|
}
|
|
@@ -2,10 +2,10 @@ import {
|
|
|
2
2
|
getGitDiffStat,
|
|
3
3
|
getSessionStats,
|
|
4
4
|
getUnresolvedCount
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-3OHYYXYN.js";
|
|
6
6
|
import {
|
|
7
7
|
sessionMemory
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-LVKOGXLC.js";
|
|
9
9
|
import "./chunk-E2KFPEBT.js";
|
|
10
10
|
|
|
11
11
|
// src/engine/safetyScore.ts
|
|
@@ -60,7 +60,7 @@ async function computeSafetyScore(inputGoal) {
|
|
|
60
60
|
totalScore += 20;
|
|
61
61
|
}
|
|
62
62
|
try {
|
|
63
|
-
const { getDb } = await import("./kumaDb-
|
|
63
|
+
const { getDb } = await import("./kumaDb-4XZ5S2LH.js");
|
|
64
64
|
const db = await getDb();
|
|
65
65
|
const nodeCount = db.exec("SELECT COUNT(*) as c FROM nodes")[0]?.values[0][0] ?? 0;
|
|
66
66
|
const edgeCount = db.exec("SELECT COUNT(*) as c FROM edges")[0]?.values[0][0] ?? 0;
|
|
@@ -91,7 +91,7 @@ async function computeSafetyScore(inputGoal) {
|
|
|
91
91
|
totalScore += 5;
|
|
92
92
|
}
|
|
93
93
|
try {
|
|
94
|
-
const { getDb } = await import("./kumaDb-
|
|
94
|
+
const { getDb } = await import("./kumaDb-4XZ5S2LH.js");
|
|
95
95
|
const db = await getDb();
|
|
96
96
|
const researchCount = db.exec("SELECT COUNT(*) as c FROM research_cache")[0]?.values[0][0] ?? 0;
|
|
97
97
|
checks.push({
|
|
@@ -116,7 +116,7 @@ async function computeSafetyScore(inputGoal) {
|
|
|
116
116
|
const hasRunTests = stats.hasRunTests;
|
|
117
117
|
let latestVerif = null;
|
|
118
118
|
try {
|
|
119
|
-
const { getLatestVerifications } = await import("./kumaDb-
|
|
119
|
+
const { getLatestVerifications } = await import("./kumaDb-4XZ5S2LH.js");
|
|
120
120
|
const verifs = await getLatestVerifications(1);
|
|
121
121
|
if (verifs.length > 0) latestVerif = verifs[0];
|
|
122
122
|
} catch {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plumpslabs/kuma",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.19",
|
|
4
4
|
"description": "Safety-first context & orchestration engine for AI coding agents. MCP server with mandatory research pipeline, knowledge graph, impact analysis, decision memory, and safety guard — works with any MCP client.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|