跳过主要内容
P

dsh-maestro

paroca72/dsh-maestro

为单个工作区内的会话提供额外工作目录与跨会话中继:由用户授予目录权限并指定主控会话,模型可将子任务转交给同区其他会话并回收结果,中继仅在用户在面板批准方案后执行。它的 HTTP 路由没有 DSH 的访问检查,浏览器里打开的网页可以调用它们。

安装

dsh plugin --profile web add github:paroca72/dsh-maestro

README

Maestro — session working directories and cross-session relay

A DeepSeek Harness bundle with two capabilities: extra working directories for one session, and a relay that lets the sessions of one workspace hand work to each other.

A session starts in the directory its workspace gave it: its immutable Session.header.cwd stays the project root, and this plugin widens only the writable set around it. It lets the person add further directories to that session:

  • the Host half registers each one with ctx.sandboxPolicy.registerWritableRoot, so under Workspace write the Harness file tools may write there;
  • a dynamic prompt context tells the model which directories the session may write in, and is absent while the list is empty;
  • the Client half renders the control and the panel.

Install

From GitHub — JavaScript only, no build step and no build scripts:

dsh plugin --profile <profile> add github:Paroca72/dsh-maestro

The package name is dsh-maestro: that is what a profile lists under dsh.profile.bundles, and what a market index that reads the awesome-dsh-plugin catalog installs. After installing, reload the page; a bundle the profile has just added may need the app restarted once.

The plugin declares engines.dsh (>=0.2.2-rc.1 <0.3.0-0), which the market reads to tell you whether it fits the host you are running.

Use

  1. Open a session whose permission mode is Workspace write.
  2. Press the Directories control in the composer tool row.
  3. Choose Add directory…: the host's system chooser opens. It takes no start directory, but it reaches every drive, and the directory you pick is added at once. When the host offers no chooser, or the chooser itself fails, the panel falls back to a field for an absolute path instead of leaving you with nothing to do.
  4. Remove a directory with Remove; the model notice disappears with the last entry.
  5. Work here makes one listed directory the session's working directory, so relative paths resolve there from then on; that row is then marked working directory. Permissions do not change: the write boundary stays the session's original project.

A relative path always resolves against the working directory, never against an additional directory: to read a file inside one of them, use its absolute path. The model is told both facts, and must say which directory it read and ask which was meant when one name (for example docs) exists in more than one of them.

A session that is not running yet can still be configured: the list is applied when the session starts. A forked session inherits the list it was forked from; a subagent does not inherit it, because widening a child's write boundary is the host's decision, not a side effect of delegation.

Relay between sessions

A workspace can hold several sessions that are parts of one project (a bot, its API, a web app). This plugin lets the model in one of them hand a task to another and get the answer back, without the person leaving the session they are working in. The Host half gives every session of a workspace six tools:

