Skip to content

[ps1-exit] T4 模型通道执行体 Rust 化(sealed judgment plane 地基) #49

Description

@2233admin

目标

模型通道执行体 Rust 化:Invoke-ModelChannelDelegate.ps1 → judgment plane 的 Rust 实现。路由/回退/成本域已在 Rust(model_channels.rs),PS1 里剩的是执行体(HTTP 调用、子进程管理、失败分类、产物落盘)。这是 sealed judgment plane 的地基:LLM 判断必须 optional / cached / attributable / 可过期,执行体在 Rust 才能跟 artifact 契约与 digest spine 原生打通。

做法

  1. Rust 侧实现三协议(anthropic/openai/ollama)执行体,保持 PR fix(ai-safety): prompt injection boundary, hardened model delegate, audit regression fixtures #44 刚落的语义不回退:
    • HTTP 失败分类 status-code-first(429→provider_quota,401/403→config_error,404/503→provider_unavailable,其余→local_tool_error;body 不进分类器)
    • stdout 字节预算(4MB cap,超限杀进程报 adapter_protocol_error)
    • 三协议都带显式输出上限(max_tokens / num_predict)
  2. fixture parity:现有 tests/test-model-channel-delegate.ps1 套跑 Rust 路径,产物(model-channel-result.json / model-adapter-result)逐字段对齐。
  3. PS1 shim 化。

出口

  • 三协议 fixture parity green
  • 失败分类矩阵有 Rust 单测(每个 status→category 一条)
  • Invoke-ModelChannelDelegate.ps1 ≤50 行或删除

依赖

T1 先行;与 T3/T5 可并行。注意与 PR #44 的合并顺序,别把它的修复迁丢。

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