dsh-architecture-map 0.2.0 → 0.2.1

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,19 @@
1
+ ## 0.2.1 — 2026-11-23
2
+
3
+ ### Added
4
+
5
+ - 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.
6
+
7
+ ### Fixed
8
+
9
+ - 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.
10
+ - `Reset layout` clears the local overrides instead of materializing the current layout into the position map.
11
+ - 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>`.
12
+
13
+ ### Docs
14
+
15
+ - State that a cyclic graph falls back to a compact grid and that the layered layout is for acyclic graphs.
16
+
1
17
  ## 0.2.0 — 2026-11-22
2
18
 
3
19
  ### 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.2.1 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.
8
8
 
9
9
  ---
10
10
 
@@ -47,11 +47,11 @@ A static feature preview is included. A recorded 30-second demo GIF is not part
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
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.
50
+ - **Local layout memory** — only dragged node positions are kept, per workspace in browser storage; every other node keeps following the automatic layout, so a graph edit reflows it. `Reset layout` clears the local overrides. Shared positions are planned.
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
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.
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
@@ -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.
@@ -197,9 +214,9 @@ There is no separate "start" button or left-sidebar icon. The plugin adds a righ
197
214
  - Node positions are stored in the browser locally, not 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 falls back to a compact grid; the layered (longest-path) layout is used for acyclic graphs.
201
218
  - 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.
219
+ - This is a 0.2.1 developer preview; the API and file schema can still change.
203
220
  - 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
221
 
205
222
  ## FAQ
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.2.1 开发者预览**。Host 工具、右侧栏画布、架构记忆、按节点子对话、确定性导出、内置 Mermaid 渲染和通过 SSH 只读查看远程 Linux 仓库都已可用;共享位置仍待实现,空闲父会话自动维护和 pending 清零是已知粗糙边缘。
8
8
 
9
9
  ---
10
10
 
@@ -47,11 +47,11 @@ Architecture map 把「项目架构」变成 harness 里**可寻址的一等对
47
47
 
48
48
  - **Canonical 架构图**:`.archmap/graph.json`,带 rev、schema 校验、原子写入和单步备份。模型通过 `arch_graph_get` / `arch_graph_patch` 读写;`apply:false` 只预览不写入。
49
49
  - **右侧栏画布**:从当前会话 workspace 读取图,SVG 渲染节点/边,使用 longest-path 分层布局,支持平移、滚轮缩放、`Fit`、节点拖拽、`Reset layout`,点击节点看详情。
50
- - **位置本地记忆**:拖动的节点位置按 workspace 存在浏览器本地,刷新或同机新会话会保留;`Reset layout` 清掉。共享位置是后续计划。
50
+ - **位置本地记忆**:只保留拖动过的节点位置,按 workspace 存在浏览器本地;其余节点继续跟随自动布局,图变化后会重新分层。`Reset layout` 清掉本地覆盖。共享位置是后续计划。
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
52
  - **确定性导出**:`arch_export` 把 Mermaid flowchart、独立 SVG 或 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
  ## 下一步计划
@@ -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 元数据,只有已分析文件才会被哈希。
@@ -162,9 +179,9 @@ npm pack --dry-run
162
179
  - 节点位置只存在浏览器本地,不在 `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。带环的图会退化为紧凑网格;分层布局用于无环图。
166
183
  - Mermaid 默认 `auto` 开启;`renderMermaid: off` 可关;检测到已知的 `dsh-mermaid-plus` 时 `auto` 会关闭本插件渲染。
167
- - 这是 0.2.0 开发者预览,API 和文件 schema 仍可能变化。
184
+ - 这是 0.2.1 开发者预览,API 和文件 schema 仍可能变化。
168
185
  - 远程仓库是开发者预览:登记、读取、同步、轮询、命令和维护都已接上,并在真实 Linux 主机上验收;空闲父会话的自动维护和 pending 清零仍是粗糙边缘。
169
186
 
170
187
  ## 安装
