Skip to content

Accelerator 已增强,但其定位与 Machine 的关系仍需设计讨论 #18

Description

@yzxoi

背景

原 issue 指出 Accelerator 只有 state 字段、run() 就是 fire 的 wrapper,近乎无价值。

当前状态(2026-06-05)

PR #110(统一 MachineState)、#111(SpawnTool)后,Accelerator 已不再是纯 wrapper:

pub struct Accelerator {
    id: AcceleratorId,
    pub name: Name,
    body: AcceleratorBody,
}
  • primitive() / composite() / composite_named() 三个构造器
  • inject_tool() 注入 spawn worker
  • run_with() 入口
  • merge_input() 内部拼接
  • AcceleratorBodyPrimitiveComposite 变体已 boxing

但仍然可以问:

  • Accelerator 是否应该持有 metrics / hooks 等 runtime 实体信息?
  • 它跟 Machine 的关系是否应该进一步简化?
  • 是否应降级为函数风格,让 Graph 直接持有 State?

原则问题未变:machine / accelerator 层走 strong type 还是 function-heavy 风格?

关联

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions