@echomem/mcp 1.4.7 → 1.4.9

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.
Files changed (46) hide show
  1. package/README.md +35 -9
  2. package/assets/canonical-scorer/README.md +18 -0
  3. package/assets/canonical-scorer/analyze-10-problems.mjs +857 -0
  4. package/assets/canonical-scorer/build-session-waste-dashboard.mjs +1628 -0
  5. package/assets/canonical-scorer/golden_anchors.mjs +83 -0
  6. package/assets/canonical-scorer/optimizable_detail.mjs +633 -0
  7. package/assets/hud/claude.svg +1 -0
  8. package/assets/hud/codex.svg +1 -0
  9. package/assets/hud/session-viewer.html +35 -0
  10. package/dist/city/chaos-to-clarity-pencil.html +582 -0
  11. package/dist/city/echo-ai-city-only.html +1126 -109
  12. package/dist/city/echo-ai-city-only.template.html +1126 -109
  13. package/dist/city/echo-face-cutout.png +0 -0
  14. package/dist/city/pencil-pie-generator.html +883 -0
  15. package/dist/city/pencil-webgl-landscape.html +1239 -0
  16. package/dist/city/spatial-fan-story.html +479 -0
  17. package/dist/codex-session-files.js +283 -0
  18. package/dist/codex-sync.js +7 -2
  19. package/dist/context-analysis/canonical-golden.js +47 -0
  20. package/dist/context-analysis/claude-native-canonical.js +1193 -0
  21. package/dist/context-analysis/vendored-canonical.js +793 -0
  22. package/dist/context-analysis/workspace-report.js +1838 -0
  23. package/dist/context-metrics/calculate.js +56 -0
  24. package/dist/context-metrics/model-limits.js +26 -0
  25. package/dist/context-metrics/types.js +1 -0
  26. package/dist/forensics-10-problems.js +7 -6
  27. package/dist/forensics.js +863 -132
  28. package/dist/hud/adapters.js +8 -4
  29. package/dist/hud/autostart.js +66 -0
  30. package/dist/hud/cli.js +31 -0
  31. package/dist/hud/electron-main.js +182 -19
  32. package/dist/hud/metric.js +13 -4
  33. package/dist/hud/monitor.js +171 -84
  34. package/dist/hud/preload.cjs +3 -0
  35. package/dist/hud/server.js +321 -4
  36. package/dist/hud/web.js +880 -270
  37. package/dist/index.js +122 -24
  38. package/dist/local-data-paths.js +87 -0
  39. package/dist/migrate.js +55 -29
  40. package/dist/report.js +101 -40
  41. package/dist/setup-page.js +4257 -245
  42. package/dist/setup-preview.js +245 -0
  43. package/dist/setup.js +786 -75
  44. package/dist/v1-contract.js +20 -2
  45. package/package.json +6 -4
  46. package/templates/echomem-recall.md +2 -2
@@ -0,0 +1,83 @@
1
+ export function chooseGroundTruthAnchors({ commitTurns, commitMessages = new Map(), userMessages = new Map(), userTurns = [] }) {
2
+ const commits = [...new Set(commitTurns || [])].sort((a, b) => a - b);
3
+ if (commits.length) {
4
+ const anchors = commits.map((turn) => ({
5
+ turn,
6
+ kind: "commit",
7
+ label: commitMessages.get(turn) || `commit @T${turn}`,
8
+ confidence: 1
9
+ }));
10
+ return packAnchors(anchors, "commit");
11
+ }
12
+
13
+ const positive = userTurns
14
+ .filter((turn) => isStrongPositiveFeedback(userMessages.get(turn) || ""))
15
+ .map((turn) => ({
16
+ turn,
17
+ kind: "positive-user-feedback",
18
+ label: summarizeUserAnchor(userMessages.get(turn) || `positive feedback @T${turn}`),
19
+ confidence: 0.8
20
+ }));
21
+ if (positive.length) return packAnchors(positive, "positive-user-feedback");
22
+
23
+ const lastTurn = userTurns[userTurns.length - 1];
24
+ if (lastTurn) {
25
+ return packAnchors([{
26
+ turn: lastTurn,
27
+ kind: "final-fallback",
28
+ label: summarizeUserAnchor(userMessages.get(lastTurn) || `final fallback @T${lastTurn}`),
29
+ confidence: 0.35
30
+ }], "final-fallback");
31
+ }
32
+
33
+ return packAnchors([], "none");
34
+ }
35
+
36
+ export function isStrongPositiveFeedback(message) {
37
+ const text = normalize(message);
38
+ if (!text) return false;
39
+ if (/\b(no|not|wrong|incorrect|fix|bad|worse|broken|laggy|shaking|remove|revert|don't|do not|doesn't|does not|didn't|did not|isn't|is not)\b/.test(text)) {
40
+ if (!/\b(save this|looks good|perfect|exactly what i want|that's what i want|that is what i want)\b/.test(text)) return false;
41
+ }
42
+
43
+ return [
44
+ /\blooks? good\b/,
45
+ /\bthis is good\b/,
46
+ /\bcaveat font is good\b/,
47
+ /\bperfect\b/,
48
+ /\bthis is exactly\b/,
49
+ /\bthat's exactly\b/,
50
+ /\bthat is exactly\b/,
51
+ /\bexactly what i want\b/,
52
+ /\bthat's what i want\b/,
53
+ /\bthat is what i want\b/,
54
+ /\bwhat i want\b/,
55
+ /\byes[,.\s].*\blet'?s do it\b/,
56
+ /\bok[,.\s].*\blet'?s do it\b/,
57
+ /\blet'?s do it\b/,
58
+ /\bsave this\b/,
59
+ /\bship it\b/,
60
+ /\bapproved\b/
61
+ ].some((pattern) => pattern.test(text));
62
+ }
63
+
64
+ export function summarizeUserAnchor(message, max = 82) {
65
+ const flat = String(message || "").replace(/\s+/g, " ").trim();
66
+ if (flat.length <= max) return flat;
67
+ return `${flat.slice(0, max - 1).trim()}...`;
68
+ }
69
+
70
+ function packAnchors(anchors, source) {
71
+ const turns = anchors.map((anchor) => anchor.turn);
72
+ const byTurn = new Map(anchors.map((anchor) => [anchor.turn, anchor]));
73
+ const labelByTurn = new Map(anchors.map((anchor) => [anchor.turn, anchor.label]));
74
+ return { source, anchors, turns, byTurn, labelByTurn };
75
+ }
76
+
77
+ function normalize(value) {
78
+ return String(value || "")
79
+ .toLowerCase()
80
+ .replace(/[’]/g, "'")
81
+ .replace(/\s+/g, " ")
82
+ .trim();
83
+ }