@gotcos/glasses-server 6.99.12 → 6.99.16

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.
@@ -62,10 +62,16 @@
62
62
  function headline(q) {
63
63
  var s = String(q || '').replace(/\s+/g, ' ').trim();
64
64
  if (!s) return '(empty query)';
65
- return s.length > 60 ? s.slice(0, 57) + '…' : s;
65
+ return s.length > 240 ? s.slice(0, 239) + '…' : s;
66
66
  }
67
67
  function modelOf(t) { var m = String(t.modelPreference || ''); return /^[A-Za-z0-9._:-]{1,64}$/.test(m) ? m : ''; }
68
- function originTag(t) { return t.origin === 'routine' ? 'ROUTINE' : t.origin === 'task' ? 'TASK' : ''; }
68
+ // 6.99.15: the row says "Opus", not "opus"; a model id it does not know stays as the server wrote it.
69
+ var MODEL_NAMES = { opus: 'Opus', sonnet: 'Sonnet', fable: 'Fable', haiku: 'Haiku' };
70
+ function modelName(m) { return MODEL_NAMES[m] || m; }
71
+ // A preview of an answer whose progress lines were joined with no space ("now.Reading the tax"): one space after a
72
+ // sentence's end when the next sentence starts at once. Previews only; the reader shows the answer as written.
73
+ function previewText(text) { return stripMd(text).replace(/([a-z0-9)][.!?])([A-Z][a-z])/g, '$1 $2'); }
74
+ function originTag(t) { return t.origin === 'routine' ? 'Routine' : t.origin === 'task' ? 'Task' : ''; }
69
75
  function originTitle(t) {
70
76
  var id = t.originId ? ' (' + t.originId + ')' : '';
71
77
  return t.origin === 'routine' ? 'Produced by a scheduled routine on your Mac' + id : t.origin === 'task' ? 'Produced by an agent working a task on your Mac' + id : '';
@@ -285,8 +291,8 @@
285
291
  var detail;
286
292
  if (S.recentState === 'loading' && !S.recent) detail = 'Loading…';
287
293
  else if (S.recentState === 'error') detail = S.recentError === 'signed-out' ? 'Signed out' : 'Could not load messages';
288
- else if (S.recent && S.recent.length) detail = 'Newest first · ' + S.recent.length + ' ' + W.plural(S.recent.length, 'turn', 'turns');
289
- else if (S.recent) detail = 'No turns today';
294
+ else if (S.recent && S.recent.length) detail = S.recent.length + ' ' + W.plural(S.recent.length, 'message', 'messages') + ', newest first';
295
+ else if (S.recent) detail = 'No messages today';
290
296
  else detail = 'Refresh to load';
291
297
  return '<header class="cx-hero" data-tint="messages">' +
292
298
  '<span class="cx-glyph"><svg class="icon"><use href="#i-messages"/></svg></span>' +
@@ -298,7 +304,7 @@
298
304
  }
299
305
  function controlsHtml() {
300
306
  return '<div class="cx-controls">' +
301
- '<div class="cx-switch" role="group" aria-label="Message view"><span class="cx-switch-label">Message view</span>' +
307
+ '<div class="cx-switch" role="group" aria-label="Message view">' +
302
308
  '<button type="button" data-msg="view" data-view="recent" aria-pressed="' + (S.view === 'recent') + '">Recent</button>' +
303
309
  '<button type="button" data-msg="view" data-view="archive" aria-pressed="' + (S.view === 'archive') + '">Archive</button>' +
304
310
  '</div>' +
@@ -318,24 +324,26 @@
318
324
  ? '<span>' + esc(recentSide) + '</span><span>·</span><button type="button" class="door" data-msg="view" data-view="archive">' + esc(archSide) + '<svg class="icon" aria-hidden="true"><use href="#i-chev"/></svg></button>'
319
325
  : '<button type="button" class="door" data-msg="view" data-view="recent">' + esc(recentSide) + '<svg class="icon" aria-hidden="true"><use href="#i-chev"/></svg></button><span>·</span><span>' + esc(archSide) + '</span>') + '</p>';
320
326
  }
