dsh-architecture-map 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,32 @@
1
+ ## 0.3.0 — 2026-11-23
2
+
3
+ ### Added
4
+
5
+ - Optional `node.position: {x, y}` in `graph.json`: a pinned top-left corner that the sidebar canvas and the SVG export honor. `arch_graph_patch` accepts `position` on `add_node`/`update_node`; `update_node` with `position: null` clears a pin; `arch_graph_get` shows the pin.
6
+ - Edge labels on the sidebar canvas; forward edges route straight, return edges bow around the row, and same-row edges detour around a node that blocks the line. Dependency edges are dashed.
7
+ - Width-aware node-title clipping so long CJK titles do not overflow the fixed node box.
8
+ - The SVG export applies pinned positions and shares the canvas routing/labels; Mermaid and Markdown stay position-agnostic.
9
+
10
+ ### Changed
11
+
12
+ - Layout precedence is local drag override > `node.position` pin > automatic layout. `Reset layout` clears local drags and returns to the pin/automatic layout.
13
+
14
+ ## 0.2.1 — 2026-11-23
15
+
16
+ ### Added
17
+
18
+ - Remote consent scopes: `/arch remote grant <id> session` grants only the current session (and its discussion children, in memory); `/arch remote grant <id> always` or no scope persists a workspace grant. `/arch remote revoke <id>` clears both. The content-read card keeps the same two choices.
19
+
20
+ ### Fixed
21
+
22
+ - Local node positions no longer freeze the whole layout when the graph revision changes: only dragged nodes are stored as `{x, y}` overrides, so undragged nodes follow the automatic layout after an edit.
23
+ - `Reset layout` clears the local overrides instead of materializing the current layout into the position map.
24
+ - The sidebar's Discuss/Lite buttons now pass the selected source to `/arch discuss`: a node in a remote source is resolved in `remote:<id>` instead of the session's local workspace, which previously produced `node "<id>" does not exist in <cwd>`.
25
+
26
+ ### Docs
27
+
28
+ - State that a cyclic graph falls back to a compact grid and that the layered layout is for acyclic graphs.
29
+
1
30
  ## 0.2.0 — 2026-11-22
2
31
 
3
32
  ### Added
package/README.md CHANGED
@@ -4,7 +4,7 @@ English | [中文](README.zh.md)
4
4
 
5
5
  **中文名:架构地图** · An architecture workbench for DeepSeek Harness: a live semantic architecture graph, per-node side conversations, and incremental architecture memory.
6
6
 
7
- > Status: **0.2.0 developer preview.** The Host tools, sidebar canvas, architecture memory, per-node discussions, deterministic exports, built-in Mermaid rendering and read-only remote Linux repositories over SSH work today. Shared positions remain planned; remote auto-maintenance on an idle parent and pending-counter clearing are the known rough edges.
7
+ > Status: **0.3.0 developer preview.** The Host tools, sidebar canvas, architecture memory, per-node discussions, deterministic exports, built-in Mermaid rendering and read-only remote Linux repositories over SSH work today. Node positions can be pinned in `graph.json` and rendered by the canvas; remote auto-maintenance on an idle parent and pending-counter clearing are the known rough edges.
8
8
 
9
9
  ---
10
10
 
@@ -46,17 +46,17 @@ A static feature preview is included. A recorded 30-second demo GIF is not part
46
46
  ## Features (implemented today)
47
47
 
48
48
  - **Canonical architecture graph** — `.archmap/graph.json` with a revision number, schema validation, atomic writes and a one-step backup. The model reads and edits it through `arch_graph_get` / `arch_graph_patch`; `apply:false` previews without writing.
49
- - **Right-sidebar canvas** — reads the graph from the session workspace, renders nodes/edges as SVG with a layered (longest-path) layout, supports pan, wheel zoom, `Fit`, node dragging and `Reset layout`, and shows node details on click.
50
- - **Local layout memory** — dragged node positions are kept per workspace in browser storage, so a refresh or a new session on the same machine keeps the layout. `Reset layout` clears it. Shared positions are planned.
49
+ - **Right-sidebar canvas** — reads the graph from the session workspace, renders nodes/edges as SVG with a layered (longest-path) layout, draws edge labels, honors per-node `position` pins, supports pan, wheel zoom, `Fit`, node dragging and `Reset layout`, and shows node details on click.
50
+ - **Layout: pins + local drags** — a node's `position` in `graph.json` is a shared pin (set through `arch_graph_patch`); dragging a node keeps a browser-local override per workspace, so a refresh or a new session on the same machine keeps the view. `Reset layout` drops the local overrides and returns to the pinned/automatic layout.
51
51
  - **Incremental architecture memory with cosmetic detection** — `.archmap/manifest.json` records content hashes plus a normalized code signature; `arch_sync` reports only added/changed/deleted files, distinguishes code changes from format/comment-only changes, and lists the nodes whose anchors are affected. `markStale:true` marks those nodes stale (and bumps the graph rev); the default is report-only. Anchors may also store the file's normalized content signature; sync reports a node whose anchor hash no longer matches, and `arch_graph_patch` fills missing hashes or refreshes them with `refreshAnchors:true` after review. `arch_manifest_commit` records analyzed files, and `arch_doc_get` / `arch_doc_put` read and write `overview`, `modules/<id>` and `notes/<id>`.
