Skip to content

[ps1-exit] T5 拆解 Invoke-SentruxAgentTool.ps1(114KB wrapper) #50

Description

@2233admin

2026-07-27 票面修正:原票描述的"shim 管理/pro 激活/失败归一化在此文件"经 T1 盘点(#46,docs/ps1-exit/contract-inventory.md §0)证伪。以实测为准重写如下。

目标

拆解第二块巨石 Invoke-SentruxAgentTool.ps1(~114KB)。它的真身(T1 实测)= 11 个 tool operation 的 DSM/git-churn/复杂度指标引擎,被 run-code-intel.ps1 消费其中 3 个操作(dsm/evolution/what_if);sentrux check/gate 管线步走的是独立的 tools/sentrux-shim/,与本文件无关。

sentrux 分析内核已在 Rust(sentrux.rs / sentrux_analysis.rs / sentrux_gate.rs,sentrux-native 2.0.0)。

做法

  1. 按 T1 inventory §2 的 21 行行为表逐操作判三类:
    • Rust 已有等价(sentrux-native 已覆盖的 DSM/复杂度面)→ 指认,删
    • 独有且要留(如 evolution/what_if 等 Rust 侧尚无等价的操作)→ port 进 Rust
    • 独有但该死(无消费者的操作;11 个里只有 3 个被 run-code-intel.ps1 调用,其余 8 个逐一核实外部消费者)→ 宣告死亡
  2. 失败归一化契约(code-intel-sentrux-failures.v1)在 run-code-intel.ps1 本体(:2741 New-CodeIntelSentruxFailures)——归 T2 launcher 收编范围,不在本票。
  3. tools/sentrux-shim/ 三件套(shim 管理+pro 激活,906 行,T1 §3 已盘)在本票一并处置:doctor 绝对路径解析(PR fix(security): resolve tool paths absolutely, close digest evidence gaps #56 tool_path.rs)落地后,shim 的转发价值重估——留 or 退役,给出证据结论。SENTRUX_AUTO_PRO opt-in 语义(PR fix(security): resolve tool paths absolutely, close digest evidence gaps #56)不回退。

出口

  • 114KB → 0 或 ≤50 行 shim
  • 11 操作逐个有归宿(Rust 等价指认/ported/宣告死亡+理由)
  • tools/sentrux-shim 处置结论落地
  • .sentrux 自扫 green(cycle=0 不回归)

依赖

T1 先行(已交付,见 #46 / PR #57);与 T3/T4 可并行。

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions