henryZhouLikeStudy/dsh-lattice-adapter-command ↗★ 0
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.
AI Analysis
核心用途是为 Lattice 体系提供安全的外部命令行进程执行通道,适合需要运行本地 Agent 服务、控制执行超时与输出边界的系统集成任务。
Install
This plugin has no verified bundle, or compatibility checks failed. Read the repository notes first. Read the full README ↗
README
Read the full README ↗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')"