52
- - **Deterministic exports** — `arch_export` writes Mermaid flowchart source, a standalone SVG, or a Markdown dossier digest to `.archmap/export/`; graph revision and files stay unchanged.
52
+ - **Deterministic exports** — `arch_export` writes Mermaid flowchart source, a standalone SVG that honors pinned positions, or a Markdown dossier digest to `.archmap/export/`; graph revision and files stay unchanged.
53
53
  - **Built-in Mermaid rendering** — assistant ` ```mermaid ` fences render with a vendored Mermaid 12.2.0 runtime served from the plugin's own Host route. No CDN and no `dsh-mermaid-plus` dependency. Streaming keeps the code block; parse errors fall back to code plus an error line. `renderMermaid: false` disables it.
54
- - **Per-node side conversations** — `arch_discuss` starts a child for `node:<id>` or `edge:<id>`: `fork` inherits the main conversation's completed turns; `lite` starts fresh with the graph and dossier. Delivery is caller-only, so the main conversation is not polluted; conclusions go to `notes/<id>`. The node detail also has `Discuss (fork)` / `Lite` buttons that open the child in the right sidebar through the `subagentchat` resource. Discussion children are prompt-constrained; shell and generic source-write calls are denied at execution (inherited tool schemas may remain visible in a fork). Graph changes still require approval.
54
+ - **Per-node side conversations** — `arch_discuss` starts a child for `node:<id>` or `edge:<id>`: `fork` inherits the main conversation's completed turns; `lite` starts fresh with the graph and dossier. Delivery is caller-only, so the main conversation is not polluted; conclusions go to `notes/<id>`. The node detail also has `Discuss (fork)` / `Lite` buttons that open the child in the right sidebar through the `subagentchat` resource; they pass the selected local or remote source to the host (a remote discussion needs remote content consent). Discussion children are prompt-constrained; shell and generic source-write calls are denied at execution (inherited tool schemas may remain visible in a fork). Graph changes still require approval.
55
55
  - **Remote Linux repositories (developer preview)** — `arch_remote_list/status/tree/read/grep` inspect a registered repository over SSH without cloning it. Content reads are consent-gated; remote `arch_sync`/`arch_manifest_commit` hash only analyzed files; change polling and `/arch remote ...` commands work; the panel switches local/remote sources; graph/dossier stay under `.archmap/projects/<id>/`; remote files are never modified.
56
56
 
57
57
  ## Planned next
58
58
 
59
- - Shared/persisted positions, direct export buttons in the panel, and a short animated demo (GIF).
59
+ - Direct export buttons in the panel, and a short animated demo (GIF).
60
60
  - Remote maintenance polish: start from an idle parent and clear the local pending counter after a run.
61
61
 
62
62
  ## What it is not
@@ -102,7 +102,7 @@ code blocks and the 5.2 MB runtime is not loaded. The default `auto` disables ou
102
102
  All graph, manifest, dossier and export data lives in `<workspace>/.archmap/`. The plugin installation
103
103
  directory contains only code, skill, vendor, docs and locale. The plugin does not modify a user project's
104
104
  `.gitignore`; commit `.archmap/` to share the map, or ignore it for local-only data. Uninstalling the plugin
105
- does not delete `.archmap/`. Node positions are browser-local and are not part of the graph.
105
+ does not delete `.archmap/`. `node.position` pins are part of the graph; dragged positions are browser-local overrides.
106
106
 
107
107
  ## Remote repositories (developer preview)
108
108
 
@@ -132,6 +132,23 @@ The plugin can map a repository on a remote Linux host over your existing SSH co
132
132
  4. Open `/arch` and pick **Local** or **staging** in the source selector in the panel header. The status line shows host/root/vcs/consent; a remote project without a graph shows its own empty state.
133
133
  5. Picking a remote source starts polling. `/arch remote sync staging` checks immediately, `/arch remote update staging` starts a maintenance child, `/arch remote list` lists projects, and `/arch remote grant/revoke/remove` manage consent and registration.
134
134
 
135
+ ### Remote consent scopes
136
+
137
+ The content-read card and the cardless `grant` command expose the same two scopes:
138
+
139
+ | Input / choice | Scope | Lifetime | Stored | Auto maintenance |
140
+ | --- | --- | --- | --- | --- |
141
+ | `/arch remote grant <id>` | workspace | persistent | `.archmap/index.json` | yes |
142
+ | `/arch remote grant <id> always` | workspace | persistent | `.archmap/index.json` | yes |
143
+ | `/arch remote grant <id> session` | session + its children | until this session ends | in-memory only | no |
144
+ | Card: “允许,本次会话” | session | until this session ends | in-memory only | no |
145
+ | Card: “始终允许这个远程” | workspace | persistent | `.archmap/index.json` | yes |
146
+ | `/arch remote revoke <id>` | revokes session + workspace | — | clears both | — |
147
+
148
+ `grant` does not show a card because the typed command itself is the explicit user consent. The card only appears when a content read has no grant yet.
149
+
150
+ There is **no single-read grant**; the smallest scope is the current session. A session grant is invisible in the panel source bar (that bar reads the persisted workspace consent), but it is active for the session and its discussion children. Auto maintenance requires a workspace grant.
151
+
135
152
  Auto maintenance runs only after a durable “always allow”, for at most 50 changed files, at most once per 10 minutes. Larger changes only mark affected nodes stale. Real remote end-to-end verification was completed on a Linux host; auto maintenance still skips an idle parent (use `/arch remote update` to force it), and a maintenance run does not yet clear the local pending counter.
136
153
 
137
154
  Remote reads are confined to the registered root: `..`, absolute escapes, and symlinks pointing outside are rejected. Git projects use HEAD plus `git status`, and hash changed/untracked paths so a second edit to an already-dirty file still moves the fingerprint; non-git projects use path/size/mtime metadata, and only analyzed files are hashed.
@@ -194,17 +211,27 @@ There is no separate "start" button or left-sidebar icon. The plugin adds a righ
194
211
  ## Limitations
195
212
 
196
213
  - The sidebar follows the **session workspace**; an explicit tool `workspace` can point at a different graph than the panel shows.
197
- - Node positions are stored in the browser locally, not in `graph.json`.
214
+ - Dragged node positions are browser-local; only `node.position` pins are stored in `graph.json`.
198
215
  - Fork discussions inherit the parent request prefix, so their tool schemas may still show `bash`/`write` even though calls are denied.
199
216
  - A parent-initiated `send_message` to a discussion child produces DSH's native settlement notice (including the child's closing text) in the parent conversation. The initial `arch_discuss` is caller-only and the child's full transcript never enters the main log; use the child's sidebar chat for narrative follow-ups.
200
- - The canvas is hand-written SVG with a layered layout, not React Flow.
217
+ - The canvas is hand-written SVG with a layered layout, not React Flow. A cyclic graph with no `position` pins falls back to a compact grid; pin a layout when the reading order matters.
218
+ - Group metadata appears in the node subtitle/detail; the canvas does not draw group bands or resolve group titles yet (0.4).
201
219
  - Mermaid rendering is on by default (`auto`) but can be disabled with `renderMermaid: off`; a known `dsh-mermaid-plus` installation makes `auto` disable ours.
202
- - This is a 0.2.0 developer preview; the API and file schema can still change.
220
+ - This is a 0.3.0 developer preview; the API and file schema can still change.
203
221
  - Remote repositories are a developer preview: register, read, sync, polling, commands and maintenance are wired and were verified on a real Linux host; auto maintenance on an idle parent and pending-counter clearing remain rough edges.
204
222
 
205
223
  ## FAQ
206
224
 
207
- **Do I need `dsh-mermaid-plus`?** No. Mermaid 12.2.0 is vendored. With `dsh-mermaid-plus` enabled,
225
+ **How do I pin a layout?** Give a node a top-left corner in the graph:
226
+
227
+ ```json
228
+ { "op": "update_node", "id": "api", "patch": { "position": { "x": 120, "y": 40 } } }
229
+ ```
230
+
231
+ Unpinned nodes keep the automatic layout; `position: null` clears a pin. Dragging in the panel is a
232
+ browser-local override on top of the pins, and `Reset layout` drops the override.
233
+
234
+ **Do I need `dsh-mermaid-plus`? No. Mermaid 12.2.0 is vendored. With `dsh-mermaid-plus` enabled,
208
235
  `renderMermaid: auto` disables our renderer to avoid the shared `mermaid` fence key; `on` forces ours.
209
236
 
210
237
  **Why hand-written SVG instead of React Flow?** It keeps the client bundle self-contained and avoids a
@@ -234,7 +261,7 @@ session workspace by design. Open a session whose workspace is the graph you wan
234
261
  |---|---|
235
262
  | 0.1 | graph core and tools, sidebar canvas, node dragging, local position memory, `arch_sync` + manifest + dossier docs, cosmetic diff + stale marking, bundled architecture skill, `arch_discuss`, sidebar discussion buttons, `arch_export`, built-in Mermaid fence rendering |
236
263
  | 0.2 | read-only remote Linux repositories over SSH (source picker, consent, 60s polling, sync/commands, maintenance), release polish |
237
- | 0.3 | direct node→discussion bridge, shared/persisted positions, proposals, graph diff |
264
+ | 0.3 | direct node→discussion bridge, position pins, edge labels/routing, export pins, proposals, graph diff |
238
265
  | 0.4 | edge discussions, group collapse, Mermaid import, Office export |
239
266
  | 0.5 | multiple graphs, PR links, shared team maps |
240
267
  | 0.6 | multiple remote repositories in parallel, remote sharing/export polish |
package/README.zh.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  **DeepSeek Harness 的架构工作台:可交互的语义架构图、按节点开启的侧栏子对话、增量架构记忆。**
6
6
 
7
- > 状态:**0.2.0 开发者预览**。Host 工具、右侧栏画布、架构记忆、按节点子对话、确定性导出、内置 Mermaid 渲染和通过 SSH 只读查看远程 Linux 仓库都已可用;共享位置仍待实现,空闲父会话自动维护和 pending 清零是已知粗糙边缘。
7
+ > 状态:**0.3.0 开发者预览**。Host 工具、右侧栏画布、架构记忆、按节点子对话、确定性导出、内置 Mermaid 渲染和通过 SSH 只读查看远程 Linux 仓库都已可用;节点位置可以 pin 进 `graph.json` 并由画布渲染;空闲父会话自动维护和 pending 清零是已知粗糙边缘。
8
8
 
9
9
  ---
10
10
 
@@ -46,17 +46,17 @@ Architecture map 把「项目架构」变成 harness 里**可寻址的一等对
46
46
  ## 已实现
47
47
 
48
48
  - **Canonical 架构图**:`.archmap/graph.json`,带 rev、schema 校验、原子写入和单步备份。模型通过 `arch_graph_get` / `arch_graph_patch` 读写;`apply:false` 只预览不写入。
49
- - **右侧栏画布**:从当前会话 workspace 读取图,SVG 渲染节点/边,使用 longest-path 分层布局,支持平移、滚轮缩放、`Fit`、节点拖拽、`Reset layout`,点击节点看详情。
50
- - **位置本地记忆**:拖动的节点位置按 workspace 存在浏览器本地,刷新或同机新会话会保留;`Reset layout` 清掉。共享位置是后续计划。
49
+ - **右侧栏画布**:从当前会话 workspace 读取图,SVG 渲染节点/边和边标签,使用 longest-path 分层布局,优先采用节点 `position` pin,支持平移、滚轮缩放、`Fit`、节点拖拽、`Reset layout`,点击节点看详情。
50
+ - **位置:pin + 本地拖拽**:`graph.json` 里的 `position` 是共享布局(通过 `arch_graph_patch` 写入);拖动节点只在浏览器本地按 workspace 覆盖,刷新或同机新会话会保留;`Reset layout` 清掉本地覆盖,回到 pin/自动布局。
51
51
  - **增量架构记忆 + 格式改动识别**:`.archmap/manifest.json` 记录 hash 和归一化代码签名;`arch_sync` 只报告新增/修改/删除文件,区分代码改动和仅格式/注释改动,并列出受影响节点;`markStale:true` 会把这些节点标成 stale 并递增 graph rev,默认只报告不写图;anchor 还可以存文件的归一化内容签名,sync 会发现 hash 不匹配的节点,复盘后用 `arch_graph_patch` 的 `refreshAnchors:true` 刷新;`arch_manifest_commit` 记录已分析文件;`arch_doc_get` / `arch_doc_put` 读写 `overview`、`modules/<id>`、`notes/<id>`。
52
- - **确定性导出**:`arch_export` 把 Mermaid flowchart、独立 SVG 或 Markdown 档案摘要写到 `.archmap/export/`;不改变 graph rev,也不改源文件。
52
+ - **确定性导出**:`arch_export` 把 Mermaid flowchart、独立 SVG(跟随 `position` pin)或 Markdown 档案摘要写到 `.archmap/export/`;不改变 graph rev,也不改源文件。
53
53
  - **内置 Mermaid 渲染**:assistant 消息里的 ` ```mermaid ` 块用 vendored Mermaid 12.2.0 渲染,runtime 由本插件 Host 路由提供,不依赖 CDN,也不依赖 `dsh-mermaid-plus`。流式时保留代码块,语法错误回退代码块 + 错误行;`renderMermaid:false` 可关闭。
