@suifei/dsh-ai-team 0.4.106 → 0.4.109

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 CHANGED
@@ -1,5 +1,36 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.4.109 - 2026-11-16
4
+
5
+ **dsh 来源不再采 SkillOpt 自己的子代理会话**
6
+
7
+ - handoff 作答、判官、生成子代理都在项目工作区里运行,`dsh` 来源按 `cwd` 认项目,会把它们当成团队会话:
8
+ 题面以 `user` 消息投递,被挖成「回答 SkillOpt 题目」的任务。il2c 实机:一个 handoff 夜间后 17:00 起 39 个
9
+ 新会话里 38 个是 `skillopt-*` 子代理,采集得到 33 个摘要;
10
+ - `harvest_dsh` 遇到 label 以 `skillopt-` 开头的 `subagent/descriptor` 即跳过该会话(团队派生的其它子代理照采)。
11
+ 实机:17:00 起只剩团队宿主会话 1 个,72 小时窗口 10 个(与作答子代理出现前一致);
12
+ - 测试:`test/skillopt-dsh-source.test.js` 新增 1 例(去掉修复即失败);
13
+
14
+ ## 0.4.108 - 2026-11-16
15
+
16
+ **handoff 作答题面原样转交**
17
+
18
+ - 0.4.105 在每道 handoff 题前加了一句「只输出这道题的答案原文:不要调用工具、不要解释、不要代码围栏」。
19
+ il2c night 7 实测(首个跑完的 dsh 来源夜间环,9 个挖出任务):回放题转去复述这句要求而不是完成任务,
20
+ 判分题在 JSON 前夹带说明(`judge-parse-failed`),留出集 0.000 → 0.000,反思环节也被这句话带偏;
21
+ - 引擎题面自带输出格式要求,现在原样转交,不加任何前言;
22
+
23
+ ## 0.4.107 - 2026-11-16
24
+
25
+ **主对话打开即在最新消息(#33)**
26
+
27
+ - 主对话的滚动容器此前没有任何滚动管理:每次打开、切项目、切标签重新挂载都停在顶部最早的消息,
28
+ 和主理人对话要先手动拖到底;
29
+ - 新增跟随算法 `createStreamFollower`:打开或切换后贴底,内容晚到/变高(卡片展开、字体加载)继续贴底;
30
+ 停在底部附近(≤48px)即跟随,新消息到达自动贴底;上翻阅读时数据刷新不改变滚动位置,只累计未读,
31
+ 底部浮出「↓ N 条新消息」按钮一键回到最新(零高度锚点 + 绝对定位,不进文档流);
32
+ - 测试:`test/client-stream-follow.test.js` 4 例(按 `<stream-follow>` 标记取出 client.js 中的同一份算法单测);
33
+
3
34
  ## 0.4.106 - 2026-11-16
4
35
 
5
36
  **handoff 自动作答实机两处缺陷**
package/client.js CHANGED
@@ -244,6 +244,7 @@ window.__ModuleLoader__.load({
244
244
  notifyInbox: '新的待办已进入收件箱',
245
245
  notifyWake: 'Agent 已唤醒',
246
246
  notifyStream: '主对话有新消息',
247
+ streamUnseen: '{count} 条新消息',
247
248
  notifyClose: '关闭通知',
248
249
  workspaceRequired: '请先设置项目工作目录。',
249
250
  workspaceSaved: '项目工作目录已保存。',
@@ -662,6 +663,7 @@ window.__ModuleLoader__.load({
662
663
  notifyInbox: 'New inbox item',
663
664
  notifyWake: 'Agent woken',
664
665
  notifyStream: 'New main-stream message',
666
+ streamUnseen: '{count} new messages',
665
667
  notifyClose: 'Dismiss notification',
666
668
  workspaceRequired: 'Set the Project workspace first.',
667
669
  workspaceSaved: 'Project workspace saved.',
@@ -1120,6 +1122,9 @@ window.__ModuleLoader__.load({
1120
1122
  .at-banner b { color: var(--dsw-alias-state-warn-label); font-weight: 500; }
1121
1123
  .at-stream { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 16px 18px 8px; scrollbar-width: thin; scrollbar-color: var(--dsw-alias-scrollbar-bg-l1) transparent; }
1122
1124
  .at-streaminner { width: 100%; max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
1125
+ .at-streamjumpanchor { position: relative; height: 0; }
1126
+ .at-streamjump { position: absolute; left: 50%; bottom: 8px; z-index: 5; transform: translateX(-50%); display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border: 1px solid var(--dsw-alias-border-l2); border-radius: 999px; background: var(--dsw-alias-bg-layer-1); color: var(--dsw-alias-label-secondary); font: inherit; font-size: 12px; line-height: 18px; white-space: nowrap; cursor: pointer; box-shadow: var(--dsw-elevation-panel, 0 4px 12px var(--dsw-alias-bg-mask-2)); }
1127
+ .at-streamjump:hover { color: var(--dsw-alias-label-primary); }
1123
1128
  .at-msg { display: flex; align-items: flex-start; gap: 8px; min-width: 0; }
1124
1129
  .at-avatar { flex: 0 0 auto; width: 24px; height: 24px; display: grid; place-items: center; border: 1px solid var(--dsw-alias-border-l2); border-radius: 999px; background: var(--dsw-alias-bg-layer-3); color: var(--dsw-alias-label-secondary); font-size: 10px; font-weight: 500; }
1125
1130
  .at-avatar-human { border-color: transparent; background: var(--dsw-alias-button-primary-fill); color: var(--dsw-alias-label-primary-inverted); }
@@ -1428,6 +1433,7 @@ window.__ModuleLoader__.load({
1428
1433
  if (name === 'dot') return h('svg', common, h('circle', { cx: 8, cy: 8, r: 3.5, fill: 'currentColor', stroke: 'none' }));
1429
1434
  if (name === 'layers') return h('svg', common, h('path', { d: 'M8 2.5 14 6 8 9.5 2 6Z' }), h('path', { d: 'M2 9.5 8 13l6-3.5' }));
1430
1435
  if (name === 'chevron') return h('svg', common, h('path', { d: 'M6 3.5 10.5 8 6 12.5' }));
1436
+ if (name === 'down') return h('svg', common, h('path', { d: 'M8 3v10M3.5 8.5 8 13l4.5-4.5' }));
1431
1437
  if (name === 'loop') return h('svg', { width: 18, height: 18, viewBox: '0 0 32 32', fill: 'none', 'aria-hidden': 'true', focusable: 'false' }, h('rect', { x: 2.5, y: 5.5, width: 21, height: 21, rx: 6.5, stroke: 'currentColor', strokeWidth: 2.6 }), h('circle', { cx: 23.5, cy: 16, r: 4.8, fill: 'var(--dsw-alias-state-business-primary)' }));
1432
1438
  return null;
1433
1439
  }
@@ -2622,6 +2628,44 @@ window.__ModuleLoader__.load({
2622
2628
  effortHint ? h('div', { className: 'at-fieldhint' }, effortHint) : null);
2623
2629
  }
2624
2630
 
2631
+ // <stream-follow>
2632
+ /**
2633
+ * 主对话的「跟随最新」判定(#33:打开主对话总停在最早的消息,要手动拖到底)。
2634
+ * 只读写传入元素的 scrollTop/scrollHeight/clientHeight,不碰 DOM 结构,便于单测。
2635
+ * - 打开主对话 / 切项目(reset)后贴底,内容晚到或变高时继续贴底;
2636
+ * - 用户停在底部附近(≤ threshold)即视为跟随,新消息到达自动贴底;
2637
+ * - 用户上翻后不动其位置(数据刷新不得改变用户滚动位置),只累计未读数,
2638
+ * 由「↓ N 条新消息」按钮(jump)回到底部。
2639
+ */
2640
+ function createStreamFollower({ threshold = 48 } = {}) {
2641
+ let pinned = true;
2642
+ let unseen = 0;
2643
+ let count = null;
2644
+ const distance = (el) => el.scrollHeight - el.scrollTop - el.clientHeight;
2645
+ const bottom = (el) => Math.max(0, el.scrollHeight - el.clientHeight);
2646
+ return {
2647
+ reset() { pinned = true; unseen = 0; count = null; },
2648
+ onScroll(el) {
2649
+ pinned = distance(el) <= threshold;
2650
+ if (pinned) unseen = 0;
2651
+ return unseen;
2652
+ },
2653
+ /** 消息数或内容变化后调用;返回 { scrollTo: number|null, unseen }。 */
2654
+ onContent(el, nextCount) {
2655
+ const grown = count === null ? 0 : Math.max(0, nextCount - count);
2656
+ count = nextCount;
2657
+ if (pinned) { unseen = 0; return { scrollTo: bottom(el), unseen }; }
2658
+ unseen += grown;
2659
+ return { scrollTo: null, unseen };
2660
+ },
2661
+ /** 布局变高(卡片展开、字体晚到)时调用:跟随中才贴底。 */
2662
+ onResize(el) { return pinned ? bottom(el) : null; },
2663
+ jump(el) { pinned = true; unseen = 0; return bottom(el); },
2664
+ get pinned() { return pinned; },
2665
+ };
2666
+ }
2667
+ // </stream-follow>
2668
+
2625
2669
  function Workbench({ t, ctx }) {
2626
2670
  const [phase, setPhase] = React.useState('loading');
2627
2671
  const [data, setData] = React.useState(null);
@@ -2776,6 +2820,42 @@ window.__ModuleLoader__.load({
2776
2820
  const replyRef = React.useRef(null);
2777
2821
  const triggerRef = React.useRef(null);
2778
2822
  const mobileRef = React.useRef(null);
2823
+ // #33 主对话跟随最新(算法见 createStreamFollower)。
2824
+ const streamRef = React.useRef(null);
2825
+ const followerRef = React.useRef(null);
2826
+ if (followerRef.current === null) followerRef.current = createStreamFollower();
2827
+ const [streamUnseen, setStreamUnseen] = React.useState(0);
2828
+ const streamItems = Array.isArray(data?.stream) ? data.stream : [];
2829
+ const streamTail = streamItems.length > 0 ? streamItems[streamItems.length - 1]?.id ?? '' : '';
2830
+ const streamShown = scope === 'project' && tab === 'main';
2831
+ React.useLayoutEffect(() => {
2832
+ followerRef.current.reset();
2833
+ setStreamUnseen(0);
2834
+ }, [projectId, scope, tab]);
2835
+ React.useLayoutEffect(() => {
2836
+ const el = streamRef.current;
2837
+ if (!streamShown || el === null || el === undefined) return;
2838
+ const step = followerRef.current.onContent(el, streamItems.length);
2839
+ if (step.scrollTo !== null) el.scrollTop = step.scrollTo;
2840
+ setStreamUnseen(step.unseen);
2841
+ }, [projectId, streamShown, streamItems.length, streamTail]);
2842
+ React.useLayoutEffect(() => {
2843
+ const el = streamRef.current;
2844
+ const inner = el?.firstElementChild;
2845
+ if (!streamShown || inner === null || inner === undefined || typeof ResizeObserver !== 'function') return undefined;
2846
+ const observer = new ResizeObserver(() => {
2847
+ const to = followerRef.current.onResize(el);
2848
+ if (to !== null) el.scrollTop = to;
2849
+ });
2850
+ observer.observe(inner);
2851
+ return () => observer.disconnect();
2852
+ }, [projectId, streamShown, data !== null]);
2853
+ const onStreamScroll = (event) => setStreamUnseen(followerRef.current.onScroll(event.currentTarget));
2854
+ const jumpToLatest = () => {
2855
+ const el = streamRef.current;
2856
+ if (el !== null && el !== undefined) el.scrollTop = followerRef.current.jump(el);
2857
+ setStreamUnseen(0);
2858
+ };
2779
2859
  // R-08 快捷键:composer 聚焦句柄 + `?` 帮助浮层开关。
2780
2860
  const composerInputRef = React.useRef(null);
2781
2861
  const [shortcutsOpen, setShortcutsOpen] = React.useState(false);
@@ -4209,7 +4289,7 @@ window.__ModuleLoader__.load({
4209
4289
  })
4210
4290
  : tab === 'situation'
4211
4291
  ? h(Situation, { t, quadrants, tasks, onItem: openQuadrantItem, onViewAll: viewQuadrant })
4212
- : h('div', { className: 'at-stream', role: 'tabpanel', id: 'at-panel-main', 'aria-labelledby': 'at-tab-main' },
4292
+ : h(React.Fragment, null, h('div', { className: 'at-stream', role: 'tabpanel', id: 'at-panel-main', 'aria-labelledby': 'at-tab-main', ref: streamRef, onScroll: onStreamScroll },
4213
4293
  h('div', { className: 'at-streaminner', role: 'log', 'aria-live': 'polite', 'aria-label': t('streamAria') },
4214
4294
  h(TeamPulse, { t, agents: data.agents, tasks, onOpen: openTask, onCancelAllPending: cancelAllPending, cancelBusy: cancelAllBusy }),
4215
4295
  data.stream.length
@@ -4233,7 +4313,13 @@ window.__ModuleLoader__.load({
4233
4313
  agents: data.agents,
4234
4314
  onSetWorkspace: openWorkspaceEditor,
4235
4315
  onExample: () => setDraft(t('emptyStreamExample')),
4236
- })));
4316
+ }))),
4317
+ // 零高度锚点 + 绝对定位按钮:不进文档流,不改变任何滚动位置。
4318
+ streamUnseen > 0
4319
+ ? h('div', { className: 'at-streamjumpanchor' },
4320
+ h('button', { className: 'at-streamjump', type: 'button', onClick: jumpToLatest },
4321
+ h(Ico, { name: 'down', size: 12 }), tf(t, 'streamUnseen', { count: streamUnseen })))
4322
+ : null);
4237
4323
 
4238
4324
  return h('div', { className: 'at-root', role: 'region', 'aria-label': t('panel') },
4239
4325
  h('div', { className: 'at-top' },
@@ -24,7 +24,6 @@ const STATE_FILE = 'answerer.json';
24
24
  const DEFAULT_CONCURRENCY = 3;
25
25
  const DEFAULT_TTL_MS = 15 * 60 * 1000;
26
26
  const DEFAULT_MAX_ATTEMPTS = 2;
27
- const ANSWER_RULE = '只输出这道题的答案原文:不要调用工具、不要解释、不要代码围栏。';
28
27
 
29
28
  /** 读 pending.json,归一成 [{id, prompt, answerFile}];没有或读不了返回 null。 */
30
29
  export function readPendingCalls(workspace) {
@@ -136,7 +135,10 @@ export async function stepHandoff({ workspace, deps }) {
136
135
  try {
137
136
  const child = await deps.startChild(`skillopt-reviewer-handoff-${call.id}`, {
138
137
  cwd: workspace,
139
- prompt: `${ANSWER_RULE}\n\n${call.prompt}`,
138
+ // 题面原样转交,不加任何前言:引擎的题面自带输出格式要求。il2c night 7 实测,
139
+ // 一句「只输出这道题的答案原文」让回放题转去复述这句要求、判分题在 JSON 前
140
+ // 夹带说明(judge-parse-failed),留出集 0.000 → 0.000。
141
+ prompt: call.prompt,
140
142
  });
141
143
  entry.childId = child.childId;
142
144
  entry.outputStart = child.outputStart ?? null;
@@ -55,6 +55,8 @@ DECODER = os.path.join(os.path.dirname(os.path.abspath(__file__)), "dsh_decode.m
55
55
  # Host bookkeeping (``time-context``, ``runtime-context``, ``skill-catalog``,
56
56
  # ``agent-instructions``, ``subagent-settled``, ``tool-jobs``, …) is not intent.
57
57
  _INTENT_SOURCES = {"", "user", "agent-message", "ai-team"}
58
+ # Label prefix of the AI-team plugin's SkillOpt subagents (subagent/descriptor).
59
+ _ENGINE_LABEL_PREFIX = "skillopt-"
58
60
  _RELAY_PREFIX = re.compile(r"^Agent \S+ sent a message:\s*")
59
61
  # AI-team activation prompts start with the member's identity block
60
62
  # (``memberIdentity`` in lib/domain/member-profile.js: "你是 <名>(<角色>)。"
@@ -178,6 +180,13 @@ def digest_dsh_session(path: str, *, node: str, project: str = "") -> Optional[S
178
180
  ended = stamp
179
181
  rtype = rec.get("type")
180
182
  data = rec.get("data") if isinstance(rec.get("data"), dict) else {}
183
+ if rtype == "subagent/descriptor" and str(data.get("label") or "").startswith(_ENGINE_LABEL_PREFIX):
184
+ # The engine's own one-shot children (handoff answers, judges,
185
+ # generators) run in the project directory too; their prompt is
186
+ # a SkillOpt task, not the team's work. Mining them teaches the
187
+ # loop to answer SkillOpt prompts (il2c: 38 of 39 sessions in one
188
+ # handoff night).
189
+ return None
181
190
  if rtype == "user/message":
182
191
  source = data.get("source") if isinstance(data.get("source"), dict) else {}
183
192
  kind = str(source.get("kind") or "")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@suifei/dsh-ai-team",
3
- "version": "0.4.106",
3
+ "version": "0.4.109",
4
4
  "type": "module",
5
5
  "description": "文渊阁 (Wenyuan Pavilion) — AI Team mode for DeepSeek Harness: concurrent projects, owned tasks, threads, inbox and an append-only team ledger",
6
6
  "license": "MIT",