@suifei/dsh-ai-team 0.4.112 → 0.4.114

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,29 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.4.114 - 2026-11-16
4
+
5
+ **SkillOpt 判分不再因答复开头复述 JSON 格式而全部记零**
6
+
7
+ - il2c night 11(0.4.113,干净采集 1 会话 → 2 任务):所有判分都记成 `judge-parse-failed`,留出集 0.000 → 0.000,
8
+ 而判分子代理实际给出 0.6 / 0.85 / 0.78。答复先写一段说明、复述题面「return only JSON {"score": <0..1>, …}」,
9
+ 末尾才是真 JSON;`_extract_json` 的贪婪 `\{.*\}` 从复述处吃到末尾,解析失败;
10
+ - `_extract_json`:最宽跨度解析失败时,取最后一个能解析的同类 JSON 值(判分、挖任务、反思共用);
11
+ - `judge`:对象解析不出时兜底取最后一个 `"score": 数字`(night 11 有 1/11 份答复漏了收尾 `}`),原因记 `judge-score-only`;
12
+ - 测试:`test/skillopt-dsh-source.test.js` 新增 1 例(去掉修复即失败);
13
+
14
+ ## 0.4.113 - 2026-11-16
15
+
16
+ **dsh 来源也跳过「替引擎答题」的会话,不论谁派的**
17
+
18
+ - il2c night 8(0.4.109,作答子代理仍逐个唤醒 PMO):PMO 被唤醒后自己派了 23 个子代理去答 handoff 题
19
+ (「读文件 …\.skillopt-sleep-handoff\PROMPTS.md 中 id …」),label 是 `agent-N`,0.4.109 按 `skillopt-*` label
20
+ 的过滤挡不住;night 9 因此钉入 33 个会话,其中 23 个是这类引擎工作;
21
+ - `harvest_dsh`:会话的**第一条**意图指向 `.skillopt-sleep-handoff` 即整段跳过;团队会话里后来顺带提到不受影响。
22
+ 实机同一 72 小时窗口:33 → 10(与作答子代理出现前一致);
23
+ - 根因(PMO 被逐个唤醒)已由 0.4.111 的 caller 投递消除:night 9 触发后 PMO 宿主会话的「子智能体已完成」通知
24
+ 保持 382 条不变;
25
+ - 测试:`test/skillopt-dsh-source.test.js` 扩充 1 例(去掉修复即失败);
26
+
3
27
  ## 0.4.112 - 2026-11-16
4
28
 
5
29
  **任务记录同样打开即在最新回帖(#33 后续)**
@@ -292,15 +292,36 @@ class MockBackend(Backend):
292
292
  # ── Shared real-CLI backend (prompts + parsing + cache; subclasses do _call) ──
293
293
 
294
294
  def _extract_json(raw: str, kind: str):
295
- """Pull the first JSON object/array out of a possibly chatty CLI reply."""
296
- pat = r"\{.*\}" if kind == "object" else r"\[.*\]"
297
- m = re.search(pat, raw or "", re.DOTALL)
298
- if not m:
295
+ """Pull the JSON object/array out of a possibly chatty CLI reply.
296
+
297
+ The widest span (first opener .. last closer) is tried first, as before.
298
+ When it does not parse -- a reply that restates the requested format, e.g.
299
+ 'return only JSON {"score": <0..1>, ...}', before the real answer -- the
300
+ last value of the requested kind that does parse is taken: chatty replies
301
+ put the answer at the end (il2c night 11: every judge reply was scored
302
+ judge-parse-failed although each ended with a valid {"score": ...}).
303
+ """
304
+ text = raw or ""
305
+ opener, closer, want = ("{", "}", dict) if kind == "object" else ("[", "]", list)
306
+ first, last = text.find(opener), text.rfind(closer)
307
+ if first < 0 or last < first:
299
308
  return None
300
309
  try:
301
- return json.loads(m.group(0))
310
+ return json.loads(text[first:last + 1])
302
311
  except Exception:
303
- return None
312
+ pass
313
+ decoder = json.JSONDecoder()
314
+ found = None
315
+ pos = first
316
+ while pos >= 0:
317
+ try:
318
+ value, _ = decoder.raw_decode(text, pos)
319
+ except ValueError:
320
+ value = None
321
+ if isinstance(value, want):
322
+ found = value
323
+ pos = text.find(opener, pos + 1)
324
+ return found
304
325
 
305
326
 
306
327
  def _task_guardrail(pairs) -> str:
@@ -519,6 +540,12 @@ class CliBackend(Backend):
519
540
  return (1.0 if soft >= 0.8 else 0.0), soft, str(obj.get("reason", ""))[:200]
520
541
  except (ValueError, TypeError):
521
542
  pass
543
+ # A reply whose JSON lost its closing brace still carries the score
544
+ # (il2c night 11: 1 of 11 judge replies ended '..."' without '}').
545
+ scores = re.findall(r'"score"\s*:\s*([0-9]+(?:\.[0-9]+)?)', raw or "")
546
+ if scores:
547
+ soft = min(1.0, max(0.0, float(scores[-1])))
548
+ return (1.0 if soft >= 0.8 else 0.0), soft, "judge-score-only"
522
549
  return 0.0, 0.0, "judge-parse-failed"
523
550
 
524
551
  def reflect(
@@ -57,6 +57,10 @@ DECODER = os.path.join(os.path.dirname(os.path.abspath(__file__)), "dsh_decode.m
57
57
  _INTENT_SOURCES = {"", "user", "agent-message", "ai-team"}
58
58
  # Label prefix of the AI-team plugin's SkillOpt subagents (subagent/descriptor).
59
59
  _ENGINE_LABEL_PREFIX = "skillopt-"
60
+ # A session whose opening request works on the engine's handoff files is engine
61
+ # work too, whoever spawned it: il2c night 8 had the PMO, woken by every answer
62
+ # child, dispatch 23 subagents of its own ("read PROMPTS.md, id …").
63
+ _ENGINE_WORK = re.compile(r"\.skillopt-sleep-handoff")
60
64
  _RELAY_PREFIX = re.compile(r"^Agent \S+ sent a message:\s*")
61
65
  # AI-team activation prompts start with the member's identity block
62
66
  # (``memberIdentity`` in lib/domain/member-profile.js: "你是 <名>(<角色>)。"
@@ -199,6 +203,8 @@ def digest_dsh_session(path: str, *, node: str, project: str = "") -> Optional[S
199
203
  if not text or _HOST_NOISE.match(text) or _is_meta_prompt(text):
200
204
  continue
201
205
  n_user += 1
206
+ if n_user == 1 and _ENGINE_WORK.search(text):
207
+ return None
202
208
  user_prompts.append(text)
203
209
  feedback.extend(_detect_feedback(text))
204
210
  if kind == "ai-team":
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@suifei/dsh-ai-team",
3
- "version": "0.4.112",
3
+ "version": "0.4.114",
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",