54
- - **按节点子对话**:`arch_discuss` 为 `node:<id>` 或 `edge:<id>` 开子会话;`fork` 继承主对话已完成轮次,`lite` 只靠图和档案。结果只走 caller,不污染主对话;结论写进 `notes/<id>`。节点详情里还有 `Discuss (fork)` / `Lite` 按钮,通过 `subagentchat` resource 在右侧栏打开子会话。子会话受提示词约束;shell 和通用源码写调用在执行时会被拒绝(fork 可能仍显示继承的工具 schema);改图仍需你确认。
54
+ - **按节点子对话**:`arch_discuss` 为 `node:<id>` 或 `edge:<id>` 开子会话;`fork` 继承主对话已完成轮次,`lite` 只靠图和档案。结果只走 caller,不污染主对话;结论写进 `notes/<id>`。节点详情里还有 `Discuss (fork)` / `Lite` 按钮,通过 `subagentchat` resource 在右侧栏打开子会话;按钮会把当前选中的本地/远程来源传给 Host(远程讨论需要远程内容授权)。子会话受提示词约束;shell 和通用源码写调用在执行时会被拒绝(fork 可能仍显示继承的工具 schema);改图仍需你确认。
55
55
  - **远程 Linux 仓库(开发者预览)**:`arch_remote_list/status/tree/read/grep` 通过 SSH 查看已登记仓库,不 clone;读内容前要授权,远程 `arch_sync`/`arch_manifest_commit` 只哈希已分析文件,变更轮询和 `/arch remote ...` 命令可用,面板可切换本地/远程来源,图和档案留在 `.archmap/projects/<id>/`,远程文件不被修改。
56
56
 
57
57
  ## 下一步计划
58
58
 
59
- - 位置共享/写回图数据、右侧栏导出按钮、短视频演示(GIF)。
59
+ - 右侧栏导出按钮、短视频演示(GIF)。
60
60
  - 远程维护打磨:空闲父会话自动启动,维护后清零本地 pending。
61
61
 
62
62
  ## 不是什么
@@ -84,7 +84,7 @@ Architecture map 把「项目架构」变成 harness 里**可寻址的一等对
84
84
 
85
85
  架构图、manifest、档案和导出都在 `<workspace>/.archmap/`;插件安装目录只有代码、skill、vendor、文档和 locale。
86
86
  插件不会修改用户项目的 `.gitignore`;想共享就提交 `.archmap/`,想只留本地就自己忽略。卸载插件不会删除
87
- `.archmap/`。节点位置只存在浏览器本地,不属于图数据。
87
+ `.archmap/`。`node.position` pin 属于图数据;拖动位置只是浏览器本地覆盖。
88
88
 
89
89
  ## 远程仓库(开发者预览)
90
90
 
@@ -114,6 +114,23 @@ Architecture map 把「项目架构」变成 harness 里**可寻址的一等对
114
114
  4. 打开 `/arch`,在面板顶部的来源选择器里切换 **本地 / staging**。状态条显示 host/root/vcs/授权;远程项目没有图时会显示对应的空状态。
115
115
  5. 选中远程来源会开始轮询。`/arch remote sync staging` 立即检查一次,`/arch remote update staging` 启维护子会话,`/arch remote list` 列项目,`/arch remote grant/revoke/remove` 管理授权和登记。
116
116
 
117
+ ### 远程授权范围
118
+
119
+ 内容读取卡和不弹卡的 `grant` 命令对应同一组范围:
120
+
121
+ | 输入 / 选择 | 范围 | 有效期 | 存储 | 自动维护 |
122
+ | --- | --- | --- | --- | --- |
123
+ | `/arch remote grant <id>` | workspace | 持久 | `.archmap/index.json` | 可以 |
124
+ | `/arch remote grant <id> always` | workspace | 持久 | `.archmap/index.json` | 可以 |
125
+ | `/arch remote grant <id> session` | 本次会话(含子会话) | 会话结束 | 仅内存 | 不行 |
126
+ | 授权卡「允许,本次会话」 | session | 会话结束 | 仅内存 | 不行 |
127
+ | 授权卡「始终允许这个远程」 | workspace | 持久 | `.archmap/index.json` | 可以 |
128
+ | `/arch remote revoke <id>` | 撤销 session + workspace | — | 两者都清 | — |
129
+
130
+ `grant` 不弹卡,因为输入的这条命令本身就是你的显式授权;只有内容读取还没有任何授权时才会弹卡。
131
+
132
+ **没有“单次读取”授权**,最小范围是本次会话。session 授权不会改变面板来源条(来源条读的是写盘的 workspace 授权),但对当前会话和它启动的讨论子会话有效。自动维护需要 workspace 授权。
133
+
117
134
  自动维护只在“始终允许”后运行,最多 50 个变更文件、最多每 10 分钟一次;超限只标 stale。真远程端到端验收已在 Linux 主机上完成;父会话空闲时自动维护会跳过(可用 `/arch remote update` 强制),维护后本地 pending 计数暂未清零。
118
135
 
119
136
  远程读取被限制在登记的 root 内:`..`、绝对路径逃逸和指向 root 外的符号链接都会被拒绝。git 项目用 HEAD + `git status`,并哈希已修改/未跟踪路径,保证脏文件再次编辑也能被检测到;非 git 项目用 path/size/mtime 元数据,只有已分析文件才会被哈希。
@@ -159,12 +176,13 @@ npm pack --dry-run
159
176
  ## 限制
160
177
 
161
178
  - 右侧栏跟随**会话 workspace**;工具参数里的显式 `workspace` 可能和面板显示的图不同。
162
- - 节点位置只存在浏览器本地,不在 `graph.json`。
179
+ - 拖动的节点位置只存在浏览器本地;只有 `node.position` pin 写进 `graph.json`。
163
180
  - fork 讨论继承父对话 request prefix,工具列表里可能仍显示 `bash`/`write`,但执行层会拒绝。
164
181
  - 父对话主动 `send_message` 给讨论子会话时,DSH 会在主对话里投递 native settlement notice(含子会话 closing text)。初次 `arch_discuss` 是 caller-only,子会话完整 transcript 不会进主日志;需要继续聊请在子会话侧栏里发。
165
- - 画布是手写 SVG + 分层布局,不是 React Flow。
182
+ - 画布是手写 SVG + 分层布局,不是 React Flow。带环且没有 `position` pin 的图会退化为紧凑网格;在意阅读顺序时请 pin 布局。
183
+ - 分组只以节点副标题/详情显示;画布不画分组带,也不解析分组标题(0.4)。
166
184
  - Mermaid 默认 `auto` 开启;`renderMermaid: off` 可关;检测到已知的 `dsh-mermaid-plus` 时 `auto` 会关闭本插件渲染。
167
- - 这是 0.2.0 开发者预览,API 和文件 schema 仍可能变化。
185
+ - 这是 0.3.0 开发者预览,API 和文件 schema 仍可能变化。
168
186
  - 远程仓库是开发者预览:登记、读取、同步、轮询、命令和维护都已接上,并在真实 Linux 主机上验收;空闲父会话的自动维护和 pending 清零仍是粗糙边缘。
169
187
 
170
188
  ## 安装
@@ -186,6 +204,15 @@ npm pack --dry-run
186
204
 
187
205
  ## 常见问题
188
206
 
207
+ **怎么 pin 布局?** 给节点一个左上角坐标:
208
+
209
+ ```json
210
+ { "op": "update_node", "id": "api", "patch": { "position": { "x": 120, "y": 40 } } }
211
+ ```
212
+
213
+ 未 pin 的节点继续走自动布局;`position: null` 清除 pin。面板里拖动是叠加在 pin 之上的浏览器本地覆盖,
214
+ `Reset layout` 只清本地覆盖。
215
+
189
216
  **需要 `dsh-mermaid-plus` 吗?** 不需要,Mermaid 12.2.0 已 vendored。如果启用了 `dsh-mermaid-plus`,
190
217
  `renderMermaid: auto` 会关闭本插件渲染,避免共用 `mermaid` fence key;`on` 强制开启本插件。
191
218
 
@@ -216,7 +243,7 @@ React Flow 仍可作为后续可选升级。
216
243
  |---|---|
217
244
  | 0.1 | 图核心与工具、右侧栏画布、节点拖拽、位置本地记忆、`arch_sync` + manifest + dossier、格式改动识别 + stale、内置 architecture skill、`arch_discuss`、右侧栏讨论按钮、`arch_export`、内置 Mermaid fence 渲染 |
218
245
  | 0.2 | 通过 SSH 只读查看远程 Linux 仓库(来源选择、授权、60 秒轮询、sync/命令、维护)+ 发布打磨 |
219
- | 0.3 | 节点直连讨论、位置共享/写回图、提案、图 diff |
246
+ | 0.3 | 节点直连讨论、位置 pin、边标签/路由、导出 pin、提案、图 diff |
220
247
  | 0.4 | 边讨论、分组折叠、Mermaid 导入、Office 导出 |
221
248
  | 0.5 | 多图、PR 关联、团队共享 |
222
249
  | 0.6 | 多远程仓库并行、远程共享/导出打磨 |
