@restregular/dsh-team-hub 0.2.0 → 0.3.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.
package/README.md CHANGED
@@ -1,10 +1,13 @@
1
1
  # @restregular/dsh-team-hub
2
2
 
3
- DSH 团队中枢:画布式 Agent 协作看板。
3
+ DSH 团队中枢:无限画布式 Agent 协作看板。
4
4
 
5
- - 侧边栏按钮切换到全屏团队画布,卡片可自由拖拽。
6
- - 每会话 = 一个 Agent 卡片;派任务 / 发消息 / 查状态 / 读回复 / 跳会话。
7
- - 工具层:`team_hub_list_agents` / `team_hub_send` / `team_hub_status` / `team_hub_reply` / `team_hub_create_agent`。
5
+ - 工作区行「…」→「在团队中枢打开」进入绑定工作区的画布;点击卡片气泡切回原生会话,画布缩到右侧栏。
6
+ - 无限画布:拖拽空白处平移、Ctrl+滚轮以鼠标为锚点缩放、方格背景、随缩放变化的自定义鼠标。
7
+ - 每会话 = 一个 Agent 卡片:实例化 / 刷新实例(保存与恢复进度提示词)/ 移除(自动归档会话,可恢复)/ 发消息 / 工具日志。
8
+ - 卡片上方外部聊天气泡滚动展示实时会话内容;协作仅沟通后连线并动画传递。
9
+ - 团队看板浮窗:公开团队任务 + 全 Agent 工具调用日志。
10
+ - 工具层:`team_hub_list_agents` / `find_agent` / `send` / `status` / `reply` / `create_agent` / `public_tasks` / `set_public_task`。
8
11
  - 权限:禁用工具为代码硬约束;身份与文件边界为提示词软约束。
9
12
  - 状态持久化于 `~/.dsh/team-hub/board.json`。
10
13
 
package/client.js CHANGED
@@ -171,7 +171,9 @@
171
171
 
172
172
  /* ------------------------------------------------------------- 样式 */