ToolWhat it does
workspace_peersLists the other sessions of the workspace by title and whether they are open. Reads only.
tell_sessionHands a task to a sibling by name, wakes it, and returns at once. Its closing message arrives later as a new message. One call per sibling in the same step delivers them in parallel.
ask_sessionThe same delivery, waiting for the answer within a timeout; on expiry it degrades to a pending answer instead of failing.
ask_sessionsFans out in one call: several siblings, each with its own task, delivered in parallel, and one result carrying every answer. A session still working when the timeout expires is reported as pending and answers later as a message.
peer_changesReads the changed files recorded for another session's last completed turns, without waking it.
relay_decisionRecords a decision the work needs: a light one the hub takes itself — shown to the person at the end — or a structural one, which the person is asked about before anything depends on it.
relay_planFiles the plan the workspace will follow — the person's request quoted, then one step per session to ask, and the person is asked to approve it with a review card in the conversation — reads the one in force, records an authorization given in words, or closes a plan. Until they authorize it, nothing the hub sends is delivered.
  • A relay is delivered to a session that is not open by starting it first: the Harness session controller resolves or resumes the target, and the answer reports woken: true. A target that the controller refuses is named in the error, and a subagent session is never addressable.
  • peer_changes never starts anything: it reads only a session that is already open, and says so instead of loading it.
  • The message carries the Harness's own agent-message/relay attribution, so the recipient's chat shows which session asked, not the person's own words.
  • The answer is the recipient's closing text of the turn that read the request — identified by the id of the delivered message, which the Harness queue preserves — delivered back as another relay: the recipient needs no extra tool to answer. A request that waits in the target's inbox while it is busy is therefore answered by the turn that picks it up, not by the one that happened to be running.
  • Every session is also told the catalogue in its prompt context, and told to ask the person when a name is unknown or ambiguous.
  • One session of the workspace acts as the hub: it is told to coordinate the others, and they are told to go through it. The person can pin the hub in the panel; with nothing pinned, the hub is the first session created in the workspace, so the relay coordinates itself with no configuration.
  • A forked session is a sibling like any other; a subagent session is never addressable.
  • Work is routed through the hub. A relay must touch the hub at one end: the hub addresses any session, a session addresses the hub, and a relay between two sessions that are neither is refused, with a hint telling the model to ask the hub to pass the request on. The switch is per workspace, in the relay panel ("Route every relay through the hub"), and it is closed by default — that default is the row config's relayHubOnly — because a model left to itself creates peer-to-peer traffic the person never asked for. Clearing the switch in the panel returns the workspace to the deployment default. The answer leg is not a delivery, so replies keep flowing both ways, and a refusal is recorded in the ledger as refused: a bypass attempt shows up in the panel and interrupts nobody's chat.
  • Light decisions are taken, structural ones are asked. relay_decision records a decision the work needs. A light one — a switch, a default, a flag that can be flipped later without changing the shape of the project — the hub takes itself with the recommended option and records: nobody is interrupted, and every one of them is shown to the person when the plan is closed, or on relay_decision action review, where they confirm them or say what to change. A structural one — which database, which protocol, a new dependency, a public interface — is asked of the person straight away, with the recommendation and the alternatives, and their answer is what gets recorded. The relay panel lists them all, and one the person has not seen yet is marked.
  • The cards the plugin writes speak the person's language. Everything a review card carries from the hub — the quoted request, the steps, the questions — is passed through untouched; the frame around it is the plugin's own, and it follows the conversation. relay_plan and relay_decision take an optional language tag (ISO 639-1), and with none the plugin reads the language from the request the plan quotes. en and it ship; anything else falls back to English instead of guessing.
  • The relay window is four sections, not one scroll. Plan is the card you decide on — the state, the budget, the request folded to three lines, and one row per step that opens when you want to read what it asks — followed by the decisions taken without asking, folded while there is nothing to review. Sessions holds the hub choice, Relays the ledger, Settings the two switches (and Save is what writes them). A dot marks the section that wants you.
  • Independent work runs in parallel. Every relay tool is declared safe to run beside a sibling call, so when one session addresses several siblings in the same step the driver dispatches those calls together instead of one relay per step. ask_sessions is the one-call form of the same fan-out. Which shape to use is the caller's choice: gather every answer before writing one report (ask_sessions, or ask_session once per sibling), or report each answer as it arrives (tell_session, once per sibling).
  • Work needs a plan the person approved. The hub files it with relay_plan, quoted from the person's own request, with one step per session it means to ask, and asks them in the conversation. The person authorizes it either way: by telling the hub to go ahead — the hub records that with relay_plan action approve, and the plugin accepts it only when a message from the person really arrived after the plan was filed, which a relay never can — or by clicking Approve in the relay panel, which also refuses and closes. Filing a plan asks the person through the platform's own review card — the same surface ask_user_question uses — with Approve and Refuse in the conversation, and the hub's turn waits on the answer: approving starts the work in that same turn, a reply in the person's own words reaches the hub as their answer, and a dismissed card leaves the plan filed and nothing running. Until then every relay the hub sends is refused, and the refusal says so instead of interrupting anyone. Once approved, each relay names the step it serves (step: <n>), a step is worth two relays, and the plan as many as its steps allow; a relay outside the plan, or a step already spent, is refused and recorded. The budget is shared with the members' own relays, so a spent plan stops the whole workspace and the coordinator has to come back to the person. The approval is not revoked by the next thing the person says — the plan is bounded by its own steps, the person can close it, and a hub whose work has changed files a new plan, which needs a fresh authorization. The switch is per workspace, in the panel ("The team leader must have your approval before it asks anything"), on by default, and relayPlanGate: false in the row config turns it off for a deployment. The model's tool can file a plan, read it, record an authorization the person gave it in words, and close one; it can never refuse a plan on the person's behalf — that stays on the panel route.
  • A sibling takes no initiative of its own, unless the person says so. The Settings tab carries the level, per workspace: Only what the hub asks (the default), They ask the hub, and decide the small things, They decide for themselves. At the first, a session that is not the hub may not start a relay (obey-hub), file a plan or record a decision (obey-hub-plan): its closing message is the answer, and the relay already delivers that to the hub, so a doubt, a blocker or a choice still arrives — it just does not become work of the sibling's own. The level is also what the session's prompt says, which is where a model decides what to do before it does it; the tools enforce the two ends of it, and relayObedience sets the deployment default.