327
+ // 6.99.15: one row is the ask as its title with the time beside it, the answer under it, and one quiet line of
328
+ // facts (number, Routine or Task, model, attachments). No glyph per row: every row was the same bubble.
321
329
  function recentRowHtml(t, i) {
322
330
  var a = atts(t);
323
331
  var kinds = a.map(attKind);
324
332
  var n = numOf(t);
325
333
  var tag = originTag(t);
326
334
  var model = modelOf(t);
327
- return '<button type="button" class="cx-row" data-msg="open" data-key="' + esc(keyOf(t, i)) + '">' +
328
- '<span class="cx-row-glyph"><svg class="icon"><use href="#i-messages"/></svg>' +
329
- (a.length ? '<span class="cx-badge-icon"><svg class="icon"><use href="#i-' + attIcon(kinds) + '"/></svg></span>' : '') + '</span>' +
335
+ var facts = [];
336
+ if (n != null) facts.push('<span class="cx-num">#' + esc(n) + '</span>');
337
+ if (tag) facts.push('<span class="cx-tag" title="' + esc(originTitle(t)) + '">' + tag + '</span>');
338
+ if (model) facts.push('<span class="cx-model">' + esc(modelName(model)) + '</span>');
339
+ if (a.length) facts.push('<span class="cx-att" title="' + esc(attTitle(a)) + '"><svg class="icon"><use href="#i-' + attIcon(kinds) + '"/></svg>' + esc(attTitle(a)) + '</span>');
340
+ var sub = previewText(t.text);
341
+ return '<button type="button" class="cx-row cx-msgrow" data-msg="open" data-key="' + esc(keyOf(t, i)) + '">' +
330
342
  '<span class="cx-row-body">' +
331
- '<span class="cx-meta"><span class="cx-num">' + (n != null ? 'Message #' + esc(n) : 'Message') + '</span>' +
332
- '<span class="cx-time">' + esc(timeLabel(t.timestamp)) + '</span>' +
333
- (tag ? '<span class="cx-tag" title="' + esc(originTitle(t)) + '">' + tag + '</span>' : '') +
334
- (model ? '<span class="cx-model">' + esc(model) + '</span>' : '') +
335
- (a.length ? '<span class="cx-att" title="' + esc(attTitle(a)) + '"><svg class="icon"><use href="#i-' + attIcon(kinds) + '"/></svg>' + a.length + '</span>' : '') +
336
- '</span>' +
337
- '<span class="cx-row-title">' + esc(headline(t.query)) + '</span>' +
338
- '<span class="cx-row-sub">' + esc(stripMd(t.text)) + '</span>' +
343
+ '<span class="cx-msg-top"><span class="cx-row-title">' + esc(headline(t.query)) + '</span>' +
344
+ '<span class="cx-time">' + esc(timeLabel(t.timestamp)) + '</span></span>' +
345
+ (sub ? '<span class="cx-row-sub">' + esc(sub) + '</span>' : '') +
346
+ (facts.length ? '<span class="cx-meta cx-facts">' + facts.join('') + '</span>' : '') +
339
347
  '</span><span class="chev"></span></button>';
340
348
  }
341
349
  // The pinned COS chat, first in Recent (Drop it on only, and not while a search narrows the list).
@@ -361,8 +369,7 @@
361
369
  return '<div class="cx-list"><p class="cx-empty">No recent message contains “' + esc(q) + '”' +
362
370
  (days ? ', but ' + days + ' archived ' + W.plural(days, 'day', 'days') + ' ' + (days === 1 ? 'does' : 'do') + '.' : '. The archive goes back further.') + '</p></div>';
363
371
  }
364
- return '<div class="cx-list">' + shown.map(function (t) { return recentRowHtml(t, list.indexOf(t)); }).join('') + '</div>' +
365
- '<p class="cx-note">ROUTINE and TASK mark a run your Mac started.</p>';
372
+ return '<div class="cx-list">' + shown.map(function (t) { return recentRowHtml(t, list.indexOf(t)); }).join('') + '</div>';
366
373
  }
367
374
  function archiveBody() {
368
375
  var q = S.q.trim();