편집자 노트

henryZhouLikeStudy/dsh-lattice-adapter-command

DSH Lattice command adapter: safe shell:false subprocess execution with JSONL/JSON-RPC sessions

이것은 DeepSeek Harness(DSH) 플러그인입니다. 이 사이트는 GitHub README, 설치 정보, 유지보수 상태, 공개 보안 시그널을 모아 보여줍니다.

업스트림에서 중국어 README를 제공하지 않아 저장소 원본 내용을 표시합니다.

@dsh-lattice/adapter-command

DSH Lattice V1 command adapter: safe shell: false execution with persistent or one-shot JSON-lines / JSON-RPC sessions, cancellation, timeouts and output limits.

This package is an independent community adapter, part of the DSH Lattice facade project. It is not affiliated with, endorsed by, or sponsored by DeepSeek AI.

Why it exists

The command adapter turns any executable into a Lattice provider with strict, auditable boundaries. It is the transport seam used by the aggregator's local provider and by the transports' demo engine, and it is safe to point at untrusted tools because:

  • No shell, ever. Execution is spawn(executable, args) with an explicit argument vector. shell: true or a command string is rejected at config validation; shell metacharacters in arguments are inert data.
  • Deterministic limits. Every run has a timeout (default 120s), per-stream output caps (default 1 MiB) with an explicit truncation marker, and a per-frame cap for persistent protocols.
  • Cancellation. Abort signals and per-call timeouts terminate the process tree (process group on POSIX, taskkill /T /F on Windows). Results are never claimed to be exactly-once.
  • Environment policy. inherit (default), allowlist, or none.

Modules

ModuleResponsibility
configStrict config validation: executable policy, shell: false enforcement, arg/env validation, defaults
framingLine framing (one compact JSON frame per \n line) shared by both session protocols — the same framing the DeepSeek Harness SDK protocol uses
runnerOne-shot execution: timeout → SIGTERM → SIGKILL, output caps, abort cancellation, process-tree termination
sessionPersistent child: request/response correlation, per-call timeouts, cancel notifications, frame caps, bounded stderr, clean teardown
clidsh-lattice-command run and dsh-lattice-command serve

Usage

One-shot

import { runOneShot } from "@dsh-lattice/adapter-command";

const result = await runOneShot({
  executable: process.execPath,
  args: ["-e", "console.log('hi')"],
  shell: false,
  mode: "one-shot",
  timeoutMs: 30_000,
  maxOutputBytes: 65_536,
});
// { exitCode: 0, stdout: "hi\n", timedOut: false, truncated: {...} }

Persistent JSON-RPC session

import { CommandSession } from "@dsh-lattice/adapter-command";

const session = new CommandSession({
  executable: "my-agent-server",
  args: ["--stdio"],
  shell: false,
  mode: "persistent",
  protocol: "jsonrpc",
});
session.start();
const result = await session.call("agent/turn", { prompt: "..." }, { timeoutMs: 60_000 });
session.close();

The session protocol speaks one JSON frame per line. jsonrpc frames conform to JSON-RPC 2.0; jsonl frames are { id, method, params }. A cancel notification ({ method: "cancel", params: { id } }) is sent when a call times out or is aborted, so cooperative servers can stop work.

CLI

dsh-lattice-command run --executable node --arg -e --arg "console.log('hi')"
# {"ok":true,"result":{"exitCode":0,"stdout":"hi\n",...}}

dsh-lattice-command serve --executable my-agent-server --arg --stdio --protocol jsonrpc
# proxy: {"jsonrpc":"2.0","id":1,"method":"echo","params":{}} → {"id":1,"result":{...}}

Security

See SECURITY.md. Highlights: shell: false enforced, argument vector only, timeout + output + frame caps, process-tree termination, env allowlist.

Platform caveat (Windows): libuv merges the provided env into the parent environment when spawning on Windows, so allowlist/none overlay their keys but cannot remove inherited keys. On POSIX the environment is replaced exactly. Use POSIX or container isolation for strict environment sandboxing.

Upstream compatibility

The line framing mirrors the DeepSeek Harness SDK protocol transport (JSON-RPC 2.0, one compact JSON frame per \n-terminated line; malformed lines ignored — upstream packages/sdk/protocol/README.md). This is a design reference only; no upstream code is vendored.

Development

pnpm install
pnpm build && pnpm typecheck && pnpm test && pnpm coverage

License

Apache-2.0. See LICENSE and NOTICE.

REPOSITORY SIGNALS

보안 및 설치 증거

이 점수는 공개 저장소 메타데이터와 이 사이트에 등록된 설치 증거에만 기반하며, 코드 보안 감사와 다릅니다.

출처 추적 가능

공개 플러그인 카탈로그에서 왔으며, 공개 GitHub 저장소로 연결됩니다.

라이선스

저장소가 Apache-2.0 라이선스를 선언했습니다.

유지보수 활동

최근 180일 내 코드 업데이트가 있습니다.

설치 증거

재현 가능한 정확한 설치 메타데이터가 아직 등록되지 않았습니다. 저장소 설명에 따라 직접 확인하세요.

설치 라이프사이클 스크립트

검사한 패키지 메타데이터에 설치 라이프사이클 스크립트가 선언되지 않았습니다.