Limits of the relay

  • Delivery is text only: no attachments or images travel with a relay.
  • A chain is bounded by hops (default 3) and by relays in flight per workspace (default 4), and it may not revisit a session it already crossed.
  • A relay grants nothing: the recipient keeps its own permissions and sandbox.
  • Starting a target that was not open spends a turn in that session: that is the delegation the sender asked for, not a side effect. The read-only tools never do it.
  • Relays never cross workspaces.
  • The routing rule governs the relay only. Two sessions of one project can still exchange information through a shared file or a shell, and no plugin sits on that path.
  • A fan-out is bounded: one ask_sessions call addresses at most 8 sessions, and every request in it takes its own in-flight slot, so a fan-out wider than relayMaxInFlight (default 4) needs that limit raised from the panel first. The slot is taken when the relay is recorded, before the target is handed the message, so two deliveries dispatched in the same step cannot overrun the limit.
  • After a restart, a relay whose turn already closed is answered from the durable log; one whose session is gone is recorded as expired.

Limits

  • An extra root only matters under Workspace write. Under Read only it grants nothing, and under Full access everything is already writable, so the panel says so instead of pretending otherwise.
  • On Windows, only the Harness file tools honour an extra directory. Shells and other confined processes keep their own permissions — registerWritableRoot does not change process confinement there.
  • The plugin grants write access; reads are not confined by the sandbox in the first place.
  • Grants are runtime-only in the Harness, so they are installed again on every agent/created (startup, resume, clear, compact). Unloading the plugin removes them and leaves every saved list untouched.

Data

The durable list is one JSON file, written atomically (temporary file plus rename):

  • default: $DSH_HOME/maestro/session-directories.json
  • shape: { "version": 1, "sessions": { "<sessionId>": { "dirs": [...], "updatedAt": "..." } } }

The relay keeps a second, separate file, because a broken ledger must not make the directory list unreadable:

  • default: $DSH_HOME/maestro/workspace-relay.json
  • shape: { "version": 1, "workspaces": { "<workspaceId>": { "hub": null, "settings": {}, "relays": [] } } }
  • a workspace's session names are its own session titles, so the file stores no name layer; a labels map left by an older version is ignored on read and dropped on the next write. "hub": null means no choice is pinned, and the workspace's first session acts as hub.
  • at most 200 relays per workspace are retained; older ones are dropped on write.
  • a relay the routing rule refused is recorded with state refused and the reason not-through-hub: it delivered nothing and has no answer, it is there for the panel. A relay a member started at the strict level is recorded the same way, with the reason obey-hub.

A file that is not valid JSON, carries another version, or has a structurally wrong sessions value makes the list read-only and reports the reason in the panel, rather than being overwritten. A single malformed session record is dropped and logged.

Configuration

Row config, overridable in the profile's cordis.patch.yml:

FieldDefaultMeaning
maxDirectories16Upper bound of extra directories per session (1–64).
announceToModeltrueWhether the model is told about the session's directories.
storePathnullAbsolute path of the JSON store.
relayMaxHops3Relay chains may take at most this many hops (1–8).
relayMaxInFlight4Most relays in flight per workspace (1–16).
relayAskTimeoutMs120000Default wait of ask_session, in milliseconds (5000–600000).
announcePeersToModeltrueWhether the model is told which sessions share this one's workspace.
relayHubOnlytrueDeployment default for the per-workspace routing switch: with it closed, a relay between two sessions that are neither is refused. The relay panel overrides it for one workspace.
relayPlanGatetrueDeployment default for the per-workspace planning switch: on, the hub files a plan with relay_plan and nothing is relayed until the person authorizes it — in the conversation, or from the panel. The panel overrides the switch for one workspace.
relayObediencestrictDeployment default for the per-workspace level of initiative: strict — a member answers and reports, and its own relays, plans and decisions are refused; balanced — it may address the hub and take the light decisions of its own work; free — it may start work of its own. The panel overrides the level for one workspace.
relayStorePathnullAbsolute path of the relay ledger.
- id: maestro-session-directories
  name: 'dsh-maestro'
  config:
    maxDirectories: 8
    relayMaxHops: 2

HTTP surface

