henryZhouLikeStudy/dsh-lattice-adapter-command ↗★ 0
dsh-lattice-adapter-command
DSH Lattice V1 命令行适配器:支持安全(shell:false)执行,提供持久或单次 JSON-lines / JSON-RPC 会话、取消、超时及输出限制功能。
AI 分析
核心用途是为 Lattice 体系提供安全的外部命令行进程执行通道,适合需要运行本地 Agent 服务、控制执行超时与输出边界的系统集成任务。
安裝
此插件尚未提供可驗證的 bundle,或相容性檢查未通過。請先閱讀倉庫說明。 閱讀完整 README ↗
說明文件
閱讀完整 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')"