package/client.js CHANGED
@@ -244,6 +244,21 @@ window.__ModuleLoader__.load({
244
244
  return value.length <= max ? value : `${value.slice(0, max - 1)}…`
245
245
  }
246
246
 
247
+ /**
248
+ * A local drag only replaces the x/y of the automatic layout box; width,
249
+ * height and every undragged node still come from the layout.
250
+ */
251
+ function overlayPosition(base, override) {
252
+ if (!base) return undefined
253
+ if (!override || !Number.isFinite(override.x) || !Number.isFinite(override.y)) return base
254
+ return { ...base, x: override.x, y: override.y }
255
+ }
256
+
257
+ /** The panel's Discuss/Lite path must carry the selected source, not the session cwd. */
258
+ function discussionCommand(id, mode, workspace) {
259
+ return `/arch discuss node:${id} ${mode}${workspace ? ` ${workspace}` : ''}`
260
+ }
261
+
247
262
  let mermaidRuntime
248
263
  let mermaidUid = 0
249
264
 
@@ -737,7 +752,8 @@ window.__ModuleLoader__.load({
737
752
  ? edges.filter(edge => edge.from === selected.id || edge.to === selected.id)
738
753
  : []
739
754
  const layoutView = layout(graph)
740
- const positionOf = id => positions[id] ?? layoutView.positions.get(id)
755
+ // positions only holds local drag overrides; the automatic layout stays the base.
756
+ const positionOf = id => overlayPosition(layoutView.positions.get(id), positions[id])
741
757
 
742
758
  const fitBoxes = boxes => {
743
759
  if (boxes.length === 0) return
@@ -755,30 +771,26 @@ window.__ModuleLoader__.load({
755
771
  }
756
772
 
757
773
  const fitGraph = target => {
758
- const current = Object.values(positions)
759
- fitBoxes(current.length > 0 ? current : [...layout(target).positions.values()])
774
+ const boxes = (Array.isArray(target?.nodes) ? target.nodes : [])
775
+ .map(node => positionOf(node.id))
776
+ .filter(Boolean)
777
+ fitBoxes(boxes.length > 0 ? boxes : [...layout(target).positions.values()])
760
778
  }
761
779
 
762
780
  const resetLayout = () => {
763
781
  if (!graph) return
764
- const base = layout(graph)
765
- setPositions(Object.fromEntries(base.positions))
782
+ setPositions({})
766
783
  clearSavedPositions(storageKey)
767
- fitBoxes([...base.positions.values()])
784
+ fitBoxes([...layout(graph).positions.values()])
768
785
  }
769
786
 
770
787
  React.useEffect(() => {
771
788
  if (!graph || !storageKey) return
772
- const base = layout(graph)
789
+ const ids = new Set(graph.nodes.map(node => node.id))
773
790
  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
- })
791
+ setPositions(Object.fromEntries(
792
+ Object.entries(saved).filter(([id]) => ids.has(id)),
793
+ ))
782
794
  }, [graph?.rev, storageKey])
783
795
 
784
796
  React.useEffect(() => {
@@ -806,13 +818,10 @@ window.__ModuleLoader__.load({
806
818
  const dx = (moveEvent.clientX - startX) / view.zoom
807
819
  const dy = (moveEvent.clientY - startY) / view.zoom
808
820
  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
- })
821
+ setPositions(previous => ({
822
+ ...previous,
823
+ [id]: last,
824
+ }))
816
825
  }
817
826
  const up = () => {
818
827
  window.removeEventListener('pointermove', move)
@@ -1045,7 +1054,8 @@ window.__ModuleLoader__.load({
1045
1054
  }
1046
1055
  setDiscussState({ status: 'starting', error: null })
1047
1056
  try {
1048
- const line = `/arch discuss node:${selected.id} ${mode}`
1057
+ const workspace = source?.kind === 'remote' ? `remote:${source.id}` : undefined
1058
+ const line = discussionCommand(selected.id, mode, workspace)
1049
1059
  const response = await ctx.remote.commands.execute(sessionId, line, [])
1050
1060
  if (!response.ok) throw new Error(`${response.error.code}: ${response.error.message}`)
1051
1061
  const outcome = response.value?.result
package/docs/DETAIL.md CHANGED
@@ -9,7 +9,7 @@ A live, addressable architecture graph for DeepSeek Harness. The model writes no
9
9
  - **Canonical graph** — `.archmap/graph.json` with a revision, schema validation, atomic writes and a one-step backup.
10
10
  - **Right-sidebar canvas** — layered SVG layout, 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>`.
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
13
  - **Exports** — deterministic Mermaid, SVG 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.
@@ -52,13 +52,13 @@ The model can also use the bundled `architecture-map` skill in a new session.
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
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.
61
+ - Dragged node positions are local to the browser; shared positions are not implemented yet. A cyclic graph falls back to a compact grid; the layered layout is for acyclic graphs.
62
62
  - The sidebar follows the **session workspace**; it does not show a graph from an explicit `workspace` argument when the two differ.
63
63
  - Fork discussions inherit the parent request prefix, so their tool list can still show schemas that are denied at execution.
64
64
  - 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 +73,4 @@ The model can also use the bundled `architecture-map` skill in a new session.
73
73
 
74
74
  ## Status
75
75
 
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`.
76
+ 0.2.1 developer preview. `npm test` covers graph, layout override, memory, stale-hash, export, remote content/SSH, consent, sync, polling, commands and maintenance policy (68 tests); CI runs syntax checks, tests and `npm pack --dry-run`.
package/docs/DETAIL.zh.md CHANGED
@@ -9,7 +9,7 @@
9
9
  - **Canonical 图**:`.archmap/graph.json`,带 rev、schema 校验、原子写入和单步备份。
10
10
  - **右侧栏画布**:分层 SVG 布局、平移/缩放/Fit、节点拖拽、Reset layout、节点详情。
11
11
  - **架构记忆**:manifest、增量 `arch_sync`、代码/格式改动识别、stale 标记和 Markdown dossier(`overview`、`modules/<id>`、`notes/<id>`)。
12
- - **按节点讨论**:`arch_discuss` 开 fork(继承已完成轮次)或 lite(只靠图和档案);侧栏打开子会话;结论写到 `notes/<id>`。
12
+ - **按节点讨论**:`arch_discuss` 开 fork(继承已完成轮次)或 lite(只靠图和档案);侧栏打开子会话;结论写到 `notes/<id>`。面板的 Discuss/Lite 会把当前选中的本地/远程来源传给 Host;远程讨论需要远程内容授权。
13
13
  - **导出**:确定性的 Mermaid、SVG、Markdown,落在 `.archmap/export/`。
14
14
  - **内置 Mermaid**:assistant 消息里的 ` ```mermaid ` 用本插件自带的 runtime 渲染,不访问 CDN,不依赖额外 Mermaid 插件。
15
15
  - **随包 skill**:`architecture-map` 指导 sync → 读变更 → 改图 → 档案 → commit 的循环。
@@ -52,13 +52,13 @@
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
60
  - 画布是手写 SVG,不是 React Flow。
61
- - 节点位置只存在浏览器本地;共享位置还没做。
61
+ - 拖动的节点位置只存在浏览器本地;共享位置还没做。带环的图会退化为紧凑网格;分层布局用于无环图。
62
62
  - 右侧栏跟随**会话 workspace**;工具参数里的显式 `workspace` 不同时,面板不会显示那张图。
63
63
  - fork 讨论会继承父对话 request prefix,工具列表里可能仍显示执行层已拒绝的 schema。
64
64
  - 父 agent 用 `send_message` 继续子会话时,DSH 会在主对话里投递 settlement notice(含子会话 closing text);初次 `arch_discuss` 是 caller-only,子会话 transcript 不会复制进主日志。
@@ -73,4 +73,4 @@
73
73
 
74
74
  ## 状态
75
75
 
76
- 0.2.0 开发者预览。`npm test` 覆盖图、记忆、stale-hash、导出、远程内容/SSH、授权、同步、轮询、命令和维护策略(65 个测试);CI 跑语法检查、测试和 `npm pack --dry-run`。
76
+ 0.2.1 开发者预览。`npm test` 覆盖图、布局覆盖层、记忆、stale-hash、导出、远程内容/SSH、授权、同步、轮询、命令和维护策略(68 个测试);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.2.1",
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",
@@ -91,4 +91,4 @@ Exports never modify `graph.json` or the manifest.
91
91
  - Paths are realpath-checked and must stay inside the workspace.
92
92
  - Writes are atomic (temp file + rename); a failed write must be reported, never silently retried.
93
93
  - 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`.
94
+ - Node positions are a **local view preference** (browser localStorage), not part of `graph.json`. Only dragged nodes are stored as overrides; the automatic layout stays the base, so a graph revision reflows undragged nodes. A cyclic graph falls back to a compact grid; the layered layout is for acyclic graphs.
@@ -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.
@@ -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
  }