package/client.js CHANGED
@@ -244,6 +244,35 @@ window.__ModuleLoader__.load({
244
244
  return value.length <= max ? value : `${value.slice(0, max - 1)}…`
245
245
  }
246
246
 
247
+ /** Clip to a pixel budget (CJK counts as a full em, ASCII as ~0.58 em). */
248
+ function clipWidth(text, maxWidth, fontSize = 13) {
249
+ const value = String(text ?? '')
250
+ let width = 0
251
+ let out = ''
252
+ for (const char of value) {
253
+ const charWidth = char.charCodeAt(0) > 255 ? fontSize : fontSize * 0.58
254
+ if (width + charWidth > maxWidth - fontSize) return `${out}…`
255
+ out += char
256
+ width += charWidth
257
+ }
258
+ return out
259
+ }
260
+
261
+ /**
262
+ * A local drag only replaces the x/y of the automatic layout box; width,
263
+ * height and every undragged node still come from the layout.
264
+ */
265
+ function overlayPosition(base, override) {
266
+ if (!base) return undefined
267
+ if (!override || !Number.isFinite(override.x) || !Number.isFinite(override.y)) return base
268
+ return { ...base, x: override.x, y: override.y }
269
+ }
270
+
271
+ /** The panel's Discuss/Lite path must carry the selected source, not the session cwd. */
272
+ function discussionCommand(id, mode, workspace) {
273
+ return `/arch discuss node:${id} ${mode}${workspace ? ` ${workspace}` : ''}`
274
+ }
275
+
247
276
  let mermaidRuntime
248
277
  let mermaidUid = 0
249
278
 
@@ -474,8 +503,9 @@ window.__ModuleLoader__.load({
474
503
  /**
475
504
  * Layered layout: longest-path levels for a DAG. Cyclic graphs fall back to
476
505
  * the grid so a bad edge cannot collapse the canvas into one column.
506
+ * Pinned `node.position` values are applied afterwards by `layout`.
477
507
  */
478
- function layout(graph) {
508
+ function autoLayout(graph) {
479
509
  const nodes = Array.isArray(graph?.nodes) ? graph.nodes : []
480
510
  if (nodes.length === 0) return { positions: new Map(), width: 0, height: 96 }
481
511
  const ids = new Set(nodes.map(node => node.id))
@@ -537,6 +567,126 @@ window.__ModuleLoader__.load({
537
567
  return { positions, width, height }
538
568
  }
539
569
 
570
+ function pinnedPosition(node) {
571
+ const position = node?.position
572
+ if (!position || !Number.isFinite(position.x) || !Number.isFinite(position.y)) return null
573
+ return { x: position.x, y: position.y }
574
+ }
575
+
576
+ /**
577
+ * Automatic layout with optional manual pins. A node with a finite
578
+ * `position` keeps that top-left corner; everything else is placed by the
579
+ * layered/grid fallback. Local drags still override both in the panel.
580
+ */
581
+ function layout(graph) {
582
+ const view = autoLayout(graph)
583
+ const nodes = Array.isArray(graph?.nodes) ? graph.nodes : []
584
+ let width = view.width
585
+ let height = view.height
586
+ let pinned = 0
587
+ for (const node of nodes) {
588
+ const position = pinnedPosition(node)
589
+ if (!position) continue
590
+ const base = view.positions.get(node.id) ?? { x: 0, y: 0, w: 196, h: 64 }
591
+ const box = { ...base, x: position.x, y: position.y }
592
+ view.positions.set(node.id, box)
593
+ pinned += 1
594
+ width = Math.max(width, box.x + box.w + 24)
595
+ height = Math.max(height, box.y + box.h + 24)
596
+ }
597
+ return { positions: view.positions, width, height, pinned }
598
+ }
599
+
600
+ /**
601
+ * Straight or curved edge geometry. Forward edges leave the right side and
602
+ * enter the left side; backward edges leave the left side and enter the
603
+ * right side as return paths. Same-row forward edges detour around a node
604
+ * that blocks the straight line.
605
+ */
606
+ function edgeRoute(from, to, boxes = []) {
607
+ const fx = from.x + from.w / 2
608
+ const fy = from.y + from.h / 2
609
+ const tx = to.x + to.w / 2
610
+ const ty = to.y + to.h / 2
611
+ const dx = tx - fx
612
+ const dy = ty - fy
613
+ const horizontal = Math.abs(dx) >= (from.w + to.w) / 2 - 8
614
+ if (horizontal && dx >= 0) {
615
+ const start = { x: from.x + from.w, y: fy }
616
+ const end = { x: to.x, y: ty }
617
+ // Same-row edges can be blocked by a node between the two boxes. Route
618
+ // above or below the blocker instead of drawing through its title.
619
+ const blockers = Math.abs(dy) > 4 ? [] : boxes.filter(box => {
620
+ if (box === from || box === to) return false
621
+ return box.x < end.x
622
+ && box.x + box.w > start.x
623
+ && box.y < fy
624
+ && box.y + box.h > fy
625
+ })
626
+ if (blockers.length > 0) {
627
+ const top = Math.min(fy, ...blockers.map(box => box.y)) - 26
628
+ const bottom = Math.max(fy, ...blockers.map(box => box.y + box.h)) + 18
629
+ const lane = top >= 12 && fy - top <= bottom - fy ? top : bottom
630
+ const inner = 10
631
+ const d = [
632
+ `M ${start.x} ${start.y}`,
633
+ `L ${start.x + inner} ${start.y}`,
634
+ `L ${start.x + inner} ${lane}`,
635
+ `L ${end.x - inner} ${lane}`,
636
+ `L ${end.x - inner} ${end.y}`,
637
+ `L ${end.x} ${end.y}`,
638
+ ].join(' ')
639
+ return {
640
+ d,
641
+ label: { x: (start.x + end.x) / 2, y: lane - 7 },
642
+ }
643
+ }
644
+ return {
645
+ d: `M ${start.x} ${start.y} L ${end.x} ${end.y}`,
646
+ label: { x: (start.x + end.x) / 2, y: (start.y + end.y) / 2 - 7 },
647
+ gap: to.x - (from.x + from.w),
648
+ above: Math.max(12, Math.min(from.y, to.y) - 12),
649
+ }
650
+ }
651
+ if (horizontal) {
652
+ const start = { x: from.x, y: fy }
653
+ const end = { x: to.x + to.w, y: ty }
654
+ const bow = 70 + Math.min(60, Math.abs(dx) * 0.08)
655
+ // A diagonal return edge should pass between the two rows, not dip
656
+ // through whatever sits below the target row.
657
+ const controlY = Math.abs(dy) < 24
658
+ ? Math.max(start.y, end.y) + bow
659
+ : (start.y + end.y) / 2
660
+ const control = { x: (start.x + end.x) / 2, y: controlY }
661
+ return {
662
+ d: `M ${start.x} ${start.y} Q ${control.x} ${control.y} ${end.x} ${end.y}`,
663
+ label: {
664
+ x: 0.25 * start.x + 0.5 * control.x + 0.25 * end.x,
665
+ y: 0.25 * start.y + 0.5 * control.y + 0.25 * end.y,
666
+ },
667
+ }
668
+ }
669
+ const start = { x: fx, y: dy >= 0 ? from.y + from.h : from.y }
670
+ const end = { x: tx, y: dy >= 0 ? to.y : to.y + to.h }
671
+ return {
672
+ d: `M ${start.x} ${start.y} L ${end.x} ${end.y}`,
673
+ label: { x: (start.x + end.x) / 2, y: (start.y + end.y) / 2 - 7 },
674
+ }
675
+ }
676
+
677
+ function edgeLabelWidth(text) {
678
+ let width = 0
679
+ for (const char of text) width += char.charCodeAt(0) > 255 ? 10 : 6
680
+ return width + 10
681
+ }
682
+
683
+ function edgeStyle(kind) {
684
+ if (kind === 'dependency') return { width: 1.2, opacity: 0.45, dash: '4 3' }
685
+ if (kind === 'containment') return { width: 1.2, opacity: 0.4, dash: '1 4' }
686
+ if (kind === 'data') return { width: 1.3, opacity: 0.5 }
687
+ return { width: 1.4, opacity: 0.6 }
688
+ }
689
+
540
690
  function readAll(ctx, sessionId, filePath, signal) {
541
691
  return (async () => {
542
692
  let offset = 1
@@ -581,7 +731,7 @@ window.__ModuleLoader__.load({
581
731
  }),
582
732
  h('text', {
583
733
  x: x + 12, y: y + 24, fill: 'currentColor', fontSize: 13, fontWeight: 600,
584
- }, clip(node.title ?? node.id, 22)),
734
+ }, clipWidth(node.title ?? node.id, 170)),
585
735
  h('text', {
586
736
  x: x + 12, y: y + 44, fill: 'currentColor', fontSize: 11, opacity: 0.65,
587
737
  }, `${node.kind ?? 'module'}${node.group ? ` · ${node.group}` : ''}${node.status === 'stale' ? ` · ${t('legend.stale')}` : ''}`),
@@ -737,7 +887,9 @@ window.__ModuleLoader__.load({
737
887
  ? edges.filter(edge => edge.from === selected.id || edge.to === selected.id)
738
888
  : []
739
889
  const layoutView = layout(graph)
740
- const positionOf = id => positions[id] ?? layoutView.positions.get(id)
890
+ // Local drags are overrides on top of the graph's own (possibly pinned)
891
+ // positions. Keeping only x/y here means a graph repin still shows up.
892
+ const positionOf = id => overlayPosition(layoutView.positions.get(id), positions[id])
741
893
 
742
894
  const fitBoxes = boxes => {
743
895
  if (boxes.length === 0) return
@@ -755,30 +907,26 @@ window.__ModuleLoader__.load({
755
907
  }
756
908
 
757
909
  const fitGraph = target => {
758
- const current = Object.values(positions)
759
- fitBoxes(current.length > 0 ? current : [...layout(target).positions.values()])
910
+ const boxes = (Array.isArray(target?.nodes) ? target.nodes : [])
911
+ .map(node => positionOf(node.id))
912
+ .filter(Boolean)
913
+ fitBoxes(boxes.length > 0 ? boxes : [...layout(target).positions.values()])
760
914
  }
761
915
 
762
916
  const resetLayout = () => {
763
917
  if (!graph) return
764
- const base = layout(graph)
765
- setPositions(Object.fromEntries(base.positions))
918
+ setPositions({})
766
919
  clearSavedPositions(storageKey)
767
- fitBoxes([...base.positions.values()])
920
+ fitBoxes([...layout(graph).positions.values()])
768
921
  }
769
922
 
770
923
  React.useEffect(() => {
771
924
  if (!graph || !storageKey) return
772
- const base = layout(graph)
925
+ const ids = new Set(graph.nodes.map(node => node.id))
773
926
  const saved = readSavedPositions(storageKey)
774
- setPositions(previous => {
775
- const next = {}
776
- for (const [id, box] of base.positions) {
777
- const old = previous[id] ?? saved[id]
778
- next[id] = old ? { ...box, x: old.x, y: old.y } : box
779
- }
780
- return next
781
- })
927
+ setPositions(Object.fromEntries(
928
+ Object.entries(saved).filter(([id]) => ids.has(id)),
929
+ ))
782
930
  }, [graph?.rev, storageKey])
783
931
 
784
932
  React.useEffect(() => {
@@ -806,13 +954,10 @@ window.__ModuleLoader__.load({
806
954
  const dx = (moveEvent.clientX - startX) / view.zoom
807
955
  const dy = (moveEvent.clientY - startY) / view.zoom
808
956
  last = { x: originX + dx, y: originY + dy }
809
- setPositions(previous => {
810
- const current = previous[id] ?? box
811
- return {
812
- ...previous,
813
- [id]: { ...current, ...last },
814
- }
815
- })
957
+ setPositions(previous => ({
958
+ ...previous,
959
+ [id]: last,
960
+ }))
816
961
  }
817
962
  const up = () => {
818
963
  window.removeEventListener('pointermove', move)
@@ -960,11 +1105,18 @@ window.__ModuleLoader__.load({
960
1105
  type: 'button',
961
1106
  style: styles.button,
962
1107
  onClick: resetLayout,
963
- title: 'Reset node positions to the automatic layout',
1108
+ title: 'Clear local drags and return to the pinned or automatic layout',
964
1109
  }, t('panel.reset')),
965
1110
  h('span', { style: styles.meta }, `${Math.round(view.zoom * 100)}%`),
966
1111
  h('span', { style: { ...styles.meta, opacity: 0.55 } }, t('panel.hint')))
967
1112
 
1113
+ const boxes = nodes.map(node => positionOf(node.id)).filter(Boolean)
1114
+ const edgeViews = edges.flatMap(edge => {
1115
+ const from = positionOf(edge.from)
1116
+ const to = positionOf(edge.to)
1117
+ return from && to ? [{ edge, route: edgeRoute(from, to, boxes) }] : []
1118
+ })
1119
+
968
1120
  const canvas = nodes.length === 0
969
1121
  ? h('div', { style: styles.empty },
970
1122
  h('div', { style: { fontWeight: 600, marginBottom: '6px' } },
@@ -999,17 +1151,17 @@ window.__ModuleLoader__.load({
999
1151
  orient: 'auto-start-reverse',
1000
1152
  }, h('path', { d: 'M 0 0 L 10 5 L 0 10 z', fill: 'var(--dsw-alias-text-secondary, #888)' }))),
1001
1153
  h('g', { transform: `translate(${view.x} ${view.y}) scale(${view.zoom})` },
1002
- edges.map(edge => {
1003
- const from = positionOf(edge.from)
1004
- const to = positionOf(edge.to)
1005
- if (!from || !to) return null
1006
- return h('line', {
1154
+ edgeViews.map(({ edge, route }) => {
1155
+ const style = edgeStyle(edge.kind)
1156
+ return h('path', {
1007
1157
  key: `edge:${edge.id}`,
1008
- x1: from.x + from.w, y1: from.y + from.h / 2,
1009
- x2: to.x, y2: to.y + to.h / 2,
1158
+ d: route.d,
1159
+ fill: 'none',
1010
1160
  stroke: 'var(--dsw-alias-text-secondary, #888)',
1011
- strokeWidth: 1.2,
1012
- strokeOpacity: 0.6,
1161
+ strokeWidth: style.width,
1162
+ strokeOpacity: style.opacity,
1163
+ strokeDasharray: style.dash,
1164
+ strokeLinecap: 'round',
1013
1165
  markerEnd: 'url(#archmap-arrow)',
1014
1166
  })
1015
1167
  }),
@@ -1023,6 +1175,30 @@ window.__ModuleLoader__.load({
1023
1175
  })
1024
1176
  : null
1025
1177
  }),
1178
+ edgeViews.map(({ edge, route }) => {
1179
+ const label = clip(edge.label, 24).trim()
1180
+ if (!label) return null
1181
+ const width = edgeLabelWidth(label)
1182
+ const tight = route.gap !== undefined && width + 6 > route.gap
1183
+ const labelY = tight ? route.above : route.label.y
1184
+ return h('g', { key: `label:${edge.id}`, style: { pointerEvents: 'none' } },
1185
+ h('rect', {
1186
+ x: route.label.x - width / 2,
1187
+ y: labelY - 9,
1188
+ width,
1189
+ height: 15,
1190
+ rx: 3,
1191
+ fill: 'var(--dsw-alias-bg-primary, #ffffff)',
1192
+ opacity: 0.9,
1193
+ }),
1194
+ h('text', {
1195
+ x: route.label.x,
1196
+ y: labelY + 2,
1197
+ textAnchor: 'middle',
1198
+ fontSize: 10.5,
1199
+ fill: 'var(--dsw-alias-text-secondary, #888)',
1200
+ }, label))
1201
+ }),
1026
1202
  ),
1027
1203
  )
1028
1204
 
@@ -1045,7 +1221,8 @@ window.__ModuleLoader__.load({
1045
1221
  }
1046
1222
  setDiscussState({ status: 'starting', error: null })
1047
1223
  try {
1048
- const line = `/arch discuss node:${selected.id} ${mode}`
1224
+ const workspace = source?.kind === 'remote' ? `remote:${source.id}` : undefined
1225
+ const line = discussionCommand(selected.id, mode, workspace)
1049
1226
  const response = await ctx.remote.commands.execute(sessionId, line, [])
1050
1227
  if (!response.ok) throw new Error(`${response.error.code}: ${response.error.message}`)
1051
1228
  const outcome = response.value?.result
package/docs/DETAIL.md CHANGED
@@ -7,10 +7,10 @@ A live, addressable architecture graph for DeepSeek Harness. The model writes no
7
7
  ## What you get
8
8
 
9
9
  - **Canonical graph** — `.archmap/graph.json` with a revision, schema validation, atomic writes and a one-step backup.
10
- - **Right-sidebar canvas** — layered SVG layout, pan/zoom/Fit, node dragging, reset layout and node details.
10
+ - **Right-sidebar canvas** — layered SVG layout with edge labels, `node.position` pins, pan/zoom/Fit, node dragging, reset layout and node details.
11
11
  - **Architecture memory** — a manifest of analyzed files, incremental `arch_sync`, code-vs-cosmetic detection, stale marking and a Markdown dossier (`overview`, `modules/<id>`, `notes/<id>`).
12
- - **Per-node discussions** — `arch_discuss` starts a fork (inherits completed turns) or lite (fresh from graph/dossier) child; the sidebar opens it; conclusions go to `notes/<id>`.
13
- - **Exports** — deterministic Mermaid, SVG and Markdown files under `.archmap/export/`.
12
+ - **Per-node discussions** — `arch_discuss` starts a fork (inherits completed turns) or lite (fresh from graph/dossier) child; the sidebar opens it; conclusions go to `notes/<id>`. The sidebar's Discuss/Lite buttons pass the selected local or remote source; a remote discussion requires remote content consent.
13
+ - **Exports** — deterministic Mermaid, SVG (pinned positions honored) and Markdown files under `.archmap/export/`.
14
14
  - **Built-in Mermaid** — assistant ` ```mermaid ` fences render with a vendored runtime served by the plugin; no CDN and no extra Mermaid plugin.
15
15
  - **Bundled skill** — `architecture-map` explains the sync → read → patch → dossier → commit loop.
16
16
  - **Remote Linux repositories (developer preview)** — register a repository over SSH without cloning; the panel switches local/remote sources, content reads are consent-gated, and a 60-second fingerprint poll marks affected nodes stale while the graph/dossier stay local.
@@ -48,17 +48,18 @@ The model can also use the bundled `architecture-map` skill in a new session.
48
48
 
49
49
  ## Data and permissions
50
50
 
51
- - Reads/writes local state only under `<workspace>/.archmap/` (plus the browser's local position preference).
51
+ - Reads/writes local state only under `<workspace>/.archmap/` (plus the browser's local drag overrides).
52
52
  - No telemetry and no external network requests; Mermaid is served from the plugin's own Host route.
53
53
  - Graph/dossier writes are bounded and atomic; source files are never edited by `arch_graph_patch` or `arch_doc_put`.
54
54
  - Discussion children are prompt-constrained; shell and generic source-write calls are denied at execution (a fork may still display inherited tool schemas).
55
- - Remote access uses the user's OpenSSH config, is read-only, and never clones or writes the remote repository. Content reads need an explicit session/always grant; remote path escapes and symlinks outside the root are rejected.
55
+ - Remote access uses the user's OpenSSH config, is read-only, and never clones or writes the remote repository. Content reads need an explicit grant: `/arch remote grant <id> session` (this session and its children, in memory) or `/arch remote grant <id> always` / no scope (workspace, persisted in `.archmap/index.json`, required for auto maintenance); `/arch remote revoke <id>` clears both. The content-read card offers the same two choices, and the panel source bar shows only the persisted workspace scope. Remote path escapes and symlinks outside the root are rejected.
56
56
  - Mermaid uses `securityLevel: 'strict'`.
57
57
 
58
58
  ## Known limitations
59
59
 
60
- - The canvas is a hand-written SVG implementation, not React Flow.
61
- - Node positions are local to the browser; shared positions are not implemented yet.
60
+ - The canvas is a hand-written SVG implementation, not React Flow. A cyclic graph without `position` pins falls back to a compact grid; pin a layout when the reading order matters.
61
+ - Group metadata appears in the node subtitle/detail; the canvas does not draw group bands or resolve group titles yet (0.4).
62
+ - Dragged node positions are local to the browser; `node.position` pins are stored in the graph.
62
63
  - The sidebar follows the **session workspace**; it does not show a graph from an explicit `workspace` argument when the two differ.
63
64
  - Fork discussions inherit the parent request prefix, so their tool list can still show schemas that are denied at execution.
64
65
  - If the parent agent uses `send_message` to continue a child, DSH posts a native settlement notice (with the child's closing text) in the parent conversation. The initial `arch_discuss` result is caller-only; the child transcript is not copied into the main log.
@@ -73,4 +74,4 @@ The model can also use the bundled `architecture-map` skill in a new session.
73
74
 
74
75
  ## Status
75
76
 
76
- 0.2.0 developer preview. `npm test` covers graph, memory, stale-hash, export, remote content/SSH, consent, sync, polling, commands and maintenance policy (65 tests); CI runs syntax checks, tests and `npm pack --dry-run`.
77
+ 0.3.0 developer preview. `npm test` covers graph validation and positions, layout pins and edge routing, memory, stale-hash, export, remote content/SSH, consent, sync, polling, commands and maintenance policy (77 tests); CI runs syntax checks, tests and `npm pack --dry-run`.
package/docs/DETAIL.zh.md CHANGED
@@ -7,10 +7,10 @@
7
7
  ## 功能
8
8
 
9
9
  - **Canonical 图**:`.archmap/graph.json`,带 rev、schema 校验、原子写入和单步备份。
10
- - **右侧栏画布**:分层 SVG 布局、平移/缩放/Fit、节点拖拽、Reset layout、节点详情。
10
+ - **右侧栏画布**:分层 SVG 布局、边标签、`node.position` pin、平移/缩放/Fit、节点拖拽、Reset layout、节点详情。
11
11
  - **架构记忆**:manifest、增量 `arch_sync`、代码/格式改动识别、stale 标记和 Markdown dossier(`overview`、`modules/<id>`、`notes/<id>`)。
12
- - **按节点讨论**:`arch_discuss` 开 fork(继承已完成轮次)或 lite(只靠图和档案);侧栏打开子会话;结论写到 `notes/<id>`。
13
- - **导出**:确定性的 Mermaid、SVG、Markdown,落在 `.archmap/export/`。
12
+ - **按节点讨论**:`arch_discuss` 开 fork(继承已完成轮次)或 lite(只靠图和档案);侧栏打开子会话;结论写到 `notes/<id>`。面板的 Discuss/Lite 会把当前选中的本地/远程来源传给 Host;远程讨论需要远程内容授权。
13
+ - **导出**:确定性的 Mermaid、SVG(跟随 position pin)、Markdown,落在 `.archmap/export/`。
14
14
  - **内置 Mermaid**:assistant 消息里的 ` ```mermaid ` 用本插件自带的 runtime 渲染,不访问 CDN,不依赖额外 Mermaid 插件。
15
15
  - **随包 skill**:`architecture-map` 指导 sync → 读变更 → 改图 → 档案 → commit 的循环。
16
16
  - **远程 Linux 仓库(开发者预览)**:通过 SSH 登记仓库,不 clone;面板可切换本地/远程来源,读内容前要授权;60 秒指纹轮询把受影响节点标 stale,图和档案留在本地。
@@ -48,17 +48,18 @@
48
48
 
49
49
  ## 数据与权限
50
50
 
51
- - 本地状态只读写 `<workspace>/.archmap/`(以及浏览器本地的节点位置偏好)。
51
+ - 本地状态只读写 `<workspace>/.archmap/`(以及浏览器本地的拖拽覆盖)。
52
52
  - 无遥测、无外部网络请求;Mermaid 由插件自己的 Host 路由提供。
53
53
  - 图和档案写入有上限、原子落盘;`arch_graph_patch` / `arch_doc_put` 不修改源码。
54
54
  - 讨论子会话受提示词约束;shell 和通用源码写调用在执行层被拒绝(fork 可能仍显示继承的工具 schema)。
55
- - 远程访问使用用户自己的 OpenSSH 配置,只读,不 clone、不写远程仓库;读内容需要本次会话/始终允许授权;远程路径逃逸和 root 外符号链接会被拒绝。
55
+ - 远程访问使用用户自己的 OpenSSH 配置,只读,不 clone、不写远程仓库;读内容需要显式授权:`/arch remote grant <id> session`(本次会话及子会话,仅内存)或 `/arch remote grant <id> always` / 不带范围(workspace,写进 `.archmap/index.json`,自动维护需要它);`/arch remote revoke <id>` 两者都清。内容读取卡提供同样两个选择,面板来源条只显示写盘的 workspace 授权;远程路径逃逸和 root 外符号链接会被拒绝。
56
56
  - Mermaid 使用 `securityLevel: 'strict'`。
57
57
 
58
58
  ## 已知限制
59
59
 
60
- - 画布是手写 SVG,不是 React Flow。
61
- - 节点位置只存在浏览器本地;共享位置还没做。
60
+ - 画布是手写 SVG,不是 React Flow。带环且没有 `position` pin 的图会退化为紧凑网格;在意阅读顺序时请 pin 布局。
61
+ - 分组只以节点副标题/详情显示;画布不画分组带,也不解析分组标题(0.4)。
62
+ - 拖动的节点位置只存在浏览器本地;`node.position` pin 存在图里。
62
63
  - 右侧栏跟随**会话 workspace**;工具参数里的显式 `workspace` 不同时,面板不会显示那张图。
63
64
  - fork 讨论会继承父对话 request prefix,工具列表里可能仍显示执行层已拒绝的 schema。
64
65
  - 父 agent 用 `send_message` 继续子会话时,DSH 会在主对话里投递 settlement notice(含子会话 closing text);初次 `arch_discuss` 是 caller-only,子会话 transcript 不会复制进主日志。
@@ -73,4 +74,4 @@
73
74
 
74
75
  ## 状态
75
76
 
76
- 0.2.0 开发者预览。`npm test` 覆盖图、记忆、stale-hash、导出、远程内容/SSH、授权、同步、轮询、命令和维护策略(65 个测试);CI 跑语法检查、测试和 `npm pack --dry-run`。
77
+ 0.3.0 开发者预览。`npm test` 覆盖图校验与位置、布局 pin 与连线路由、记忆、stale-hash、导出、远程内容/SSH、授权、同步、轮询、命令和维护策略(77 个测试);CI 跑语法检查、测试和 `npm pack --dry-run`。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-architecture-map",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Architecture map for DeepSeek Harness: a semantic architecture graph with per-node side conversations, incremental architecture memory and read-only remote repositories over SSH.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -30,6 +30,7 @@ All data lives under `<workspace>/.archmap/`. Do not invent another store.
30
30
  "group": "g-core",
31
31
  "summary": "User request enters the agent and dispatches tools.",
32
32
  "status": "fresh",
33
+ "position": { "x": 40, "y": 40 },
33
34
  "anchors": [{ "path": "src/host/plugin.js", "symbol": "apply" }]
34
35
  }
35
36
  ],
@@ -44,8 +45,9 @@ All data lives under `<workspace>/.archmap/`. Do not invent another store.
44
45
  - **status**: `fresh`, `stale`, `proposed`.
45
46
  - **anchor**: workspace-relative POSIX `path`, optional `symbol`, optional `hash` (the normalized content signature: comments/whitespace ignored for code); no `..`, absolute paths, backslashes or empty segments. `arch_graph_patch` fills a missing hash from disk and preserves an existing hash unless `refreshAnchors:true` is passed.
46
47
  - **group**: optional group id; groups have `id` and `title`.
48
+ - **position**: optional `{x, y}` (finite numbers, ±1000000); the node's top-left corner in canvas coordinates. A pinned node keeps that spot; unpinned nodes are placed automatically.
47
49
  - **edge**: `from`/`to` must be existing node ids; `kind` common values `call`, `data`, `dependency`, `next`, `contains`.
48
- - `layout.mode` is advisory for the client; the current client uses its own grid + local positions.
50
+ - `layout.mode` is advisory for the client; the current client uses its own layered/grid layout, `node.position` pins and browser-local drag overrides.
49
51
 
50
52
  `rev` increments on every successful write. Pass the latest `rev` as `baseRev`; a mismatch returns `STALE_REV`. `apply:false` validates and returns a diff without writing. `refreshAnchors:true` recomputes all anchor hashes after review; without it, only missing hashes are filled.
51
53
 
@@ -53,7 +55,7 @@ All data lives under `<workspace>/.archmap/`. Do not invent another store.
53
55
 
54
56
  ```
55
57
  add_node { node }
56
- update_node { id, patch }
58
+ update_node { id, patch } # patch.position={x,y} pins; patch.position=null clears
57
59
  remove_node { id, cascade? }
58
60
  add_edge { edge }
59
61
  update_edge { id, patch }
@@ -91,4 +93,4 @@ Exports never modify `graph.json` or the manifest.
91
93
  - Paths are realpath-checked and must stay inside the workspace.
92
94
  - Writes are atomic (temp file + rename); a failed write must be reported, never silently retried.
93
95
  - The UI polls the graph every 2s; a successful patch becomes visible within ~3s.
94
- - Node positions are a **local view preference** (browser localStorage), not part of `graph.json`.
96
+ - `position` is part of `graph.json` (shared pin). Dragging a node only writes a browser-local override; `Reset layout` drops the override and returns to the pin/automatic layout. A cyclic graph with no pins falls back to a compact grid, so pin positions when the reading order matters.
@@ -143,9 +143,86 @@ function gridLayout(graph) {
143
143
  h: NODE_H,
144
144
  })
145
145
  })
146
- const width = PAD * 2 + cols * NODE_W + (cols - 1) * GAP_X
147
- const height = PAD * 2 + rows * NODE_H + (rows - 1) * GAP_Y
148
- return { positions, width, height }
146
+ let width = PAD * 2 + cols * NODE_W + (cols - 1) * GAP_X
147
+ let height = PAD * 2 + rows * NODE_H + (rows - 1) * GAP_Y
148
+ // A pinned position is a top-left corner in graph coordinates; the grid is
149
+ // only the fallback for nodes that do not carry one.
150
+ for (const node of nodes) {
151
+ const position = node.position
152
+ if (!position || !Number.isFinite(position.x) || !Number.isFinite(position.y)) continue
153
+ const box = positions.get(node.id)
154
+ box.x = position.x
155
+ box.y = position.y
156
+ width = Math.max(width, box.x + box.w + PAD)
157
+ height = Math.max(height, box.y + box.h + PAD)
158
+ }
159
+ return { positions, width: Math.ceil(width), height: Math.ceil(height) }
160
+ }
161
+
162
+ function edgeRoute(from, to, boxes = []) {
163
+ const fx = from.x + from.w / 2
164
+ const fy = from.y + from.h / 2
165
+ const tx = to.x + to.w / 2
166
+ const ty = to.y + to.h / 2
167
+ const dx = tx - fx
168
+ const dy = ty - fy
169
+ const horizontal = Math.abs(dx) >= (from.w + to.w) / 2 - 8
170
+ if (horizontal && dx >= 0) {
171
+ const start = { x: from.x + from.w, y: fy }
172
+ const end = { x: to.x, y: ty }
173
+ const blockers = Math.abs(dy) > 4 ? [] : boxes.filter(box => {
174
+ if (box === from || box === to) return false
175
+ return box.x < end.x
176
+ && box.x + box.w > start.x
177
+ && box.y < fy
178
+ && box.y + box.h > fy
179
+ })
180
+ if (blockers.length > 0) {
181
+ const top = Math.min(fy, ...blockers.map(box => box.y)) - 26
182
+ const bottom = Math.max(fy, ...blockers.map(box => box.y + box.h)) + 18
183
+ const lane = top >= 12 && fy - top <= bottom - fy ? top : bottom
184
+ const inner = 10
185
+ return {
186
+ d: [
187
+ `M ${start.x} ${start.y}`,
188
+ `L ${start.x + inner} ${start.y}`,
189
+ `L ${start.x + inner} ${lane}`,
190
+ `L ${end.x - inner} ${lane}`,
191
+ `L ${end.x - inner} ${end.y}`,
192
+ `L ${end.x} ${end.y}`,
193
+ ].join(' '),
194
+ label: { x: (start.x + end.x) / 2, y: lane - 6 },
195
+ }
196
+ }
197
+ return {
198
+ d: `M ${start.x} ${start.y} L ${end.x} ${end.y}`,
199
+ label: { x: (start.x + end.x) / 2, y: (start.y + end.y) / 2 - 6 },
200
+ gap: to.x - (from.x + from.w),
201
+ above: Math.max(12, Math.min(from.y, to.y) - 12),
202
+ }
203
+ }
204
+ if (horizontal) {
205
+ const start = { x: from.x, y: fy }
206
+ const end = { x: to.x + to.w, y: ty }
207
+ const bow = 70 + Math.min(60, Math.abs(dx) * 0.08)
208
+ const controlY = Math.abs(dy) < 24
209
+ ? Math.max(start.y, end.y) + bow
210
+ : (start.y + end.y) / 2
211
+ const control = { x: (start.x + end.x) / 2, y: controlY }
212
+ return {
213
+ d: `M ${start.x} ${start.y} Q ${control.x} ${control.y} ${end.x} ${end.y}`,
214
+ label: {
215
+ x: 0.25 * start.x + 0.5 * control.x + 0.25 * end.x,
216
+ y: 0.25 * start.y + 0.5 * control.y + 0.25 * end.y,
217
+ },
218
+ }
219
+ }
220
+ const start = { x: fx, y: dy >= 0 ? from.y + from.h : from.y }
221
+ const end = { x: tx, y: dy >= 0 ? to.y : to.y + to.h }
222
+ return {
223
+ d: `M ${start.x} ${start.y} L ${end.x} ${end.y}`,
224
+ label: { x: (start.x + end.x) / 2, y: (start.y + end.y) / 2 - 6 },
225
+ }
149
226
  }
150
227
 
151
228
  function svgSource(graph) {
@@ -166,17 +243,20 @@ function svgSource(graph) {
166
243
  ' </defs>',
167
244
  ` <rect width="${width}" height="${height}" fill="#ffffff"/>`,
168
245
  ]
246
+ const boxes = [...positions.values()]
169
247
  for (const edge of edges) {
170
248
  const from = positions.get(edge.from)
171
249
  const to = positions.get(edge.to)
172
250
  if (!from || !to) continue
173
- const x1 = from.x + from.w
174
- const y1 = from.y + from.h / 2
175
- const x2 = to.x
176
- const y2 = to.y + to.h / 2
177
- lines.push(` <line x1="${x1}" y1="${y1}" x2="${x2}" y2="${y2}" stroke="#7b8794" stroke-width="1.4" stroke-opacity="0.7" marker-end="url(#arrow)"/>`)
251
+ const route = edgeRoute(from, to, boxes)
252
+ lines.push(` <path d="${route.d}" fill="none" stroke="#7b8794" stroke-width="1.4" stroke-opacity="0.7" stroke-linecap="round" marker-end="url(#arrow)"/>`)
178
253
  if (edge.label) {
179
- lines.push(` <text x="${(x1 + x2) / 2}" y="${(y1 + y2) / 2 - 5}" text-anchor="middle" font-family="sans-serif" font-size="10" fill="#52606d">${xml(edge.label)}</text>`)
254
+ const label = String(edge.label)
255
+ const labelWidth = [...label].reduce((sum, char) => sum + (char.charCodeAt(0) > 255 ? 10 : 6), 0) + 8
256
+ const tight = route.gap !== undefined && labelWidth + 6 > route.gap
257
+ const labelY = tight ? route.above : route.label.y
258
+ lines.push(` <rect x="${(route.label.x - labelWidth / 2).toFixed(1)}" y="${(labelY - 9).toFixed(1)}" width="${labelWidth}" height="14" rx="3" fill="#ffffff" opacity="0.92"/>`)
259
+ lines.push(` <text x="${route.label.x.toFixed(1)}" y="${(labelY + 2).toFixed(1)}" text-anchor="middle" font-family="sans-serif" font-size="10" fill="#52606d">${xml(label)}</text>`)
180
260
  }
181
261
  }
182
262
  for (const node of nodes) {
package/src/host/graph.js CHANGED
@@ -20,8 +20,9 @@ const NODE_KINDS = new Set(['entry', 'module', 'service', 'store', 'external', '
20
20
  const EDGE_KINDS = new Set(['call', 'data', 'dependency', 'containment'])
21
21
  const STATUSES = new Set(['fresh', 'stale', 'proposed'])
22
22
 
23
- const NODE_FIELDS = new Set(['id', 'title', 'kind', 'group', 'summary', 'anchors', 'status', 'style', 'notes'])
24
- const NODE_PATCH_FIELDS = new Set(['title', 'kind', 'group', 'summary', 'anchors', 'status', 'style', 'notes'])
23
+ const NODE_FIELDS = new Set(['id', 'title', 'kind', 'group', 'summary', 'anchors', 'status', 'style', 'notes', 'position'])
24
+ const NODE_PATCH_FIELDS = new Set(['title', 'kind', 'group', 'summary', 'anchors', 'status', 'style', 'notes', 'position'])
25
+ const POSITION_FIELDS = new Set(['x', 'y'])
25
26
  const EDGE_FIELDS = new Set(['id', 'from', 'to', 'label', 'kind', 'status'])
26
27
  const EDGE_PATCH_FIELDS = new Set(['from', 'to', 'label', 'kind', 'status'])
27
28
  const GROUP_FIELDS = new Set(['id', 'title', 'kind'])
@@ -82,6 +83,21 @@ function assertKnownKeys(value, allowed, where) {
82
83
  }
83
84
  }
84
85
 
86
+ function assertPosition(position, where) {
87
+ if (!isPlainObject(position)) {
88
+ fail('INVALID_GRAPH', `${where} must be an object { x, y } with finite numbers`)
89
+ }
90
+ assertKnownKeys(position, POSITION_FIELDS, where)
91
+ for (const axis of ['x', 'y']) {
92
+ if (!Number.isFinite(position[axis])) {
93
+ fail('INVALID_GRAPH', `${where}.${axis} must be a finite number`)
94
+ }
95
+ if (Math.abs(position[axis]) > 1000000) {
96
+ fail('LIMIT_EXCEEDED', `${where}.${axis} must be within ±1000000`)
97
+ }
98
+ }
99
+ }
100
+
85
101
  function assertRelativeAnchor(anchor, where) {
86
102
  if (!isPlainObject(anchor)) fail('INVALID_GRAPH', `${where} must be an object { path, symbol?, hash? }`)
87
103
  if (typeof anchor.path !== 'string' || anchor.path.trim() === '') {
@@ -115,6 +131,7 @@ function normalizeNode(raw, where = 'node') {
115
131
  status: raw.status ?? 'fresh',
116
132
  ...(raw.style === undefined ? {} : { style: raw.style }),
117
133
  ...(raw.notes === undefined ? {} : { notes: raw.notes }),
134
+ ...(raw.position === undefined ? {} : { position: raw.position }),
118
135
  }
119
136
  }
120
137
 
@@ -225,6 +242,9 @@ export function validateGraph(graph, limits = DEFAULTS) {
225
242
  if (node.notes !== undefined && typeof node.notes !== 'string') {
226
243
  fail('INVALID_GRAPH', `node ${node.id}.notes must be a string when present`)
227
244
  }
245
+ if (node.position !== undefined) {
246
+ assertPosition(node.position, `node ${node.id}.position`)
247
+ }
228
248
  }
229
249
 
230
250
  for (const edge of graph.edges) {
@@ -291,6 +311,8 @@ export function applyOps(graph, ops, limits = DEFAULTS) {
291
311
  }
292
312
  assertKnownKeys(op.patch, NODE_PATCH_FIELDS, `${where}.patch`)
293
313
  Object.assign(node, op.patch)
314
+ // position:null clears a pin; other fields keep their normal merge.
315
+ if (op.patch.position === null) delete node.position
294
316
  break
295
317
  }
296
318
  case 'remove_node': {
@@ -443,6 +465,7 @@ function renderOverview(graph, limit, include) {
443
465
  const parts = [` ${node.id} "${node.title}"`, node.kind]
444
466
  if (node.group !== undefined) parts.push(`group ${node.group}`)
445
467
  parts.push(node.status)
468
+ if (node.position) parts.push(`pin ${node.position.x},${node.position.y}`)
446
469
  lines.push(parts.join(' · '))
447
470
  if (include.includes('summary') && node.summary) lines.push(` ${clip(node.summary, 160)}`)
448
471
  }
@@ -467,6 +490,7 @@ function renderNode(graph, node, options) {
467
490
  `rev ${graph.rev} · node ${node.id} "${node.title}"`,
468
491
  `kind: ${node.kind}${node.group ? ` · group: ${node.group}` : ''} · status: ${node.status}`,
469
492
  ]
493
+ if (node.position) lines.push(`pinned: ${node.position.x},${node.position.y}`)
470
494
  if (include.includes('summary') && node.summary) lines.push(`summary: ${clip(node.summary, 600)}`)
471
495
  if (include.includes('anchors') && node.anchors.length > 0) {
472
496
  lines.push('anchors:')
@@ -271,6 +271,17 @@ const REMOTE_TEXT_OUTPUT = {
271
271
  render: (_args, value) => [{ type: 'text', text: value.text }],
272
272
  }
273
273
 
274
+ /**
275
+ * Parse the panel-facing `/arch discuss` input. The client appends the selected
276
+ * workspace for remote sources; a local source omits it and the handler falls
277
+ * back to the session working directory.
278
+ */
279
+ export function parseArchDiscuss(input) {
280
+ const match = /^discuss\s+((?:node|edge):[a-z][a-z0-9_-]*)(?:\s+(fork|lite))?(?:\s+(\S+))?\s*$/.exec(String(input ?? '').trim())
281
+ if (!match) return null
282
+ return { target: match[1], mode: match[2], workspace: match[3] }
283
+ }
284
+
274
285
  /**
275
286
  * Register the M0/M1 tools and the `/arch` command.
276
287
  * @param {import('@deepseek-ai/cordis').Context} ctx - Host plugin context.
@@ -438,7 +449,7 @@ export function apply(ctx, config = {}) {
438
449
  ops: {
439
450
  type: 'array',
440
451
  items: { type: 'object', additionalProperties: true },
441
- description: 'Ordered operations. Shapes: {op:"add_node", node:{id,title,kind,summary?,anchors?:[{path,symbol?,hash?}]}}; {op:"update_node", id, patch:{...}}; {op:"remove_node", id, cascade?}; {op:"add_edge", edge:{id,from,to,label?,kind?}}; {op:"update_edge", id, patch:{...}}; {op:"remove_edge", id}; {op:"set_group", group:{id,title}}; {op:"remove_group", id}.',
452
+ description: 'Ordered operations. Shapes: {op:"add_node", node:{id,title,kind,summary?,anchors?:[{path,symbol?,hash?}],position?:{x,y}}}; {op:"update_node", id, patch:{...}} (patch.position={x,y} pins the top-left corner; patch.position=null clears it); {op:"remove_node", id, cascade?}; {op:"add_edge", edge:{id,from,to,label?,kind?}}; {op:"update_edge", id, patch:{...}}; {op:"remove_edge", id}; {op:"set_group", group:{id,title}}; {op:"remove_group", id}.',
442
453
  },
443
454
  apply: {
444
455
  type: 'boolean',
@@ -1093,18 +1104,18 @@ export function apply(ctx, config = {}) {
1093
1104
  if (extra === 'remote' || extra.startsWith('remote ')) {
1094
1105
  return await remoteCommands.handle(extra.slice('remote'.length).trim(), agent)
1095
1106
  }
1096
- const discuss = /^discuss\s+((?:node|edge):[a-z][a-z0-9_-]*)(?:\s+(fork|lite))?\s*$/.exec(extra)
1107
+ const discuss = parseArchDiscuss(extra)
1097
1108
  if (discuss) {
1098
1109
  try {
1099
- const workspace = agent.session.header.cwd
1110
+ const workspace = discuss.workspace ?? agent.session.header.cwd
1100
1111
  if (typeof workspace !== 'string' || workspace === '') {
1101
1112
  return { kind: 'error', text: 'the session has no working directory; pass an explicit workspace to arch_discuss' }
1102
1113
  }
1103
1114
  const started = await startDiscussion({
1104
1115
  agent,
1105
1116
  workspace,
1106
- target: discuss[1],
1107
- mode: discuss[2],
1117
+ target: discuss.target,
1118
+ mode: discuss.mode,
1108
1119
  signal,
1109
1120
  context: { agent },
1110
1121
  })
@@ -1118,7 +1129,7 @@ export function apply(ctx, config = {}) {
1118
1129
  }
1119
1130
  return {
1120
1131
  kind: 'error',
1121
- text: '用法:/arch 或 /arch open(打开面板);/arch discuss node:<id> [fork|lite](开节点讨论);/arch remote add|list|select|sync|update|grant|revoke|remove ...(远程仓库)。要调用图工具,请直接发送“调用 arch_graph_get”。',
1132
+ text: '用法:/arch 或 /arch open(打开面板);/arch discuss node:<id> [fork|lite] [workspace](开节点讨论);/arch remote add|list|select|sync|update|grant <id> [session|always]|revoke|remove ...(远程仓库)。要调用图工具,请直接发送“调用 arch_graph_get”。',
1122
1133
  }
1123
1134
  },
1124
1135
  })
@@ -168,12 +168,21 @@ export function createRemoteCommands(options = {}) {
168
168
  }
169
169
 
170
170
  async function grant(args, agent) {
171
- const [id] = args
172
- if (!id) return commandError('用法:/arch remote grant <id>')
171
+ const [id, rawScope] = args
172
+ if (!id) return commandError('用法:/arch remote grant <id> [session|always]')
173
+ const scope = (rawScope ?? 'always').toLowerCase()
174
+ if (scope !== 'session' && scope !== 'always') {
175
+ return commandError(`未知授权范围 "${rawScope}";用法:/arch remote grant <id> [session|always]`)
176
+ }
173
177
  const ws = await remoteWorkspace(id, agent)
178
+ if (scope === 'session') {
179
+ consent.allowSession(ws, { agent })
180
+ indexer.track(ws, { agent }, { immediate: false })
181
+ return { kind: 'success', text: `${id}: 已写入本次会话内容授权(会话结束失效;不启用自动维护)。` }
182
+ }
174
183
  await consent.grantWorkspace(ws)
175
184
  indexer.track(ws, { agent }, { immediate: false })
176
- return { kind: 'success', text: `${id}: 已写入 workspace 级内容授权。` }
185
+ return { kind: 'success', text: `${id}: 已写入 workspace 级内容授权(持久;后续会话和自动维护可用)。` }
177
186
  }
178
187
 
179
188
  async function revoke(args, agent) {
@@ -214,7 +223,7 @@ export function createRemoteCommands(options = {}) {
214
223
  case 'remove': return await remove(args, agent)
215
224
  case undefined:
216
225
  case '':
217
- return commandError('用法:/arch remote add|list|select|sync|update|grant|revoke|remove ...')
226
+ return commandError('用法:/arch remote add|list|select|sync|update|grant <id> [session|always]|revoke|remove ...')
218
227
  default:
219
228
  return commandError(`未知子命令 "${sub}"`)
220
229
  }