Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 15 additions & 14 deletions README.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,25 +29,26 @@ Supported: Windows x64, Linux x64, and macOS 13+ on Apple Silicon or Intel
(`darwin-arm64`, `darwin-x64`). See [macOS](docs/macos.md).

> [!IMPORTANT]
> This branch is the **0.4.0 release candidate**, not a published release. Approved acceptance requires
> at least 40% less BM-01 output than OPS 0.3.x; the official reader is a separate comparison.
> BM-03 limits file/discovery schemas to 400 tokens while keeping Bash at startup and reporting the
> full total separately. Final measured evidence and functional CI are both required.
> See [release status and limitations](docs/release-0.4.0.md). Commands using `@latest` below select
> the published package; build and pack this checkout to evaluate the candidate.

- Native starts with `ops_read_files` and `ops_discover_tools`; the default profile enables the shell row
and publishes `ops_bash` on every platform. Advanced tools activate in the owning agent's next
provider request.
> This branch is the **0.5.0 candidate**, not a published release: the component roster moved to
> preset-mode rows. Commands using `@latest` below select the published package; build and pack this
> checkout to evaluate the candidate. See the [changelog](docs/CHANGELOG.md).

- The default profile enables the four preset-mode rows: Standard and Cordis publish the resident
OPS file tools, PTC publishes its typed SDK, and Minimal replaces only the Windows shell;
its sessions receive the `ops_discover_tools` entry whenever the discovery row is enabled. A mode row replaces the official
Windows shell with `ops_bash`. Advanced tools activate in the owning agent's next provider request.
- The PTC SDK catalogue has 18 APIs: 15 file/document tools, batch, result references and its loader.
Only the configured resident or selected APIs are exposed. Native and PTC use separate outputs.
- Discover bounded CSV/TSV, DOCX main-body paragraphs and a restricted PDF text layer. Binary DOC,
OCR, general PDF rendering, web search and HTML crawling are not implemented. Read the
[document-format limits](docs/native-kernel.md) before choosing a reader.
- Seven independently toggled rows preserve saved profile IDs and settings. Per-tool official
replacements are off by default. [Settings](docs/configuration-reference.md) include validated
built-in forms and optional browser pages with an explicit offline carrier migration.
- The shell row is on by default on all three platforms: Windows uses the pinned Bash payload
- Eight independently toggled rows: the four mode rows and discovery start on; Compatibility,
panel and TUI start off. An enabled mode row hides the official tools it replaces (read/glob/grep
plus the Windows pwsh); Compatibility mode keeps the official tools visible. Saved overrides for
the removed `shell`/`file`/`ptc`/`hide-official` rows must be deleted.
[Settings](docs/configuration-reference.md) include validated built-in forms and optional browser
pages with an explicit offline carrier migration.
- The mode rows are on by default on all three platforms: Windows uses the pinned Bash payload
declared by the main package — `@dsh-ops/bash-win32-x64@0.2.1` in `optionalDependencies`, so npm
installs the independent **bash 5.3.15** (PortableGit `v2.56.0.windows.2`) that ships with ops,
and `bashPath` can point `ops_bash` at Git Bash instead; Linux/macOS use the distribution's own
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@

以提高token效率为目的,提供新增的ops系列工具并隐藏部分官方工具为方案的插件,低改动面,低侵入性,与其他插件广泛兼容。

- (仅windows平台)启用与dsh原生bash行为一致的ops_bash,并可选禁用powershell
- (仅 Windows)启用与 dsh 原生 bash 行为一致的 ops_bash;启用模式行时用它替换官方 pwsh,兼容模式则保留官方工具
- 四个预设模式行分别增强内置 Minimal/Standard/PTC/Cordis preset:Standard 与 Cordis 替换官方 read/glob/grep,PTC 提供类型化 SDK,Minimal 只替换 Windows shell;discovery 行启用时其会话始终获得动态加载入口;兼容模式(默认关闭)可保留全部官方工具
- 启用 DSH 预留的 `tools_addition` 动态工具加载,并提供渐进式纰漏的工具,作为高级功能(如pdf、word读取、超多文件批量修改)的加载平台,大大减少常见特定场景的token消耗量,且不会导致系统提示词膨胀
- 为 Native 模式提供返回紧凑、带行号和更好错误回馈的工具以遏制报错循环,减少调用轮次
- 为 PTC 模式提供一些返回结构化 JSON 值的工具以降低 ai 在 ptc 模式下编写 TypeScript 代码的token总量和心智负担
Expand Down Expand Up @@ -92,6 +93,8 @@ npx --yes dsh-ops@latest uninstall --profile desktop

