# tikaflow/dsh-model-fix architecture

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

- Interactive diagram: https://gitdiagram.com/tikaflow/dsh-model-fix
- Repository: https://github.com/tikaflow/dsh-model-fix

## Overview

dsh-model-fix is a DeepSeek Harness plugin that enriches custom-provider model settings from models.dev and adds compatibility and reasoning-effort conveniences. Its main workflow starts at plugin activation: migrate configuration, load or refresh the catalog, then fill or update eligible provider models. Users configure behavior in the client card, which sends operations through RPC; the plugin also supports forced updates, effort resets, and restoring startup backups. Edges reflect README statements and indexed imports; unsampled implementation details are not inferred beyond those references.

Main entry points: [`src/fix.ts`](https://github.com/tikaflow/dsh-model-fix/blob/main/src/fix.ts) (Model repair), [`src/index.ts`](https://github.com/tikaflow/dsh-model-fix/blob/main/src/index.ts) (Plugin activation), [`src/rpc.ts`](https://github.com/tikaflow/dsh-model-fix/blob/main/src/rpc.ts) (RPC dispatch), [`src/client/index.tsx`](https://github.com/tikaflow/dsh-model-fix/blob/main/src/client/index.tsx) (Client integration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Plugin runtime"]
  node_entry["Plugin activation<br/>[index.ts]"]
  node_migrate["Config migration<br/>[migrate.ts]"]
  node_refresh["Catalog refresh<br/>[refresh.ts]"]
  node_fill["Model repair<br/>[fix.ts]"]
  node_compat["Route compatibility<br/>[compat.ts]"]
  node_lookup["Model matching<br/>[lookup.ts]"]
  node_rpc["RPC dispatch<br/>[rpc.ts]"]
  node_rpcroute["RPC route<br/>[rpc-route.ts]"]
  node_reset["Effort reset<br/>[reset.ts]"]
  node_restore["Backup restore<br/>[restore.ts]"]
  node_guard["Mutation guard<br/>[guard.ts]"]
  node_hostqueue["Host task queue<br/>[host.ts]"]
end

subgraph group_catalog["Model data"]
  node_catalogdata["Model catalog<br/>[catalog.ts]"]
  node_cache["Bundled catalog cache<br/>[models-cache.json]"]
end

subgraph group_client["Settings client"]
  node_card["Settings card<br/>[card.tsx]"]
  node_cliententry["Client integration<br/>[index.tsx]"]
  node_clientmodel["Settings mapping<br/>[model.ts]"]
  node_effort["Effort behavior<br/>[effort.ts]"]
  node_slot["Client contract<br/>[slot-contract.ts]"]
  node_locales["Client locales<br/>[locales.ts]"]
end

subgraph group_shared["Shared configuration"]
  node_config["Runtime config<br/>[config.ts]"]
  node_parser["Snapshot parsing<br/>[parse.ts]"]
  node_types["Shared types<br/>[types.ts]"]
end

node_harness(("DSH host"))
node_user(("Plugin user"))
node_modelsdev["models.dev"]

node_harness -->|"loads plugin"| node_entry
node_entry -->|"migrates config"| node_migrate
node_entry -->|"starts refresh"| node_refresh
node_entry -->|"starts repair"| node_fill
node_entry -->|"registers RPC"| node_rpc
node_entry -->|"captures backup"| node_restore
node_entry -->|"sets config source"| node_config
node_refresh -->|"refreshes catalog"| node_catalogdata
node_refresh -->|"triggers repair"| node_fill
node_catalogdata -->|"reads and writes"| node_cache
node_modelsdev -->|"provides model data"| node_catalogdata
node_fill -->|"uses catalog"| node_catalogdata
node_fill -->|"plans route changes"| node_compat
node_fill -->|"matches models"| node_lookup
node_fill -->|"reads rules"| node_config
node_rpc -->|"registers routes"| node_rpcroute
node_rpc -->|"dispatches updates"| node_fill
node_rpc -->|"dispatches reset"| node_reset
node_rpc -->|"dispatches restore"| node_restore
node_rpc -->|"guards actions"| node_guard
node_user -->|"configures plugin"| node_card
node_cliententry -->|"renders card"| node_card
node_cliententry -->|"uses effort behavior"| node_effort
node_cliententry -->|"uses contract"| node_slot
node_cliententry -->|"loads labels"| node_locales
node_card -->|"uses settings mapping"| node_clientmodel
node_card -->|"sends operations"| node_rpc
node_clientmodel -->|"decodes snapshots"| node_parser
node_config -->|"resolves snapshots"| node_parser
node_parser -->|"validates objects"| node_types
node_migrate -->|"resolves config"| node_config
node_migrate -->|"upgrades snapshots"| node_parser
node_restore -->|"guards restore"| node_guard
node_restore -->|"queues writes"| node_hostqueue
node_fill -->|"queues writes"| node_hostqueue

click node_entry "https://github.com/tikaflow/dsh-model-fix/blob/main/src/index.ts"
click node_migrate "https://github.com/tikaflow/dsh-model-fix/blob/main/src/migrate.ts"
click node_refresh "https://github.com/tikaflow/dsh-model-fix/blob/main/src/refresh.ts"
click node_fill "https://github.com/tikaflow/dsh-model-fix/blob/main/src/fix.ts"
click node_compat "https://github.com/tikaflow/dsh-model-fix/blob/main/src/compat.ts"
click node_lookup "https://github.com/tikaflow/dsh-model-fix/blob/main/src/lookup.ts"
click node_rpc "https://github.com/tikaflow/dsh-model-fix/blob/main/src/rpc.ts"
click node_rpcroute "https://github.com/tikaflow/dsh-model-fix/blob/main/src/rpc-route.ts"
click node_reset "https://github.com/tikaflow/dsh-model-fix/blob/main/src/reset.ts"
click node_restore "https://github.com/tikaflow/dsh-model-fix/blob/main/src/restore.ts"
click node_guard "https://github.com/tikaflow/dsh-model-fix/blob/main/src/guard.ts"
click node_hostqueue "https://github.com/tikaflow/dsh-model-fix/blob/main/src/host.ts"
click node_catalogdata "https://github.com/tikaflow/dsh-model-fix/blob/main/src/catalog.ts"
click node_cache "https://github.com/tikaflow/dsh-model-fix/blob/main/public/models-cache.json"
click node_card "https://github.com/tikaflow/dsh-model-fix/blob/main/src/client/card.tsx"
click node_cliententry "https://github.com/tikaflow/dsh-model-fix/blob/main/src/client/index.tsx"
click node_clientmodel "https://github.com/tikaflow/dsh-model-fix/blob/main/src/client/model.ts"
click node_effort "https://github.com/tikaflow/dsh-model-fix/blob/main/src/client/effort.ts"
click node_slot "https://github.com/tikaflow/dsh-model-fix/blob/main/src/client/slot-contract.ts"
click node_locales "https://github.com/tikaflow/dsh-model-fix/blob/main/src/client/locales.ts"
click node_config "https://github.com/tikaflow/dsh-model-fix/blob/main/src/config.ts"
click node_parser "https://github.com/tikaflow/dsh-model-fix/blob/main/src/shared/parse.ts"
click node_types "https://github.com/tikaflow/dsh-model-fix/blob/main/src/shared/types.ts"

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_entry,node_migrate,node_refresh,node_fill,node_compat,node_lookup,node_rpc,node_rpcroute,node_reset,node_restore,node_guard,node_hostqueue,node_user toneBlue
class node_catalogdata,node_cache toneAmber
class node_card,node_cliententry,node_clientmodel,node_effort,node_slot,node_locales toneMint
class node_config,node_parser,node_types toneRose
class node_harness,node_modelsdev toneIndigo
```

## Components

### Plugin runtime

- [Plugin activation](https://github.com/tikaflow/dsh-model-fix/blob/main/src/index.ts): `src/index.ts`
- [Config migration](https://github.com/tikaflow/dsh-model-fix/blob/main/src/migrate.ts): `src/migrate.ts`
- [Catalog refresh](https://github.com/tikaflow/dsh-model-fix/blob/main/src/refresh.ts): `src/refresh.ts`
- [Model repair](https://github.com/tikaflow/dsh-model-fix/blob/main/src/fix.ts): `src/fix.ts`
- [Route compatibility](https://github.com/tikaflow/dsh-model-fix/blob/main/src/compat.ts): `src/compat.ts`
- [Model matching](https://github.com/tikaflow/dsh-model-fix/blob/main/src/lookup.ts): `src/lookup.ts`
- [RPC dispatch](https://github.com/tikaflow/dsh-model-fix/blob/main/src/rpc.ts): `src/rpc.ts`
- [RPC route](https://github.com/tikaflow/dsh-model-fix/blob/main/src/rpc-route.ts): `src/rpc-route.ts`
- [Effort reset](https://github.com/tikaflow/dsh-model-fix/blob/main/src/reset.ts): `src/reset.ts`
- [Backup restore](https://github.com/tikaflow/dsh-model-fix/blob/main/src/restore.ts): `src/restore.ts`
- [Mutation guard](https://github.com/tikaflow/dsh-model-fix/blob/main/src/guard.ts): `src/guard.ts`
- [Host task queue](https://github.com/tikaflow/dsh-model-fix/blob/main/src/host.ts): `src/host.ts`

### Model data

- [Model catalog](https://github.com/tikaflow/dsh-model-fix/blob/main/src/catalog.ts): `src/catalog.ts`
- [Bundled catalog cache](https://github.com/tikaflow/dsh-model-fix/blob/main/public/models-cache.json): `public/models-cache.json`

### Settings client

- [Settings card](https://github.com/tikaflow/dsh-model-fix/blob/main/src/client/card.tsx): `src/client/card.tsx`
- [Client integration](https://github.com/tikaflow/dsh-model-fix/blob/main/src/client/index.tsx): `src/client/index.tsx`
- [Settings mapping](https://github.com/tikaflow/dsh-model-fix/blob/main/src/client/model.ts): `src/client/model.ts`
- [Effort behavior](https://github.com/tikaflow/dsh-model-fix/blob/main/src/client/effort.ts): `src/client/effort.ts`
- [Client contract](https://github.com/tikaflow/dsh-model-fix/blob/main/src/client/slot-contract.ts): `src/client/slot-contract.ts`
- [Client locales](https://github.com/tikaflow/dsh-model-fix/blob/main/src/client/locales.ts): `src/client/locales.ts`

### Shared configuration

- [Runtime config](https://github.com/tikaflow/dsh-model-fix/blob/main/src/config.ts): `src/config.ts`
- [Snapshot parsing](https://github.com/tikaflow/dsh-model-fix/blob/main/src/shared/parse.ts): `src/shared/parse.ts`
- [Shared types](https://github.com/tikaflow/dsh-model-fix/blob/main/src/shared/types.ts): `src/shared/types.ts`

### Other components

- **DSH host**
- **Plugin user**
- **models.dev**

## Connections

- DSH host → Plugin activation: loads plugin (evidence: `README.md`)
- Plugin activation → Config migration: migrates config (evidence: `src/index.ts`)
- Plugin activation → Catalog refresh: starts refresh (evidence: `src/index.ts`)
- Plugin activation → Model repair: starts repair (evidence: `src/index.ts`)
- Plugin activation → RPC dispatch: registers RPC (evidence: `src/index.ts`)
- Plugin activation → Backup restore: captures backup (evidence: `src/index.ts`)
- Plugin activation → Runtime config: sets config source (evidence: `src/index.ts`)
- Catalog refresh → Model catalog: refreshes catalog (evidence: `src/refresh.ts`)
- Catalog refresh → Model repair: triggers repair (evidence: `src/refresh.ts`)
- Model catalog → Bundled catalog cache: reads and writes (evidence: `src/catalog.ts`)
- models.dev → Model catalog: provides model data (evidence: `README.md`)
- Model repair → Model catalog: uses catalog (evidence: `src/fix.ts`)
- Model repair → Route compatibility: plans route changes (evidence: `src/fix.ts`)
- Model repair → Model matching: matches models (evidence: `src/fix.ts`)
- Model repair → Runtime config: reads rules (evidence: `src/fix.ts`)
- RPC dispatch → RPC route: registers routes (evidence: `src/rpc.ts`)
- RPC dispatch → Model repair: dispatches updates (evidence: `src/rpc.ts`)
- RPC dispatch → Effort reset: dispatches reset (evidence: `src/rpc.ts`)
- RPC dispatch → Backup restore: dispatches restore (evidence: `src/rpc.ts`)
- RPC dispatch → Mutation guard: guards actions (evidence: `src/rpc.ts`)
- Plugin user → Settings card: configures plugin (evidence: `README.md`)
- Client integration → Settings card: renders card (evidence: `src/client/index.tsx`)
- Client integration → Effort behavior: uses effort behavior (evidence: `src/client/index.tsx`)
- Client integration → Client contract: uses contract (evidence: `src/client/index.tsx`)
- Client integration → Client locales: loads labels (evidence: `src/client/index.tsx`)
- Settings card → Settings mapping: uses settings mapping (evidence: `src/client/card.tsx`)
- Settings card → RPC dispatch: sends operations (evidence: `src/client/card.tsx`)
- Settings mapping → Snapshot parsing: decodes snapshots (evidence: `src/client/model.ts`)
- Runtime config → Snapshot parsing: resolves snapshots (evidence: `src/config.ts`)
- Snapshot parsing → Shared types: validates objects (evidence: `src/shared/parse.ts`)
- Config migration → Runtime config: resolves config (evidence: `src/migrate.ts`)
- Config migration → Snapshot parsing: upgrades snapshots (evidence: `src/migrate.ts`)
- Backup restore → Mutation guard: guards restore (evidence: `src/restore.ts`)
- Backup restore → Host task queue: queues writes (evidence: `src/restore.ts`)
- Model repair → Host task queue: queues writes (evidence: `src/fix.ts`)
