@v587d/capital-generation 2.21.0 → 2.21.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/README.md +2 -2
- package/automation/board.js +4 -6
- package/automation/brief.js +119 -12
- package/automation/builtins.js +1 -1
- package/automation/client.js +29 -7
- package/automation/client.src.cjs +281 -91
- package/automation/index.js +9 -3
- package/automation/package.json +1 -1
- package/automation/schema.js +2 -2
- package/automation/watch.js +84 -12
- package/chart-ui/package.json +1 -1
- package/config/package.json +1 -1
- package/lib/web-retriever/local-fetch.d.ts +1 -1
- package/lib/web-retriever/local-fetch.js +1 -1
- package/lib/web-retriever/wind-client.d.ts +1 -1
- package/lib/web-retriever/wind-client.js +1 -1
- package/package.json +1 -1
- package/watchlist/package.json +1 -1
|
@@ -171,23 +171,35 @@ const zh = {
|
|
|
171
171
|
watchTriggered: '已触发',
|
|
172
172
|
watchNeedsHuman: '待人工处理',
|
|
173
173
|
watchResolved: '已确认',
|
|
174
|
-
watchDeferred: '
|
|
174
|
+
watchDeferred: '已忽略',
|
|
175
175
|
watchExpired: '已过期',
|
|
176
176
|
watchTracking: '跟踪',
|
|
177
177
|
watchEvidence: '核验依据',
|
|
178
178
|
watchSource: '来源',
|
|
179
179
|
watchDeferredHint: '已忽略当前版本;后续新版本会重新出现',
|
|
180
|
-
watchChecked: '
|
|
180
|
+
watchChecked: '自动核验于 {time}',
|
|
181
181
|
notificationFallbackTodoTriggered: '条件已触发,查看 TODO 详情。',
|
|
182
182
|
notificationFallbackTodoNeedsHuman: '自动核验无法完成,需要你处理。',
|
|
183
183
|
todoEmptyToday: '今天暂无待办',
|
|
184
184
|
todoEmptyGroup: '暂无「{label}」待办',
|
|
185
|
+
todoEmptyHistory: '{date} 暂无历史 TODO',
|
|
185
186
|
todoFilterLabel: '按日期筛选',
|
|
187
|
+
todoDateLabel: '选择历史日期',
|
|
186
188
|
dueToday: '今天',
|
|
187
189
|
dueAsap: '尽快',
|
|
188
190
|
dueNoDate: '未定',
|
|
189
191
|
dueFuture: '将来',
|
|
190
|
-
|
|
192
|
+
historyTodo: '历史 TODO',
|
|
193
|
+
historyExpired: '已过期',
|
|
194
|
+
todoManualConfirm: '手动确认',
|
|
195
|
+
todoManualDefer: '手动忽略',
|
|
196
|
+
todoNotTriggered: '未触发',
|
|
197
|
+
todoInsufficient: '证据不足',
|
|
198
|
+
todoUnverified: '未完成核验',
|
|
199
|
+
todoTrackEnded: '跟踪结束',
|
|
200
|
+
todoStale: '已停止跟踪',
|
|
201
|
+
todoCheckedAt: '自动核验于 {date}',
|
|
202
|
+
todoManualAt: '人工处理于 {date}',
|
|
191
203
|
showBasis: '查看依据',
|
|
192
204
|
hideBasis: '收起依据',
|
|
193
205
|
seenCount: '{n} 次运行提到',
|
|
@@ -766,6 +778,8 @@ function installStyles() {
|
|
|
766
778
|
.capital-automation-panelhead h3 { margin: 0; font-size: 13.5px; line-height: 20px; font-weight: 600; }
|
|
767
779
|
.capital-automation-panelhead .capital-automation-btn { margin-left: auto; }
|
|
768
780
|
.capital-automation-panelhead .capital-automation-select { margin-left: auto; }
|
|
781
|
+
.capital-automation-panelhead .capital-automation-todofilters { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; }
|
|
782
|
+
.capital-automation-panelhead .capital-automation-todofilters .capital-automation-select { margin-left: 0; }
|
|
769
783
|
.capital-automation-panelhead .capital-automation-btn[data-variant="ghost"] { padding-right: 0; }
|
|
770
784
|
.capital-automation-kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px 18px; }
|
|
771
785
|
.capital-automation-kvitem { min-width: 0; }
|
|
@@ -1086,7 +1100,7 @@ function installStyles() {
|
|
|
1086
1100
|
.capital-automation-todoitem { padding: 8px 0; border-top: .5px solid var(--ca-line); transition: opacity .16s ease, padding .18s ease; }
|
|
1087
1101
|
.capital-automation-todoitem:first-child { border-top: 0; }
|
|
1088
1102
|
.capital-automation-todoitem[data-decided="true"], .capital-automation-todoitem[data-archived="true"] { padding: 7px 0; opacity: .72; border-top: 0; }
|
|
1089
|
-
.capital-automation-todoitem:not([data-decided="true"]) + .capital-automation-todoitem[data-decided="true"] { border-top: .5px solid var(--ca-line); }
|
|
1103
|
+
.capital-automation-todoitem:not([data-decided="true"]):not([data-archived="true"]) + .capital-automation-todoitem[data-decided="true"] { border-top: .5px solid var(--ca-line); }
|
|
1090
1104
|
.capital-automation-todoitem[data-decided="true"]:hover, .capital-automation-todoitem[data-archived="true"]:hover { opacity: 1; }
|
|
1091
1105
|
.capital-automation-todoitem[data-decided="true"] .capital-automation-todoline, .capital-automation-todoitem[data-archived="true"] .capital-automation-todoline { gap: 0; }
|
|
1092
1106
|
.capital-automation-todoitem[data-decided="true"] .capital-automation-todotop, .capital-automation-todoitem[data-archived="true"] .capital-automation-todotop { justify-content: flex-start; gap: 10px; }
|
|
@@ -1101,11 +1115,31 @@ function installStyles() {
|
|
|
1101
1115
|
.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; }
|
|
1102
1116
|
.capital-automation-todotitle:hover, .capital-automation-gaptitle:hover { color: var(--ca-business-text); }
|
|
1103
1117
|
.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; }
|
|
1104
|
-
.capital-automation-basiscaret { display: inline-flex; align-items: center; margin-left: 4px; color: var(--ca-muted); vertical-align: -2px; transform: rotate(-90deg); transition: transform .16s ease; }
|
|
1105
|
-
.capital-automation-todotitle[aria-expanded="true"] .capital-automation-basiscaret, .capital-automation-gaptitle[aria-expanded="true"] .capital-automation-basiscaret { transform: rotate(0deg); }
|
|
1106
1118
|
.capital-automation-tododesc { margin: 3px 0 0; color: var(--ca-muted); font-size: 12px; line-height: 20px; overflow-wrap: anywhere; }
|
|
1107
1119
|
.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; }
|
|
1108
|
-
.capital-automation-
|
|
1120
|
+
.capital-automation-todolist[data-period="expired"] > .capital-automation-todoitem { border-top: 0; }
|
|
1121
|
+
.capital-automation-historytitle { width: 100%; min-width: 0; padding: 0; border: 0; background: transparent; color: var(--dsw-alias-label-primary); font: inherit; font-size: 13px; line-height: 20px; font-weight: 600; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
|
|
1122
|
+
.capital-automation-historytitle:hover { color: var(--ca-business-text); }
|
|
1123
|
+
.capital-automation-historytitle:focus-visible { outline: 2px solid var(--dsw-focus-ring-color, var(--ca-business)); outline-offset: 2px; border-radius: 4px; }
|
|
1124
|
+
.capital-automation-historymeta { margin-top: 4px; }
|
|
1125
|
+
.capital-automation-historyconclusion { display: inline-flex; flex: none; align-items: center; min-height: 20px; padding: 0 7px; border-radius: 999px; background: var(--dsw-alias-bg-module-platform); color: var(--ca-muted); font-size: 10.5px; line-height: 20px; font-weight: 500; white-space: nowrap; }
|
|
1126
|
+
.capital-automation-historyconclusion[data-tone="success"] { background: color-mix(in srgb, var(--ca-success) 14%, var(--ca-card)); color: var(--ca-success-text); }
|
|
1127
|
+
.capital-automation-historyconclusion[data-tone="warn"] { background: color-mix(in srgb, var(--ca-warn) 14%, var(--ca-card)); color: var(--ca-warn-text); }
|
|
1128
|
+
.capital-automation-historyconclusion[data-tone="error"] { background: color-mix(in srgb, var(--ca-error) 12%, var(--ca-card)); color: var(--ca-error-text); }
|
|
1129
|
+
.capital-automation-datepick-menu { box-sizing: border-box; width: 236px; max-width: calc(100vw - 24px); padding: 10px; }
|
|
1130
|
+
.capital-automation-datepick-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 6px; }
|
|
1131
|
+
.capital-automation-datepick-month { color: var(--dsw-alias-label-primary); font-size: 12px; line-height: 18px; }
|
|
1132
|
+
.capital-automation-datepick-nav { display: inline-grid; place-items: center; width: 26px; height: 26px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--ca-muted); cursor: pointer; }
|
|
1133
|
+
.capital-automation-datepick-nav:hover:not(:disabled) { background: var(--ca-hover); color: var(--dsw-alias-label-primary); }
|
|
1134
|
+
.capital-automation-datepick-nav:disabled { opacity: .35; cursor: default; }
|
|
1135
|
+
.capital-automation-datepick-nav:focus-visible { outline: 2px solid var(--dsw-focus-ring-color, var(--ca-business)); outline-offset: 0; }
|
|
1136
|
+
.capital-automation-datepick-week, .capital-automation-datepick-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
|
|
1137
|
+
.capital-automation-datepick-weekday { padding: 2px 0; color: var(--ca-caption); font-size: 10px; line-height: 16px; text-align: center; }
|
|
1138
|
+
.capital-automation-datepick-day { height: 28px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--dsw-alias-label-secondary); font: inherit; font-size: 11.5px; line-height: 28px; cursor: pointer; }
|
|
1139
|
+
.capital-automation-datepick-day:hover:not(:disabled) { background: var(--ca-hover); color: var(--dsw-alias-label-primary); }
|
|
1140
|
+
.capital-automation-datepick-day[data-selected="true"] { background: var(--ca-business); color: #fff; }
|
|
1141
|
+
.capital-automation-datepick-day:disabled { opacity: .3; cursor: default; }
|
|
1142
|
+
.capital-automation-datepick-day:focus-visible { outline: 2px solid var(--dsw-focus-ring-color, var(--ca-business)); outline-offset: 0; }
|
|
1109
1143
|
.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; }
|
|
1110
1144
|
.capital-automation-todowatch[data-status="triggered"] { background: color-mix(in srgb, var(--ca-error) 12%, var(--ca-card)); color: var(--ca-error-text); }
|
|
1111
1145
|
.capital-automation-todowatch[data-status="needs_human"] { background: color-mix(in srgb, var(--ca-warn) 14%, var(--ca-card)); color: var(--ca-warn-text); }
|
|
@@ -4098,7 +4132,7 @@ function boardTodoTodaySplit(todos, now = new Date()) {
|
|
|
4098
4132
|
|
|
4099
4133
|
function boardTodoGroupLabel(period) {
|
|
4100
4134
|
if (period === 'today') return zh.board.dueToday
|
|
4101
|
-
if (period === 'expired') return zh.board.
|
|
4135
|
+
if (period === 'expired') return zh.board.historyTodo
|
|
4102
4136
|
return zh.board.dueFuture
|
|
4103
4137
|
}
|
|
4104
4138
|
|
|
@@ -4263,12 +4297,12 @@ function boardTodoFilterOptions() {
|
|
|
4263
4297
|
}
|
|
4264
4298
|
|
|
4265
4299
|
function boardTodoDueLabel(item, period) {
|
|
4300
|
+
if (period === 'expired') return ''
|
|
4266
4301
|
const date = typeof item.dueAt === 'string' && item.dueAt.length >= 10 ? item.dueAt.slice(5) : ''
|
|
4267
4302
|
if (period === 'today') {
|
|
4268
4303
|
const label = typeof item.dueLabel === 'string' ? item.dueLabel.trim() : ''
|
|
4269
4304
|
return ['尽快', '马上', '现在'].includes(label) && date.length === 0 ? zh.board.dueAsap : zh.board.dueToday
|
|
4270
4305
|
}
|
|
4271
|
-
if (period === 'expired') return date ? `${zh.board.dueExpired} · ${date}` : zh.board.dueExpired
|
|
4272
4306
|
return date || zh.board.dueNoDate
|
|
4273
4307
|
}
|
|
4274
4308
|
|
|
@@ -4281,23 +4315,45 @@ function boardTodoDecision(item) {
|
|
|
4281
4315
|
return undefined
|
|
4282
4316
|
}
|
|
4283
4317
|
|
|
4284
|
-
/**
|
|
4285
|
-
function
|
|
4318
|
+
/** Local YYYY-MM-DD for a timestamp; empty when the value cannot be parsed. */
|
|
4319
|
+
function dateKeyOfValue(value) {
|
|
4320
|
+
const at = Date.parse(value)
|
|
4321
|
+
return Number.isFinite(at) ? localDateKey(new Date(at)) : ''
|
|
4322
|
+
}
|
|
4323
|
+
|
|
4324
|
+
function formatMonthDay(value) {
|
|
4325
|
+
if (typeof value === 'string' && /^\d{4}-\d{2}-\d{2}$/.test(value)) return value.slice(5)
|
|
4326
|
+
const key = dateKeyOfValue(value)
|
|
4327
|
+
return key.length > 0 ? key.slice(5) : ''
|
|
4328
|
+
}
|
|
4329
|
+
|
|
4330
|
+
/**
|
|
4331
|
+
* History is filed by the day the TODO was due; undated items fall back to the decision, the
|
|
4332
|
+
* verification, then the last mention so nothing disappears from the day view.
|
|
4333
|
+
*/
|
|
4334
|
+
function boardTodoHistoryDate(item) {
|
|
4335
|
+
if (typeof item.dueAt === 'string' && /^\d{4}-\d{2}-\d{2}$/.test(item.dueAt)) return item.dueAt
|
|
4336
|
+
const decidedAt = typeof item.ackedAt === 'string' ? item.ackedAt : item.deferredAt
|
|
4337
|
+
const decisionKey = dateKeyOfValue(decidedAt)
|
|
4338
|
+
if (decisionKey.length > 0) return decisionKey
|
|
4339
|
+
const checkedKey = dateKeyOfValue(item.watch?.checkedAt)
|
|
4340
|
+
if (checkedKey.length > 0) return checkedKey
|
|
4341
|
+
return dateKeyOfValue(item.lastSeenAt)
|
|
4342
|
+
}
|
|
4343
|
+
|
|
4344
|
+
/** One conclusion per history row: verifier verdict, human decision, or the deadline. */
|
|
4345
|
+
function boardTodoConclusion(item) {
|
|
4286
4346
|
const decision = boardTodoDecision(item)
|
|
4287
|
-
if (decision === 'confirmed') return '
|
|
4288
|
-
if (decision === 'deferred') return '
|
|
4347
|
+
if (decision === 'confirmed') return { label: zh.board.todoManualConfirm, at: item.ackedAt, kind: 'manual', tone: 'success' }
|
|
4348
|
+
if (decision === 'deferred') return { label: zh.board.todoManualDefer, at: item.deferredAt, kind: 'manual', tone: 'muted' }
|
|
4349
|
+
if (item.kind === 'track') return { label: zh.board.todoTrackEnded, at: undefined, kind: 'track', tone: 'muted' }
|
|
4350
|
+
if (item.watch?.status === 'triggered') return { label: zh.board.watchTriggered, at: item.watch?.checkedAt, kind: 'auto', tone: 'error' }
|
|
4289
4351
|
const reason = item.watch?.expiredReason
|
|
4290
|
-
if (reason === 'not_triggered') return '
|
|
4291
|
-
if (reason === 'no_data') return '
|
|
4292
|
-
if (reason === 'not_verified') return '
|
|
4293
|
-
if (reason === '
|
|
4294
|
-
|
|
4295
|
-
if (item.watch?.status === 'needs_human') return '数据不足'
|
|
4296
|
-
if (item.watch?.status === 'watching') return '未完成核验'
|
|
4297
|
-
if (item.kind === 'confirm') return '未确认'
|
|
4298
|
-
if (item.kind === 'verify') return '未完成核验'
|
|
4299
|
-
if (item.kind === 'track') return '跟踪结束'
|
|
4300
|
-
return ''
|
|
4352
|
+
if (reason === 'not_triggered') return { label: zh.board.todoNotTriggered, at: item.watch?.checkedAt, kind: 'auto', tone: 'muted' }
|
|
4353
|
+
if (reason === 'no_data') return { label: zh.board.todoInsufficient, at: item.watch?.checkedAt, kind: 'auto', tone: 'warn' }
|
|
4354
|
+
if (reason === 'not_verified') return { label: zh.board.todoUnverified, at: undefined, kind: 'auto', tone: 'muted' }
|
|
4355
|
+
if (reason === 'stale') return { label: zh.board.todoStale, at: undefined, kind: 'auto', tone: 'muted' }
|
|
4356
|
+
return { label: zh.board.historyExpired, at: undefined, kind: 'expired', tone: 'muted' }
|
|
4301
4357
|
}
|
|
4302
4358
|
|
|
4303
4359
|
function boardTodoStatus(item) {
|
|
@@ -5104,29 +5160,25 @@ function TodoRow(props) {
|
|
|
5104
5160
|
const { item, period, showDue = true, onOpenSession, onDecide, checkpointHint = '', pending = false } = props
|
|
5105
5161
|
const [open, setOpen] = useState(false)
|
|
5106
5162
|
const [menuOpen, setMenuOpen] = useState(false)
|
|
5107
|
-
const
|
|
5163
|
+
const sources = Array.isArray(item.sources) && item.sources.length > 0
|
|
5164
|
+
? item.sources
|
|
5165
|
+
: [{ taskTitle: item.taskTitle, finishedAt: item.finishedAt, sessionId: item.sessionId ?? null }]
|
|
5166
|
+
const quote = item.sourceQuote ?? sources[0]?.sourceQuote
|
|
5108
5167
|
const due = showDue === true ? boardTodoDueLabel(item, period) : ''
|
|
5109
|
-
const source = {
|
|
5110
|
-
taskTitle: item.taskTitle,
|
|
5111
|
-
finishedAt: item.finishedAt,
|
|
5112
|
-
sessionId: item.sessionId ?? item.sources?.[0]?.sessionId,
|
|
5113
|
-
}
|
|
5114
5168
|
const meta = []
|
|
5115
5169
|
const watch = item.watch && typeof item.watch === 'object' ? item.watch : null
|
|
5116
5170
|
const archived = period === 'expired'
|
|
5117
5171
|
const status = archived ? 'expired' : boardTodoStatus(item)
|
|
5118
5172
|
const decision = boardTodoDecision(item)
|
|
5119
5173
|
const decided = decision !== undefined
|
|
5120
|
-
const compact = decided
|
|
5174
|
+
const compact = decided
|
|
5121
5175
|
const watchLabel = boardTodoWatchLabel(status)
|
|
5122
|
-
if (
|
|
5123
|
-
|
|
5124
|
-
|
|
5125
|
-
if (
|
|
5126
|
-
|
|
5127
|
-
|
|
5128
|
-
if (watch?.checkedAt && status !== 'resolved' && status !== 'deferred' && status !== 'tracking') {
|
|
5129
|
-
meta.push(h('span', { key: 'checked' }, zh.board.watchChecked.replace('{time}', formatShortTime(watch.checkedAt))))
|
|
5176
|
+
if (!archived) {
|
|
5177
|
+
if (due) meta.push(h('span', { key: 'due' }, due))
|
|
5178
|
+
if (item.seenCount > 1) meta.push(h('span', { key: 'seen' }, zh.board.seenCount.replace('{n}', String(item.seenCount))))
|
|
5179
|
+
if (watch?.checkedAt && status !== 'resolved' && status !== 'deferred' && status !== 'tracking') {
|
|
5180
|
+
meta.push(h('span', { key: 'checked' }, zh.board.watchChecked.replace('{time}', formatShortTime(watch.checkedAt))))
|
|
5181
|
+
}
|
|
5130
5182
|
}
|
|
5131
5183
|
const watchMessage = status === 'triggered'
|
|
5132
5184
|
? `${zh.board.watchEvidence}:${watch?.evidence ?? ''}${watch?.source ? ` · ${zh.board.watchSource}:${watch.source}` : ''}`
|
|
@@ -5135,8 +5187,7 @@ function TodoRow(props) {
|
|
|
5135
5187
|
const pastDue = typeof item.dueAt === 'string' && item.dueAt < localDateKey(new Date())
|
|
5136
5188
|
const autoAvailable = !archived && !pastDue && boardTodoAutoAvailable(item, status)
|
|
5137
5189
|
const basisAction = open ? zh.board.hideBasis : zh.board.showBasis
|
|
5138
|
-
const
|
|
5139
|
-
const tags = watchLabel.length > 0
|
|
5190
|
+
const tags = !archived && watchLabel.length > 0
|
|
5140
5191
|
? h('div', { className: 'capital-automation-todotags' },
|
|
5141
5192
|
h('span', {
|
|
5142
5193
|
className: 'capital-automation-todowatch',
|
|
@@ -5173,7 +5224,7 @@ function TodoRow(props) {
|
|
|
5173
5224
|
}
|
|
5174
5225
|
menuItems.push({
|
|
5175
5226
|
id: 'defer',
|
|
5176
|
-
label: decision === 'deferred' ? `${zh.board.
|
|
5227
|
+
label: decision === 'deferred' ? `${zh.board.watchDeferred}(当前)` : zh.board.todoActionDefer,
|
|
5177
5228
|
icon: h(IconClockOutlineRegular, { size: 14 }),
|
|
5178
5229
|
disabled: pending || decision === 'deferred',
|
|
5179
5230
|
})
|
|
@@ -5201,26 +5252,74 @@ function TodoRow(props) {
|
|
|
5201
5252
|
portal: true,
|
|
5202
5253
|
})
|
|
5203
5254
|
: null
|
|
5255
|
+
const detailNode = open
|
|
5256
|
+
? h('div', { className: 'capital-automation-tododetail' },
|
|
5257
|
+
archived && item.detail ? h('p', { className: 'capital-automation-tododesc' }, item.detail) : null,
|
|
5258
|
+
archived && watch?.evidence
|
|
5259
|
+
? h('p', { className: 'capital-automation-todowatchmsg', 'data-status': status },
|
|
5260
|
+
`${zh.board.watchEvidence}:${watch.evidence}${watch.source ? ` · ${zh.board.watchSource}:${watch.source}` : ''}`)
|
|
5261
|
+
: null,
|
|
5262
|
+
h('blockquote', null, quote),
|
|
5263
|
+
sources.map((entry, index) => h('div', {
|
|
5264
|
+
key: entry.runId ?? `source-${index}`,
|
|
5265
|
+
className: 'capital-automation-todosource',
|
|
5266
|
+
},
|
|
5267
|
+
h('span', null, `${zh.board.sourceRun}:${entry.taskTitle} · ${formatShortTime(entry.finishedAt)}`),
|
|
5268
|
+
entry.sessionId
|
|
5269
|
+
? h('button', {
|
|
5270
|
+
type: 'button',
|
|
5271
|
+
className: 'capital-automation-btn',
|
|
5272
|
+
'data-size': 'icon',
|
|
5273
|
+
title: zh.openSession,
|
|
5274
|
+
'aria-label': zh.openSession,
|
|
5275
|
+
onClick: () => onOpenSession(entry.sessionId),
|
|
5276
|
+
}, h(IconRightUpOutlineRegular, { size: 14 }))
|
|
5277
|
+
: null)))
|
|
5278
|
+
: null
|
|
5279
|
+
if (archived) {
|
|
5280
|
+
const conclusion = boardTodoConclusion(item)
|
|
5281
|
+
const historyMeta = [
|
|
5282
|
+
h('span', {
|
|
5283
|
+
key: 'conclusion',
|
|
5284
|
+
className: 'capital-automation-historyconclusion',
|
|
5285
|
+
'data-tone': conclusion.tone,
|
|
5286
|
+
}, conclusion.label),
|
|
5287
|
+
conclusion.at
|
|
5288
|
+
? h('span', { key: 'at' },
|
|
5289
|
+
(conclusion.kind === 'manual' ? zh.board.todoManualAt : zh.board.todoCheckedAt)
|
|
5290
|
+
.replace('{date}', formatMonthDay(conclusion.at)))
|
|
5291
|
+
: null,
|
|
5292
|
+
item.seenCount > 1 ? h('span', { key: 'seen' }, zh.board.seenCount.replace('{n}', String(item.seenCount))) : null,
|
|
5293
|
+
].filter((node) => node !== null)
|
|
5294
|
+
return h('li', {
|
|
5295
|
+
className: 'capital-automation-todoitem',
|
|
5296
|
+
'data-archived': 'true',
|
|
5297
|
+
'data-decision': decision,
|
|
5298
|
+
},
|
|
5299
|
+
h('div', { className: 'capital-automation-todoline' },
|
|
5300
|
+
h('button', {
|
|
5301
|
+
type: 'button',
|
|
5302
|
+
className: 'capital-automation-historytitle',
|
|
5303
|
+
'aria-expanded': open ? 'true' : 'false',
|
|
5304
|
+
'aria-label': `${item.title},${basisAction}`,
|
|
5305
|
+
title: basisAction,
|
|
5306
|
+
onClick: () => setOpen((value) => !value),
|
|
5307
|
+
}, item.title),
|
|
5308
|
+
historyMeta.length > 0
|
|
5309
|
+
? h('div', { className: 'capital-automation-todometa capital-automation-historymeta' }, historyMeta)
|
|
5310
|
+
: null),
|
|
5311
|
+
detailNode)
|
|
5312
|
+
}
|
|
5204
5313
|
return h('li', {
|
|
5205
5314
|
className: 'capital-automation-todoitem',
|
|
5206
5315
|
'data-decided': decided ? 'true' : undefined,
|
|
5207
|
-
'data-archived': archived ? 'true' : undefined,
|
|
5208
5316
|
'data-decision': decision,
|
|
5209
5317
|
},
|
|
5210
5318
|
compact
|
|
5211
5319
|
? h('div', { className: 'capital-automation-todoline' },
|
|
5212
5320
|
h('div', { className: 'capital-automation-todotop' },
|
|
5213
5321
|
tags,
|
|
5214
|
-
|
|
5215
|
-
? h('button', {
|
|
5216
|
-
type: 'button',
|
|
5217
|
-
className: 'capital-automation-todotitle',
|
|
5218
|
-
'aria-expanded': open ? 'true' : 'false',
|
|
5219
|
-
'aria-label': `${item.title},${basisAction}`,
|
|
5220
|
-
title: basisAction,
|
|
5221
|
-
onClick: () => setOpen((value) => !value),
|
|
5222
|
-
}, item.title, basisCaret)
|
|
5223
|
-
: h('span', { className: 'capital-automation-todotitle', title: item.title }, item.title),
|
|
5322
|
+
h('span', { className: 'capital-automation-todotitle', title: item.title }, item.title),
|
|
5224
5323
|
menu))
|
|
5225
5324
|
: h('div', { className: 'capital-automation-todoline' },
|
|
5226
5325
|
h('div', { className: 'capital-automation-todotop' }, tags, menu),
|
|
@@ -5231,35 +5330,13 @@ function TodoRow(props) {
|
|
|
5231
5330
|
'aria-label': `${item.title},${basisAction}`,
|
|
5232
5331
|
title: basisAction,
|
|
5233
5332
|
onClick: () => setOpen((value) => !value),
|
|
5234
|
-
}, item.title
|
|
5333
|
+
}, item.title)),
|
|
5235
5334
|
!compact && item.detail ? h('p', { className: 'capital-automation-tododesc' }, item.detail) : null,
|
|
5236
5335
|
!compact && watchMessage.length > 0
|
|
5237
5336
|
? h('p', { className: 'capital-automation-todowatchmsg', 'data-status': status }, watchMessage)
|
|
5238
5337
|
: null,
|
|
5239
|
-
|
|
5240
|
-
|
|
5241
|
-
? h('div', { className: 'capital-automation-tododetail' },
|
|
5242
|
-
archived && item.detail ? h('p', { className: 'capital-automation-tododesc' }, item.detail) : null,
|
|
5243
|
-
archived && watch?.evidence
|
|
5244
|
-
? h('p', { className: 'capital-automation-todowatchmsg', 'data-status': status },
|
|
5245
|
-
`${zh.board.watchEvidence}:${watch.evidence}${watch.source ? ` · ${zh.board.watchSource}:${watch.source}` : ''}`)
|
|
5246
|
-
: null,
|
|
5247
|
-
h('blockquote', null, quote),
|
|
5248
|
-
source
|
|
5249
|
-
? h('div', { className: 'capital-automation-todosource' },
|
|
5250
|
-
h('span', null, `${zh.board.sourceRun}:${source.taskTitle} · ${formatShortTime(source.finishedAt)}`),
|
|
5251
|
-
source.sessionId
|
|
5252
|
-
? h('button', {
|
|
5253
|
-
type: 'button',
|
|
5254
|
-
className: 'capital-automation-btn',
|
|
5255
|
-
'data-size': 'icon',
|
|
5256
|
-
title: zh.openSession,
|
|
5257
|
-
'aria-label': zh.openSession,
|
|
5258
|
-
onClick: () => onOpenSession(source.sessionId),
|
|
5259
|
-
}, h(IconRightUpOutlineRegular, { size: 14 }))
|
|
5260
|
-
: null)
|
|
5261
|
-
: null)
|
|
5262
|
-
: null)
|
|
5338
|
+
!decided && meta.length > 0 ? h('div', { className: 'capital-automation-todometa' }, meta) : null,
|
|
5339
|
+
!decided ? detailNode : null)
|
|
5263
5340
|
}
|
|
5264
5341
|
|
|
5265
5342
|
function BoardPanelHead(props) {
|
|
@@ -5300,32 +5377,144 @@ function BoardPanel(props) {
|
|
|
5300
5377
|
}, children))
|
|
5301
5378
|
}
|
|
5302
5379
|
|
|
5380
|
+
function yesterdayDateKey() {
|
|
5381
|
+
return localDateKey(addLocalDays(new Date(), -1))
|
|
5382
|
+
}
|
|
5383
|
+
|
|
5384
|
+
function monthKeyOf(dateKey) {
|
|
5385
|
+
return typeof dateKey === 'string' && /^\d{4}-\d{2}/.test(dateKey)
|
|
5386
|
+
? dateKey.slice(0, 7)
|
|
5387
|
+
: localDateKey(new Date()).slice(0, 7)
|
|
5388
|
+
}
|
|
5389
|
+
|
|
5390
|
+
function shiftMonthKey(monthKey, delta) {
|
|
5391
|
+
const [year, month] = monthKey.split('-').map(Number)
|
|
5392
|
+
const date = new Date(year, month - 1 + delta, 1)
|
|
5393
|
+
return `${date.getFullYear()}-${pad2(date.getMonth() + 1)}`
|
|
5394
|
+
}
|
|
5395
|
+
|
|
5396
|
+
/** Host-Menu month grid; only days before today are selectable. */
|
|
5397
|
+
function HistoryDatePicker(props) {
|
|
5398
|
+
const { value, min, max, onChange } = props
|
|
5399
|
+
const [open, setOpen] = useState(false)
|
|
5400
|
+
const [month, setMonth] = useState(() => monthKeyOf(value))
|
|
5401
|
+
useEffect(() => {
|
|
5402
|
+
if (open) setMonth(monthKeyOf(value))
|
|
5403
|
+
}, [open, value])
|
|
5404
|
+
const [year, monthNumber] = month.split('-').map(Number)
|
|
5405
|
+
const lead = new Date(year, monthNumber - 1, 1).getDay()
|
|
5406
|
+
const total = new Date(year, monthNumber, 0).getDate()
|
|
5407
|
+
const cells = [
|
|
5408
|
+
...Array.from({ length: lead }, (_, index) => ({ key: `lead-${index}`, day: null })),
|
|
5409
|
+
...Array.from({ length: total }, (_, index) => ({ key: dateStringFromParts(year, monthNumber, index + 1), day: index + 1 })),
|
|
5410
|
+
]
|
|
5411
|
+
const nextDisabled = month >= monthKeyOf(max)
|
|
5412
|
+
const prevDisabled = typeof min === 'string' && min.length > 0 && month <= monthKeyOf(min)
|
|
5413
|
+
const trigger = h('button', {
|
|
5414
|
+
type: 'button',
|
|
5415
|
+
className: 'capital-automation-select capital-automation-datepick',
|
|
5416
|
+
'data-size': 'sm',
|
|
5417
|
+
'aria-label': `${zh.board.todoDateLabel}:${formatMonthDay(value)}`,
|
|
5418
|
+
'aria-haspopup': 'menu',
|
|
5419
|
+
'aria-expanded': open ? 'true' : 'false',
|
|
5420
|
+
title: zh.board.todoDateLabel,
|
|
5421
|
+
onClick: () => setOpen((current) => !current),
|
|
5422
|
+
},
|
|
5423
|
+
h('span', { className: 'capital-automation-selectvalue' }, formatMonthDay(value)),
|
|
5424
|
+
h(IconChevronDownOutlineRegular, { size: 12 }))
|
|
5425
|
+
return h(Menu, {
|
|
5426
|
+
open,
|
|
5427
|
+
anchor: trigger,
|
|
5428
|
+
items: [],
|
|
5429
|
+
onClose: () => setOpen(false),
|
|
5430
|
+
align: 'end',
|
|
5431
|
+
portal: true,
|
|
5432
|
+
listClassName: 'capital-automation-datepick-menu',
|
|
5433
|
+
},
|
|
5434
|
+
h('div', { className: 'capital-automation-datepick-head' },
|
|
5435
|
+
h('button', {
|
|
5436
|
+
type: 'button',
|
|
5437
|
+
className: 'capital-automation-datepick-nav',
|
|
5438
|
+
'aria-label': '上个月',
|
|
5439
|
+
disabled: prevDisabled,
|
|
5440
|
+
onClick: () => { if (!prevDisabled) setMonth((current) => shiftMonthKey(current, -1)) },
|
|
5441
|
+
}, h(IconChevronLeftOutlineRegular, { size: 14 })),
|
|
5442
|
+
h('span', { className: 'capital-automation-datepick-month' }, `${year} 年 ${monthNumber} 月`),
|
|
5443
|
+
h('button', {
|
|
5444
|
+
type: 'button',
|
|
5445
|
+
className: 'capital-automation-datepick-nav',
|
|
5446
|
+
'aria-label': '下个月',
|
|
5447
|
+
disabled: nextDisabled,
|
|
5448
|
+
onClick: () => { if (!nextDisabled) setMonth((current) => shiftMonthKey(current, 1)) },
|
|
5449
|
+
}, h(IconChevronRightOutlineRegular, { size: 14 }))),
|
|
5450
|
+
h('div', { className: 'capital-automation-datepick-week' },
|
|
5451
|
+
['日', '一', '二', '三', '四', '五', '六'].map((label) => h('span', {
|
|
5452
|
+
key: label,
|
|
5453
|
+
className: 'capital-automation-datepick-weekday',
|
|
5454
|
+
}, label))),
|
|
5455
|
+
h('div', { className: 'capital-automation-datepick-grid' },
|
|
5456
|
+
cells.map((cell) => cell.day === null
|
|
5457
|
+
? h('span', { key: cell.key })
|
|
5458
|
+
: h('button', {
|
|
5459
|
+
key: cell.key,
|
|
5460
|
+
type: 'button',
|
|
5461
|
+
className: 'capital-automation-datepick-day',
|
|
5462
|
+
'data-selected': cell.key === value ? 'true' : undefined,
|
|
5463
|
+
disabled: cell.key > max || (typeof min === 'string' && min.length > 0 && cell.key < min),
|
|
5464
|
+
'aria-label': cell.key,
|
|
5465
|
+
'aria-pressed': cell.key === value ? 'true' : 'false',
|
|
5466
|
+
onClick: () => {
|
|
5467
|
+
onChange(cell.key)
|
|
5468
|
+
setOpen(false)
|
|
5469
|
+
},
|
|
5470
|
+
}, String(cell.day)))))
|
|
5471
|
+
}
|
|
5472
|
+
|
|
5303
5473
|
function TodoPanel(props) {
|
|
5304
|
-
const { todos, tasks, onOpenSession, onDecideTodo, pendingTodoIds = new Set(), open, onToggle } = props
|
|
5474
|
+
const { todos, tasks, minDate = null, onOpenSession, onDecideTodo, pendingTodoIds = new Set(), open, onToggle } = props
|
|
5305
5475
|
const [filter, setFilter] = useState('today')
|
|
5476
|
+
const [historyDate, setHistoryDate] = useState(yesterdayDateKey)
|
|
5477
|
+
const historyDay = typeof minDate === 'string' && minDate.length > 0 && historyDate < minDate ? minDate : historyDate
|
|
5306
5478
|
const entries = boardTodoEntries(todos, new Date())
|
|
5307
|
-
const visible = entries.filter((entry) => entry.period === filter
|
|
5479
|
+
const visible = entries.filter((entry) => entry.period === filter
|
|
5480
|
+
&& (filter !== 'expired' || boardTodoHistoryDate(entry.item) === historyDay))
|
|
5481
|
+
if (filter === 'expired') {
|
|
5482
|
+
visible.sort((left, right) => {
|
|
5483
|
+
const leftAt = Date.parse(boardTodoConclusion(left.item).at)
|
|
5484
|
+
const rightAt = Date.parse(boardTodoConclusion(right.item).at)
|
|
5485
|
+
const delta = (Number.isFinite(rightAt) ? rightAt : 0) - (Number.isFinite(leftAt) ? leftAt : 0)
|
|
5486
|
+
if (delta !== 0) return delta
|
|
5487
|
+
return String(right.item.lastSeenAt ?? '').localeCompare(String(left.item.lastSeenAt ?? ''))
|
|
5488
|
+
|| String(left.item.title).localeCompare(String(right.item.title))
|
|
5489
|
+
})
|
|
5490
|
+
}
|
|
5308
5491
|
const checkpointHint = boardTodoVerifierHint(tasks)
|
|
5309
5492
|
const emptyText = filter === 'today'
|
|
5310
5493
|
? zh.board.todoEmptyToday
|
|
5311
|
-
:
|
|
5494
|
+
: filter === 'expired'
|
|
5495
|
+
? zh.board.todoEmptyHistory.replace('{date}', formatMonthDay(historyDay))
|
|
5496
|
+
: zh.board.todoEmptyGroup.replace('{label}', boardTodoGroupLabel(filter))
|
|
5312
5497
|
return h(BoardPanel, {
|
|
5313
5498
|
id: 'capital-automation-todo',
|
|
5314
5499
|
title: zh.board.todoTitle,
|
|
5315
5500
|
open,
|
|
5316
5501
|
onToggle,
|
|
5317
|
-
action: h(
|
|
5318
|
-
|
|
5319
|
-
|
|
5320
|
-
|
|
5321
|
-
|
|
5322
|
-
|
|
5323
|
-
|
|
5324
|
-
|
|
5502
|
+
action: h('div', { className: 'capital-automation-todofilters' },
|
|
5503
|
+
filter === 'expired'
|
|
5504
|
+
? h(HistoryDatePicker, { value: historyDay, min: minDate, max: yesterdayDateKey(), onChange: setHistoryDate })
|
|
5505
|
+
: null,
|
|
5506
|
+
h(Select, {
|
|
5507
|
+
value: filter,
|
|
5508
|
+
options: boardTodoFilterOptions(),
|
|
5509
|
+
onChange: setFilter,
|
|
5510
|
+
size: 'sm',
|
|
5511
|
+
label: zh.board.todoFilterLabel,
|
|
5512
|
+
align: 'end',
|
|
5513
|
+
})),
|
|
5325
5514
|
},
|
|
5326
5515
|
visible.length === 0
|
|
5327
5516
|
? h('p', { className: 'capital-automation-hint' }, emptyText)
|
|
5328
|
-
: h('ul', { className: 'capital-automation-todolist' }, visible.map((entry) => h(TodoRow, {
|
|
5517
|
+
: h('ul', { className: 'capital-automation-todolist', 'data-period': filter }, visible.map((entry) => h(TodoRow, {
|
|
5329
5518
|
key: entry.item.id,
|
|
5330
5519
|
item: entry.item,
|
|
5331
5520
|
period: entry.period,
|
|
@@ -5490,7 +5679,7 @@ function GapRow(props) {
|
|
|
5490
5679
|
'aria-label': `${gap.topic},${basisAction}`,
|
|
5491
5680
|
title: basisAction,
|
|
5492
5681
|
onClick: () => setOpen((value) => !value),
|
|
5493
|
-
}, gap.topic
|
|
5682
|
+
}, gap.topic)),
|
|
5494
5683
|
h('p', { className: 'capital-automation-gapdesc' }, gap.detail),
|
|
5495
5684
|
open
|
|
5496
5685
|
? h('div', { className: 'capital-automation-tododetail' },
|
|
@@ -5724,6 +5913,7 @@ function BoardPage(props) {
|
|
|
5724
5913
|
h(TodoPanel, {
|
|
5725
5914
|
todos: board?.todos ?? [],
|
|
5726
5915
|
tasks,
|
|
5916
|
+
minDate: board?.range?.from ?? null,
|
|
5727
5917
|
onOpenSession,
|
|
5728
5918
|
onDecideTodo,
|
|
5729
5919
|
pendingTodoIds,
|
package/automation/index.js
CHANGED
|
@@ -80,9 +80,15 @@ export function createAutomationRuntime(options) {
|
|
|
80
80
|
settings: getSettings,
|
|
81
81
|
profile: { displayName, runDir },
|
|
82
82
|
workspaces,
|
|
83
|
-
onRunSucceeded: (payload) => {
|
|
84
|
-
if (watches?.isVerifierTask(payload.task)
|
|
85
|
-
|
|
83
|
+
onRunSucceeded: async (payload) => {
|
|
84
|
+
if (watches?.isVerifierTask(payload.task) !== true) return briefs?.onRunSucceeded(payload)
|
|
85
|
+
let summary
|
|
86
|
+
try {
|
|
87
|
+
summary = await watches.onVerifierRun(payload)
|
|
88
|
+
} catch (error) {
|
|
89
|
+
logger?.warn?.(`capital-automation: TODO 核验结果处理失败:${String(error)}`)
|
|
90
|
+
}
|
|
91
|
+
return briefs?.recordVerifierBrief({ ...payload, summary })
|
|
86
92
|
},
|
|
87
93
|
buildPromptContext: (payload) => watches?.promptContextFor(payload.task),
|
|
88
94
|
now,
|
package/automation/package.json
CHANGED
package/automation/schema.js
CHANGED
|
@@ -328,9 +328,9 @@ export const TaskBriefSchema = z.strictObject({
|
|
|
328
328
|
status: z.enum(['pending', 'ready', 'failed', 'skipped']),
|
|
329
329
|
headline: z.string().min(4).max(24).optional(),
|
|
330
330
|
plain: z.string().min(40).max(200).optional(),
|
|
331
|
-
items: z.array(BriefItemSchema)
|
|
331
|
+
items: z.array(BriefItemSchema),
|
|
332
332
|
stocks: z.array(BriefStockSchema).max(8),
|
|
333
|
-
gaps: z.array(BriefGapSchema)
|
|
333
|
+
gaps: z.array(BriefGapSchema),
|
|
334
334
|
coverage: z.enum(['full', 'partial']).optional(),
|
|
335
335
|
model: z.string().max(120).optional(),
|
|
336
336
|
promptVersion: z.number().int().min(1).max(99),
|