旧版显式 provision 的 `<DSH_HOME>/dsh-ops/` 文件(provision 的 shell,以及早期版本可 provision 的 FastCtx 运行时)需单独清理:`npx --yes dsh-ops@latest uninstall --yes`。已移除的后台组件留下的 `~/.fastctx/` 状态默认不删;需要时显式加 `--purge-fastctx`。

组件 bundle 现为八行:`mode-minimal`、`mode-standard`、`mode-ptc`、`mode-cordis`、`discovery`、`compat`、`panel`、`tui`。旧的 `shell`、`file`、`ptc`、`hide-official` 行已移除,请删除为它们保存的 profile 覆盖,并按需重设模式开关。

原 `dsh-ops/background` 组件(FastCtx 后台任务)已移除。仍保留该行的 profile 照常加载:该行不发布任何工具,只记录一条警告,可直接删除。

## 可选 OPS 只读侧栏
Expand Down
9 changes: 4 additions & 5 deletions README.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,13 @@ OPS 为 DSH 增加有界文件与文档工具。Native 模式返回紧凑、带
支持:Windows x64、Linux x64,以及 macOS 13+ 的 Apple Silicon 与 Intel(`darwin-arm64`、`darwin-x64`)。见 [macOS](docs/macos.zh.md)。

> [!IMPORTANT]
> 本分支是 **0.4.0 发布候选**,尚未发布。已批准的验收范围为:BM-01 相比 OPS 0.3.x 输出减少至少 40%,官方读取另列对照;BM-03 对文件/发现 schema 执行 400 token 上限,同时保留 Bash 启动常驻并单列完整总数。最终实测证据与功能 CI 缺一不可。
> 详情见[发布状态与限制](docs/0.4.0发布候选.md)。下方 `@latest` 命令安装已发布版本;评估候选版本需自行构建本检出目录并打包。
> 本分支是 **0.5.0 未发布候选**:组件 roster 改为预设模式行。下方 `@latest` 命令安装已发布版本;评估候选版本需自行构建本检出目录并打包,变更见[变更日志](docs/CHANGELOG.md)。

- Native 默认提供 `ops_read_files` 与 `ops_discover_tools`;三个平台的默认 profile 都启用 shell 行并提供 `ops_bash`。高级工具在所属 agent 的下一次供应商请求中激活。
- 默认 profile 启用四个预设模式行:Standard/Cordis 发布常驻 OPS 文件工具,PTC 发布类型化 SDK,Minimal 只替换 Windows shell;discovery 行启用时其会话获得 `ops_discover_tools` 动态加载入口;`ops_bash` 由模式行在 Windows 上替换官方 pwsh。高级工具在所属 agent 的下一次供应商请求中激活。
- PTC SDK 目录包含 18 个 API:15 个文件/文档工具,加批处理、结果引用和加载器。仅暴露配置为常驻或已选择的 API;Native 与 PTC 分别提供自己的输出形式。
- 可按需发现有界 CSV/TSV、DOCX 主体段落与受限 PDF 文本层读取。尚不支持二进制 DOC、OCR、通用 PDF 渲染、网页搜索或 HTML 抓取;使用前请查看[文档格式限制](docs/原生内核.md)。
- 七个组件独立启停,保留已有 profile ID 与配置。逐工具官方替换默认关闭。[设置](docs/配置参考.md)提供严格校验的内置表单;可选浏览器页面需显式执行离线承载行迁移。
- shell 组件在三个平台默认开启:Windows 使用主包声明的固定 bash 载荷——`optionalDependencies` 中的 `@dsh-ops/bash-win32-x64@0.2.1`,npm 安装时自动拉取 ops 自带的独立 **bash 5.3.15**(PortableGit `v2.56.0.windows.2`),也可用 `bashPath` 把 `ops_bash` 指向 git bash;Linux/macOS 使用发行版自带 bash,可用 `config.bashPath` 覆盖。`dsh-ops bash-runtime install` 保留为安装/修复与选择受管理副本的路径。PowerShell 仍由宿主管理;升级命令先预览标准安装,仅加 `--yes` 才执行。
- 八个组件独立启停:四个模式行与 discovery 默认开,兼容模式、panel 与 TUI 默认关。启用模式行会自动隐藏被替换的官方工具(read/glob/grep + Windows pwsh),兼容模式开启则保留官方工具。[设置](docs/配置参考.md)提供严格校验的内置表单;可选浏览器页面需显式执行离线承载行迁移。旧 `shell`/`file`/`ptc`/`hide-official` 覆盖需删除。
- 模式行在三个平台默认开启:Windows 使用主包声明的固定 bash 载荷——`optionalDependencies` 中的 `@dsh-ops/bash-win32-x64@0.2.1`,npm 安装时自动拉取 ops 自带的独立 **bash 5.3.15**(PortableGit `v2.56.0.windows.2`),也可用 `bashPath` 把 `ops_bash` 指向 git bash;Linux/macOS 使用发行版自带 bash,可用 `config.bashPath` 覆盖。`dsh-ops bash-runtime install` 保留为安装/修复与选择受管理副本的路径。PowerShell 仍由宿主管理;升级命令先预览标准安装,仅加 `--yes` 才执行。

