dshbase

插件目录 / Automation / dsh-gatedflow

dsh-gatedflow

已验证 · 实测可装 TtTRz

✓ 持续维护 纯 TypeScript

查看 GitHub ↗ ← 返回插件目录

1Stars
0Forks
0未关闭 issue
TypeScript语言
2026-08-15最近推送
跨平台平台

功能简介

dsh-gatedflow — DSH 插件(编排)

✅
我们的评价
可用 — 实测通过,早期项目

dsh-gatedflow — DSH 插件(编排) 实测能干净安装、正常启动。早期项目,但功能可用。

「已验证」表示我们的自动化 CI 在干净 profile 里实际执行了 dsh plugin add 并启动成功——仅此而已。功能描述与版本兼容性均为作者声明。这不是安全审计,也不代表对第三方代码的背书。

README

dsh-gatedflow

Gated, durable, human-in-the-loop workflows for DeepSeek Harness — gates
as control flow: "must verify / confirm / review" rules live in the engine,
not in prompts, so no agent can skip them under load.

Zero-mutation replan · gates as control flow · declarative subflows.
The engine core contains no LLM and no orchestrator dependencies.

Packages

Package Description Dependencies
@gatedflow/engine Framework-agnostic engine core: validation, expansion, deterministic conditions, the workflow state machine. none
@gatedflow/dsh DeepSeek Harness adapter: gf_* tools, the gate panel UI, the anti-bypass guard, filesystem persistence. @gatedflow/engine + DSH services

The idea in one picture

user task ──► agent composes atomics (Ref/Inline) ──► gf_start
                                                       │
              path ① single Ref ──────────────┐        │
              path ② multi/inline ── pre_start_gate (human approves the plan)
                                                       ▼
              shell (command + expect) ─ interrupt (human gate via panel)
              handoff (delegate back to the agent) ─ conditional (structured fields)
                                                       ▼
                                                   done (auto)
  • Gates are control flow. interrupt steps pause the engine; the human
    approves or rejects through a panel card in the conversation. The model
    agent has no approve/reject channel — gf_advance rejects them (guard
    • schema), and decisions travel straight from the panel to the engine.
  • Zero mutation. Agents cannot rewrite workflow state, params, or
    routing. Failures take exactly two paths: step-level failure with
    pause_on_failure → pause → human repairs → retry (prior outputs kept);
    otherwise abort → failed → human reviews → new workflow.
  • Declarative subflows. Workflows are JSON/YAML data, validated at load
    time and snapshotted at start — what the human approves is exactly what
    executes.
  • No LLM in the engine. Semantic judgment happens on the agent side and
    returns structured fields; the engine only evaluates deterministic
    operators (==, !=, >=, <=, >, <, contains, &&, ||, !).

Quick start

npm install
npm run check   # build + typecheck + unit tests

Run a workflow (as a DSH user)

The adapter registers seven tools. The agent composes a plan, then:

gf_start({ atomics: [
  { name: 'gf-verify-demo', params: { note: 'hello' } },
  { type: 'shell', params: { command: 'echo done', expect: 'true' } },
]})
  • Single Ref runs the preset deterministically (no gate wrapper).
  • Multiple / Inline atomics wrap a pre_start_gate: the engine pauses
    and the plan appears as a panel card above the composer. Click ✓ Approve
    to proceed or ✕ Reject to abort.
  • Handoff gates pause for the agent; the agent returns structured results
    via gf_advance(handoff_complete, result).
  • A failed step with pause_on_failure shows an Awaiting retry card;
    after the human repairs the environment,
    gf_advance(decision: 'retry') re-runs only that step.

Author a subflow

Drop a JSON file into a subflows directory — the session workspace's
.gatedflow/subflows (scanned automatically, takes precedence on name
conflicts) or the shared root (~/.gatedflow/subflows by default,
GATEDFLOW_SUBFLOWS_DIR to override) — then call gf_reload_subflows
(hot-loaded, no restart):

{
  "name": "release",
  "description": "build with objective verification, human review, then publish",
  "keywords": ["release", "build", "review"],
  "params": { "branch": { "required": true } },
  "steps": [
    { "id": "build", "type": "shell", "params": { "command": "npm run build", "expect": "test -f dist/index.js", "max_retries": 1, "pause_on_failure": true }, "on_success": "review", "on_failure": "abort" },
    { "id": "review", "type": "interrupt", "params": { "message": "Publish ${branch}?" }, "on_approve": "publish", "on_reject": "abort" },
    { "id": "publish", "type": "shell", "params": { "command": "npm publish" }, "on_success": "next", "on_failure": "abort" }
  ]
}

See examples/subflows/ for more.

Architecture

  • docs/DESIGN.md — root constraints, step model, routing,
    data references, gate protocol, persistence and anti-stuck design, with
    the decision record.
  • docs/INTEGRATION.md — mounting the adapter in a
    DSH composition, environment variables, tool reference, and the agent
    skill guidance.

Development

npm install
npm run test          # unit tests (vitest, engine + adapter)
npm run typecheck     # strict TS across both packages
npm run build         # tsc output for engine + dsh

The engine package is deliberately dependency-free and framework-agnostic;
the DSH adapter is a thin, typed wiring layer over the harness services
(fs, shell, tools, timer, subagents; the gateway row additionally
consumes webServer), configurable through a
schemastery Config schema exactly like the official DSH plugins. See the
package README for the plugin contract.
Contributions welcome — see CONTRIBUTING.md.

Status

v0.1 ships the engine core plus the DSH adapter with shell / interrupt /
handoff / conditional / agent_delegate / agent_resume steps, the
gate panel, the anti-bypass guard, gate deadlines, /stop-safe interruption
semantics, hot-reloadable subflows, bounded-tail audit logs, and
restore-on-reference persistence. Roadmap: YAML-native subflow authoring
improvements and a solidify flow that turns recurring dynamic plans into
named presets.

License

MIT — see LICENSE.

Relationship to gatedflow

This project is an independent, native implementation of the gatedflow
philosophy for DeepSeek Harness. It shares the vocabulary (atomics,
subflows, pre_start_gate, zero-mutation replan, decision records) but
re-implements everything on harness-native primitives — the engine core is
written from scratch in TypeScript with no external dependencies.

安装

🧩 让 Agent 自动装(推荐)

装一次目录插件,之后本站所有插件都能让 DeepSeek Harness 自动找、自动装:

dsh plugin add dshbase-catalog

然后对 agent 说「帮我装 dsh-gatedflow」,它会在目录里找到并自动安装。文档:dshbase-catalog · 已验证场景包。

该插件是 GitHub 源码(未发 npm)——直接从仓库装:

Web profile:

dsh plugin --profile web add github:TtTRz/dsh-gatedflow

Headless(CLI)profile:

dsh plugin --profile headless add github:TtTRz/dsh-gatedflow

实测报告

验证通过:从 GitHub 源码完成 L1 安装 + L2 加载 + L3 运行(dsh 0.1.0-rc.6)。

使用场景

自动化一项重复工作——调度、串联任务或响应事件——不用你亲手启动。

适合谁

有周期性工作、想 cron 式无人值守而非手动触发的人。

二次开发建议

触发器和任务模板是缝——加事件驱动或文件监听触发,以及更丰富的流程编排。

安全:尚未扫描——我们的每日静态扫描将很快覆盖它。

分享徽章

Automation 里更多

浏览全部 7797 个插件 →