← Back to home@Jaylor-Wang

dsh-fast-loop

High-performance streaming agent loop plugin for DeepSeek Harness

Stars
2
Language
TypeScript
Created
Oct 24, 2026
Updated
Oct 26, 2026

Introduction

dsh-fast-loop

English | 中文

npm version license GitHub release TypeScript

High-performance streaming agent loop plugin for DeepSeek Harness (DSH).

Replaces the default agent-loop with a high-throughput, bounded concurrent execution engine featuring zero-allocation transactional message routing, caller-shadow safe Cordis service reachability, and resilient durable turn/step boundary recovery.


Highlights in v0.4.6

  • Native Web GUI Settings Card: Seamlessly registers an interactive settings card in DSH General Settings (通用设置), offering a visual slider (1–32) and quick presets for maxParallelToolCalls without modifying DSH core code.
  • Dynamic Volatile Store Sampling: Concurrency limits dynamically resolve reactive state from client volatile stores or functions in real time without restarting the web service or refreshing the page.
  • DSH Client Plugin Web Manifest: Fully exports ./client conforming to DSH client specifications, declaring dsh.client for the web platform with clean locale and settings dependencies.

Highlights in v0.4.5

  • Strict Monotonic Stream Revisions & Terminal Guard: Enforces monotonic assistant stream revisions with a terminal guard (push, settle, abandon), eliminating duplicate frames and preventing RemoteStreamCarrierError: session assistant stream skipped revision in DSH Web UI.
  • Active Phase Wake Latching (Steering Guarantee): Latches phase.wakeRequested = true when messages arrive during active execution (phase.kind === "running"), automatically waking the driver upon turn completion so mid-turn user inputs are never dropped.
  • Clean Turn Settlement & Signal Reset: Resets AbortController and step counters per turn, ensuring turns end with clean { kind: "completed" } statuses and eliminating spurious UI "处理失败" error markers.
  • Event-Sourced V4 Protocol Compliance: Correctly sets producer-owned source kinds on synthetic recovery messages to satisfy strict DSH Session V4 formatting contracts.
  • Comprehensive Front-End Contract Test Suite: Ships with dedicated mock tests covering stream monotonicity, idempotent abandonment, V4 source compliance, and phase wake latching.

Features

1. High-Concurrency Tool Scheduler

  • Bounded Concurrency Pool: Dynamically dispatches parallelizable tool calls up to maxParallelToolCalls concurrently, preserving strict sequential FIFO order for durable event persistence.
  • Exclusive Tool Barrier: Automatically blocks and synchronizes in-flight tasks before running exclusive tools (e.g. state-mutating commands or terminal operations).
  • Tool Crash Recovery: Traps and contains unhandled tool execution failures, ensuring prior tool results are safely settled and recorded without corrupting agent state.

2. Architecture & Cordis Integration

  • Runtime Dependency Holding: Shields factory dependency lookups from caller shadow proxies, ensuring sessionProjections, systemPrompt, tools, and llm services remain reachable in all execution contexts.
  • Durable Turn Boundaries: Accurately tracks turn/step boundaries across process restarts and reloads (turnBoundary projection), preventing state drift and premature interruptions.
  • Session Persistence Splicing: Seamlessly restores historical turns and appends interrupted turn closers during resume.

Installation

Via DSH Plugin CLI (Recommended)

dsh plugin --profile web add dsh-fast-loop@latest

Via npm / pnpm

npm install dsh-fast-loop@latest
# or
pnpm add dsh-fast-loop@latest

Method 1: One-Click CLI Switcher (Recommended)

Switch between Fast Loop and Official Loop effortlessly without manual YAML editing:

# Enable dsh-fast-loop and disable official agent-loop
dsh-fast-loop enable
# or run without global install via npx:
npx dsh-fast-loop enable

# Restore official agent-loop and disable fast-loop
dsh-fast-loop disable
# or
npx dsh-fast-loop disable

# Check current active loop mode
dsh-fast-loop status
# or
npx dsh-fast-loop status

Method 2: Manual cordis.patch.yml Configuration

In ~/.dsh/profiles/web/cordis.patch.yml, disable agent-loop and insert dsh-fast-loop:

# Disable standard loop
- id: agent-loop
  disabled: true

# Insert high-performance fast loop
- insert:
  - id: fast-loop
    name: dsh-fast-loop
    config:
      maxParallelToolCalls: 10
      enableStreamingTools: true
      enablePathAwareBarrier: true
      enableSteeringSoftInterrupt: true

Configuration

OptionTypeDefaultDescription
maxParallelToolCallsnumber10Maximum number of concurrent parallel tool calls allowed per step.
enableStreamingToolsbooleantrueWhether to enable streaming tool result delivery.
enablePathAwareBarrierbooleantrueWhether to enable Path-Aware Barrier for multi-file concurrent edits.
enableSteeringSoftInterruptbooleantrueWhether to enable cooperative soft-interruption for wait tools upon incoming steer messages.
agentsarray[]Static agent identity and configuration overrides.

License

MIT © dsh-fast-loop contributors