OPS 只发布自身作用域内的工具与可选路由提示,不改写共享工具注册表。每次调用均检查权限与取消状态。Windows 受限 Bash 仍存在文档注明的部分约束与运行时兼容性限制。

Expand Down
10 changes: 5 additions & 5 deletions bench/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## 测试前的准备

Linux / macOS:使用当前平台构建的 worker;`setup --dry-run` 会说明跳过 Windows PowerShell pin、PSModulePath、Windows Bash IPC 和随包 Windows shell 检查的原因。当前 shell 行已支持各平台,不要再从早期 Windows-only 默认值推断配置。模型 sweep 仍需自己的 OpenAI 兼容服务与凭据;`tools` 自检不调用模型。
Linux / macOS:使用当前平台构建的 worker;`setup --dry-run` 会说明跳过 Windows PowerShell pin、PSModulePath、Windows Bash IPC 和随包 Windows shell 检查的原因。组件行在三个平台都受支持,不要再从早期 Windows-only 默认值推断配置。模型 sweep 仍需自己的 OpenAI 兼容服务与凭据;`tools` 自检不调用模型。

Linux / macOS: build the worker for the current host. `setup --dry-run` explains skipped Windows-only checks. `ab`, `compare`/`report`, `panel` and `tools` use the same entry point on every platform. A model sweep needs your own OpenAI-compatible endpoint; the tools self-check needs no model. Every sweep now fingerprints the composed profiles even without `--seal`, recording platform and component configuration in the arm summaries. `enabled` is a configuration fact, not proof of tool readiness; unresolved expressions remain `unknown`.

Expand Down Expand Up @@ -74,19 +74,19 @@ Model flags set the actual shared route, with the condition patch applied after
### 组件开关 / Component switches

```console
node bench/cli.mjs setup --switch hide-official=all --switch ptc --switch panel=false --dry-run
node bench/cli.mjs setup --switch hide-official=read,grep --switch discovery --switch shell
node bench/cli.mjs setup --switch mode-standard --switch mode-ptc=false --switch compat=false --switch panel=false --dry-run
node bench/cli.mjs setup --switch mode-minimal=false --switch mode-cordis --switch discovery --switch compat
```

`--switch` 可重复,支持 `hide-official`、`ptc`、`panel`、`discovery`、`shell`;省略值等同 `true`,普通开关也接受 `false`。`hide-official=all` 只选择已有替代实现的 `read,glob,grep`,也可指定不重复的子集或 `false`。只修改 candidate 的 `cordis.patch.yml`;baseline 不写入组件行。每次 setup 只改明确指定的开关,不自动搜索组合。
`--switch` 可重复,支持 `mode-minimal`、`mode-standard`、`mode-ptc`、`mode-cordis`、`discovery`、`compat`、`panel`、`tui`;省略值等同 `true`。四个模式行与 discovery 默认启用;`compat` 是反向开关:`true` 表示兼容模式开启、官方工具保持可见,因此默认的 `false` 才让已启用模式隐藏被替换的官方工具。只修改 candidate 的 `cordis.patch.yml`;baseline 不写入组件行。每次 setup 只改明确指定的开关,不自动搜索组合。

写入幂等;本地已有相反值需 `--force`,继承的字面配置键会保留。动态表达式、非映射配置、重复行和无法安全编辑的目标形态需手工处理,`--force` 也不会猜测。`--dry-run` 打印请求的行和值,不启动宿主、不修改 profile。