173
173
  const CSS = `
174
- .th-root { position:relative; display:flex; flex-direction:column; width:100%; height:100%; min-height:0; overflow:hidden; background:var(--dsw-alias-bg-base); color:var(--dsw-alias-label-primary); font-family:inherit; }
174
+ .th-root { position:relative; display:flex; flex-direction:column; width:100%; height:100%; min-height:0; overflow:hidden; background:var(--dsw-alias-bg-base); color:var(--dsw-alias-label-primary); font-family:inherit; user-select:none; -webkit-user-select:none; }
175
+ .th-root button, .th-root input, .th-root textarea { user-select:none; -webkit-user-select:none; }
176
+ .th-root input, .th-root textarea { user-select:text; -webkit-user-select:text; }
175
177
  .th-compact .th-bar { padding:8px 10px; gap:6px; }
176
178
  .th-compact .th-title, .th-compact .th-sub { font-size:11px; }
177
179
  .th-compact .th-ws-chip { max-width:120px; font-size:10px; }
@@ -196,11 +198,9 @@
196
198
  .th-zoom button { appearance:none; border:0; background:var(--dsw-alias-bg-layer-2); color:var(--dsw-alias-label-primary); width:26px; height:26px; font-size:14px; cursor:pointer; transition:background .16s ease; }
197
199
  .th-zoom button:hover { background:var(--dsw-alias-interactive-bg-hover); }
198
200
  .th-zoom span { min-width:46px; text-align:center; font-size:11px; color:var(--dsw-alias-label-secondary); font-variant-numeric:tabular-nums; }
199
- .th-canvas { position:relative; flex:1 1 auto; min-height:0; overflow:hidden; background-color:var(--dsw-alias-bg-layer-1); background-image:linear-gradient(to right, var(--dsw-alias-border-l1) 1px, transparent 1px), linear-gradient(to bottom, var(--dsw-alias-border-l1) 1px, transparent 1px); background-size:24px 24px; cursor:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28' viewBox='0 0 28 28'%3E%3Cpath d='M5 2 L5 22 L10 17 L14 25 L18 23 L14 15 L21 15 Z' fill='%23ffffff' stroke='%23111827' stroke-width='1.6' stroke-linejoin='round'/%3E%3C/svg%3E") 5 2, grab; }
200
- .th-canvas.th-panning { cursor:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28' viewBox='0 0 28 28'%3E%3Cpath d='M9 12 V7 a2 2 0 0 1 4 0 v4 a2 2 0 0 1 4 0 v1 a2 2 0 0 1 4 0 v5 c0 4-3 7-7 7 h-2 c-3 0-5-2-6-4 l-3-5 a2 2 0 0 1 3-2 l3 3 z' fill='%23ffffff' stroke='%23111827' stroke-width='1.6' stroke-linejoin='round'/%3E%3C/svg%3E") 12 8, grabbing; }
201
- .th-node, .th-node * { cursor:auto; }
202
- .th-head, .th-head * { cursor:grab !important; }
203
- .th-head:active, .th-head:active * { cursor:grabbing !important; }
201
+ .th-canvas { position:relative; flex:1 1 auto; min-height:0; overflow:hidden; background-color:var(--dsw-alias-bg-layer-1); background-image:linear-gradient(to right, var(--dsw-alias-border-l1) 1px, transparent 1px), linear-gradient(to bottom, var(--dsw-alias-border-l1) 1px, transparent 1px); background-size:24px 24px; cursor:var(--th-cursor, grab); }
202
+ .th-canvas *, .th-node, .th-node * { cursor:var(--th-cursor, grab) !important; }
203
+ .th-canvas .th-btn, .th-canvas button { cursor:var(--th-cursor, grab) !important; }
204
204
  .th-stage { position:absolute; inset:0; pointer-events:none; }
205
205
  .th-world { position:absolute; left:0; top:0; transform-origin:0 0; pointer-events:none; }
206
206
  .th-world > * { pointer-events:auto; }
@@ -247,8 +247,22 @@
247
247
  .th-modal { width:460px; max-width:92vw; max-height:86vh; overflow:auto; background:var(--dsw-alias-bg-layer-1); border:1px solid var(--dsw-alias-border-l2); border-radius:16px; padding:20px; box-shadow:0 24px 70px rgba(0,0,0,.4); animation:th-rise .24s cubic-bezier(.2,.8,.2,1) both; }
248
248
  @keyframes th-rise { from{opacity:0; transform:translateY(18px) scale(.97)} to{opacity:1; transform:none} }
249
249
  .th-modal h3 { margin:0 0 14px; font-size:16px; }
250
- .th-field { display:flex; flex-direction:column; gap:5px; margin-bottom:12px; }
250
+ .th-field { display:flex; flex-direction:column; gap:5px; margin-bottom:12px; flex:1 1 auto; min-width:0; }
251
251
  .th-field label { font-size:11px; color:var(--dsw-alias-label-secondary); }
252
+ .th-form { width:480px; padding:0; }
253
+ .th-form-head { display:flex; align-items:center; gap:10px; padding:16px 18px 12px; border-bottom:1px solid var(--dsw-alias-border-l1); }
254
+ .th-form-head h3 { margin:0; flex:1 1 auto; }
255
+ .th-form-emoji { font-size:24px; }
256
+ .th-x { appearance:none; border:0; background:transparent; color:var(--dsw-alias-label-secondary); font-size:22px; line-height:1; cursor:pointer; padding:0 4px; }
257
+ .th-x:hover { color:var(--dsw-alias-label-primary); }
258
+ .th-form-row { display:flex; gap:12px; padding:14px 18px 0; }
259
+ .th-tabs { display:flex; gap:4px; padding:0 18px; border-bottom:1px solid var(--dsw-alias-border-l1); }
260
+ .th-tab { appearance:none; border:0; border-bottom:2px solid transparent; background:transparent; color:var(--dsw-alias-label-secondary); padding:8px 14px; font-size:12px; cursor:pointer; transition:color .16s ease, border-color .16s ease; }
261
+ .th-tab.on { color:var(--dsw-alias-brand-primary); border-color:var(--dsw-alias-brand-primary); font-weight:600; }
262
+ .th-form-body { padding:14px 18px 4px; max-height:52vh; overflow:auto; }
263
+ .th-textarea.th-sm { min-height:58px; }
264
+ .th-textarea.th-xs { min-height:44px; }
265
+ .th-form .th-modal-foot { padding:0 18px 16px; }
252
266
  .th-bind { background:var(--dsw-alias-bg-layer-2); border:1px solid var(--dsw-alias-border-l1); border-radius:8px; padding:8px 10px; font-size:11.5px; color:var(--dsw-alias-label-secondary); margin-bottom:14px; }
253
267
  .th-input, .th-textarea { width:100%; box-sizing:border-box; background:var(--dsw-alias-bg-base); color:var(--dsw-alias-label-primary); border:1px solid var(--dsw-alias-border-l2); border-radius:8px; padding:8px 10px; font-size:12.5px; font-family:inherit; transition:border-color .16s ease; }
254
268
  .th-input:focus, .th-textarea:focus { outline:none; border-color:var(--dsw-alias-brand-primary); }
@@ -265,6 +279,34 @@
265
279
  @keyframes th-slide { from{opacity:0; transform:translateX(10px)} to{opacity:1; transform:none} }
266
280
  .th-log b { color:var(--dsw-alias-label-primary); font-weight:600; }
267
281
  .th-empty { position:absolute; inset:0; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:10px; color:var(--dsw-alias-label-secondary); font-size:13px; }
282
+ /* 团队看板浮窗 */
283
+ .th-board-panel { position:absolute; right:14px; top:56px; width:380px; max-height:calc(100% - 70px); overflow:auto; background:var(--dsw-alias-bg-overlay); border:1px solid var(--dsw-alias-border-l2); border-radius:14px; box-shadow:0 12px 40px rgba(0,0,0,.3); z-index:60; animation:th-rise .2s ease both; padding:14px 16px; }
284
+ .th-board-head { display:flex; align-items:center; margin-bottom:10px; }
285
+ .th-board-head h3 { margin:0; flex:1 1 auto; font-size:14px; }
286
+ .th-board-section { margin-top:12px; border-top:1px solid var(--dsw-alias-border-l1); padding-top:10px; }
287
+ .th-board-sub { font-size:11px; color:var(--dsw-alias-label-secondary); margin-bottom:8px; font-weight:600; }
288
+ .th-task-add { display:flex; gap:6px; margin-bottom:8px; }
289
+ .th-task-add .th-input { flex:1 1 auto; min-width:0; padding:5px 8px; font-size:11px; }
290
+ .th-task-add .th-btn { flex:0 0 auto; padding:4px 10px; }
291
+ .th-task-list { display:flex; flex-direction:column; gap:6px; max-height:220px; overflow:auto; }
292
+ .th-task-item { display:flex; align-items:flex-start; gap:8px; padding:7px 8px; border:1px solid var(--dsw-alias-border-l1); border-radius:8px; background:var(--dsw-alias-bg-layer-1); }
293
+ .th-task-status { flex:0 0 auto; appearance:none; border:0; border-radius:6px; font-size:10px; padding:2px 7px; cursor:pointer; background:var(--dsw-alias-bg-layer-2); color:var(--dsw-alias-label-secondary); }
294
+ .th-task-status.doing { color:var(--dsw-alias-state-warn-primary); }
295
+ .th-task-status.done { color:var(--dsw-alias-state-success-primary); }
296
+ .th-task-body { flex:1 1 auto; min-width:0; }
297
+ .th-task-title { font-size:12px; color:var(--dsw-alias-label-primary); }
298
+ .th-task-detail { font-size:10.5px; color:var(--dsw-alias-label-secondary); margin-top:2px; word-break:break-word; }
299
+ .th-muted { font-size:11px; color:var(--dsw-alias-label-secondary); text-align:center; padding:12px; }
300
+ .th-log-agents { display:flex; flex-wrap:wrap; gap:6px; margin-top:8px; }
301
+ .th-log-agents .th-btn { padding:4px 9px; font-size:11px; }
302
+ .th-logs { width:640px; padding:0; }
303
+ .th-log-list { padding:12px 18px 18px; max-height:60vh; overflow:auto; }
304
+ .th-log-item { padding:8px 10px; border:1px solid var(--dsw-alias-border-l1); border-radius:8px; margin-bottom:7px; background:var(--dsw-alias-bg-layer-1); animation:th-slide .25s ease both; }
305
+ .th-log-meta { display:flex; align-items:center; gap:10px; font-size:10.5px; }
306
+ .th-log-tool { color:var(--dsw-alias-brand-primary); font-weight:600; }
307
+ .th-log-agent { color:var(--dsw-alias-label-secondary); }
308
+ .th-log-time { margin-left:auto; color:var(--dsw-alias-label-secondary); }
309
+ .th-log-detail { margin-top:5px; font-size:11px; color:var(--dsw-alias-label-secondary); word-break:break-all; font-family:var(--dsw-font-mono, monospace); }
268
310
  /* 右侧栏里的紧凑画布 */
269
311
  .th-side { display:flex; flex-direction:column; height:100%; min-height:0; font-family:inherit; color:var(--dsw-alias-label-primary); background:var(--dsw-alias-bg-base); }
270
312
  .th-side-bar { display:flex; align-items:center; gap:8px; padding:10px 12px; border-bottom:1px solid var(--dsw-alias-border-l1); font-size:12px; flex:0 0 auto; }
@@ -327,7 +369,7 @@
327
369
  )
328
370
  }
329
371
 
330
- function AgentCard({ agent, feed, notices, onDragStart, onMessage, onOpen, onEdit, onRemove, onStatus, onInstantiate, onRefresh }) {
372
+ function AgentCard({ agent, feed, notices, onDragStart, onMessage, onOpen, onEdit, onRemove, onStatus, onInstantiate, onRefresh, onLogs }) {
331
373
  const status = statusOf(agent)
332
374
  const sid = agent.sessionId
333
375
  const extra = sid ? (notices[sid] || []) : []
@@ -364,9 +406,9 @@
364
406
  h('div', { className: 'th-foot' },
365
407
  h('button', { className: 'th-btn primary', onClick: () => onMessage(agent) }, '发消息'),
366
408
  h('button', { className: 'th-btn', onClick: () => onOpen(agent) }, '打开会话'),
409
+ h('button', { className: 'th-btn', onClick: () => onLogs(agent) }, '工具日志'),
367
410
  ),
368
411
  h('div', { className: 'th-foot' },
369
- h('button', { className: 'th-btn', onClick: () => onStatus(agent) }, '状态'),
370
412
  h('button', { className: 'th-btn', onClick: () => onRefresh(agent) }, '刷新实例'),
371
413
  h('button', { className: 'th-btn', onClick: () => onEdit(agent) }, '编辑'),
372
414
  h('button', { className: 'th-btn danger', onClick: () => onRemove(agent) }, '移除'),
@@ -378,20 +420,43 @@
378
420
 
379
421
  function AgentForm({ agent, t, workspaceTitle, onClose, onSave }) {
380
422
  const [form, setForm] = useState(agent || { icon: '🤖', name: '', identity: '', duties: '', permissions: { denyTools: '', writeFiles: '', readFiles: '' } })
423
+ const [tab, setTab] = useState('basic')
381
424
  const set = (k, v) => setForm((f) => ({ ...f, [k]: v }))
382
425
  const setPerm = (k, v) => setForm((f) => ({ ...f, permissions: { ...f.permissions, [k]: v } }))
383
426
  const split = (v) => String(v || '').split(/[,,\n]/).map((s) => s.trim()).filter(Boolean)
427
+ const field = (label, control) => h('div', { className: 'th-field' }, h('label', null, label), control)
384
428
  return h('div', { className: 'th-overlay', onPointerDown: (e) => { if (e.target === e.currentTarget) onClose() } },
385
- h('div', { className: 'th-modal' },
386
- h('h3', null, agent ? t('editAgent') : t('newAgent')),
387
- !agent && h('div', { className: 'th-bind' }, '🔗 ', t('newAgentHint'), ':', workspaceTitle || t('noWorkspace')),
388
- h('div', { className: 'th-field' }, h('label', null, t('icon')), h('input', { className: 'th-input', value: form.icon, onChange: (e) => set('icon', e.target.value) })),
389
- h('div', { className: 'th-field' }, h('label', null, t('name')), h('input', { className: 'th-input', value: form.name, onChange: (e) => set('name', e.target.value), placeholder: '例如:研究员' })),
390
- h('div', { className: 'th-field' }, h('label', null, t('identity')), h('textarea', { className: 'th-textarea', value: form.identity, onChange: (e) => set('identity', e.target.value) })),
391
- h('div', { className: 'th-field' }, h('label', null, t('duties')), h('textarea', { className: 'th-textarea', value: form.duties, onChange: (e) => set('duties', e.target.value) })),
392
- h('div', { className: 'th-field' }, h('label', null, t('denyTools')), h('input', { className: 'th-input', value: form.permissions.denyTools || '', onChange: (e) => setPerm('denyTools', e.target.value), placeholder: 'bash, pwsh(硬约束)' })),
393
- h('div', { className: 'th-field' }, h('label', null, t('writeFiles')), h('input', { className: 'th-input', value: form.permissions.writeFiles || '', onChange: (e) => setPerm('writeFiles', e.target.value), placeholder: '仅提示词约束' })),
394
- h('div', { className: 'th-field' }, h('label', null, t('readFiles')), h('input', { className: 'th-input', value: form.permissions.readFiles || '', onChange: (e) => setPerm('readFiles', e.target.value), placeholder: '仅提示词约束' })),
429
+ h('div', { className: 'th-modal th-form' },
430
+ h('div', { className: 'th-form-head' },
431
+ h('span', { className: 'th-form-emoji' }, form.icon || '🤖'),
432
+ h('h3', null, agent ? t('editAgent') : t('newAgent')),
433
+ h('button', { className: 'th-x', onClick: onClose, title: t('cancel') }, '×'),
434
+ ),
435
+ h('div', { className: 'th-form-row' },
436
+ field(t('icon'), h('input', { className: 'th-input', value: form.icon, onChange: (e) => set('icon', e.target.value), style: { maxWidth: 72 } })),
437
+ field(t('name'), h('input', { className: 'th-input', value: form.name, onChange: (e) => set('name', e.target.value), placeholder: '例如:研究员' })),
438
+ ),
439
+ h('div', { className: 'th-tabs' },
440
+ h('button', { className: `th-tab ${tab === 'basic' ? 'on' : ''}`, onClick: () => setTab('basic') }, t('basicTab')),
441
+ h('button', { className: `th-tab ${tab === 'adv' ? 'on' : ''}`, onClick: () => setTab('adv') }, t('advTab')),
442
+ ),
443
+ h('div', { className: 'th-form-body' },
444
+ tab === 'basic'
445
+ ? h('div', null,
446
+ field(t('identity'), h('textarea', { className: 'th-textarea th-sm', value: form.identity, onChange: (e) => set('identity', e.target.value), placeholder: t('identity') })),
447
+ field(t('duties'), h('textarea', { className: 'th-textarea th-sm', value: form.duties, onChange: (e) => set('duties', e.target.value), placeholder: t('duties') })),
448
+ )
449
+ : h('div', null,
450
+ !agent && h('div', { className: 'th-bind' }, '🔗 ', t('newAgentHint'), ':', workspaceTitle || t('noWorkspace')),
451
+ field(t('savePrompt'), h('textarea', { className: 'th-textarea th-sm', value: form.savePrompt || '', onChange: (e) => set('savePrompt', e.target.value), placeholder: t('defaultSavePrompt') })),
452
+ field(t('restorePrompt'), h('textarea', { className: 'th-textarea th-sm', value: form.restorePrompt || '', onChange: (e) => set('restorePrompt', e.target.value), placeholder: t('defaultRestorePrompt') })),
453
+ field(t('denyTools'), h('textarea', { className: 'th-textarea th-xs', value: form.permissions.denyTools || '', onChange: (e) => setPerm('denyTools', e.target.value), placeholder: '每行一个工具名,如 bash / pwsh(硬约束)' })),
454
+ h('div', { className: 'th-form-row' },
455
+ field(t('writeFiles'), h('textarea', { className: 'th-textarea th-xs', value: form.permissions.writeFiles || '', onChange: (e) => setPerm('writeFiles', e.target.value), placeholder: '每行一个可写路径(提示约束)' })),
456
+ field(t('readFiles'), h('textarea', { className: 'th-textarea th-xs', value: form.permissions.readFiles || '', onChange: (e) => setPerm('readFiles', e.target.value), placeholder: '每行一个可读路径(提示约束)' })),
457
+ ),
458
+ ),
459
+ ),
395
460
  h('div', { className: 'th-modal-foot' },
396
461
  h('button', { className: 'th-btn', onClick: onClose }, t('cancel')),
397
462
  h('button', {
@@ -432,8 +497,8 @@
432
497
 
433
498
  /** 刷新实例弹窗:设置保存/恢复进度提示词,把 Agent 换绑到新会话。 */
434
499
  function RefreshModal({ agent, t, busy, onClose, onRun }) {
435
- const [saveText, setSaveText] = useState(t('defaultSavePrompt'))
436
- const [restoreText, setRestoreText] = useState(t('defaultRestorePrompt'))
500
+ const [saveText, setSaveText] = useState(agent.savePrompt || t('defaultSavePrompt'))
501
+ const [restoreText, setRestoreText] = useState(agent.restorePrompt || t('defaultRestorePrompt'))
437
502
  return h('div', { className: 'th-overlay', onPointerDown: (e) => { if (e.target === e.currentTarget && !busy) onClose() } },
438
503
  h('div', { className: 'th-modal' },
439
504
  h('h3', null, `${t('refreshInstance')} · ${agent.name}`),
@@ -457,6 +522,103 @@
457
522
  )
458
523
  }
459
524
 
525
+ /** 工具调用日志查看器:可看全部 Agent 或某个 Agent 的日志。 */
526
+ function ToolLogPanel({ t, agent, onClose }) {
527
+ const [logs, setLogs] = useState([])
528
+ useEffect(() => {
529
+ let alive = true
530
+ const load = async () => {
531
+ try {
532
+ const q = agent ? `?agentId=${encodeURIComponent(agent.id)}` : ''
533
+ const d = await api('/tool-logs' + q)
534
+ if (alive) setLogs((d || []).slice().reverse())
535
+ } catch {}
536
+ }
537
+ load()
538
+ const id = setInterval(load, 4000)
539
+ return () => { alive = false; clearInterval(id) }
540
+ }, [agent])
541
+ return h('div', { className: 'th-overlay', onPointerDown: (e) => { if (e.target === e.currentTarget) onClose() } },
542
+ h('div', { className: 'th-modal th-logs' },
543
+ h('div', { className: 'th-form-head' },
544
+ h('h3', null, `${t('toolLogs')}${agent ? ` · ${agent.name}` : ''}`),
545
+ h('button', { className: 'th-x', onClick: onClose }, '×'),
546
+ ),
547
+ h('div', { className: 'th-log-list' },
548
+ logs.length === 0
549
+ ? h('div', { style: { padding: 30, textAlign: 'center', color: 'var(--dsw-alias-label-secondary)', fontSize: 12 } }, t('noLogs'))
550
+ : logs.map((l) => {
551
+ const a = agent || null
552
+ return h('div', { className: 'th-log-item', key: l.id },
553
+ h('div', { className: 'th-log-meta' },
554
+ h('span', { className: 'th-log-tool' }, l.tool),
555
+ a ? null : h('span', { className: 'th-log-agent' }, (l.agentId || '—').slice(0, 8)),
556
+ h('span', { className: 'th-log-time' }, new Date(l.at).toLocaleTimeString()),
557
+ ),
558
+ h('div', { className: 'th-log-detail' }, l.detail || '—'),
559
+ )
560
+ }),
561
+ ),
562
+ ),
563
+ )
564
+ }
565
+
566
+ /** 团队看板浮窗:公开团队任务 + 全部工具日志入口。 */
567
+ function TeamBoardPanel({ t, agents, onClose, onLogs, refreshKey }) {
568
+ const [tasks, setTasks] = useState([])
569
+ const [title, setTitle] = useState('')
570
+ const [detail, setDetail] = useState('')
571
+ const load = useCallback(async () => {
572
+ try { setTasks((await api('/public-tasks')) || []) } catch {}
573
+ }, [])
574
+ useEffect(() => { load(); const id = setInterval(load, 5000); return () => clearInterval(id) }, [load])
575
+ useEffect(() => { load() }, [refreshKey, load])
576
+ const add = async () => {
577
+ if (!title.trim()) return
578
+ try { await api('/public-task', { method: 'POST', body: { title: title.trim(), detail: detail.trim() } }); setTitle(''); setDetail(''); load() } catch {}
579
+ }
580
+ const cycle = async (task) => {
581
+ const next = task.status === 'open' ? 'doing' : task.status === 'doing' ? 'done' : 'open'
582
+ try { await api('/public-task', { method: 'POST', body: { ...task, status: next } }); load() } catch {}
583
+ }
584
+ const del = async (task) => {
585
+ try { await api('/public-task?id=' + encodeURIComponent(task.id), { method: 'DELETE' }); load() } catch {}
586
+ }
587
+ return h('div', { className: 'th-board-panel' },
588
+ h('div', { className: 'th-board-head' },
589
+ h('h3', null, t('teamBoard')),
590
+ h('button', { className: 'th-x', onClick: onClose }, '×'),
591
+ ),
592
+ h('div', { className: 'th-board-section' },
593
+ h('div', { className: 'th-board-sub' }, t('publicTasks')),
594
+ h('div', { className: 'th-task-add' },
595
+ h('input', { className: 'th-input', value: title, onChange: (e) => setTitle(e.target.value), placeholder: t('taskTitle') }),
596
+ h('input', { className: 'th-input', value: detail, onChange: (e) => setDetail(e.target.value), placeholder: t('taskDetail') }),
597
+ h('button', { className: 'th-btn primary', onClick: add, disabled: !title.trim() }, '+'),
598
+ ),
599
+ h('div', { className: 'th-task-list' },
600
+ tasks.length === 0
601
+ ? h('div', { className: 'th-muted' }, t('noTasks'))
602
+ : tasks.map((task) => h('div', { className: 'th-task-item', key: task.id },
603
+ h('button', { className: `th-task-status ${task.status}`, onClick: () => cycle(task), title: t('cycleStatus') }, task.status),
604
+ h('div', { className: 'th-task-body' },
605
+ h('div', { className: 'th-task-title' }, task.title),
606
+ task.detail ? h('div', { className: 'th-task-detail' }, task.detail) : null,
607
+ ),
608
+ h('button', { className: 'th-x', onClick: () => del(task) }, '×'),
609
+ )),
610
+ ),
611
+ ),
612
+ h('div', { className: 'th-board-section' },
613
+ h('div', { className: 'th-board-sub' }, t('toolLogs')),
614
+ h('button', { className: 'th-btn', style: { width: '100%' }, onClick: () => onLogs(null) }, `${t('allAgents')} →`),
615
+ h('div', { className: 'th-log-agents' },
616
+ agents.map((a) => h('button', { className: 'th-btn', key: a.id, onClick: () => onLogs(a) }, `${a.icon || '🤖'} ${a.name}`)),
617
+ ),
618
+ ),
619
+ )
620
+ }
621
+
460
622
  /** 右侧栏紧凑画布:与中央画布共享同一份看板数据,点击卡片打开对应原生会话。 */
461
623
  /** 右侧栏里渲染的是同一个完整画布(拖拽/缩放/气泡/连线俱全),不是列表。 */
462
624
  function SidebarCanvas(props) {
@@ -509,6 +671,9 @@
509
671
  const [composer, setComposer] = useState(null)
510
672
  const [refreshing, setRefreshing] = useState(null)
511
673
  const [refreshBusy, setRefreshBusy] = useState(false)
674
+ const [boardOpen, setBoardOpen] = useState(false)
675
+ const [logAgent, setLogAgent] = useState(undefined) // undefined=不显示, null=全部, 对象=某 Agent
676
+ const [boardKey, setBoardKey] = useState(0)
512
677
  const [activity, setActivity] = useState([])
513
678
  const [pulses, setPulses] = useState([])
514
679
  const [zoom, setZoom] = useState(props.compact ? 0.6 : 1)
@@ -611,10 +776,10 @@
611
776
  }
612
777
  }, [])
613
778
 
614
- // 鼠标指针始终自定义,尺寸随 zoom 变化;inline 覆盖 CSS。
779
+ // 鼠标指针始终自定义,尺寸随 zoom 变化;用 CSS 变量覆盖整个画布子树。
615
780
  useEffect(() => {
616
781
  const el = canvasRef.current
617
- if (el) el.style.cursor = makeCursor(zoom, panning)
782
+ if (el) el.style.setProperty('--th-cursor', makeCursor(zoom, panning))
618
783
  }, [zoom, panning])
619
784
 
620
785
  const notify = useCallback((msg) => {
@@ -696,39 +861,51 @@
696
861
  setRefreshBusy(true)
697
862
  const oldSid = agent.sessionId
698
863
  const ws = agent.workspaceId || workspaceId
864
+ let step = 'start'
865
+ const trace = (s) => { step = s; log(`↳ ${s}`) }
699
866
  try {
700
867
  // 1) 旧会话发送保存进度提示词
868
+ trace('发送保存进度提示词')
701
869
  notify('正在让旧会话保存进度…')
702
870
  if (saveText.trim()) {
703
871
  await ctx.sessions.using(oldSid, { source: 'teamHub' }, async (ref) => {
704
872
  await ref.ready
705
- return ref.binding.session.prompt([{ type: 'text', text: saveText.trim() }], 'queue', undefined, crypto.randomUUID())
873
+ const res = await ref.binding.session.prompt([{ type: 'text', text: saveText.trim() }], 'queue', undefined, crypto.randomUUID())
874
+ if (res && res.ok === false) throw new Error(res.error?.message || '保存提示词发送失败')
706
875
  })
707
876
  // 2) 等旧会话这一轮跑完(wait 在 idle / input-required / timeout 时返回)
877
+ trace('等待旧会话完成')
708
878
  const waitRes = await ctx.remote.session.wait({ sessionId: oldSid, timeoutMs: 60000, maxMessages: 6 })
709
- if (waitRes && waitRes.ok === false) notify(`等待保存完成超时/失败:${waitRes.error?.message || ''}`)
879
+ if (waitRes && waitRes.ok === false) throw new Error(`等待失败:${waitRes.error?.message || ''}`)
710
880
  }
711
881
  // 3) 归档旧会话
882
+ trace('归档旧会话')
712
883
  await ctx.uiWorkspace?.archiveSession(oldSid, { stopActivity: true })
713
884
  log(`<b>${agent.name}</b> 旧会话已归档`)
714
885
  // 4) 建新会话
886
+ trace('创建新会话')
715
887
  if (!ws) throw new Error('未绑定工作区')
716
888
  const newSid = await ctx.sessions.create({ workspaceId: ws })
717
889
  notify('新会话已创建,正在恢复进度…')
718
890
  // 5) 新会话发恢复进度提示词
891
+ trace('发送恢复进度提示词')
719
892
  await ctx.sessions.using(newSid, { source: 'teamHub' }, async (ref) => {
720
893
  await ref.ready
721
894
  const msgs = [{ type: 'text', text: restoreText?.trim() || t('defaultRestorePrompt') }]
722
- return ref.binding.session.prompt(msgs, 'queue', undefined, crypto.randomUUID())
895
+ const res = await ref.binding.session.prompt(msgs, 'queue', undefined, crypto.randomUUID())
896
+ if (res && res.ok === false) throw new Error(res.error?.message || '恢复提示词发送失败')
723
897
  })
724
898
  // 6) 重绑卡片
899
+ trace('重绑卡片')
725
900
  await api('/agent', { method: 'POST', body: { ...agent, sessionId: newSid } })
726
901
  log(`<b>${agent.name}</b> 已刷新实例并恢复进度`)
727
902
  notify('刷新实例完成')
728
903
  setRefreshing(null)
729
904
  await refresh()
730
905
  } catch (e) {
731
- notify(`刷新失败: ${e.message}`)
906
+ const msg = `刷新失败(${step}): ${e?.message || e}`
907
+ log(`<b style="color:var(--dsw-alias-state-error-primary)">${msg}</b>`)
908
+ notify(msg)
732
909
  } finally { setRefreshBusy(false) }
733
910
  }
734
911
 
@@ -799,6 +976,7 @@
799
976
  h('button', { title: '放大', onClick: () => setZoomClamped(zoom + 0.1) }, '+'),
800
977
  h('button', { title: '重置', onClick: () => setZoomClamped(1) }, '⟳'),
801
978
  ),
979
+ h('button', { className: `th-btn ${boardOpen ? 'primary' : ''}`, onClick: () => setBoardOpen((v) => !v) }, t('teamBoard')),
802
980
  h('button', { className: 'th-btn', onClick: () => { refresh(); refreshRemoved() } }, t('refresh')),
803
981
  h('button', { className: 'th-btn primary', onClick: () => setForm({}) }, t('newAgent')),
804
982
  ),
@@ -832,6 +1010,7 @@
832
1010
  onStatus: showStatus,
833
1011
  onInstantiate: instantiate,
834
1012
  onRefresh: (ag) => setRefreshing(ag),
1013
+ onLogs: (ag) => setLogAgent(ag),
835
1014
  })),
836
1015
  activity.length > 0 && h('div', { className: 'th-activity' },
837
1016
  h('div', { style: { fontWeight: 650, marginBottom: 6 } }, t('activity')),
@@ -845,6 +1024,8 @@
845
1024
  form !== null ? h(AgentForm, { agent: form.id ? form : null, t, workspaceTitle, onClose: () => setForm(null), onSave: saveAgent }) : null,
846
1025
  composer ? h(Composer, { agent: composer.agent, t, onClose: () => setComposer(null), onSend: (text) => sendMessage(composer.agent, text) }) : null,
847
1026
  refreshing ? h(RefreshModal, { agent: refreshing, t, busy: refreshBusy, onClose: () => setRefreshing(null), onRun: (p) => runRefresh(refreshing, p) }) : null,
1027
+ boardOpen ? h(TeamBoardPanel, { t, agents, refreshKey: boardKey, onClose: () => setBoardOpen(false), onLogs: (ag) => { setBoardOpen(false); setLogAgent(ag) } }) : null,
1028
+ logAgent !== undefined ? h(ToolLogPanel, { t, agent: logAgent, onClose: () => setLogAgent(undefined) }) : null,
848
1029
  )
849
1030
  }
850
1031
 
@@ -853,10 +1034,13 @@
853
1034
  zh: {
854
1035
  title: '团队中枢', panel: '团队画布', workspaceAction: '在团队中枢打开', refresh: '刷新', newAgent: '新建 Agent',
855
1036
  boundWorkspace: '已绑定工作区', globalWorkspace: '全局视图(未绑定工作区)',
1037
+ basicTab: '基本设定', advTab: '高级设定',
856
1038
  editAgent: '编辑 Agent', icon: '图标', name: '名称', identity: '身份设定',
857
1039
  duties: '职责边界', newAgentHint: '将在此工作区创建卡片,再点「实例化」建会话', noWorkspace: '未检测到工作区',
858
1040
  denyTools: '禁用工具(硬约束)', writeFiles: '可写文件(提示约束)', readFiles: '可读文件(提示约束)',
859
1041
  cancel: '取消', save: '保存', sendMessage: '发消息 / 派任务',
1042
+ teamBoard: '团队看板', publicTasks: '公开团队任务', taskTitle: '任务标题', taskDetail: '任务详情',
1043
+ noTasks: '暂无公开任务', cycleStatus: '点击切换状态', toolLogs: '工具调用日志', allAgents: '全部 Agent', noLogs: '暂无工具调用日志',
860
1044
  refreshInstance: '刷新实例', refreshHint: '旧会话先按「保存进度提示词」收尾,等运行结束后自动归档,再在新会话发送「恢复进度提示词」。',
861
1045
  savePrompt: '保存进度提示词', restorePrompt: '恢复进度提示词',
862
1046
  defaultSavePrompt: '请总结当前进度与待办,写入你的记忆,方便在新会话中恢复。完成后回复“已保存”。',
@@ -867,10 +1051,13 @@
867
1051
  en: {
868
1052
  title: 'Team Hub', panel: 'Team canvas', workspaceAction: 'Open in Team Hub', refresh: 'Refresh', newAgent: 'New agent',
869
1053
  boundWorkspace: 'Bound workspace', globalWorkspace: 'Global view (no workspace)',
1054
+ basicTab: 'Basic', advTab: 'Advanced',
870
1055
  editAgent: 'Edit agent', icon: 'Icon', name: 'Name', identity: 'Identity',
871
1056
  duties: 'Responsibilities', newAgentHint: 'Card will be created here; click Instantiate to bind a session',
872
1057
  noWorkspace: 'No workspace detected', denyTools: 'Denied tools (hard)', writeFiles: 'Writable files (prompt)', readFiles: 'Readable files (prompt)',
873
1058
  cancel: 'Cancel', save: 'Save', sendMessage: 'Send message / task',
1059
+ teamBoard: 'Team board', publicTasks: 'Public team tasks', taskTitle: 'Task title', taskDetail: 'Task detail',
1060
+ noTasks: 'No public tasks', cycleStatus: 'Click to cycle status', toolLogs: 'Tool call logs', allAgents: 'All agents', noLogs: 'No tool call logs',
874
1061
  refreshInstance: 'Refresh instance', refreshHint: 'The old session wraps up with the save-progress prompt, then is archived; a new session receives the restore-progress prompt.',
875
1062
  savePrompt: 'Save-progress prompt', restorePrompt: 'Restore-progress prompt',
876
1063
  defaultSavePrompt: 'Summarize your current progress and TODOs into memory so a new session can resume. Reply "saved" when done.',
@@ -928,7 +1115,7 @@
928
1115
  })
929
1116
  }
930
1117
 
931
- return { apply, inject: ['slots', 'locale', 'layout', 'uiWorkspace', 'sessions', 'workspaces', 'contextMenus', 'remote', 'sidebarRight', 'sidebarRightTabs'] }
1118
+ return { apply, inject: ['slots', 'locale', 'layout', 'uiWorkspace', 'sessions', 'workspaces', 'contextMenus', 'remote', 'remote.session', 'sidebarRight', 'sidebarRightTabs'] }
932
1119
  },
933
1120
  })
934
1121
  })()
package/docs/DETAIL.md CHANGED
@@ -13,11 +13,13 @@
13
13
  - **团队画布**:无限延伸的画布,每个会话对应一张 Agent 卡片,可自由拖拽调整位置;拖拽空白处平移画布(普通滚轮也可平移),`Ctrl + 滚轮` 以鼠标位置为锚点缩放(40%~200%),按钮也可缩放。画布背景为透明方格,鼠标指针带深色描边在深浅背景下均清晰。主画布与右侧栏画布共享同一份看板数据与同一套交互。
14
14
  - **卡片管理**:新建 / 编辑 / 移除 Agent。新建的卡片默认「还未实例化」。
15
15
  - **实例化**:未实例化的卡片点「实例化」,在绑定工作区自动创建新会话、与卡片绑定,并把该 Agent 的身份 / 职责 / 权限设定作为初始化消息自动发进新会话。
16
+ - **刷新实例**:已实例化的卡片点「刷新实例」,可分别设置「保存进度提示词」与「恢复进度提示词」(也保存在 Agent 编辑弹窗的「高级设定」里)。流程:旧会话发送保存提示词→等其运行结束→自动归档→建新会话→发恢复提示词→卡片重绑。可在「协作动态」里看到每一步。
16
17
  - **移除与会话恢复**:移除 Agent 时自动归档其会话;之后在侧边栏恢复该会话,Agent 卡片自动回到画布。
17
18
  - **实时气泡**:卡片上方外侧有约两行高的聊天气泡,滚动展示该会话的最新内容——助手回复、用户消息、工具调用与结果、回合结束、审批请求、用户提问,各用不同样式,并展示运行状态。气泡跟随新内容向上滚动。
18
19
  - **协作连线**:卡片之间默认没有连线;只有当某个 Agent 通过沟通工具给另一个 Agent 发消息后,才会把两者用线连起来(取两卡最近边的中点),并用动画展示消息传递过程。
19
20
  - **发消息 / 派任务**:合并为一个入口,对目标 Agent 的会话发送消息。
20
21
  - **权限边界**:禁用工具由 `ctx.tools.guard()` 代码层硬拦截;身份、职责、可读写文件范围写进对应 Agent 上下文作为提示词软约束。
22
+ - **团队看板浮窗**:顶部标题栏「团队看板」按钮 toggle 一个浮窗,含两块:①公开团队任务——任何人可创建,状态点可在 open→doing→done 间循环,所有 Agent 都能通过工具查看;②工具调用日志——可查看全部 Agent 或某个 Agent 的本插件工具调用记录(工具名、调用方、参数、时间)。每张卡片上也有「工具日志」按钮直接看该 Agent 的记录。
21
23
 
22
24
  ## 给 Agent 的工具
23
25
 
@@ -27,6 +29,9 @@
27
29
  - `team_hub_status`:查会话状态。
28
30
  - `team_hub_reply`:读最近回复。
29
31
  - `team_hub_create_agent`:新建卡片。
32
+ - `team_hub_public_tasks`:列出所有公开团队任务。
33
+ - `team_hub_set_public_task`:创建或更新公开团队任务(所有 Agent 在团队看板可见)。
34
+ - 每次本插件工具调用都会自动记入工具日志,可在团队看板浮窗查看。
30
35
 
31
36
  ## 数据位置
32
37
 
package/index.js CHANGED
@@ -34,7 +34,7 @@ function boardPath() {
34
34
  }
35
35
 
36
36
  function defaultBoard() {
37
- return { version: 1, agents: [], removed: [], messages: [], tasks: [], updatedAt: 0 }
37
+ return { version: 1, agents: [], removed: [], messages: [], tasks: [], toolLogs: [], publicTasks: [], updatedAt: 0 }
38
38
  }
39
39
 
40
40
  function loadBoard(file) {
@@ -48,6 +48,8 @@ function loadBoard(file) {
48
48
  removed: Array.isArray(parsed.removed) ? parsed.removed : [],
49
49
  messages: Array.isArray(parsed.messages) ? parsed.messages : [],
50
50
  tasks: Array.isArray(parsed.tasks) ? parsed.tasks : [],
51
+ toolLogs: Array.isArray(parsed.toolLogs) ? parsed.toolLogs : [],
52
+ publicTasks: Array.isArray(parsed.publicTasks) ? parsed.publicTasks : [],
51
53
  updatedAt: Number(parsed.updatedAt) || 0,
52
54
  }
53
55
  } catch (error) {
@@ -91,6 +93,8 @@ function createStore() {
91
93
  name: String(input.name ?? existing?.name ?? 'Agent').slice(0, 80),
92
94
  identity: String(input.identity ?? existing?.identity ?? '').slice(0, 2000),
93
95
  duties: String(input.duties ?? existing?.duties ?? '').slice(0, 4000),
96
+ savePrompt: String(input.savePrompt ?? existing?.savePrompt ?? '').slice(0, 4000),
97
+ restorePrompt: String(input.restorePrompt ?? existing?.restorePrompt ?? '').slice(0, 4000),
94
98
  x: Number.isFinite(input.x) ? input.x : (existing?.x ?? 80),
95
99
  y: Number.isFinite(input.y) ? input.y : (existing?.y ?? 80),
96
100
  permissions: {
@@ -172,6 +176,54 @@ function createStore() {
172
176
  save()
173
177
  return true
174
178
  },
179
+ /** 本插件工具调用日志(每次 team_hub_* 工具执行记一条)。 */
180
+ logTool({ agentId, tool, detail }) {
181
+ board.toolLogs = Array.isArray(board.toolLogs) ? board.toolLogs : []
182
+ board.toolLogs.push({
183
+ id: randomUUID(),
184
+ agentId: agentId || null,
185
+ tool: String(tool || ''),
186
+ detail: String(detail ?? '').slice(0, 4000),
187
+ at: Date.now(),
188
+ })
189
+ if (board.toolLogs.length > 1000) board.toolLogs.splice(0, board.toolLogs.length - 1000)
190
+ save()
191
+ },
192
+ toolLogs(agentId) {
193
+ const list = Array.isArray(board.toolLogs) ? board.toolLogs : []
194
+ return agentId ? list.filter((l) => l.agentId === agentId) : list.slice()
195
+ },
196
+ /** 公开团队任务(对所有 Agent 可见)。 */
197
+ listPublicTasks() {
198
+ board.publicTasks = Array.isArray(board.publicTasks) ? board.publicTasks : []
199
+ return board.publicTasks.slice()
200
+ },
201
+ setPublicTask({ id, title, detail, status, ownerId }) {
202
+ board.publicTasks = Array.isArray(board.publicTasks) ? board.publicTasks : []
203
+ const tid = id || randomUUID()
204
+ const existing = board.publicTasks.find((t) => t.id === tid)
205
+ const task = {
206
+ id: tid,
207
+ title: String(title ?? existing?.title ?? '未命名任务').slice(0, 200),
208
+ detail: String(detail ?? existing?.detail ?? '').slice(0, 8000),
209
+ status: String(status ?? existing?.status ?? 'open'),
210
+ ownerId: ownerId ?? existing?.ownerId ?? null,
211
+ updatedAt: Date.now(),
212
+ createdAt: existing?.createdAt ?? Date.now(),
213
+ }
214
+ if (existing) Object.assign(existing, task)
215
+ else board.publicTasks.push(task)
216
+ save()
217
+ return task
218
+ },
219
+ removePublicTask(id) {
220
+ board.publicTasks = Array.isArray(board.publicTasks) ? board.publicTasks : []
221
+ const i = board.publicTasks.findIndex((t) => t.id === id)
222
+ if (i < 0) return false
223
+ board.publicTasks.splice(i, 1)
224
+ save()
225
+ return true
226
+ },
175
227
  }
176
228
  }
177
229
 
@@ -324,6 +376,18 @@ function mountApi(ctx, store) {
324
376
  if (!agent?.sessionId) return writeJson(res, { ok: true, value: '' })
325
377
  return writeJson(res, { ok: true, value: await sessionReply(ctx, agent.sessionId) })
326
378
  }
379
+ if (path === '/tool-logs' && method === 'GET') {
380
+ return writeJson(res, { ok: true, value: store.toolLogs(url.searchParams.get('agentId') || undefined) })
381
+ }
382
+ if (path === '/public-tasks' && method === 'GET') {
383
+ return writeJson(res, { ok: true, value: store.listPublicTasks() })
384
+ }
385
+ if (path === '/public-task' && method === 'POST') {
386
+ return writeJson(res, { ok: true, value: store.setPublicTask(await readBody(req)) })
387
+ }
388
+ if (path === '/public-task' && method === 'DELETE') {
389
+ return writeJson(res, { ok: true, value: store.removePublicTask(url.searchParams.get('id')) })
390
+ }
327
391
  return writeJson(res, { ok: false, error: { message: '未知接口' } }, 404)
328
392
  } catch (error) {
329
393
  writeJson(res, { ok: false, error: { message: error?.message || String(error) } }, 500)
@@ -435,13 +499,59 @@ function registerTools(ctx, store) {
435
499
  return `已创建 Agent ${agent.name},id=${agent.id}。可再绑定会话或在面板里操作。`
436
500
  },
437
501
  }),
502
+ defineTool({
503
+ name: 'team_hub_public_tasks',
504
+ description: '列出所有公开的团队任务(对所有 Agent 可见),含状态、负责人与详情。',
505
+ parameters: {},
506
+ output: jsonOut,
507
+ async execute() {
508
+ const tasks = store.listPublicTasks()
509
+ if (!tasks.length) return '目前没有公开团队任务。'
510
+ return tasks.map((t) => `[${t.status}] ${t.title}${t.ownerId ? ` (负责人 ${t.ownerId})` : ''}\n${t.detail}`).join('\n---\n')
511
+ },
512
+ }),
513
+ defineTool({
514
+ name: 'team_hub_set_public_task',
515
+ description: '创建或更新一条公开团队任务,让所有 Agent 都能在团队看板看到。提供 id 则更新,否则新建。',
516
+ parameters: {
517
+ id: { type: 'string', description: '任务 id(更新时提供,新建省略)' },
518
+ title: { type: 'string', required: true, description: '任务标题' },
519
+ detail: { type: 'string', description: '任务详情' },
520
+ status: { type: 'string', description: "状态:open / doing / done,默认 open" },
521
+ },
522
+ output: jsonOut,
523
+ async execute(args) {
524
+ const t = store.setPublicTask(args)
525
+ return `公开任务已保存:${t.title} (id=${t.id}, status=${t.status})。团队看板可见。`
526
+ },
527
+ }),
438
528
  ]
439
529
 
530
+ // 给每个工具包一层:执行后把调用记入本插件工具日志(含调用 Agent)。
531
+ const logged = tools.map((tool) => {
532
+ const orig = tool.execute
533
+ return {
534
+ ...tool,
535
+ async execute(args, exec) {
536
+ const sessionId = exec?.agent?.session?.id
537
+ const caller = sessionId && store.findBySession(sessionId)
538
+ try {
539
+ const result = await orig(args, exec)
540
+ store.logTool({ agentId: caller?.id || null, tool: tool.name, detail: JSON.stringify(args).slice(0, 2000) })
541
+ return result
542
+ } catch (error) {
543
+ store.logTool({ agentId: caller?.id || null, tool: tool.name, detail: `ERROR ${error?.message || error} | ${JSON.stringify(args).slice(0, 1500)}` })
544
+ throw error
545
+ }
546
+ },
547
+ }
548
+ })
549
+
440
550
  ctx.inject(['tools'], (svcCtx) => {
441
551
  const toolsService = svcCtx.get('tools')
442
552
  if (!toolsService?.register) return
443
553
  svcCtx.effect(() => {
444
- const disposers = tools.map((tool) => toolsService.register(tool))
554
+ const disposers = logged.map((tool) => toolsService.register(tool))
445
555
  return () => disposers.forEach((d) => d?.())
446
556
  })
447
557
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@restregular/dsh-team-hub",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "DSH 团队中枢:画布式 Agent 协作看板,支持跨会话派发任务、消息传递与权限边界管理。",
5
5
  "icon": "./icon.svg",
6
6
  "type": "module",