@suifei/dsh-ai-team 0.4.46 → 0.4.48

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,20 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.4.48 - 2026-11-12
4
+
5
+ **批 15:评审卡不再有孤儿窗口 + 清掉一段死代码**
6
+
7
+ - **卡片一创建就把 job 落盘**:此前 `startReview`(建卡 + 投递 N 条评审请求)整体完成后才 `writeJob`。进程若在建卡之后、写 job 之前崩溃,卡已存在但没有任何 job 记录引用它——收票循环只认 `state === 'judging'` 的 job,这张卡会永久 pending,被 PMO 反复唤醒评审官。现在 `startReview` 接受 `onCard(reviewTaskId)` 回调,在**投递请求之前**调用;调用方据此先写一条带 `reviewTaskId` 的 job。崩溃在中途时,下一轮仍能从 job 读到卡 id,超时终态会收口。
8
+ - **删除一段不可达代码**:`skillopt_optimize` 成功分支后紧跟了第二个 `return [...]`(第一次编辑残留),永远执行不到。
9
+ - 测试:`node --test` **246 通过 / 1 跳过**(新增 1 例:`onCard` 必须在任何评审请求投递之前被调用)。
10
+
11
+ ## 0.4.47 - 2026-11-12
12
+
13
+ **批 14:右侧提示不再丢失**
14
+
15
+ - `sayRight` 写入的 `rightNote` 只在 Thread 面板打开时渲染:交接文档路径、归档失败、批量取消失败汇总这类消息,在面板关闭时**等于丢失**。现在同一句同时推一条 toast(可见),右侧面板照旧。
16
+ - 测试:`node --test` **245 通过 / 1 跳过**(新增 1 例结构契约:`sayRight` 必须同时走 `pushToast`)。
17
+
3
18
  ## 0.4.46 - 2026-11-12
4
19
 
5
20
  **SDK 符合性核对(用 cordis_inspect 读运行时契约)+ 修复预设名解析**
