openpencil/crates
Kayshen-X 354ffb31b2 fix(shell-core/chat): replace direct-HTTP provider model with 4-backend architecture
User correction: the previous `chat_provider.rs` (commits `548c5336`
+ `2c2b7f60`) assumed a direct-HTTP-per-provider model with
Anthropic / OpenAI-compat / Gemini / etc. each carrying its own
endpoint + model defaults. That's not the architecture decision —
per the project_agent_runtime memory, OP runs FOUR distinct
backend categories:

  - BuiltIn          → `agent-rs` QueryEngine in-process (the
                       cross-product Rust agent crate; lives at
                       /Users/kayshen/Workspace/ZSeven-W/agent-rs)
  - Subprocess(Cli)  → spawn `claude` / `gemini` / `gh-copilot` +
                       talk line-delimited JSON over stdio
  - HttpServer(Cli)  → spawn `codex serve` / `opencode serve` +
                       hit local HTTP endpoint with reqwest
  - Acp              → Agent Client Protocol (ndJSON over stdio),
                       the open extension point for third-party
                       agents OP doesn't ship a dedicated adapter for

API rewrite in `chat_provider.rs`:
  - `CliName::{ ClaudeCode, Gemini, Copilot, Codex, OpenCode }`
    enumerates the 5 first-party CLI backends. Each carries
    `label()` (human display), `default_binary()` (PATH lookup),
    and `backend()` (which Subprocess/HttpServer transport it
    uses — table matches the memo verbatim).
  - `ChatProviderKind::{ BuiltIn | Subprocess(CliName) |
    HttpServer(CliName) | Acp }` replaces the previous flat
    Anthropic/OpenAI-compat/etc enum.
  - `ChatProviderConfig::new(kind)` pre-fills `binary` from
    `default_binary()` for Subprocess/HttpServer kinds; BuiltIn
    and Acp leave it empty.
  - `ChatProvider` trait + `EchoProvider` test double unchanged.
    The streaming `ChatDelta` shape stays close to agent-rs's
    `stream::Event` (TextDelta / Thinking / ToolUse / Done /
    Error + StopReason variants).
  - Real transport implementations live in the future
    `pen-agent-cli` desktop crate per the memo — shell-core stays
    wasm32-clean (no tokio / reqwest / process-spawn).

Tests (4 new + 1 carried):
  - cli_name_backend_table_matches_architecture_memo (verbatim
    map from the memo's table)
  - cli_default_binary_uses_expected_names
  - provider_config_new_seeds_binary_for_cli_kinds (BuiltIn / Acp
    leave it empty)
  - cli_label_is_human_readable
  - echo_provider_replays_script (carries the test double's
    behavior forward)

Tests total: 250 shell-core. Wasm32 build clean.
2026-05-14 15:59:11 +08:00
..
openpencil-app feat(openpencil-app): skeleton crate (Stage F entry placeholder) 2026-05-03 22:05:00 +08:00
openpencil-desktop fix(shell): 3 codex stop-gate regressions (anchor drag, MCP id, doc load reset) 2026-05-14 15:18:02 +08:00
openpencil-shell-core fix(shell-core/chat): replace direct-HTTP provider model with 4-backend architecture 2026-05-14 15:59:11 +08:00
openpencil-shell-native fix(shell): 3 codex stop-gate regressions (anchor drag, MCP id, doc load reset) 2026-05-14 15:18:02 +08:00
openpencil-shell-web feat(shell): export dialog + multi-format raster (PNG/JPEG/WEBP) + Property-panel preview 2026-05-14 14:02:52 +08:00
pen-codegen chore(workspace): cargo-deny 0.18 activation (Phase 1 Task 1.8 Step 6) 2026-05-03 23:05:00 +08:00
pen-core chore(workspace): cargo-deny 0.18 activation (Phase 1 Task 1.8 Step 6) 2026-05-03 23:05:00 +08:00
pen-engine chore(workspace): cargo-deny 0.18 activation (Phase 1 Task 1.8 Step 6) 2026-05-03 23:05:00 +08:00
pen-figma chore(workspace): cargo-deny 0.18 activation (Phase 1 Task 1.8 Step 6) 2026-05-03 23:05:00 +08:00
pen-types feat(pen-types): skeleton crate (bucket A) 2026-05-03 22:35:00 +08:00
wasm-libc-shim style(shell): cargo fmt --all (rustfmt-clean) 2026-05-10 18:47:33 +08:00
CLAUDE.md feat(shell): canonical .op loader + jian-core layout + visual fidelity pass 2026-05-14 09:26:08 +08:00