sigrank 0.0.177 → 0.0.179

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 (72) hide show
  1. package/CHANGELOG.md +100 -0
  2. package/MCP_SERVER_DESCRIPTION.md +141 -0
  3. package/README.md +23 -3
  4. package/adapters/index.mjs +865 -0
  5. package/adapters/tokenpull.mjs +576 -0
  6. package/adapters.mjs +1 -750
  7. package/analytics/cascade.mjs +274 -0
  8. package/cascade.mjs +1 -274
  9. package/cli.mjs +1 -1850
  10. package/connect.mjs +1 -13
  11. package/identity/connect.mjs +13 -0
  12. package/identity/keystore.mjs +242 -0
  13. package/identity/sign.mjs +106 -0
  14. package/index.mjs +30 -148
  15. package/keystore.mjs +1 -242
  16. package/narrate.mjs +1 -77
  17. package/package.json +31 -15
  18. package/preflight.mjs +1 -191
  19. package/presentation/cli.mjs +1874 -0
  20. package/presentation/narrate.mjs +77 -0
  21. package/presentation/tui.mjs +2668 -0
  22. package/prompts/check-my-efficiency.md +1 -0
  23. package/prompts/compare-with-leader.md +1 -0
  24. package/prompts/simulate-improvement.md +1 -0
  25. package/resources/class-tiers.md +23 -0
  26. package/resources/data-policy.md +27 -0
  27. package/resources/install-guide.md +59 -0
  28. package/resources/privacy-model.md +30 -0
  29. package/resources/scoring-formula.md +28 -0
  30. package/review.mjs +263 -0
  31. package/sign.mjs +1 -106
  32. package/submit/index.mjs +309 -0
  33. package/submit/preflight.mjs +191 -0
  34. package/submit.mjs +1 -303
  35. package/tokenpull.mjs +1 -584
  36. package/tools/_framing.mjs +139 -0
  37. package/tools/_helpers.mjs +258 -0
  38. package/tools/_report.mjs +262 -0
  39. package/tools/_schemas.mjs +394 -0
  40. package/tools/_verifiers.mjs +148 -0
  41. package/tools/compare-operators.mjs +79 -0
  42. package/tools/compare-self.mjs +122 -0
  43. package/tools/describe-power-user.mjs +68 -0
  44. package/tools/diagnose-cascade.mjs +192 -0
  45. package/tools/enroll.mjs +121 -0
  46. package/tools/get-best-operator.mjs +58 -0
  47. package/tools/get-leaderboard.mjs +26 -0
  48. package/tools/get-operator.mjs +33 -0
  49. package/tools/index.mjs +257 -0
  50. package/tools/optimize-efficiency.mjs +160 -0
  51. package/tools/rank-paste.mjs +51 -0
  52. package/tools/rank-windows.mjs +120 -0
  53. package/tools/self-improve.mjs +423 -0
  54. package/tools/simulate-change.mjs +207 -0
  55. package/tools/submit-paste.mjs +118 -0
  56. package/tools/submit-verified.mjs +153 -0
  57. package/tools/suggest-improvements.mjs +168 -0
  58. package/tools/tokenpull-compare.mjs +123 -0
  59. package/tools/tokenpull-submit.mjs +234 -0
  60. package/tools/tokenpull.mjs +113 -0
  61. package/tools/tokscale-breakdown.mjs +159 -0
  62. package/tools/tokscale-competitive-intel.mjs +45 -0
  63. package/tools/tokscale-cost-analysis.mjs +31 -0
  64. package/tools/tokscale-developer-profile.mjs +36 -0
  65. package/tools/tokscale-device-profile.mjs +35 -0
  66. package/tools/tokscale-market-share.mjs +38 -0
  67. package/tools/tokscale-mcp-usage.mjs +33 -0
  68. package/tools/tokscale-model-trends.mjs +32 -0
  69. package/tools/watch-tokenpull.mjs +134 -0
  70. package/tools.mjs +1 -3385
  71. package/tui.mjs +4 -2650
  72. package/banner.svg +0 -7