package/client.js CHANGED
@@ -3063,7 +3063,12 @@ window.__ModuleLoader__.load({
3063
3063
  const followingOf = (card) => (Object.prototype.hasOwnProperty.call(follows, card.id) ? follows[card.id] : Boolean(card.following));
3064
3064
 
3065
3065
  function say(text) { setNote(text); }
3066
- function sayRight(text) { setRightNote(text); }
3066
+ function sayRight(text) {
3067
+ setRightNote(text);
3068
+ // 右侧提示只在 Thread 面板打开时可见:交接文档路径、归档失败、批量取消
3069
+ // 汇总这类消息在面板关闭时等于丢失。同一句话再走 toast,保证用户看得到。
3070
+ try { pushToast(String(text ?? '')); } catch { /* toast is best effort */ }
3071
+ }
3067
3072
  function pushToast(text) {
3068
3073
  if (!text) return;
3069
3074
  const id = Date.now() + ':' + Math.random().toString(36).slice(2, 6);
package/index.js CHANGED
@@ -1172,14 +1172,7 @@ export function apply(ctx, config = {}) {
1172
1172
  } catch (error) {
1173
1173
  diag.append({ ev: 'skillopt.reviewer.refresh.fail', projectId: runtime.id, message: error?.message ?? String(error) });
1174
1174
  }
1175
- const started = await startReview({
1176
- service: runtime.service,
1177
- projectRuntime: runtime,
1178
- job: { id: jobId, skillPath, skillName: skillPath.split(/[\\/]/).slice(-2, -1)[0] ?? skillPath, before: text0, candidate },
1179
- actor,
1180
- votes: config.skilloptJudgeVotes ?? 3,
1181
- });
1182
- writeJob(runtime.dir, {
1175
+ const jobRecord = {
1183
1176
  id: jobId,
1184
1177
  state: 'judging',
1185
1178
  project: runtime.dir,
@@ -1188,20 +1181,31 @@ export function apply(ctx, config = {}) {
1188
1181
  dimension: `dim${dimension.id} ` + dimension.name,
1189
1182
  before: text0,
1190
1183
  candidate,
1184
+ createdAt: Date.now(),
1185
+ };
1186
+ const started = await startReview({
1187
+ service: runtime.service,
1188
+ projectRuntime: runtime,
1189
+ job: jobRecord,
1190
+ actor,
1191
+ votes: config.skilloptJudgeVotes ?? 3,
1192
+ // 卡片一创建就把 job 落盘:进程若在投递评审请求期间崩溃,下一轮仍能
1193
+ // 从 job 里读到卡 id,超时终态会把它收口,而不是留下孤儿卡。
1194
+ onCard: async (reviewTaskId) => {
1195
+ writeJob(runtime.dir, { ...jobRecord, reviewTaskId, reviewOrders: [], cardCreatedAt: Date.now() });
1196
+ },
1197
+ });
1198
+ writeJob(runtime.dir, {
1199
+ ...jobRecord,
1191
1200
  reviewTaskId: started.reviewTaskId,
1192
1201
  reviewerId: started.reviewerId,
1193
1202
  reviewOrders: started.orders,
1194
- createdAt: Date.now(),
1195
1203
  });
1196
1204
  diag.append({ ev: 'skillopt.job.started', jobId, project: runtime.dir, skillPath, dimension: `dim${dimension.id}`, reviewTaskId: started.reviewTaskId, votes: started.orders.length });
1197
1205
  return [
1198
1206
  `[skillopt optimize] reviewing job=${jobId} target=dim${dimension.id} ${dimension.name} baseline=${rubric.total}`,
1199
1207
  ` reviewer=${REVIEWER_NAME} card=${started.reviewTaskId} votes=${started.orders.length} (blind A/B, odd majority)`,
1200
1208
  ' call skillopt_jobs to collect the verdict when the reviewer answers.',
1201
- ].join('\n'); return [
1202
- `[skillopt optimize] started job=${jobId} target=dim${dimension.id} ${dimension.name} baseline=${rubric.total}` ,
1203
- ' two-phase async: the PMO tick harvests generator -> judges -> keep/revert and appends results.tsv',
1204
- ' poll with skillopt_jobs',
1205
1209
  ].join('\n');
1206
1210
  },
1207
1211
  });
@@ -30,7 +30,7 @@ export async function ensureReviewer({ service, projectRuntime, actor }) {
30
30
  }
31
31
 
32
32
  /** 创建评审卡(task)并投递 N 条盲评请求给评审成员。 */
33
- export async function startReview({ service, projectRuntime, job, actor, votes }) {
33
+ export async function startReview({ service, projectRuntime, job, actor, votes, onCard = null }) {
34
34
  const reviewer = await ensureReviewer({ service, projectRuntime, actor });
35
35
  if (reviewer === undefined || reviewer === null) throw new Error('reviewer member unavailable');
36
36
  const count = reviewVoteCount(votes ?? 3);
@@ -50,6 +50,9 @@ export async function startReview({ service, projectRuntime, job, actor, votes }
50
50
  });
51
51
  const reviewTaskId = created?.task?.id ?? created?.id ?? null;
52
52
  if (typeof reviewTaskId !== 'string') throw new Error('review card creation failed');
53
+ // 卡片一创建就把 id 交回调用方落盘:进程若在「投递评审请求」期间崩溃,
54
+ // 调用方手里已经有卡 id,随后的超时终态能把它收口,而不是留下孤儿卡。
55
+ if (typeof onCard === 'function') await onCard(reviewTaskId);
53
56
  const orders = [];
54
57
  for (let index = 0; index < count; index++) {
55
58
  const order = Math.random() < 0.5 ? 'ab' : 'ba';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@suifei/dsh-ai-team",
3
- "version": "0.4.46",
3
+ "version": "0.4.48",
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",