TtTRz / dsh-gatedflow

목록에 있음

Gated, durable human-in-the-loop workflow engine for DeepSeek Harness.

main스킬 소스 보기

설치

npx -y @deepseek-ai/dsh plugin --profile web add github:TtTRz/dsh-gatedflow

이 설치 명령은 GitHub 저장소 주소에서 생성된 확인되지 않은 시작점입니다.

README

유지 관리자가 작성한 문서 스냅샷입니다.

GitHub에서 보기 ↗
커밋 308619b동기화 2026. 8. 18.

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

PackageDescriptionDependencies
@gatedflow/engineFramework-agnostic engine core: validation, expansion, deterministic conditions, the workflow state machine.none
@gatedflow/dshDeepSeek 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 channelgf_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.

프로젝트 파일 및 신호

표시된 항목은 디렉터리 스냅샷에서 감지된 공개 저장소 신호입니다.

테스트감지됨
기여 가이드감지됨
문서감지됨
예제감지됨

저장소 정보

언어
TypeScript
라이선스
MIT
마지막 업데이트
2026. 8. 14. 오전 4:51

신중하게 설치하기

소스 코드, 권한, 수명 주기 스크립트, 의존성 및 네트워크 접근을 검토하고 신뢰하지 않는 플러그인은 격리 환경에서 테스트하세요.