Lite Exec: Bounded Shell Execution and Large File/ASAR Inspection for DeepSeek Harness

Introduction

In DeepSeek Harness (DSH), agents need to interact with the system, read files, or execute commands to complete complex tasks. Exposing full Shell or filesystem access poses security risks, while overly restrictive access limits the agent’s capabilities. This plugin provides a set of bounded, controllable tools that allow agents to perform shell execution, file reading, regex search, and metadata inspection within a controlled scope.

Plugin Overview

This is a DSH plugin maintained by ClearMind-17, categorized under admin-security. It registers four tools: lite_exec, lite_read, lite_grep, and lite_stat. By constraining commands, output size, timeouts, and file access scope, the plugin provides agents with secure system interaction capabilities.

Installation

The plugin version is 0.1.5 and requires Node.js 24 or later, with a DSH declaration range of >=0.2.2-rc.3 <1.0.0.

After completely exiting DSH Desktop, run the following commands in a directory where you intend to keep the package long-term. Source users can run npm pack in the plugin directory first to generate the package.

$archive = (Resolve-Path -LiteralPath './dsh-lite-exec-0.1.5.tgz').Path
dsh plugin --profile desktop add "dsh-lite-exec@file:$archive" --ignore-scripts

The profile records the path to the package file—please retain it. After reopening Desktop and creating a new session, verify the installation by executing code via run_code in a Flash PTC session.

console.log(await tools.lite_stat({ path: "." }))

The current directory should return exists: true and isDir: true. If tools are still missing after an upgrade, check the Desktop plugin toggle, as well as whether the profile’s cordis.patch.yml contains config.enabled: false or config.tools: []. Either of these override entries will prevent tool registration.

Configuration

By default, all four tools are registered. To restrict tools, modify the dsh-lite-exec entry in the Desktop profile’s cordis.patch.yml.

Enable Shell only:

- id: dsh-lite-exec
  config:
    tools: [lite_exec]

Omitting tools registers all four; an empty array disables all. When using a custom PortableGit, you can set bashPath under the same config with the absolute path to the Bash executable.

Tool Capabilities

lite_exec

lite_exec executes Shell commands. command is required. Supported options include cwd (working directory), timeoutMs (timeout, default 30 s, max 300 s), maxOutputBytes (output size, default 16 KiB, max 64 KiB), and shell (specify Shell). Returns the actual cwd, shell, exit code, stdout, and up to the last 20 lines of stderr. On success, stdout takes from the beginning; on failure or timeout, it takes from the end. stdout and stderr share the output byte budget; when both produce large output, stdout is guaranteed at least half the budget or 4 KiB, whichever is smaller (capped by actual output).

lite_read

lite_read reads files. path is required. Supports offsetBytes (0-based), limitBytes, and encoding. Defaults to reading 64 KiB; up to 1 MiB per call. Supported encodings: auto, UTF-8, UTF-16LE/BE, GBK, CP936. Binary content returns binary:true and up to 512 bytes in hex. A missing path returns ENOENT, exists:false, and up to three near-name candidates. The returned bytes field indicates the actual number of window bytes read.

The read window may start or end mid-character. UTF-8 and UTF-16 will discard incomplete boundary characters where possible. GBK’s lead-byte and trail-byte ranges overlap, so arbitrary offsets into a GBK file may not resolve character boundaries. When the encoding is known, pass it explicitly and continue reading at confirmed byte boundaries.

lite_grep

lite_grep performs regex search. pattern and path are required. Case-sensitive by default; pass ignoreCase: true to ignore case. Empty strings match decodable lines. For plain-file regex search, native grep is available. include accepts a single glob or up to 32 globs, e.g. ["*.ts", "*.tsx"], supporting *, **, ?. maxMatches defaults to 100, max 5,000. maxBytes defaults to 64 KiB, max 1 MiB. When the full overflow result is successfully written, fullResultPath returns the JSONL path.

matchCount is in units of matched lines. Multiple occurrences on the same line count as one. When complete:false, the count only covers the portion already inspected. truncated:true indicates the preview omitted at least one found match. If the first match exceeds the preview budget, matches may be empty, but the full scan still returns the count and the available spill path. The workspace spill directory is excluded from searches; already-spilled files can be read via lite_read.

Search limits: 128 nesting levels, 100,000 directory entries, 256 MiB per file, 1 GiB total scan, 32 MiB per line, with a 30-second scan deadline. Traversal skips symlinks. Binary files and undecodable lines have independent counters. If search exceeds the scan budget or deadline, complete:false is returned along with the available preview. If spilling is restricted, over budget, or fails, a bounded scan continues and returns spill.reason and the compatibility field spillError. When searching ASAR archives, explicitly specify the archive or an internal path; scanning a plain parent directory skips archive files within it.

