@suifei/dsh-ai-team 0.4.31 → 0.4.32
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 +9 -0
- package/client.js +50 -11
- package/index.js +5 -1
- package/lib/host/people-view.js +7 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.4.32 - 2026-11-12
|
|
4
|
+
|
|
5
|
+
**中危批次 3:前端断流自愈、重复提交、同人绑定**
|
|
6
|
+
|
|
7
|
+
- **断流不再假装在重连**:`EventSource` 只在临时失败时自己重试;一旦被判死(`readyState === CLOSED`,例如服务端 4xx/5xx),浏览器不会再试,而界面还挂着「正在自动重连…」。现在由前端按 2s→30s 退避重建事件源,卸载时清掉定时器;收到帧后清掉断流提示并提示已恢复。
|
|
8
|
+
- **重复提交**:发送与回复共用同一个在途守卫——连按 Ctrl/⌘+Enter 或双击不会写出两条相同的消息/回复。
|
|
9
|
+
- **同人绑定真的会合并**:界面把「绑定到谁」的名字当 `personId` 提交,而聚合桶键是 `name:<名字>`,于是别名落到 `person:<名字>`,两行永远合不到一起、提示却是成功。现在服务端把别名的目标归一为 `person:<id>` / `name:<名字>`,聚合时裸名字也按 `name:` 处理,历史数据文件不回改也能生效。
|
|
10
|
+
- 测试:`node --test` **216/216**(新增 `client-contract` 结构契约 3 例、人员别名 2 例)。
|
|
11
|
+
|
|
3
12
|
## 0.4.31 - 2026-11-12
|
|
4
13
|
|
|
5
14
|
**中危批次 2:Host 会话落账、报告路径判别、PMO 决策遵从建议**
|
package/client.js
CHANGED
|
@@ -85,6 +85,7 @@ window.__ModuleLoader__.load({
|
|
|
85
85
|
fromDiscussion: '由讨论升格',
|
|
86
86
|
loading: '加载中…',
|
|
87
87
|
streamDown: '实时更新已中断,界面可能滞后;正在自动重连…',
|
|
88
|
+
streamUp: '实时更新已恢复。',
|
|
88
89
|
loadFailedTitle: '工作台不可达',
|
|
89
90
|
loadFailedBody: 'bootstrap 接口(/ai-team)无法访问;请确认插件已启用后重试。',
|
|
90
91
|
spike: 'AI Team',
|
|
@@ -497,6 +498,7 @@ window.__ModuleLoader__.load({
|
|
|
497
498
|
loadFailedTitle: 'Workbench unreachable',
|
|
498
499
|
loadFailedBody: 'The bootstrap endpoint (/ai-team) cannot be reached; confirm the plugin is enabled and retry.',
|
|
499
500
|
streamDown: 'Live updates stopped; the view may lag while the stream reconnects…',
|
|
501
|
+
streamUp: 'Live updates are back.',
|
|
500
502
|
spike: 'AI Team',
|
|
501
503
|
spikeTitle: 'Wenyuan Pavilion AI Team workbench: compile, collate, edit; direction, acceptance and ledger.',
|
|
502
504
|
navAria: 'Page navigation',
|
|
@@ -2637,6 +2639,8 @@ window.__ModuleLoader__.load({
|
|
|
2637
2639
|
const scopeRef = React.useRef(scope);
|
|
2638
2640
|
// SSE 断流一次性提示:只提示一次,恢复后重置。
|
|
2639
2641
|
const streamDownRef = React.useRef(false);
|
|
2642
|
+
// 发送在途守卫:双击按钮或连按 Ctrl+Enter 会重复提交同一条消息/回复。
|
|
2643
|
+
const sendingRef = React.useRef(false);
|
|
2640
2644
|
scopeRef.current = scope;
|
|
2641
2645
|
const [nBusy, setNBusy] = React.useState(false);
|
|
2642
2646
|
const [nError, setNError] = React.useState('');
|
|
@@ -2731,15 +2735,25 @@ window.__ModuleLoader__.load({
|
|
|
2731
2735
|
}
|
|
2732
2736
|
load();
|
|
2733
2737
|
// Event-driven refresh only; the Host sends one frame per command and
|
|
2734
|
-
// no heartbeat/timer.
|
|
2735
|
-
//
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2738
|
+
// no heartbeat/timer. A project is required — no magic fallback id here.
|
|
2739
|
+
// EventSource 只在**临时**失败时自动重连;一旦被判死(readyState
|
|
2740
|
+
// CLOSED,例如服务端返回 4xx/5xx),它不会再试,界面会永远停在
|
|
2741
|
+
// 「正在自动重连…」的假承诺上。这里自己接管重建,并在恢复后清掉提示。
|
|
2742
|
+
let source = null;
|
|
2743
|
+
let retryTimer = null;
|
|
2744
|
+
let retryDelay = 2000;
|
|
2745
|
+
const openStream = () => {
|
|
2746
|
+
if (!alive || typeof EventSource !== 'function' || !projectId) return;
|
|
2747
|
+
source = new EventSource('/ai-team/api/projects/' + encodeURIComponent(projectId) + '/events');
|
|
2740
2748
|
source.addEventListener('change', (raw) => {
|
|
2741
2749
|
if (!alive) return;
|
|
2742
|
-
|
|
2750
|
+
retryDelay = 2000;
|
|
2751
|
+
if (streamDownRef.current) {
|
|
2752
|
+
streamDownRef.current = false;
|
|
2753
|
+
// 恢复后清掉断流提示;否则「正在自动重连」会一直挂着。
|
|
2754
|
+
say('');
|
|
2755
|
+
pushToast(t('streamUp'));
|
|
2756
|
+
}
|
|
2743
2757
|
try {
|
|
2744
2758
|
const frame = JSON.parse(raw.data);
|
|
2745
2759
|
pushToast(notificationText(frame?.event));
|
|
@@ -2752,19 +2766,30 @@ window.__ModuleLoader__.load({
|
|
|
2752
2766
|
load();
|
|
2753
2767
|
});
|
|
2754
2768
|
source.addEventListener('error', () => {
|
|
2755
|
-
// EventSource 自己会重连,但**必须让用户看见**:旧实现只在首屏
|
|
2756
|
-
// (dataRef===null)时打印,面板已有数据时断流完全静默。
|
|
2757
2769
|
if (!alive) return;
|
|
2758
|
-
console.error(PKG + ': event stream unavailable
|
|
2770
|
+
console.error(PKG + ': event stream unavailable');
|
|
2759
2771
|
if (!streamDownRef.current) {
|
|
2760
2772
|
streamDownRef.current = true;
|
|
2761
2773
|
say(t('streamDown'));
|
|
2762
2774
|
}
|
|
2775
|
+
// CONNECTING 时浏览器自己会重试,保持原样;CLOSED 表示已放弃,
|
|
2776
|
+
// 必须由我们按退避重建,否则永远不会恢复。
|
|
2777
|
+
if (source !== null && source.readyState === 2) {
|
|
2778
|
+
try { source.close(); } catch { /* already closed */ }
|
|
2779
|
+
source = null;
|
|
2780
|
+
if (retryTimer === null) {
|
|
2781
|
+
const delay = retryDelay;
|
|
2782
|
+
retryDelay = Math.min(retryDelay * 2, 30000);
|
|
2783
|
+
retryTimer = setTimeout(() => { retryTimer = null; openStream(); }, delay);
|
|
2784
|
+
}
|
|
2785
|
+
}
|
|
2763
2786
|
});
|
|
2764
|
-
}
|
|
2787
|
+
};
|
|
2788
|
+
openStream();
|
|
2765
2789
|
return () => {
|
|
2766
2790
|
alive = false;
|
|
2767
2791
|
if (controller) controller.abort();
|
|
2792
|
+
if (retryTimer !== null) clearTimeout(retryTimer);
|
|
2768
2793
|
if (source) source.close();
|
|
2769
2794
|
};
|
|
2770
2795
|
}, [projectId]);
|
|
@@ -3657,6 +3682,15 @@ window.__ModuleLoader__.load({
|
|
|
3657
3682
|
async function send() {
|
|
3658
3683
|
const text = draft.trim();
|
|
3659
3684
|
if (!text) return;
|
|
3685
|
+
if (sendingRef.current) return;
|
|
3686
|
+
sendingRef.current = true;
|
|
3687
|
+
try {
|
|
3688
|
+
await sendOnce(text);
|
|
3689
|
+
} finally {
|
|
3690
|
+
sendingRef.current = false;
|
|
3691
|
+
}
|
|
3692
|
+
}
|
|
3693
|
+
async function sendOnce(text) {
|
|
3660
3694
|
// 目录门槛只拦"要动手"的任务:讨论与建卡无需工作目录(11-管理视角
|
|
3661
3695
|
// §3);激活/认领由 Host fail-closed,并把用户引导到目录设置。
|
|
3662
3696
|
if (!project?.workspacePath && mode === 'task') {
|
|
@@ -3699,6 +3733,9 @@ window.__ModuleLoader__.load({
|
|
|
3699
3733
|
async function sendReply() {
|
|
3700
3734
|
const text = reply.trim();
|
|
3701
3735
|
if (!text || !selectedTask) return;
|
|
3736
|
+
// 与发送共用同一个在途守卫:连按 Ctrl+Enter 会写出两条相同回复。
|
|
3737
|
+
if (sendingRef.current) return;
|
|
3738
|
+
sendingRef.current = true;
|
|
3702
3739
|
try {
|
|
3703
3740
|
const result = await runCommand('thread.post', {
|
|
3704
3741
|
taskId: selectedTask.id,
|
|
@@ -3712,6 +3749,8 @@ window.__ModuleLoader__.load({
|
|
|
3712
3749
|
await reloadData();
|
|
3713
3750
|
} catch (error) {
|
|
3714
3751
|
sayRight(tf(t, 'replyFailed', { message: error?.message ?? String(error) }));
|
|
3752
|
+
} finally {
|
|
3753
|
+
sendingRef.current = false;
|
|
3715
3754
|
}
|
|
3716
3755
|
}
|
|
3717
3756
|
function openConvert() {
|
package/index.js
CHANGED
|
@@ -1723,7 +1723,11 @@ export function apply(ctx, config = {}) {
|
|
|
1723
1723
|
return send(res, { error: { code: 'E_INVALID_ARGUMENT', message: 'name and personId are required' } }, 400);
|
|
1724
1724
|
}
|
|
1725
1725
|
const aliases = readAliases() ?? {};
|
|
1726
|
-
|
|
1726
|
+
// 归一到视图层的桶键:接受 `person:<id>`、`name:<名字>` 或裸名字。
|
|
1727
|
+
// 归一后才能与 aggregatePeople 的桶键对齐(裸名字曾让两行永不合并,
|
|
1728
|
+
// 而界面还提示「已绑定」)。
|
|
1729
|
+
const normalized = personId.startsWith('person:') || personId.startsWith('name:') ? personId : `name:${personId}`;
|
|
1730
|
+
aliases[memberName] = normalized;
|
|
1727
1731
|
writeFileSync(aliasesPath, JSON.stringify(aliases, null, 2) + '\n', 'utf8');
|
|
1728
1732
|
diag?.append({ ev: 'people.alias', name: memberName, personId });
|
|
1729
1733
|
return send(res, { ok: true, aliases });
|
package/lib/host/people-view.js
CHANGED
|
@@ -22,8 +22,13 @@ export function aggregatePeople(registryEntries, runtimes, options = {}) {
|
|
|
22
22
|
const aliases = options.aliases ?? null;
|
|
23
23
|
const people = new Map();
|
|
24
24
|
const bucketOf = (name) => {
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
// 别名的目标可以是 `person:<id>`(真正的 personId)、`name:<名字>`,或
|
|
26
|
+
// 历史数据里的裸名字。裸名字必须归一到 `name:<名字>`——否则「X → 白砚」
|
|
27
|
+
// 会让 X 落到 `person:白砚`,而白砚本人是 `name:白砚`,两行永远合不到一起。
|
|
28
|
+
const alias = aliases !== null && Object.prototype.hasOwnProperty.call(aliases, name) ? aliases[name] : null;
|
|
29
|
+
if (alias === null) return `name:${name}`;
|
|
30
|
+
if (alias.startsWith('person:') || alias.startsWith('name:')) return alias;
|
|
31
|
+
return `name:${alias}`;
|
|
27
32
|
};
|
|
28
33
|
for (const runtime of runtimes) {
|
|
29
34
|
const projectName = registryEntries.find((project) => project.id === runtime.id)?.name ?? runtime.id;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@suifei/dsh-ai-team",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.32",
|
|
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",
|