dsh-dispatch-board 0.2.5 → 0.2.6

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.
Files changed (2) hide show
  1. package/lib/index.js +25 -3
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -167,6 +167,25 @@ function iso(ms) {
167
167
  return new Date(ms).toISOString()
168
168
  }
169
169
 
170
+ /**
171
+ * 宿主本地时区的可读时间戳:`YYYY-MM-DD HH:mm:ss ±HH:MM`(带 UTC 偏移量,便于跨时区对表)。
172
+ * 只用于拼给模型 / 用户看的**人读文案**(派发文本「看板时间」、完成回执「看板时间」、
173
+ * 工具输出的「更新时间」);board.json 等存储字段仍是 ISO UTC(`iso()`),协议口径不变。
174
+ * 解析失败返回空串,调用方自行回退原始字符串。
175
+ */
176
+ export function localStamp(ms) {
177
+ const date = new Date(ms)
178
+ if (Number.isNaN(date.getTime())) return ''
179
+ const pad = (n) => String(n).padStart(2, '0')
180
+ const wall =
181
+ date.getFullYear() + '-' + pad(date.getMonth() + 1) + '-' + pad(date.getDate()) +
182
+ ' ' + pad(date.getHours()) + ':' + pad(date.getMinutes()) + ':' + pad(date.getSeconds())
183
+ const offsetMin = -date.getTimezoneOffset()
184
+ const sign = offsetMin >= 0 ? '+' : '-'
185
+ const abs = Math.abs(offsetMin)
186
+ return wall + ' ' + sign + pad(Math.floor(abs / 60)) + ':' + pad(abs % 60)
187
+ }
188
+
170
189
  function asString(value) {
171
190
  return typeof value === 'string' ? value : ''
172
191
  }
@@ -1386,7 +1405,7 @@ export function buildDispatchText(task, now = Date.now()) {
1386
1405
  if (task.notificationCount > 0) {
1387
1406
  lines.push('(这是第 ' + (task.notificationCount + 1) + ' 次提醒;任务仍未派发。)')
1388
1407
  }
1389
- lines.push('看板时间:' + iso(now))
1408
+ lines.push('看板时间:' + localStamp(now))
1390
1409
  return lines.join('\n')
1391
1410
  }
1392
1411
 
@@ -1774,7 +1793,7 @@ export function buildReceiptText(tasks, now = Date.now()) {
1774
1793
  }
1775
1794
  lines.push('')
1776
1795
  lines.push('请向用户汇总以上结论,不要重复执行任务。')
1777
- lines.push('看板时间:' + iso(now))
1796
+ lines.push('看板时间:' + localStamp(now))
1778
1797
  return lines.join('\n')
1779
1798
  }
1780
1799
 
@@ -3808,7 +3827,10 @@ function renderTaskOne(prefix, task) {
3808
3827
  if (task.note) lines.push('备注:' + task.note)
3809
3828
  if (task.result) lines.push('结论:' + task.result)
3810
3829
  if (task.needsUser) lines.push('待用户回答:' + task.question)
3811
- lines.push('更新时间:' + task.updatedAt)
3830
+ const updatedMs = Date.parse(task.updatedAt)
3831
+ lines.push(
3832
+ '更新时间:' + (Number.isFinite(updatedMs) ? localStamp(updatedMs) : asString(task.updatedAt)),
3833
+ )
3812
3834
  return [{ type: 'text', text: lines.join('\n') }]
3813
3835
  }
3814
3836
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-dispatch-board",
3
- "version": "0.2.5",
3
+ "version": "0.2.6",
4
4
  "description": "DeepSeek Harness 插件:派单看板 + 派单模式。主 Agent 只拆解/派发/审核/汇报,子 Agent 干活;看板四列(待开始/进行中/已完成/已归档)由轮询自动派发,结论按 Markdown 展示。Dispatcher mode plus a dispatch board for DeepSeek Harness.",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",