agent-things 1.2.1 → 1.3.1

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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Agent Things
2
2
 
3
- English | [简体中文](README.zh-CN.md)
3
+ English | [简体中文](docs/README.zh-CN.md)
4
4
 
5
5
  When you juggle several sessions at once, or come back to one you haven't touched in a while, Agent Things shows you at a glance how far each session has got and what is still open, so you can decide whether to archive it or keep following up. You can also jump from any task back to the message it came from.
6
6
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-things-ui",
3
- "version": "0.2.7",
3
+ "version": "1.3.1",
4
4
  "description": "Agent Things session task progress, manual status, task sources, and notes",
5
5
  "author": {
6
6
  "name": "Agent Things"
@@ -108,5 +108,5 @@ export default function controls(props, surface) {
108
108
  const buttonWidth = props.action === 'clear'
109
109
  ? (props.label === '清除进度' || !props.label ? 64 : measureClearWidth(props.label))
110
110
  : measureButtonWidth(props.label);
111
- return { type: 'Svg', props: { source: props.action === 'clear' ? clearButton(state.hovered, state.pressed, props.label, buttonWidth) : primary(props.label, props.disabled, state.hovered, state.pressed && state.hovered, buttonWidth), alt: props.label, width: buttonWidth, height: props.action === 'clear' ? 28 : 36 } };
111
+ return { type: 'Svg', props: { source: props.action === 'clear' ? clearButton(state.hovered, state.pressed, props.label, buttonWidth) : primary(props.label, props.disabled, state.hovered, state.pressed && state.hovered, buttonWidth, props.accent || null), alt: props.label, width: buttonWidth, height: props.action === 'clear' ? 28 : 36 } };
112
112
  }
@@ -4,7 +4,98 @@ const presentation = (function createPresentation(lang) {
4
4
  const currentLang = normalizeLang(lang ?? (typeof globalThis !== 'undefined' ? globalThis.__agentThingsLang : undefined));
5
5
  const colors = { unstarted: '#9098a2', unfinished: '#c89b38', completed: '#548eea', pushed: '#a17be3' };
6
6
  const layout = { contentWidth: 300, panelWidth: 340, progressNodes: [0, 25, 50, 75, 100] };
7
- const accent = { normal: '#0169CC', hover: '#005bb3', pressed: '#004f9c' };
7
+ const accent = { normal: '#0169CC', hover: '#005bb3', pressed: '#004f9c', onAccent: '#FFFFFF' };
8
+ const claudeCodeThemes = {
9
+ 'claude-light': '#C6613F',
10
+ 'claude-dark': '#D97757',
11
+ 'github-light': '#0969DA',
12
+ 'github-light-high-contrast': '#0550AE',
13
+ 'github-dark': '#1F6FEB',
14
+ 'github-dark-dimmed': '#316DCA',
15
+ 'github-dark-high-contrast': '#409EFF',
16
+ 'pierre-light': '#0073E6',
17
+ 'pierre-dark': '#0087EE',
18
+ 'vscode-light': '#007ACC',
19
+ 'vscode-dark': '#007ACC',
20
+ 'one-light': '#4078F2',
21
+ 'one-dark-pro': '#61AFEF',
22
+ 'catppuccin-latte': '#8839EF',
23
+ 'catppuccin-mocha': '#CBA6F7',
24
+ 'solarized-light': '#268BD2',
25
+ 'solarized-dark': '#268BD2',
26
+ 'vitesse-light': '#4D9375',
27
+ 'vitesse-dark': '#4D9375',
28
+ 'min-light': '#256ABF',
29
+ 'min-dark': '#5598E7',
30
+ 'rose-pine-dawn': '#D7827E',
31
+ 'rose-pine': '#EA9A97',
32
+ 'slack-ochin': '#1264A3',
33
+ 'slack-dark': '#36C5F0',
34
+ 'dracula': '#BD93F9',
35
+ 'dracula-soft': '#BD93F9',
36
+ 'nord': '#88C0D0',
37
+ 'monokai': '#F92672',
38
+ 'tokyo-night': '#7AA2F7',
39
+ 'night-owl': '#82AAFF',
40
+ 'ayu-dark': '#E6B450',
41
+ };
42
+
43
+ function normalizeHexColor(value, fallback = null) {
44
+ if (typeof value !== 'string') return fallback;
45
+ const raw = value.trim();
46
+ if (/^#[0-9a-fA-F]{6}$/.test(raw)) return raw.toUpperCase();
47
+ if (/^#[0-9a-fA-F]{3}$/.test(raw)) {
48
+ return `#${raw[1]}${raw[1]}${raw[2]}${raw[2]}${raw[3]}${raw[3]}`.toUpperCase();
49
+ }
50
+ const rgbMatch = raw.match(/^rgba?\(\s*(\d{1,3})\s*[,\s]\s*(\d{1,3})\s*[,\s]\s*(\d{1,3})/i);
51
+ if (rgbMatch) {
52
+ const toHex = n => Math.max(0, Math.min(255, Number(n))).toString(16).padStart(2, '0');
53
+ return `#${toHex(rgbMatch[1])}${toHex(rgbMatch[2])}${toHex(rgbMatch[3])}`.toUpperCase();
54
+ }
55
+ return fallback;
56
+ }
57
+
58
+ function hexToRgb(hex) {
59
+ const clean = normalizeHexColor(hex, '#0169CC').slice(1);
60
+ return [
61
+ parseInt(clean.slice(0, 2), 16),
62
+ parseInt(clean.slice(2, 4), 16),
63
+ parseInt(clean.slice(4, 6), 16),
64
+ ];
65
+ }
66
+
67
+ function getRelativeLuminance(hex) {
68
+ const [r, g, b] = hexToRgb(hex).map(channel => {
69
+ const srgb = channel / 255;
70
+ return srgb <= 0.03928 ? srgb / 12.92 : ((srgb + 0.055) / 1.055) ** 2.4;
71
+ });
72
+ return 0.2126 * r + 0.7152 * g + 0.0722 * b;
73
+ }
74
+
75
+ function mixHexColors(hexA, hexB, weightA) {
76
+ const [r1, g1, b1] = hexToRgb(hexA);
77
+ const [r2, g2, b2] = hexToRgb(hexB);
78
+ const wA = Math.max(0, Math.min(1, weightA));
79
+ const wB = 1 - wA;
80
+ const toHex = n => Math.max(0, Math.min(255, Math.round(n))).toString(16).padStart(2, '0');
81
+ return `#${toHex(r1 * wA + r2 * wB)}${toHex(g1 * wA + g2 * wB)}${toHex(b1 * wA + b2 * wB)}`.toUpperCase();
82
+ }
83
+
84
+ function resolveAccentPalette(rawColor, { isDark = true, fallback = '#0169CC' } = {}) {
85
+ const normal = normalizeHexColor(rawColor, normalizeHexColor(fallback, '#0169CC'));
86
+ const lum = getRelativeLuminance(normal);
87
+ const onAccent = lum > 0.45 ? '#0D0D0D' : '#FFFFFF';
88
+ // Darken bright accents or shade toward dark/light ink subtly without losing hue identity.
89
+ const mixTarget = lum > 0.45 ? '#000000' : (isDark ? '#FFFFFF' : '#000000');
90
+ const hoverWeight = lum > 0.45 ? 0.88 : (isDark ? 0.88 : 0.88);
91
+ const pressedWeight = lum > 0.45 ? 0.78 : (isDark ? 0.78 : 0.78);
92
+ return {
93
+ normal,
94
+ hover: mixHexColors(normal, mixTarget, hoverWeight),
95
+ pressed: mixHexColors(normal, mixTarget, pressedWeight),
96
+ onAccent,
97
+ };
98
+ }
8
99
 
9
100
  const locales = {
10
101
  zh: {
@@ -183,6 +274,18 @@ const presentation = (function createPresentation(lang) {
183
274
  hookPresentedMessage: '已呈现当前会话任务进度卡片',
184
275
  noSessionBadge: '无会话',
185
276
  offlineBadge: '离线',
277
+ badgeNotOrganized: '未整理',
278
+ badgeProgressUnrecordedSuffix: ' · 进度未记录',
279
+ ringAriaPattern: '{title}:{summary},点击记录任务进展',
280
+ ringUpdating: '正在更新进度',
281
+ sessionFallbackTitle: '会话',
282
+ statusUnrecorded: '尚未记录进展',
283
+ panelAriaPattern: '{title} 任务进展',
284
+ totalsEmpty: '暂无任务统计',
285
+ taskUnknown: '状态未知',
286
+ timelineAnalysis: '自动分析',
287
+ timelineManual: '手动记录',
288
+ unrecordedShort: '未记录',
186
289
  },
187
290
  en: {
188
291
  appTitle: 'Agent Things',
@@ -360,6 +463,18 @@ const presentation = (function createPresentation(lang) {
360
463
  hookPresentedMessage: 'Session task progress card presented',
361
464
  noSessionBadge: 'No session',
362
465
  offlineBadge: 'Offline',
466
+ badgeNotOrganized: 'Not organized',
467
+ badgeProgressUnrecordedSuffix: ' · Progress unrecorded',
468
+ ringAriaPattern: '{title}: {summary}. Click to track progress',
469
+ ringUpdating: 'Updating progress',
470
+ sessionFallbackTitle: 'Session',
471
+ statusUnrecorded: 'No progress recorded',
472
+ panelAriaPattern: '{title} Task Progress',
473
+ totalsEmpty: 'No task metrics yet',
474
+ taskUnknown: 'Unknown status',
475
+ timelineAnalysis: 'Auto analysis',
476
+ timelineManual: 'Manual record',
477
+ unrecordedShort: 'Unrecorded',
363
478
  },
364
479
  };
365
480
 
@@ -418,6 +533,9 @@ const presentation = (function createPresentation(lang) {
418
533
  locales,
419
534
  layout,
420
535
  accent,
536
+ claudeCodeThemes,
537
+ normalizeHexColor,
538
+ resolveAccentPalette,
421
539
  t: active.t,
422
540
  format,
423
541
  forLang,
@@ -428,4 +546,4 @@ const presentation = (function createPresentation(lang) {
428
546
  analysisDisabled,
429
547
  };
430
548
  })();
431
- export const { lang, labels, colors, taskLabels, strings, locales, layout, accent, t, format, forLang, formatDate, progressValue, progressState, draftTransition, analysisDisabled } = presentation;
549
+ export const { lang, labels, colors, taskLabels, strings, locales, layout, accent, claudeCodeThemes, normalizeHexColor, resolveAccentPalette, t, format, forLang, formatDate, progressValue, progressState, draftTransition, analysisDisabled } = presentation;
@@ -184,9 +184,10 @@ export function preview(text, maxWidth = NOTE_LINE_WIDTH) {
184
184
 
185
185
  export function slider(value, color, width = CONTENT_WIDTH) {
186
186
  const sliderWidth = Math.max(130, Math.round(Number.isFinite(Number(width)) ? Number(width) : CONTENT_WIDTH));
187
- const track = sliderWidth - 14, at = 7 + track * (value || 0) / 100;
188
- const nodes = layout.progressNodes.map(n => `<circle cx="${7+track*n/100}" cy="12" r="3.5" fill="light-dark(#fff,#191919)" stroke="light-dark(#576374,#a0a6ad)" stroke-width="1"/><text x="${7+track*n/100}" y="38" font-size="10" fill="currentColor" text-anchor="${n === 0 ? 'start' : n === 100 ? 'end' : 'middle'}" opacity=".68">${n}</text>`).join('');
189
- return svg(`<rect x="7" y="10" width="${track}" height="4" rx="2" fill="light-dark(#c3ccd6,#ffffff12)"/><rect x="7" y="10" width="${track*(value||0)/100}" height="4" rx="2" fill="${color}"/>${nodes}<circle cx="${at}" cy="12" r="7" fill="light-dark(${accent.normal},#e6edf3)" stroke="light-dark(#fff,#191919)" stroke-width="2"/>`, sliderWidth, 51, 'xMinYMid meet');
187
+ const pad = 9;
188
+ const track = sliderWidth - pad * 2, at = pad + track * (value || 0) / 100;
189
+ const nodes = layout.progressNodes.map(n => `<text x="${pad+track*n/100}" y="38" font-size="10" fill="currentColor" text-anchor="${n === 0 ? 'start' : n === 100 ? 'end' : 'middle'}" opacity=".68">${n}</text>`).join('');
190
+ return svg(`<rect x="${pad}" y="9" width="${track}" height="6" rx="3" fill="light-dark(#e5e9ef,#ffffff16)"/><rect x="${pad}" y="9" width="${track*(value||0)/100}" height="6" rx="3" fill="${color}"/>${nodes}<circle cx="${at}" cy="12" r="8" fill="#ffffff" stroke="light-dark(#00000024,#00000066)" stroke-width="1.2"/>`, sliderWidth, 51, 'xMinYMid meet');
190
191
  }
191
192
  export function measureButtonWidth(label, minWidth = BUTTON_WIDTH) {
192
193
  const w = textWidth(String(label || ''), 13);
@@ -196,9 +197,11 @@ export function measureClearWidth(label, minWidth = 64) {
196
197
  const w = textWidth(String(label || ''), 11);
197
198
  return Math.max(minWidth, Math.round(w + 20));
198
199
  }
199
- export function primary(label, disabled, hovered = false, pressed = false, width = measureButtonWidth(label)) {
200
- const fill = disabled ? accent.normal : pressed ? accent.pressed : hovered ? accent.hover : accent.normal;
201
- return svg(`<rect width="${width}" height="36" rx="9" fill="${fill}" opacity="${disabled?'.5':'1'}"/><text x="${width/2}" y="23" fill="white" text-anchor="middle" font-size="13" font-weight="550">${escape(label)}</text>`, width, 36, 'xMidYMid meet');
200
+ export function primary(label, disabled, hovered = false, pressed = false, width = measureButtonWidth(label), palette = null) {
201
+ const p = palette && typeof palette === 'object' && palette.normal ? palette : accent;
202
+ const fill = disabled ? p.normal : pressed ? (p.pressed || p.normal) : hovered ? (p.hover || p.normal) : p.normal;
203
+ const fg = p.onAccent || 'white';
204
+ return svg(`<rect width="${width}" height="36" rx="9" fill="${fill}" opacity="${disabled?'.5':'1'}"/><text x="${width/2}" y="23" fill="${escape(fg)}" text-anchor="middle" font-size="13" font-weight="550">${escape(label)}</text>`, width, 36, 'xMidYMid meet');
202
205
  }
203
206
 
204
207
  // 「在侧栏打开」图标:右侧 28×28 为图标,悬停时在左侧画出提示。
@@ -319,7 +319,7 @@ async function draw($, e, inPane) {
319
319
  const saveLabel = busy ? t('savingBtn') : t('saveBtn');
320
320
  const saveWidthCols = colWidthFor(measureButtonWidth(saveLabel), 8.6);
321
321
  content.push(row([trailing(button('cancel', t('cancelBtn'), async () => { draft = null; await view($, 'overview'); }, { plain: true })),
322
- control('save', { kind: 'button', action: 'save', disabled: busy, label: saveLabel }, saveWidthCols)]));
322
+ control('save', { kind: 'button', action: 'save', disabled: busy, label: saveLabel, accent: data?.accent || null }, saveWidthCols)]));
323
323
  if (conflict) content.push(button('resolve-conflict', t('resolveConflictBtn'), () => rebaseDraft($), { plain: true }));
324
324
  } else {
325
325
  content.push(statusRow({ dotColor: color, label: labels[record?.state] || t('unrecordedSummary'), timeLabel: date(record?.updatedAt), score: record?.progress, scoreAlt: `${record?.progress ?? t('progressUnrecordedWord')}%` }));
@@ -335,7 +335,7 @@ async function draw($, e, inPane) {
335
335
  const clearLabel = t('btnClear');
336
336
  const clearWidthCols = colWidthFor(measureClearWidth(clearLabel), 6.9);
337
337
  content.push(row([
338
- control('analyze', { kind: 'button', action: 'analyze', disabled: Boolean(active) || busy, label: analyzeLabel }, analyzeWidthCols),
338
+ control('analyze', { kind: 'button', action: 'analyze', disabled: Boolean(active) || busy, label: analyzeLabel, accent: data?.accent || null }, analyzeWidthCols),
339
339
  button('edit', t('btnAdjust'), () => edit($), { plain: true, dimColor: true }),
340
340
  trailing(control('clear', { kind: 'button', action: 'clear', disabled: busy, label: clearLabel }, clearWidthCols)),
341
341
  ]));