# The `standard` agent preset declaration: one `@deepseek-ai/dsh-agent-preset`
# row inserted after this bundle's main patch. Its `config.plugins` below is the
# composition.
#
- insert:
    - id: preset-standard
      name: '@deepseek-ai/dsh-agent-preset'
      config:
        id: standard
        order: 1
        plugins:
          # The `standard` agent preset: the full coding agent, mounted once per process.
          #
          # A preset is now an ordinary `@deepseek-ai/dsh-agent-preset` declaration in a
          # Cordis composition, and this file is its `config.plugins`. It starts from the
          # released 0.2.0-rc.2 standard declaration
          # (`packages/bundle/web-app/presets/standard.patch.yml` in deepseek-harness, git blob
          # 0b898bf7740306cf7bbb50eb37bfbbf75fa03c68 — byte-identical to 0.2.0-rc.1's) and
          # carries the terminal-profile differences a terminal session has always needed.
          # The tool set is the one a terminal session has run, and every row here is one
          # this bundle DISABLES in `cordis.patch.yml` above, because `dsh-base` ships the
          # same rows mounted process-wide and mounting both would double-register each one.
          #
          # THE MAINTENANCE RULE IS: start from the adopted upstream standard, and keep every
          # terminal-owned difference explicit, small, and tested. This file is NOT a
          # byte-for-byte copy of upstream's, and never claimed to be — the one difference
          # already here before the skill work below is that upstream's `command-goal` stays
          # Host-side, because dshline owns that command's key routing against its own
          # attachment and it must resolve without a preset. So do not read any single row
          # below as "the only divergence", and do not "restore" a row to match upstream
          # without checking the terminal reason it is absent.
          #
          # One further difference, made here for the first time in this file, is the
          # dedicated `skill-harness-authoring` provider next to the ordinary skill rows.
          # Upstream `standard` carries the ordinary bare `skill-filesystem` row, and does
          # NOT add this authoring provider or its `@deepseek-ai/dsh-agent-preset` root.
          # Upstream `cordis` exposes the same package-owned authoring skills, as part of the Creator
          # composition, configured as one more root on its single provider.
          # What that is actually about, stated correctly because the obvious reading is
          # wrong: `tool-cordis` does not load these skills. `skill-filesystem` discovers
          # them and `tool-skill` exposes and loads them. Creator mounts `tool-cordis` and
          # Plugin Manager alongside because ITS authoring workflow needs those
          # capabilities; dshline wants the knowledge and not the Creator tool set.
          #
          # What the extra provider does and does not change:
          #
          #   Harness still owns the files. They are read from the installed package, in
          #   that package's own `skills/` directory — nothing is copied into this
          #   repository, and the next adopted generation's new or reworded skill bodies
          #   arrive by the Harness migration alone.
          #   Harness still owns discovery, precedence and loading. This is one more
          #   instance of the ordinary provider, configured; no registry, no scanner, and
          #   no precedence rule was added.
          #   SKILLS EXPOSED IS NOT CREATOR TOOLS ENABLED. `cordis_inspect_list`,
          #   `cordis_inspect_query`, `tool-plugin-manager` and the Web Client tooling
          #   stay unmounted, so a skill may describe an operation this preset cannot
          #   perform. The bodies are not filtered to hide that, and must not be.
          #
          # A service row here MUST sit inside a group carrying an `isolate` realm. Without
          # one it publishes into the root realm, where it is process-global — another
          # preset publishing the same name collides, and a host reader would resolve one
          # preset's instance for every session.
          #
          # Two rows are worth naming because omitting either breaks the whole composition
          # rather than one tool:
          #
          #   `workflow-ptc`  provides the `workflowEngine` that `tool-workflow` below
          #                   waits on INSIDE this group's realm. Without it the workflow
          #                   tool stays pending forever and the preset never reaches a
          #                   fully mounted state. The host-plane copy is disabled in
          #                   `cordis.patch.yml` so exactly one engine exists and the preset
          #                   owns it.
          #   `present`       the deliverables surface `/turns` and the transcript read.
          #
          # The host keeps everything a preset must not own: the `tools`, `skills`,
          # `subagents`, `tokenMeter` and `llm` registries themselves, the sandbox and
          # approval stack, persistence, and the model route.

          # ── identity ────────────────────────────────────────────────────────────────

          # The preset's own persona, shadowing the deployment default for this agent.
          # `{{model}}` and `{{cwd}}` resolve from the agent's own route and workspace.
          - id: persona
            name: '@deepseek-ai/dsh-persona'
            config:
              suffix: Your working directory is {{cwd}}.
              prefix: You are a coding agent powered by the {{model}} model.

          - id: agent-instructions
            name: '@deepseek-ai/dsh-agent-instructions'
            config:
              maxBytes: 65536

          # ── shell ───────────────────────────────────────────────────────────────────

          # `shell-env` stays in the HOST composition: a host row that injects a service
          # is the criterion for host-plane ownership, and behind a preset realm those
          # variables would never reach the model's shell at all. Both shell tools consume
          # the host registry from here; their executors are host-plane too.
          - id: tool-bash
            name: '@deepseek-ai/dsh-tool-bash'
            disabled: !!js process.platform === 'win32'

          - id: tool-pwsh
            name: '@deepseek-ai/dsh-tool-pwsh'
            disabled: !!js process.platform !== 'win32'

          # ── filesystem ──────────────────────────────────────────────────────────────

          # Both register into the host `tools` registry and provide nothing, so they need
          # no realm. The `fs` service and its policy stay in the host.
          - id: tool-fs
            name: '@deepseek-ai/dsh-tool-fs'

          - id: tool-fs-search
            name: '@deepseek-ai/dsh-tool-fs-search'
            config:
              sampleOverCapGlobResults: false

          # ── background jobs ────────────────────────────────────────────────────────

          # Only the model-facing controls. The task REGISTRY stays on the host plane: its
          # producers sit outside any realm this file could put it in, and the registry is
          # keyed by owning agent anyway, so one host instance serves every session.
          - id: tool-jobs
            name: '@deepseek-ai/dsh-tool-jobs'

          # ── skills ──────────────────────────────────────────────────────────────────

          # The skill REGISTRY lives in the host composition and is layered per scope:
          # these rows register into THIS preset's layer of it, so they need no realm.
          #
          # This first row is upstream's own, left exactly as upstream states it. It owns
          # every ordinary root — project `.dsh/skills`, project `.agents/skills`,
          # `~/.dsh/skills`, `~/.agents/skills` — and the deployment's own bundled channel
          # through `$DSH_BUNDLED_SKILL_DIR`. A person who configures nothing and a person
          # who configures a great deal both get the same provider they would get from
          # upstream.
          - id: skill-filesystem
            name: '@deepseek-ai/dsh-skill-filesystem'

          # The first-party authoring skills `@deepseek-ai/dsh-agent-preset` ships, on a
          # SECOND instance of the same provider, dedicated to them.
          #
          # `bundledSkillDir` is the field that matters, and it is why this is not
          # `customSkillDirs`. These are package-owned baseline skills, not a root this
          # profile or a user configured, so Harness's own packaged-skill semantics are
          # the honest ones: `source: bundled`, `rank: 600`, and a Host-trusted read that
          # deliberately bypasses the workspace `ctx.fs` because the path is inside an
          # installed package rather than inside anything a workspace may restrict. It
          # also puts them BELOW the user roots, which `customSkillDirs` at 300 would not:
          # a project or home skill of the same name wins, and only an unclaimed name
          # resolves to the shipped copy.
          #
          # It cannot simply be the ordinary provider's `bundledSkillDir` instead, because
          # an explicit `bundledSkillDir` REPLACES that instance's `$DSH_BUNDLED_SKILL_DIR`
          # fallback. Setting it there would commandeer the deployment's bundled slot and
          # delete whatever this installation packages as its own baseline skills.
          #
          # `includeDefaultRoots: false` is what makes this instance isolated rather than
          # a second copy of the row above: it contributes this one root and nothing else.
          # `providerName` is required, not decorative — a scope holds one provider per
          # name, so a second instance left on the shipped `filesystem` default would fail
          # to register at all.
          #
          # Being its OWN row is the point. `/plugins` can toggle `skill-harness-authoring`
          # off without touching `skill-filesystem`, so someone who does not want these
          # packaged authoring skills can disable this row while retaining the ordinary
          # provider and every project and user skill they wrote. No dshline-side switch is
          # added for this; the preset-row toggle dshline already has is the control.
          - id: skill-harness-authoring
            name: '@deepseek-ai/dsh-skill-filesystem'
            config:
              providerName: harness-authoring
              includeDefaultRoots: false
              bundledSkillDir: !!js process.getBuiltinModule('node:path').join(process.getBuiltinModule('node:path').dirname(process.getBuiltinModule('node:module').createRequire(baseUrl).resolve('@deepseek-ai/dsh-agent-preset/package.json')), 'skills')

          - id: tool-skill
            name: '@deepseek-ai/dsh-tool-skill'

          # ── goals ───────────────────────────────────────────────────────────────────

          # The goal service and session driver stay on the host plane, where the Gateway
          # can resolve them. Only the model-facing tool moves behind the preset; the
          # `/goal` COMMAND stays host-plane too, which is the one deliberate deviation
          # from the upstream web declaration — dshline owns that command's key routing
          # against its own attachment, so it must resolve without a preset.
          - id: tool-goal
            name: '@deepseek-ai/dsh-tool-goal'

          # ── plan mode ───────────────────────────────────────────────────────────────

          # Plan state is per-agent by nature, so an entry-local realm is not a workaround
          # here — it is the correct lifetime.
          - id: planning
            name: cordis:group
            group: true
            isolate:
              planMode: true
            config:
              - id: plan-mode
                name: '@deepseek-ai/dsh-plan-mode'
                config:
                  section: |
                    You are in plan mode. Stay in plan mode until exit_plan_mode succeeds or the user switches the session mode. Imperative language to implement changes means plan the implementation, not execute it. A user's conversational agreement — including an answer confirming something you asked — approves nothing and does not end plan mode; fold the confirmed decision into the plan and submit it through exit_plan_mode.

                    Explore first. Use non-mutating reads, searches, static analysis, and checks to ground the plan in the actual repository. Do not edit or write files, change configuration, run formatters or code generation that rewrites tracked files, commit, or otherwise carry out the plan. Prefer existing functions and patterns over new machinery.

                    The tool catalog stays the same across modes for request-cache stability. These plan-mode rules override any later tool description or guidance that suggests using mutation tools; those tools remain listed to keep the tool catalog unchanged. Do not use todo_write to track this planning phase: it tracks implementation after an approved plan, while the plan itself belongs in exit_plan_mode.

                    Resolve discoverable facts by inspection. Use ask_user_question only for user-owned choices or material ambiguity that inspection cannot answer. Do not ask the user where code lives or how current behavior works when you can find out.

                    Make the plan decision-complete: state the goal and success criteria; group implementation changes by subsystem; identify public API, schema, and data-flow changes; cover edge cases, failure modes, tests, acceptance criteria, and explicit assumptions. Keep it concise enough to review but detailed enough that another engineer can implement it without making design decisions.

                    When ready, call exit_plan_mode with the complete plan markdown, starting with a # title. Make exit_plan_mode the only and final tool call in that assistant response: it presents the plan for approval, and implementation begins only in a later step after approval. Do not paste the final plan as a plain reply or ask "should I proceed?" through prose or ask_user_question. If review rejects it, incorporate the feedback and present again. If the review channel is unavailable or aborted, stay in plan mode and ask the user to switch modes manually; do not proceed with implementation.

          # ── compaction ──────────────────────────────────────────────────────────────

          # `compaction-basic` reads `toolResultPrune` through `ctx.get`, so the pruner
          # must share this realm rather than sit outside it.
          #
          # `tokenMeter` is deliberately NOT in this realm: the meter stays on the HOST
          # plane, and the rows here resolve that one instance.
          - id: compaction
            name: cordis:group
            group: true
            isolate:
              compaction: true
              toolResultPruner: true
            config:
              - id: compaction-basic
                name: '@deepseek-ai/dsh-compaction-basic'

              - id: command-compact
                name: '@deepseek-ai/dsh-command-compact'

              - id: tool-result-pruner
                name: '@deepseek-ai/dsh-compaction-tool-result-pruner'
                config:
                  thresholdChars: 8192
                  headChars: 4096
                  tailChars: 1024

          # ── delegation and workflows ────────────────────────────────────────────────

          # The `subagents` registry and its spawn/fork backends live in the HOST
          # composition: the registry is a process singleton and a provider name may only
          # be registered once. This preset contributes the delegation TOOLS, which
          # resolve that host registry.
          #
          # `workflows` is different — nothing outside an agent reads it — so every row
          # that reaches it shares one entry-local realm here, and a consumer left outside
          # would resolve a host registry this preset does not populate. `workflow-ptc`
          # below is what fills that realm.
          - id: delegation
            name: cordis:group
            group: true
            isolate:
              workflowEngine: true
            config:
              - id: tool-subagent-control
                name: '@deepseek-ai/dsh-tool-subagent-control'

              - id: tool-subagent-list-agents
                name: '@deepseek-ai/dsh-tool-subagent-control/list-agents'

              - id: tool-subagent
                name: '@deepseek-ai/dsh-tool-subagent'
                config:
                  provider: spawn
                  toolName: subagent
                  modelSelectionSettings: true
                  backgroundMode: continuable

              # Fork omits model selection so provider/model stay equal to the parent and
              # the inherited history remains eligible for KV Cache reuse.
              - id: tool-subagent-fork
                name: '@deepseek-ai/dsh-tool-subagent'
                config:
                  provider: fork
                  toolName: subagent_fork
                  backgroundMode: continuable

              # Production dsh does not install these optional providers. Install the
              # matching provider in this Profile and restart the Host, then remove
              # `disabled` from the matching tool row — or override this declaration's
              # `config.plugins` by row id in a profile patch. Host availability alone
              # grants no tool.
              - id: tool-subagent-codex
                name: '@deepseek-ai/dsh-tool-subagent'
                disabled: true
                config:
                  provider: codex
                  toolName: subagent_codex
                  backgroundMode: one-shot
                  maxDepth: provider-managed

              - id: tool-subagent-claude-code
                name: '@deepseek-ai/dsh-tool-subagent'
                disabled: true
                config:
                  provider: claude-code
                  toolName: subagent_claude_code
                  backgroundMode: one-shot
                  maxDepth: provider-managed

              # The provider for the realm this whole group isolates. `tool-workflow`
              # below waits on exactly this service name, so removing this row leaves the
              # workflow tool permanently pending.
              - id: workflow-ptc
                name: '@deepseek-ai/dsh-workflow-ptc'
                config:
                  provider: spawn

              - id: tool-workflow
                name: '@deepseek-ai/dsh-tool-workflow'

              # Off by default with the base row it mirrors: the tool description
              # restricts `ralph` to runs the human explicitly asked for, and completion
              # is a worker self-report, not an independent evaluation.
              - id: tool-ralph
                name: '@deepseek-ai/dsh-tool-ralph'
                disabled: true
                config:
                  subagentProvider: spawn
                  maxRounds: 64

          # ── remaining model-facing rows ─────────────────────────────────────────────

          # Upstream 0.2.0-rc.2 gave this tool a `config` (`mode: legacy | timed`,
          # `timeout`) for the first time; this row declares none, which selects the
          # documented `legacy` default — the blocking tool dshline has always answered.
          # Deliberate, not an oversight: `timed` is the opt-in that lets a foreground
          # wait expire and continue the turn, and dshline's answerer does not claim that
          # wait (it reads no `request.wait`). Its overlays still dismiss correctly when
          # one closes, through the waterfall signal `askOne` already honours. Adopting
          # `timed` is a UX decision for its own pull request, not a consequence of this
          # generation.
          - id: tool-ask-user
            name: '@deepseek-ai/dsh-tool-ask-user'

          - id: tool-todo
            name: '@deepseek-ai/dsh-tool-todo'
            config:
              allowParallelInProgress: true

          # The `web` service and its search provider stay in the host composition; only
          # the model-facing tool is per-session.
          - id: tool-web
            name: '@deepseek-ai/dsh-tool-web'
            config:
              fetch: true
              searchTimeoutMs: 60000

          # The deliverables surface: turn-tail file cards and the delivery cards under
          # each closing assistant message.
          - id: present
            name: '@deepseek-ai/dsh-tool-present'

          # Off: installing or removing a bundle is a human action taken through
          # `/profiles`, and a model that can rewrite its own plugin roster is a tool
          # nobody asked for.
          - id: tool-plugin-manager
            name: '@deepseek-ai/dsh-plugin-manager/tools'
            disabled: true
