# The dsh-tui bundle patch: interactive terminal mode directly over dsh-base.
# It mounts no Host, HTTP server, Web runtime, or browser plugin. An ordinary
# provider plugin injects `cmdlineArgs`, parses this app's flags
# (`dsh --profile tui [--resume <id>]`), then the interactive runner creates
# or resumes an Agent through the core registry and drives it from the TTY.

- id: system-prompt
  config:
    persona: >-
      You are a coding agent powered by the {{model}} model. Your working directory is {{cwd}}.

# Module-reload HMR redraws would fight the interactive terminal; the
# launcher's watch-only fallback still keeps the user patch layers live.
- id: hmr
  disabled: true

- insert:
    - id: tui-startup
      name: '@tomowang/dsh-tui/startup'

    # Reads its startup values from the ordinary tuiStartup provider.
    - id: tui
      name: '@tomowang/dsh-tui'
      inject: [tuiStartup]
      config:
        resume: !!js ctx.tuiStartup.resume
        agentPreset: !!js ctx.tuiStartup.agentPreset

    # Whole-log turn/step counts for the status bar's stats line (the
    # sessionStats projection key); dsh-base mounts the registry itself but
    # only dsh-web-app's bundle mounts this unit, so the TUI mounts its own
    # copy. The registry is a base-layer row, so this activates regardless of
    # insertion order.
    - id: session-stats
      name: '@deepseek-ai/dsh-session-stats'

    # Preset roster and mid-session preset switching for `/presets` and
    # `--agent-preset`. dsh-base doesn't mount this row (only dsh-web-app's
    # bundle does); the deepseek-harness CLI's own profile-boot patches
    # shipped preset roots onto any `agent-presets` row regardless of which
    # layer inserted it, so mounting a bare copy (with a required `default`)
    # here is enough to pick up the standard/code/minimal/cordis roster.
    - id: agent-presets
      name: '@deepseek-ai/dsh-agent-presets'
      config:
        default: standard

    # Host-owned opt-in the shipped presets' `tool-subagent` rows require:
    # the standard/code/minimal/cordis presets all set `modelSelectionSettings:
    # true` on their delegation tool, which throws at preset-mount time
    # ("requires @deepseek-ai/dsh-tool-subagent/model-selection-settings in
    # the Host scope") without this row composed somewhere above them.
    # dsh-base's own host-plane `tool-subagent` doesn't request the flag, so
    # dsh-base never needed this; mirrors dsh-web-app's bundle, which mounts
    # the same row for the same reason.
    - id: subagent-model-selection-settings
      name: '@deepseek-ai/dsh-tool-subagent/model-selection-settings'
