@suifei/dsh-ai-team 0.4.121 → 0.4.122

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,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.4.122 - 2026-11-17
4
+
5
+ **DSH 标准会话里的 @ 也能点名成员**
6
+
7
+ - il2c 11-17 20:53 实机:在「【il2c】文渊阁·PMO」里用 DSH 输入框 @ 了 tony 老师,DSH 插入的是会话链接
8
+ `@[tony老师](dsh-session:…)`,0.4.121 只认「@名字」,账本没有 mentions,tony 老师没被直接叫醒(靠墨渊建卡转达);
9
+ 主对话里还露出一长串链接编码;
10
+ - `findMentions` 也认 DSH 会话链接:先按链接里的会话 id 对上成员,对不上再按链接里的名字;与普通 @ 混用按出现顺序;
11
+ - 主对话里把这种链接显示成「@名字」(`plainMentionLinks`);
12
+ - 测试:`test/rich-message.test.js` 用实机原文补两例;实机 E2E(rc.1 / rc.3):宿主会话发 `@[青岚](dsh-session:<青岚会话>)` →
13
+ 主对话显示「@青岚 …」、mentions 记下青岚、负责人与青岚各被唤醒一次。
14
+
3
15
  ## 0.4.121 - 2026-11-17
4
16
 
5
17
  **主对话支持图片、文件与 @成员;文渊阁对话框与 DSH 标准会话同一套**(#65)
@@ -27,6 +39,8 @@
27
39
  沿用角色、人格、运行配方、模型与推理档位、输出上限与技能;笔记、会话与任务不带(`copyMemberDraft`);
28
40
  - 测试:`test/client-composer-copy.test.js`(长高与封顶、拖动下限、复制草稿与命名、界面接线)。
29
41
 
42
+ ## 0.4.119 - 2026-11-17
43
+
30
44
  **在「文渊阁·PMO」会话里说话等于在文渊阁主对话里说话;宿主模型不再自己跑**
31
45
 
32
46
  - il2c 11-17 16:33:Human 在桌面版的「【il2c】文渊阁·PMO」会话里发「继续」。插件只认文渊阁主对话,账本没有 Human 消息,
@@ -65,17 +65,45 @@ export function findMentions(body, members) {
65
65
  if (typeof body !== 'string' || !body.includes('@')) return [];
66
66
  const roster = (Array.isArray(members) ? members : Object.values(members ?? {}))
67
67
  .filter((member) => member?.kind === 'agent' && member.status !== 'retired' && typeof member.name === 'string' && member.name.trim() !== '')
68
- .map((member) => ({ id: member.id, name: member.name.trim() }))
68
+ .map((member) => ({ id: member.id, name: member.name.trim(), sessionId: member.sessionId ?? null }))
69
69
  .sort((a, b) => b.name.length - a.name.length);
70
- const ids = [];
70
+ const hits = [];
71
+ // DSH 标准会话输入框的 @ 插入的是会话链接 `@[名字](dsh-session:<base64url 的 JSON 会话 id>)`
72
+ // (il2c 11-17 20:53 实机:「@[tony老师](dsh-session:…)」没叫醒 tony 老师)。先按会话 id 对上成员,对不上再按名字。
73
+ for (const match of body.matchAll(DSH_SESSION_MENTION)) {
74
+ const sessionId = decodeSessionRef(match[2]);
75
+ const byName = roster.find((member) => member.name === match[1].trim());
76
+ const bySession = sessionId === null ? undefined : roster.find((member) => member.sessionId === sessionId);
77
+ const hit = bySession ?? byName;
78
+ if (hit !== undefined) hits.push([match.index, hit.id]);
79
+ }
71
80
  for (let at = body.indexOf('@'); at !== -1; at = body.indexOf('@', at + 1)) {
72
81
  const rest = body.slice(at + 1);
73
82
  const hit = roster.find((member) => rest.startsWith(member.name));
74
- if (hit !== undefined && !ids.includes(hit.id)) ids.push(hit.id);
83
+ if (hit !== undefined) hits.push([at, hit.id]);
75
84
  }
85
+ const ids = [];
86
+ for (const [, id] of hits.sort((a, b) => a[0] - b[0])) if (!ids.includes(id)) ids.push(id);
76
87
  return ids;
77
88
  }
78
89
 
90
+ const DSH_SESSION_MENTION = /@\[([^\]\n]{1,64})\]\(dsh-session:([A-Za-z0-9_-]{4,400})\)/g;
91
+
92
+ /** `dsh-session:` 后面的引用 = base64url 编码的 JSON 字符串(会话 id);解不开返回 null。 */
93
+ function decodeSessionRef(ref) {
94
+ try {
95
+ const value = JSON.parse(Buffer.from(ref, 'base64url').toString('utf8'));
96
+ return typeof value === 'string' && value !== '' ? value : null;
97
+ } catch {
98
+ return null;
99
+ }
100
+ }
101
+
102
+ /** 主对话里把 DSH 会话链接显示成「@名字」(链接只对 DSH 自己的界面有意义,在文渊阁里是一串乱码)。 */
103
+ export function plainMentionLinks(body) {
104
+ return typeof body === 'string' ? body.replace(DSH_SESSION_MENTION, (_, name) => '@' + name.trim()) : body;
105
+ }
106
+
79
107
  /** 附件的一行文字说明(主对话摘要、提示词里给模型看清有几张图几个文件)。 */
