henryZhouLikeStudy/dsh-lattice-adapter-command0

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 분석

核心用途是为 Lattice 体系提供安全的外部命令行进程执行通道,适合需要运行本地 Agent 服务、控制执行超时与输出边界的系统集成任务。

패키지
dsh-lattice-adapter-command
버전
0.1.0
라이선스
Apache-2.0
최근 업데이트
2026. 8. 14.

설치

검증된 bundle이 없거나 호환성 검사에 실패했습니다. 먼저 저장소 설명을 읽어 주세요. 전체 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')"