agent-things 1.3.1 → 1.3.3

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.
@@ -347,6 +347,11 @@ function createPresentation(lang) {
347
347
  updateFailedLabel: '升级失败',
348
348
  upgradeBtn: '立即升级',
349
349
  upgradingShort: '正在升级…',
350
+ checkUpdateBtn: '检查更新',
351
+ checkingUpdateShort: '正在检查…',
352
+ alreadyLatestPattern: '当前已是最新版 v{version}',
353
+ versionTagPattern: 'v{version}',
354
+ checkUpdateFailedLabel: '检查更新失败',
350
355
  pleaseWait: '请稍候',
351
356
  completedShort: '已完成',
352
357
  retryBtn: '重试',
@@ -536,6 +541,11 @@ function createPresentation(lang) {
536
541
  updateFailedLabel: 'Upgrade failed',
537
542
  upgradeBtn: 'Upgrade',
538
543
  upgradingShort: 'Upgrading...',
544
+ checkUpdateBtn: 'Check updates',
545
+ checkingUpdateShort: 'Checking...',
546
+ alreadyLatestPattern: 'Up to date (v{version})',
547
+ versionTagPattern: 'v{version}',
548
+ checkUpdateFailedLabel: 'Update check failed',
539
549
  pleaseWait: 'Please wait',
540
550
  completedShort: 'Done',
541
551
  retryBtn: 'Retry',
@@ -625,6 +635,72 @@ function createPresentation(lang) {
625
635
  function analysisDisabled(busy, analyzing, upgradeStage) {
626
636
  return Boolean(busy || analyzing || ['waiting', 'installing'].includes(upgradeStage));
627
637
  }
638
+ function updateBannerState(info, dict, options = {}) {
639
+ const textDict = dict || {};
640
+ const fmtText = (template, vars = {}) => String(template || '').replace(/\{(\w+)\}/g, (_, k) => (vars[k] !== undefined ? String(vars[k]) : ''));
641
+ const update = info?.update;
642
+ const stage = update?.stage;
643
+ const stages = textDict.updateStages || {
644
+ queued: 'Preparing upgrade',
645
+ checking: 'Checking version',
646
+ downloading: 'Downloading update',
647
+ waiting: 'Waiting for analysis to finish',
648
+ installing: 'Upgrading',
649
+ };
650
+ const activeStage = Boolean(stages[stage]) || Boolean(options.starting);
651
+ const updatedAtMs = update?.updatedAt ? Date.parse(update.updatedAt) : NaN;
652
+ const now = options.now ?? Date.now();
653
+ const completed = stage === 'completed' && Number.isFinite(updatedAtMs) && now - updatedAtMs < 60000;
654
+ const failed = stage === 'failed';
655
+ const visible = Boolean(info?.available || activeStage || failed || completed);
656
+ const command = info?.command || 'npx agent-things@latest';
657
+ const label = activeStage
658
+ ? (stages[stage] || stages.queued)
659
+ : failed
660
+ ? fmtText(textDict.updateFailedLabel || 'Upgrade failed')
661
+ : completed
662
+ ? fmtText(textDict.upgradedToPattern || 'Upgraded to v{version}', { version: update?.currentVersion || '' })
663
+ : fmtText(textDict.updateAvailablePattern || 'Update available v{version}', { version: info?.latestVersion || '' });
664
+ const buttonText = activeStage
665
+ ? (textDict.pleaseWait || 'Please wait')
666
+ : completed
667
+ ? (textDict.completedShort || 'Done')
668
+ : failed
669
+ ? (textDict.retryBtn || 'Retry')
670
+ : (textDict.upgradeBtn || 'Upgrade');
671
+ const detail = options.connectionError
672
+ ? `${textDict.reconnectHint || ''}\n${textDict.terminalUpgradePrefix || ''}${command}`
673
+ : failed
674
+ ? `${update?.error || ''}\n${textDict.terminalUpgradePrefix || ''}${command}`
675
+ : (completed && update?.reconnectMcp ? (textDict.reconnectMcpHint || '') : '');
676
+ const currentVersion = info?.currentVersion || '';
677
+ const checkFailed = !visible && options.manualCheckStatus === 'failed';
678
+ let versionText = currentVersion ? fmtText(textDict.versionTagPattern || 'v{version}', { version: currentVersion }) : '';
679
+ if (checkFailed) {
680
+ const errText = options.checkError || info?.checkError || '';
681
+ versionText = errText ? `${textDict.checkUpdateFailedLabel || 'Update check failed'}: ${errText}` : (textDict.checkUpdateFailedLabel || 'Update check failed');
682
+ } else if (!visible && options.manualCheckStatus === 'latest' && currentVersion) {
683
+ versionText = fmtText(textDict.alreadyLatestPattern || 'Up to date (v{version})', { version: currentVersion });
684
+ }
685
+ const checking = Boolean(options.checking);
686
+ return {
687
+ visible,
688
+ active: activeStage,
689
+ completed,
690
+ failed,
691
+ buttonDisabled: activeStage || completed,
692
+ label,
693
+ buttonText,
694
+ detail,
695
+ currentVersion,
696
+ versionText,
697
+ showVersionBar: !visible,
698
+ checking,
699
+ checkDisabled: checking,
700
+ checkFailed,
701
+ checkButtonText: checking ? (textDict.checkingUpdateShort || 'Checking...') : (textDict.checkUpdateBtn || 'Check updates'),
702
+ };
703
+ }
628
704
 
629
705
  const active = forLang(currentLang);
630
706
  return {
@@ -647,6 +723,7 @@ function createPresentation(lang) {
647
723
  progressState,
648
724
  draftTransition,
649
725
  analysisDisabled,
726
+ updateBannerState,
650
727
  };
651
728
  }
652
729
 
@@ -1373,7 +1450,7 @@ function installCodexSessionStatus(version, restored, embedded) {
1373
1450
  panelEvent('close', panel.entry);
1374
1451
  const target = panel; panel = null;
1375
1452
  clearTimeout(target.pollTimer); cancelAnimationFrame(target.marqueeFrame);
1376
- clearTimeout(target.updateTimer);
1453
+ clearTimeout(target.updateTimer); clearTimeout(target.manualCheckTimer);
1377
1454
  target.resizeObserver?.disconnect();
1378
1455
  target.root.remove(); target.entry.button.setAttribute('aria-expanded', 'false');
1379
1456
  if (restoreFocus && target.entry.host.isConnected) target.entry.button.focus();
@@ -1408,6 +1485,7 @@ function installCodexSessionStatus(version, restored, embedded) {
1408
1485
  .note-label{display:block;font-size:11px;color:var(--secondary);margin-bottom:8px}textarea{display:block;width:100%;resize:vertical;min-height:66px;max-height:140px;background:var(--input-bg);color:inherit;border:1px solid var(--input-border);border-radius:8px;padding:9px;line-height:1.6;font-size:12px;scrollbar-width:none;-ms-overflow-style:none}textarea::-webkit-scrollbar{display:none;width:0;height:0}textarea::placeholder{color:var(--muted)}.edit-actions{display:flex;justify-content:flex-end;gap:18px;align-items:center;padding:21px 0 16px}.git{font-size:11px;color:var(--secondary)}.analysis-message{font-size:11px;color:var(--secondary);margin:0 0 13px}.analysis-message:empty,.error:empty,.git:empty{display:none}.error{flex:none;font-size:12px;color:var(--error);padding-top:10px;white-space:pre-wrap}button:disabled,input:disabled,textarea:disabled{opacity:.55;cursor:wait}button:focus-visible,input:focus-visible,textarea:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
1409
1486
  .shell textarea:focus-visible{outline:none}
1410
1487
  .app-update{margin-top:3px;padding:10px 11px;background:var(--hover);border:1px solid var(--line);border-radius:10px}.app-update-row{display:flex;align-items:center;justify-content:space-between;gap:10px}.app-update-label{font-size:12px;line-height:18px;color:var(--ink);min-width:0;overflow-wrap:anywhere}.app-update-button{flex:none;padding:5px 10px;min-height:28px;border-radius:7px;font-size:11px}.app-update-detail{margin-top:7px;font-size:11px;line-height:1.6;color:var(--secondary);white-space:pre-wrap;overflow-wrap:anywhere;user-select:text}.app-update[data-failed=true] .app-update-detail{color:var(--error)}
1488
+ .version-bar{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:10px 0 2px;font-size:11px;line-height:16px;color:var(--muted)}.version-bar-text{min-width:0;overflow-wrap:anywhere}.version-bar[data-failed=true] .version-bar-text{color:var(--error)}.version-check-button{flex:none;font-size:11px;color:var(--muted)}.version-check-button:hover:not(:disabled){color:inherit}
1411
1489
  :host([data-color-mode=light]){--ink:#22272e;--secondary:#576374;--muted:#667383;--note:#46515f;--track:#dfe4ea;--line:#dfe4ea;--input-border:#c7d0da;--input-bg:#f7f9fb;--hover:#f0f3f6;--selected:#e9edf2;--source-bg:#e9eef4;--number-line:#b6c1ce;--thumb:#ffffff;--danger:#bf2f3a;--error:#b13a2d;color:var(--ink);color-scheme:light}
1412
1490
  :host([data-color-mode=light]) .shell{--panel-bg:#fff;border-color:#dfe4ea;box-shadow:0 14px 45px #26344520}
1413
1491
  :host([data-color-mode=light]) .shell:hover{--panel-bg:#f5f6f7}
@@ -1478,6 +1556,9 @@ function installCodexSessionStatus(version, restored, embedded) {
1478
1556
  const appUpdateLabel = element('span', null, appUpdateRow, 'app-update-label'); appUpdateLabel.setAttribute('role', 'status');
1479
1557
  const appUpdateButton = element('button', S('upgradeBtn'), appUpdateRow, 'primary app-update-button');
1480
1558
  const appUpdateDetail = element('div', null, appUpdate, 'app-update-detail'); appUpdateDetail.hidden = true;
1559
+ const versionBar = element('div', null, overview, 'version-bar'); versionBar.hidden = true;
1560
+ const versionBarText = element('span', null, versionBar, 'version-bar-text'); versionBarText.setAttribute('role', 'status');
1561
+ const checkUpdateButton = element('button', S('checkUpdateBtn'), versionBar, 'text-button version-check-button');
1481
1562
  const edit = element('div', null, body, 'view edit-view'); edit.hidden = true;
1482
1563
  const editHeading = element('div', null, edit, 'view-heading'); const editHeadingTitle = element('h3', S('editHeading'), editHeading);
1483
1564
  const choices = new Map(), choiceLabels = new Map(), controls = [];
@@ -1563,6 +1644,8 @@ function installCodexSessionStatus(version, restored, embedded) {
1563
1644
  if (timelineBackBtn) timelineBackBtn.textContent = S('backLabel');
1564
1645
  resolveConflict.textContent = S('resolveConflictBtn');
1565
1646
  target.tasksKey = null; target.completedKey = null; target.timelineRevision = null;
1647
+ if (target.updateInfo || target.updateChecking || target.manualCheckStatus) showAppUpdate(target.updateInfo);
1648
+ else checkUpdateButton.textContent = S('checkUpdateBtn');
1566
1649
  };
1567
1650
  target.capabilities = embedded?.session?.capabilities || null;
1568
1651
  panelEvent('open', entry);
@@ -1576,24 +1659,58 @@ function installCodexSessionStatus(version, restored, embedded) {
1576
1659
  resolveConflict.onclick = () => rebaseDraft(target);
1577
1660
  const showAppUpdate = info => {
1578
1661
  target.updateInfo = info;
1579
- const update = info?.update;
1580
- const stage = update?.stage;
1581
- const stages = strings.updateStages || { queued: '正在准备升级', checking: '正在检查版本', downloading: '正在下载新版本', waiting: '等待当前分析结束', installing: '正在升级' };
1582
- const active = Boolean(stages[stage]) || target.upgradeStarting;
1583
- const completed = stage === 'completed' && Date.now() - Date.parse(update.updatedAt) < 60000;
1584
- const failed = stage === 'failed';
1585
- appUpdate.hidden = !info?.available && !active && !failed && !completed;
1586
- appUpdate.setAttribute('data-failed', String(failed));
1587
- appUpdateLabel.textContent = active ? stages[stage] || stages.queued : failed ? S('updateFailedLabel') : completed
1588
- ? S('upgradedToPattern', { version: update.currentVersion }) : S('updateAvailablePattern', { version: info?.latestVersion });
1589
- appUpdateButton.textContent = active ? S('pleaseWait') : completed ? S('completedShort') : failed ? S('retryBtn') : S('upgradeBtn');
1590
- appUpdateButton.disabled = active || completed;
1591
- const command = info?.command || 'npx agent-things@latest';
1592
- appUpdateDetail.textContent = target.updateConnectionError ? `${S('reconnectHint')}\n${S('terminalUpgradePrefix')}${command}`
1593
- : failed ? `${update.error}\n${S('terminalUpgradePrefix')}${command}` : completed && update.reconnectMcp ? S('reconnectMcpHint') : '';
1662
+ const options = {
1663
+ starting: target.upgradeStarting,
1664
+ checking: target.updateChecking,
1665
+ connectionError: target.updateConnectionError,
1666
+ manualCheckStatus: target.manualCheckStatus,
1667
+ checkError: target.manualCheckError,
1668
+ };
1669
+ const banner = presentation?.updateBannerState
1670
+ ? presentation.updateBannerState(info, strings, options)
1671
+ : (() => {
1672
+ const update = info?.update;
1673
+ const stage = update?.stage;
1674
+ const stages = strings.updateStages || { queued: '正在准备升级', checking: '正在检查版本', downloading: '正在下载新版本', waiting: '等待当前分析结束', installing: '正在升级' };
1675
+ const active = Boolean(stages[stage]) || Boolean(options.starting);
1676
+ const completed = stage === 'completed' && Date.now() - Date.parse(update.updatedAt) < 60000;
1677
+ const failed = stage === 'failed';
1678
+ const visible = Boolean(info?.available || active || failed || completed);
1679
+ const command = info?.command || 'npx agent-things@latest';
1680
+ return {
1681
+ visible,
1682
+ active,
1683
+ completed,
1684
+ failed,
1685
+ buttonDisabled: active || completed,
1686
+ label: active ? stages[stage] || stages.queued : failed ? S('updateFailedLabel') : completed
1687
+ ? S('upgradedToPattern', { version: update?.currentVersion }) : S('updateAvailablePattern', { version: info?.latestVersion }),
1688
+ buttonText: active ? S('pleaseWait') : completed ? S('completedShort') : failed ? S('retryBtn') : S('upgradeBtn'),
1689
+ detail: options.connectionError ? `${S('reconnectHint')}\n${S('terminalUpgradePrefix')}${command}`
1690
+ : failed ? `${update?.error || ''}\n${S('terminalUpgradePrefix')}${command}` : completed && update?.reconnectMcp ? S('reconnectMcpHint') : '',
1691
+ versionText: options.manualCheckStatus === 'failed'
1692
+ ? `${S('checkUpdateFailedLabel')}${options.checkError ? `: ${options.checkError}` : ''}`
1693
+ : (options.manualCheckStatus === 'latest' && info?.currentVersion ? S('alreadyLatestPattern', { version: info.currentVersion }) : (info?.currentVersion ? `v${info.currentVersion}` : '')),
1694
+ showVersionBar: !visible,
1695
+ checkDisabled: Boolean(options.checking),
1696
+ checkFailed: !visible && options.manualCheckStatus === 'failed',
1697
+ checkButtonText: options.checking ? S('checkingUpdateShort') : S('checkUpdateBtn'),
1698
+ };
1699
+ })();
1700
+ appUpdate.hidden = !banner.visible;
1701
+ appUpdate.setAttribute('data-failed', String(banner.failed));
1702
+ appUpdateLabel.textContent = banner.label;
1703
+ appUpdateButton.textContent = banner.buttonText;
1704
+ appUpdateButton.disabled = banner.buttonDisabled;
1705
+ appUpdateDetail.textContent = banner.detail;
1594
1706
  appUpdateDetail.hidden = !appUpdateDetail.textContent;
1707
+ versionBar.hidden = !(banner.showVersionBar && (info || banner.checking || banner.checkFailed));
1708
+ versionBar.setAttribute('data-failed', String(banner.checkFailed));
1709
+ versionBarText.textContent = banner.versionText;
1710
+ checkUpdateButton.textContent = banner.checkButtonText;
1711
+ checkUpdateButton.disabled = banner.checkDisabled;
1595
1712
  refreshPanel();
1596
- return active;
1713
+ return banner.active;
1597
1714
  };
1598
1715
  const pollAppUpdate = async () => {
1599
1716
  clearTimeout(target.updateTimer);
@@ -1601,6 +1718,10 @@ function installCodexSessionStatus(version, restored, embedded) {
1601
1718
  const info = await target.request('app-update-info', 12000);
1602
1719
  if (panel !== target) return;
1603
1720
  target.updateConnectionError = null;
1721
+ if (info?.available) {
1722
+ target.manualCheckStatus = '';
1723
+ target.manualCheckError = '';
1724
+ }
1604
1725
  const active = showAppUpdate(info);
1605
1726
  target.updateTimer = setTimeout(pollAppUpdate, active ? 2000 : 60000);
1606
1727
  } catch (error) {
@@ -1610,6 +1731,41 @@ function installCodexSessionStatus(version, restored, embedded) {
1610
1731
  target.updateTimer = setTimeout(pollAppUpdate, 2000);
1611
1732
  }
1612
1733
  };
1734
+ checkUpdateButton.onclick = async () => {
1735
+ if (target.updateChecking || checkUpdateButton.disabled) return;
1736
+ clearTimeout(target.updateTimer);
1737
+ clearTimeout(target.manualCheckTimer);
1738
+ target.updateChecking = true;
1739
+ target.manualCheckStatus = '';
1740
+ target.manualCheckError = '';
1741
+ showAppUpdate(target.updateInfo);
1742
+ try {
1743
+ const info = await target.request('app-update-info', 12000, { force: true });
1744
+ if (panel !== target) return;
1745
+ target.updateChecking = false;
1746
+ target.updateConnectionError = null;
1747
+ if (info?.checkError && !info?.available) {
1748
+ target.manualCheckStatus = 'failed';
1749
+ target.manualCheckError = info.checkError;
1750
+ } else if (!info?.available) {
1751
+ target.manualCheckStatus = 'latest';
1752
+ target.manualCheckTimer = setTimeout(() => {
1753
+ if (panel !== target || target.manualCheckStatus !== 'latest') return;
1754
+ target.manualCheckStatus = '';
1755
+ showAppUpdate(target.updateInfo);
1756
+ }, 5000);
1757
+ }
1758
+ const active = showAppUpdate(info);
1759
+ target.updateTimer = setTimeout(pollAppUpdate, active ? 2000 : 60000);
1760
+ } catch (error) {
1761
+ if (panel !== target) return;
1762
+ target.updateChecking = false;
1763
+ target.manualCheckStatus = 'failed';
1764
+ target.manualCheckError = error.message;
1765
+ showAppUpdate(target.updateInfo);
1766
+ target.updateTimer = setTimeout(pollAppUpdate, 60000);
1767
+ }
1768
+ };
1613
1769
  appUpdateButton.onclick = async () => {
1614
1770
  if (appUpdateButton.disabled) return;
1615
1771
  clearTimeout(target.updateTimer);
@@ -1709,7 +1865,7 @@ function installCodexSessionStatus(version, restored, embedded) {
1709
1865
  element('span', null, row, 'task-dot'); const content = element('div', null, row, 'task-content');
1710
1866
  const title = element('div', null, content, 'task-title'); title.title = task.title;
1711
1867
  const track = element('div', null, title, 'task-track');
1712
- const text = task.summary || task.title;
1868
+ const text = task.title || task.summary;
1713
1869
  element('span', text, track, 'task-copy');
1714
1870
  element('div', taskLabels[task.status] || S('taskUnknown'), content, 'task-meta');
1715
1871
  const ref = task.evidenceRefs?.find(value => sources?.[value]?.turnId);
@@ -1935,7 +2091,7 @@ function installCodexSessionStatus(version, restored, embedded) {
1935
2091
  },
1936
2092
  destroy() {
1937
2093
  destroyed = true; localCards?.destroy(); harness?.dispose?.(); observer.disconnect(); rootObserver?.disconnect(); headObserver?.disconnect(); cancelAnimationFrame(frame);
1938
- if (panel) { rememberPanel(panel); panelEvent('dispose', panel.entry); clearTimeout(panel.pollTimer); clearTimeout(panel.updateTimer); cancelAnimationFrame(panel.marqueeFrame); panel.resizeObserver?.disconnect(); panel.root.remove(); panel.entry.button?.setAttribute('aria-expanded', 'false'); panel = null; }
2094
+ if (panel) { rememberPanel(panel); panelEvent('dispose', panel.entry); clearTimeout(panel.pollTimer); clearTimeout(panel.updateTimer); clearTimeout(panel.manualCheckTimer); cancelAnimationFrame(panel.marqueeFrame); panel.resizeObserver?.disconnect(); panel.root.remove(); panel.entry.button?.setAttribute('aria-expanded', 'false'); panel = null; }
1939
2095
  for (const entry of [...mounted.values()]) unmount(entry);
1940
2096
  document.removeEventListener('pointerdown', onOutside, true); document.removeEventListener('keydown', onKey, true);
1941
2097
  document.removeEventListener('scroll', onScroll, true); window.removeEventListener('resize', positionPanel);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-things",
3
- "version": "1.3.1",
3
+ "version": "1.3.3",
4
4
  "description": "Session task progress and checklists for ChatGPT, Antigravity and Claude Desktop on macOS.",
5
5
  "license": "MIT",
6
6
  "author": "snuffpic",
@@ -5,7 +5,7 @@ const { createPresentation } = require('../src/ui-foundation.cjs');
5
5
 
6
6
  function buildSharedUi() {
7
7
  const target = path.join(__dirname, '../mods/agent-things-ui/hooks/foundation.js');
8
- const source = `// Generated from src/ui-foundation.cjs. Edit the shared source.\nconst presentation = (${createPresentation.toString()})();\nexport const { lang, labels, colors, taskLabels, strings, locales, layout, accent, claudeCodeThemes, normalizeHexColor, resolveAccentPalette, t, format, forLang, formatDate, progressValue, progressState, draftTransition, analysisDisabled } = presentation;\n`;
8
+ const source = `// Generated from src/ui-foundation.cjs. Edit the shared source.\nconst presentation = (${createPresentation.toString()})();\nexport const { lang, labels, colors, taskLabels, strings, locales, layout, accent, claudeCodeThemes, normalizeHexColor, resolveAccentPalette, t, format, forLang, formatDate, progressValue, progressState, draftTransition, analysisDisabled, updateBannerState } = presentation;\n`;
9
9
  fs.writeFileSync(target, source);
10
10
 
11
11
  const sidecarI18nTarget = path.join(__dirname, '../src/plugins/things/sidecars/things_board/ui-i18n.mjs');
@@ -3,7 +3,8 @@
3
3
  "properties": {
4
4
  "summary": {
5
5
  "type": "string",
6
- "maxLength": 120
6
+ "maxLength": 120,
7
+ "description": "Concise overall summary (at most 120 chars) stating the current goal and remaining work."
7
8
  },
8
9
  "gitPush": {
9
10
  "type": "object",
@@ -41,7 +42,8 @@
41
42
  ]
42
43
  },
43
44
  "title": {
44
- "type": "string"
45
+ "type": "string",
46
+ "description": "Full task title (action + target) preserving full scope; do not put completion status, waiting reasons, or progress remarks here."
45
47
  },
46
48
  "status": {
47
49
  "type": "string",
@@ -61,7 +63,8 @@
61
63
  },
62
64
  "summary": {
63
65
  "type": "string",
64
- "maxLength": 60
66
+ "maxLength": 60,
67
+ "description": "Short standalone task title (at most 60 chars, concise action + target). NEVER write status remarks or blocker notes such as 'merged to main', 'pending decision', 'waiting for test', or 'not scheduled yet'."
65
68
  }
66
69
  },
67
70
  "required": [
@@ -3,7 +3,8 @@
3
3
  "properties": {
4
4
  "summary": {
5
5
  "type": "string",
6
- "maxLength": 40
6
+ "maxLength": 40,
7
+ "description": "不超过40个汉字的整体进展摘要,说明当前核心目标与剩余工作。"
7
8
  },
8
9
  "gitPush": {
9
10
  "type": "object",
@@ -41,7 +42,8 @@
41
42
  ]
42
43
  },
43
44
  "title": {
44
- "type": "string"
45
+ "type": "string",
46
+ "description": "完整任务标题(动作 + 目标对象),保留完整范围;不要包含完成状态、等待原因或进度评论。"
45
47
  },
46
48
  "status": {
47
49
  "type": "string",
@@ -61,7 +63,8 @@
61
63
  },
62
64
  "summary": {
63
65
  "type": "string",
64
- "maxLength": 20
66
+ "maxLength": 20,
67
+ "description": "不超过20个汉字的简短任务标题(精简版动作 + 对象),供独立识别任务。严禁写成“已合入”“待定”“待实测”“未做,待安排”等纯状态描述或进展批注。"
65
68
  }
66
69
  },
67
70
  "required": [
@@ -14,4 +14,4 @@ Rules:
14
14
  11. `projectGit` is the remote Git state detected by the program. `gitPush` reflects delivery push status: set `pushed` (with supporting `evidenceRefs`) when conversation explicitly reports a successful push or user confirmation of push; set `not_pushed` when explicitly unpushed; otherwise `unknown`. All tasks being done alone does not prove changes were pushed. If new modifications occur after a previous push without a new push, update to `not_pushed`; if uncertain relative to prior pushes, use `unknown`. Ignore non-text attachments such as images and rely on text messages/answers.
15
15
  12. Output strictly according to the JSON Schema with no Markdown wrapper. Totals and percentages are computed by the program after merging the ledger—do not output counts yourself.
16
16
  13. LANGUAGE REQUIREMENT: Write `summary`, every task's `title`, and every task's short `summary` in clear, concise **English** (even if the source conversation is in Chinese or mixed languages). If `previousLedger` contains non-English titles or summaries, rewrite all affected task titles, short `summary` strings, and top-level `summary` into English while keeping their existing `knownTaskId`.
17
- 14. For each output task, provide both a full `title` and a concise short `summary`: keep each task `summary` under 60 characters (at most 2 short clauses) capturing both action and target so it stands alone cleanly (e.g., "Verify full session analysis", "Export delivery checklist"). Keep the full task scope in `title`, and represent state exclusively via `status`.
17
+ 14. For each output task, provide both a full `title` and a concise short `summary`: BOTH must name the task as "action + target", while progress state and blockers belong strictly in `status`. Keep the full scope in `title`; write task `summary` as a short standalone task title under 60 characters (at most 2 short clauses) capturing both action and target (e.g., "Verify full session analysis", "Export delivery checklist", "Fix Linux workspace guard"). NEVER write status notes or deferral phrases like "merged to main", "pending decision", "waiting for test", or "not scheduled" in `summary`; if `previousLedger` contains status-only `summary` text, keep its `knownTaskId` and rewrite `summary` into a proper action+target short title.
@@ -14,5 +14,5 @@
14
14
  11. projectGit 是程序检测的项目远端配置。gitPush 描述当前交付内容的推送状态:对话明确报告推送成功、或用户确认已推送时为 pushed,并引用对应事件;明确尚未推送为 not_pushed,其余为 unknown。任务全部完成不能单独证明已经推送。之后出现的新改动尚未再次推送时,应更新为 not_pushed;当前工作与历史推送的关系不明确时用 unknown。可结合上一份账本的 gitPush 和本批事件进行增量更新。图片等非文本附件不纳入分析,依据对话文本和答复识别任务。
15
15
  12. 严格按JSON Schema输出本批任务增量与当前摘要,不附Markdown。总数和比例由程序合并账本后计算,不自行输出计数。模型结果的生效顺序由程序根据用户操作序号决定。
16
16
 
17
- 13. 每个输出任务同时提供完整 title 与简短 summary;任务 summary 不超过20个汉字、最多2个短句,必须概括任务动作和对象,供独立识别任务,例如“验收完整会话分析”“导出交付清单”。title 保留完整任务范围。状态统一由 status 表达。
17
+ 13. 每个输出任务同时提供完整 title 与简短 summary:两者都必须写成“动作+对象”的任务名称,状态与阻塞原因统一只通过 status 表达。title 保留完整任务范围;任务 summary 是不超过20个汉字(最多2个短句)的简短任务标题,必须让人不看上下文就能认出“要做什么事”(例如“验收完整会话分析”“导出交付清单”“修复Linux守卫报错”),严禁写成“已合入main”“等锚点再定”“待用户确认”“未做,待安排”等纯状态描述或进展批注;若 previousLedger 中已有任务的 summary 属于纯状态描述,请保留其 knownTaskId 并一并改写为规范的短任务标题。
18
18
  14. 语言要求:顶层 summary、每项任务的 title 与短 summary 一律用简体中文书写(即使原对话是英文或中英混合);代码标识、命令、文件名和产品名保留原文。previousLedger 中的任务标题、短总结或顶层 summary 不是中文时,保留其 knownTaskId,将受影响任务的 title、短 summary 及顶层 summary 改写为中文后一并返回。
@@ -46,12 +46,28 @@ function dehydrateTerminalLogs(text) {
46
46
  return compacted.join('\n');
47
47
  }
48
48
 
49
- // Strip only recognized machine envelopes; quoted XML and ordinary human text remain data.
50
- function cleanMessage(text) {
51
- let value = text.trim();
52
- const leading = /^<(heartbeat|in-app-browser-context|send_user_message_question_reply)\b[^>]*>([\s\S]*?)<\/\1>/;
49
+ const MACHINE_ENVELOPE_TAGS = [
50
+ 'heartbeat',
51
+ 'in-app-browser-context',
52
+ 'send_user_message_question_reply',
53
+ 'system-reminder',
54
+ 'task-notification',
55
+ 'side-sessions-event',
56
+ 'local-command-caveat',
57
+ 'command-name',
58
+ 'command-message',
59
+ 'command-args',
60
+ 'local-command-stdout',
61
+ 'tools-used-before-summary',
62
+ ].join('|');
63
+
64
+ const LEADING_ENVELOPE_RE = new RegExp(`^<(${MACHINE_ENVELOPE_TAGS})\\b[^>]*>([\\s\\S]*?)<\\/\\1>`);
65
+
66
+ // Strip only recognized leading machine envelopes; quoted XML and ordinary human text remain data.
67
+ function stripLeadingEnvelopes(text) {
68
+ let value = String(text || '').trim();
53
69
  let match;
54
- while ((match = value.match(leading))) {
70
+ while ((match = value.match(LEADING_ENVELOPE_RE))) {
55
71
  let replacement = '';
56
72
  if (match[1] === 'send_user_message_question_reply') {
57
73
  try {
@@ -63,6 +79,11 @@ function cleanMessage(text) {
63
79
  value = (replacement + '\n' + value.slice(match[0].length)).trim();
64
80
  if (replacement) break;
65
81
  }
82
+ return value;
83
+ }
84
+
85
+ function cleanMessage(text) {
86
+ let value = stripLeadingEnvelopes(text);
66
87
  // 仅应用规则 1 (代码块脱水) 与 规则 3 (终端日志脱水),智能体正文汇报完整保留
67
88
  value = dehydrateCodeBlocks(value);
68
89
  value = dehydrateTerminalLogs(value);
@@ -147,4 +168,4 @@ function commitCheckpoint(extracted, ledger, versions) {
147
168
  versions: { prompt: versions.prompt, schema: versions.schema, ledger: versions.ledger },
148
169
  turnHashes: extracted.turnHashes, ledger };
149
170
  }
150
- module.exports = { extractHistory, prepareIncremental, commitCheckpoint };
171
+ module.exports = { extractHistory, prepareIncremental, commitCheckpoint, stripLeadingEnvelopes, cleanMessage };
@@ -12,7 +12,7 @@ const { assertUpdateIdle } = require('./npm-updates.cjs');
12
12
  const { nextBatch, measureRequest, splitAdaptiveBatches, FULL_PASS_MAX_BYTES, FULL_PASS_TOKEN_BUDGET, getAnalysisInstructions } = require('./analysis-budget.cjs');
13
13
  const { errorDetails, progressError } = require('./progress-error.cjs');
14
14
  const { readConfiguredLang } = require('./i18n.cjs');
15
- const versions = { prompt: '4', schema: '4', ledger: '3' };
15
+ const versions = { prompt: '5', schema: '5', ledger: '3' };
16
16
  class AnalysisService {
17
17
  constructor({ store, onChange = () => {}, makeServer, run,
18
18
  resources = path.join(__dirname, 'analysis-assets'), logFile = path.join(path.dirname(store.file), 'analysis.jsonl'),