# The dsh-headless bundle patch: one-shot task mode directly over dsh-base.
# It mounts no Host, HTTP server, Web runtime, or browser plugin. An ordinary
# provider plugin injects `cmdlineArgs`, parses the task positional
# (`dsh --profile headless "<task>"`) and this app's --help, then the direct
# driver creates an Agent through the core registry and prints its durable result.

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

# The shared module-reload HMR row stays off; the launcher also skips its
# watch-only fallback for this one-shot surface (apps/cli/src/profile-boot.ts),
# because the run must exit when its single task does.
- id: hmr
  disabled: true

# The process-wide Code Mode opt-in (DSH_TOOLS_MODE) is applied by the dsh
# launcher above every bundle layer (apps/cli/src/profile-boot.ts), like the
# Web surface.

- insert:
    # Code Mode is a core execution capability, not a Web component.
    - id: code-runtime
      name: '@monotykamary/dsh-code-runtime-worker-thread'

    # The Fabric mesh provider persists its coordination state through the
    # same storage-domain seam as the Web surface (dsh-fabric-mesh/provider
    # injects storageDomain); headless one-shot runs share that durable state.
    - id: storage
      name: '@monotykamary/dsh-storage'

    - id: storage-json
      name: '@monotykamary/dsh-storage-json'
      config:
        root: !!js dshHomePath('storages')

    - id: storage-domain
      name: '@monotykamary/dsh-storage-domain'
      config:
        backend: json

    - id: headless-startup
      name: '@monotykamary/dsh-headless/startup'

    # Reads its task from the ordinary headlessStartup provider.
    - id: headless-runner
      name: '@monotykamary/dsh-headless'
      inject: [headlessStartup]
      config:
        task: !!js ctx.headlessStartup.task
