Skip to content

feat: replace the component roster with preset-mode switches - #430

Merged
T-Auto merged 1 commit into
mainfrom
feat/mode-components
Oct 27, 2026
Merged

T-Auto merged 1 commit into
mainfrom
feat/mode-components

Conversation

@T-Auto

@T-Auto T-Auto commented Oct 27, 2026 •

Copy link
Copy Markdown
Owner

Closes #429

What was wrong

  • 组件 roster 是能力维度(shell/file/ptc/discovery/panel/tui/hide-official),与 DSH 内置 agent preset 不对齐;插件对所有会话全局发布 OPS 工具,无法按“极简/标准/PTC/创造”模式分别开关。
  • 官方工具替换需要逐项 opt-in(replaceTools),与新需求“模式启用即自动替换、兼容模式才恢复官方工具”相反。
  • 0.4.1 只导出 ./panel/icon,宿主只能为“启动数据检测”一行解析到 OPS 图标,其余组件行静默回退默认图。

The change

  • 8 行 roster:mode-minimal / mode-standard / mode-ptc / mode-cordis / discovery / compat / panel / tui;旧 shell/file/ptc/hide-official/background 模块保留为 legacy 导出(已保存的旧行 override 会得到一条 patch: entry ... not found 启动警告),从 cordis.patch.yml 移除。
  • 按预设门控(src/modes/):
    • mode-standard/mode-cordis:只对对应 preset 的 agent 在 agent scope 发布 ops_inspect_local_file/ops_glob/ops_grep/ops_read_files/ops_result,并在 OPS 对端可见时隐藏官方 read/glob/grep。
    • 所有模式在 Windows 上隐藏 pwsh/pwsh_persistent 并发布 ops_bash(仅当 ops_bash 可见;POSIX 保持宿主 bash)。
    • mode-minimal:保留极简提示词,不发布 native 文件工具、不发布路由段。
    • mode-ptc:对 PTC-only presentation 的 ptc preset 发布 PTC SDK API,仅替换 Windows shell。
  • 兼容模式:dsh-ops/compat 启用时不隐藏任何官方工具(模式行已发布的 OPS 工具保留);关闭后重新隐藏。运行时切换通过 registry 事件立即生效。
  • 动态加载独立开关:dsh-ops/discovery 对所有 native 会话发布 ops_discover_tools(含 Minimal),PTC-only 不发布;某模式行启用时其 resident 工具不再作为发现选项;未启用模式行时池中保留全部 advanced 工具。
  • 图标/元数据:新增 5 个组件目录(index/package.json/en+zh locale/PNG icon),为所有 8 行导出 ./<c>、./<c>/package.json、./<c>/locale/*.json、./<c>/icon;dsh-plugin.json x-components、x-prompt-sections、cordis.patch.yml 同步为 8 行;包/清单/native crates 升到 0.5.0。
  • 客户端设置:4 个 mode 行复用 shell 表单(dsh-ops#dsh-ops-mode-*),discovery 保持自有表单;carrier 迁移只切换 bundle 名,把 standard 行 name 改成包根 dsh-ops(包根 entry 现在应用 standard 模式)。
  • 刻意不做:不改宿主源码、不 monkey-patch 共享工具注册表;不隐藏 PTC 的 read/glob/grep(PTC 只替换 Windows shell);不自动清理用户 profile 里的旧行 override(CHANGELOG 给出升级步骤)。

Validation

  • npm run build:通过(tsc + client bundle + 55 assets)。
  • node scripts/validate-manifest.mjs:all 140 checks passed。
  • npm run check:size:426 code files,均 ≤1000 行。
  • node test/run.mjs(Windows 本机、规范门禁、无 DSH_OPS_REQUIRE_RUNTIME):146 suites passed, 4 skipped, 0 failed(4 个 skip 为环境性:linux-attributes/linux-shell 为 POSIX-only,tui-host/tui-native 缺 DSH_OPS_TUI_ROOT)。
  • 新增 test/modes.test.mjs(8 checks,真实 bootHost + createScope/preset 桩):模式门控、官方替换/兼容模式恢复/dispose、cordis、discovery(minimal 始终注入、resident 不进发现池、PTC-only 不发布)、PTC 模式、预设切换接管。
  • worker:npm run build:ptc 已按 0.5.0 重建并 stage,provenance 与 package version 一致;npm run build:bash-ipc 已生成 Windows 受限 IPC 载荷(bash-ipc 套件 8/8 通过)。

CI: 本 PR 由 pull_request 触发 Cross-platform validation:https://github.com/T-Auto/dsh-ops/actions/runs/40453634594

  • CI required passed;validate-windows (win32-x64) / validate-posix (linux-x64, darwin-arm64) / validate-macos-intel / node-floor / source-size / tools-trial / workflow-lint 全部 pass;bench-smoke skipping(按仓库规则)。

Replace the seven-row component roster with eight rows that select the
built-in agent preset each enhancement applies to, plus an independent
dynamic-loading switch and an inverted compatibility fallback.

- Add mode-minimal, mode-standard, mode-ptc and mode-cordis rows. Each
  publishes only for sessions composed from its preset: Standard and Cordis
  add resident OPS file tools and replace read/glob/grep, every mode replaces
  the Windows shell with ops_bash once its OPS counterpart is visible.
- Add the compat row: while enabled, official tools stay exposed and no
  replacement is hidden; OPS tools remain published.
- Keep dynamic loading independent of the mode rows and stop offering a
  mode's resident capabilities as discovery choices.
- Export icon, locale and package metadata for every shipped component so
  the host renders the OPS artwork on all component rows.
- Bump package, manifest and native crates to 0.5.0; derive the optional
  client carrier from the standard-mode row and document the migration.

Validation: npm run build; validate-manifest 140 checks passed;
node test/run.mjs 146 passed, 4 environment skips, 0 failed; check:size ok.
@T-Auto T-Auto added the enhancement New feature or request label Oct 27, 2026
@T-Auto
T-Auto merged commit a6e215a into main Oct 27, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[设计] 组件开关与入口大改造:四个原版模式优化 + 动态工具加载 + 兼容模式

1 participant