# The mstar profile-bundle patch: inserts the mstar plugin row AND the mstar
# MCP client row over the dsh-base layer (profile `dsh.profile.bundles` order —
# dsh-base first, this bundle after the web-app layer; later layers win per
# row).
#
# A patch replaces the targeted row's whole `config` rather than merging into
# it, so a user-level override must restate every field it keeps (see
# bundle/README.md). The rows ship only neutral defaults: deployment-owned
# fields (harnessDir, enforcement, dispatchTools, dispatchBinding, skillRoots,
# bundledSkillDir) stay unset — the plugin resolves its OWN packaged
# `harness-skills/` mirror (synced by `bundle-assets`) package-relative, so no
# cwd-anchored default is needed. An absolute `bundledSkillDir` override in
# the profile layer still wins when a deployment wants a different mirror.
#
# The `mstar-mcp` row launches the host-neutral MCP server
# (`npx @mstar-harness/cli mcp`, stdio) through Cordis's `mcp-client` bridge.
# It requires that bridge package in the profile's dependencies
# (`dsh plugin --profile web add @deepseek-ai/dsh-mcp-client`); app-boot
# tolerates the row failing to load without it, in which case no mstar MCP
# tools appear and `mstar-harness doctor --target dsh` reports the mismatch.
#
# Shared-only contract: this ONE row is the whole MCP channel for the host.
# The plugin registers no MCP client of its own — a per-agent MCP instance
# could not be given per-call arguments (`PreToolDecision` has no
# argument-rewrite arm), so it would buy nothing but one Node process per
# agent. Everything a caller needs is on this connection.
#
# Control root: every command that needs a harness root must be TOLD one. The
# server never infers it from the launch cwd — that directory is the HOST's,
# it says nothing about which workspace a caller belongs to, and adopting it
# would root writes on an unrelated project. The root is declared by the
# launch (`mstar mcp --harness <absolute path>`, or a non-blank
# `MSTAR_HARNESS_DIR` in the server environment), which pins the connection
# for every call and also anchors the invocation workspace at the pinned
# root's parent (so a command that derives paths from its cwd — e.g.
# `audit.scaffold` deriving `{REVIEW_DIR}` — writes under the declared
# harness, not the launch cwd). Without a connection pin, each call to a
# command that needs a root must name its own through the published `harness`
# selector; that selector is REQUIRED on an unpinned connection, so a caller
# cannot forget it. Commands that read no root (`schema`, `path.resolve`,
# `host.*`, `doctor`, the read-only validators) and `harness.scaffold` run with
# a null root; any other call is refused with the cause and the recoveries
# (`mcp.control-root-unresolved`). The shipped row declares no root; an
# override restates the row's whole `config`, including the `args` list.
#
# Identity: the row passes `--trust-caller-session-id`. A stdio child has no
# host-proven caller identity, so this flag is the deployment's explicit
# statement that it owns this connection's trust boundary -- without it the
# per-call `sessionId` selector stays unpublished and a call that sends one is
# refused (`mcp.caller-identity-unavailable`). With it, the selector is
# published and its value is a BEARER identity: `executionContextFor` turns it
# into `context.caller` and the engine resolves the caller's OWN coordinator
# binding from it, so knowing a live session id is enough to act as that
# session. Authorization is still that binding row plus the optional `--expect`
# CAS token. A deployment that connects callers it does not trust must remove
# the flag (or add transport authentication); the refusal then names the
# host-proven routes -- the native tools `mstar_plan_bind`,
# `mstar_audit_validate`, `mstar_execution_clear` and the CLI.

- insert:
    - id: mstar
      name: '@mstar-harness/dsh'
      config: {}
    - id: mstar-mcp
      name: '@deepseek-ai/dsh-mcp-client'
      config:
        serverName: mstar
        transport: stdio
        command: npx
        args: ['-y', '@mstar-harness/cli', 'mcp', '--trust-caller-session-id']