The Client half talks to the Host half over one route, served by the Harness web server to the authenticated page:

  • GET /maestro/session-directories?sessionId=<id> → the session's list, its current access mode, whether that mode makes the entries effective, and projectRoot (the session's working directory, which the panel marks in the list and offers as Work here).

  • GET /maestro/session-directories/list?path=<absolute> → one directory level: the resolved path, its parent, and up to 200 directory entries (a symlink resolving to a directory counts), with truncated when the level holds more. An absent path lists the home directory. The panel no longer reads this route — it hands the choice to the system chooser — so it stays as a documented listing primitive for a caller that needs a start directory, which the native chooser cannot take.

  • PUT /maestro/session-directories with { "sessionId": "...", "dirs": [...] } → the complete new list. Paths must be absolute directories; they are canonicalized through realpath (symlinks resolved, because the enforcement layer rejects symlinked roots), de-duplicated, and bounded by maxDirectories.

  • POST /maestro/session-directories/working-directory with { "sessionId": "...", "path": "<absolute>" } → makes that directory the session's working directory through ctx.workingDirectory.set; the session must be running. It changes no permission: the sandbox's write boundary stays the session's immutable Session.header.cwd.

  • GET /maestro/relay/peers?sessionId=<id> → the session's workspace, its siblings with their titles and liveness, the designated hub, the effective limits, and storeProblem when the ledger is unusable.

  • GET /maestro/relay/config?sessionId=<id> → the hub that applies (the pinned one, otherwise the workspace's first session) and the limits, next to the deployment defaults.

  • PUT /maestro/relay/config with { "sessionId": "...", "hub": "<id>|null", "settings": { ... } } → the new configuration. An unknown key, an out-of-range limit and a hub that is not a session id are refused with 400; a retired key such as labels is refused too. This route is the only writer of the person's configuration, and no relay can reach it. settings is a patch of that workspace: it touches only the keys it names, so switching the routing cannot drop a limit set earlier. "hubOnly": false opens that workspace's routing, true closes it, and null clears the workspace's own value so the deployment default applies again. "planGate" works the same way for the planning gate, and "obedience" for the level of initiative — one of strict, balanced or free, or null to use the deployment default. A level the plugin does not know is refused with 400 instead of being stored.

  • GET /maestro/relay/plan?sessionId=<id> → the plan in force in that workspace, with its state, the request it answers, its steps and how much of the budget each has spent, next to the workspace's planGate and the per-step allowance.

  • POST /maestro/relay/plan with { "sessionId": "...", "action": "approve"|"reject"|"close", "planId": <n> } → the person's decision. A decision about a plan that is no longer in force is refused with 409 instead of being applied to whatever replaced it, and the hub is told the outcome as a message, so it never has to poll. Like the configuration route, this is a panel route: no relay can reach it. The tool the model holds can file and read a plan, record an authorization the person gave it in the conversation, and close a plan; it can never refuse one on the person's behalf, and the panel's own decision is what decidedBy: "panel" records.

  • GET /maestro/relay/ledger?sessionId=<id>&limit=<n> → the workspace's recorded relays, oldest first (at most 200, default 50), each with its state, the sessions involved, the turn and the answer text — or, for a refused one, its reason.

These routes add no authentication of their own: the Harness listener binds a local interface only, so any local process can read or replace a session's list or a workspace's relay configuration. They grant nothing by themselves — a list matters only for a session running under Workspace write, and a relay configuration only decides the designated hub and the limits — but treat them as a local trust boundary.

Layout

FileRole
index.jsHost half entry: the bundle's exports, the shared row config, and the composition of both features.
lib/shared.jsHost helpers both features use: request errors, logging, the bounded JSON body, the durable JSON file.
lib/directories.jsHost half: the working-directory store, its three routes, the per-agent grants and the model notice.
lib/peers.jsHost half: workspace membership, session titles, the peer catalogue and name resolution.
lib/relay.jsHost half: the five relay tools and the batch fan-out, the routing gate, chain guards, the return leg, the peer notice and the panel routes.
lib/relay-store.jsHost half: the durable per-workspace record (hub, limits, ledger).
client.jsClient half: composer control plus the shell.overlay panel.
test/The bundle harness: structural checks and the isolated Host tests. Not shipped.
CHANGELOG.mdRelease history. Its newest section matches package.json; npm test fails when the two drift.
AGENTS.mdThe working agreement for this repository: versioning policy, release checklist, development loop. Not shipped.
cordis.patch.ymlThe bundle's one plugin row.
locale/en.jsonPlugin Manager title and description.
docs/DETAIL.md, docs/preview.svgDetail page image.
icon.svgBundle icon.

相关插件