Skip to content

[native] qoder: three-mode alignment (proxy / launcher / native plugin) + runtime-info #960

Closed

Description

@ranxianglei

Goal

Bring qoder to full three-mode alignment like pi / opencode / dsh already have:

  1. Mode 1 — proxy (URL prefix, exists today via launcher)
  2. Mode 2 — launcher (bili qoder — exists)
  3. Mode 3 — native plugin (bili plugin install qoder — the gap): plugin loaded by the CLIENT itself, spawns/attaches its own proxy, rewrites model traffic, registers ACP tools natively, stamps plugin-mode headers, implements the runtime-info protocol.

Feasibility pre-assessment

UNKNOWN — research first: plugin/extension surface (config rewrite, request headers, native tool registration)? Follow the dsh playbook if yes.

Reference implementations (read these first)

Requirements if feasible

  • No launcher, no env vars, no fixed port for the end user; opt-out env BILI_NATIVE_QODER=0
  • Plugin-mode gating: stamp x-bili-plugin ONLY after native tools are registered (round 1 rides wire mode)
  • Parent-pid watchdog proxy teardown; attach to a healthy proxy when present
  • Runtime-info stamps (model + contextWindow + maxOutput whenever the client exposes them)
  • npm run typecheck + npm test + npm run build green; new tests for the plugin module (see tests/dsh-native.test.ts for the harness style)
  • README (en + zh) client table + install section updated

If NOT feasible

Post the evidence (what extension points exist, why wire interception / native tools are impossible) and close as wontfix — a documented no is a deliverable too.

For ework

This issue is directly implementable. Follow the dsh playbook; ask in this thread before inventing new protocol surface. PR must reference this issue (Fixes #N).

Activity

  1. ranxianglei commented on Sep 18, 2026

    @ranxianglei
    OwnerAuthor

    🤖 Powered by ework · qwen3.8-27b

    [bot] 🏷 开工。已查重:无重复(此前 qoder 相关只有 launcher 支持 #653/#654/#693 和 open PR #765)。当前在按 dsh playbook 做可行性预研:读 dsh-native.ts / opencode-native.ts / runtime-info 协议,并调查 qoder 自身的插件/扩展面(能否加载本地 JS、能否改请求头、能否注册原生工具)。结论或 PR 会回贴到这里。

  2. ranxianglei commented on Sep 18, 2026

    @ranxianglei
    OwnerAuthor

    🤖 Powered by ework · qwen3.8-27b

    结论先行:按本 issue 定义的 mode 3 对 qoder 不可行。按 issue 的 fallback 条款(If NOT feasible → post evidence + close as wontfix),以下是完整调研证据。

    调研方法

    • 官方文档:docs.qoder.com/cli(plugins / plugins-reference / hooks-reference / settings-reference / mcp-reference / custom-models / network / installation)
    • 实证:下载并解包 @qoder-ai/qodercli@1.1.56(npm latest;npm 兼容安装通道,bin 为 bundle/qodercli.js ~34MB JS bundle),对插件加载器、env var 面、请求路径代码做了逐项 grep 核对。

    qoder 的真实扩展面(v1.1.56)

    1. Plugin = 纯声明式 bundle:.qoder-plugin/plugin.json(另兼容 .claude-plugin/,即 Claude Code 插件格式)+ commands/*.md + agents/*.md + skills/SKILL.md + hooks/hooks.json + output-styles/ + bin/(仅加入 PATH)+ .mcp.json。没有任何把用户 JS 加载进 qoder 进程的机制——bundle 里唯一的 runtime/main.cjs 属于 qoder 内部 sites MCP host(plugins/cache/qodercli-bundler/qoder-sites),不是用户可用面。这是与 pi/opencode/dsh(均有进程内模块加载)的根本差异。
    2. Hooks = 27 个生命周期事件(PreToolUse / UserPromptSubmit / SessionStart / PreCompact / …),执行方式 command / http / prompt / agent,全部是外部进程或独立模型调用。没有任何 model-request 相关事件,无法修改或拦截出站请求。
    3. MCP client 完整支持(stdio / sse / streamable-http / websocket)——原生工具注册可行,是少数能做到的项。
    4. 模型流量路由 = 仅 env var:HTTPS_PROXY / NODE_EXTRA_CA_CERTS / SSL_CERT_FILE,官方文档明确 "Proxies are read at startup; you must restart Qoder CLI after making changes"。settings.json 无模型 endpoint/baseURL/CA 配置键(对照全量 configuration reference 逐项核对);枚举 bundle 读取的全部 QODER* env var,无模型流量覆盖项(仅 QODERCLI_CDN_BASE_URL(CDN 资产)、QODER_TEST_*(测试域名));BYOK 是按账号下发的固定 provider 目录,官方明确禁止手改 settings.json,且只影响所选自定义模型,不影响内置模型流量。

    对照 mode 3 需求逐项

    需求 可行性 原因
    插件由客户端自身加载 ✅ 声明式 install 正常
    自启/附着自己的 proxy ⚠️ 部分 可作为 MCP server 进程的副作用实现(parent-pid watchdog 可做),但没有流量路由时 proxy 收不到任何请求
    rewrite 模型流量 ❌ 无 env var 时不存在任何路径把内置模型请求送到 bili:无 fetch patch 点、无 baseURL 设置、无请求 hook。env var 只在进程启动时生效,插件无法对已运行的 qoder 补设——直接违反 "no launcher, no env vars" 硬要求
    stamp plugin-mode headers(x-bili-plugin 等,toolsReady 门控) ❌ 需要拦截每个出站请求;qoder 无此拦截面(bundle 中仅有的 "interceptor" 命中全部是 grpc-js 内部件)
    runtime-info protocol(#955/PR #956) ❌ 同上,per-request header 无从 stamp

    为什么剩余路径也不成立

    • "MCP 伴生工具插件"(MCP 注册 decompress/acp_status/search_context + 自启 proxy):没有流量路由,压缩引擎永远看不到请求;若用 mode 2 的 env var 路由流量,则今天的 wire mode 已经提供完整功能——proxy mode 下 bili 拥有 wire 上的 ACP 工具名,同名客户端工具在注入前被丢弃(src/server.ts:2694–2710,opencode v1: keep opencode-acp legacy sessions working after switching to bili #920)。即 MCP 版工具会被 proxy 从请求体里剥掉,模型看到的是 bili 的 wire 版本,MCP 通道净价值 ≈ 0,却多一个要维护的协议面。若要这个伴生方向请另开 issue 讨论(本 issue 规则:invent new protocol surface 前先问)。
    • native standalone build(curl 安装脚本,推荐安装方式)不跑 Node,扩展面比 npm build 更窄,结论不变;CN 站点版(~/.qoder-cn / QODERCN_*)架构相同,结论不变。

    附注

    qoder 自带 native context compaction(hook 事件表含 PreCompact/PostCompact),长上下文管理并非完全缺位;bili 能带来的是 ACP 级压缩摘要,但路由缺口不可逾越。

    处置

    按 issue 定义,documented no 本身就是交付物。我这边没有修改 issue 状态的权限——若认可以上证据,请将 #960 关闭为 wontfix(或打标签)。如需跟踪假想的 "MCP 伴生" 方向,建议另开新 issue 先讨论范围。

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

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