lite_stat

lite_stat checks file metadata. path is required. Returns existence, whether it’s a directory, byte size, modification time, and ASAR path marker. Call only when metadata inspection is needed.

Shell and Permissions

On Windows, workspace-write and read-only profiles default to PowerShell selected before startup, with shellFallback:false. Windows full-access defaults to Git for Windows Bash; other platforms also default to Bash. If the default Bash is not found, PowerShell can be attempted under the same permission policy.

Under full access, only an ENOENT explicitly identified as a failed Bash executable launch triggers startup fallback. An explicit shell: "bash" or shell: "powershell" uses only the specified Shell. shellUsed and the compatibility field shell record the Shell actually used.

Each execution uses the current session’s DSH permissions. Restricted mode goes through the host OS sandbox. Under Windows restricted permissions, an explicit Bash hit on a known startup failure returns diagnostic.code: "WINDOWS_BASH_STARTUP". PowerShell stderr showing access-denial signs returns suspectedSandboxDenial:true with a hint, preserving the command exit code. For write commands that support -ErrorAction Stop, add that parameter to cause non-terminating errors to exit as failure. After writing, use lite_stat to verify the output.

Full access writes complete output to $DSH_HOME/dsh-lite-exec/spill, defaulting to ~/.dsh/dsh-lite-exec/spill. Workspace writes use .dsh-lite-exec/spill under the current session’s workspace root. lite_grep skips this directory to avoid counting previous results into matches. Existing spilled files can be read with lite_read.

Read-only mode returns the available preview and spill.reason: "READ_ONLY" when overflow occurs. When the target directory is confirmed to not meet private permission requirements, ACL_DENIED is returned. Other storage or I/O failures return UNAVAILABLE. Spill issues preserve the preview and the command’s own result. Each storage location allows up to 8 slots, 16 MiB per slot, 128 MiB total. Files older than 24 hours are cleaned on subsequent writes. When slots are full, the oldest completed result is reused; reading the old path afterward returns file-not-found. In-progress slots are retained. Legacy logs continue to expire after 24 hours. On Windows, directory ACLs are restricted to the current account and allowed system principals. On Unix, directories and files use 0700 and 0600 respectively. In Windows workspace mode, path and anti-symlink checks run on every spill; directory DACL checks are cached per directory identifier for up to 30 seconds (immediately rechecked when a directory is newly created or replaced).

If you want git status to hide the spill directory, add /.dsh-lite-exec/ as a line in .git/info/exclude of the target repository.

Disabling, Uninstalling, and Rollback

  • Disable: Use the Desktop plugin toggle. An existing config.enabled: false configuration remains effective. After modifying the YAML, reopen DSH Desktop. Removing the override restores the default enabled state.
  • Uninstall: Use the Desktop plugin page. Alternatively, after completely exiting Desktop, remove this plugin’s override entries, run dsh plugin --profile desktop remove dsh-lite-exec, then reopen Desktop.
  • Rollback: If configuration anomalies occur during installation, exit Desktop, compare the pre-installation backup with the current files, and restore changes to package.json, pnpm-lock.yaml, and cordis.patch.yml caused by that installation. If no other modifications were made during that period, you can restore the full backup. Spilled files can be independently retained or cleaned up.

Verification

Run npm test in the source or unpacked directory. On Windows, run npm test -- --powershell to verify explicit PowerShell. Run node scripts/spill-check.mjs to check private directory permissions, 15 MiB command output, and actual spilling of 5,000 search results.

Use Cases

  • Agents need to execute temporary commands to gather system information
  • Reading large files or partial content is required
  • Searching for specific patterns across many files is needed
  • File metadata or ASAR archive content inspection is required

Note: The plugin runs with the current DSH process permissions. Review the source code and license before installing. In restricted mode, the plugin goes through the host OS sandbox; in full-access mode, it writes to the spill directory.

Summary

Lite Exec provides DeepSeek Harness with a set of controlled Shell and file operation tools. By constraining output size, timeouts, permissions, and search scope, it strikes a balance between security and functionality. Developers can enable or disable specific tools via configuration, use a custom Bash path, and leverage the spill mechanism to handle results exceeding in-memory limits.

  • Plugin homepage: https://www.skillhub.cn/plugins/ClearMind-17/lite-exec
  • GitHub: https://github.com/ClearMind-17/lite-exec
羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye