@gotcos/glasses-server 6.39.2 → 6.40.0

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/CHANGELOG.md CHANGED
@@ -1,3 +1,39 @@
1
+ ## 6.40.0
2
+
3
+ Local thinking now follows the effort you asked for.
4
+
5
+ 6.39.3 turned thinking off wholesale. This release makes it a ladder: the
6
+ default effort keeps local turns instant, and raising the effort raises the
7
+ thinking budget with it -- xhigh maps to a high thinking level, max and
8
+ ultracode to the maximum. That is what the escalation means: in a controlled
9
+ flag benchmark against an Opus 5 reference (10/10), a local Qwen model WITH
10
+ thinking also scored 10/10, where the same model without it scored 6-7. The
11
+ daemon accepts level strings on Qwen-class models and silently tolerates
12
+ think:false on models without the capability (both probed live).
13
+
14
+ COS_OLLAMA_THINK becomes a PIN rather than the only switch: "1"/"true"
15
+ always think, "0"/"false" never think, an explicit level forces that level,
16
+ and unset defers to the effort map. Pairs with COS Control 0.5.79, which
17
+ adds a local-model picker writing COS_OLLAMA_MODEL so multi-model daemons
18
+ stop depending on pull order.
19
+
20
+ ## 6.39.3
21
+
22
+ Local turns answer in seconds again: thinking is off by default.
23
+
24
+ The Ollama bridge sent no `think` field, so a thinking-class model spent its
25
+ full hidden reasoning chain before the first visible token. Measured on
26
+ qwen3.5:35b the day it became the default local model: 6,265 generated tokens
27
+ for a 150-word answer, 98.6 seconds of dead screen against 2.2 seconds with
28
+ thinking disabled, at the same visible answer quality -- and a hard prompt
29
+ could out-run the 180-second wall clock entirely.
30
+
31
+ Every request now sends `think: false` unless COS_OLLAMA_THINK opts back in
32
+ ("1"/"true", or an explicit budget: low, medium, high, max). The daemon
33
+ silently tolerates `think: false` on models without the thinking capability
34
+ (verified live), so no capability gating is needed. COS Control 0.5.77
35
+ allowlists the new key so a pinned preference survives Update Server.
36
+
1
37
  ## 6.39.2
2
38
 
3
39
  Every Claude fork failed; the copy it left behind was real.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gotcos/glasses-server",
3
- "version": "6.39.2",
3
+ "version": "6.40.0",
4
4
  "description": "COS Glasses \u2014 self-hosted AI heads-up-display server for Even G2 smart glasses, powered by Claude Code, Codex, Cursor Agent CLI, or local Ollama",
5
5
  "type": "module",
6
6
  "bin": {
@@ -26,10 +26,46 @@ import {
26
26
  startOllamaRun,
27
27
  } from './ollama-run-ledger.js'
28
28
  import { notifyExchange, notifySessionStart } from './telegram-notify.js'
29
- import { OLLAMA_MODEL } from '../../shared/model-preference.js'
29
+ import { OLLAMA_MODEL, type EffortPreference } from '../../shared/model-preference.js'
30
30
 
31
31
  const INACTIVITY_MS = 60_000
32
32
  const WALL_MAX_MS = 180_000
33
+
34
+ /**
35
+ * Thinking follows the REQUESTED EFFORT, not a blanket switch.
36
+ *
37
+ * The default effort ('high' -- every ordinary lens turn) keeps thinking
38
+ * OFF: measured 2026-08-26 on qwen3.5:35b, a hidden chain turned a
39
+ * 2.2-second answer into 98.6 seconds of dead screen at the same visible
40
+ * quality, and a hard prompt can out-run WALL_MAX_MS entirely. Raising the
41
+ * effort raises the thinking budget with it (xhigh -> 'high', max and
42
+ * ultracode -> 'max'), because that is what the escalation MEANS -- the
43
+ * flag benchmark showed a thinking local model matching Opus 5 (10/10)
44
+ * where the same model without thinking scored 6-7. Level strings are
45
+ * accepted by the daemon on Qwen-class models (probed live), and
46
+ * `think: false` is silently tolerated by models WITHOUT the thinking
47
+ * capability (verified against llama3.2:1b -- HTTP 200), so no capability
48
+ * gate is needed.
49
+ *
50
+ * COS_OLLAMA_THINK, when set, PINS the behavior regardless of effort:
51
+ * "1"/"true" always think, "0"/"false" never think, or an explicit level.
52
+ * Anything unrecognized reads as unset and defers to the effort map.
53
+ */
54
+ export function resolveOllamaThink(
55
+ raw: string | undefined,
56
+ effort?: EffortPreference,
57
+ ): boolean | string {
58
+ const value = (raw ?? '').trim().toLowerCase()
59
+ if (value === '1' || value === 'true') return true
60
+ if (value === '0' || value === 'false') return false
61
+ if (value === 'low' || value === 'medium' || value === 'high' || value === 'max') return value
62
+ switch (effort) {
63
+ case 'xhigh': return 'high'
64
+ case 'max':
65
+ case 'ultracode': return 'max'
66
+ default: return false
67
+ }
68
+ }
33
69
  const HISTORY_LIMIT = 20
34
70
 
35
71
  type OllamaChatMessage = { role: 'system' | 'user' | 'assistant'; content: string }
@@ -207,6 +243,7 @@ export async function callOllamaStreaming(
207
243
  model: catalog.model,
208
244
  messages,
209
245
  stream: true,
246
+ think: resolveOllamaThink(process.env.COS_OLLAMA_THINK, options?.effort),
210
247
  }),
211
248
  signal: abort.signal,
212
249
  })