跳转到内容

概念

本节解释 Bub 的设计模型:内核为何小、一次 turn 究竟做了什么、context 如何从 tape 重建,以及三个扩展面在哪里相遇。

第一遍按顺序读完四个页面。每页都很短且自洽:

  1. Philosophy — 内核为何严格、插件为何宽松,以及 operator 为何对等。
  2. Turn pipelineprocess_inbound 顺序执行了什么、各处 fallback 何时生效。
  3. Tape and context — append-only 的 tape 如何变成模型 context window。
  4. Surfaces — channel、skill 与 tool 这三条独立扩展轴。

第一遍之后,把每页当参考,按需返回查阅。

下面这张图会在 Turn pipeline 中详细展开:

flowchart TB
  subgraph row1[" "]
    direction LR
    inbound(["inbound envelope"]) --> resolve["resolve_session"]
    resolve --> load["load_state"]
    load --> prompt["build_prompt"]
    prompt --> model["run_model<br/>[_stream]"]
  end
  subgraph row2[" "]
    direction RL
    save["save_state<br/>(finally)"] --> render["render_outbound"]
    render --> dispatch["dispatch_outbound"]
  end
  model --> save
  style row1 fill:transparent,stroke:transparent
  style row2 fill:transparent,stroke:transparent

save_state 始终在 finally 块中执行;render_outbounddispatch_outbound 仅在 turn 成功时执行。

每个术语跳到其定义所在页面:

  • Hook — 内核在一次 turn 中调用的 pluggy 扩展点。
  • Plugin — 任何注册到 bub entry-point 组的包。
  • Tape — 单个 session 的 append-only 事实序列。
  • Entry — tape 上的一条不可变记录。
  • Anchor — 内核可据以重建 context 的检查点。
  • Handoff — 受约束的阶段过渡,会写入新的 anchor。
  • Channel — 对外 I/O 表面(CLI、Telegram 等)。
  • Skill — operator(人或 agent)按名字调用的可复用流程。
  • Tool — 模型可调用的有类型动作。
  • Envelope — 在 turn pipeline 中传递的 duck-typed 负载。