adaptive-memory-multi-model-router 2.13.12 → 2.13.14

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.
@@ -1,17 +1,17 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * A3M Router — Overlay Box (blessed, non-fullscreen)
3
+ * A3M Router — Overlay Box TUI (Sakura Light Theme)
4
4
  */
5
5
 
6
6
  import * as blessed from 'blessed';
7
7
 
8
- // State
8
+ // ── State ──
9
9
  let activeModel = 'nvidia/llama-3.1-8b';
10
10
  let totalCost = 0.000087;
11
11
  let reqCount = 4;
12
12
  const log: string[] = [];
13
13
 
14
- // Screen — floating overlay, not fullscreen
14
+ // ── Screen ──
15
15
  const screen = blessed.screen({
16
16
  smartCSR: true,
17
17
  fullUnicode: true,
@@ -19,63 +19,55 @@ const screen = blessed.screen({
19
19
  cursor: { shape: 'line', blink: true },
20
20
  });
21
21
 
22
- // Box settings
23
22
  const BW = 82;
24
23
  const BH = 18;
24
+ function L() { return Math.max(0, Math.floor(((screen.width as number) - BW) / 2)); }
25
+ function T() { return Math.max(0, Math.floor(((screen.height as number) - BH) / 2)); }
26
+
27
+ // ── SAKURA LIGHT THEME ──
28
+ // bg: #fff5f7 (blush white)
29
+ // srf: #fce7f3 (light pink)
30
+ // dim: #d8a4b8 (muted rose)
31
+ // txt: #831843 (deep maroon)
32
+ // pink:#be185d (hot pink)
33
+ // grn: #059669 (emerald)
34
+ // blu: #2563eb (royal blue)
35
+ // amb: #d97706 (amber)
36
+ // red: #dc2626 (crimson)
37
+ // cyn: #0891b2 (teal)
38
+ // prp: #7c3aed (violet)
25
39
 
26
- function boxLeft() { return Math.max(0, Math.floor(((screen.width as number) - BW) / 2)); }
27
- function boxTop() { return Math.max(0, Math.floor(((screen.height as number) - BH) / 2)); }
28
-
29
- // Overlay box
30
40
  const box = blessed.box({
31
- top: boxTop(),
32
- left: boxLeft(),
33
- width: BW,
34
- height: BH,
35
- border: { type: 'line', fg: 'magenta' },
36
- style: { fg: '#c0caf5', bg: '#1a1b26' },
37
- tags: true,
38
- scrollable: true,
39
- mouse: true,
40
- keys: true,
41
+ top: T(), left: L(), width: BW, height: BH,
42
+ border: { type: 'line', fg: '#f472b6' },
43
+ style: { fg: '#831843', bg: '#fff5f7' },
44
+ tags: true, scrollable: true, mouse: true, keys: true,
41
45
  padding: { left: 1, right: 1, top: 0, bottom: 0 },
42
46
  });
43
47
 
44
- // Prompt
45
48
  const prompt = blessed.textbox({
46
- parent: box,
47
- bottom: 1,
48
- left: 0,
49
- width: BW - 4,
50
- height: 1,
51
- style: { fg: '#c0caf5', bg: '#24283b' },
52
- inputOnFocus: true,
53
- keys: true,
54
- tags: true,
49
+ parent: box, bottom: 1, left: 0, width: BW - 4, height: 1,
50
+ style: { fg: '#831843', bg: '#fce7f3' },
51
+ inputOnFocus: true, keys: true, tags: true,
55
52
  });
56
53
 
57
- // Helpers
58
- const D = (s: string) => `{#565f89-fg}${s}{/}`;
54
+ const D = (s: string) => `{#d8a4b8-fg}${s}{/}`;
59
55
 
60
56
  function render() {
61
57
  const maxLines = BH - 4;
62
58
  const visible = log.slice(-maxLines);
63
-
64
59
  let out = '';
65
- out += `{bold}{#bb9af7-fg}⚡ A3M Router{/} ${D('·')} {#9ece6a-fg}${activeModel}{/} ${D('·')} ${D(`${reqCount} req`)} ${D('·')} ${D(`$${totalCost.toFixed(6)}`)}\n`;
66
- out += `${D('─'.repeat(BW - 6))}\n`;
67
- out += '\n';
60
+ out += `{bold}{#be185d-fg}⚡ A3M Router{/} ${D('·')} {#059669-fg}${activeModel}{/} ${D('·')} ${D(`${reqCount} req`)} ${D('·')} ${D(`$${totalCost.toFixed(6)}`)}\n`;
61
+ out += `${D('─'.repeat(BW - 6))}\n\n`;
68
62
 
69
- for (const line of visible) {
70
- out += line + '\n';
71
- }
63
+ for (const line of visible) out += line + '\n';
72
64
 
73
65
  if (visible.length === 0) {
74
66
  out += ` ${D('Type a query — auto-routed to cheapest model.')}\n\n`;
75
67
  out += ` ${D('Commands:')}\n`;
76
- out += ` {#7aa2f7-fg}/route{/} ${D('<query>')} /cost /model nvidia\n`;
77
- out += ` {#7aa2f7-fg}/health{/} /models /clear\n`;
78
- out += ` {#7aa2f7-fg}/exit{/} /help\n\n`;
68
+ out += ` {#2563eb-fg}/route{/} ${D('<query>')} /cost /model nvidia\n`;
69
+ out += ` {#2563eb-fg}/health{/} /models /clear\n`;
70
+ out += ` {#2563eb-fg}/exit{/} /help\n\n`;
79
71
  out += ` ${D('nvidia (free) · groq (free) · deepseek ($9.46)')}\n`;
80
72
  }
81
73
 
@@ -85,32 +77,32 @@ function render() {
85
77
 
86
78
  function cmd(c: string) {
87
79
  if (!c) return;
88
- log.push(`{bold}{#7dcfff-fg}▸{/} ${c}`);
80
+ log.push(`{bold}{#0891b2-fg}▸{/} ${c}`);
89
81
 
90
82
  if (c === '/exit' || c === '/q') { screen.destroy(); process.exit(0); }
91
83
  else if (c === '/help') log.push(` ${D('/route /cost /health /models /model <p> /clear /exit')}`);
92
84
  else if (c === '/clear') log.length = 0;
93
85
  else if (c === '/cost') {
94
- log.push(` {#bb9af7-fg}A3M{/} Cost:`);
86
+ log.push(` {#be185d-fg}A3M{/} Cost:`);
95
87
  log.push(` ${D('nvidia $0 | deepseek $0.000009 | groq $0 | cerebras $0')}`);
96
88
  log.push(` ${D(`TOTAL $${totalCost.toFixed(6)} | ${reqCount} req | 99.97% saved`)}`);
97
89
  } else if (c === '/health') {
98
- log.push(` {#bb9af7-fg}A3M{/} Health:`);
99
- log.push(` {#9ece6a-fg}●{/} nvidia 85ms {#9ece6a-fg}●{/} deepseek 210ms {#9ece6a-fg}●{/} groq 150ms {#9ece6a-fg}●{/} cerebras 320ms`);
100
- log.push(` {#f7768e-fg}✕{/} mistral OFFLINE {#9ece6a-fg}●{/} ollama 50ms`);
90
+ log.push(` {#be185d-fg}A3M{/} Health:`);
91
+ log.push(` {#059669-fg}●{/} nvidia 85ms {#059669-fg}●{/} deepseek 210ms {#059669-fg}●{/} groq 150ms {#059669-fg}●{/} cerebras 320ms`);
92
+ log.push(` {#dc2626-fg}✕{/} mistral OFFLINE {#059669-fg}●{/} ollama 50ms`);
101
93
  } else if (c === '/models') {
102
- log.push(` {#bb9af7-fg}A3M{/} 47+ providers:`);
103
- log.push(` {#9ece6a-fg}● nvidia{/} (free) {#7dcfff-fg}● groq{/} (free) {#e0af68-fg}● deepseek{/} (cheap) {#bb9af7-fg}● cerebras{/} (free)`);
94
+ log.push(` {#be185d-fg}A3M{/} 47+ providers:`);
95
+ log.push(` {#059669-fg}● nvidia{/} (free) {#0891b2-fg}● groq{/} (free) {#d97706-fg}● deepseek{/} (cheap) {#7c3aed-fg}● cerebras{/} (free)`);
104
96
  } else if (c.startsWith('/model ')) {
105
97
  const w = c.replace('/model ', '').trim();
106
- const valid = ['nvidia', 'deepseek', 'groq', 'cerebras', 'mistral', 'openai', 'ollama'];
107
- if (valid.includes(w)) { activeModel = `${w}/auto`; log.push(` ${D(`→ {#9ece6a-fg}${activeModel}{/}`)}`); }
98
+ const ok = ['nvidia','deepseek','groq','cerebras','mistral','openai','ollama'];
99
+ if (ok.includes(w)) { activeModel = `${w}/auto`; log.push(` ${D(`→ {#059669-fg}${activeModel}{/}`)}`); }
108
100
  else log.push(` ${D(`Unknown: ${w}`)}`);
109
101
  } else {
110
102
  const ms = Math.floor(Math.random() * 100) + 30;
111
103
  const cost = Math.random() * 0.00005;
112
104
  totalCost += cost; reqCount++;
113
- log.push(` {#bb9af7-fg}A3M{/} {#9ece6a-fg}${activeModel}{/} ${D('·')} {#e0af68-fg}${ms}ms{/} ${D('·')} {#ff9e64-fg}$${cost.toFixed(6)}{/}`);
105
+ log.push(` {#be185d-fg}A3M{/} {#059669-fg}${activeModel}{/} ${D('·')} {#d97706-fg}${ms}ms{/} ${D('·')} {#ea580c-fg}$${cost.toFixed(6)}{/}`);
114
106
  log.push(` ${c}`);
115
107
  }
116
108
 
@@ -119,11 +111,9 @@ function cmd(c: string) {
119
111
  prompt.focus();
120
112
  }
121
113
 
122
- // Keys
123
114
  screen.key(['C-c', 'escape'], () => { screen.destroy(); process.exit(0); });
124
115
  prompt.key('enter', () => { const v = prompt.getValue().trim(); prompt.clearValue(); cmd(v); });
125
116
 
126
- // Start
127
117
  screen.append(box);
128
118
  render();
129
119
  prompt.focus();