@@ -0,0 +1,77 @@
1
+ /**
2
+ * narrate.mjs — deterministic prose "card" for a cascade result.
3
+ *
4
+ * Port of _template() from ~/Desktop/moses-sigrank/narrate.py. The model path
5
+ * (MiniCPM4-0.5B) is intentionally SKIPPED: the template is the trustworthy,
6
+ * instant, auditable fallback — same numbers in → same card out, and it can never
7
+ * emit a metric the cascade didn't produce. A model hook can layer behind this same
8
+ * narrate() interface later without a rewrite.
9
+ *
10
+ * Token-only. No network, no randomness.
11
+ */
12
+
13
+ // Safe formatters: never emit NaN/Infinity/undefined into the card.
14
+ const safeNum = (n) => (Number.isFinite(Number(n)) ? Number(n) : null);
15
+ const comma = (n, dec) => {
16
+ const v = safeNum(n);
17
+ return v !== null
18
+ ? v.toLocaleString("en-US", {
19
+ minimumFractionDigits: dec,
20
+ maximumFractionDigits: dec,
21
+ })
22
+ : "—";
23
+ };
24
+ const plain = (n, dec) => {
25
+ const v = safeNum(n);
26
+ return v !== null ? v.toFixed(dec) : "—";
27
+ };
28
+
29
+ /**
30
+ * Given a cascade result ({ velocity, leverage, dev10x, pillars, class }) and an
31
+ * optional subject name, return "**CLASS.** <one or two sentences>". Deterministic.
32
+ */
33
+ export function narrate(cascade, name = "This operator") {
34
+ const klass = cascade.class || cascade.klass || "UNCLASSED";
35
+ const v = safeNum(cascade.velocity);
36
+ const l = safeNum(cascade.leverage);
37
+
38
+ // "non-compounding" = a stateless pipe: no cache commits, so the cascade can't
39
+ // form. cascade.mjs leaves dev10x null when cacheCreate is 0 (the cw/o term
40
+ // collapses), which is exactly metrics.py's non_compounding flag.
41
+ // Also catches zero-input sessions where velocity/leverage are null.
42
+ const cw = cascade.pillars ? Number(cascade.pillars.cacheCreate) : NaN;
43
+ const nonCompounding =
44
+ cascade.dev10x == null || !(cw > 0) || v === null || l === null;
45
+
46
+ let body;
47
+ if (nonCompounding) {
48
+ const leverageStr =
49
+ l !== null
50
+ ? `Leverage ${comma(l, 1)}x comes from reuse alone.`
51
+ : "Leverage is undefined (no fresh input recorded).";
52
+ const dev10xNote =
53
+ cascade.dev10x == null
54
+ ? " 10xDEV is undefined — the compounding loop has not formed yet."
55
+ : "";
56
+ body =
57
+ `${name} runs a stateless pipe — no cache commits, so the cascade can't form. ` +
58
+ `High read volume, but nothing is being built forward. ${leverageStr}${dev10xNote}`;
59
+ } else if (v >= 1 && l >= 100) {
60
+ body =
61
+ `${name} holds both axes at once: ${plain(v, 1)}x generation AND ${comma(l, 0)}x memory leverage. ` +
62
+ `A closed kinetic loop — the rare operator the leverage/generation tradeoff says shouldn't exist.`;
63
+ } else if (l >= 10 && v < 1) {
64
+ body =
65
+ `${name} is an archival sponge — ${comma(l, 0)}x reuse but only ${plain(v, 2)}x generation. ` +
66
+ `Holds context beautifully, executes little with it. The reuse number is inflated by a weak commitment stage.`;
67
+ } else if (v >= 0.8 && l < 2) {
68
+ body =
69
+ `${name} is a volatile ingestor — ${plain(v, 2)}x generation but ${plain(l, 1)}x leverage. ` +
70
+ `Fast on single shots, resets between turns. Memory doesn't persist into a compounding loop.`;
71
+ } else {
72
+ body =
73
+ `${name} sits low on both axes: ${plain(v, 2)}x generation, ${plain(l, 1)}x leverage. ` +
74
+ `A transient profile — neither building state nor converting input to output efficiently.`;
75
+ }
76
+ return `**${klass}.** ${body}`;
77
+ }