Files
dsh_ai1net_server/交付物/唤醒-上报即唤醒与门控归属-20260930-图.html
admin c1b5e4d966 chore(工作区): 全量入库 + 补齐 .gitignore(以工作区为准)
- 变更规模:新增 514 / 修改 62 / 重命名 155 / 删除 4(归档重组与文档轮次)
- .gitignore 修:`归档/**/db-cwd归一-备份-*/` —— 原规则写绝对层级(归档/db-cwd归一-…),
  目录搬进 归档/配置与备份/ 后**静默失效**,43 MB 的 DB 备份又变成未跟踪
- .gitignore 补:嵌套 git 内部数据(归档/内嵌git-20261008/、归档/skills-git-旧线-20261007/dotgit-原样移出/)
- .gitignore 补:运行态与部署副本(.workbuddy/collab/、.workbuddy/tools/、.workbuddy/.load-pending、.workbuddy/tmp-*)
- .gitignore 补:备份件(*.bak-*)
- 未跟踪文件从 2190 降到 890(其余为 归档/ 归档件与 .workbuddy/memory/ 知识文件,按口径入库)
2026-10-10 23:13:22 +08:00

130 lines
9.3 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<title>唤醒 · 上报即唤醒与门控归属(2026-09-30)</title>
<style>
html,body{margin:0;padding:0;background:#1a1a1a;color:#e8e8e8;
font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif;}
.wrap{max-width:760px;margin:0 auto;padding:28px 20px 48px;}
h1{font-size:18px;font-weight:600;color:#CECBF6;margin:0 0 6px;}
.sub{font-size:12.5px;color:#8a8a8a;margin:0 0 26px;line-height:1.6;}
.fig{margin:0 0 34px;}
.cap{font-size:12px;color:#8a8a8a;margin:8px 0 0;line-height:1.6;}
</style>
</head>
<body>
<div class="wrap">
<h1>唤醒 · 「上报给主会话」到底是不是唤醒 + 门控该归谁</h1>
<p class="sub">结论:<b style="color:#9FE1CB">是</b> —— 但只对「此刻活着的主会话」成立;「上报」在本机制里不是写文件,是<b>投递</b>。<br>
主会话已退出 ⇒ 投不出去 ⇒ 只能由唤醒轮起新会话(≤30 分钟)。</p>
<div class="fig">
<svg width="100%" viewBox="0 0 680 300" role="img" xmlns="http://www.w3.org/2000/svg">
<text x="24" y="26" font-size="15" font-weight="600" fill="#CECBF6">① 「上报」拆成三段 —— 只有中间那段会唤醒</text>
<rect x="24" y="48" width="192" height="106" rx="8" fill="#26215C" stroke="#AFA9EC" stroke-width="0.6"/>
<text x="40" y="72" font-size="13" font-weight="600" fill="#CECBF6">① 内容 · 落盘</text>
<text x="40" y="94" font-size="11.5" fill="#AFA9EC">tasks.json / TO_MAIN.md</text>
<text x="40" y="112" font-size="11.5" fill="#AFA9EC">blocked.json / NEED-USER.md</text>
<text x="40" y="138" font-size="12" font-weight="600" fill="#F7C1C1">✗ 一个人都叫不起来</text>
<rect x="244" y="48" width="192" height="106" rx="8" fill="#085041" stroke="#9FE1CB" stroke-width="0.9"/>
<text x="260" y="72" font-size="13" font-weight="600" fill="#9FE1CB">② 投递 · 钩子→网关</text>
<text x="260" y="94" font-size="11.5" fill="#5DCAA5">POST /api/v1/sessions/</text>
<text x="260" y="112" font-size="11.5" fill="#5DCAA5">&lt;主会话&gt;/reply</text>
<text x="260" y="138" font-size="12" font-weight="600" fill="#9FE1CB">✓ 这就是唤醒</text>
<rect x="464" y="48" width="192" height="106" rx="8" fill="#412402" stroke="#FAC775" stroke-width="0.9"/>
<text x="480" y="72" font-size="13" font-weight="600" fill="#FAC775">③ 起会话 · 自动任务</text>
<text x="480" y="94" font-size="11.5" fill="#EFB775">唤醒轮 A / B</text>
<text x="480" y="112" font-size="11.5" fill="#EFB775">HOURLY ×2,错开 30 分</text>
<text x="480" y="138" font-size="12" font-weight="600" fill="#FAC775">✓ 主会话不在时的唯一通道</text>
<line x1="340" y1="156" x2="340" y2="190" stroke="#9FE1CB" stroke-width="1"/>
<polygon points="340,198 334,186 346,186" fill="#9FE1CB"/>
<rect x="178" y="200" width="324" height="48" rx="8" fill="#1F3B33" stroke="#5DCAA5" stroke-width="0.6"/>
<text x="340" y="220" text-anchor="middle" font-size="12.5" font-weight="600" fill="#9FE1CB">主会话被推进一轮 = 被唤醒</text>
<text x="340" y="238" text-anchor="middle" font-size="11" fill="#5DCAA5">前提:它此刻活着(reply 只认 live)</text>
<text x="24" y="278" font-size="11.5" fill="#F7C1C1">⚠ 只做 ① 不做 ② ⇒ 等于没上报;主会话已退出 ⇒ ② 发不出去(程序拒绝盲投,只喊人)</text>
</svg>
<p class="cap">判据:<code>collabd.py:1770</code> 先写 <code>TO_MAIN.md</code>,<code>:1777</code> 才 <code>_deliver_str()</code>;端点见 <code>:1058</code>。</p>
</div>
<div class="fig">
<svg width="100%" viewBox="0 0 680 322" role="img" xmlns="http://www.w3.org/2000/svg">
<text x="24" y="26" font-size="15" font-weight="600" fill="#CECBF6">② 门控矩阵 —— 你的规则 vs 现有实现</text>
<text x="24" y="46" font-size="11.5" fill="#8a8a8a">红=缺 / 绿=已有 / 黄=接口有但需接上</text>
<text x="30" y="72" font-size="11" font-weight="600" fill="#8a8a8a">条件</text>
<text x="356" y="72" font-size="11" font-weight="600" fill="#8a8a8a">该干什么</text>
<text x="590" y="72" font-size="11" font-weight="600" fill="#8a8a8a">现状</text>
<!-- row1 -->
<rect x="24" y="80" width="632" height="36" rx="6" fill="#1F3B33" stroke="#5DCAA5" stroke-width="0.5"/>
<text x="34" y="102" font-size="11.5" fill="#9FE1CB">有会话在执行</text>
<text x="356" y="102" font-size="11.5" fill="#9FE1CB">不打扰 · 延后(target-busy)</text>
<text x="590" y="102" font-size="11.5" font-weight="600" fill="#5DCAA5">✓ 已有</text>
<!-- row2 -->
<rect x="24" y="120" width="632" height="36" rx="6" fill="#501313" stroke="#F7C1C1" stroke-width="0.6"/>
<text x="34" y="142" font-size="11.5" fill="#F7C1C1">有队列任务 ∧ 无会话执行</text>
<text x="356" y="142" font-size="11.5" fill="#F7C1C1">派一棒去干</text>
<text x="590" y="142" font-size="11.5" font-weight="600" fill="#F7C1C1">✗ 缺</text>
<!-- row3 -->
<rect x="24" y="160" width="632" height="36" rx="6" fill="#1F3B33" stroke="#5DCAA5" stroke-width="0.5"/>
<text x="34" y="182" font-size="11.5" fill="#9FE1CB">无队列 ∧ 无会话 · 目标未完成</text>
<text x="356" y="182" font-size="11.5" fill="#9FE1CB">写差距进 supervise-inbox</text>
<text x="590" y="182" font-size="11.5" font-weight="600" fill="#EFB775">~ 部分</text>
<!-- row4 -->
<rect x="24" y="200" width="632" height="36" rx="6" fill="#412402" stroke="#FAC775" stroke-width="0.6"/>
<text x="34" y="222" font-size="11.5" fill="#FAC775">无队列 ∧ 无会话 · 有阻碍</text>
<text x="356" y="222" font-size="11.5" fill="#FAC775">写清"要用户做什么" + A/B 暂停</text>
<text x="590" y="222" font-size="11.5" font-weight="600" fill="#EFB775">~ 接口有</text>
<!-- row5 -->
<rect x="24" y="240" width="632" height="36" rx="6" fill="#501313" stroke="#F7C1C1" stroke-width="0.6"/>
<text x="34" y="262" font-size="11.5" fill="#F7C1C1">无队列 ∧ 无会话 · 目标已完成</text>
<text x="356" y="262" font-size="11.5" fill="#F7C1C1">A、B 两条排期一起置 PAUSED</text>
<text x="590" y="262" font-size="11.5" font-weight="600" fill="#F7C1C1">✗ 缺</text>
<!-- row6 -->
<rect x="24" y="280" width="632" height="36" rx="6" fill="#1F3B33" stroke="#5DCAA5" stroke-width="0.5"/>
<text x="34" y="302" font-size="11.5" fill="#9FE1CB">判不准是哪一种</text>
<text x="356" y="302" font-size="11.5" fill="#9FE1CB">按"未完成"处理,⛔ 不造活</text>
<text x="590" y="302" font-size="11.5" font-weight="600" fill="#5DCAA5">✓ 已有</text>
</svg>
<p class="cap">判据读法:队列 <code>tmp/supervise-inbox/tasks.json</code>;会话在执行 = 宿主库 <code>sessions.status='working'</code>;目标 = <code>goals_open()</code> 三路并集(<code>collabd.py:1403</code>)。</p>
</div>
<div class="fig">
<svg width="100%" viewBox="0 0 680 176" role="img" xmlns="http://www.w3.org/2000/svg">
<text x="24" y="26" font-size="15" font-weight="600" fill="#CECBF6">③ 谁把主会话叫起来 —— 三态分工</text>
<rect x="24" y="46" width="196" height="104" rx="8" fill="#085041" stroke="#9FE1CB" stroke-width="0.8"/>
<text x="122" y="70" text-anchor="middle" font-size="12.5" font-weight="600" fill="#9FE1CB">活着 · 空闲</text>
<text x="122" y="94" text-anchor="middle" font-size="11.5" fill="#5DCAA5">钩子投递(reply)</text>
<text x="122" y="114" text-anchor="middle" font-size="11.5" fill="#5DCAA5">延迟:秒级~分钟</text>
<text x="122" y="134" text-anchor="middle" font-size="11.5" font-weight="600" fill="#9FE1CB">✓ 能唤醒</text>
<rect x="242" y="46" width="196" height="104" rx="8" fill="#412402" stroke="#FAC775" stroke-width="0.8"/>
<text x="340" y="70" text-anchor="middle" font-size="12.5" font-weight="600" fill="#FAC775">活着 · 执行中</text>
<text x="340" y="94" text-anchor="middle" font-size="11.5" fill="#EFB775">延后,不打扰</text>
<text x="340" y="114" text-anchor="middle" font-size="11.5" fill="#EFB775">等它空闲再投</text>
<text x="340" y="134" text-anchor="middle" font-size="11.5" font-weight="600" fill="#FAC775">⏸ 有意不唤</text>
<rect x="460" y="46" width="196" height="104" rx="8" fill="#26215C" stroke="#AFA9EC" stroke-width="0.8"/>
<text x="558" y="70" text-anchor="middle" font-size="12.5" font-weight="600" fill="#CECBF6">已退出(worker 没了)</text>
<text x="558" y="94" text-anchor="middle" font-size="11.5" fill="#AFA9EC">网关随进程消失</text>
<text x="558" y="114" text-anchor="middle" font-size="11.5" fill="#AFA9EC">只剩唤醒轮起新会话</text>
<text x="558" y="134" text-anchor="middle" font-size="11.5" font-weight="600" fill="#CECBF6">≤30 分钟 · 花一个新会话</text>
</svg>
<p class="cap">⚠ 源码原话(<code>collabd.py:857-860</code>):「每次投递都会唤起主会话跑一轮 ⇒ 用户发消息撞 busy ⇒ 体感"卡"」⇒ 上报即唤醒<b>必须节流</b>(单条+握手 / 哈希去重 / 300 s 最小间隔 / 15 分钟真停滞门槛)。</p>
</div>
</div>
</body>
</html>