实跑先读合成配置,写入后再核验配置并执行一次有超时的最小 headless turn;这可能调用已配置模型。没有已完成 turn、宿主错误或 `READINESS_BLOCKED` 都会让 setup 失败并指向 [#207](https://github.com/T-Auto/dsh-ops/issues/207),不会启动 benchmark sweep。这个探测不代替 Desktop 重启后的人工验证。

实际配置写入摘要及封存 `run.json` 的 `arms.cand.switches`,报告头和 panel 显示 candidate 开关。baseline 的空集合与 candidate 的非空集合属于正常 A/B;两份运行的 candidate 集合不同则 compare 退出 `2`,列出差异,不合并 Δ。未求值配置记录 `null`,旧数据缺失开关元数据仍可读取为未知;这些字段是配置事实,不证明组件已经发布到会话。

Repeat `--switch` to set candidate components. Values default to `true`; booleans also accept `false`. `hide-official=all` expands only the implemented `read,glob,grep` replacements, or select a unique subset. Setup edits only the candidate patch, preserves inherited literal configuration, and changes only named switches. Conflicting local values require `--force`; dynamic or unsafe shapes require manual edits even with force. Dry-run prints the requested values without launching the host or writing profiles.
Repeat `--switch` to set candidate components. Values default to `true`. Supported names are `mode-minimal`, `mode-standard`, `mode-ptc`, `mode-cordis`, `discovery`, `compat`, `panel` and `tui`; the four mode rows and discovery are on by default. `compat` is the inverse switch: `true` turns Compatibility mode on and keeps the official tools visible, so the default `false` lets enabled modes hide the tools they replace. Setup edits only the candidate patch, preserves inherited literal configuration, and changes only named switches. Conflicting local values require `--force`; dynamic or unsafe shapes require manual edits even with force. Dry-run prints the requested values without launching the host or writing profiles.

Real setup verifies composed configuration and runs one bounded headless readiness turn, which may call the configured model. Missing successful completion, host errors and `READINESS_BLOCKED` fail setup with the #207 diagnostic before a sweep starts. This does not substitute for Desktop validation. Summaries and sealed `arms.cand.switches` retain effective configuration; report headers and the panel show it. Comparisons reject different candidate switch sets with exit 2, while the baseline's empty set is expected. Unevaluated configuration and historical missing metadata remain unknown, without implying publication readiness. Switch combinations are selected explicitly and are outside the CI gate.

Expand Down
3 changes: 2 additions & 1 deletion bench/lib/environment.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { parse } from 'yaml'

const COMPONENTS = ['shell', 'file', 'ptc', 'discovery', 'panel', 'tui', 'hide-official']
// Keep in sync with the component roster in src/components/defaults.ts.
const COMPONENTS = ['mode-minimal', 'mode-standard', 'mode-ptc', 'mode-cordis', 'discovery', 'compat', 'panel', 'tui']

/** Read configuration facts, never evaluate an expression or infer publication readiness. */
export function componentFacts(text) {
Expand Down
13 changes: 9 additions & 4 deletions bench/lib/switches.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
import { parse } from 'yaml'

export const SWITCH_ROWS = Object.freeze(Object.fromEntries(['hide-official', 'ptc', 'panel', 'discovery', 'shell'].map(name => [name, `dsh-ops-${name}`])))
export const ACTIVATION_KEYS = Object.freeze({ discovery: 'enabled', panel: 'capture', shell: 'publishBashTool' })
// Component rows of the fallback bundle. The four mode rows publish an enhanced
// built-in preset and start enabled; "compat" is the inverse switch — on keeps the
// official tools visible, off lets enabled mode rows hide what they replace.
export const SWITCH_ROWS = Object.freeze(Object.fromEntries([
'mode-minimal', 'mode-standard', 'mode-ptc', 'mode-cordis', 'discovery', 'compat', 'panel', 'tui',
].map(name => [name, `dsh-ops-${name}`])))
// Legacy activation keys still found in saved profile overrides. Mode rows use the
// row switch (disabled), and Compatibility mode has no configuration key.
export const ACTIVATION_KEYS = Object.freeze({ discovery: 'enabled', panel: 'capture' })
export const parseRows = text => parse(text, { customTags: [{ tag: 'tag:yaml.org,2002:js', resolve: value => ({ expression: value }) }] })

/** Configuration facts only; readiness is established separately by setup's host probe. */
Expand All @@ -20,8 +27,6 @@ export function switchesFromDump(text) {
const enabled = row.disabled === true || activation === false ? false
: knownConfig && (row.disabled === undefined || row.disabled === false) && (activation === undefined || activation === true) ? true : null
switches[name] = { enabled }
if (name === 'hide-official') switches[name].replaceTools = Array.isArray(row.config?.replaceTools)
&& row.config.replaceTools.every(value => typeof value === 'string') ? [...row.config.replaceTools].sort() : null
}
return switches
}
Expand Down
Loading
Loading