80
108
  export function describeAttachments(attachments) {
81
109
  const list = Array.isArray(attachments) ? attachments : [];
@@ -26,7 +26,7 @@ import { MEMBER_STATUS, isBoardIdle } from '../ledger/fold.js';
26
26
 
27
27
  const MEMBER_STATUS_VALUES = new Set(Object.values(MEMBER_STATUS));
28
28
  import { checkPersonality, isQaMember, unfinishedTasksFor } from '../domain/member-profile.js';
29
- import { describeAttachments, findMentions, normalizeAttachments } from '../domain/rich-message.js';
29
+ import { describeAttachments, findMentions, normalizeAttachments, plainMentionLinks } from '../domain/rich-message.js';
30
30
 
31
31
  function mentionsHuman(body) {
32
32
  return typeof body === 'string'
@@ -678,7 +678,8 @@ export class TeamService {
678
678
  const attachments = normalizeAttachments(payload.attachments);
679
679
  const typed = typeof payload.body === 'string' ? payload.body.trim() : '';
680
680
  if (typed === '' && attachments.length === 0) fail(ERRORS.INVALID_ARGUMENT, 'stream message body is required');
681
- const body = typed === '' ? describeAttachments(attachments) : typed;
681
+ // DSH 标准会话的 @ 是会话链接:@ 先按原文识别(链接里带会话 id),主对话里显示成「@名字」。
682
+ const body = typed === '' ? describeAttachments(attachments) : plainMentionLinks(typed);
682
683
  const author = this.state.members?.[command.actor.memberId];
683
684
  if (author === undefined) fail(ERRORS.UNAUTHORIZED, 'actor must be a Team member');
684
685
  // seq 由账本事件定(fold 用 event.seq;payload 里的幻影计数会被忽略,
@@ -690,7 +691,7 @@ export class TeamService {
690
691
  ? [...new Set(payload.taskIds.filter((id) => typeof id === 'string' && Object.hasOwn(this.state.tasks ?? {}, id)))]
691
692
  : [];
692
693
  // @成员只对 Human 的话生效(负责人照常收到,被点名者另行唤醒,见 waker)。
693
- const mentions = command.actor.kind === 'human' ? findMentions(body, this.state.members) : [];
694
+ const mentions = command.actor.kind === 'human' ? findMentions(typed, this.state.members) : [];
694
695
  const entry = {
695
696
  kind: command.actor.kind === 'human' ? 'human_message' : 'milestone',
696
697
  authorId: author.id,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@suifei/dsh-ai-team",
3
- "version": "0.4.121",
3
+ "version": "0.4.122",
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",