Skip to content

[1.5.0] rubash-as-engine: a stable embeddable API to replace partial shells like brush-core in editor integrations #595

Closed

Description

@caomengxuan666

Owner direction (2026-10-13): rubash should be embeddable as a library engine — target scenario: editor-integrated shells (Zed's built-in terminal/tasks currently embeds brush-core; owner has tested brush and found it semantically crippled — "轻量是功能残缺的遮羞布").

Where we already are

  • lib+bin layout: parser/lexer/executor/script_driver all in-lib; rubash#593 just API-fied the stdin-script driver (run_stdin_script(executor)).
  • GNU goldens byte-pinned semantics — the differentiator vs brush's syntax-compatible/semantics-subset approach.

The gap (cost-ordered)

  1. Session-level embeddable API (core work): input injection, output stream takeover, lifecycle, event callbacks, multi-session — currently only driver-level (Executor/Shell). Design an RFC against brush-core's consumer interface shape.
  2. unix functional parity: unix builds are cfg-strip-clean only; embeddable unix needs real interactive semantics there.
  3. Size budget: an order of magnitude larger than brush (full bash semantics) — acceptable for editor bundling; correctness is the decision variable, not footprint.
  4. API stability commitment: semver discipline + MSRV + changelog for downstreams.

Suggested 1.5.0 plan

  • API design RFC (对标 brush-core consumer surface)
  • brush vs rubash semantic coverage matrix (goldens data already proves it)
  • Minimal embed PoC (Zed extension or a thin pure-embed consumer of the lib)

Not blocking 1.4.0.

Activity

  1. added
    enhancement
    P3-low
    on Oct 13, 2026
  2. changed the issue type fromtoon Oct 13, 2026
  3. caomengxuan666 commented on Oct 13, 2026

    @caomengxuan666
    MemberAuthor

    Owner direction (2026-10-13): yes to layering — as the structural first cut of this project, together with the API RFC.

    Proposed workspace split (dependency direction bottom-up; matches the existing one-way module deps in src/, so the split cost is low):

    rubash-core          lexer / parser / executor / variables / builtin semantics
                         pure engine: no terminal, no COM, no ConPTY, no git2
                         <- the embedder's primary surface; strictest semver promise
    rubash-driver        non-interactive drivers (#593's run_stdin_script lives here)
    rubash-interactive   readline / ConPTY / paste-chunk / prompt theming / git2
                         Windows-heavy, fast-iteration layer
    rubash (facade)      re-exports everything + bin + default assembly
                         <- niubash keeps importing exactly this one crate
    

    Benefits: embedders take core without the interactive layer's Windows deps; the layer boundary doubles as the semver stability boundary (core strictest, interactive free to move); workspace single-version publishing (brush-mode); niubash's version-only lock semantics unchanged.

    Caveats: single-crate internal-refactor freedom narrows once layers carry semver — keep the first cut coarse (3-4 layers, resist sub-layer sprawl); do it after 1.4.0 ships, as the opening move of the API RFC (the layer boundary is where the embeddable API lives).

  4. caomengxuan666 commented on Oct 18, 2026

    @caomengxuan666
    MemberAuthor

    1.5.0 RFC draft v1 已落:docs/design/1.5.0-workspace-and-engine-api.md(PR #814)。

    三支柱:①四层 workspace 拆分(core/driver/interactive/facade,粗粒度先行,CI 钉依赖方向);②Session 级嵌入 API(RFC 冻结 pub 面;消费者序 = niubash → oh-my-pi #15582 → Zed PoC;验收 = 无 ConPTY/Win32 的编辑器内 REPL demo);③引擎/宿主边界形式化(846 env-IPC → typed bridges,#359 案 A 是第一块实体)。

    火车:1.4.1 修复 wave / 1.4.2 #359 loader / 1.4.3 typed writer / 1.5.0 三支柱 + unix 交互 harness + debugger M0。

    地基盘点(~30% 已落):#593/#314 driver API、#606 usage lib、#570 契约测试、#746 棘轮、#729/#728 carrier 审计、#359 设计。

    开放决策 D1-D5 见 RFC §8(#359 案 A、RFC 形态、debugger DP1-DP3、carapace 预装、1.4.1 发版时机)。

  5. caomengxuan666 commented on Oct 25, 2026

    @caomengxuan666
    MemberAuthor

    Finalized — 2026-10-25. The detailed Session API RFC is approved as written and lands in the tree with PR #1535 (docs/design/1.5.0-session-api.md, extending the RFC v1 in docs/design/1.5.0-workspace-and-engine-api.md). The §11 decision points are settled, each per the recommendation recorded in the document:

    • Q1 — synchronous core for 1.5.0; async facade later, only on demonstrated demand.
    • Q2 — observer trait for host events.
    • Q3 — workspace lockstep versioning through 1.5.x; revisit at the next major.
    • Q4 — the syntax surface is tier-B api::syntax view types; the internal Ast is not frozen into tier A.
    • Q5 — the threading contract is explicitly single-threaded: one Session per thread, stated in the docs and in the types.
    • Q6 — only fds 0/1/2 are injectable in 1.5.0.
    • Q7 — a new #[non_exhaustive] SessionError / ParseFailure; the existing error types stay internal.
    • Q8 — both interrupt surfaces: Session::interrupt() and inject_signal().

    The full decision record is §12 of the landed document. This RFC and the #497 debugger design are finalized together as one 1.5.0 implementation program (split and debugger interleaved, module by module); the plan is established, and work starts with the API ledger + niubash-pairing CI groundwork (the §9 M-0 step), then the mechanical split.

  6. added 2 commits that reference this issue on Oct 25, 2026
  7. added
    deferred
    on Oct 29, 2026
  8. caomengxuan666 commented on Oct 29, 2026

    @caomengxuan666
    MemberAuthor

    按实现关单(2026-10-29)。本单的提案已定版并全量落地:

    残余契约缺口均已单独立案、归发布后契约批:#2001(call_function 无 env 通道)、#2039(close 无最终状态回传面)、#2040(OptionsView::set 不能武装 flag-only 选项)。

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

Metadata

Metadata

Labels

P3-lowdeferredenhancement

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions