wyrm-mcp 6.8.0 → 6.8.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/dist/index.js +75 -0
- package/dist/index.js.map +1 -1
- package/dist/migrations.d.ts.map +1 -1
- package/dist/migrations.js +21 -1
- package/dist/migrations.js.map +1 -1
- package/dist/wyrm-ui.d.ts +8 -3
- package/dist/wyrm-ui.d.ts.map +1 -1
- package/dist/wyrm-ui.js +31 -20
- package/dist/wyrm-ui.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -443,6 +443,81 @@ const internalDispatch = async (name, args) => {
|
|
|
443
443
|
};
|
|
444
444
|
return { ok: true, result: ctx };
|
|
445
445
|
}
|
|
446
|
+
// ── Memory ops the OODA loop is whitelisted for (SAFE_INTERNAL_TOOLS).
|
|
447
|
+
// These were promised by the whitelist but had no dispatch case until 6.8.1,
|
|
448
|
+
// so the loop silently failed on them. Kept in lockstep by
|
|
449
|
+
// tests/tool-surface-integrity.test.ts.
|
|
450
|
+
case 'wyrm_global_context': {
|
|
451
|
+
const a = args;
|
|
452
|
+
const projects = db.getAllProjects(a.maxProjects ?? 20).map((p) => ({
|
|
453
|
+
name: p.name, stack: p.stack ?? null, stats: db.getProjectStats(p.id),
|
|
454
|
+
}));
|
|
455
|
+
const result = { globalContext: db.getAllGlobalContext(), projects };
|
|
456
|
+
if (a.includeQuests)
|
|
457
|
+
result.quests = db.getAllPendingQuests().slice(0, 20);
|
|
458
|
+
return { ok: true, result };
|
|
459
|
+
}
|
|
460
|
+
case 'wyrm_recall': {
|
|
461
|
+
const a = args;
|
|
462
|
+
const proj = a.projectPath ? db.getProject(a.projectPath) : null;
|
|
463
|
+
if (!proj)
|
|
464
|
+
return { ok: false, error: 'project not found' };
|
|
465
|
+
if (!a.query)
|
|
466
|
+
return { ok: false, error: 'query required' };
|
|
467
|
+
const results = memory.recall(proj.id, a.query, { kind: a.kind, limit: Math.min(20, a.limit ?? 10), minConfidence: a.minConfidence });
|
|
468
|
+
return { ok: true, result: results.map((r) => ({ id: r.artifact.id, kind: r.artifact.kind, problem: r.artifact.problem, validated_fix: r.artifact.validated_fix, relevance: r.relevance_score })) };
|
|
469
|
+
}
|
|
470
|
+
case 'wyrm_remember': {
|
|
471
|
+
const a = args;
|
|
472
|
+
const proj = a.projectPath ? db.getProject(a.projectPath) : null;
|
|
473
|
+
if (!proj)
|
|
474
|
+
return { ok: false, error: 'project not found' };
|
|
475
|
+
if (!a.problem)
|
|
476
|
+
return { ok: false, error: 'problem required' };
|
|
477
|
+
const art = memory.add(proj.id, { kind: a.kind, problem: a.problem, constraints: a.constraints, validatedFix: a.validatedFix, whyItWorked: a.whyItWorked, outcome: a.outcome, tags: a.tags, confidence: a.confidence, sourceSessionId: a.sourceSessionId });
|
|
478
|
+
return { ok: true, result: { id: art.id, kind: art.kind } };
|
|
479
|
+
}
|
|
480
|
+
case 'wyrm_distill': {
|
|
481
|
+
const a = args;
|
|
482
|
+
const proj = a.projectPath ? db.getProject(a.projectPath) : null;
|
|
483
|
+
if (!proj)
|
|
484
|
+
return { ok: false, error: 'project not found' };
|
|
485
|
+
if (!a.candidates?.length)
|
|
486
|
+
return { ok: false, error: 'candidates required' };
|
|
487
|
+
const ids = a.candidates.map((c) => memory.add(proj.id, { kind: c.kind, problem: c.title, validatedFix: c.content, tags: c.tags ?? [], confidence: c.confidence ?? 0.7, needsReview: 1 }).id);
|
|
488
|
+
return { ok: true, result: { queued: ids.length, ids } };
|
|
489
|
+
}
|
|
490
|
+
case 'wyrm_capture': {
|
|
491
|
+
const a = args;
|
|
492
|
+
if (!a.content)
|
|
493
|
+
return { ok: false, error: 'content required' };
|
|
494
|
+
let cls = classifyCapture(a.content);
|
|
495
|
+
if (a.mode && a.mode !== 'auto') {
|
|
496
|
+
const sub = { quest: 'quest', truth: 'decision', memory: 'pattern' };
|
|
497
|
+
cls = { type: a.mode, subtype: sub[a.mode] ?? a.mode, confidence: 100, reasoning: `mode:${a.mode}` };
|
|
498
|
+
}
|
|
499
|
+
const pid = a.project_id ?? null;
|
|
500
|
+
if (cls.type === 'quest') {
|
|
501
|
+
if (pid === null)
|
|
502
|
+
return { ok: false, error: 'project_id required for quest' };
|
|
503
|
+
const q = db.addQuest(pid, a.content.slice(0, 200), '', 'medium', a.tags?.join(','));
|
|
504
|
+
return { ok: true, result: { type: 'quest', id: q.id } };
|
|
505
|
+
}
|
|
506
|
+
if (cls.type === 'truth') {
|
|
507
|
+
if (pid === null)
|
|
508
|
+
return { ok: false, error: 'project_id required for truth' };
|
|
509
|
+
if (a.mode === 'truth' || cls.confidence >= 100) {
|
|
510
|
+
const t = groundTruths.set(pid, { category: 'decision', key: a.content.slice(0, 60), value: a.content });
|
|
511
|
+
return { ok: true, result: { type: 'truth', id: t.id } };
|
|
512
|
+
}
|
|
513
|
+
const art = memory.add(pid, { kind: 'pattern', problem: a.content, tags: a.tags ?? [], confidence: cls.confidence / 100, needsReview: 1 });
|
|
514
|
+
return { ok: true, result: { type: 'memory_review', id: art.id } };
|
|
515
|
+
}
|
|
516
|
+
if (pid === null)
|
|
517
|
+
return { ok: false, error: 'project_id required for memory' };
|
|
518
|
+
const art = memory.add(pid, { kind: 'pattern', problem: a.content, tags: a.tags ?? [], confidence: (cls.confidence ?? 70) / 100, needsReview: 1 });
|
|
519
|
+
return { ok: true, result: { type: 'memory', id: art.id } };
|
|
520
|
+
}
|
|
446
521
|
default:
|
|
447
522
|
return { ok: false, error: `Internal tool '${name}' not implemented in dispatcher` };
|
|
448
523
|
}
|