@v587d/capital-generation 2.19.2 → 2.20.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.
@@ -85,6 +85,9 @@ const AUTOSAVE_DELAY_MS = 600
85
85
  const BOARD_UI_KEY = 'capital-automation:board-ui:v3'
86
86
  const BOARD_PANEL_KEYS = ['todo', 'stocks', 'gaps', 'health']
87
87
  const BOARD_TODO_PERIODS = ['today', 'future', 'expired']
88
+ const BOARD_STOCK_PAGE_SIZE = 12
89
+ const BOARD_STOCK_ROLES = ['holding', 'risk', 'event', 'watch']
90
+ const BOARD_BRIEF_HIGHLIGHT_MS = 3_000
88
91
  const BOARD_PANEL_IDS = {
89
92
  'capital-automation-todo': 'todo',
90
93
  'capital-automation-stocks': 'stocks',
@@ -103,11 +106,23 @@ const zh = {
103
106
  goTasks: '去任务页运行',
104
107
  goEnable: '去启用任务',
105
108
  newTask: '新建任务',
106
- statsBriefs: '本期简报',
107
- statsTodos: '今日 TODO',
108
- statsStocks: '标的',
109
- statsGaps: '缺口',
110
- statsIssues: '近 7 天异常',
109
+ statsBriefsToday: '今天简报',
110
+ statsBriefsTotal: '总简报',
111
+ statsTodos: '今天 TODO',
112
+ statsTodoManual: '人工',
113
+ statsTodoAuto: '自动',
114
+ statsStocks: '个股动态',
115
+ statsStocksNew: '新增',
116
+ statsGaps: '数据能力缺口',
117
+ statsGapsNew: '新增',
118
+ statsIssuesToday: '今天运行异常',
119
+ statsBriefsTodayHint: '点击高亮今天的简报卡片',
120
+ statsTodoHint: '点击查看今天的 TODO',
121
+ statsTodoManualHint: '需要你确认或跟踪的 TODO',
122
+ statsTodoAutoHint: '自动核验中的 TODO',
123
+ statsStockHint: '点击查看个股动态',
124
+ statsGapHint: '点击查看数据能力缺口',
125
+ statsIssuesTodayHint: '点击查看今天的运行异常',
111
126
  refresh: '刷新',
112
127
  range: '时间范围',
113
128
  range7: '最近 7 天',
@@ -136,14 +151,27 @@ const zh = {
136
151
  askPending: '正在回答…',
137
152
  askFailed: '回答失败',
138
153
  askMore: '查看更多',
139
- stocksCount: '{n} 个标的',
154
+ stockTitle: '个股动态',
155
+ stocksCount: '共 {n} 只',
156
+ stockFilteredCount: '{shown} / {total} 只',
157
+ stockFilterLabel: '按标签筛选',
158
+ stockFilterAll: '全部',
159
+ stockFilterEmpty: '没有符合该标签的个股',
160
+ stockShowAll: '展开全部 {n} 只',
161
+ stockShowLess: '收起',
140
162
  gapsCount: '{n} 个缺口',
141
- todoConfirm: '待确认',
142
- todoVerify: '待验证',
143
- todoTrack: '跟踪',
144
- todoAck: '确认',
145
- todoAckTitle: '确认并移除这条 TODO',
146
- todoAcked: '已确认,已从 TODO 移除',
163
+ todoAckTitle: '标记为已确认',
164
+ todoAcked: '已确认',
165
+ watchWatching: '自动核验中',
166
+ watchTriggered: '已触发',
167
+ watchNeedsHuman: '待人工确认',
168
+ watchResolved: '已确认',
169
+ watchExpired: '已停止核验',
170
+ watchTracking: '跟踪',
171
+ watchEvidence: '核验依据',
172
+ watchChecked: '核验于 {time}',
173
+ notificationFallbackTodoTriggered: '条件已触发,查看 TODO 详情。',
174
+ notificationFallbackTodoNeedsHuman: '自动核验无法确认,需要你确认。',
147
175
  todoEmptyToday: '今天暂无待办',
148
176
  todoEmptyGroup: '暂无「{label}」待办',
149
177
  todoFilterLabel: '按日期筛选',
@@ -156,18 +184,19 @@ const zh = {
156
184
  hideBasis: '收起依据',
157
185
  seenCount: '{n} 次运行提到',
158
186
  sourceRun: '来源',
159
- stockEmpty: '最近运行没有提到自选股',
160
- stockOther: '其他事件 {n} 只',
161
- stockTodoCount: '{n} 项待办',
187
+ stockEmpty: '最近运行没有提到个股',
188
+ stockOther: '另有 {n} 只未显示',
189
+ stockTodoCount: '{n} 条待跟进',
190
+ stockTodoCountHint: '与这只个股相关的待确认、待验证或待跟踪事项;展开后可直接打开来源 session',
162
191
  roleHolding: '持仓',
163
192
  roleWatch: '关注',
164
193
  roleEvent: '事件',
165
194
  roleRisk: '风险',
195
+ roleHoldingHint: '自选清单里标记为持仓',
196
+ roleWatchHint: '在自选清单里关注,未标记持仓',
197
+ roleEventHint: '近期运行提到需要跟踪的事件或催化',
198
+ roleRiskHint: '近期运行提示存在风险',
166
199
  gapEmpty: '最近运行没有报告数据缺口',
167
- gapCapability: '能力缺口',
168
- gapTransient: '本次未取到',
169
- gapConflict: '口径冲突',
170
- gapQuality: '数据质量',
171
200
  gapSeen: '{n} 次运行',
172
201
  gapAll: '查看全部',
173
202
  healthTitle: '运行健康',
@@ -195,7 +224,6 @@ const zh = {
195
224
  healthBriefSkipped: '跳过',
196
225
  healthNoBrief: '没有已入队简报',
197
226
  healthRecovered: '已补跑',
198
- healthOpen: '打开 session',
199
227
  healthCalendarOk: '正常',
200
228
  healthCalendarBad: '不可用',
201
229
  loadError: '看板暂时不可用',
@@ -419,6 +447,7 @@ const zh = {
419
447
  allRead: '全部已读',
420
448
  noNotifications: '没有未读或历史任务通知。',
421
449
  notificationOpenTask: '查看任务',
450
+ notificationOpenTodo: '查看 TODO',
422
451
  systemStatus: '系统状态',
423
452
  systemActive: '定时调度正常',
424
453
  systemStandby: '本窗口待命,不启动新的定时运行',
@@ -963,15 +992,20 @@ function installStyles() {
963
992
  .capital-automation-boardtools { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
964
993
  .capital-automation-boardactions { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-left: auto; }
965
994
  .capital-automation-boardstats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
966
- .capital-automation-boardstat { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; min-height: 62px; padding: 10px 12px; border: .5px solid var(--ca-line); border-radius: 12px; background: var(--ca-card); color: inherit; font: inherit; text-align: left; cursor: pointer; transition: background .15s, border-color .15s; }
967
- .capital-automation-boardstat:hover { background: color-mix(in srgb, var(--ca-hover) 58%, var(--ca-card)); border-color: color-mix(in srgb, var(--ca-business) 24%, var(--ca-line)); }
968
- .capital-automation-boardstat:focus-visible { outline: 2px solid var(--dsw-focus-ring-color, var(--ca-business)); outline-offset: 1px; }
969
- .capital-automation-boardstatlabel { color: var(--ca-muted); font-size: 11.5px; line-height: 17px; }
970
- .capital-automation-boardstat strong { color: var(--dsw-alias-label-primary); font-size: 18px; line-height: 24px; font-weight: 600; font-variant-numeric: tabular-nums; }
995
+ .capital-automation-boardstat { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; min-height: 62px; padding: 10px 12px; border: .5px solid var(--ca-line); border-radius: 12px; background: var(--ca-card); color: inherit; text-align: left; }
996
+ .capital-automation-boardstatlabel { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 3px; color: var(--ca-muted); font-size: 11.5px; line-height: 17px; }
997
+ .capital-automation-boardstatvalue { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 2px; color: var(--dsw-alias-label-primary); font-size: 18px; line-height: 24px; font-weight: 600; font-variant-numeric: tabular-nums; }
998
+ .capital-automation-boardstatnum { margin: 0; padding: 0; border: 0; background: transparent; color: inherit; font: inherit; font-variant-numeric: inherit; line-height: inherit; }
999
+ .capital-automation-boardstatnum[data-clickable="true"] { border-radius: 4px; cursor: pointer; transition: color .15s; }
1000
+ .capital-automation-boardstatnum[data-clickable="true"]:hover { color: var(--ca-business-text); text-decoration: underline; text-underline-offset: 2px; }
1001
+ .capital-automation-boardstatnum[data-clickable="true"]:focus-visible { outline: 2px solid var(--dsw-focus-ring-color, var(--ca-business)); outline-offset: 1px; }
1002
+ .capital-automation-boardstatsep { color: var(--dsw-alias-label-secondary); font-weight: 500; }
1003
+ .capital-automation-boardstatvalue .capital-automation-boardstatsep { padding: 0 3px; }
971
1004
  .capital-automation-boardgrid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 340px); align-items: start; gap: 20px; min-width: 0; }
972
1005
  .capital-automation-boardgrid[data-rail="closed"] { grid-template-columns: minmax(0, 1fr); }
973
1006
  .capital-automation-boardmain { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
974
- .capital-automation-briefcard { box-sizing: border-box; display: flex; flex-direction: column; gap: 10px; padding: 16px 18px 13px; border: .5px solid var(--ca-line); border-radius: 16px; background: var(--ca-card); min-width: 0; }
1007
+ .capital-automation-briefcard { box-sizing: border-box; display: flex; flex-direction: column; gap: 10px; padding: 16px 18px 13px; border: .5px solid var(--ca-line); border-radius: 16px; background: var(--ca-card); min-width: 0; transition: border-color .2s ease, box-shadow .2s ease; }
1008
+ .capital-automation-briefcard[data-highlight="true"] { border-color: var(--ca-business); box-shadow: 0 0 0 1px var(--ca-business); }
975
1009
  .capital-automation-briefhead { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 8px 14px; }
976
1010
  .capital-automation-brieftitle { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 7px; min-width: 0; }
977
1011
  .capital-automation-brieftitle h3 { margin: 0; color: var(--dsw-alias-label-primary); font-size: 13.5px; line-height: 20px; font-weight: 600; overflow-wrap: anywhere; }
@@ -1012,6 +1046,7 @@ function installStyles() {
1012
1046
  .capital-automation-chatcontext h3 { margin: 5px 0 0; color: var(--dsw-alias-label-primary); font-size: 16px; line-height: 24px; font-weight: 600; letter-spacing: .1px; overflow-wrap: anywhere; }
1013
1047
  .capital-automation-chatcontexttext { margin: 5px 0 0; color: var(--dsw-alias-label-secondary); font-size: 13px; line-height: 20px; white-space: pre-wrap; overflow-wrap: anywhere; }
1014
1048
  .capital-automation-chatthread { margin-left: 18px; padding: 12px 0 4px 30px; border-left: 2px solid var(--ca-line); }
1049
+ .capital-automation-chatexchange + .capital-automation-chatexchange { margin-top: 18px; padding-top: 16px; border-top: .5px solid var(--ca-line); }
1015
1050
  .capital-automation-chatempty { margin-left: 18px; padding: 12px 0 4px 30px; border-left: 2px solid var(--ca-line); }
1016
1051
  .capital-automation-chatempty p { margin: 0; color: var(--dsw-alias-label-secondary); font-size: 13px; line-height: 20px; }
1017
1052
  .capital-automation-chatcomposer { display: flex; align-items: center; gap: 8px; padding: 10px 16px 14px; border-top: .5px solid var(--ca-line); }
@@ -1044,10 +1079,7 @@ function installStyles() {
1044
1079
  .capital-automation-todoitem:first-child { border-top: 0; }
1045
1080
  .capital-automation-todoline { display: flex; flex-direction: column; align-items: stretch; gap: 5px; min-width: 0; }
1046
1081
  .capital-automation-todotop { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }
1047
- .capital-automation-todokind { display: inline-flex; flex: none; align-items: center; justify-content: center; min-height: 20px; padding: 0 5px; border-radius: 5px; background: var(--dsw-alias-bg-module-platform); color: var(--ca-muted); font-size: 10px; line-height: 20px; white-space: nowrap; }
1048
- .capital-automation-todokind[data-kind="confirm"] { color: var(--ca-warn-text); }
1049
- .capital-automation-todokind[data-kind="verify"] { color: var(--ca-business-text); }
1050
- .capital-automation-todokind[data-kind="track"] { color: var(--ca-success-text); }
1082
+ .capital-automation-todotags { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 5px; min-width: 0; }
1051
1083
  .capital-automation-todotitle { flex: none; width: 100%; min-width: 0; padding: 0; border: 0; background: transparent; font: inherit; color: var(--dsw-alias-label-primary); font-size: 13px; line-height: 20px; font-weight: 600; text-align: left; cursor: pointer; overflow-wrap: anywhere; }
1052
1084
  .capital-automation-todotitle:hover, .capital-automation-gaptitle:hover { color: var(--ca-business-text); }
1053
1085
  .capital-automation-todotitle:focus-visible, .capital-automation-gaptitle:focus-visible { outline: 2px solid var(--dsw-focus-ring-color, var(--ca-business)); outline-offset: 2px; border-radius: 4px; }
@@ -1055,31 +1087,56 @@ function installStyles() {
1055
1087
  .capital-automation-todotitle[aria-expanded="true"] .capital-automation-basiscaret, .capital-automation-gaptitle[aria-expanded="true"] .capital-automation-basiscaret { transform: rotate(0deg); }
1056
1088
  .capital-automation-tododesc { margin: 3px 0 0; color: var(--ca-muted); font-size: 12px; line-height: 20px; overflow-wrap: anywhere; }
1057
1089
  .capital-automation-todometa { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-top: 3px; color: var(--ca-caption); font-size: 11px; line-height: 17px; }
1090
+ .capital-automation-todowatch { display: inline-flex; flex: none; align-items: center; min-height: 20px; padding: 0 6px; border-radius: 999px; background: var(--dsw-alias-bg-module-platform); color: var(--ca-muted); font-size: 10px; line-height: 20px; white-space: nowrap; }
1091
+ .capital-automation-todowatch[data-status="triggered"] { background: color-mix(in srgb, var(--ca-error) 12%, var(--ca-card)); color: var(--ca-error-text); }
1092
+ .capital-automation-todowatch[data-status="needs_human"] { background: color-mix(in srgb, var(--ca-warn) 14%, var(--ca-card)); color: var(--ca-warn-text); }
1093
+ .capital-automation-todowatch[data-status="watching"] { color: var(--ca-business-text); }
1094
+ .capital-automation-todowatch[data-status="resolved"] { background: color-mix(in srgb, var(--ca-success) 14%, var(--ca-card)); color: var(--ca-success-text); }
1095
+ .capital-automation-todowatch[data-status="tracking"] { color: var(--ca-muted); }
1096
+ .capital-automation-todowatch[data-status="expired"] { color: var(--ca-caption); }
1097
+ .capital-automation-todowatchcheck { margin-left: 3px; font-size: 10px; }
1098
+ .capital-automation-todocheck { display: inline-flex; flex: none; align-items: center; justify-content: center; width: 18px; height: 18px; padding: 0; border: 1.5px solid var(--ca-line); border-radius: 4px; background: var(--ca-card); cursor: pointer; transition: border-color .15s ease, background .15s ease; }
1099
+ .capital-automation-todocheck:hover { border-color: var(--ca-business); background: color-mix(in srgb, var(--ca-business) 8%, var(--ca-card)); }
1100
+ .capital-automation-todocheck:focus-visible { outline: 2px solid var(--dsw-focus-ring-color, var(--ca-business)); outline-offset: 2px; }
1101
+ .capital-automation-todocheck[disabled] { opacity: .55; cursor: default; }
1102
+ .capital-automation-todocheckspin { width: 10px; height: 10px; border: 2px solid var(--ca-line); border-top-color: var(--ca-business); border-radius: 50%; animation: capital-automation-todospin .7s linear infinite; }
1103
+ @keyframes capital-automation-todospin { to { transform: rotate(360deg); } }
1104
+ .capital-automation-todowatchmsg { margin: 1px 0 0; padding: 6px 9px; border-left: 2px solid var(--ca-line); border-radius: 0 7px 7px 0; background: var(--ca-field); color: var(--ca-muted); font-size: 11.5px; line-height: 18px; overflow-wrap: anywhere; }
1105
+ .capital-automation-todowatchmsg[data-status="triggered"] { border-left-color: var(--ca-error); color: var(--ca-error-text); }
1058
1106
  .capital-automation-tododetail { margin: 6px 0 0; padding: 7px 9px; border-left: 2px solid var(--ca-line); background: var(--ca-field); border-radius: 0 7px 7px 0; }
1059
1107
  .capital-automation-tododetail blockquote { margin: 0; color: var(--ca-muted); font-size: 11.5px; line-height: 19px; overflow-wrap: anywhere; }
1060
1108
  .capital-automation-todosource { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 5px 8px; margin-top: 5px; color: var(--ca-caption); font-size: 11px; line-height: 17px; }
1109
+ .capital-automation-stockfilters { display: flex; align-items: center; gap: 8px; margin-left: auto; }
1110
+ .capital-automation-stockfilters .capital-automation-select { margin-left: 0; }
1061
1111
  .capital-automation-stockrow { border-top: .5px solid var(--ca-line); }
1062
1112
  .capital-automation-stockrow:first-of-type { border-top: 0; }
1063
1113
  .capital-automation-stockmain { display: flex; flex-wrap: wrap; align-items: baseline; gap: 3px 7px; width: 100%; padding: 8px 0; border: 0; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; }
1114
+ .capital-automation-stockmain:hover .capital-automation-stockname, .capital-automation-stockmain:hover .capital-automation-stockcode { color: var(--ca-business-text); }
1064
1115
  .capital-automation-stockmain:focus-visible { outline: 2px solid var(--dsw-focus-ring-color, var(--ca-business)); outline-offset: -2px; }
1065
1116
  .capital-automation-stockname { color: var(--dsw-alias-label-primary); font-size: 12.5px; line-height: 19px; font-weight: 600; }
1066
1117
  .capital-automation-stockcode { color: var(--ca-caption); font-size: 11px; line-height: 17px; }
1067
1118
  .capital-automation-stockroles { display: inline-flex; flex-wrap: wrap; gap: 3px; }
1068
- .capital-automation-stockrole { display: inline-flex; align-items: center; padding: 0 5px; border-radius: 4px; background: var(--dsw-alias-bg-module-platform); color: var(--ca-muted); font-size: 10px; line-height: 17px; }
1119
+ .capital-automation-stockrole { display: inline-flex; align-items: center; padding: 0 5px; border-radius: 4px; background: var(--dsw-alias-bg-module-platform); color: var(--ca-muted); font-size: 10px; line-height: 17px; cursor: help; }
1069
1120
  .capital-automation-stockrole[data-role="holding"] { color: var(--ca-success-text); }
1070
1121
  .capital-automation-stockrole[data-role="risk"] { color: var(--ca-error-text); }
1071
1122
  .capital-automation-stockrole[data-role="event"] { color: var(--ca-warn-text); }
1072
1123
  .capital-automation-stocknote { flex: 1 1 100%; color: var(--ca-muted); font-size: 12px; line-height: 19px; overflow-wrap: anywhere; }
1073
1124
  .capital-automation-stockmeta { display: flex; flex-wrap: wrap; gap: 4px 9px; color: var(--ca-caption); font-size: 11px; line-height: 17px; }
1074
1125
  .capital-automation-stocktodos { margin: 0 0 7px; padding: 0 0 0 8px; border-left: 2px solid var(--ca-line); }
1075
- .capital-automation-stocktodos li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 8px; padding: 3px 0; color: var(--ca-muted); font-size: 11.5px; line-height: 18px; }
1126
+ .capital-automation-stocktodos li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 8px; color: var(--ca-muted); font-size: 11.5px; line-height: 18px; }
1127
+ .capital-automation-stocktodo { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 8px; width: 100%; padding: 4px 6px; border: 0; border-radius: 6px; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; transition: background-color .15s ease, color .15s ease; }
1128
+ .capital-automation-stocktodo:hover { background: color-mix(in srgb, var(--ca-business) 8%, transparent); color: var(--ca-business-text); }
1129
+ .capital-automation-stocktodo:hover .capital-automation-stocktodotitle { color: var(--ca-business-text); }
1130
+ .capital-automation-stocktodo:focus-visible { outline: 2px solid var(--dsw-focus-ring-color, var(--ca-business)); outline-offset: -2px; }
1131
+ .capital-automation-stocktodo[data-static="true"] { cursor: default; }
1132
+ .capital-automation-stocktodo[data-static="true"]:hover { background: transparent; color: inherit; }
1133
+ .capital-automation-stocktodo svg { flex: none; color: var(--ca-caption); opacity: .65; }
1134
+ .capital-automation-stocktodo:hover svg { color: var(--ca-business-text); opacity: 1; }
1135
+ .capital-automation-stocktodotitle { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
1136
+ .capital-automation-stockmore { align-self: center; margin: 6px 0 2px; }
1076
1137
  .capital-automation-gaprow { padding: 8px 0; border-top: .5px solid var(--ca-line); }
1077
1138
  .capital-automation-gaprow:first-child { border-top: 0; }
1078
- .capital-automation-gaphead { display: flex; align-items: flex-start; gap: 6px; min-width: 0; }
1079
- .capital-automation-gapkind { display: inline-flex; flex: none; align-items: center; justify-content: center; min-height: 20px; padding: 0 5px; border-radius: 5px; background: var(--dsw-alias-bg-module-platform); color: var(--ca-muted); font-size: 10px; line-height: 20px; white-space: nowrap; }
1080
- .capital-automation-gapkind[data-kind="capability"] { color: var(--ca-warn-text); }
1081
- .capital-automation-gapkind[data-kind="conflict"] { color: var(--ca-error-text); }
1082
- .capital-automation-gapkind[data-kind="quality"] { color: var(--ca-warn-text); }
1139
+ .capital-automation-gaphead { display: flex; align-items: flex-start; min-width: 0; }
1083
1140
  .capital-automation-gaptitle { flex: 1 1 auto; min-width: 0; padding: 0; border: 0; background: transparent; font: inherit; color: var(--dsw-alias-label-primary); font-size: 13px; line-height: 20px; font-weight: 600; text-align: left; cursor: pointer; overflow-wrap: anywhere; }
1084
1141
  .capital-automation-gapdesc { margin: 3px 0 0; color: var(--ca-muted); font-size: 12px; line-height: 20px; overflow-wrap: anywhere; }
1085
1142
  .capital-automation-healthgrid { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 10px; align-items: baseline; }
@@ -1215,6 +1272,7 @@ function createApi() {
1215
1272
  timeoutMs: 60_000,
1216
1273
  }),
1217
1274
  askStatus: (askId) => request(`/board/asks/${encodeURIComponent(askId)}`),
1275
+ askHistory: (runId) => request(`/board/briefs/${encodeURIComponent(runId)}/asks`),
1218
1276
  askAnswer: (askId) => request(`/board/asks/${encodeURIComponent(askId)}/answer`),
1219
1277
  notifications: () => request('/notifications'),
1220
1278
  markRead: (body) => request('/notifications/read', { method: 'POST', body }),
@@ -1826,7 +1884,7 @@ function heatDayMeta(day) {
1826
1884
 
1827
1885
  function eventTone(kind) {
1828
1886
  if (kind === 'run_failed' || kind === 'run_timeout') return 'error'
1829
- if (kind === 'scheduler_standby' || kind === 'calendar_unavailable') return 'warn'
1887
+ if (kind === 'scheduler_standby' || kind === 'calendar_unavailable' || kind === 'todo_triggered' || kind === 'todo_needs_human') return 'warn'
1830
1888
  return 'neutral'
1831
1889
  }
1832
1890
 
@@ -1838,6 +1896,8 @@ function notificationMessage(item) {
1838
1896
  if (item.kind === 'scheduler_standby') return zh.notificationFallbackStandby
1839
1897
  if (item.kind === 'calendar_unavailable') return zh.notificationFallbackCalendar
1840
1898
  if (item.kind === 'skipped') return zh.notificationFallbackSkipped
1899
+ if (item.kind === 'todo_triggered') return zh.notificationFallbackTodoTriggered
1900
+ if (item.kind === 'todo_needs_human') return zh.notificationFallbackTodoNeedsHuman
1841
1901
  return ''
1842
1902
  }
1843
1903
 
@@ -3324,7 +3384,7 @@ function NotificationsTab(props) {
3324
3384
 
3325
3385
  function NotificationItem(props) {
3326
3386
  const { item, onClick, onOpenTask } = props
3327
- const clickable = typeof onClick === 'function' && item.taskId !== undefined
3387
+ const clickable = typeof onClick === 'function' && (item.taskId !== undefined || item.todoId !== undefined)
3328
3388
  const tag = clickable ? 'button' : 'div'
3329
3389
  return h(tag, {
3330
3390
  type: clickable ? 'button' : undefined,
@@ -3340,8 +3400,8 @@ function NotificationItem(props) {
3340
3400
  item.readAt === undefined ? h('span', { className: 'capital-automation-count' }, zh.unread) : null),
3341
3401
  h('span', { className: 'capital-automation-notificationmessage' }, notificationMessage(item)),
3342
3402
  h('span', { className: 'capital-automation-notificationtime' }, formatShortTime(item.createdAt))),
3343
- onOpenTask !== undefined && item.taskId !== undefined
3344
- ? h('span', { className: 'capital-automation-hint' }, zh.notificationOpenTask)
3403
+ onOpenTask !== undefined && (item.taskId !== undefined || item.todoId !== undefined)
3404
+ ? h('span', { className: 'capital-automation-hint' }, item.todoId !== undefined ? zh.notificationOpenTodo : zh.notificationOpenTask)
3345
3405
  : null)
3346
3406
  }
3347
3407
 
@@ -3905,7 +3965,7 @@ function ConfirmModal(props) {
3905
3965
  }
3906
3966
 
3907
3967
  function InboxModal(props) {
3908
- const { open, onClose, notifications, onMarkAllRead, onOpenTask, busy } = props
3968
+ const { open, onClose, notifications, onMarkAllRead, onOpenTask, onOpenTodo, busy } = props
3909
3969
  const unread = notifications.filter((item) => item.readAt === undefined).length
3910
3970
  return h(Modal, {
3911
3971
  open,
@@ -3931,7 +3991,11 @@ function InboxModal(props) {
3931
3991
  key: item.id,
3932
3992
  item,
3933
3993
  onOpenTask: onOpenTask,
3934
- onClick: item.taskId === undefined ? undefined : () => onOpenTask(item.taskId),
3994
+ onClick: item.todoId !== undefined
3995
+ ? () => onOpenTodo(item)
3996
+ : item.taskId === undefined
3997
+ ? undefined
3998
+ : () => onOpenTask(item.taskId),
3935
3999
  }))))
3936
4000
  }
3937
4001
 
@@ -3963,8 +4027,19 @@ function boardRelativeTime(value, now = Date.now()) {
3963
4027
  return `${Math.floor(diff / year)}年前`
3964
4028
  }
3965
4029
 
4030
+ function boardCardIsToday(card, today = localDateKey(new Date())) {
4031
+ if (typeof card?.finishedAt !== 'string') return false
4032
+ const date = new Date(card.finishedAt)
4033
+ return !Number.isNaN(date.getTime()) && localDateKey(date) === today
4034
+ }
4035
+
3966
4036
  function boardTodoPeriod(item, now = new Date()) {
3967
4037
  const today = localDateKey(now)
4038
+ // Triggered or handed-off items stay in today's action list even when dueAt has passed; a
4039
+ // confirmed one only stays there through the day it was acknowledged.
4040
+ const watchedStatus = item.watch?.resolvedFrom ?? item.watch?.status
4041
+ const ackedToday = typeof item.ackedAt === 'string' && localDateKey(new Date(item.ackedAt)) === today
4042
+ if ((watchedStatus === 'triggered' || watchedStatus === 'needs_human') && (item.ackedAt === undefined || ackedToday)) return 'today'
3968
4043
  if (typeof item.dueAt === 'string' && /^\d{4}-\d{2}-\d{2}$/.test(item.dueAt)) {
3969
4044
  if (item.dueAt < today) return 'expired'
3970
4045
  if (item.dueAt === today) return 'today'
@@ -3979,8 +4054,20 @@ function boardTodoPeriod(item, now = new Date()) {
3979
4054
  return 'future'
3980
4055
  }
3981
4056
 
3982
- function boardTodoTodayCount(todos, now = new Date()) {
3983
- return todos.filter((item) => boardTodoPeriod(item, now) === 'today').length
4057
+ /**
4058
+ * Human / automatic is the watch axis, not the run trigger: `watching` items are checked by the
4059
+ * service, everything else (confirmation, triggered, passive tracking, stopped checks) needs the user.
4060
+ */
4061
+ function boardTodoTodaySplit(todos, now = new Date()) {
4062
+ const split = { total: 0, manual: 0, auto: 0 }
4063
+ for (const item of todos) {
4064
+ const status = boardTodoStatus(item)
4065
+ if (status === 'resolved' || boardTodoPeriod(item, now) !== 'today') continue
4066
+ split.total += 1
4067
+ if (status === 'watching') split.auto += 1
4068
+ else split.manual += 1
4069
+ }
4070
+ return split
3984
4071
  }
3985
4072
 
3986
4073
  function boardTodoGroupLabel(period) {
@@ -4003,10 +4090,48 @@ function boardTodoDueLabel(item, period) {
4003
4090
  return date || zh.board.dueNoDate
4004
4091
  }
4005
4092
 
4006
- function boardTodoKindLabel(kind) {
4007
- if (kind === 'confirm') return zh.board.todoConfirm
4008
- if (kind === 'verify') return zh.board.todoVerify
4009
- return zh.board.todoTrack
4093
+ const TODO_CHECKPOINT_IDS = new Set(['midday-snapshot', 'daily-review'])
4094
+
4095
+ function boardTodoStatus(item) {
4096
+ if (typeof item.ackedAt === 'string' && item.ackedAt.length > 0) return 'resolved'
4097
+ if (item.watch !== null && item.watch !== undefined && typeof item.watch.status === 'string') return item.watch.status
4098
+ // Track items are passive; everything else without a watch is waiting for the user.
4099
+ return item.kind === 'track' ? 'tracking' : 'needs_human'
4100
+ }
4101
+
4102
+ function boardTodoWatchLabel(status) {
4103
+ if (status === 'triggered') return zh.board.watchTriggered
4104
+ if (status === 'needs_human') return zh.board.watchNeedsHuman
4105
+ if (status === 'resolved') return zh.board.watchResolved
4106
+ if (status === 'expired') return zh.board.watchExpired
4107
+ if (status === 'tracking') return zh.board.watchTracking
4108
+ if (status === 'watching') return zh.board.watchWatching
4109
+ return ''
4110
+ }
4111
+
4112
+ function boardTodoWatchHint(status, checkpointHint) {
4113
+ if (status === 'watching') return checkpointHint
4114
+ if (status === 'triggered') return '自动核验已确认条件成立'
4115
+ if (status === 'needs_human') return '需要你确认'
4116
+ if (status === 'resolved') return '已确认'
4117
+ if (status === 'tracking') return '仅展示,不自动核验'
4118
+ if (status === 'expired') return '连续 3 天没有新运行提到,已停止自动核验'
4119
+ return ''
4120
+ }
4121
+
4122
+ function boardTodoCheckpointHint(tasks) {
4123
+ const names = []
4124
+ for (const task of Array.isArray(tasks) ? tasks : []) {
4125
+ if (task?.origin !== 'builtin' || task.state !== 'active' || !TODO_CHECKPOINT_IDS.has(task.sourceBuiltinId)) continue
4126
+ if (typeof task.title === 'string' && task.title.length > 0 && !names.includes(task.title)) names.push(task.title)
4127
+ }
4128
+ if (names.length > 0) return `自动核验跟随 ${names.join('、')} 运行`
4129
+ if (!Array.isArray(tasks) || tasks.length === 0) return '自动核验跟随「午间快照」「每日复盘」运行'
4130
+ return '自动核验检查点任务未启用'
4131
+ }
4132
+
4133
+ function boardTodoCheckable(status) {
4134
+ return status === 'needs_human' || status === 'triggered' || status === 'tracking'
4010
4135
  }
4011
4136
 
4012
4137
  function boardCategoryOptions() {
@@ -4089,27 +4214,129 @@ function BoardEmpty(props) {
4089
4214
  }
4090
4215
 
4091
4216
  function BoardStats(props) {
4092
- const { stats, onJump } = props
4093
- const items = [
4094
- { id: 'capital-automation-briefs', label: zh.board.statsBriefs, value: stats?.briefs ?? 0 },
4095
- { id: 'capital-automation-todo', label: zh.board.statsTodos, value: stats?.todos ?? 0 },
4096
- { id: 'capital-automation-stocks', label: zh.board.statsStocks, value: stats?.stocks ?? 0 },
4097
- { id: 'capital-automation-gaps', label: zh.board.statsGaps, value: stats?.gaps ?? 0 },
4098
- { id: 'capital-automation-health', label: zh.board.statsIssues, value: stats?.issues7d ?? 0 },
4099
- ]
4217
+ const { stats, onJump, onHighlightTodayBriefs } = props
4100
4218
  const jump = (id) => {
4101
4219
  if (typeof document === 'undefined') return
4102
4220
  const node = document.getElementById(id)
4103
4221
  if (node !== null && typeof node.scrollIntoView === 'function') node.scrollIntoView({ block: 'start', behavior: 'smooth' })
4104
4222
  }
4105
4223
  const activate = typeof onJump === 'function' ? onJump : jump
4106
- return h('div', { className: 'capital-automation-boardstats', role: 'group', 'aria-label': zh.board.title },
4107
- items.map((item) => h('button', {
4108
- key: item.id,
4224
+ const open = (id) => () => activate(id)
4225
+ const labelParts = (parts) => parts.map((part, index) => h('span', {
4226
+ key: `label-${index}`,
4227
+ className: typeof part === 'string' && /^\s*[\/:]\s*$/.test(part) ? 'capital-automation-boardstatsep' : undefined,
4228
+ }, part))
4229
+ const valueParts = (parts) => parts.map((part, index) => {
4230
+ if (typeof part === 'string') return h('span', { key: `sep-${index}`, className: 'capital-automation-boardstatsep' }, part)
4231
+ if (typeof part.onClick !== 'function') {
4232
+ return h('span', { key: `value-${index}`, className: 'capital-automation-boardstatnum' }, String(part.value))
4233
+ }
4234
+ return h('button', {
4235
+ key: `value-${index}`,
4109
4236
  type: 'button',
4110
- className: 'capital-automation-boardstat',
4111
- onClick: () => activate(item.id),
4112
- }, h('span', { className: 'capital-automation-boardstatlabel' }, item.label), h('strong', null, String(item.value)))))
4237
+ className: 'capital-automation-boardstatnum',
4238
+ 'data-clickable': 'true',
4239
+ title: part.title,
4240
+ 'aria-label': part.ariaLabel,
4241
+ onClick: part.onClick,
4242
+ }, String(part.value))
4243
+ })
4244
+ const items = [
4245
+ {
4246
+ key: 'briefs',
4247
+ label: [zh.board.statsBriefsToday, ' / ', zh.board.statsBriefsTotal],
4248
+ values: [
4249
+ {
4250
+ value: stats?.briefsToday ?? 0,
4251
+ title: zh.board.statsBriefsTodayHint,
4252
+ ariaLabel: `${zh.board.statsBriefsToday} ${stats?.briefsToday ?? 0},${zh.board.statsBriefsTodayHint}`,
4253
+ onClick: typeof onHighlightTodayBriefs === 'function' ? onHighlightTodayBriefs : undefined,
4254
+ },
4255
+ ' / ',
4256
+ { value: stats?.briefs ?? 0 },
4257
+ ],
4258
+ },
4259
+ {
4260
+ key: 'todos',
4261
+ label: [zh.board.statsTodos, ' : ', zh.board.statsTodoManual, ' / ', zh.board.statsTodoAuto],
4262
+ values: [
4263
+ {
4264
+ value: stats?.todos ?? 0,
4265
+ title: zh.board.statsTodoHint,
4266
+ ariaLabel: `${zh.board.statsTodos} ${stats?.todos ?? 0},${zh.board.statsTodoHint}`,
4267
+ onClick: open('capital-automation-todo'),
4268
+ },
4269
+ ' : ',
4270
+ {
4271
+ value: stats?.todosManual ?? 0,
4272
+ title: zh.board.statsTodoManualHint,
4273
+ ariaLabel: `${zh.board.statsTodoManual} ${stats?.todosManual ?? 0},${zh.board.statsTodoManualHint}`,
4274
+ onClick: open('capital-automation-todo'),
4275
+ },
4276
+ ' / ',
4277
+ {
4278
+ value: stats?.todosAuto ?? 0,
4279
+ title: zh.board.statsTodoAutoHint,
4280
+ ariaLabel: `${zh.board.statsTodoAuto} ${stats?.todosAuto ?? 0},${zh.board.statsTodoAutoHint}`,
4281
+ onClick: open('capital-automation-todo'),
4282
+ },
4283
+ ],
4284
+ },
4285
+ {
4286
+ key: 'stocks',
4287
+ label: [zh.board.statsStocks, ' / ', zh.board.statsStocksNew],
4288
+ values: [
4289
+ {
4290
+ value: stats?.stocks ?? 0,
4291
+ title: zh.board.statsStockHint,
4292
+ ariaLabel: `${zh.board.statsStocks} ${stats?.stocks ?? 0},${zh.board.statsStockHint}`,
4293
+ onClick: open('capital-automation-stocks'),
4294
+ },
4295
+ ' / ',
4296
+ {
4297
+ value: stats?.stocksNewToday ?? 0,
4298
+ title: zh.board.statsStockHint,
4299
+ ariaLabel: `${zh.board.statsStocksNew} ${stats?.stocksNewToday ?? 0},${zh.board.statsStockHint}`,
4300
+ onClick: open('capital-automation-stocks'),
4301
+ },
4302
+ ],
4303
+ },
4304
+ {
4305
+ key: 'gaps',
4306
+ label: [zh.board.statsGaps, ' / ', zh.board.statsGapsNew],
4307
+ values: [
4308
+ {
4309
+ value: stats?.gaps ?? 0,
4310
+ title: zh.board.statsGapHint,
4311
+ ariaLabel: `${zh.board.statsGaps} ${stats?.gaps ?? 0},${zh.board.statsGapHint}`,
4312
+ onClick: open('capital-automation-gaps'),
4313
+ },
4314
+ ' / ',
4315
+ {
4316
+ value: stats?.gapsNewToday ?? 0,
4317
+ title: zh.board.statsGapHint,
4318
+ ariaLabel: `${zh.board.statsGapsNew} ${stats?.gapsNewToday ?? 0},${zh.board.statsGapHint}`,
4319
+ onClick: open('capital-automation-gaps'),
4320
+ },
4321
+ ],
4322
+ },
4323
+ {
4324
+ key: 'issues',
4325
+ label: [zh.board.statsIssuesToday],
4326
+ values: [
4327
+ {
4328
+ value: stats?.issuesToday ?? 0,
4329
+ title: zh.board.statsIssuesTodayHint,
4330
+ ariaLabel: `${zh.board.statsIssuesToday} ${stats?.issuesToday ?? 0},${zh.board.statsIssuesTodayHint}`,
4331
+ onClick: open('capital-automation-health'),
4332
+ },
4333
+ ],
4334
+ },
4335
+ ]
4336
+ return h('div', { className: 'capital-automation-boardstats', role: 'group', 'aria-label': zh.board.title },
4337
+ items.map((item) => h('div', { key: item.key, className: 'capital-automation-boardstat' },
4338
+ h('span', { className: 'capital-automation-boardstatlabel' }, labelParts(item.label)),
4339
+ h('span', { className: 'capital-automation-boardstatvalue' }, valueParts(item.values)))))
4113
4340
  }
4114
4341
 
4115
4342
  function BoardToolbar(props) {
@@ -4229,13 +4456,22 @@ function AskExchange(props) {
4229
4456
  }
4230
4457
 
4231
4458
  function AskDialog(props) {
4232
- const { open, onClose, card, identity, ask, api, question, onQuestionChange, onSubmit, busy, error, onOpenSession } = props
4459
+ const { open, onClose, card, identity, asks = [], api, question, onQuestionChange, onSubmit, busy, error, historyError = '', onOpenSession } = props
4233
4460
  const inputRef = useRef(null)
4461
+ const scrollRef = useRef(null)
4234
4462
  useEffect(() => {
4235
4463
  if (!open) return undefined
4236
4464
  const timer = setTimeout(() => inputRef.current?.focus?.(), 0)
4237
4465
  return () => clearTimeout(timer)
4238
4466
  }, [open])
4467
+ useEffect(() => {
4468
+ if (!open) return undefined
4469
+ const timer = setTimeout(() => {
4470
+ const node = scrollRef.current
4471
+ if (node !== null) node.scrollTop = node.scrollHeight
4472
+ }, 0)
4473
+ return () => clearTimeout(timer)
4474
+ }, [open, asks.length])
4239
4475
  if (!open) return null
4240
4476
  const brief = card.brief
4241
4477
  const status = brief?.status ?? 'pending'
@@ -4246,7 +4482,7 @@ function AskDialog(props) {
4246
4482
  const trigger = card.trigger === 'manual' ? zh.triggerManual : zh.triggerScheduled
4247
4483
  const relativeTime = boardRelativeTime(card.finishedAt)
4248
4484
  const exactTime = formatTime(card.finishedAt)
4249
- const running = ask?.status === 'running'
4485
+ const running = asks.some((item) => item.status === 'running')
4250
4486
  let context
4251
4487
  if (status === 'ready') {
4252
4488
  context = h('div', null,
@@ -4287,7 +4523,7 @@ function AskDialog(props) {
4287
4523
  onClick: openSession,
4288
4524
  }, h(IconRightUpOutlineRegular, { size: 18 }))
4289
4525
  : null),
4290
- h('div', { className: 'capital-automation-chatscroll' },
4526
+ h('div', { ref: scrollRef, className: 'capital-automation-chatscroll' },
4291
4527
  h('div', { className: 'capital-automation-chatcontext' },
4292
4528
  h(Glyph, { task: identity ?? card, size: 38, radius: 999, glyphSize: 18 }),
4293
4529
  h('div', { className: 'capital-automation-chatcontextbody' },
@@ -4297,8 +4533,13 @@ function AskDialog(props) {
4297
4533
  `${categoryLabel(card.category)} · ${trigger} · `,
4298
4534
  h('time', { dateTime: card.finishedAt, title: exactTime }, relativeTime))),
4299
4535
  context)),
4300
- ask !== null
4301
- ? h('div', { className: 'capital-automation-chatthread' }, h(AskExchange, { key: ask.id, ask, api }))
4536
+ historyError.length > 0
4537
+ ? h('p', { className: 'capital-automation-askerror', role: 'alert' }, historyError)
4538
+ : null,
4539
+ asks.length > 0
4540
+ ? h('div', { className: 'capital-automation-chatthread' },
4541
+ asks.map((item) => h('div', { key: item.id, className: 'capital-automation-chatexchange' },
4542
+ h(AskExchange, { ask: item, api }))))
4302
4543
  : h('div', { className: 'capital-automation-chatempty' },
4303
4544
  h('p', null, zh.board.askEmptyTitle)),
4304
4545
  error.length > 0 ? h('p', { className: 'capital-automation-askerror', role: 'alert' }, error) : null),
@@ -4326,39 +4567,75 @@ function AskDialog(props) {
4326
4567
  }, busy ? zh.processing : zh.board.askSubmit))))
4327
4568
  }
4328
4569
 
4570
+ function compareAsks(left, right) {
4571
+ const time = String(left?.createdAt ?? '').localeCompare(String(right?.createdAt ?? ''))
4572
+ if (time !== 0) return time
4573
+ return String(left?.id ?? '').localeCompare(String(right?.id ?? ''))
4574
+ }
4575
+
4576
+ function mergeAsks(current, incoming) {
4577
+ const byId = new Map()
4578
+ for (const ask of Array.isArray(current) ? current : []) {
4579
+ if (ask !== null && typeof ask === 'object' && typeof ask.id === 'string') byId.set(ask.id, ask)
4580
+ }
4581
+ for (const ask of Array.isArray(incoming) ? incoming : []) {
4582
+ if (ask === null || typeof ask !== 'object' || typeof ask.id !== 'string') continue
4583
+ const existing = byId.get(ask.id)
4584
+ if (existing !== undefined) {
4585
+ // A board refresh can trail a resolved local ask; never roll a terminal state back to running.
4586
+ if (existing.status !== 'running' && ask.status === 'running') continue
4587
+ if (existing.status === ask.status
4588
+ && typeof existing.preview === 'string' && typeof ask.preview === 'string'
4589
+ && Array.from(existing.preview).length > Array.from(ask.preview).length) continue
4590
+ }
4591
+ byId.set(ask.id, ask)
4592
+ }
4593
+ return Array.from(byId.values()).sort(compareAsks)
4594
+ }
4595
+
4329
4596
  function AskDock(props) {
4330
4597
  const { card, identity, api, onOpenSession, open, onClose } = props
4331
- const [latest, setLatest] = useState(card.ask ?? null)
4598
+ const [thread, setThread] = useState(() => (card.ask ? [card.ask] : []))
4332
4599
  const [question, setQuestion] = useState('')
4333
4600
  const [busy, setBusy] = useState(false)
4334
4601
  const [error, setError] = useState('')
4602
+ const [historyError, setHistoryError] = useState('')
4335
4603
  const incoming = card.ask ?? null
4604
+ const latest = thread.length > 0 ? thread[thread.length - 1] : null
4336
4605
 
4337
4606
  useEffect(() => {
4338
- setLatest((current) => {
4339
- // A board refresh can trail a just-created/resolved local ask; never drop or roll it back.
4340
- if (incoming === null) return current
4341
- if (current === null || current.id !== incoming.id) {
4342
- if (current !== null && String(current.createdAt ?? '') > String(incoming.createdAt ?? '')) return current
4343
- return incoming
4344
- }
4345
- if (current.status !== 'running' && incoming.status === 'running') return current
4346
- return incoming
4347
- })
4607
+ if (incoming === null) return
4608
+ setThread((current) => mergeAsks(current, [incoming]))
4348
4609
  }, [incoming?.id, incoming?.status, incoming?.preview, incoming?.error])
4349
4610
 
4350
4611
  useEffect(() => {
4351
4612
  if (!open) return
4352
4613
  setQuestion('')
4353
4614
  setError('')
4615
+ setHistoryError('')
4354
4616
  }, [open])
4355
4617
 
4618
+ useEffect(() => {
4619
+ if (!open || typeof api?.askHistory !== 'function') return undefined
4620
+ let cancelled = false
4621
+ api.askHistory(card.runId).then((payload) => {
4622
+ if (cancelled) return
4623
+ setThread((current) => mergeAsks(current, Array.isArray(payload?.asks) ? payload.asks : []))
4624
+ setHistoryError('')
4625
+ }).catch((failure) => {
4626
+ if (!cancelled) setHistoryError(failure?.message ?? zh.errorGeneric)
4627
+ })
4628
+ return () => {
4629
+ cancelled = true
4630
+ }
4631
+ }, [open, card.runId, api])
4632
+
4356
4633
  useEffect(() => {
4357
4634
  if (latest === null || latest.status !== 'ready' || typeof api?.askStatus !== 'function') return undefined
4358
4635
  if (typeof latest.preview !== 'string' || !latest.preview.endsWith('…') || Array.from(latest.preview).length > 80) return undefined
4359
4636
  let cancelled = false
4360
4637
  api.askStatus(latest.id).then((payload) => {
4361
- if (!cancelled && payload?.ask) setLatest(payload.ask)
4638
+ if (!cancelled && payload?.ask) setThread((current) => mergeAsks(current, [payload.ask]))
4362
4639
  }).catch(() => {})
4363
4640
  return () => {
4364
4641
  cancelled = true
@@ -4373,7 +4650,7 @@ function AskDock(props) {
4373
4650
  try {
4374
4651
  const payload = await api.askStatus(latest.id)
4375
4652
  if (cancelled) return
4376
- if (payload?.ask) setLatest(payload.ask)
4653
+ if (payload?.ask) setThread((current) => mergeAsks(current, [payload.ask]))
4377
4654
  } catch {
4378
4655
  // The dialog shows the actionable error; the card preview keeps its last known state.
4379
4656
  } finally {
@@ -4401,7 +4678,7 @@ function AskDock(props) {
4401
4678
  try {
4402
4679
  const payload = await api.askBrief(card.runId, text, browserTimeZone())
4403
4680
  if (payload?.ask) {
4404
- setLatest(payload.ask)
4681
+ setThread((current) => mergeAsks(current, [payload.ask]))
4405
4682
  setQuestion('')
4406
4683
  } else {
4407
4684
  setError(zh.errorGeneric)
@@ -4421,13 +4698,14 @@ function AskDock(props) {
4421
4698
  onClose: requestClose,
4422
4699
  card,
4423
4700
  identity,
4424
- ask: latest,
4701
+ asks: thread,
4425
4702
  api,
4426
4703
  question,
4427
4704
  onQuestionChange: setQuestion,
4428
4705
  onSubmit: submit,
4429
4706
  busy,
4430
4707
  error,
4708
+ historyError,
4431
4709
  onOpenSession,
4432
4710
  })
4433
4711
  if (latest === null) return dialog
@@ -4437,7 +4715,7 @@ function AskDock(props) {
4437
4715
  }
4438
4716
 
4439
4717
  function BriefCard(props) {
4440
- const { card, task, api, onOpenSession, onRetry, retrying } = props
4718
+ const { card, task, api, onOpenSession, onRetry, retrying, highlighted = false } = props
4441
4719
  const [askOpen, setAskOpen] = useState(false)
4442
4720
  // Older /board payloads omit icon/origin; the task list carries the same identity.
4443
4721
  const identity = typeof card.icon === 'string' ? card : (task ?? card)
@@ -4501,7 +4779,12 @@ function BriefCard(props) {
4501
4779
  h(SkeletonBlock, { width: '88%', height: 10 }),
4502
4780
  h('p', { className: 'capital-automation-hint' }, zh.board.briefPending))
4503
4781
  }
4504
- return h('article', { className: 'capital-automation-briefcard', 'data-status': status, 'aria-labelledby': titleId },
4782
+ return h('article', {
4783
+ className: 'capital-automation-briefcard',
4784
+ 'data-status': status,
4785
+ 'data-highlight': highlighted === true ? 'true' : undefined,
4786
+ 'aria-labelledby': titleId,
4787
+ },
4505
4788
  h('div', { className: 'capital-automation-briefhead' },
4506
4789
  h('div', { className: 'capital-automation-brieftitle' },
4507
4790
  h(Glyph, { task: identity, size: 24, radius: 8, glyphSize: 14 }),
@@ -4554,7 +4837,7 @@ function BoardSkeleton(props) {
4554
4837
  }
4555
4838
 
4556
4839
  function BriefFeed(props) {
4557
- const { cards, tasks, api, loading, error, onOpenSession, onRetry, retryingRunId, onViewAll, onClearFilter, onLoadMore, hasMore, loadingMore, railOpen } = props
4840
+ const { cards, tasks, api, loading, error, onOpenSession, onRetry, retryingRunId, onViewAll, onClearFilter, onLoadMore, hasMore, loadingMore, railOpen, highlightToken = 0 } = props
4558
4841
  if (loading === true) return h(BoardSkeleton, { railOpen })
4559
4842
  if (typeof error === 'string' && error.length > 0) {
4560
4843
  return h('section', { className: 'capital-automation-boardmain', id: 'capital-automation-briefs' },
@@ -4571,6 +4854,7 @@ function BriefFeed(props) {
4571
4854
  onClearFilter ? h('button', { type: 'button', className: 'capital-automation-btn', onClick: onClearFilter }, zh.board.clearFilter) : null)))
4572
4855
  }
4573
4856
  const taskById = new Map((Array.isArray(tasks) ? tasks : []).map((task) => [task.id, task]))
4857
+ const today = localDateKey(new Date())
4574
4858
  return h('section', { className: 'capital-automation-boardmain', id: 'capital-automation-briefs', 'aria-label': zh.board.briefTitle },
4575
4859
  cards.map((card) => h(BriefCard, {
4576
4860
  key: card.runId,
@@ -4580,6 +4864,7 @@ function BriefFeed(props) {
4580
4864
  onOpenSession,
4581
4865
  onRetry,
4582
4866
  retrying: retryingRunId === card.runId,
4867
+ highlighted: highlightToken > 0 && boardCardIsToday(card, today),
4583
4868
  })),
4584
4869
  hasMore
4585
4870
  ? h('button', {
@@ -4592,7 +4877,7 @@ function BriefFeed(props) {
4592
4877
  }
4593
4878
 
4594
4879
  function TodoRow(props) {
4595
- const { item, period, showDue = true, onOpenSession, onAck, acking = false, ackDisabled = false } = props
4880
+ const { item, period, showDue = true, onOpenSession, onAck, acking = false, ackDisabled = false, checkpointHint = '' } = props
4596
4881
  const [open, setOpen] = useState(false)
4597
4882
  const quote = item.sourceQuote ?? item.sources?.[0]?.sourceQuote
4598
4883
  const due = showDue === true ? boardTodoDueLabel(item, period) : ''
@@ -4604,21 +4889,44 @@ function TodoRow(props) {
4604
4889
  const meta = []
4605
4890
  if (due) meta.push(h('span', { key: 'due' }, due))
4606
4891
  if (item.seenCount > 1) meta.push(h('span', { key: 'seen' }, zh.board.seenCount.replace('{n}', String(item.seenCount))))
4892
+ const watch = item.watch && typeof item.watch === 'object' ? item.watch : null
4893
+ const status = boardTodoStatus(item)
4894
+ const watchLabel = boardTodoWatchLabel(status)
4895
+ if (watch?.checkedAt && status !== 'resolved' && status !== 'tracking') {
4896
+ meta.push(h('span', { key: 'checked' }, zh.board.watchChecked.replace('{time}', formatShortTime(watch.checkedAt))))
4897
+ }
4898
+ const watchMessage = status === 'triggered'
4899
+ ? `${zh.board.watchEvidence}:${watch?.evidence ?? ''}`
4900
+ : ''
4901
+ const checkable = boardTodoCheckable(status)
4607
4902
  const basisAction = open ? zh.board.hideBasis : zh.board.showBasis
4608
4903
  const basisCaret = h('span', { className: 'capital-automation-basiscaret', 'aria-hidden': 'true' }, h(IconChevronDownOutlineRegular, { size: 12 }))
4609
4904
  return h('li', { className: 'capital-automation-todoitem' },
4610
4905
  h('div', { className: 'capital-automation-todoline' },
4611
4906
  h('div', { className: 'capital-automation-todotop' },
4612
- h('span', { className: 'capital-automation-todokind', 'data-kind': item.kind }, boardTodoKindLabel(item.kind)),
4613
- h('button', {
4614
- type: 'button',
4615
- className: 'capital-automation-btn',
4616
- 'data-size': 'sm',
4617
- title: zh.board.todoAckTitle,
4618
- 'aria-label': `${zh.board.todoAckTitle}:${item.title}`,
4619
- disabled: ackDisabled === true,
4620
- onClick: () => onAck(item),
4621
- }, acking === true ? zh.processing : zh.board.todoAck)),
4907
+ h('div', { className: 'capital-automation-todotags' },
4908
+ watchLabel.length > 0
4909
+ ? h('span', {
4910
+ className: 'capital-automation-todowatch',
4911
+ 'data-status': status,
4912
+ title: boardTodoWatchHint(status, checkpointHint),
4913
+ },
4914
+ watchLabel,
4915
+ status === 'resolved' ? h('span', { className: 'capital-automation-todowatchcheck', 'aria-hidden': 'true' }, '✓') : null)
4916
+ : null),
4917
+ checkable
4918
+ ? h('button', {
4919
+ type: 'button',
4920
+ className: 'capital-automation-todocheck',
4921
+ role: 'checkbox',
4922
+ 'aria-checked': 'false',
4923
+ title: zh.board.todoAckTitle,
4924
+ 'aria-label': `${zh.board.todoAckTitle}:${item.title}`,
4925
+ 'data-busy': acking === true ? 'true' : undefined,
4926
+ disabled: ackDisabled === true,
4927
+ onClick: () => onAck(item),
4928
+ }, acking === true ? h('span', { className: 'capital-automation-todocheckspin', 'aria-hidden': 'true' }) : null)
4929
+ : null),
4622
4930
  h('button', {
4623
4931
  type: 'button',
4624
4932
  className: 'capital-automation-todotitle',
@@ -4628,6 +4936,9 @@ function TodoRow(props) {
4628
4936
  onClick: () => setOpen((value) => !value),
4629
4937
  }, item.title, basisCaret)),
4630
4938
  item.detail ? h('p', { className: 'capital-automation-tododesc' }, item.detail) : null,
4939
+ watchMessage.length > 0
4940
+ ? h('p', { className: 'capital-automation-todowatchmsg', 'data-status': status }, watchMessage)
4941
+ : null,
4631
4942
  meta.length > 0 ? h('div', { className: 'capital-automation-todometa' }, meta) : null,
4632
4943
  open
4633
4944
  ? h('div', { className: 'capital-automation-tododetail' },
@@ -4688,12 +4999,13 @@ function BoardPanel(props) {
4688
4999
  }
4689
5000
 
4690
5001
  function TodoPanel(props) {
4691
- const { todos, onOpenSession, onAckTodo, ackingTodoId, open, onToggle } = props
5002
+ const { todos, tasks, onOpenSession, onAckTodo, ackingTodoId, open, onToggle } = props
4692
5003
  const [filter, setFilter] = useState('today')
4693
5004
  const now = new Date()
4694
5005
  const entries = todos.map((item) => ({ item, period: boardTodoPeriod(item, now) }))
4695
5006
  entries.sort((left, right) => BOARD_TODO_PERIODS.indexOf(left.period) - BOARD_TODO_PERIODS.indexOf(right.period))
4696
5007
  const visible = entries.filter((entry) => entry.period === filter)
5008
+ const checkpointHint = boardTodoCheckpointHint(tasks)
4697
5009
  const emptyText = filter === 'today'
4698
5010
  ? zh.board.todoEmptyToday
4699
5011
  : zh.board.todoEmptyGroup.replace('{label}', boardTodoGroupLabel(filter))
@@ -4722,6 +5034,7 @@ function TodoPanel(props) {
4722
5034
  onAck: onAckTodo,
4723
5035
  acking: ackingTodoId === entry.item.id,
4724
5036
  ackDisabled: ackingTodoId !== null && ackingTodoId !== undefined,
5037
+ checkpointHint,
4725
5038
  }))))
4726
5039
  }
4727
5040
 
@@ -4732,53 +5045,134 @@ function boardRoleLabel(role) {
4732
5045
  return zh.board.roleRisk
4733
5046
  }
4734
5047
 
5048
+ function boardRoleHint(role) {
5049
+ if (role === 'holding') return zh.board.roleHoldingHint
5050
+ if (role === 'watch') return zh.board.roleWatchHint
5051
+ if (role === 'event') return zh.board.roleEventHint
5052
+ return zh.board.roleRiskHint
5053
+ }
5054
+
5055
+ function boardRoleTitle(role) {
5056
+ return `${boardRoleLabel(role)}:${boardRoleHint(role)}`
5057
+ }
5058
+
5059
+ function boardStockFilterOptions() {
5060
+ return [{ value: 'all', label: zh.board.stockFilterAll }].concat(
5061
+ BOARD_STOCK_ROLES.map((role) => ({ value: role, label: boardRoleLabel(role) })),
5062
+ )
5063
+ }
5064
+
5065
+ function boardEntrySymbolKey(entry) {
5066
+ return typeof entry.symbolKey === 'string' ? entry.symbolKey : entry.symbol
5067
+ }
5068
+
4735
5069
  function StockRow(props) {
4736
5070
  const { stock, todos, onOpenSession } = props
4737
5071
  const [open, setOpen] = useState(false)
4738
- const related = todos.filter((item) => item.symbol === stock.symbol)
5072
+ const stockKey = boardEntrySymbolKey(stock)
5073
+ const related = Array.isArray(stock.items)
5074
+ ? stock.items
5075
+ : todos.filter((item) => item.ackedAt === undefined && boardEntrySymbolKey(item) === stockKey)
5076
+ const followUpCount = Array.isArray(stock.items) ? stock.items.length : (stock.todoCount ?? 0)
5077
+ const roleSummary = stock.roles.map((role) => boardRoleTitle(role)).join(';')
4739
5078
  return h('div', { className: 'capital-automation-stockrow' },
4740
5079
  h('button', {
4741
5080
  type: 'button',
4742
5081
  className: 'capital-automation-stockmain',
4743
5082
  'aria-expanded': open ? 'true' : 'false',
5083
+ 'aria-label': `${stock.name} ${stock.symbol}${roleSummary.length > 0 ? `,${roleSummary}` : ''}`,
4744
5084
  onClick: () => setOpen((value) => !value),
4745
5085
  },
4746
5086
  h('span', { className: 'capital-automation-stockname' }, stock.name),
4747
5087
  h('span', { className: 'capital-automation-stockcode' }, stock.symbol),
4748
5088
  h('span', { className: 'capital-automation-stockroles' },
4749
- stock.roles.map((role) => h('span', { key: role, className: 'capital-automation-stockrole', 'data-role': role }, boardRoleLabel(role)))),
5089
+ stock.roles.map((role) => h('span', {
5090
+ key: role,
5091
+ className: 'capital-automation-stockrole',
5092
+ 'data-role': role,
5093
+ title: boardRoleTitle(role),
5094
+ }, boardRoleLabel(role)))),
4750
5095
  stock.note ? h('span', { className: 'capital-automation-stocknote' }, stock.note) : null,
4751
5096
  h('span', { className: 'capital-automation-stockmeta' },
4752
5097
  stock.nextAt ? h('span', null, stock.nextAt) : null,
4753
- stock.todoCount > 0 ? h('span', null, zh.board.stockTodoCount.replace('{n}', String(stock.todoCount))) : null)),
5098
+ followUpCount > 0
5099
+ ? h('span', { title: zh.board.stockTodoCountHint }, zh.board.stockTodoCount.replace('{n}', String(followUpCount)))
5100
+ : null)),
4754
5101
  open && related.length > 0
4755
5102
  ? h('ul', { className: 'capital-automation-stocktodos' }, related.map((item) => h('li', { key: item.id },
4756
- h('span', null, item.title),
4757
- item.sessionId ? h('button', { type: 'button', className: 'capital-automation-btn', 'data-size': 'sm', onClick: () => onOpenSession(item.sessionId) }, zh.openSession) : null)))
5103
+ item.sessionId
5104
+ ? h('button', {
5105
+ type: 'button',
5106
+ className: 'capital-automation-stocktodo',
5107
+ title: zh.openSession,
5108
+ 'aria-label': `${item.title},${zh.openSession}`,
5109
+ onClick: () => onOpenSession(item.sessionId),
5110
+ },
5111
+ h('span', { className: 'capital-automation-stocktodotitle' }, item.title),
5112
+ h(IconRightUpOutlineRegular, { size: 12, 'aria-hidden': 'true' }))
5113
+ : h('span', { className: 'capital-automation-stocktodo', 'data-static': 'true' }, item.title))))
4758
5114
  : null)
4759
5115
  }
4760
5116
 
4761
5117
  function StockRadar(props) {
4762
5118
  const { stocks, todos, total, onOpenSession, open, onToggle } = props
4763
- const hidden = Math.max(0, (total ?? stocks.length) - stocks.length)
5119
+ const [filter, setFilter] = useState('all')
5120
+ const [showAll, setShowAll] = useState(false)
5121
+ const totalCount = total ?? stocks.length
5122
+ const filtered = filter === 'all'
5123
+ ? stocks
5124
+ : stocks.filter((stock) => Array.isArray(stock.roles) && stock.roles.includes(filter))
5125
+ const visible = showAll ? filtered : filtered.slice(0, BOARD_STOCK_PAGE_SIZE)
5126
+ const hidden = Math.max(0, filtered.length - visible.length)
5127
+ const capped = Math.max(0, totalCount - stocks.length)
5128
+ const countText = filter === 'all'
5129
+ ? zh.board.stocksCount.replace('{n}', String(totalCount))
5130
+ : zh.board.stockFilteredCount.replace('{shown}', String(filtered.length)).replace('{total}', String(totalCount))
4764
5131
  return h(BoardPanel, {
4765
5132
  id: 'capital-automation-stocks',
4766
- title: zh.board.statsStocks,
5133
+ title: zh.board.stockTitle,
4767
5134
  open,
4768
5135
  onToggle,
4769
- meta: stocks.length === 0 ? null : h('span', { className: 'capital-automation-hint' }, zh.board.stocksCount.replace('{n}', String(total ?? stocks.length))),
5136
+ action: stocks.length === 0
5137
+ ? null
5138
+ : h('div', { className: 'capital-automation-stockfilters' },
5139
+ h('span', { className: 'capital-automation-hint' }, countText),
5140
+ h(Select, {
5141
+ value: filter,
5142
+ options: boardStockFilterOptions(),
5143
+ onChange: (value) => { setFilter(value); setShowAll(false) },
5144
+ size: 'sm',
5145
+ label: zh.board.stockFilterLabel,
5146
+ align: 'end',
5147
+ })),
4770
5148
  },
4771
5149
  stocks.length === 0
4772
5150
  ? h('p', { className: 'capital-automation-hint' }, zh.board.stockEmpty)
4773
- : stocks.map((stock) => h(StockRow, { key: stock.symbol, stock, todos, onOpenSession })),
4774
- hidden > 0 ? h('p', { className: 'capital-automation-hint' }, zh.board.stockOther.replace('{n}', String(hidden))) : null)
4775
- }
4776
-
4777
- function boardGapLabel(kind) {
4778
- if (kind === 'capability') return zh.board.gapCapability
4779
- if (kind === 'conflict') return zh.board.gapConflict
4780
- if (kind === 'quality') return zh.board.gapQuality
4781
- return zh.board.gapTransient
5151
+ : filtered.length === 0
5152
+ ? h('p', { className: 'capital-automation-hint' }, zh.board.stockFilterEmpty)
5153
+ : [
5154
+ ...visible.map((stock) => h(StockRow, { key: boardEntrySymbolKey(stock), stock, todos, onOpenSession })),
5155
+ hidden > 0
5156
+ ? h('button', {
5157
+ key: 'stock-more',
5158
+ type: 'button',
5159
+ className: 'capital-automation-btn capital-automation-stockmore',
5160
+ 'data-size': 'sm',
5161
+ onClick: () => setShowAll(true),
5162
+ }, zh.board.stockShowAll.replace('{n}', String(hidden)))
5163
+ : showAll && filtered.length > BOARD_STOCK_PAGE_SIZE
5164
+ ? h('button', {
5165
+ key: 'stock-less',
5166
+ type: 'button',
5167
+ className: 'capital-automation-btn capital-automation-stockmore',
5168
+ 'data-size': 'sm',
5169
+ onClick: () => setShowAll(false),
5170
+ }, zh.board.stockShowLess)
5171
+ : null,
5172
+ capped > 0
5173
+ ? h('p', { key: 'stock-capped', className: 'capital-automation-hint' }, zh.board.stockOther.replace('{n}', String(capped)))
5174
+ : null,
5175
+ ])
4782
5176
  }
4783
5177
 
4784
5178
  function GapRow(props) {
@@ -4788,7 +5182,6 @@ function GapRow(props) {
4788
5182
  const basisAction = open ? zh.board.hideBasis : zh.board.showBasis
4789
5183
  return h('li', { className: 'capital-automation-gaprow' },
4790
5184
  h('div', { className: 'capital-automation-gaphead' },
4791
- h('span', { className: 'capital-automation-gapkind', 'data-kind': gap.kind }, boardGapLabel(gap.kind)),
4792
5185
  h('button', {
4793
5186
  type: 'button',
4794
5187
  className: 'capital-automation-gaptitle',
@@ -4801,8 +5194,20 @@ function GapRow(props) {
4801
5194
  open
4802
5195
  ? h('div', { className: 'capital-automation-tododetail' },
4803
5196
  h('blockquote', null, source?.sourceQuote ?? gap.sourceQuote),
4804
- source ? h('p', { className: 'capital-automation-hint' }, `${source.taskTitle} · ${formatShortTime(source.finishedAt)}`) : null,
4805
- source?.sessionId ? h('button', { type: 'button', className: 'capital-automation-btn', 'data-size': 'sm', onClick: () => onOpenSession(source.sessionId) }, zh.openSession) : null)
5197
+ source
5198
+ ? h('div', { className: 'capital-automation-todosource' },
5199
+ h('span', null, `${source.taskTitle} · ${formatShortTime(source.finishedAt)}`),
5200
+ source.sessionId
5201
+ ? h('button', {
5202
+ type: 'button',
5203
+ className: 'capital-automation-btn',
5204
+ 'data-size': 'icon',
5205
+ title: zh.openSession,
5206
+ 'aria-label': zh.openSession,
5207
+ onClick: () => onOpenSession(source.sessionId),
5208
+ }, h(IconRightUpOutlineRegular, { size: 14 }))
5209
+ : null)
5210
+ : null)
4806
5211
  : null)
4807
5212
  }
4808
5213
 
@@ -4882,7 +5287,16 @@ function RunHealthPanel(props) {
4882
5287
  h('span', { className: 'capital-automation-healthissuetitle' }, issue.taskTitle),
4883
5288
  h('span', { className: 'capital-automation-healthissuestatus', 'data-tone': tone ?? undefined }, statusLabel(issue.status)),
4884
5289
  issue.recoveredByRunId ? h('span', { className: 'capital-automation-healthrecovered' }, zh.board.healthRecovered) : null),
4885
- issue.sessionId ? h('button', { type: 'button', className: 'capital-automation-btn', 'data-size': 'sm', onClick: () => onOpenSession(issue.sessionId) }, zh.board.healthOpen) : null)
5290
+ issue.sessionId
5291
+ ? h('button', {
5292
+ type: 'button',
5293
+ className: 'capital-automation-btn',
5294
+ 'data-size': 'icon',
5295
+ title: zh.openSession,
5296
+ 'aria-label': zh.openSession,
5297
+ onClick: () => onOpenSession(issue.sessionId),
5298
+ }, h(IconRightUpOutlineRegular, { size: 14 }))
5299
+ : null)
4886
5300
  }))
4887
5301
  : h('p', { className: 'capital-automation-healthempty' }, zh.board.healthNoIssues))
4888
5302
  }
@@ -4896,6 +5310,13 @@ function BoardPage(props) {
4896
5310
  const [railOpen, setRailOpen] = useState(() => readBoardUi().rail !== false)
4897
5311
  const [openPanels, setOpenPanels] = useState(() => boardPanelFlags(readBoardUi().panels))
4898
5312
  const [pendingJump, setPendingJump] = useState(null)
5313
+ const [briefHighlight, setBriefHighlight] = useState(0)
5314
+
5315
+ useEffect(() => {
5316
+ if (briefHighlight === 0) return undefined
5317
+ const timer = setTimeout(() => setBriefHighlight(0), BOARD_BRIEF_HIGHLIGHT_MS)
5318
+ return () => clearTimeout(timer)
5319
+ }, [briefHighlight])
4899
5320
 
4900
5321
  useEffect(() => {
4901
5322
  if (typeof pendingJump !== 'string') return undefined
@@ -4952,9 +5373,10 @@ function BoardPage(props) {
4952
5373
  error.length > 0 ? h('div', { className: 'capital-automation-banner', 'data-tone': 'error', role: 'alert' }, error) : null,
4953
5374
  h(BoardEmpty, { hasActiveTasks, storageReady, onGoTasks, onNewTask }))
4954
5375
  }
5376
+ const todoToday = boardTodoTodaySplit(board?.todos ?? [])
4955
5377
  const boardStats = board?.stats === undefined
4956
5378
  ? undefined
4957
- : { ...board.stats, todos: boardTodoTodayCount(board?.todos ?? []) }
5379
+ : { ...board.stats, todos: todoToday.total, todosManual: todoToday.manual, todosAuto: todoToday.auto }
4958
5380
  return h('div', { className: 'capital-automation-board' },
4959
5381
  h(BoardToolbar, {
4960
5382
  range,
@@ -4967,7 +5389,11 @@ function BoardPage(props) {
4967
5389
  onToggleRail: toggleRail,
4968
5390
  }),
4969
5391
  error.length > 0 ? h('div', { className: 'capital-automation-banner', 'data-tone': 'error', role: 'alert' }, error) : null,
4970
- h(BoardStats, { stats: boardStats, onJump: jumpTo }),
5392
+ h(BoardStats, {
5393
+ stats: boardStats,
5394
+ onJump: jumpTo,
5395
+ onHighlightTodayBriefs: () => setBriefHighlight((value) => value + 1),
5396
+ }),
4971
5397
  h('div', {
4972
5398
  className: 'capital-automation-boardgrid',
4973
5399
  'data-rail': railOpen === true ? 'open' : 'closed',
@@ -4987,6 +5413,7 @@ function BoardPage(props) {
4987
5413
  hasMore: board?.nextBefore !== null && board?.nextBefore !== undefined,
4988
5414
  loadingMore,
4989
5415
  railOpen,
5416
+ highlightToken: briefHighlight,
4990
5417
  }),
4991
5418
  h('aside', {
4992
5419
  id: 'capital-automation-boardrail',
@@ -4995,6 +5422,7 @@ function BoardPage(props) {
4995
5422
  },
4996
5423
  h(TodoPanel, {
4997
5424
  todos: board?.todos ?? [],
5425
+ tasks,
4998
5426
  onOpenSession,
4999
5427
  onAckTodo,
5000
5428
  ackingTodoId,
@@ -5273,15 +5701,33 @@ function AutomationPage(props) {
5273
5701
  setBoardError('')
5274
5702
  try {
5275
5703
  await api.confirmTodo(item.id)
5704
+ const ackedAt = new Date().toISOString()
5276
5705
  setBoard((current) => {
5277
5706
  if (current === null) return current
5278
- const removed = (current.todos ?? []).find((entry) => entry.id === item.id)
5279
- if (removed === undefined) return current
5280
- const todos = current.todos.filter((entry) => entry.id !== item.id)
5281
- const stocks = (current.stocks ?? []).map((stock) =>
5282
- removed.symbol !== undefined && stock.symbol === removed.symbol
5283
- ? { ...stock, todoCount: Math.max(0, (stock.todoCount ?? 0) - 1) }
5284
- : stock)
5707
+ const target = (current.todos ?? []).find((entry) => entry.id === item.id)
5708
+ if (target === undefined) return current
5709
+ const todos = current.todos.map((entry) => entry.id === item.id
5710
+ ? {
5711
+ ...entry,
5712
+ ackedAt,
5713
+ ...(entry.watch === null || entry.watch === undefined
5714
+ ? {}
5715
+ : {
5716
+ watch: {
5717
+ ...entry.watch,
5718
+ status: 'resolved',
5719
+ resolvedFrom: entry.watch.resolvedFrom ?? entry.watch.status,
5720
+ },
5721
+ }),
5722
+ }
5723
+ : entry)
5724
+ const targetKey = target.symbol === undefined ? undefined : boardEntrySymbolKey(target)
5725
+ const stocks = (current.stocks ?? []).map((stock) => {
5726
+ if (targetKey === undefined || boardEntrySymbolKey(stock) !== targetKey) return stock
5727
+ if (!Array.isArray(stock.items)) return { ...stock, todoCount: Math.max(0, (stock.todoCount ?? 0) - 1) }
5728
+ const items = stock.items.filter((entry) => entry.id !== target.id)
5729
+ return { ...stock, items, todoCount: items.length }
5730
+ })
5285
5731
  return {
5286
5732
  ...current,
5287
5733
  todos,
@@ -5440,6 +5886,25 @@ function AutomationPage(props) {
5440
5886
  await openTaskById(taskId)
5441
5887
  }
5442
5888
 
5889
+ async function openTodoFromNotification(item) {
5890
+ setInbox(false)
5891
+ const wasUnread = item.readAt === undefined
5892
+ setNotifications((current) => current.map((entry) => entry.id === item.id && entry.readAt === undefined
5893
+ ? { ...entry, readAt: new Date().toISOString() }
5894
+ : entry))
5895
+ if (wasUnread) setUnread((current) => Math.max(0, current - 1))
5896
+ try {
5897
+ await api.markRead({ ids: [item.id] })
5898
+ } catch {
5899
+ // Navigation still works when the read receipt fails; the next poll reconciles the badge.
5900
+ }
5901
+ switchTab('board')
5902
+ void loadBoard(boardRange, boardCategory)
5903
+ requestAnimationFrame(() => {
5904
+ document.getElementById('capital-automation-todo')?.scrollIntoView?.({ block: 'start', behavior: 'smooth' })
5905
+ })
5906
+ }
5907
+
5443
5908
  useEffect(() => {
5444
5909
  mountedRef.current = true
5445
5910
  void refresh()
@@ -5654,6 +6119,7 @@ function AutomationPage(props) {
5654
6119
  notifications,
5655
6120
  onMarkAllRead: () => { void markAllRead() },
5656
6121
  onOpenTask: (taskId) => { void openTaskFromNotification(taskId) },
6122
+ onOpenTodo: (item) => { void openTodoFromNotification(item) },
5657
6123
  busy: inboxBusy,
5658
6124
  }),
5659
6125
  h(ConfirmModal, {