dsh-ops 0.0.0-stage → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +189 -0
- package/LICENSE +30 -0
- package/NOTICE +106 -0
- package/PROVENANCE.md +417 -0
- package/README.en.md +121 -0
- package/README.md +113 -2
- package/README.zh.md +114 -0
- package/bin/dsh-ops.mjs +1216 -0
- package/cordis.patch.yml +160 -0
- package/docs/manual-validation.md +53 -0
- package/docs/schema-baseline.json +64 -0
- package/docs/schema-current.json +84 -0
- package/docs/schema-measurement.md +17 -0
- package/dsh-plugin.json +88 -0
- package/icon.svg +12 -0
- package/lib/binary.js +409 -0
- package/lib/config.js +198 -0
- package/lib/handshake.js +252 -0
- package/lib/index.js +108 -0
- package/lib/jobs.js +42 -0
- package/lib/policy.js +64 -0
- package/lib/presentation.js +63 -0
- package/lib/profile-install.js +61 -0
- package/lib/rust.js +194 -0
- package/lib/session-shells.js +78 -0
- package/lib/shells.js +993 -0
- package/lib/tools.js +657 -0
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +114 -4
- package/vendor/fastctx/Cargo.lock +3210 -0
- package/vendor/fastctx/Cargo.toml +94 -0
- package/vendor/fastctx/FORK.md +119 -0
- package/vendor/fastctx/LICENSE-APACHE +201 -0
- package/vendor/fastctx/NOTICE +40 -0
- package/vendor/fastctx/README.md +439 -0
- package/vendor/fastctx/THIRD_PARTY_LICENSES.md +17 -0
- package/vendor/fastctx/THIRD_PARTY_LICENSES_RUST.md +7914 -0
- package/vendor/fastctx/UPSTREAM.md +49 -0
- package/vendor/fastctx/build.rs +413 -0
- package/vendor/fastctx/src/background_status.rs +403 -0
- package/vendor/fastctx/src/binary.rs +75 -0
- package/vendor/fastctx/src/bounded_sort.rs +500 -0
- package/vendor/fastctx/src/budget.rs +781 -0
- package/vendor/fastctx/src/cli/mod.rs +110 -0
- package/vendor/fastctx/src/context_guard.rs +289 -0
- package/vendor/fastctx/src/control/mod.rs +6 -0
- package/vendor/fastctx/src/control/paths.rs +49 -0
- package/vendor/fastctx/src/control/settings.rs +753 -0
- package/vendor/fastctx/src/control/transaction.rs +531 -0
- package/vendor/fastctx/src/edit/document.rs +535 -0
- package/vendor/fastctx/src/edit/locks.rs +371 -0
- package/vendor/fastctx/src/edit/mod.rs +213 -0
- package/vendor/fastctx/src/edit/private_storage/unix.rs +315 -0
- package/vendor/fastctx/src/edit/private_storage/windows.rs +793 -0
- package/vendor/fastctx/src/edit/private_storage.rs +234 -0
- package/vendor/fastctx/src/edit/replace.rs +1030 -0
- package/vendor/fastctx/src/edit_server.rs +53 -0
- package/vendor/fastctx/src/encoding/reference_v011.rs +587 -0
- package/vendor/fastctx/src/encoding/snapshot_pipeline.rs +1678 -0
- package/vendor/fastctx/src/encoding.rs +1118 -0
- package/vendor/fastctx/src/file_executor.rs +1151 -0
- package/vendor/fastctx/src/file_snapshot.rs +1491 -0
- package/vendor/fastctx/src/glob_filter.rs +98 -0
- package/vendor/fastctx/src/glob_tool.rs +653 -0
- package/vendor/fastctx/src/grep_sink.rs +1162 -0
- package/vendor/fastctx/src/grep_tool.rs +2449 -0
- package/vendor/fastctx/src/lib.rs +45 -0
- package/vendor/fastctx/src/main.rs +15 -0
- package/vendor/fastctx/src/model.rs +51 -0
- package/vendor/fastctx/src/model_guidance.rs +62 -0
- package/vendor/fastctx/src/operation.rs +356 -0
- package/vendor/fastctx/src/ordered_window.rs +1235 -0
- package/vendor/fastctx/src/os_environment.rs +414 -0
- package/vendor/fastctx/src/path_codec.rs +850 -0
- package/vendor/fastctx/src/paths.rs +244 -0
- package/vendor/fastctx/src/process_identity.rs +763 -0
- package/vendor/fastctx/src/process_policy.rs +74 -0
- package/vendor/fastctx/src/read_tool/batch.rs +496 -0
- package/vendor/fastctx/src/read_tool/hex_file.rs +141 -0
- package/vendor/fastctx/src/read_tool/image_file.rs +88 -0
- package/vendor/fastctx/src/read_tool/mod.rs +245 -0
- package/vendor/fastctx/src/read_tool/pdf.rs +470 -0
- package/vendor/fastctx/src/read_tool/pdf_disabled.rs +47 -0
- package/vendor/fastctx/src/read_tool/pdf_engine.rs +664 -0
- package/vendor/fastctx/src/read_tool/text_file.rs +351 -0
- package/vendor/fastctx/src/render_plan.rs +468 -0
- package/vendor/fastctx/src/runtime/activity.rs +159 -0
- package/vendor/fastctx/src/runtime/hosts.rs +99 -0
- package/vendor/fastctx/src/runtime/journal.rs +556 -0
- package/vendor/fastctx/src/runtime/local_ipc.rs +186 -0
- package/vendor/fastctx/src/runtime/mod.rs +746 -0
- package/vendor/fastctx/src/runtime/protocol.rs +296 -0
- package/vendor/fastctx/src/runtime/session.rs +536 -0
- package/vendor/fastctx/src/runtime/windows_process.rs +66 -0
- package/vendor/fastctx/src/search_parallelism.rs +106 -0
- package/vendor/fastctx/src/search_text.rs +227 -0
- package/vendor/fastctx/src/server.rs +359 -0
- package/vendor/fastctx/src/server_manifest.rs +468 -0
- package/vendor/fastctx/src/server_support.rs +826 -0
- package/vendor/fastctx/src/session.rs +629 -0
- package/vendor/fastctx/src/shell/apply_patch_hint.rs +41 -0
- package/vendor/fastctx/src/shell/bash.rs +263 -0
- package/vendor/fastctx/src/shell/buffer.rs +108 -0
- package/vendor/fastctx/src/shell/encoding.rs +403 -0
- package/vendor/fastctx/src/shell/foreground.rs +115 -0
- package/vendor/fastctx/src/shell/jobs/admission.rs +91 -0
- package/vendor/fastctx/src/shell/jobs/background.rs +146 -0
- package/vendor/fastctx/src/shell/jobs/host.rs +830 -0
- package/vendor/fastctx/src/shell/jobs/identity.rs +29 -0
- package/vendor/fastctx/src/shell/jobs/mod.rs +1513 -0
- package/vendor/fastctx/src/shell/jobs/model.rs +244 -0
- package/vendor/fastctx/src/shell/jobs/output_log.rs +1148 -0
- package/vendor/fastctx/src/shell/jobs/store.rs +1300 -0
- package/vendor/fastctx/src/shell/mod.rs +345 -0
- package/vendor/fastctx/src/shell/normalize.rs +389 -0
- package/vendor/fastctx/src/shell/output.rs +406 -0
- package/vendor/fastctx/src/shell/process.rs +493 -0
- package/vendor/fastctx/src/shell_server.rs +156 -0
- package/vendor/fastctx/src/skip_report.rs +83 -0
- package/vendor/fastctx/src/stdio_transport.rs +177 -0
- package/vendor/fastctx/src/tool_schema.rs +204 -0
- package/vendor/fastctx/src/traversal.rs +846 -0
- package/vendor/fastctx/third-party/pdfium-7763/LICENSE +9 -0
- package/vendor/fastctx/third-party/pdfium-7763/licenses/abseil.txt +202 -0
- package/vendor/fastctx/third-party/pdfium-7763/licenses/agg23.txt +14 -0
- package/vendor/fastctx/third-party/pdfium-7763/licenses/fast_float.txt +27 -0
- package/vendor/fastctx/third-party/pdfium-7763/licenses/freetype.txt +169 -0
- package/vendor/fastctx/third-party/pdfium-7763/licenses/icu.txt +542 -0
- package/vendor/fastctx/third-party/pdfium-7763/licenses/lcms.txt +27 -0
- package/vendor/fastctx/third-party/pdfium-7763/licenses/libjpeg_turbo.ijg +260 -0
- package/vendor/fastctx/third-party/pdfium-7763/licenses/libjpeg_turbo.md +135 -0
- package/vendor/fastctx/third-party/pdfium-7763/licenses/libopenjpeg.txt +32 -0
- package/vendor/fastctx/third-party/pdfium-7763/licenses/libpng.txt +134 -0
- package/vendor/fastctx/third-party/pdfium-7763/licenses/libtiff.txt +21 -0
- package/vendor/fastctx/third-party/pdfium-7763/licenses/llvm-libc.txt +278 -0
- package/vendor/fastctx/third-party/pdfium-7763/licenses/pdfium.txt +230 -0
- package/vendor/fastctx/third-party/pdfium-7763/licenses/simdutf.txt +18 -0
- package/vendor/fastctx/third-party/pdfium-7763/licenses/zlib.txt +29 -0
package/cordis.patch.yml
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
# ============================================================================
|
|
2
|
+
# dsh-ops — DSH bundle patch
|
|
3
|
+
# ============================================================================
|
|
4
|
+
# This is the plugin's "mount declaration". DSH applies every bundle patch in
|
|
5
|
+
# the profile's `dsh.profile.bundles` order at startup; this file inserts the
|
|
6
|
+
# dsh-ops row into that tree.
|
|
7
|
+
#
|
|
8
|
+
# Install:
|
|
9
|
+
# dsh plugin --profile desktop add <path to this package>
|
|
10
|
+
# dsh plugin --profile web add <path to this package>
|
|
11
|
+
#
|
|
12
|
+
# The row's config is validated by lib/config.js; every key below is optional
|
|
13
|
+
# and the values shown are the defaults. An unknown key fails the plugin at load
|
|
14
|
+
# rather than being ignored.
|
|
15
|
+
# ----------------------------------------------------------------------------
|
|
16
|
+
|
|
17
|
+
- insert:
|
|
18
|
+
- id: dsh-ops
|
|
19
|
+
name: dsh-ops
|
|
20
|
+
config:
|
|
21
|
+
# Absolute path to the FastCtx executable. When set, the plugin hosts
|
|
22
|
+
# exactly this file and fails loud if it is unusable.
|
|
23
|
+
# binaryPath: 'C:\path\to\fastctx.exe'
|
|
24
|
+
|
|
25
|
+
# The FastCtx server's own name, used to attribute the server
|
|
26
|
+
# instructions this plugin publishes as a prompt section. The model
|
|
27
|
+
# never sees it: this plugin speaks MCP to the server it spawns itself
|
|
28
|
+
# and registers every tool under its own ops_<tool> name.
|
|
29
|
+
serverName: fastctx
|
|
30
|
+
|
|
31
|
+
# Deployment opt-in only. Command/job tools are published per session
|
|
32
|
+
# only when sandboxPolicy.resolve() reports danger-full-access.
|
|
33
|
+
enableShellTools: true
|
|
34
|
+
|
|
35
|
+
# Per-call deadline for one FastCtx tool call, in milliseconds.
|
|
36
|
+
toolCallTimeoutMs: 300000
|
|
37
|
+
|
|
38
|
+
# Fail plugin activation when the FastCtx server cannot start. Keep
|
|
39
|
+
# false so a missing runtime degrades to "prompt policy only" instead of
|
|
40
|
+
# taking the plugin down.
|
|
41
|
+
required: false
|
|
42
|
+
|
|
43
|
+
# 'advise' — inject the prompt policy only.
|
|
44
|
+
# 'deny-host-shell' — additionally refuse the host shell tools below at
|
|
45
|
+
# the tools/pre-execute gate.
|
|
46
|
+
shellPolicy: advise
|
|
47
|
+
|
|
48
|
+
# Host tool names refused under 'deny-host-shell'.
|
|
49
|
+
deniedHostTools:
|
|
50
|
+
- pwsh
|
|
51
|
+
- bash
|
|
52
|
+
- pwsh_persistent
|
|
53
|
+
|
|
54
|
+
# Inject the repository-tooling prompt section.
|
|
55
|
+
promptPolicy: true
|
|
56
|
+
|
|
57
|
+
# ---- L2: the plugin's own bash -------------------------------------
|
|
58
|
+
# Absolute path to the bash this plugin runs `ops_bash` through. When
|
|
59
|
+
# set, the plugin runs exactly this file and refuses the rung when it is
|
|
60
|
+
# unusable; leave it unset to search the plugin's own bundled copy
|
|
61
|
+
# first, then PATH, then the well-known Git for Windows locations.
|
|
62
|
+
# bashPath: 'C:\Program Files\Git\bin\bash.exe'
|
|
63
|
+
|
|
64
|
+
# Layer 2: preferred executor for general commands, pipelines and scripts.
|
|
65
|
+
# Requires a resolved bash, host subprocess and session full access.
|
|
66
|
+
publishBashTool: true
|
|
67
|
+
|
|
68
|
+
# Fall back to a system-installed bash when the plugin carries no copy
|
|
69
|
+
# of its own. Set false to confine the bash rung to plugin-provided
|
|
70
|
+
# shells. (L3 needs no such switch: whether the host's pwsh row runs
|
|
71
|
+
# the plugin's own pwsh is decided by the executable's presence — see
|
|
72
|
+
# the L3 override below.)
|
|
73
|
+
allowSystemShellFallback: true
|
|
74
|
+
|
|
75
|
+
# ----------------------------------------------------------------------------
|
|
76
|
+
# L3: run the host's pwsh tool on the plugin's own PowerShell 7.
|
|
77
|
+
#
|
|
78
|
+
# WHY ONE LINE IS ENOUGH. `pwsh-local`'s Config owns a `pwshPath` field
|
|
79
|
+
# ("Explicit pwsh executable", packages/shell/pwsh-local/src/index.ts:71-77),
|
|
80
|
+
# and `pwsh-sandbox` inherits it verbatim because it declares
|
|
81
|
+
# `type Config = LocalConfig` (packages/shell/pwsh-sandbox/src/index.ts:40).
|
|
82
|
+
# Pointing this row at the plugin's executable therefore gets the bundled pwsh
|
|
83
|
+
# 7 under the host's sandbox, credential scrub, and output governance with no
|
|
84
|
+
# custom executor and no patched internals.
|
|
85
|
+
#
|
|
86
|
+
# WHY IT CAN EVALUATE TO `undefined` — and that is the safe answer. The row's
|
|
87
|
+
# `pwshPath` default is `undefined`, and `undefined` means "resolve a pwsh the
|
|
88
|
+
# official way" (PowerShell 7 install, PATH, Windows PowerShell 5.1;
|
|
89
|
+
# packages/shell/pwsh-local/src/resolve.ts:67-79). The expression keeps exactly
|
|
90
|
+
# four guards:
|
|
91
|
+
#
|
|
92
|
+
# 1. the platform gate, matching the row's own `disabled` gate: this override
|
|
93
|
+
# is meaningless off Windows, where `pwsh-sandbox` is not mounted;
|
|
94
|
+
# 2. an existence check over the SAME THREE PLACES, IN THE SAME ORDER, as the
|
|
95
|
+
# plugin's own probe in `lib/shells.js` (`PWSH_LAYOUT_ORDER`): first the
|
|
96
|
+
# provisioned store, `<DSH_HOME>/dsh-ops/shells/pwsh/<version>/bin/pwsh.exe`
|
|
97
|
+
# (what `dsh-ops provision-shells` installs, and the copy the plugin
|
|
98
|
+
# prefers), then `@dsh-ops/pwsh-<platform>-<arch>` with the shell at
|
|
99
|
+
# `bin/pwsh.exe` (a deployment that installed the platform package), then
|
|
100
|
+
# the vendored `vendor/pwsh/<platform>-<arch>/pwsh.exe` (a checkout that
|
|
101
|
+
# carries its own copy). Keeping the order identical is what makes the
|
|
102
|
+
# ladder's L3 and the host row the same fact rather than two guesses;
|
|
103
|
+
# 3. a `lstat`-based usability test, so a Windows Store execution alias (a
|
|
104
|
+
# symlink whose target is not statable) counts, while a directory named
|
|
105
|
+
# `pwsh.exe` does not — the same rule `resolveShells` applies;
|
|
106
|
+
# 4. a wrapping `try`/`catch` around the whole body, plus a `try` each for the
|
|
107
|
+
# store scan, the plugin-package resolution, and the platform-package
|
|
108
|
+
# resolution: an absent store, an unresolvable package, and a malformed
|
|
109
|
+
# manifest alike may not fail the boot. The store scan sits outside the
|
|
110
|
+
# plugin resolution on purpose — a provisioned copy is an absolute path
|
|
111
|
+
# under `DSH_HOME`, so a profile whose `baseUrl` cannot resolve `dsh-ops`
|
|
112
|
+
# still gets it rather than losing the rung.
|
|
113
|
+
#
|
|
114
|
+
# The store scan picks the greatest version name that holds the executable —
|
|
115
|
+
# the identical comparison `provisionedShell` makes in `lib/shells.js`, which is
|
|
116
|
+
# why it is one expression rather than a version list repeated here. The store's
|
|
117
|
+
# root mirrors `dshHome` there too: `DSH_HOME` when the deployment names one,
|
|
118
|
+
# `~/.dsh` otherwise.
|
|
119
|
+
#
|
|
120
|
+
# Until one of those three places actually carries the executable, the
|
|
121
|
+
# expression yields `undefined` and the host row is left completely untouched.
|
|
122
|
+
#
|
|
123
|
+
# "Installed means used" is the point of the rung: a deployment that carries
|
|
124
|
+
# the plugin's pwsh 7 wants the host's pwsh tool to run it, not the machine's.
|
|
125
|
+
# A deployment that does NOT want this rewrite removes or edits this patch
|
|
126
|
+
# entry in its OWN profile `cordis.patch.yml` — that layer applies after every
|
|
127
|
+
# bundle layer (docs/user/develop/basic/publish.md:118-130), so it has the last
|
|
128
|
+
# word. There is deliberately no plugin config key for it: a bundle patch is
|
|
129
|
+
# evaluated before any dsh-ops row is mounted (the Loader defers a row's `!!js`
|
|
130
|
+
# interpolation until that row's own injections are active), so a config key
|
|
131
|
+
# could not reach this expression, and a key that pretends to is a ladder that
|
|
132
|
+
# lies about the row it never changed.
|
|
133
|
+
#
|
|
134
|
+
# `!!js` SCOPE, VERIFIED IN THE VENDORED LOADER. The Loader evaluates these
|
|
135
|
+
# expressions as `with (ctx) { return eval(expr) }`
|
|
136
|
+
# (vendor/loader/src/config/utils.ts:5-9), so bare `baseUrl` (the owning config
|
|
137
|
+
# tree's base URL) and `ctx` are both in scope — the same convention the shipped
|
|
138
|
+
# bundle uses at packages/bundle/web-app/presets/cordis.patch.yml:147.
|
|
139
|
+
# `dsh-ops` is a dependency of the profile, so
|
|
140
|
+
# `createRequire(baseUrl).resolve('dsh-ops/package.json')` finds the package
|
|
141
|
+
# whether it was installed as a link or from the registry.
|
|
142
|
+
#
|
|
143
|
+
# WHOLE-OBJECT REPLACEMENT — AUDITED, NOT ASSUMED. A patch replaces the target
|
|
144
|
+
# row's ENTIRE `config` object rather than deep-merging it
|
|
145
|
+
# (docs/user/develop/basic/publish.md:129), so every non-default field of the
|
|
146
|
+
# target must be restated here. The base row this targets is
|
|
147
|
+
# packages/bundle/base/cordis.patch.yml:241-243:
|
|
148
|
+
#
|
|
149
|
+
# - id: pwsh-sandbox
|
|
150
|
+
# name: '@deepseek-ai/dsh-pwsh-sandbox'
|
|
151
|
+
# disabled: !!js process.platform !== 'win32'
|
|
152
|
+
#
|
|
153
|
+
# It declares NO `config` at all, and this patch writes only `config` (the
|
|
154
|
+
# row's `name` and its platform `disabled` gate are untouched), so there is no
|
|
155
|
+
# non-default field to restate and nothing is silently dropped. If the base row
|
|
156
|
+
# ever gains one, it must be restated here.
|
|
157
|
+
# ----------------------------------------------------------------------------
|
|
158
|
+
- id: pwsh-sandbox
|
|
159
|
+
config:
|
|
160
|
+
pwshPath: !!js "(() => { if (process.platform !== 'win32') return undefined; try { const builtin = (name) => process.getBuiltinModule(name); const fs = builtin('node:fs'); const nodePath = builtin('node:path'); const win = process.platform + '-' + process.arch; const usable = (file) => { try { const stat = fs.lstatSync(file); return stat.isFile() || stat.isSymbolicLink(); } catch { return false; } }; const named = process.env.DSH_HOME; const home = typeof named === 'string' && named.trim() !== '' ? nodePath.resolve(named) : nodePath.join(builtin('node:os').homedir(), '.dsh'); const layouts = []; try { const store = nodePath.join(home, 'dsh-ops', 'shells', 'pwsh'); const versions = fs.readdirSync(store, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name).sort().reverse(); for (const version of versions) layouts.push(nodePath.join(store, version, 'bin', 'pwsh.exe')); } catch {} try { const requires = builtin('node:module').createRequire(String(baseUrl).replace(/[^/]*$/, 'noop.json')); const dir = nodePath.dirname(requires.resolve('dsh-ops/package.json')); try { const pluginRequire = builtin('node:module').createRequire(nodePath.join(dir, 'package.json')); const pkg = nodePath.dirname(pluginRequire.resolve('@dsh-ops/pwsh-' + win + '/package.json')); layouts.push(nodePath.join(pkg, 'bin', 'pwsh.exe')); } catch {} layouts.push(nodePath.join(dir, 'vendor', 'pwsh', win, 'pwsh.exe')); } catch {} for (const candidate of layouts) { if (usable(candidate)) return candidate; } return undefined; } catch { return undefined; } })()"
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# dsh-ops 手动验收清单
|
|
2
|
+
|
|
3
|
+
本轮按风雪要求:不补/改回归测试,不加 CI,不运行旧套件。本清单是操作者步骤,不是自动化门禁。替换源码后先重启 DSH。
|
|
4
|
+
|
|
5
|
+
## 工具发布与提示词
|
|
6
|
+
|
|
7
|
+
- `workspace-write`、`read-only`:目录只有四个 ops 文件工具;没有任何 `ops_run` / `ops_job_*`,提示词也不出现这些名字。
|
|
8
|
+
- `danger-full-access` 且 `enableShellTools: true`:五个命令/job 工具一起出现。
|
|
9
|
+
- `enableShellTools: false`、无 sandboxPolicy 服务、无会话:命令组不出现。
|
|
10
|
+
- 同时开受限会话与完全权限会话:两者目录互不污染。受限子 agent 不继承祖先的命令组。
|
|
11
|
+
- 同一会话切换受限 → 完全权限 → 受限:每次下一请求目录/提示词跟随变化,不重连 FastCtx;旧命令句柄不能继续调用。
|
|
12
|
+
- 受限会话不发布 `ops_bash`;完全权限 + publishBashTool=true + bash 可解析 + subprocess 可用时出现,通用命令优先走它。FastCtx 缺失或 enableShellTools=false 时 bash 层仍独立可用。
|
|
13
|
+
- 提示词仅一段 `dsh-ops:repository-tooling`:工具包 → bash → pwsh7;不混语法,不因 bash 报错切 PowerShell。Windows 原生操作才用 pwsh。没有旧 host-shell 段或 `mcp:fastctx`。
|
|
14
|
+
- publishBashTool=false 隐去 bash 这一层;bash 权限动态切换、受限子 agent 继承过滤和卸载清理一起验证。
|
|
15
|
+
- `promptPolicy: false`:不发布路由提示词。
|
|
16
|
+
- `deny-host-shell`:有无 ops 命令组都应拒绝配置的宿主 shell;若工具来自继承层,目录也应遮蔽。无可用执行器时不推荐不可调用的 ops 命令。
|
|
17
|
+
|
|
18
|
+
## 文件工具
|
|
19
|
+
|
|
20
|
+
- 多文件多区间 `files[]`,各自 offset/limit/encoding;重复路径读取不同区间,结果有序。
|
|
21
|
+
- GBK 文本显式 encoding;单文件 grep encoding、目录 fallback_encoding。
|
|
22
|
+
- grep `pattern` 是字符串,不传数组;`glob[]` 可混正负规则。
|
|
23
|
+
- glob `pattern[]`、`!` 排除、paths/details;没有 count 模式。
|
|
24
|
+
- grep schema 只公开 context;content/count/summary 与分页结果仍符合上游行为。
|
|
25
|
+
- PDF text、pages 翻页、hex;text 模式外不要让 ops 渲染图像。
|
|
26
|
+
- 普通图片路径:错误明确说使用宿主 read_image;改后缀的图像也不能返回成功占位符。图像 `view: hex` 可以读取字节。
|
|
27
|
+
- 跨文件替换先 dry_run,再在临时副本上应用;精确编辑走宿主 edit。
|
|
28
|
+
- 只读工具可并发;替换/命令不应声明并发安全。
|
|
29
|
+
|
|
30
|
+
## 任务与输出隔离
|
|
31
|
+
|
|
32
|
+
- 当前会话没启动 job:ops 结果没有别的会话的 Background 行。
|
|
33
|
+
- 启动 job,保留返回 ID;输出、列表、kill 只操作自己的 ID。
|
|
34
|
+
- A/B 两会话各启动 job:各自 footer/list 只见自己,不能读取/kill 对方 ID。
|
|
35
|
+
- 完成/kill 后仍能读取自己已有 ID 的日志。
|
|
36
|
+
- job_list status/limit/offset 是自己的分页,不暴露全局总数/offset;空列表明确为空。
|
|
37
|
+
- 大全局 job 存储扫描不完整时必须报告 Partial,不冒充完整;原工具结果的 Complete/Partial 续页提示不能丢。
|
|
38
|
+
- 重连后不认领旧 ID;操作者可通过上游工具清理持久 job。权限降级不自动杀已运行任务,须操作者管理。
|
|
39
|
+
|
|
40
|
+
## 生命周期与边界
|
|
41
|
+
|
|
42
|
+
- 服务端断线立即撤下工具与对应提示词项,恢复后重新出现。
|
|
43
|
+
- 卸载后工具/提示词/限制全部消失;共享注册表方法未改写,外来同名工具仍可按自己的 scope 注册。
|
|
44
|
+
- 未知配置键报错点名;required=true 的缺失/不可用二进制拒绝激活。
|
|
45
|
+
- 取消/传输超时只表明停止等待,不把它误读为命令已停止。ops_run 的 timeout_ms 才是上游进程树超时。
|
|
46
|
+
|
|
47
|
+
## 数字复核
|
|
48
|
+
|
|
49
|
+
运行 `node scripts/measure-schemas.mjs docs/schema-current.json`,对比 `schema-baseline.json`。不执行真实文件/命令操作。统计的是紧凑 schema JSON 的 UTF-8 字节,tokens≈bytes/4,不是使用频率或准确账单。基线来自修改前 dee3c57 + FastCtx 0.2.6;工具调用频率仍未知,不据此删除 ops_replace。
|
|
50
|
+
|
|
51
|
+
## 不可误读为已解决的边界
|
|
52
|
+
|
|
53
|
+
四个 FastCtx 文件工具仍是非宿主沙箱后端,ops_replace 没有 workspace confinement;命令权限门不解决这件事。没有文件系统约束设计前,不作为不可信受限环境的安全方案。宿主审批策略与 sandbox mode 独立,本插件没有新增逐命令审批升级。
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
{
|
|
2
|
+
"format": "dsh-ops-schema-measurement-v1",
|
|
3
|
+
"metric": "UTF-8 bytes of compact JSON {name,description,parameters}; approximate tokens = ceil(bytes/4), not a tokenizer or usage-frequency count",
|
|
4
|
+
"runtimeVersion": "fastctx 0.2.6",
|
|
5
|
+
"tools": [
|
|
6
|
+
{
|
|
7
|
+
"name": "ops_glob",
|
|
8
|
+
"bytes": 2485,
|
|
9
|
+
"approximateTokens": 622
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"name": "ops_grep",
|
|
13
|
+
"bytes": 3766,
|
|
14
|
+
"approximateTokens": 942
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"name": "ops_inspect_local_file",
|
|
18
|
+
"bytes": 4375,
|
|
19
|
+
"approximateTokens": 1094
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"name": "ops_job_kill",
|
|
23
|
+
"bytes": 289,
|
|
24
|
+
"approximateTokens": 73
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"name": "ops_job_list",
|
|
28
|
+
"bytes": 889,
|
|
29
|
+
"approximateTokens": 223
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"name": "ops_job_output",
|
|
33
|
+
"bytes": 1717,
|
|
34
|
+
"approximateTokens": 430
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"name": "ops_replace",
|
|
38
|
+
"bytes": 2181,
|
|
39
|
+
"approximateTokens": 546
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"name": "ops_run",
|
|
43
|
+
"bytes": 1672,
|
|
44
|
+
"approximateTokens": 418
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"name": "ops_run_background",
|
|
48
|
+
"bytes": 1515,
|
|
49
|
+
"approximateTokens": 379
|
|
50
|
+
}
|
|
51
|
+
],
|
|
52
|
+
"total": {
|
|
53
|
+
"bytes": 18889,
|
|
54
|
+
"approximateTokens": 4723
|
|
55
|
+
},
|
|
56
|
+
"toolingPrompt": {
|
|
57
|
+
"bytes": 3373,
|
|
58
|
+
"approximateTokens": 844
|
|
59
|
+
},
|
|
60
|
+
"rawServerInstructions": {
|
|
61
|
+
"bytes": 246,
|
|
62
|
+
"approximateTokens": 62
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
{
|
|
2
|
+
"format": "dsh-ops-schema-measurement-v1",
|
|
3
|
+
"metric": "UTF-8 bytes of compact JSON {name,description,parameters}; approximate tokens = ceil(bytes/4), not a tokenizer or usage-frequency count",
|
|
4
|
+
"runtimeVersion": "fastctx 0.2.6",
|
|
5
|
+
"tools": [
|
|
6
|
+
{
|
|
7
|
+
"name": "ops_glob",
|
|
8
|
+
"bytes": 1226,
|
|
9
|
+
"approximateTokens": 307
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"name": "ops_grep",
|
|
13
|
+
"bytes": 2019,
|
|
14
|
+
"approximateTokens": 505
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"name": "ops_inspect_local_file",
|
|
18
|
+
"bytes": 1968,
|
|
19
|
+
"approximateTokens": 492
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"name": "ops_job_kill",
|
|
23
|
+
"bytes": 267,
|
|
24
|
+
"approximateTokens": 67
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"name": "ops_job_list",
|
|
28
|
+
"bytes": 694,
|
|
29
|
+
"approximateTokens": 174
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"name": "ops_job_output",
|
|
33
|
+
"bytes": 668,
|
|
34
|
+
"approximateTokens": 167
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"name": "ops_replace",
|
|
38
|
+
"bytes": 1511,
|
|
39
|
+
"approximateTokens": 378
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"name": "ops_run",
|
|
43
|
+
"bytes": 751,
|
|
44
|
+
"approximateTokens": 188
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"name": "ops_run_background",
|
|
48
|
+
"bytes": 635,
|
|
49
|
+
"approximateTokens": 159
|
|
50
|
+
}
|
|
51
|
+
],
|
|
52
|
+
"total": {
|
|
53
|
+
"bytes": 9739,
|
|
54
|
+
"approximateTokens": 2435
|
|
55
|
+
},
|
|
56
|
+
"fileOnly": {
|
|
57
|
+
"bytes": 6724,
|
|
58
|
+
"approximateTokens": 1681
|
|
59
|
+
},
|
|
60
|
+
"fileOnlyPrompt": {
|
|
61
|
+
"bytes": 470,
|
|
62
|
+
"approximateTokens": 118
|
|
63
|
+
},
|
|
64
|
+
"bashSchema": {
|
|
65
|
+
"bytes": 894,
|
|
66
|
+
"approximateTokens": 224
|
|
67
|
+
},
|
|
68
|
+
"fullWithBash": {
|
|
69
|
+
"bytes": 10633,
|
|
70
|
+
"approximateTokens": 2659
|
|
71
|
+
},
|
|
72
|
+
"toolingPrompt": {
|
|
73
|
+
"bytes": 1053,
|
|
74
|
+
"approximateTokens": 264
|
|
75
|
+
},
|
|
76
|
+
"publishedServerInstructions": {
|
|
77
|
+
"bytes": 0,
|
|
78
|
+
"approximateTokens": 0
|
|
79
|
+
},
|
|
80
|
+
"rawServerInstructions": {
|
|
81
|
+
"bytes": 246,
|
|
82
|
+
"approximateTokens": 62
|
|
83
|
+
}
|
|
84
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Schema measurement
|
|
2
|
+
|
|
3
|
+
Manual measurement only; not CI, regression coverage, a tokenizer, or tool-use telemetry.
|
|
4
|
+
|
|
5
|
+
Baseline: plugin `dee3c57`, FastCtx 0.2.6, before presentation changes. Current: same runtime, plugin-only schema projections. Metric: sum of compact UTF-8 JSON `{name,description,parameters}` sizes, no whitespace formatting; tokens ≈ ceil(bytes/4).
|
|
6
|
+
|
|
7
|
+
| Surface | Baseline bytes | Current bytes | Reduction |
|
|
8
|
+
| --- | ---: | ---: | ---: |
|
|
9
|
+
| Nine FastCtx schemas (full-access session) | 18,889 | 9,739 | 48.4% |
|
|
10
|
+
| Four file schemas | 12,807 | 6,724 | 47.5% |
|
|
11
|
+
| Routing section (original full ladder vs restored compact three-layer table) | 3,373 | 1,053 | 68.8% |
|
|
12
|
+
|
|
13
|
+
Full-access FastCtx schema estimate: 4,723 → 2,435 tokens. The restored ops_bash schema adds 894 bytes (~224 tokens); full FastCtx+bash surface is 10,633 bytes (~2,659 tokens). Restricted file-only surface: about 1,681 tokens; its routing table is 470 bytes (~118 tokens). No server instructions are published (the original raw server instructions were 246 bytes); the old host-shell section is also removed. Baseline excludes ops_bash, so compare nine FastCtx tools like-for-like rather than treating restoration as a regression of those numbers. Total request savings depend on host presentation; these are not API usage/billing measurements.
|
|
14
|
+
|
|
15
|
+
`ops_grep` went from 3,766 → 2,019 bytes; `ops_inspect_local_file` from 4,375 → 1,968. `ops_replace` is retained: schema cost cannot establish invocation frequency, and no usage-frequency measurement was collected.
|
|
16
|
+
|
|
17
|
+
Reproduce the current snapshot with `node scripts/measure-schemas.mjs docs/schema-current.json`. It only starts FastCtx, initializes, lists schemas, then closes it; it executes no tools. Keep the baseline unchanged; a different runtime schema requires an explicitly labeled comparison.
|
package/dsh-plugin.json
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://raw.githubusercontent.com/T-Auto/dsh-std/8a15541117cb3c13ddb8f2468308691b6051d162/packages/manifest/schema/dsh-plugin-0.15.schema.json",
|
|
3
|
+
"manifestVersion": "0.15",
|
|
4
|
+
"id": "dsh-ops.fastctx",
|
|
5
|
+
"name": "dsh-ops",
|
|
6
|
+
"version": "0.2.1",
|
|
7
|
+
"license": "MIT AND Apache-2.0",
|
|
8
|
+
"facets": {
|
|
9
|
+
"host": {
|
|
10
|
+
"entry": "lib/index.js",
|
|
11
|
+
"apiVersion": "v1alpha1"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"requires": {
|
|
15
|
+
"contracts": [
|
|
16
|
+
{
|
|
17
|
+
"apiVersion": "tools.dsh/v1alpha1",
|
|
18
|
+
"kind": "Tool"
|
|
19
|
+
}
|
|
20
|
+
]
|
|
21
|
+
},
|
|
22
|
+
"permissions": [
|
|
23
|
+
{
|
|
24
|
+
"name": "dsh-ops.process.spawn",
|
|
25
|
+
"scope": "subprocess",
|
|
26
|
+
"reason": "Start the FastCtx MCP server and the command execution it owns."
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"name": "dsh-ops.fs.read",
|
|
30
|
+
"scope": "filesystem-read",
|
|
31
|
+
"reason": "Read the FastCtx executable, the vendored source, and the runtime receipt."
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"name": "dsh-ops.fs.write",
|
|
35
|
+
"scope": "dsh-home",
|
|
36
|
+
"reason": "Install the provisioned runtime into <DSH_HOME>/dsh-ops/bin and record its receipt."
|
|
37
|
+
}
|
|
38
|
+
],
|
|
39
|
+
"contributes": {
|
|
40
|
+
"x-display": [
|
|
41
|
+
{
|
|
42
|
+
"icon": "./icon.svg",
|
|
43
|
+
"title": "Repository tools",
|
|
44
|
+
"description": "Read, search, replace, and run commands through the hosted FastCtx ops_* tool surface instead of shell commands.",
|
|
45
|
+
"locales": [
|
|
46
|
+
"locale/en.json",
|
|
47
|
+
"locale/zh.json"
|
|
48
|
+
]
|
|
49
|
+
}
|
|
50
|
+
],
|
|
51
|
+
"x-prompt-sections": [
|
|
52
|
+
{
|
|
53
|
+
"name": "dsh-ops:repository-tooling",
|
|
54
|
+
"order": 3250,
|
|
55
|
+
"summary": "Compact tools-to-bash-to-PowerShell-7 routing; prefer bash except for Windows-native operations."
|
|
56
|
+
}
|
|
57
|
+
],
|
|
58
|
+
"x-tool-namespaces": [
|
|
59
|
+
{
|
|
60
|
+
"serverName": "fastctx",
|
|
61
|
+
"transport": "stdio",
|
|
62
|
+
"source": "vendored FastCtx runtime",
|
|
63
|
+
"publicPrefix": "ops_",
|
|
64
|
+
"tools": [
|
|
65
|
+
"inspect_local_file",
|
|
66
|
+
"grep",
|
|
67
|
+
"glob",
|
|
68
|
+
"replace",
|
|
69
|
+
"run",
|
|
70
|
+
"run_background",
|
|
71
|
+
"job_output",
|
|
72
|
+
"job_list",
|
|
73
|
+
"job_kill"
|
|
74
|
+
],
|
|
75
|
+
"shellPermission": "enableShellTools AND per-session sandboxPolicy danger-full-access"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"serverName": "dsh-ops",
|
|
79
|
+
"transport": "in-process",
|
|
80
|
+
"source": "the plugin's bash layer via host subprocess",
|
|
81
|
+
"publicPrefix": "ops_",
|
|
82
|
+
"tools": ["bash"],
|
|
83
|
+
"shellPermission": "publishBashTool AND per-session sandboxPolicy danger-full-access"
|
|
84
|
+
}
|
|
85
|
+
]
|
|
86
|
+
},
|
|
87
|
+
"subscriptions": []
|
|
88
|
+
}
|
package/icon.svg
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="36" height="36" viewBox="0 0 36 36" fill="none">
|
|
2
|
+
<g stroke="#7C7C82" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round">
|
|
3
|
+
<rect x="4.2" y="6.2" width="27.6" height="23.6" rx="4.2" />
|
|
4
|
+
<path d="M10 14.4l4 3.8-4 3.8" />
|
|
5
|
+
<path d="M17.4 22h4.4" />
|
|
6
|
+
<path d="M25.6 13v10" />
|
|
7
|
+
</g>
|
|
8
|
+
<g fill="#7C7C82">
|
|
9
|
+
<circle cx="25.6" cy="13" r="2.3" />
|
|
10
|
+
<circle cx="25.6" cy="23" r="2.3" />
|
|
11
|
+
</g>
|
|
12
|
+
</svg>
|