refactor(preset): trim the shell-row comments

Drop the filler and factually loose comments added with the tool-pwsh rows:
the platform expressions self-explain, the web-app overlay comment repeats
the file header, and the spec comments now state only the platform-scoped
evaluation fact.
This commit is contained in:
Huanqi Cao
2026-08-11 21:38:51 +08:00
parent ccb3e4aaac
commit 05a8846c6e
5 changed files with 11 additions and 34 deletions

View File

@@ -46,18 +46,14 @@
# the criterion for host-plane ownership — injection resolves before any session
# exists, so there is no agent to key by. Behind a preset realm those variables
# never reached the model's shell at all. Both shell tools consume the host
# registry from here; the executors behind them (`bash-sandbox`/`pwsh-sandbox`)
# are host-plane too, where the sandbox policy owns them. The web-app overlay
# disables the host shell-tool rows, so exactly one of these rows mounts per
# host — `tool-bash` on POSIX, `tool-pwsh` on win32.
# registry from here; their executors (`bash-sandbox`/`pwsh-sandbox`) are
# host-plane too.
- id: tool-bash
name: '@deepseek-ai/dsh-tool-bash'
# POSIX-only: the base composition swaps the bash stack for the pwsh stack on win32.
disabled: !!js process.platform === 'win32'
- id: tool-pwsh
name: '@deepseek-ai/dsh-tool-pwsh'
# win32-only twin of tool-bash: bash has no Windows runner.
disabled: !!js process.platform !== 'win32'
# ── filesystem ──────────────────────────────────────────────────────────────

View File

@@ -40,18 +40,14 @@
# the criterion for host-plane ownership — injection resolves before any session
# exists, so there is no agent to key by. Behind a preset realm those variables
# never reached the model's shell at all. Both shell tools consume the host
# registry from here; the executors behind them (`bash-sandbox`/`pwsh-sandbox`)
# are host-plane too, where the sandbox policy owns them. The web-app overlay
# disables the host shell-tool rows, so exactly one of these rows mounts per
# host — `tool-bash` on POSIX, `tool-pwsh` on win32.
# registry from here; their executors (`bash-sandbox`/`pwsh-sandbox`) are
# host-plane too.
- id: tool-bash
name: '@deepseek-ai/dsh-tool-bash'
# POSIX-only: the base composition swaps the bash stack for the pwsh stack on win32.
disabled: !!js process.platform === 'win32'
- id: tool-pwsh
name: '@deepseek-ai/dsh-tool-pwsh'
# win32-only twin of tool-bash: bash has no Windows runner.
disabled: !!js process.platform !== 'win32'
# ── filesystem ──────────────────────────────────────────────────────────────

View File

@@ -39,18 +39,14 @@
# the criterion for host-plane ownership — injection resolves before any session
# exists, so there is no agent to key by. Behind a preset realm those variables
# never reached the model's shell at all. Both shell tools consume the host
# registry from here; the executors behind them (`bash-sandbox`/`pwsh-sandbox`)
# are host-plane too, where the sandbox policy owns them. The web-app overlay
# disables the host shell-tool rows, so exactly one of these rows mounts per
# host — `tool-bash` on POSIX, `tool-pwsh` on win32.
# registry from here; their executors (`bash-sandbox`/`pwsh-sandbox`) are
# host-plane too.
- id: tool-bash
name: '@deepseek-ai/dsh-tool-bash'
# POSIX-only: the base composition swaps the bash stack for the pwsh stack on win32.
disabled: !!js process.platform === 'win32'
- id: tool-pwsh
name: '@deepseek-ai/dsh-tool-pwsh'
# win32-only twin of tool-bash: bash has no Windows runner.
disabled: !!js process.platform !== 'win32'
# ── filesystem ──────────────────────────────────────────────────────────────

View File

@@ -21,10 +21,8 @@ import { evaluate } from '@deepseek-ai/cordis-plugin-loader'
import { composeEntries, initProfile, loadProfile, PROFILES_DIR } from '@deepseek-ai/dsh-app-boot'
/**
* The effective disabled state of one composed row on one platform: a `!!js`
* expression evaluates with a platform-scoped context (the `with` scope
* shadows the global `process`) so both outcomes pin on every host; a plain
* boolean is the value itself.
* The effective disabled state of one row on one platform: a `!!js` expression
* evaluates with a platform-scoped `process` so both outcomes pin on any host.
*/
function disabledOn(row: { disabled?: unknown }, platform: 'win32' | 'linux'): boolean {
const value = row.disabled
@@ -60,9 +58,8 @@ describe('the shipped shell composition (real bundle layers)', () => {
expect(disabledOn(byId.get('bash-sandbox')!, 'linux'), 'bash-sandbox on linux').toBe(false)
expect(disabledOn(byId.get('pwsh-sandbox')!, 'win32'), 'pwsh-sandbox on win32').toBe(false)
expect(disabledOn(byId.get('pwsh-sandbox')!, 'linux'), 'pwsh-sandbox on linux').toBe(true)
// The Web surface owns both host shell TOOL rows on every platform: the
// executors stay host-plane with their platform gates, while sessions
// mount the shell tools from their preset rows instead.
// Host shell-tool rows are disabled on every platform; sessions mount
// their own rows instead.
expect(byId.get('tool-bash')?.disabled).toBe(true)
expect(byId.get('tool-pwsh')?.disabled).toBe(true)
// The permission surface never moves: the sandbox/policy rows, the
@@ -118,10 +115,7 @@ describe('shipped agent presets gate both shell tools by platform', () => {
))
if (row === undefined) throw new TypeError(`preset ${preset} must mount ${id}`)
expect(row.disabled).toMatchObject({ __jsExpr: expect.any(String) as string })
// The base patch gates the host shell-tool rows by platform; the preset
// rows must not re-enable them on the wrong host. Evaluate the shipped
// expression with a platform-scoped context (the `with` scope shadows
// the global `process`) so both outcomes pin on every host.
// A platform-scoped context pins both outcomes on every host.
const expression = (row.disabled as { __jsExpr: string }).__jsExpr
expect(Boolean(evaluate({ process: { platform: 'win32' } }, expression)), `${id} on win32`).toBe(win32)
expect(Boolean(evaluate({ process: { platform: 'linux' } }, expression)), `${id} on linux`).toBe(!win32)