# Self-referential TUI demo: the coding spine plus tools to inspect the live
# service/plugin/tool/mount/API/event state, mount a model-written plugin under
# `cordis-dynamic`, and quiescently unmount it. The app bin loads the gitignored
# root `.env` before reading the required DeepSeek key and optional base URL.
# Trust stance: the vm and context façade limit accidental global/framework
# access but are not a security boundary; mounted code can reach live capabilities
# such as `ctx.bash`. Grant this toolset like bash access. See
# ../../.agents/notes/implemented/feature/2026-07-08-self-referential-cordis-toolset.md.

# Development-only hot reload; production assemblies omit it.
- id: hmr
  name: '@cordisjs/plugin-hmr'
  config:
    root: ['.']

# The DeepSeek adapter. Shipped default: full thinking at max effort on every
# request (wire-only defaults; they never enter the request header).
- id: llm-deepseek
  name: '@deepseek-ai/dsh-llm-deepseek'
  config:
    apiKey: !!js process.env.DEEPSEEK_API_KEY
    baseURL: !!js process.env.DEEPSEEK_BASE_URL
    thinking: enabled
    reasoningEffort: max

# Local bash executor for agent-spine-demo's tool-bash schema — gives the agent an
# ordinary tool whose calls make the mounted listeners observably fire.
- id: bash
  name: '@deepseek-ai/dsh-bash-local'
  config:
    timeoutMs: 60000

# Filesystem service for mounted plugins (ctx.fs) — the local provider only.
# The model-facing read/write/edit tools stay unmounted on purpose: this demo
# is about the agent building its own tools over the services.
- id: fs-local
  name: '@deepseek-ai/dsh-fs-local'
  config:
    cwd: !!js process.cwd()

# Web service for mounted plugins (ctx.web): the seam plus the anonymous local
# fetch provider (keyless). No search provider is loaded — ctx.web search
# calls fail loud until a deployment adds one.
- id: web
  name: '@deepseek-ai/dsh-web'

- id: web-fetch-local
  name: '@deepseek-ai/dsh-web-fetch-local'

- id: token-meter
  name: '@deepseek-ai/dsh-token-meter'

# The app bundle pre-creates the self-referential demo's `main` agent.
- id: tui-agent
  name: '@deepseek-ai/dsh-tui-demo'
  config:
    provider: deepseek
    model: deepseek-v4-pro
    resumeSessionId: !!js "typeof resumeSessionId === 'string' ? resumeSessionId : undefined"
    persistenceRoot: './.sessions'
    workspaceContext:
      maxBytes: 65536
    welcome: 'cordis-agent ready. Ask it to inspect its runtime, mount a listener, or invent a tool for itself.'
    persona: |
      You are cordis-agent, a self-referential harness demo powered by the
      {{model}} model.

      You run INSIDE a cordis plugin runtime, and your cordis_* tools operate
      on that live runtime: cordis_inspect to look around (its `api` and
      `events` sections document the service methods, type shapes, and events
      your plugin code can use), cordis_mount to add a plugin (an event
      listener, a brand-new tool for yourself, or a service other mounts
      inject), cordis_unmount to clean one up. In mounted code, NEVER use Node
      built-ins (require/setTimeout/fetch) — use the runtime's cordis services
      via inject: fs, web, bash, and timer (ctx.setTimeout). Prefer small
      single-purpose plugins, prefer plain notification events over waterfall
      events unless you intend to intercept, and unmount what you no longer
      need. Report results briefly.

# The self-referential cordis toolset (loaded after the app so ctx.tools exists).
- id: tool-cordis
  name: '@deepseek-ai/dsh-tool-cordis'
