# yexi-by/dsh-unrestricted architecture

> Architecture diagram of the GitHub repository yexi-by/dsh-unrestricted, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/yexi-by/dsh-unrestricted
- Repository: https://github.com/yexi-by/dsh-unrestricted

## Overview

dsh-unrestricted is a DSH plugin that conditionally fuses its rules into each agent’s system prompt while preserving the host’s tools and permissions. The principal flow is request assembly through anchor validation and mode-specific fusion, with a settings card for toggling, status, and previews. README documents Standard, Cordis, PTC, Plan, Minimal, and subagent behavior; the sampled host code confirms assembly interception and preview/status support, but not every internal mode path.

Main entry points: [`src/node.js`](https://github.com/yexi-by/dsh-unrestricted/blob/master/src/node.js) (Prompt assembly hook), [`src/client/controller.ts`](https://github.com/yexi-by/dsh-unrestricted/blob/master/src/client/controller.ts) (UI controller), [`src/client/index.tsx`](https://github.com/yexi-by/dsh-unrestricted/blob/master/src/client/index.tsx) (UI registration), [`src/client/UnrestrictedCard.tsx`](https://github.com/yexi-by/dsh-unrestricted/blob/master/src/client/UnrestrictedCard.tsx) (Settings card)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Settings UI"]
  node_settings["Settings card"]
  node_controller["UI controller<br/>[controller.ts]"]
  node_registration["UI registration<br/>[index.tsx]"]
  node_locales["Localized copy<br/>[locales.ts]"]
  node_styles["Card styling<br/>[styles.ts]"]
end

subgraph group_host["Prompt integration"]
  node_assembly["Prompt assembly hook<br/>[node.js]"]
  node_validation["Mode validation<br/>[node.js]"]
  node_status["Status and preview RPC<br/>[node.js]"]
  node_config[("Profile toggle<br/>[node.js]")]
end

subgraph group_rules["Fusion rules"]
  node_fusion["Anchor-based fusion<br/>[rules.js]"]
  node_modeprompts["Mode prompt sections<br/>[rules.js]"]
  node_preview["Prompt preview<br/>[rules.js]"]
end

node_user(("Plugin user"))
node_dsh(("DSH runtime"))
node_model(("Model request"))

node_user -->|"configures"| node_settings
node_registration -->|"creates"| node_controller
node_registration -->|"registers"| node_settings
node_registration -->|"injects"| node_styles
node_registration -->|"registers"| node_locales
node_settings -->|"reads state"| node_controller
node_settings -->|"renders text"| node_locales
node_controller -->|"requests status"| node_status
node_controller -->|"requests preview"| node_status
node_controller -->|"reads toggle"| node_config
node_user -->|"starts request"| node_dsh
node_dsh -->|"assembles prompt"| node_assembly
node_assembly -->|"checks toggle"| node_config
node_assembly -->|"checks anchors"| node_validation
node_validation -->|"validates sections"| node_fusion
node_assembly -->|"fuses sections"| node_fusion
node_fusion -->|"adds rules"| node_modeprompts
node_assembly -->|"records preview"| node_status
node_status -->|"renders preview"| node_preview
node_preview -->|"uses fusion"| node_fusion
node_assembly -.->|"provides prompt"| node_model

click node_settings "https://github.com/yexi-by/dsh-unrestricted/blob/master/src/client/UnrestrictedCard.tsx"
click node_controller "https://github.com/yexi-by/dsh-unrestricted/blob/master/src/client/controller.ts"
click node_registration "https://github.com/yexi-by/dsh-unrestricted/blob/master/src/client/index.tsx"
click node_locales "https://github.com/yexi-by/dsh-unrestricted/blob/master/src/client/locales.ts"
click node_styles "https://github.com/yexi-by/dsh-unrestricted/blob/master/src/client/styles.ts"
click node_assembly "https://github.com/yexi-by/dsh-unrestricted/blob/master/src/node.js"
click node_validation "https://github.com/yexi-by/dsh-unrestricted/blob/master/src/node.js"
click node_status "https://github.com/yexi-by/dsh-unrestricted/blob/master/src/node.js"
click node_config "https://github.com/yexi-by/dsh-unrestricted/blob/master/src/node.js"
click node_fusion "https://github.com/yexi-by/dsh-unrestricted/blob/master/src/rules.js"
click node_modeprompts "https://github.com/yexi-by/dsh-unrestricted/blob/master/src/rules.js"
click node_preview "https://github.com/yexi-by/dsh-unrestricted/blob/master/src/rules.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_settings,node_controller,node_registration,node_locales,node_styles,node_user toneBlue
class node_assembly,node_validation,node_status,node_config toneAmber
class node_fusion,node_modeprompts,node_preview,node_model toneMint
class node_dsh toneIndigo
```

## Components

### Settings UI

- [Settings card](https://github.com/yexi-by/dsh-unrestricted/blob/master/src/client/UnrestrictedCard.tsx): `src/client/UnrestrictedCard.tsx`
- [UI controller](https://github.com/yexi-by/dsh-unrestricted/blob/master/src/client/controller.ts): `src/client/controller.ts`
- [UI registration](https://github.com/yexi-by/dsh-unrestricted/blob/master/src/client/index.tsx): `src/client/index.tsx`
- [Localized copy](https://github.com/yexi-by/dsh-unrestricted/blob/master/src/client/locales.ts): `src/client/locales.ts`
- [Card styling](https://github.com/yexi-by/dsh-unrestricted/blob/master/src/client/styles.ts): `src/client/styles.ts`

### Prompt integration

- [Prompt assembly hook](https://github.com/yexi-by/dsh-unrestricted/blob/master/src/node.js): `src/node.js`
- [Mode validation](https://github.com/yexi-by/dsh-unrestricted/blob/master/src/node.js): `src/node.js`
- [Status and preview RPC](https://github.com/yexi-by/dsh-unrestricted/blob/master/src/node.js): `src/node.js`
- [Profile toggle](https://github.com/yexi-by/dsh-unrestricted/blob/master/src/node.js): `src/node.js`

### Fusion rules

- [Anchor-based fusion](https://github.com/yexi-by/dsh-unrestricted/blob/master/src/rules.js): `src/rules.js`
- [Mode prompt sections](https://github.com/yexi-by/dsh-unrestricted/blob/master/src/rules.js): `src/rules.js`
- [Prompt preview](https://github.com/yexi-by/dsh-unrestricted/blob/master/src/rules.js): `src/rules.js`

### Other components

- **Plugin user**
- **DSH runtime**
- **Model request**

## Connections

- Plugin user → Settings card: configures (evidence: `README.md`)
- UI registration → UI controller: creates (evidence: `src/client/index.tsx`)
- UI registration → Settings card: registers (evidence: `src/client/index.tsx`)
- UI registration → Card styling: injects (evidence: `src/client/index.tsx`)
- UI registration → Localized copy: registers (evidence: `src/client/index.tsx`)
- Settings card → UI controller: reads state (evidence: `src/client/UnrestrictedCard.tsx`)
- Settings card → Localized copy: renders text (evidence: `src/client/UnrestrictedCard.tsx`)
- UI controller → Status and preview RPC: requests status (evidence: `src/client/controller.ts`)
- UI controller → Status and preview RPC: requests preview (evidence: `src/client/controller.ts`)
- UI controller → Profile toggle: reads toggle (evidence: `src/client/controller.ts`)
- Plugin user → DSH runtime: starts request (evidence: `README.md`)
- DSH runtime → Prompt assembly hook: assembles prompt (evidence: `README.md`)
- Prompt assembly hook → Profile toggle: checks toggle (evidence: `src/node.js`)
- Prompt assembly hook → Mode validation: checks anchors (evidence: `src/node.js`)
- Mode validation → Anchor-based fusion: validates sections (evidence: `src/node.js`)
- Prompt assembly hook → Anchor-based fusion: fuses sections (evidence: `src/node.js`)
- Anchor-based fusion → Mode prompt sections: adds rules (evidence: `src/rules.js`)
- Prompt assembly hook → Status and preview RPC: records preview (evidence: `src/node.js`)
- Status and preview RPC → Prompt preview: renders preview (evidence: `src/node.js`)
- Prompt preview → Anchor-based fusion: uses fusion (evidence: `src/rules.js`)
- Prompt assembly hook → Model request: provides prompt (evidence: `README.md`)
