docs: seal Tianshu research and scoped adoption baseline

This commit is contained in:
Agent Workbench Dev
2026-11-04 10:03:32 +08:00
parent 676fc55420
commit ce3afb2f0d
13 changed files with 2223 additions and 0 deletions
+2
View File
@@ -248,3 +248,5 @@ docs/working-memory-u-evidence/**/*.txt binary
docs/working-memory-u-offline.txt binary
docs/working-memory-u-git-index.txt binary
docs/working-memory-u-release-identity.json -text
docs/tianshu-research-evidence/** -text
+115
View File
@@ -0,0 +1,115 @@
# Tianshu 研究后的 Agent Workbench 采用计划
状态:研究结论转化的后续实施方案,**尚未实现**。本轮只交付源码审查与可复核证据,正式产品保持 1.24.8。总目标仍是:真实工程能自主读取、修改、验证、解释失败并按约定交付。
本方案接续 [1.25 任务要求与交付复核](PLAN-1.25.md),不另立重复的任务/计划/模型池体系。研究依据见 [源码审查](TIANSHU-HARNESS-SOURCE-REVIEW.md)。
## A. P0:用户要求逐项对应真实成果
**问题:**测试、Git 或模型的完成答复各自成立,也可能仍漏掉用户要的业务功能。
实施入口:现有 `src/shared/contracts/task-plans.mjs`、`src/core/tasks/task-plan-manager.mjs`、`src/core/context/delivery-progress.mjs`、交付报告及 `src/core/git-delivery.mjs`。
1. 在所属 Task 下记录要求 ID、用户原文来源、修订、范围、验收方式、证据类别和当前状态。模型提取只生成草案,含糊处保留 unknown;参考文件不能自动变成待修改文件。
2. 要求映射到真实文件/变更集/检查作业/浏览器断言/用户验收。核对 Task、要求修订、源 SHA、作业和工件原字节;非空 evidence 字符串不算通过。
3. 分开“模型声称完成”“工程检查通过”“业务要求已核验”“待用户体验”“按约定未执行”。阻塞不能自动成为已完成。
4. 普通任务沿用现有入口,任务、报告和交付处显示同一份要求事实。用户追加要求后只使相关旧证据失效,保留原失败与已确认事实。
验收必须覆盖:跨项目/旧 Task 证据拒绝;相同文字不同来源;要求修订;源码变化;伪造/过期/缺失证据;无需测试约定;仅研究;已有成果;中途追加;UI/手机的所属权限。保留当前检查/Git 硬门,不采用第三方“保存即交付”语义。
完成定义:固定案例能指出哪项已核对、依据是什么、哪项仍未知;相关契约/HTTP/并发/恢复检查、实际网页和 Electron 核心路径、独立发行与回顾通过后才交付。
## B. P0:单轮进展与失败分类,先 shadow
**问题:**当前跨 Run 无进展和读取进度保护已存在,但一个 Run 内仍可能反复读同一页、重复解释或与坏工具周旋。
实施入口:`src/server/runtime.mjs`、`src/core/context/working-set.mjs` 和现有 Task/Run 事件;新增小型纯判断模块,不把两千行外部管线整块并入 runtime。
记录外显事实:新的文件范围/SHA、已有片段覆盖增长、原始失败类别变化、修改、当前源码检查、要求证据增长、正在运行的作业,以及真实用户边界。不要保存或评分私有思维过程。
必须区别:
| 行为 | 初始判断 |
|---|---|
| 同文件不同偏移且取得新字节 | 有效进展 |
| 相同 SHA/范围重复获取,结果未变 | 候选重复 |
| 新失败揭示真实环境/权限/网络问题 | 新证据或阻塞,不直接催写 |
| 等待所属检查/审批/用户输入 | 等待状态 |
| 研究任务只读并形成可核对结论 | 有效工作 |
| 同一拒绝/相同无效输入反复提交 | 无效重复候选 |
| 增加提示/改写总结,没有新证据 | 不计工程成果增长 |
第一版只记 shadow 判断与依据,不改变停止、权限或预算。固定“正常探索、分页、研究、长测试、失败修复、权限拒绝、工具损坏、真实空转”样本人工核对后,再确定提示阈值。记录误报和漏报,不能只用总准确率掩盖合法只读被打断。
不照搬 Tianshu 的低分/高错误公式。若后续增加干预,先有单次提示和冷却;硬停止沿用明确预算/取消等确定性规则,每条必须可解释、可回顾。
## C. P1:工具 surface 与前缀稳定性实测
**问题:**不知道模型本轮究竟看到了哪些工具,也难解释重复动态信息为什么让长前缀失效。
实施入口:现有模型请求计划、`runtime.mjs` 的 availableTools/filter、协议适配和原模型尝试工件。
- 对最终实际发送的工具保存 name、schema hash、字节数、可见/未装配/禁用/缺少当前资源的原因和 generation。区别注册能力与本轮可执行能力。
- 对规范化请求记录稳定块哈希、最长公共前缀、首次变化区段/原因、用户消息实例身份,以及主路径/侧路归属。诊断元数据不反过来污染模型前缀。
- 分开上下文 tokens、输出预留、HTTP body bytes、图片体积和供应商缓存用量。供应商未报告的命中保留 unknown,不能估成已节省费用。
- 先比较 U 原始请求的离线构造;若优化增量附录或冻结,必须证明原目标、所有已读片段、当前失败、工具结果配对及权限仍在。
验收:连续两次“继续”是两个实例;旁路不改主线;工具撤销后执行被拒绝;新增浏览器 tab/Skills/MCP 时 surface 修订可解释;中途保存新配置不悄悄改旧请求;旧工件仍能核对。
阶段保持 16K/2048/1600 现有预算。优化收益必须报告实际输入/缓存/请求次数/延迟/成功率,不用单一命中率代替。
## D. P1:有预算和回读的提醒
**问题:**多个监督模块可能重复输出建议、消耗上下文,却不知道是否有效。
在现有错误/进展提醒入口增加建议队列:稳定 key、Task/Run、来源、类别、TTL、字节/token 额度、实际送达回执、期待的可观察变化、冷却和退出条件。总提示额度也要有界;高等级不能无限豁免上下文预算。
“已送达”和“已采纳”分开;真实作业/新增证据满足期待才核销。模型回复“明白”不计。遇到审批、环境受阻或用户改变任务,提示要过期或转状态,不能强行换目标。
验收:同类去重;无事实不建议不存在工具;已自然解决撤销;连续无效降频;关闭后不注入;取消后不回写;迟到回读不能核销新 Task。已有权限门不依赖建议队列,普通提醒故障不得开放权限。
## E. P2:经验草稿和可回滚采纳
**问题:**重复成功和失败经验需要复用,但不能让错误结论污染后续任务。
沿用项目记忆、Skills 和 evaluation:有来源的成功轨迹/失败归因生成 draft,保留输入 SHA、模型/版本、实际检查、适用范围、反例和失效条件。默认不激活;独立复核后才批准进入发现列表。
状态分开:observed、model_suggested、source_checked、engineering_verified、user_confirmed、rejected、expired;LLM 准入评分不直接写成工程已验证。草稿不能携带原密钥、把第三方输出当指令或自增权限。
改自身代码仍走既有候选工作区 → 固定评测 → 父审查 → 当前检查 → 独立发行 → 回滚。不能边运行正式版本边自改发行载荷,也不能因一次单模型评价就发布。
## F. P2:角色路由与多智能体质量回收
前置:单模型 Node 自主交付先通过,要求/进展机制已验证;已有 worker 的停止、预算和父审查不退化。
借鉴每工单模型绑定与派发目标盖章:角色、目标、scope、模型连接修订、上下文/工具代次、预算和输出证据在派发时固定。主控回收时对账真实修改/验证/要求,不按 worker 自填 passed 认定。
默认模型、新工单路由和已有 Task 身份分开;更换供应商/型号/凭据主体须按显式政策记录。429/Retry-After 与 unknown 消费沿用现有模型池记录,不能用自动切线隐藏失败。
验证先用已有连接的合成客户端场景,之后才冻结新的真实模型角色样本。增加 reviewer 还要报告额外消费、延迟和发现的真实问题,不能默认多代理一定更好。
## G. 真实交付与 Purge 独立实验
原 V 依冻结规则已在诊断 partial 结束,旧 T/R/P/O 不续跑;研究完成不授权重放旧样本。下一真实实验另冻当前版本、来源、目标、连接身份、预算和停止规则,不在看到结果后改门槛。
顺序保持:新有界预检/Node → Node 真闭环后 React/Python → 独立原版 Purge AB/BA。Tianshu 借鉴策略若要测收益,应另列实验因素,不能同时换模型、提示、预算和工具后把变化全归给 Purge。
报告至少包含:
| 维度 | 必须保留 |
|---|---|
| 任务结果 | 原要求覆盖、原测试与当前源码、实际差异/交付;未完成和失败类别 |
| 成本 | 主线/侧路/评审的请求数、输入/输出/缓存 token、unknown 与人工介入 |
| 时间 | 总墙钟、首响应、工具/检查/等待/重试时间 |
| 过程 | 实际工具及参数、已读范围、配置身份和停止原因 |
| 比较 | 同题同模型同预算、顺序平衡、样本量和排除规则;小样本只报观察 |
先排除确定的本地功能问题,再运行冻结样本。网络/环境受阻独立分类,不能归成模型推理失败,也不能删除失败后只展示成功。
## H. 里程碑回顾与交付纪律
每个切片都回顾:原问题是否复现;改动解决哪条证据;现有能力是否重复/退化;是否引入额外模型消费;未验证事项是什么;下一步是否具备前置条件。
代码相关验证通过后只做必要扩展;不为研究文档重跑整套产品安装。真正产品变更再执行该切片的构建、实际入口、独立载荷、保留状态升级、证据封存和本地 Git。计划中功能不能在 UI 宣称已完成,不自动推送远端。
当前实施优先级:**A 与 B → C → D → E/F(满足前置)**。真实模型与 Purge 走 G 的单独冻结样本;安装校验性能优化、更多语音/电脑操控仍保留原独立排期,避免并入一次无法判断收益的大改。
+303
View File
@@ -0,0 +1,303 @@
# Tianshu Harness 深度源码审查:对 Agent Workbench 的启发
结论:**有很大参考价值,最值得学习的是长任务的运行管理、证据状态和上下文工程。应将这些机制接到我们已有内核上,分项验证;没有依据整套替换工作台,也没有依据把提示策略当成模型权重能力提升。**
本报告根据固定公开源码独立分析,不改编作者另行许可的理念文档或实证报告。源码索引、原探针与采用计划见文末。产品仍为 1.24.8,本轮没有产品代码变更、服务升级或真实模型请求。
## 1. 研究对象与结论可信度
| 项目 | 本轮实际核对 |
|---|---|
| 仓库 | https://github.com/huiliyi37/Tianshu-harness.git |
| 固定提交 | `2d0b22e0b3554686e1e4131f8bdc568ef768e060`,非浮动 main |
| 提交说明 | `sync: from dev repo (v3.37.4 stable rev45)` |
| 包版本与运行环境 | 3.37.4;TypeScript / ESM;Node `^24.22.1 || ^26.12.1` [S01] |
| 可复核规模 | Git 跟踪 4599 文件;src 下 TS/TSX 3772 文件;按测试路径/命名排除后,1709 源码文件、338689 行;测试文件 2063;hooks 源码文件 75 |
| 已封存索引 | 63 个第三方关键文件及 14 个工作台对照文件,包含 SHA-256、字节、行数、固定提交链接 |
| 代码许可 | Apache-2.0 [S02];两份文档单独声明 CC BY-NC-ND 4.0,见第 13 节 |
| 公开边界 | 有 CLI/TUI、服务端、VS Code 扩展及多种工具代码;公开树**没有** `desktop/`、`src/pro/` |
| 实际执行 | 只运行了五个已读纯模块的隔离探针,六个输入;没有启动第三方应用、安装依赖或跑完整测试集 |
这里区分四种证据:**源码可见**、**调用链已核对**、**纯函数实际执行**、**作者公布的效果数据**。前两项证明机制存在及如何接线,纯探针证明指定输入的行为;它们都不能单独证明完整系统的工程交付率。
源码量按 `git ls-files` 和 UTF-8 `splitlines()` 统计,不等于复杂度、质量或测试通过数。README 的“2.3 万测试”属于作者指标,本轮没有运行这些测试。[S03]
## 2. 系统到底是什么
这是一个独立的编程代理运行时。CLI 命令 `tianshu` 与兼容命令 `rivet` 指向同一个入口;入口再进入主程序、装配模型客户端、会话、提示引擎、工具和 AgentLoop。[S01][S62][S63]
它把五类东西放在模型之外管理:任务目标、工具权限、上下文预算、行为进展、成果与证据。模型仍然决定下一步读什么、改什么、如何回答;运行时负责构造输入、执行受控工具、记账、取消和判断状态。
下面是依据实际模块整理的简化链路,并非所有分支的完整控制流图:
```mermaid
flowchart TD
U[用户输入或继续追问] --> T[任务边界与 TaskContract]
T --> P[preTurn 与感知]
P --> A[afterPerception:状态、约束、建议]
A --> C[PromptEngine:冻结块与增量附录]
C --> B[最终请求预览:上下文与图像体积预算]
B --> M[已选 Provider / 模型客户端]
M --> Q{是否请求工具}
Q -->|是| G[模式、权限、参数、审批与所有权检查]
G --> E[冻结参数、取消信号、实际执行]
E --> R[原始结果、工件、验证证据与结果预算]
R --> H[postTool 与后续回合状态]
H --> K[postTurn:收敛、提醒回读、进展]
K --> P
Q -->|准备结束| F[结束候选与未决证据状态]
F --> Z[答复 / 阻塞披露 / 有界纠偏]
Z --> S[postSession:知识准入、技能草稿等条件钩子]
G -.派发子任务.-> W[工单、固定模型策略、只读或写工工作区]
W --> V[主控复验与派发目标对账]
V --> R
```
五阶段接口定义在 `runtime-hooks.ts`,具体组装在 `create-runtime-hooks.ts`,由 `loop-factory.ts` 实际创建。感知、工具执行、回合编排分别在自己的模块中消费,不能只看类名就假定所有机制都启用。[S04][S05][S06][S07][S08][S09]
## 3. 任务契约与用户验收:目标独立保存,但语义判断仍有边界
`TaskContract` 保存 objective、scope、constraints、successCriteria 和状态。短追问被区分为聊天、继续原任务或新任务,“继续”可保留原目标,追加限制可以合入原契约。[S10]
这能解释它怎样应对长对话:不要求模型从几百轮历史中重新猜“最初要做什么”。不过分类依赖关键词、正则和长度等启发式;它不是完整的用户意图理解器,更不是权限来源。
更有价值的是 `EvidenceObligation`:按断言类型记录 open、attempted、satisfied、blocked、superseded,并用稳定 ID 与单调状态版本跟踪变化。模型说“完成了”、工具运行成功和要求被满足是不同状态。[S11][S12]
在 `loop.ts` 的 `captureAcceptance()` 中,用户可观察验收独立于测试结果:单元测试通过不会自动关闭 acceptance;需要显式回写每项“用户做什么、应该看到什么、实际证据是什么”。[S13]
**需要补强的边界:**`decideAcceptanceOutcome()`(`evidence-obligation.ts:545`)对已满足项的 evidence 只检查非空文字。这并不核验它来自哪个真实浏览器结果、Task、源码 SHA 或用户操作。RED 编辑门也按同一义务只强制拦一次,重复请求可通过;当前验证/验收缺口主要披露,不自动续轮。[S11][S12]
对我们:直接接续 [1.25 任务要求与交付复核](PLAN-1.25.md)。我们已有 Task/Run、计划修订、证据工件和 SHA 绑定,应增加“要求 → 当前成果 → 证据 → 仍未验证事项”的对应关系,而不是重新引入一套靠自由文本证明完成的状态。
## 4. 五阶段 hooks:值得学习的装配结构,不是 75 个硬门
`RuntimeHookPipeline.runPhase()` 按注册顺序串行执行,每个 hook 有超时、取消信号、运行状态和耗时。超时后封锁其 effects 通道,迟到的结果不能继续通过这个通道写共享状态。下一 hook 获得新的作用域。[S04]
具体意义有三点:监督逻辑可以分模块关闭;一次慢提醒有独立归因;取消后继续回写的竞态可以被限制。串行执行也意味着总延迟可能是多个 hook 延迟相加,不能只检查每个 hook 的上限。
但普通异常记录后会继续;`HookCleanupUnconfirmedError` 才特殊传播。effects 的封锁也不等于能强制终止任意已经发起的外部副作用。装配还受依赖和环境条件影响,并非 75 个文件全部常驻。[S04][S05]
对我们应分两条链:**权限、预算、SHA、归属和实际执行检查由确定性硬门负责;建议、提醒和行为观察由可失败的监督模块负责。** 两条链都要有 Task/Run 归属、总时限和明确的故障结果,不能把权限判断交给“提醒模型遵守”。
## 5. 收敛检测:思路可用,已实测发现一个反例
检测器综合近期工具目标的新颖度、工具分布、写入、错误、输出效率、振荡和重复文本,并按任务阶段、上下文窗口、真实进展信号调整。等待验证可以避免被误判成空转;没有任何工具的多轮行为另有硬停止条件。[S16][S17][S18]
这比“连续读 N 次就要求写代码”合理:研究任务可以长期只读;一次测试等待也不等于停滞。我们尤其需要区分同文件不同偏移的新页、相同 SHA 的重复页、真实新增失败证据与重复查询。
### 已执行的纯检测器探针
仅装载五个已读模块,使用现有 TypeScript 转译后调用 `evaluateConvergence`,模块及调用均设超时。未暴露 process、require、fetch、定时器或文件系统全局;这只用于受审查纯模块的执行限制,不宣称是可运行恶意代码的通用安全沙箱。
| 输入 | 返回原 score | level | abort |
|---|---:|---:|---|
| 上游 W4 测试的高错误率 fixture | 0.5164603 | L1 | false |
| 六次重复读取同一文件 | 0.082125 | L2 | false |
| 同上,额外传错误率 0.5 | 0.082125 | L2 | false |
| 六次相同失败读取,错误率 1 | 0 | L2 | false |
| 重复读取,但正在等待验证 | 0.082125 | L1 | false |
| 连续五轮无工具,错误率 0.8 | 0.0485567 | L3 | true |
`convergence-detector.ts:1087` 的实际公式为:
```ts
const effectiveScore = (input.recentToolErrorRatio ?? 0) >= 0.4
? Math.min(score, 0.41)
: score
```
附近注释称高错误率要把纠偏降到 L1;但分数越低纠偏越强,`1177–1182` 又以 `<=0.4` 触发 L2、较低阈值触发 L3。`min` 无法将低分抬出 L2 区间。上游 W4 fixture 本来分数较高,不能覆盖“低分且高错误”的组合,新增纯输入复现了反例。[S16][S21]
这是**指定检测器输入的逻辑反例**。完整运行时还有 veto、阶段及发射条件,本轮没有运行完整应用,不推断所有生产场景一定出现提醒洪流。也没有修改第三方源码或向作者发送 issue。
另一个避免误读的例子:`exploration-stall.ts` 写了 12/15 次阈值,但当前生产源码检索没有找到调用点,只能列为未发现接线的实现,不能算已生效能力。[S20]
对我们应先以 shadow 模式记录判断,人工与固定样本核对误报,再启用少量提示。不能把这个评分公式直接接成停止或强制编辑门。
## 6. AdvisoryBus:让提醒有预算、有效性和退出条件
它把多个提醒源合流,按 key 去重,带优先级、类别、TTL、观察期和通道。普通提醒每轮最多三条,另有类别额度;建议可以先观察,条件已自然满足时撤销,减少反复打扰。[S14]
提醒还可携带 expect:后续工具行为满足某个可观察条件就记 adopted,否则 ignored。连续忽略会升级、冷却或静音;低采纳提示不会永远占着每轮输入。[S14]
`runtime-advice-facts.ts` 只引用当前实际工具及新鲜的预算快照,没有事实就承认未知。这与我们此前“答复与当前工程脱节”的问题直接相关。[S15]
边界也要看到:高等级提醒存在预算豁免;出现过某工具不等于问题被解决;采纳相关性不等于提醒造成收益。我们的实现应给提示总字节和总 tokens 设上限,禁止建议绕过审批,并统计“送达后是否增加真实成果”,而不只统计模型是否服从。
## 7. 前缀缓存与压缩:最可迁移的工程能力之一
`PromptEngine` 将相对稳定的系统/工具块冻结,把变化信息放到尾部增量附录,减少每轮重建长前缀。用户消息按实例冻结,不能把相同文本的两次“继续”当同一条。旁路构造也不能污染主会话的冻结状态。[S29]
缓存和上下文容量是两个问题:缓存命中可以降低计费,但很大的缓存输入仍占上下文和上游处理资源。因此应同时看实际输入、输出、缓存命中、总 tokens、延迟和交付结果。
当前真正的容量入口是 `RequestContextController.prepare()` → `prepareContextRequest()`。先使用 provider 的请求预览,再量实际规范化请求;超限时尝试压缩,重新测量,仍不满足就拒绝。[S30][S31][S33]
历史图像整理和压缩采用事务思路:归档原历史、保护真实用户边界、写入前检查源历史是否变化、提交后更新冻结状态。不能只在内存删几条消息就声称解决容量问题。[S30]
**文档漂移:**旧 `architecture-overview.md` 仍写“只在 turn0 边界压缩”及旧压缩链。当前 `CompactBoundaryCoordinator.runCompaction()` 已只观察取消、返回 `compacted:false`,真实压缩转到请求预算流程;照旧文档理解当前代码会出错。[S58][S32]
对我们:U 已修复同 SHA 片段聚合和当前事实保留,不能为了缓存再次丢掉已读页、原检查或完整用户要求。先测每轮实际请求中哪些前缀字节变化及其原因,再做稳定性优化;保持现行 16K/2048/1600 预算,不用扩大窗口掩盖问题。
## 8. 工具 surface:注册、可见、可执行是三种状态
`describeToolSurface()` 分别记录 registered、visible、cold、unavailable、unregistered 等状态,以及定义的实际字符和字节。工具 preset 在会话装配期决定,新配置不直接改已运行会话的冻结前缀。[S34][S36]
不要照抄“最多 26 个工具”:当前 preset 注释列的是 minimal 36 注册/26 主控可见、frontend 37/27、orchestration 36/30,另有 MCP、桌面或强制额外工具。默认档和旧局部注释也不完全一致,应看实际过滤后的 schema。[S34][S35]
对我们最实用的是保存**本次实际送到模型的工具清单、schema 摘要、字节数与 generation**。模型说没有浏览器能力时,就能查清是未挂载、没有当前 tab、无权限、工具被过滤,还是模型没有使用。冻结描述不能冻结撤权:真正执行前仍须读取最新权限。
## 9. 工具流水线:审批的是具体输入,执行前还要复核
公开 `tool-pipeline.ts` 包含模式与 deny 检查、风险判断、运行预览、审批、所有权、实际执行及证据归账。[S27][S28]
值得迁移的是顺序:审批允许用户修改参数,修改后重查 deny 和风险;等待期间状态可能变化,实际派发前再次核对;然后冻结输入、组合父取消与工具超时信号,再执行 registry 工具。不能审批 A 参数后悄悄执行 B 参数。
超时提示明确:停止等待不代表底层执行一定结束;先核对原任务、日志和已发生的文件副作用,不直接重复发命令。我们已有所属作业、停止和 unknown 状态,这种语义应持续保留。
这条管线也相当复杂。适合提炼小接口与不变量,不适合将两千多行模块原样搬进我们 runtime。
## 10. 交付门:必须保留我们的完成定义
`DeliveryGateV2` 区分自有修改与外部修改,核对验证快照和输入指纹,评估测试范围、过期证据及 GREEN/YELLOW/RED。它回答的是当前修改对应的验证情况。[S22][S24][S25][S26]
但当前 `deliver-task.ts:403–405` 明确:**commit 用于保存成果,验证走 run_tests,审查走 review_changes,三者分开。** 验证缺口披露,不因此阻止所有权限定的提交。跨会话冲突、版本、索引锁等是另一些提交门。[S23]
由此有两个容易误判的点:没有自有修改时 gate 可以 GREEN,不等于用户目标已完成;README 顶部对比图的 alt 仍说“RED 拒绝交付”,与 README 正文 55/273 及当前实现矛盾。应以固定源码和当前正文语义为准。[S03][S22]
我们 `GitDelivery.plan()` 当前要求源码一致、日志完整、测试数量明确的通过记录,另核验已配置的浏览器和任务计划。这个契约应继续保持。未来若增加“保存工作快照”,应独立命名、状态和权限,不能把尚未验证的保存当成已交付。
## 11. 多智能体与模型线路:值得学固定身份和回收对账
`WorkOrder` 记录 objective、scope、文件、constraints、profile、authority 和 budget;只读工具与写工工具分层。写工可使用独立 worktree,也存在显式共享工作区模式,不能一概称所有写工都物理隔离。[S37][S43]
运行时实际接线已核对:
- `createWorkerRuntimeFactory()` 每个工单冻结一次模型策略;新设置仅影响新工单。[S38]
- worker 恢复要求完整历史、冻结快照与 prefix proof;当前 `maxRetries=0`,单次执行客户端禁止隐式重试。[S39]
- 回合数按工单与 runtime 较小值限制;墙钟超时、父取消和一次软收尾都有实际处理。`maxTokens` 的报告输出档位不能等同我们全任务累计 token 额度。[S37][S38][S39]
- `hands-session` 对真实工作区执行主控复验,0 项测试不能冒充通过;当前复验失败/阻塞即终态,`repairCount=0`,不是自动再修一轮。[S40][S41]
- coordinator 确实调用 `reconcileWithObjective()`,把派发侧 objective 盖回结果。空壳、验证工没验证及部分写工越界有不同处理;没有 transcript 的部分判断降为 risk,不能称完全证明目标达成。[S42][S43]
模型连接支持 provider 下多个 key 和各自模型清单;显式 `provider/keyId/model` 有用,但未指定 key 时撞名首个命中,**多个 key 并不自动证明实现了轮询号池**。[S44][S45]
`FallbackStreamClient` 支持部分错误后的备用线,但已有主前缀证明或 singleAttempt 时直接抛错,防止执行身份悄悄变更。这提醒我们区分默认模型选择、新工单角色路由和已运行任务身份。[S46]
我们已有模型池、协议、身份快照、用量与 Retry-After 记录,以及 worker 父工程审查。接下来应补可解释的选择与连续性,不应为借鉴它反而丢掉既有轮询、冷却和错误原文。
## 12. 记忆、Skills 与“自我迭代”的真实含义
统一记忆支持 observed/claimed/verified/rejected/expired、来源、有效期和替代链;召回时排除已失效条目。此处核心 `recallMemoryEntries()` 采用关键词命中、标签和 confidence 排序,并非可以不加限定地称作向量语义检索。[S49]
EssenceGate 将候选交给侧路模型,要求可迁移范围、失败素材淘汰原因及有效替代对象;LLM 失败或无效输出就不写。自动形成/整合默认关闭,有明确开关。[S47][S48][S50]
但获准记录会写成 `status:verified`,这表示知识准入判断,**不等于该条经验经过独立源码/测试验证**。我们应分开“模型建议”“已核对来源”“工程验证”“用户确认”,继续保留当前项目记忆的来源 SHA 和失效规则。
`skill-distill` 从成功且有验证的轨迹确定性整理技能草稿,放在 `_drafts`,经 review/approve 才进入发现流程。它不是训练模型权重,也不是自动重写自身系统。[S51][S52]
Skills 采用发现摘要与按需全文两层;MCP 有连接审批和工具清单指纹;插件入口会动态 import,具有实际代码执行能力。生态能力要有来源、版本、关闭/撤销、权限和 schema 变更记录,不能只做“一键安装”。[S53][S54][S55]
对我们,最合适的自我迭代路线是:**真实失败/成功轨迹 → 经验草稿 → 独立复核 → 候选模块 → 固定评测 → 审查采纳 → 独立发行 → 可回滚。** 现有 evaluation 与自身模块受控采纳应继续使用,多模型参与也不跳过这些环节。
## 13. 哪些宣传与边界不能直接采用
| 项目 | 本轮结论 |
|---|---|
| 99.3–99.6% 前缀命中、刊例价约 ¥880→¥20 | README/观测文档公布的 5 个 DeepSeek 长会话、2001 请求数据。未独立取得完整日志重算;刊例估算不等于实际账单或我们的收益。[S03][S59] |
| 5 任务 A/B 行为改善 | README 自述为单模型、小样本、LLM 审查;不足以证明通用交付率、Purge 收益或所有模型改进。[S03] |
| 75 hooks / 2.3 万测试 | 文件/作者统计不等于当前全部启用、全部硬门或本轮全测通过。 |
| 完整桌面、离线语音、手机与电脑操控 | 可以看到文档和桥接;公开树缺 desktop/src/pro,computer-use 执行实现移至闭源目录。不能从接口推出完整实现已审计。[S56][S57] |
| 超过模型本身能力的“破甲” | 本轮可观察的是提示、工具、状态和执行策略,未训练权重,未证明权重能力提高。应独立测交付收益。 |
| 全量源码照搬 | 会引入不同提交语义、默认策略、复杂度与许可义务,风险高于按模块独立实现。 |
许可范围也必须准确:代码总体 Apache-2.0;`docs/CVM运行时对Agent模型的实证影响.md` 与 `docs/reference/cvm-cognitive-runtime.md` 单独声明 CC BY-NC-ND 4.0。本研究仅登记其许可并提供原文链接,不复制、摘编或改编两份文档用于工作台材料。[S60][S61]
## 14. 和我们现有系统对照,避免重复造轮子
| 方向 | Agent Workbench 已有 | 本次值得补的增量 | 保留的约束 |
|---|---|---|---|
| 长任务目标 | Task/Run、任务契约、计划修订与要求哈希 | 1.25 每项业务要求和证据覆盖 | 原话/修订来源,推断不是授权 |
| 工作记忆 | U 同 SHA 真实片段聚合、原来源与当前失败/检查事实 | 需求覆盖和每轮证据变化摘要 | 不丢已读页,不造未读信息 |
| 防空转 | 跨 Run 无进展保护、读取进度暂停 | 单轮语义变化/错误分类,先 shadow | 合法只读、等待与阻塞保护 |
| 上下文 | 实际请求计划、预算、配对和工件哈希 | 工具 surface / 前缀漂移测量 | 16K/2048/1600 保持,主线不被侧路污染 |
| 模型池 | 连接选择、池路由、身份/用量/原错误 | 工单角色选择与身份连续性解释 | 不静默换型号、保留未知消费 |
| 工具执行 | 审批、实际作业、取消/恢复 | 统一监督生命周期与提示反馈 | 硬权限与软建议分开 |
| 项目交付 | 真实检查、日志/源码 SHA、浏览器/计划与范围 Git | 用户可观察要求的完成度 | 不用提交快照冒充交付 |
| 多智能体 | 隔离 worker、预算、父工程审查 | 派发目标和回收结果对账 | 子工不能独立发布或接管权限 |
| 经验积累 | 有来源项目记忆、Skills/MCP、受控候选评测 | 成功轨迹草稿与失效反馈 | 默认不自动生效,不把 LLM 评价当测试 |
| 桌面/手机/浏览器 | 已有各自发行与实际验收路径 | 工具当前可用性与错误可解释 | 不因第三方文档重复扩大本阶段范围 |
对照入口:`src/server/runtime.mjs`、`src/core/context/{working-set,request-plan,delivery-progress}.mjs`、`src/core/tasks/{task-plan-manager,worker-manager}.mjs`、`src/core/git-delivery.mjs`、`src/core/models/model-hub.mjs`、`src/core/memory/project-memory.mjs`、`src/core/evaluation/evaluation-manager.mjs`。具体字节身份在 source-index 的 productFiles 中。
## 15. 采用顺序与可复核材料
建议先做 **1.25 要求与证据复核 + 单轮进展 shadow**;再测工具 schema 与前缀漂移,接入有预算的提醒;其后做经验草稿和角色路由。每个切片先离线固定场景,再独立真实模型样本,不能以提示数量代替任务成功。
详细模块、完成门槛、回顾点与真实实验规则见 [采用计划](TIANSHU-ADOPTION-PLAN.md)。原有真实 Node 交付、React/Python 和 Purge 实验继续单列;V 已按其冻结规则结束,不续跑旧失败样本。
证据目录 [tianshu-research-evidence](tianshu-research-evidence/source-index.json) 包含源码身份、原始纯探针输出、原驱动惰性文本和封存清单。验证器 [verify-tianshu-research.mjs](../scripts/verify-tianshu-research.mjs) 默认只做本地文件校验;指定源码目录后核对固定提交、源码 SHA、行号和工作台对照文件,不启动服务或访问模型。
### 固定源码引用
[S01]: https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/package.json#L3
[S02]: https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/LICENSE#L1
[S03]: https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/README.md#L55
[S04]: https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/agent/runtime-hooks.ts#L10
[S05]: https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/agent/create-runtime-hooks.ts#L344
[S06]: https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/agent/loop-factory.ts#L650
[S07]: https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/agent/turn-perception.ts#L1
[S08]: https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/agent/tool-execution.ts#L218
[S09]: https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/agent/turn-orchestrator.ts#L1
[S10]: https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/context/task-contract.ts#L11
[S11]: https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/agent/evidence-obligation.ts#L36
[S12]: https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/agent/obligation-tracker.ts#L43
[S13]: https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/agent/loop.ts#L1268
[S14]: https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/agent/advisory-bus.ts#L400
[S15]: https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/agent/runtime-advice-facts.ts#L1
[S16]: https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/agent/convergence-detector.ts#L1087
[S17]: https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/agent/convergence-message.ts#L1
[S18]: https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/agent/score-history.ts#L1
[S19]: https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/tools/write-tool-helpers.ts#L1
[S20]: https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/agent/exploration-stall.ts#L1
[S21]: https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/agent/__tests__/convergence-detector.test.ts#L1
[S22]: https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/agent/delivery-gate-v2.ts#L1
[S23]: https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/agent/deliver-task.ts#L1
[S24]: https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/agent/evidence.ts#L1
[S25]: https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/agent/verification-snapshot.ts#L1
[S26]: https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/agent/verification-scope-current.ts#L1
[S27]: https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/agent/tool-pipeline.ts#L568
[S28]: https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/agent/approval-input-boundary.ts#L1
[S29]: https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/prompt/engine.ts#L97
[S30]: https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/agent/request-context-controller.ts#L28
[S31]: https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/agent/context-budget-preparation.ts#L17
[S32]: https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/agent/compact-boundary-coordinator.ts#L1
[S33]: https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/context/request-budget.ts#L1
[S34]: https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/tools/tool-preset.ts#L12
[S35]: https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/tools/default-registry.ts#L1
[S36]: https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/agent/tool-surface.ts#L6
[S37]: https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/agent/work-order.ts#L105
[S38]: https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/agent/worker-runtime.ts#L72
[S39]: https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/agent/worker-session.ts#L638
[S40]: https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/agent/hands-session.ts#L225
[S41]: https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/agent/worker-write-gate.ts#L69
[S42]: https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/agent/worker-objective-gate.ts#L102
[S43]: https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/agent/coordinator.ts#L2482
[S44]: https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/model/model-binding.ts#L57
[S45]: https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/config/provider-keys.ts#L106
[S46]: https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/api/fallback-client.ts#L76
[S47]: https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/memory/formation-policy.ts#L1
[S48]: https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/memory/essence-gate.ts#L245
[S49]: https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/memory/unified-memory.ts#L371
[S50]: https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/agent/hooks/essence-gate-hook.ts#L1
[S51]: https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/agent/skill-distill.ts#L201
[S52]: https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/agent/hooks/skill-distill-hook.ts#L1
[S53]: https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/skills/skill-loader.ts#L5
[S54]: https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/mcp/manager.ts#L57
[S55]: https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/plugins/plugin-loader.ts#L104
[S56]: https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/tools/computer-use/bridge.ts#L1
[S57]: https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/tools/computer-use/stub.ts#L1
[S58]: https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/docs/architecture-overview.md#L1
[S59]: https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/docs/reference/observability-harness.md#L1
[S60]: https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/docs/CVM运行时对Agent模型的实证影响.md#L3
[S61]: https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/docs/reference/cvm-cognitive-runtime.md#L12
[S62]: https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/cli/entry.ts#L1
[S63]: https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/main.ts#L1
+22
View File
@@ -0,0 +1,22 @@
# Tianshu 源码研究证据
固定源码:`2d0b22e0b3554686e1e4131f8bdc568ef768e060`。没有第三方安装、完整应用启动或模型请求。公开源码 clone 在本产品仓库外,未把第三方项目混入工作台。
- `source-index.json`:63 个关键源码/文档的 SHA、字节、行号、Git blob 与固定链接;14 个工作台对照输入;统计方法和公开目录边界。
- `pure-probe-original.json`:首次六场景输出原字节,保留合成输入、返回值及五个实际执行模块的 SHA。此文件没有真实用户会话或密钥。
- `pure-probe-driver.mjs.txt`:首次自有探针驱动的原字节,作为惰性文本保存;没有再执行或覆盖原输出。
- `manifest.json`:研究报告、采用计划、索引、驱动、原输出及两个自有验证脚本的文件清单。清单自身不计入自身哈希。
验证封存字节和报告引用(只运行我们自己的验证器):
```powershell
& 'D:\Ai-project\REA逆向\tools\node-v24.22.1-win-x64\node.exe' scripts/verify-tianshu-research.mjs
```
另加 `--source-root 'D:\Ai-project\REA逆向\research\Tianshu-harness-2d0b22e'` 会只读核对公开源码 SHA、行号、Git blob 与目录边界;`--index` 会另核对已暂存的研究文件原字节。验证器不执行被研究代码、不启动工作台或读取连接配置。
源码盘点可用 `scripts/inspect-tianshu-research.py --source <固定且干净的源码目录> --output <一个尚不存在的新文件>` 复算;采用 `x` 写模式,不覆盖原索引。它只读取 Git/文件,不 import 第三方模块。源码规模不能当测试通过数。
纯探针复核方式:阅读惰性驱动、核对五模块 SHA,确认使用可信 TypeScript 依赖后才在独立研究目录转为 `.mjs`。需 Node 的 `--experimental-vm-modules`;将输出改成新的不存在路径。原驱动使用项目相对路径,不能直接在任意 cwd 运行。此次封存验证没有再次运行它。VM 仅用于已审查纯模块的有限执行,不是通用恶意代码隔离方案。
两份局部 CC BY-NC-ND 文档未复制进证据,只登记路径/许可并链接原件。报告中的机制结论来源是公开代码的独立分析;README 的缓存与 A/B 数字明确为作者主张,未以本研究证明收益。
@@ -0,0 +1,54 @@
{
"schemaVersion": 1,
"sourceCommit": "2d0b22e0b3554686e1e4131f8bdc568ef768e060",
"productBaselineCommit": "676fc55420bf06e64201f2e88ef75548f79db7b1",
"modelRequests": 0,
"productCodeChanged": false,
"thirdPartyApplicationStarted": false,
"thirdPartyDependenciesInstalled": false,
"pureProbeExecutions": 1,
"pureProbeCases": 6,
"files": [
{
"path": "docs/TIANSHU-HARNESS-SOURCE-REVIEW.md",
"bytes": 31525,
"sha256": "3de2adf379e7633444c38e919b78e0e8d1fb4bd7517f570e068442a18a0f5943"
},
{
"path": "docs/TIANSHU-ADOPTION-PLAN.md",
"bytes": 9928,
"sha256": "3413758edb1d6f6474908b463a408eb8d33ff8f6063e9fd35ed185259cf39ca5"
},
{
"path": "docs/tianshu-research-evidence/source-index.json",
"bytes": 33715,
"sha256": "8b7bb886c76bc233e228590600a7955a017aeb4177d0876722935c54e2f02b9a"
},
{
"path": "docs/tianshu-research-evidence/pure-probe-driver.mjs.txt",
"bytes": 4392,
"sha256": "ad52913d352c95a39a9dba97c0fa49fe44e55f8144df1b3e99548899bc9ad7e7"
},
{
"path": "docs/tianshu-research-evidence/pure-probe-original.json",
"bytes": 16641,
"sha256": "864d0e687c4560f2fb755a52ea67e1f6ca65af5d7f889b77bd1fb784f8d99bbb"
},
{
"path": "docs/tianshu-research-evidence/README.md",
"bytes": 2324,
"sha256": "7c659932bf5bd3f80b169f7db2edff7c8f4e2317e07f2e471a751e82f88062b3"
},
{
"path": "scripts/inspect-tianshu-research.py",
"bytes": 8932,
"sha256": "c6d54147db72cc1e77d5c4a3714f58989fab7de5e103a6e049d0745e20973103"
},
{
"path": "scripts/verify-tianshu-research.mjs",
"bytes": 6765,
"sha256": "f547a308b31a96da8fdac9829b7d7844f4abc266f67d32a9ee3a82a3b2a5bbe8"
}
],
"bytes": 114222
}
@@ -0,0 +1,45 @@
import fs from 'node:fs';
import path from 'node:path';
import vm from 'node:vm';
import assert from 'node:assert/strict';
import {createHash} from 'node:crypto';
import ts from 'typescript';
const target=path.resolve('../research/Tianshu-harness-2d0b22e');
const output=path.resolve('.qa/tianshu-research/pure-probe.json');assert.equal(fs.existsSync(output),false);
const allow=new Set(['src/agent/convergence-detector.ts','src/agent/convergence-message.ts','src/agent/score-history.ts','src/agent/runtime-advice-facts.ts','src/tools/write-tool-helpers.ts']);
const context=vm.createContext({});const modules=new Map(),sources=[];
const sha=bytes=>createHash('sha256').update(bytes).digest('hex');
const load=name=>{
assert.ok(allow.has(name),'Unexpected executable dependency: '+name);if(modules.has(name))return modules.get(name);
const bytes=fs.readFileSync(path.join(target,name));sources.push({path:name,bytes:bytes.length,sha256:sha(bytes)});
const code=ts.transpileModule(bytes.toString('utf8'),{fileName:name,compilerOptions:{target:ts.ScriptTarget.ES2022,module:ts.ModuleKind.ESNext}}).outputText;
const mod=new vm.SourceTextModule(code,{context,identifier:name});modules.set(name,mod);return mod;
};
const main=load('src/agent/convergence-detector.ts');
await main.link((specifier,referencing)=>{
assert.ok(specifier.startsWith('.'),'No external modules may execute');
const resolved=path.posix.normalize(path.posix.join(path.posix.dirname(referencing.identifier),specifier)).replace(/\.js$/,'.ts');return load(resolved);
});
await main.evaluate({timeout:3000});
const run=(name,history,extra={})=>{
const input={turn:14,phaseClass:'explore',contextWindow:200000,recentToolHistory:history,evidenceState:{filesModified:new Set(),filesRead:new Set(),deliveryStatus:'unverified'},...extra};
context.auditEvaluate=main.namespace.evaluateConvergence;context.auditInput=input;
const result=vm.runInContext('auditEvaluate(auditInput)',context,{timeout:3000});
return {name,input:{...input,evidenceState:{filesModified:[],filesRead:[],deliveryStatus:'unverified'}},result:JSON.parse(JSON.stringify(result))};
};
const history=(entries)=>entries.map(entry=>({status:'success',...entry}));
const stuck=history(Array.from({length:6},()=>({tool:'read_file',target:'a.ts'})));
const highErrors=history([{tool:'read_file',status:'failed',target:'plan.md'},{tool:'glob',status:'failed',target:'*.plan.md'},{tool:'grep',status:'failed',target:'plan'},
{tool:'bash',target:'cat'},{tool:'read_file',status:'failed',target:'.rivet'},{tool:'glob',target:'*.ts'},
{tool:'grep',status:'failed',target:'pattern'},{tool:'read_file',target:'src/a.ts'},{tool:'read_file',target:'src/a.ts'},{tool:'read_file',target:'src/a.ts'}]);
const cases=[run('upstream-W4-high-error-fixture',highErrors,{recentToolErrorRatio:.5}),run('upstream-W4-repeated-read-baseline',stuck),
run('same-repeated-read-plus-high-error-ratio',stuck,{recentToolErrorRatio:.5}),
run('repeated-failing-read-actual-high-error-window',history(Array.from({length:6},()=>({tool:'read_file',target:'a.ts',status:'failed'}))),{recentToolErrorRatio:1}),
run('verification-waiting-protection',stuck,{recentToolErrorRatio:.5,progressBeacons:{todoCompletedDelta:0,activePlan:false,awaitingVerification:true}}),
run('no-tool-hard-stop-preserved',highErrors,{phaseClass:'execute',noToolTurnCount:5,recentToolErrorRatio:.8})];
const result={schemaVersion:1,sourceCommit:'2d0b22e0b3554686e1e4131f8bdc568ef768e060',sources,cases,
capabilities:'Five reviewed pure modules transpiled with existing TypeScript into a VM context. No external imports, process, require, timers, fetch or filesystem globals exposed. Only pure exported evaluateConvergence called with 3-second bounds.',
fullApplicationStarted:false,thirdPartyDependenciesInstalled:false,modelRequests:0,productChanged:false,
caveat:'This proves the behavior of the exact pure detector and inputs, not every full-runtime outcome; other vetoes, phases and emission gates may change the production effect.'};
fs.mkdirSync(path.dirname(output),{recursive:true});fs.writeFileSync(output,JSON.stringify(result,null,2)+'\n',{flag:'wx'});
console.log(JSON.stringify({cases:cases.map(row=>({name:row.name,score:row.result.score,level:row.result.level,shouldAbort:row.result.shouldAbort,shouldKick:row.result.shouldKick})),modelRequests:0,modules:sources.length}));
@@ -0,0 +1,535 @@
{
"schemaVersion": 1,
"sourceCommit": "2d0b22e0b3554686e1e4131f8bdc568ef768e060",
"sources": [
{
"path": "src/agent/convergence-detector.ts",
"bytes": 66210,
"sha256": "2c03f3e88c16ddc750233ff7ea1ef6a3a4f9c11f818d877a52ebc622d871cc54"
},
{
"path": "src/agent/convergence-message.ts",
"bytes": 13202,
"sha256": "4626fe6f9906b7023c6aed99780e1b33a7a74968960f37d077a01c35a385ec6f"
},
{
"path": "src/tools/write-tool-helpers.ts",
"bytes": 10587,
"sha256": "a2b31a5d0cddcaf9cc2fe162d5f031125bd1579f73bb721192ff7f1d768b0d63"
},
{
"path": "src/agent/score-history.ts",
"bytes": 4905,
"sha256": "9e433c3ca44e023459ae67856deba56e0efe96015ff9f9fa20327dd49b03197d"
},
{
"path": "src/agent/runtime-advice-facts.ts",
"bytes": 1559,
"sha256": "4a7e2416411d116e9f7d9dde603f53d3868093e4963d3e7c1e43431993d314b9"
}
],
"cases": [
{
"name": "upstream-W4-high-error-fixture",
"input": {
"turn": 14,
"phaseClass": "explore",
"contextWindow": 200000,
"recentToolHistory": [
{
"status": "failed",
"tool": "read_file",
"target": "plan.md"
},
{
"status": "failed",
"tool": "glob",
"target": "*.plan.md"
},
{
"status": "failed",
"tool": "grep",
"target": "plan"
},
{
"status": "success",
"tool": "bash",
"target": "cat"
},
{
"status": "failed",
"tool": "read_file",
"target": ".rivet"
},
{
"status": "success",
"tool": "glob",
"target": "*.ts"
},
{
"status": "failed",
"tool": "grep",
"target": "pattern"
},
{
"status": "success",
"tool": "read_file",
"target": "src/a.ts"
},
{
"status": "success",
"tool": "read_file",
"target": "src/a.ts"
},
{
"status": "success",
"tool": "read_file",
"target": "src/a.ts"
}
],
"evidenceState": {
"filesModified": [],
"filesRead": [],
"deliveryStatus": "unverified"
},
"recentToolErrorRatio": 0.5
},
"result": {
"score": 0.5164603132291642,
"level": 1,
"shouldAbort": false,
"injectedMessage": null,
"messageVariant": null,
"shouldKick": false,
"shouldForceSplit": false,
"signals": {
"editRatio": 0,
"targetNovelty": 0.6,
"toolEntropy": 0.7896900821428475,
"errorPenalty": 0.6666666666666667,
"tokenEfficiency": 0,
"oscillationPenalty": 1,
"textRepetitionPenalty": 1
},
"reasoningActive": false,
"scoreQuality": "ok",
"effectiveWeights": {
"editRatio": 0.05,
"targetNovelty": 0.3125,
"toolEntropy": 0.2625,
"errorPenalty": 0.1825,
"tokenEfficiency": 0.1925,
"oscillationPenalty": 0,
"textRepetitionPenalty": 0
}
}
},
{
"name": "upstream-W4-repeated-read-baseline",
"input": {
"turn": 14,
"phaseClass": "explore",
"contextWindow": 200000,
"recentToolHistory": [
{
"status": "success",
"tool": "read_file",
"target": "a.ts"
},
{
"status": "success",
"tool": "read_file",
"target": "a.ts"
},
{
"status": "success",
"tool": "read_file",
"target": "a.ts"
},
{
"status": "success",
"tool": "read_file",
"target": "a.ts"
},
{
"status": "success",
"tool": "read_file",
"target": "a.ts"
},
{
"status": "success",
"tool": "read_file",
"target": "a.ts"
}
],
"evidenceState": {
"filesModified": [],
"filesRead": [],
"deliveryStatus": "unverified"
}
},
"result": {
"score": 0.082125,
"level": 2,
"shouldAbort": false,
"injectedMessage": "**天璇-感知:当前任务可能进入低效循环。换个角度看问题。**\n- 工具使用模式高度重复,当前探索路径可能已穷尽\n- 目标文件重复率过高,建议扩大搜索范围或切换策略\n- 已连续读取多个文件但未做任何编辑/测试/提交 — 信息已足够,请输出结论或采取行动\n\n请选择以下行动之一:\n- 对当前最可能的方案进行编辑或测试\n- 重新阅读用户原始请求,确认方向\n- 缩小范围:只解决一个子问题\n- 天璇胶囊(docs/seed-capsule-tianxuan.md)有换视角方法论可供 recall",
"messageVariant": "generic",
"shouldKick": true,
"shouldForceSplit": false,
"signals": {
"editRatio": 0,
"targetNovelty": 0,
"toolEntropy": 0,
"errorPenalty": 1,
"tokenEfficiency": 0,
"oscillationPenalty": 1,
"textRepetitionPenalty": 1
},
"reasoningActive": false,
"scoreQuality": "ok",
"effectiveWeights": {
"editRatio": 0.05,
"targetNovelty": 0.3125,
"toolEntropy": 0.2625,
"errorPenalty": 0.1825,
"tokenEfficiency": 0.1925,
"oscillationPenalty": 0,
"textRepetitionPenalty": 0
}
}
},
{
"name": "same-repeated-read-plus-high-error-ratio",
"input": {
"turn": 14,
"phaseClass": "explore",
"contextWindow": 200000,
"recentToolHistory": [
{
"status": "success",
"tool": "read_file",
"target": "a.ts"
},
{
"status": "success",
"tool": "read_file",
"target": "a.ts"
},
{
"status": "success",
"tool": "read_file",
"target": "a.ts"
},
{
"status": "success",
"tool": "read_file",
"target": "a.ts"
},
{
"status": "success",
"tool": "read_file",
"target": "a.ts"
},
{
"status": "success",
"tool": "read_file",
"target": "a.ts"
}
],
"evidenceState": {
"filesModified": [],
"filesRead": [],
"deliveryStatus": "unverified"
},
"recentToolErrorRatio": 0.5
},
"result": {
"score": 0.082125,
"level": 2,
"shouldAbort": false,
"injectedMessage": "**天璇-感知:当前任务可能进入低效循环。换个角度看问题。**\n- 工具使用模式高度重复,当前探索路径可能已穷尽\n- 目标文件重复率过高,建议扩大搜索范围或切换策略\n- 已连续读取多个文件但未做任何编辑/测试/提交 — 信息已足够,请输出结论或采取行动\n\n请选择以下行动之一:\n- 对当前最可能的方案进行编辑或测试\n- 重新阅读用户原始请求,确认方向\n- 缩小范围:只解决一个子问题\n- 天璇胶囊(docs/seed-capsule-tianxuan.md)有换视角方法论可供 recall",
"messageVariant": "generic",
"shouldKick": true,
"shouldForceSplit": false,
"signals": {
"editRatio": 0,
"targetNovelty": 0,
"toolEntropy": 0,
"errorPenalty": 1,
"tokenEfficiency": 0,
"oscillationPenalty": 1,
"textRepetitionPenalty": 1
},
"reasoningActive": false,
"scoreQuality": "ok",
"effectiveWeights": {
"editRatio": 0.05,
"targetNovelty": 0.3125,
"toolEntropy": 0.2625,
"errorPenalty": 0.1825,
"tokenEfficiency": 0.1925,
"oscillationPenalty": 0,
"textRepetitionPenalty": 0
}
}
},
{
"name": "repeated-failing-read-actual-high-error-window",
"input": {
"turn": 14,
"phaseClass": "explore",
"contextWindow": 200000,
"recentToolHistory": [
{
"status": "failed",
"tool": "read_file",
"target": "a.ts"
},
{
"status": "failed",
"tool": "read_file",
"target": "a.ts"
},
{
"status": "failed",
"tool": "read_file",
"target": "a.ts"
},
{
"status": "failed",
"tool": "read_file",
"target": "a.ts"
},
{
"status": "failed",
"tool": "read_file",
"target": "a.ts"
},
{
"status": "failed",
"tool": "read_file",
"target": "a.ts"
}
],
"evidenceState": {
"filesModified": [],
"filesRead": [],
"deliveryStatus": "unverified"
},
"recentToolErrorRatio": 1
},
"result": {
"score": 0,
"level": 2,
"shouldAbort": false,
"injectedMessage": "**天璇-感知:当前任务可能进入低效循环。换个角度看问题。**\n- 工具使用模式高度重复,当前探索路径可能已穷尽\n- 目标文件重复率过高,建议扩大搜索范围或切换策略\n- 失败率 100% 偏高,当前方向可能不可行\n- 已连续读取多个文件但未做任何编辑/测试/提交 — 信息已足够,请输出结论或采取行动\n\n请选择以下行动之一:\n- 对当前最可能的方案进行编辑或测试\n- 重新阅读用户原始请求,确认方向\n- 缩小范围:只解决一个子问题\n- 天璇胶囊(docs/seed-capsule-tianxuan.md)有换视角方法论可供 recall",
"messageVariant": "generic",
"shouldKick": true,
"shouldForceSplit": false,
"signals": {
"editRatio": 0,
"targetNovelty": 0,
"toolEntropy": 0,
"errorPenalty": 0,
"tokenEfficiency": 0,
"oscillationPenalty": 1,
"textRepetitionPenalty": 1
},
"reasoningActive": false,
"scoreQuality": "ok",
"effectiveWeights": {
"editRatio": 0.05,
"targetNovelty": 0.3125,
"toolEntropy": 0.2625,
"errorPenalty": 0.1825,
"tokenEfficiency": 0.1925,
"oscillationPenalty": 0,
"textRepetitionPenalty": 0
}
}
},
{
"name": "verification-waiting-protection",
"input": {
"turn": 14,
"phaseClass": "explore",
"contextWindow": 200000,
"recentToolHistory": [
{
"status": "success",
"tool": "read_file",
"target": "a.ts"
},
{
"status": "success",
"tool": "read_file",
"target": "a.ts"
},
{
"status": "success",
"tool": "read_file",
"target": "a.ts"
},
{
"status": "success",
"tool": "read_file",
"target": "a.ts"
},
{
"status": "success",
"tool": "read_file",
"target": "a.ts"
},
{
"status": "success",
"tool": "read_file",
"target": "a.ts"
}
],
"evidenceState": {
"filesModified": [],
"filesRead": [],
"deliveryStatus": "unverified"
},
"recentToolErrorRatio": 0.5,
"progressBeacons": {
"todoCompletedDelta": 0,
"activePlan": false,
"awaitingVerification": true
}
},
"result": {
"score": 0.082125,
"level": 1,
"shouldAbort": false,
"injectedMessage": null,
"messageVariant": null,
"shouldKick": false,
"shouldForceSplit": false,
"signals": {
"editRatio": 0,
"targetNovelty": 0,
"toolEntropy": 0,
"errorPenalty": 1,
"tokenEfficiency": 0,
"oscillationPenalty": 1,
"textRepetitionPenalty": 1
},
"reasoningActive": false,
"scoreQuality": "ok",
"effectiveWeights": {
"editRatio": 0.05,
"targetNovelty": 0.3125,
"toolEntropy": 0.2625,
"errorPenalty": 0.1825,
"tokenEfficiency": 0.1925,
"oscillationPenalty": 0,
"textRepetitionPenalty": 0
}
}
},
{
"name": "no-tool-hard-stop-preserved",
"input": {
"turn": 14,
"phaseClass": "execute",
"contextWindow": 200000,
"recentToolHistory": [
{
"status": "failed",
"tool": "read_file",
"target": "plan.md"
},
{
"status": "failed",
"tool": "glob",
"target": "*.plan.md"
},
{
"status": "failed",
"tool": "grep",
"target": "plan"
},
{
"status": "success",
"tool": "bash",
"target": "cat"
},
{
"status": "failed",
"tool": "read_file",
"target": ".rivet"
},
{
"status": "success",
"tool": "glob",
"target": "*.ts"
},
{
"status": "failed",
"tool": "grep",
"target": "pattern"
},
{
"status": "success",
"tool": "read_file",
"target": "src/a.ts"
},
{
"status": "success",
"tool": "read_file",
"target": "src/a.ts"
},
{
"status": "success",
"tool": "read_file",
"target": "src/a.ts"
}
],
"evidenceState": {
"filesModified": [],
"filesRead": [],
"deliveryStatus": "unverified"
},
"noToolTurnCount": 5,
"recentToolErrorRatio": 0.8
},
"result": {
"score": 0.048556689040178395,
"level": 3,
"shouldAbort": true,
"injectedMessage": "**天璇-感知:连续 5 轮未执行任何工具调用。你可能陷入了隧道视野。**\n\n停下来,换个角度看当前状态:\n- 如果你发现了问题但不确定,请直接向用户指出\n- 如果需要更多信息,请调用 read_file / grep 等工具\n- 如果任务已完成,请输出摘要并结束回合\n- 天璇胶囊(docs/seed-capsule-tianxuan.md)有换视角方法论可供 recall",
"messageVariant": "no-tool",
"shouldKick": true,
"shouldForceSplit": false,
"signals": {
"editRatio": 0,
"targetNovelty": 0.6,
"toolEntropy": 0.7896900821428475,
"errorPenalty": 0.6666666666666667,
"tokenEfficiency": 0,
"oscillationPenalty": 1,
"textRepetitionPenalty": 1
},
"abortCause": "no-tool",
"reasoningActive": false,
"scoreQuality": "ok",
"effectiveWeights": {
"editRatio": 0.4,
"targetNovelty": 0.125,
"toolEntropy": 0.125,
"errorPenalty": 0.225,
"tokenEfficiency": 0.125,
"oscillationPenalty": 0,
"textRepetitionPenalty": 0
}
}
}
],
"capabilities": "Five reviewed pure modules transpiled with existing TypeScript into a VM context. No external imports, process, require, timers, fetch or filesystem globals exposed. Only pure exported evaluateConvergence called with 3-second bounds.",
"fullApplicationStarted": false,
"thirdPartyDependenciesInstalled": false,
"modelRequests": 0,
"productChanged": false,
"caveat": "This proves the behavior of the exact pure detector and inputs, not every full-runtime outcome; other vetoes, phases and emission gates may change the production effect."
}
@@ -0,0 +1,819 @@
{
"schemaVersion": 1,
"repository": "https://github.com/huiliyi37/Tianshu-harness.git",
"commit": "2d0b22e0b3554686e1e4131f8bdc568ef768e060",
"commitInfo": [
"2026-10-31T13:53:04+08:00",
"sync: from dev repo (v3.37.4 stable rev45)"
],
"packageVersion": "3.37.4",
"codeLicense": "Apache-2.0",
"documentExceptions": [
"docs/CVM运行时对Agent模型的实证影响.md",
"docs/reference/cvm-cognitive-runtime.md"
],
"documentExceptionLicense": "CC-BY-NC-ND-4.0; linked and license-recorded only; not reproduced or adapted",
"publicTree": {
"desktop": false,
"src/pro": false,
"vscode-extension": true,
"src/tools/computer-use": true
},
"inventory": {
"trackedFiles": 4599,
"srcTsTsxFiles": 3772,
"testFilesByPathOrName": 2063,
"sourceFilesByExclusion": 1709,
"sourceLinesSplitlines": 338689,
"hookSourceFiles": 75
},
"inventoryMethod": "git ls-files; src/ .ts/.tsx; tests are /__tests__/ or .test. or .spec.; UTF-8 splitlines counts; no tests executed",
"sourceFiles": [
{
"id": "S01",
"path": "package.json",
"bytes": 4996,
"sha256": "d94a8c0d76b93cf68ce9954ab7222953d1df7fa3d4c9615434f095d0cc7602db",
"lines": 127,
"anchorLine": 3,
"anchorNeedle": "\"version\"",
"url": "https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/package.json#L3",
"gitBlob": "9fab2e83a177ffd527b26ed471056d8ae41487a4"
},
{
"id": "S02",
"path": "LICENSE",
"bytes": 10914,
"sha256": "93612e6128ac2069d819aa32dbaccd3a57ce5edf17596c33ff25c33c607fa238",
"lines": 189,
"anchorLine": 1,
"anchorNeedle": "",
"url": "https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/LICENSE#L1",
"gitBlob": "5e1063368ba1c69c27eaed481d17abb82c91e7f3"
},
{
"id": "S03",
"path": "README.md",
"bytes": 33073,
"sha256": "f8648e62aaeed7685e52e1ef1934fcf5ab210fc2f4eb698dbc2623e7ff4d8d32",
"lines": 464,
"anchorLine": 55,
"anchorNeedle": "**提交、验证、审查分离的交付**",
"url": "https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/README.md#L55",
"gitBlob": "55ffd3cd0783514dd843420438ea00567ec32193"
},
{
"id": "S04",
"path": "src/agent/runtime-hooks.ts",
"bytes": 18501,
"sha256": "5040689a66e451a1d35597811d3e818c14afefb1b253eaa12299a363ea61b12a",
"lines": 513,
"anchorLine": 10,
"anchorNeedle": "export type RuntimeHookPhase",
"url": "https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/agent/runtime-hooks.ts#L10",
"gitBlob": "ca61e49058692f064e511d90990f69eb8efeaace"
},
{
"id": "S05",
"path": "src/agent/create-runtime-hooks.ts",
"bytes": 54740,
"sha256": "52d4f09437a1356ef435c6c11e6eb0bdbf10a14688e2cabf9b9db7d1d8cef1df",
"lines": 1004,
"anchorLine": 344,
"anchorNeedle": "export function createDefaultRuntimeHooks",
"url": "https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/agent/create-runtime-hooks.ts#L344",
"gitBlob": "db9453af90e7f233cb41bf8fec92be3b9b2f3107"
},
{
"id": "S06",
"path": "src/agent/loop-factory.ts",
"bytes": 90188,
"sha256": "5e09b4a83343e44e9f6960790c27796791b58fa5469ddaa797e015bfb5ee1584",
"lines": 1602,
"anchorLine": 650,
"anchorNeedle": "const hooks = createDefaultRuntimeHooks",
"url": "https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/agent/loop-factory.ts#L650",
"gitBlob": "ea4dc517a4912e233b047f51c43ba514f4b736ae"
},
{
"id": "S07",
"path": "src/agent/turn-perception.ts",
"bytes": 14698,
"sha256": "7f332c4fdc7cfcb676aff2c41bf2fe8825134a2ae71331c631a4d6917a18610a",
"lines": 330,
"anchorLine": 1,
"anchorNeedle": "",
"url": "https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/agent/turn-perception.ts#L1",
"gitBlob": "bc1aa9d82f88505deb6ed1c10be97985554713cb"
},
{
"id": "S08",
"path": "src/agent/tool-execution.ts",
"bytes": 44325,
"sha256": "66a08cc5edf7f041dc1764a933c3a1f12b6f7b702faf432517d9947980b0e58d",
"lines": 805,
"anchorLine": 218,
"anchorNeedle": "export class ToolExecutionController",
"url": "https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/agent/tool-execution.ts#L218",
"gitBlob": "d90632a82d6c28c7e03c5aa79820227091c7ba71"
},
{
"id": "S09",
"path": "src/agent/turn-orchestrator.ts",
"bytes": 89339,
"sha256": "457c376c3607e638019e718095a5d65e64596932ff8fd208c6c444eda67432af",
"lines": 1631,
"anchorLine": 1,
"anchorNeedle": "",
"url": "https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/agent/turn-orchestrator.ts#L1",
"gitBlob": "19898f23ec48656b1447f72cb91187e38fb8c400"
},
{
"id": "S10",
"path": "src/context/task-contract.ts",
"bytes": 25000,
"sha256": "4444b21b0f36777d061bbb3d95a34530ead6ee86d364865f555e1954b6aae407",
"lines": 571,
"anchorLine": 11,
"anchorNeedle": "export interface TaskContract",
"url": "https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/context/task-contract.ts#L11",
"gitBlob": "e4ce46d6ae0a44291eae5bf32b33b1c2540f9a61"
},
{
"id": "S11",
"path": "src/agent/evidence-obligation.ts",
"bytes": 28447,
"sha256": "6dae2930331d490bd04e555512a303cd26ebcf26702758dc9ee6a202cda6f5f6",
"lines": 578,
"anchorLine": 36,
"anchorNeedle": "export type ObligationState",
"url": "https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/agent/evidence-obligation.ts#L36",
"gitBlob": "70d3156cbddfa8904a5f4707555d44c1b9eb129e"
},
{
"id": "S12",
"path": "src/agent/obligation-tracker.ts",
"bytes": 7583,
"sha256": "053266993d54c2ea753261c7b2b2da37373d5b971a38793c0e6b2554bf9b067e",
"lines": 185,
"anchorLine": 43,
"anchorNeedle": "export class ObligationTracker",
"url": "https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/agent/obligation-tracker.ts#L43",
"gitBlob": "1924ecac1d97966d6a92143af80d7eb58cc97090"
},
{
"id": "S13",
"path": "src/agent/loop.ts",
"bytes": 185291,
"sha256": "385c430c2d64b69fc9bb6da906e571915bae38c433f9b7a3d77aa8c472f09076",
"lines": 3375,
"anchorLine": 1268,
"anchorNeedle": "captureAcceptance(items:",
"url": "https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/agent/loop.ts#L1268",
"gitBlob": "ac630c7256b28d8b25b873eb48faef570a9c2658"
},
{
"id": "S14",
"path": "src/agent/advisory-bus.ts",
"bytes": 68002,
"sha256": "5a0f7d834e1858b911229b5b458b897795d4937c7e1d850c7b6e5e211f3eba67",
"lines": 1281,
"anchorLine": 400,
"anchorNeedle": "export class AdvisoryBus",
"url": "https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/agent/advisory-bus.ts#L400",
"gitBlob": "8bc3f3e6296fa1a514203de5a940a9c52ddb0d17"
},
{
"id": "S15",
"path": "src/agent/runtime-advice-facts.ts",
"bytes": 1559,
"sha256": "4a7e2416411d116e9f7d9dde603f53d3868093e4963d3e7c1e43431993d314b9",
"lines": 25,
"anchorLine": 1,
"anchorNeedle": "",
"url": "https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/agent/runtime-advice-facts.ts#L1",
"gitBlob": "e5156027eff6e5e4fd3c364869dc64e7a907476d"
},
{
"id": "S16",
"path": "src/agent/convergence-detector.ts",
"bytes": 66210,
"sha256": "2c03f3e88c16ddc750233ff7ea1ef6a3a4f9c11f818d877a52ebc622d871cc54",
"lines": 1281,
"anchorLine": 1087,
"anchorNeedle": "const effectiveScore =",
"url": "https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/agent/convergence-detector.ts#L1087",
"gitBlob": "3fc4208e67f2c6b5151d3ba270a0c213d87eaed4"
},
{
"id": "S17",
"path": "src/agent/convergence-message.ts",
"bytes": 13202,
"sha256": "4626fe6f9906b7023c6aed99780e1b33a7a74968960f37d077a01c35a385ec6f",
"lines": 216,
"anchorLine": 1,
"anchorNeedle": "",
"url": "https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/agent/convergence-message.ts#L1",
"gitBlob": "6435ab1ba33ff5a75f3deab12fc79448a6db12cf"
},
{
"id": "S18",
"path": "src/agent/score-history.ts",
"bytes": 4905,
"sha256": "9e433c3ca44e023459ae67856deba56e0efe96015ff9f9fa20327dd49b03197d",
"lines": 107,
"anchorLine": 1,
"anchorNeedle": "",
"url": "https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/agent/score-history.ts#L1",
"gitBlob": "de3efe9786ef84ed22b3887148ad479d9047d678"
},
{
"id": "S19",
"path": "src/tools/write-tool-helpers.ts",
"bytes": 10587,
"sha256": "a2b31a5d0cddcaf9cc2fe162d5f031125bd1579f73bb721192ff7f1d768b0d63",
"lines": 263,
"anchorLine": 1,
"anchorNeedle": "",
"url": "https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/tools/write-tool-helpers.ts#L1",
"gitBlob": "721758edd8cfa697491f30eef6f6f42d25c2ee2a"
},
{
"id": "S20",
"path": "src/agent/exploration-stall.ts",
"bytes": 2818,
"sha256": "409d0f08ad0e98b6f2c7d5a196ae0adeab3c0ee389e653a0baa969ff79b000cb",
"lines": 95,
"anchorLine": 1,
"anchorNeedle": "",
"url": "https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/agent/exploration-stall.ts#L1",
"gitBlob": "bce1b6990ef9b37b1f0e44866f2dca665a4551e7"
},
{
"id": "S21",
"path": "src/agent/__tests__/convergence-detector.test.ts",
"bytes": 132032,
"sha256": "58967b9ae7fffe9e58c275da3c160503b5d355affb2f515edef02e2bd45f9d10",
"lines": 2725,
"anchorLine": 1,
"anchorNeedle": "",
"url": "https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/agent/__tests__/convergence-detector.test.ts#L1",
"gitBlob": "80373ff1c02bf1a5d6706be88ebe2c41769ca825"
},
{
"id": "S22",
"path": "src/agent/delivery-gate-v2.ts",
"bytes": 35074,
"sha256": "2b0189cc5a7f77aacab63a0957c81febd8bf2f7293dd7d4e4992f36851490600",
"lines": 662,
"anchorLine": 1,
"anchorNeedle": "",
"url": "https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/agent/delivery-gate-v2.ts#L1",
"gitBlob": "f9670782437d4dc1a33e12e9b8cc4ced9424448d"
},
{
"id": "S23",
"path": "src/agent/deliver-task.ts",
"bytes": 30915,
"sha256": "c7cd072f6bdd50d0d5e8dd1f95cceeab7f5640ed80f36f7e50b53da77283e6af",
"lines": 489,
"anchorLine": 1,
"anchorNeedle": "",
"url": "https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/agent/deliver-task.ts#L1",
"gitBlob": "6e941fd89c4b20b9ec4e5c8c2354f821f47cd19c"
},
{
"id": "S24",
"path": "src/agent/evidence.ts",
"bytes": 13230,
"sha256": "56d28440887a12ff6a82e7c46d4d03b5a4debcfd56adde09351795cd8867bdbe",
"lines": 315,
"anchorLine": 1,
"anchorNeedle": "",
"url": "https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/agent/evidence.ts#L1",
"gitBlob": "7cec44dc58b468d529e6917bc1b0fd597d4ce19a"
},
{
"id": "S25",
"path": "src/agent/verification-snapshot.ts",
"bytes": 11575,
"sha256": "9b0978bf2a1e70c9d6309d49b700d79fbb268b420ebcba07f6b310df54fba4da",
"lines": 289,
"anchorLine": 1,
"anchorNeedle": "",
"url": "https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/agent/verification-snapshot.ts#L1",
"gitBlob": "22ee1e1c1167cc0118928db75d5d3df331bc7541"
},
{
"id": "S26",
"path": "src/agent/verification-scope-current.ts",
"bytes": 849,
"sha256": "f7f094b3335d4d36e74197437fca36d2c304235b9f9969a5cdbc88752fe9f8a7",
"lines": 14,
"anchorLine": 1,
"anchorNeedle": "",
"url": "https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/agent/verification-scope-current.ts#L1",
"gitBlob": "f6fdd0eba7f688770fdaca162bcb01b1b60fda4d"
},
{
"id": "S27",
"path": "src/agent/tool-pipeline.ts",
"bytes": 138084,
"sha256": "da544fc6ff00e92be1e2f1b49a29380a7fcf1754ae8bacd05ca480275f25ca31",
"lines": 2242,
"anchorLine": 568,
"anchorNeedle": "export function executeToolUse(",
"url": "https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/agent/tool-pipeline.ts#L568",
"gitBlob": "f802237301d54d3a0059b017cab2dc1bfa94033b"
},
{
"id": "S28",
"path": "src/agent/approval-input-boundary.ts",
"bytes": 5725,
"sha256": "a4e973db9bc4819bd12e9aa3ee7ddfd9ed99d14cb163157b2b16a05c5990ac13",
"lines": 94,
"anchorLine": 1,
"anchorNeedle": "",
"url": "https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/agent/approval-input-boundary.ts#L1",
"gitBlob": "086e136b31666299bd041a8560581afe9653c2f1"
},
{
"id": "S29",
"path": "src/prompt/engine.ts",
"bytes": 99082,
"sha256": "b41d81cd1231d0e907f1e956381638e17f397fcb363fc566c817712b7b0aa4a5",
"lines": 1809,
"anchorLine": 97,
"anchorNeedle": "export class PromptEngine",
"url": "https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/prompt/engine.ts#L97",
"gitBlob": "e5a8f964b6710a735ef864a57f9f18859e30b831"
},
{
"id": "S30",
"path": "src/agent/request-context-controller.ts",
"bytes": 12129,
"sha256": "fc01c8fd99a1d3ef5215d28cf07bda679de51c98840a01165220705d591e60b1",
"lines": 186,
"anchorLine": 28,
"anchorNeedle": "export class RequestContextController",
"url": "https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/agent/request-context-controller.ts#L28",
"gitBlob": "6e3c6699f1fd9098fc167c7f556ff3cb82b7eb92"
},
{
"id": "S31",
"path": "src/agent/context-budget-preparation.ts",
"bytes": 2881,
"sha256": "034f23a992aaef548a59f4b5307dc56d14f4f434b5e1b374feaf1c0c3c570dbc",
"lines": 53,
"anchorLine": 17,
"anchorNeedle": "export async function prepareContextRequest",
"url": "https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/agent/context-budget-preparation.ts#L17",
"gitBlob": "f1c40cfe76e28e12d6b4d2012fdb3d48028c7048"
},
{
"id": "S32",
"path": "src/agent/compact-boundary-coordinator.ts",
"bytes": 5517,
"sha256": "2c33f88d2f58556e8a66ebcd6dfbb2dbd024e730c4bf95617f5e7f1737f1dab6",
"lines": 106,
"anchorLine": 1,
"anchorNeedle": "",
"url": "https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/agent/compact-boundary-coordinator.ts#L1",
"gitBlob": "a39b01ee9617e504016fb5295d8fe2b1e9e84e37"
},
{
"id": "S33",
"path": "src/context/request-budget.ts",
"bytes": 8769,
"sha256": "40d9206c3490ab05d487e6697ff88bfa6e9e5c2ac18a57456d13ad21cee416c3",
"lines": 143,
"anchorLine": 1,
"anchorNeedle": "",
"url": "https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/context/request-budget.ts#L1",
"gitBlob": "6de4a4e19d988c800f85d670d4d6463b209fa970"
},
{
"id": "S34",
"path": "src/tools/tool-preset.ts",
"bytes": 7916,
"sha256": "aa4f6c41669bbe938ed14a2e32b169bb326b26de1b5c6c87e606a9753110b79a",
"lines": 176,
"anchorLine": 12,
"anchorNeedle": "minimal 36 / 26",
"url": "https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/tools/tool-preset.ts#L12",
"gitBlob": "f3f810509c91cfb86d887e073f1e5f8ed0992837"
},
{
"id": "S35",
"path": "src/tools/default-registry.ts",
"bytes": 12583,
"sha256": "1a774659a796c7c17bd78c39f95c2e011cb010a724f98cfc0c7995cd011a9bef",
"lines": 218,
"anchorLine": 1,
"anchorNeedle": "",
"url": "https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/tools/default-registry.ts#L1",
"gitBlob": "ddbbd6b6c85c4e619824e17ea9c9cb5a00d51f3b"
},
{
"id": "S36",
"path": "src/agent/tool-surface.ts",
"bytes": 1333,
"sha256": "13d4e772983c5212a5746a79e86cd95f7c137d7c318819278cf4a2054e8a1378",
"lines": 16,
"anchorLine": 6,
"anchorNeedle": "export function describeToolSurface",
"url": "https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/agent/tool-surface.ts#L6",
"gitBlob": "24adce321684b3e469af527e33543893296d8307"
},
{
"id": "S37",
"path": "src/agent/work-order.ts",
"bytes": 54885,
"sha256": "b32572e94b4ca0215b0f5718a0a6caebd0ba599b39f8318c10611c61ae9ae409",
"lines": 1109,
"anchorLine": 105,
"anchorNeedle": "const workerBudgetSchema",
"url": "https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/agent/work-order.ts#L105",
"gitBlob": "b0122b65ce799d55aad16b1a7fefb98e779dd2e5"
},
{
"id": "S38",
"path": "src/agent/worker-runtime.ts",
"bytes": 9340,
"sha256": "027aa0ada619baabebd11b572bfb8db50b918e83f9cc76751d82b923675b6e6e",
"lines": 179,
"anchorLine": 72,
"anchorNeedle": "export function createWorkerRuntimeFactory",
"url": "https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/agent/worker-runtime.ts#L72",
"gitBlob": "6a5809df84bdcdfb9853b94ce18a8cfcfbd280a9"
},
{
"id": "S39",
"path": "src/agent/worker-session.ts",
"bytes": 62868,
"sha256": "c900752f2a7125ef3315453e9209f789d30435796abd067102ed46ff0f1f07e4",
"lines": 1104,
"anchorLine": 638,
"anchorNeedle": "async function runWorkerSessionImpl",
"url": "https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/agent/worker-session.ts#L638",
"gitBlob": "a4357393c3f31c218ae13f066f04a7a1375962e8"
},
{
"id": "S40",
"path": "src/agent/hands-session.ts",
"bytes": 13016,
"sha256": "9466667ed5af1e5e7863fdd5f2fbf16294a09e041b25447ace8fd8de0f12d738",
"lines": 272,
"anchorLine": 225,
"anchorNeedle": "const gateOn =",
"url": "https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/agent/hands-session.ts#L225",
"gitBlob": "b6cea764e789d340c5cdce91e05375264ba623b4"
},
{
"id": "S41",
"path": "src/agent/worker-write-gate.ts",
"bytes": 7560,
"sha256": "41446bf179ff1d3966607446c4f572bf2cca784b7dd67824db474a5673b9d51b",
"lines": 167,
"anchorLine": 69,
"anchorNeedle": "export async function evaluateWorkerWriteGate",
"url": "https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/agent/worker-write-gate.ts#L69",
"gitBlob": "f950c623628df117e329ce3618ca728af6b8194f"
},
{
"id": "S42",
"path": "src/agent/worker-objective-gate.ts",
"bytes": 10053,
"sha256": "010cb229edb35c00e2c1cf814acdec1028c03b76f4625bffa010379435d33136",
"lines": 187,
"anchorLine": 102,
"anchorNeedle": "export function reconcileWithObjective",
"url": "https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/agent/worker-objective-gate.ts#L102",
"gitBlob": "6937fe231f8074006434820f5b3bd81a489dd7db"
},
{
"id": "S43",
"path": "src/agent/coordinator.ts",
"bytes": 153367,
"sha256": "56148fd00e9ce91d5d16ae3c4f77dfb52bb7cbe43d1768e0a59fe3383c98d7dc",
"lines": 2859,
"anchorLine": 2482,
"anchorNeedle": "result: reconcileWithObjective(order",
"url": "https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/agent/coordinator.ts#L2482",
"gitBlob": "b4ecfc79c9efb44a9aa59b4a092a4c4fecde3cc6"
},
{
"id": "S44",
"path": "src/model/model-binding.ts",
"bytes": 6425,
"sha256": "ae155a2ab26961d88ced821aa48c6691d4c7ae56c774508d99fd943012fab1ef",
"lines": 105,
"anchorLine": 57,
"anchorNeedle": "export function resolveModelBinding",
"url": "https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/model/model-binding.ts#L57",
"gitBlob": "0354df572a358cd39a9ec07ac40f51a86c8b7d9e"
},
{
"id": "S45",
"path": "src/config/provider-keys.ts",
"bytes": 15334,
"sha256": "19a18b810e0e188204fd9889eb1a4190f425fb2b7d8eddba8f2939eaed54f35f",
"lines": 303,
"anchorLine": 106,
"anchorNeedle": "export function findModelOwner",
"url": "https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/config/provider-keys.ts#L106",
"gitBlob": "0acdc12de45b2e35b832daa6f582aebd54f723d7"
},
{
"id": "S46",
"path": "src/api/fallback-client.ts",
"bytes": 4842,
"sha256": "d2066867e84c75dc3b22278ab3f3c69ff2c7756b10266e094f4f5be1467d8dfb",
"lines": 118,
"anchorLine": 76,
"anchorNeedle": "getMainPrefixProof?.() ||",
"url": "https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/api/fallback-client.ts#L76",
"gitBlob": "52ac24097fc3939d923d2c64bd8b10f520885574"
},
{
"id": "S47",
"path": "src/memory/formation-policy.ts",
"bytes": 1109,
"sha256": "c0468fe1a0c3ee6588146206a12568b66c823f6ebfb1859eb07cd6d762070540",
"lines": 27,
"anchorLine": 1,
"anchorNeedle": "",
"url": "https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/memory/formation-policy.ts#L1",
"gitBlob": "76c2e9c1ceb7a59489323afe8ba33e872e4c2764"
},
{
"id": "S48",
"path": "src/memory/essence-gate.ts",
"bytes": 15360,
"sha256": "8b9c1d7834c700917fb4ad2cf321e4df193cd402000c8c5b0ae03e341eb8c031",
"lines": 343,
"anchorLine": 245,
"anchorNeedle": "export async function runEssenceGate",
"url": "https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/memory/essence-gate.ts#L245",
"gitBlob": "cc5ddf13a1090359426f68df1f86cb169ce03123"
},
{
"id": "S49",
"path": "src/memory/unified-memory.ts",
"bytes": 27615,
"sha256": "d5a0388ef557330fd07e6bb3861ee21214b3a428ac9bfcfbe7073dd6c2771eb1",
"lines": 649,
"anchorLine": 371,
"anchorNeedle": "export function recallMemoryEntries",
"url": "https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/memory/unified-memory.ts#L371",
"gitBlob": "7c79c5ccea8d99ecaf0e67dd818ddf14bb1ee628"
},
{
"id": "S50",
"path": "src/agent/hooks/essence-gate-hook.ts",
"bytes": 3754,
"sha256": "ab30aac9e1161bf567e3974f6f98b2a40b83669b24eaa806dd904767e69f2545",
"lines": 81,
"anchorLine": 1,
"anchorNeedle": "",
"url": "https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/agent/hooks/essence-gate-hook.ts#L1",
"gitBlob": "d53fce0a3366e031408e633638ebed2aff15226c"
},
{
"id": "S51",
"path": "src/agent/skill-distill.ts",
"bytes": 13224,
"sha256": "2ba0d9bace581d5790692cfc154ba6e7418aad894d8120f2225dab18dbd78579",
"lines": 344,
"anchorLine": 201,
"anchorNeedle": "export function renderSkillDraftMarkdown",
"url": "https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/agent/skill-distill.ts#L201",
"gitBlob": "34fa0f7b57a31955c4df49579a232b169e699d7c"
},
{
"id": "S52",
"path": "src/agent/hooks/skill-distill-hook.ts",
"bytes": 2158,
"sha256": "5d7c1728b0b0764d906327ab9d14422657a0304b8888e1a6b53630a404a43795",
"lines": 54,
"anchorLine": 1,
"anchorNeedle": "",
"url": "https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/agent/hooks/skill-distill-hook.ts#L1",
"gitBlob": "50ad14f3285bb045f7f1a02c0c31d47309927351"
},
{
"id": "S53",
"path": "src/skills/skill-loader.ts",
"bytes": 48779,
"sha256": "c714e82f55621b6a70db3e3e66066eae765b78cbe448fa7025ca13aa6b188528",
"lines": 1031,
"anchorLine": 5,
"anchorNeedle": "Two tiers:",
"url": "https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/skills/skill-loader.ts#L5",
"gitBlob": "788f0d415ef886594ed0ce416c22e71c4c199648"
},
{
"id": "S54",
"path": "src/mcp/manager.ts",
"bytes": 36357,
"sha256": "a490053212c346d2a6cd6bcd0a90d0b82e06d265ab63ce90fb8d0c23bce51667",
"lines": 827,
"anchorLine": 57,
"anchorNeedle": "export class McpManager",
"url": "https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/mcp/manager.ts#L57",
"gitBlob": "5461be5a3f3a3668d6b090281af61b4e631db28e"
},
{
"id": "S55",
"path": "src/plugins/plugin-loader.ts",
"bytes": 20824,
"sha256": "9ac3916bace9753d84989ba42d2d906dc9678d59f4fe8ebb148f026145d34afa",
"lines": 513,
"anchorLine": 104,
"anchorNeedle": "export async function initializePlugins",
"url": "https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/plugins/plugin-loader.ts#L104",
"gitBlob": "f91ef751ed0f33e619f6a9f7c6164f982954b8f0"
},
{
"id": "S56",
"path": "src/tools/computer-use/bridge.ts",
"bytes": 2782,
"sha256": "2ded20dce257e3c07a5e962dd2d5d5e79e95bdba282711e3c210a1f6d9769413",
"lines": 67,
"anchorLine": 1,
"anchorNeedle": "",
"url": "https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/tools/computer-use/bridge.ts#L1",
"gitBlob": "788e173414221ab0ca683241f11248fbe17a38e8"
},
{
"id": "S57",
"path": "src/tools/computer-use/stub.ts",
"bytes": 14119,
"sha256": "afd07607d62a724d688af263f5bc4ac6cadd628b6427f39ee65ee4118521df9c",
"lines": 176,
"anchorLine": 1,
"anchorNeedle": "",
"url": "https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/tools/computer-use/stub.ts#L1",
"gitBlob": "5a574ca8b86461e9f63ae8b99b1dca3300cc0755"
},
{
"id": "S58",
"path": "docs/architecture-overview.md",
"bytes": 11771,
"sha256": "a7b758ccbb357741dcfd776a42ba7e92bc50b4704fbc2dd2549284112a3e78de",
"lines": 172,
"anchorLine": 1,
"anchorNeedle": "",
"url": "https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/docs/architecture-overview.md#L1",
"gitBlob": "348048ab8d17fc073e67796950c1d10617cb88bd"
},
{
"id": "S59",
"path": "docs/reference/observability-harness.md",
"bytes": 17826,
"sha256": "c7e9e77592e614bec57b84931a80507543c0ce7160618d54029e9415419bf7f1",
"lines": 237,
"anchorLine": 1,
"anchorNeedle": "",
"url": "https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/docs/reference/observability-harness.md#L1",
"gitBlob": "f6840454ca3374c09a42a1f1515ef8153d7326ec"
},
{
"id": "S60",
"path": "docs/CVM运行时对Agent模型的实证影响.md",
"bytes": 14421,
"sha256": "ad9c55c18e2dbc31e5df4089b9e6cf7b772249b695e3ebfc61c7c1c67aa7ea00",
"lines": 286,
"anchorLine": 3,
"anchorNeedle": "版权与许可",
"url": "https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/docs/CVM运行时对Agent模型的实证影响.md#L3",
"gitBlob": "527d2e0751d90be8620e25f7f22075cbb86ff2f8"
},
{
"id": "S61",
"path": "docs/reference/cvm-cognitive-runtime.md",
"bytes": 24634,
"sha256": "31feb889f92deae9d2d116567cda15c5f7bab5dec48626894abe19a5a5fd770a",
"lines": 428,
"anchorLine": 12,
"anchorNeedle": "版权与许可",
"url": "https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/docs/reference/cvm-cognitive-runtime.md#L12",
"gitBlob": "9883609263c7a7fc7570386361063b08f588d420"
},
{
"id": "S62",
"path": "src/cli/entry.ts",
"bytes": 4356,
"sha256": "9461e233f144904a05e14d2eef03b0e58ccd423235f3cbdde432ef77265a4b48",
"lines": 93,
"anchorLine": 1,
"anchorNeedle": "",
"url": "https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/cli/entry.ts#L1",
"gitBlob": "60320a457442e0c2b5d21be673d92f79cd0d50cc"
},
{
"id": "S63",
"path": "src/main.ts",
"bytes": 127344,
"sha256": "22a83ddb215b141122a4af2bcfd37f53d5c409408f3a00cc7774fa1117a0401d",
"lines": 2298,
"anchorLine": 1,
"anchorNeedle": "",
"url": "https://github.com/huiliyi37/Tianshu-harness/blob/2d0b22e0b3554686e1e4131f8bdc568ef768e060/src/main.ts#L1",
"gitBlob": "5ad93ae1fa3e2e8b61d52cdc7ba551ff88baf9f3"
}
],
"productBaselineCommit": "676fc55420bf06e64201f2e88ef75548f79db7b1",
"productFiles": [
{
"path": "src/server/runtime.mjs",
"bytes": 90224,
"sha256": "848f2110ec3563bd3391b4d24150440ffd74d59f7383972a372039c6686ce574",
"lines": 917
},
{
"path": "src/core/context/working-set.mjs",
"bytes": 18630,
"sha256": "ffbcc7421997f5a2490f654e31ac2ee7020d40e69c5f7dced619e84a48f52653",
"lines": 240
},
{
"path": "src/core/context/request-plan.mjs",
"bytes": 43271,
"sha256": "340bc40265ed83154948b5e23c45df7cf47c434ba8957fe7053c834aacce14e6",
"lines": 529
},
{
"path": "src/core/context/delivery-progress.mjs",
"bytes": 6707,
"sha256": "13d49a553e859c31efe7dd3b5d7093f89081c7c632d22cb93d4432f761e715c8",
"lines": 80
},
{
"path": "src/core/tasks/task-plan-manager.mjs",
"bytes": 22733,
"sha256": "0bebf720614cb45eb840cc5007b5499ef4fc5ca3934d2261a439d1df90cde3ec",
"lines": 232
},
{
"path": "src/core/tasks/worker-manager.mjs",
"bytes": 70505,
"sha256": "f33e326680c75bb73cb6327b80c21fc6d5345133809c79a0588fcdd954cabf65",
"lines": 744
},
{
"path": "src/core/git-delivery.mjs",
"bytes": 41256,
"sha256": "106d7f6384f69ecff0cd68ba89f0a45876d37cc0bce537b75490e78e1aae8ca6",
"lines": 516
},
{
"path": "src/core/models/model-hub.mjs",
"bytes": 34086,
"sha256": "ce17b0d7c6c21c9a3cbc649797a581f0af8eb73154556eef207b74f4523ae13b",
"lines": 404
},
{
"path": "src/core/models/protocols.mjs",
"bytes": 8476,
"sha256": "31b9decb074909a598e2926487ff90aa36c0e8c46cb4154e8bfd8959085a2fba",
"lines": 96
},
{
"path": "src/core/memory/project-memory.mjs",
"bytes": 13871,
"sha256": "9c7da0ef9c7f36b431015fd4414f55304f8d5e25a61bc527fb7e3be0b7971e51",
"lines": 233
},
{
"path": "src/core/evaluation/evaluation-manager.mjs",
"bytes": 28712,
"sha256": "c072e6c1894702955ce5d8838fbf7aa6c43c1a9cece1665a1309758878fda941",
"lines": 263
},
{
"path": "src/core/browser/browser-manager.mjs",
"bytes": 24633,
"sha256": "0efc0e30f19a8649c964e1193c455d6cc6f32bfd4a4a5e18fc6ff8014d67b820",
"lines": 235
},
{
"path": "src/shared/contracts/task-plans.mjs",
"bytes": 7339,
"sha256": "c5dc7a8ae028afcc7fa6b55a1261700998c41e799e48101759e48b05d2317d90",
"lines": 74
},
{
"path": "docs/PLAN-1.25.md",
"bytes": 2583,
"sha256": "f721b2f698f5b5503ea54b1c271678d1bd7f9acc412d6d8e0d48917b52d261c7",
"lines": 27
}
],
"executionScope": {
"fullApplicationStarted": false,
"thirdPartyDependenciesInstalled": false,
"modelRequests": 0,
"pureProbeOnly": "Five reviewed modules; separate original output and driver are sealed alongside this index"
}
}
+29
View File
@@ -1,5 +1,34 @@
# 汇总发现
## 本轮实现边界
研究证据的14产品输入原本按工作区核对,后续实现必然导致历史误失效;改为核对manifest固定676fc554 Git对象,不改变原报告/输入SHA/探针。采用计划A复用已有TaskPlanManager的五类原证据校验,避免另建一套执行或Git门;B仅shadow,模型文字不能充当工程增长。
## Tianshu 已核对的机制与边界
补充重要细节:loop.ts 1268 的 captureAcceptance 确实把用户可观察验收与单测验证分开,只有显式 acceptance 回写核销;ObligationTracker 使用稳定 ID、状态版本和有界 latch。但是 RED 编辑门按义务只硬拦一次(重发可过),final gate 对验证/验收缺口只披露不自动续轮。可学状态建模,不能误称所有验收都是不可绕过门。Skills 有发现摘要/按需全文两层;MCP 有连接审批和工具清单指纹复核;插件动态 import 是实际可执行代码。这些是已有生态的治理借鉴,不是导入第三方配置的理由。
当前 hands-session.ts 220–239 已更正早期“可自动修复一轮”的推断:写工复验失败/阻塞即终态,repairCount 固定 0,不自动再发模型。worker-session 也明确 maxRetries=0。新核对 docs/reference/cvm-cognitive-runtime.md 同样单列 CC BY-NC-ND 4.0;只登记许可并链接,不摘编其概念文档。本轮有一个产品 cwd 下查第三方路径的只读错误,及两条存在性探测无文件,均未执行第三方或产品副作用;后续以真实树定位,不推断缺失能力。
审批链已实读:tool-pipeline.ts 先做模式/deny/风险与预览,用户可编辑参数;编辑后重查 deny、自杀进程与审批边界,派发前再次重查、冻结参数、组合取消信号后执行,并返回有界结果/证据。hands-session 真接写工复验,coordinator 2482 真接目标对账。另一只读查找 worker-prompt.ts 不存在,后续按已确认模块和 rg 目录检索;不据猜测路径下结论。README 顶部对比图 alt 仍说 RED 拒绝交付,与 README 55/273 和 deliver-task 当前“提交不阻断验证缺口”相冲突;文档需以当前源码为准。公开树仅找到回归 cache-log fixture,不能据文档本地会话路径声称拿到全部 2001 次原始日志。
worker-runtime 明确每工单冻结模型策略,新设置只影响新工单;worker-session 禁重试、恢复要求完整 prefix/snapshot,回合数取较小值并有墙钟/父取消/软收尾。budget.maxTokens 注释与使用更像报告单次输出档位,不应误作全会话累计额度。EssenceGate 在 LLM 错误/无效输出时不写,但获准条目直接标 status=verified;这是知识准入模型判断,不等于经工程测试独立验证。统一记忆按有效期/替代链过滤,核心 recall 为关键词命中乘 confidence,不能称全面向量语义检索。
本轮一次 rg 误用了未确认的 worker-coordinator.ts 及 Windows 字面 coordinator*.ts 路径,只读查找失败;改为 src/agent 目录配 -g 文件筛选,后续均使用真实 coordinator.ts 调用点。未执行或修改第三方。
补核 model-binding.ts:worker 传递 provider/model/keyId 的可序列化身份,由本机解析凭据;显式 keyId 精确选线,可用性失败区分 provider/model/凭据。未提供 keyId 时依然依赖 first-match 的 findModelOwner,不能误称全池自动轮询。tool-pipeline 有输入冻结/审批后再判定、单工具 watchdog 与超时不重复执行提示,具体顺序继续追查。
公开 commit 2d0b22e / package 3.37.4;src 有 3772 个 TS/TSX 文件,其中按测试路径/命名排除后的源码 1709 文件、338689 行。没有 desktop/ 和 src/pro/,computer-use 完整驱动是闭源桥接,不能声称完整桌面操控开源。代码 Apache-2.0;docs/CVM运行时对Agent模型的实证影响.md 单独声明 CC BY-NC-ND 4.0,不复制改编该报告。
五阶段 hook 串行、超时/AbortSignal/迟到 effects 封锁、可观测且按条件装配;一般 hook 异常继续,仅特定 cleanup 未确认异常传播,所以软提醒不是确定性硬门。AdvisoryBus 有去重、TTL、每轮/类别预算、readback 和低采纳冷却。TaskContract 的继续追问合并是启发式,不能作为权限判断。DeliveryGateV2 区分自有/外部修改及验证新鲜度,但 deliver-task 明确提交与验证审查分离,不能把它当我们的必过检查交付门。
旧 architecture-overview 与当前代码有漂移:CompactBoundaryCoordinator 的压缩已是 no-op,实际由 RequestContextController/prepareContextRequest 做事务;工具 kernel 26 不是当前所有 preset 的最终可见数量。前缀冻结、用户消息按实例冻结、动态 appendix 与实际 provider normalization 后预算有借鉴价值;README 缓存命中与费用为作者 DeepSeek 样本,未独立复现,也不证明我们 Purge 收益。
纯探针只加载五个已读模块:原 W4 高错 fixture score .5164603/L1;重复读取 .082125/L2;加 .5 高错仍 L2;六次失败读取 score 0/L2。原因是声称减轻催促的 Math.min(score,.41) 在低分更强纠偏的阈值下无法保护低分。awaitingVerification 能降为 L1;no-tool 五轮硬停仍 L3/abort。此为纯检测器反例,不推断所有完整运行时效果。exploration-stall.ts 的 12/15 阈值未查到生产调用点。
本产品已有工作集同 SHA 片段/真实来源、请求预算与配对、当前检查事实、跨 Run 防空转、模型池/原生协议/用量/身份、worker/任务计划/Git 门、人工项目记忆;研究价值在要求验收、单轮语义进展、工具 surface 与前缀实测、提醒有效性、经验草稿,不能写成这些既有能力缺失。
## 当前:V已封存,Tianshu-harness源码研究
V唯一诊断partial:auto/IPv6 TLS通过,独立IPv4握手超时;按冻结计划在身份预检前结束,模型/HTTP请求0。65项目81会话6377记录13484事件/outbox、3720工件和225尝试、原PID36552/Provider及公开配置保持,9/1/73修订均未变,9229关闭。46份/38772720字节证据离线通过,见docs/QA-LIVE-DELIVERY-V.md及回顾。多历史诊断的显示排序误比已用只读ID核对更正,首失败保留、不重跑。
+13
View File
@@ -1,5 +1,18 @@
# 统一执行进度
## 本轮恢复与研究收口
用户要求继续A/B要求证据与单轮观察。核对HEAD 676fc554、分支feat/tianshu-harness-research:既有改动仅研究文档/证据/自有验证器和计划,没有产品实现。原研究8份113756字节、63固定来源/14产品输入/6纯案例离线通过。收口验证器改读固定产品Git对象,使未来产品变动不改写旧研究。正式服务/Provider未操作,真实模型0;V网络partial、原T/R/P/O、重复读取和Purge未知保持。
固定Git字节首核验拒绝PLAN-1.25的2556/LF与原2583/CRLF差异;原索引不改,验证器仅还原历史CRLF表示并继续要求原SHA,不能跳过内容差异。
## Tianshu 深读与纯探针中期回顾
主要调用链已核对完毕,开始报告和证据索引。首版静态收集器将 workerBudgetSchema 误标为 export const,锚点断言拒绝写输出;按实码 const 修正,不放松锚点检验。补发现 acceptance 的 evidence 在该纯判断器中只要求非空文字,不能当来源 SHA 验证;我们的要求证据仍须绑定 Task/Run/当前输入。研究涉及的两份 CC BY-NC-ND 文档仅登记许可/链接,不作为改编来源。
研究分支 feat/tianshu-harness-research,产品基线仍 676fc554 / 正式 1.24.8。已完成公开源码固定、主要调用链与我们系统对照,五模块 VM 六场景探针复现收敛公式的低分/高错误反例;未运行第三方应用、安装或请求模型。当前补核模型连续性/worker 预算/记忆准入,随后封存源码清单、原探针、中文深度报告和采用计划。session-catchup 无待同步内容。只读路径/通配查找错误已按实际 src 路径修正,不重做 V 或旧真实任务。
## 当前:V已封存,Tianshu-harness源码研究
V唯一诊断partial:auto/IPv6 TLS通过,独立IPv4握手超时;按冻结计划在身份预检前结束,模型/HTTP请求0。65项目81会话6377记录13484事件/outbox、3720工件和225尝试、原PID36552/Provider及公开配置保持,9/1/73修订均未变,9229关闭。46份/38772720字节证据离线通过,见docs/QA-LIVE-DELIVERY-V.md及回顾。多历史诊断的显示排序误比已用只读ID核对更正,首失败保留、不重跑。
+149
View File
@@ -0,0 +1,149 @@
"""Read a pinned, clean public source checkout; never import or run its code."""
import argparse
import hashlib
import json
from pathlib import Path
import subprocess
PIN = "2d0b22e0b3554686e1e4131f8bdc568ef768e060"
PRODUCT_PIN = "676fc554"
URL = "https://github.com/huiliyi37/Tianshu-harness"
# Identifiers are used by the research report. Empty needles anchor at line one.
SOURCES = [
("S01", "package.json", '"version"'),
("S02", "LICENSE", ""),
("S03", "README.md", "**提交、验证、审查分离的交付**"),
("S04", "src/agent/runtime-hooks.ts", "export type RuntimeHookPhase"),
("S05", "src/agent/create-runtime-hooks.ts", "export function createDefaultRuntimeHooks"),
("S06", "src/agent/loop-factory.ts", "const hooks = createDefaultRuntimeHooks"),
("S07", "src/agent/turn-perception.ts", ""),
("S08", "src/agent/tool-execution.ts", "export class ToolExecutionController"),
("S09", "src/agent/turn-orchestrator.ts", ""),
("S10", "src/context/task-contract.ts", "export interface TaskContract"),
("S11", "src/agent/evidence-obligation.ts", "export type ObligationState"),
("S12", "src/agent/obligation-tracker.ts", "export class ObligationTracker"),
("S13", "src/agent/loop.ts", "captureAcceptance(items:"),
("S14", "src/agent/advisory-bus.ts", "export class AdvisoryBus"),
("S15", "src/agent/runtime-advice-facts.ts", ""),
("S16", "src/agent/convergence-detector.ts", "const effectiveScore ="),
("S17", "src/agent/convergence-message.ts", ""),
("S18", "src/agent/score-history.ts", ""),
("S19", "src/tools/write-tool-helpers.ts", ""),
("S20", "src/agent/exploration-stall.ts", ""),
("S21", "src/agent/__tests__/convergence-detector.test.ts", ""),
("S22", "src/agent/delivery-gate-v2.ts", ""),
("S23", "src/agent/deliver-task.ts", ""),
("S24", "src/agent/evidence.ts", ""),
("S25", "src/agent/verification-snapshot.ts", ""),
("S26", "src/agent/verification-scope-current.ts", ""),
("S27", "src/agent/tool-pipeline.ts", "export function executeToolUse("),
("S28", "src/agent/approval-input-boundary.ts", ""),
("S29", "src/prompt/engine.ts", "export class PromptEngine"),
("S30", "src/agent/request-context-controller.ts", "export class RequestContextController"),
("S31", "src/agent/context-budget-preparation.ts", "export async function prepareContextRequest"),
("S32", "src/agent/compact-boundary-coordinator.ts", ""),
("S33", "src/context/request-budget.ts", ""),
("S34", "src/tools/tool-preset.ts", "minimal 36 / 26"),
("S35", "src/tools/default-registry.ts", ""),
("S36", "src/agent/tool-surface.ts", "export function describeToolSurface"),
("S37", "src/agent/work-order.ts", "const workerBudgetSchema"),
("S38", "src/agent/worker-runtime.ts", "export function createWorkerRuntimeFactory"),
("S39", "src/agent/worker-session.ts", "async function runWorkerSessionImpl"),
("S40", "src/agent/hands-session.ts", "const gateOn ="),
("S41", "src/agent/worker-write-gate.ts", "export async function evaluateWorkerWriteGate"),
("S42", "src/agent/worker-objective-gate.ts", "export function reconcileWithObjective"),
("S43", "src/agent/coordinator.ts", "result: reconcileWithObjective(order"),
("S44", "src/model/model-binding.ts", "export function resolveModelBinding"),
("S45", "src/config/provider-keys.ts", "export function findModelOwner"),
("S46", "src/api/fallback-client.ts", "getMainPrefixProof?.() ||"),
("S47", "src/memory/formation-policy.ts", ""),
("S48", "src/memory/essence-gate.ts", "export async function runEssenceGate"),
("S49", "src/memory/unified-memory.ts", "export function recallMemoryEntries"),
("S50", "src/agent/hooks/essence-gate-hook.ts", ""),
("S51", "src/agent/skill-distill.ts", "export function renderSkillDraftMarkdown"),
("S52", "src/agent/hooks/skill-distill-hook.ts", ""),
("S53", "src/skills/skill-loader.ts", "Two tiers:"),
("S54", "src/mcp/manager.ts", "export class McpManager"),
("S55", "src/plugins/plugin-loader.ts", "export async function initializePlugins"),
("S56", "src/tools/computer-use/bridge.ts", ""),
("S57", "src/tools/computer-use/stub.ts", ""),
("S58", "docs/architecture-overview.md", ""),
("S59", "docs/reference/observability-harness.md", ""),
("S60", "docs/CVM运行时对Agent模型的实证影响.md", "版权与许可"),
("S61", "docs/reference/cvm-cognitive-runtime.md", "版权与许可"),
("S62", "src/cli/entry.ts", ""),
("S63", "src/main.ts", ""),
]
PRODUCT = [
"src/server/runtime.mjs", "src/core/context/working-set.mjs",
"src/core/context/request-plan.mjs", "src/core/context/delivery-progress.mjs",
"src/core/tasks/task-plan-manager.mjs", "src/core/tasks/worker-manager.mjs",
"src/core/git-delivery.mjs", "src/core/models/model-hub.mjs",
"src/core/models/protocols.mjs", "src/core/memory/project-memory.mjs",
"src/core/evaluation/evaluation-manager.mjs", "src/core/browser/browser-manager.mjs",
"src/shared/contracts/task-plans.mjs", "docs/PLAN-1.25.md",
]
def git(root, *args):
return subprocess.check_output(["git", "-C", str(root), *args])
def digest(root, rel):
data = (root / rel).read_bytes()
return {"path": rel, "bytes": len(data), "sha256": hashlib.sha256(data).hexdigest(),
"lines": len(data.decode("utf-8").splitlines())}
def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("--source", required=True, type=Path)
parser.add_argument("--output", required=True, type=Path)
args = parser.parse_args()
source = args.source.resolve()
product = Path(__file__).resolve().parents[1]
assert git(source, "rev-parse", "HEAD").decode().strip() == PIN, "Unexpected source revision"
assert git(source, "status", "--porcelain") == b"", "Source checkout is not clean"
tracked = git(source, "ls-files", "-z").decode("utf-8").split("\0")[:-1]
ts = [p for p in tracked if p.startswith("src/") and p.endswith((".ts", ".tsx"))]
tests = [p for p in ts if "/__tests__/" in p or ".test." in p or ".spec." in p]
code = [p for p in ts if p not in set(tests)]
hooks = [p for p in code if p.startswith("src/agent/hooks/")]
entries = []
for identifier, rel, needle in SOURCES:
entry = {"id": identifier, **digest(source, rel)}
lines = (source / rel).read_text(encoding="utf-8").splitlines()
matches = [i + 1 for i, line in enumerate(lines) if needle in line] if needle else [1]
assert matches, f"Anchor not found: {identifier} {rel} {needle}"
entry.update(anchorLine=matches[0], anchorNeedle=needle,
url=f"{URL}/blob/{PIN}/{rel}#L{matches[0]}",
gitBlob=git(source, "rev-parse", f"HEAD:{rel}").decode().strip())
entries.append(entry)
result = {
"schemaVersion": 1, "repository": URL + ".git", "commit": PIN,
"commitInfo": git(source, "show", "-s", "--format=%cI%n%s", "HEAD").decode().splitlines(),
"packageVersion": json.loads((source / "package.json").read_text(encoding="utf-8"))["version"],
"codeLicense": "Apache-2.0",
"documentExceptions": ["docs/CVM运行时对Agent模型的实证影响.md", "docs/reference/cvm-cognitive-runtime.md"],
"documentExceptionLicense": "CC-BY-NC-ND-4.0; linked and license-recorded only; not reproduced or adapted",
"publicTree": {name: any(p.startswith(name + "/") for p in tracked) for name in ["desktop", "src/pro", "vscode-extension", "src/tools/computer-use"]},
"inventory": {"trackedFiles": len(tracked), "srcTsTsxFiles": len(ts), "testFilesByPathOrName": len(tests),
"sourceFilesByExclusion": len(code), "sourceLinesSplitlines": sum(digest(source, p)["lines"] for p in code),
"hookSourceFiles": len(hooks)},
"inventoryMethod": "git ls-files; src/ .ts/.tsx; tests are /__tests__/ or .test. or .spec.; UTF-8 splitlines counts; no tests executed",
"sourceFiles": entries,
"productBaselineCommit": git(product, "rev-parse", PRODUCT_PIN).decode().strip(),
"productFiles": [digest(product, p) for p in PRODUCT],
"executionScope": {"fullApplicationStarted": False, "thirdPartyDependenciesInstalled": False, "modelRequests": 0,
"pureProbeOnly": "Five reviewed modules; separate original output and driver are sealed alongside this index"},
}
args.output.parent.mkdir(parents=True, exist_ok=True)
with args.output.open("x", encoding="utf-8", newline="\n") as stream:
json.dump(result, stream, ensure_ascii=False, indent=2)
stream.write("\n")
print(json.dumps({"commit": PIN, "inventory": result["inventory"], "indexedSources": len(entries), "productFiles": len(PRODUCT)}, ensure_ascii=False))
if __name__ == "__main__":
main()
+118
View File
@@ -0,0 +1,118 @@
import assert from 'node:assert/strict';
import fs from 'node:fs';
import path from 'node:path';
import { createHash } from 'node:crypto';
import { execFileSync } from 'node:child_process';
import { fileURLToPath } from 'node:url';
// Research validation only: no fetch, credentials, model calls or third-party execution.
const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
const evidence = path.join(root, 'docs/tianshu-research-evidence');
const pin = '2d0b22e0b3554686e1e4131f8bdc568ef768e060';
const args = process.argv.slice(2);
let sourceRoot = null, useIndex = false;
for (let i = 0; i < args.length; i++) {
if (args[i] === '--index') useIndex = true;
else if (args[i] === '--source-root' && args[i + 1]) sourceRoot = path.resolve(args[++i]);
else throw new Error('Usage: node scripts/verify-tianshu-research.mjs [--source-root <checkout>] [--index]');
}
const sha = data => createHash('sha256').update(data).digest('hex');
const git = (cwd, ...gitArgs) => execFileSync('git', ['-C', cwd, ...gitArgs], { maxBuffer: 16 * 1024 * 1024, windowsHide: true });
function contained(base, relative) {
assert.equal(typeof relative, 'string');
assert.ok(relative.length && !relative.includes('\\') && !path.isAbsolute(relative));
const target = path.resolve(base, relative), rel = path.relative(base, target);
assert.ok(rel && !rel.startsWith('..') && !path.isAbsolute(rel), 'Path escapes research root');
assert.ok(fs.lstatSync(target).isFile(), 'Expected an ordinary file: ' + relative);
return target;
}
function checkBytes(bytes, row) {
assert.equal(bytes.length, row.bytes, 'Byte count: ' + row.path);
assert.equal(sha(bytes), row.sha256, 'SHA-256: ' + row.path);
}
const manifest = JSON.parse(fs.readFileSync(path.join(evidence, 'manifest.json'), 'utf8'));
assert.equal(manifest.sourceCommit, pin);
assert.equal(manifest.modelRequests, 0);
assert.equal(manifest.productCodeChanged, false);
assert.equal(manifest.files.length, new Set(manifest.files.map(row => row.path)).size);
let bytes = 0;
for (const row of manifest.files) {
checkBytes(fs.readFileSync(contained(root, row.path)), row);
if (useIndex) checkBytes(git(root, 'show', ':' + row.path), row);
bytes += row.bytes;
}
assert.equal(bytes, manifest.bytes);
const index = JSON.parse(fs.readFileSync(path.join(evidence, 'source-index.json'), 'utf8'));
assert.equal(index.commit, pin);
assert.equal(index.packageVersion, '3.37.4');
assert.equal(index.publicTree.desktop, false);
assert.equal(index.publicTree['src/pro'], false);
assert.equal(index.sourceFiles.length, 63);
assert.equal(index.sourceFiles.length, new Set(index.sourceFiles.map(row => row.id)).size);
assert.equal(index.productFiles.length, 14);
const report = fs.readFileSync(path.join(root, 'docs/TIANSHU-HARNESS-SOURCE-REVIEW.md'), 'utf8');
assert.ok(!report.includes('<!-- SOURCE_REFERENCES -->'), 'Unexpanded source links');
for (const row of index.sourceFiles) assert.ok(report.includes(`[${row.id}]: ${row.url}`), 'Missing pinned link ' + row.id);
for (const [, id] of report.matchAll(/\[(S\d+)\]/g)) assert.ok(index.sourceFiles.some(row => row.id === id), 'Unknown citation ' + id);
const probe = JSON.parse(fs.readFileSync(path.join(evidence, 'pure-probe-original.json'), 'utf8'));
assert.equal(probe.sourceCommit, pin);
assert.equal(probe.modelRequests, 0);
assert.equal(probe.fullApplicationStarted, false);
assert.equal(probe.thirdPartyDependenciesInstalled, false);
assert.equal(probe.productChanged, false);
const expectedModules = new Set(['src/agent/convergence-detector.ts', 'src/agent/convergence-message.ts',
'src/agent/score-history.ts', 'src/agent/runtime-advice-facts.ts', 'src/tools/write-tool-helpers.ts']);
assert.equal(probe.sources.length, expectedModules.size);
for (const module of probe.sources) {
assert.ok(expectedModules.delete(module.path), 'Unexpected or duplicate executable module');
const indexed = index.sourceFiles.find(row => row.path === module.path);
assert.ok(indexed);
assert.equal(indexed.sha256, module.sha256);
assert.equal(indexed.bytes, module.bytes);
}
const expected = [
['upstream-W4-high-error-fixture', 0.5164603132291642, 1, false],
['upstream-W4-repeated-read-baseline', 0.082125, 2, false],
['same-repeated-read-plus-high-error-ratio', 0.082125, 2, false],
['repeated-failing-read-actual-high-error-window', 0, 2, false],
['verification-waiting-protection', 0.082125, 1, false],
['no-tool-hard-stop-preserved', 0.048556689040178395, 3, true],
];
assert.equal(probe.cases.length, expected.length);
for (let i = 0; i < expected.length; i++) {
const [name, score, level, abort] = expected[i], row = probe.cases[i];
assert.equal(row.name, name);
assert.ok(Math.abs(row.result.score - score) < 1e-12);
assert.equal(row.result.level, level);
assert.equal(row.result.shouldAbort, abort);
}
// Research describes the frozen product baseline, not future working-tree code.
// Read Git blobs so later implementation never invalidates or rewrites old evidence.
assert.match(manifest.productBaselineCommit, /^[a-f0-9]{40}$/);
for (const row of index.productFiles) {
const blob = git(root, 'show', manifest.productBaselineCommit + ':' + row.path);
// The original index captured one CRLF Markdown checkout; Git stores LF.
// Restore only that line-ending representation, then require the original SHA.
const original = sha(blob) === row.sha256 ? blob : Buffer.from(blob.toString('utf8').replace(/\r?\n/g, '\r\n'));
checkBytes(original, row);
}
if (sourceRoot) {
assert.equal(git(sourceRoot, 'rev-parse', 'HEAD').toString('utf8').trim(), pin);
assert.equal(git(sourceRoot, 'status', '--porcelain').toString('utf8'), '');
for (const row of index.sourceFiles) {
const data = fs.readFileSync(contained(sourceRoot, row.path));
checkBytes(data, row);
const lines = data.toString('utf8').split(/\r\n|\n|\r/);
if (lines.at(-1) === '') lines.pop();
assert.equal(lines.length, row.lines, 'Source line count ' + row.id);
assert.ok(row.anchorLine >= 1 && row.anchorLine <= lines.length);
assert.ok(lines[row.anchorLine - 1].includes(row.anchorNeedle));
assert.equal(git(sourceRoot, 'rev-parse', 'HEAD:' + row.path).toString('utf8').trim(), row.gitBlob);
}
for (const [directory, present] of Object.entries(index.publicTree)) {
assert.equal(git(sourceRoot, 'ls-tree', '-d', 'HEAD', directory).length > 0, present);
}
}
console.log(JSON.stringify({ ok: true, sourceCommit: pin, files: manifest.files.length, bytes,
indexedSourceFiles: index.sourceFiles.length, productInputs: index.productFiles.length, pureCases: probe.cases.length,
sourceCheckoutChecked: !!sourceRoot, gitIndexChecked: useIndex, thirdPartyCodeExecutedByVerifier: false, modelRequests: 0 }));
+19
View File
@@ -1,5 +1,24 @@
# Agent Workbench:核心代理能力研究与产品计划
## 本轮:要求与证据复核、单轮进展观察
- [in_progress] 核对并封存既有未提交研究;离线原字节、固定源码和索引验证后本地提交。
- [pending] 复用 Task/计划/成果凭据,落地用户来源、要求修订及当前证据复核;相关契约、HTTP、恢复与界面验证,回顾并提交。
- [pending] 增加单轮外显事实 shadow 观察,区分分页增长、重复读取、失败、等待和研究;不修改停止、权限或预算。固定案例及实际宿主验证,回顾并提交。
- [pending] 构建与受影响入口验收、阶段证据和文档收尾;独立发行/实际安装/正式升级未完成前只标开发切片,不冒称产品交付。
本轮真实模型预算0,正式仍1.24.8;V诊断partial、T/R/P/O原失败、重复读取与Purge收益未验证保持,不续跑旧样本。不委派、不推送、不读取或重存Key、不重启原正式Provider。
恢复时集合根目录并非Git且指定文件不存在,定位Agent-Workbench后继续。两次宽批读输出被截断,后续限定文件短段,不将截断内容记作审查完成;一次旧路径src/web不存在,改用实际清单。
## Tianshu 源码研究执行清单
- [complete] 固定公开源码 2d0b22e0b3554686e1e4131f8bdc568ef768e060;不安装依赖、不启动应用,核对 Apache-2.0 与文档局部许可。
- [complete] 深读五阶段 hooks、AdvisoryBus、收敛检测、任务契约、交付门、前缀缓存/实际压缩、worker 与模型绑定入口,逐项对照本产品已有实现。
- [complete] 五个已读纯模块隔离探针六场景:高错误率减轻催促公式存在反例;原始输出 .qa/tianshu-research/pure-probe.json 保留。没有模型请求。
- [complete] 精读模型连续性、审批/执行顺序、worker 预算与记忆准入;区分真实调用、未接线实现、作者主张。写工复验当前失败即终止,没有自动一轮修复。
- [complete] 深度报告、分阶段采用计划、源码清单/行号/SHA 与原探针封存;8份/113756字节首离线核验与63固定源码、14产品输入、6纯探针通过。验证器改为从固定产品Git基线复核历史,避免后续实现污染研究依据;最终索引另核对。研究不改正式服务与产品源码。
## 当前:V已封存,Tianshu-harness源码研究
V唯一诊断partial:auto/IPv6 TLS通过,独立IPv4握手超时;按冻结计划在身份预检前结束,模型/HTTP请求0。65项目81会话6377记录13484事件/outbox、3720工件和225尝试、原PID36552/Provider及公开配置保持,9/1/73修订均未变,9229关闭。46份/38772720字节证据离线通过,见docs/QA-LIVE-DELIVERY-V.md及回顾。多历史诊断的显示排序误比已用只读ID核对更正,首失败保留、不重跑。