Skip to content

v0.9.4

Latest

Choose a tag to compare

@ArisuYuuko ArisuYuuko released this 19 Oct 16:10

一句话

两个新入口都开在 DSH 界面里:侧边栏底部的「插件体检」浮层面板,和会话头部的「审批历史」浮层面板;完整历史按需跳默认浏览器。

v0.8.0:插件体检面板

侧边栏底部(设置上方)新增 🩺「插件体检」按钮,点开是浮层报告,内容直接读宿主的 /dsh-approval/diag?raw=1:

  • 结论胶囊:全部正常 / N 项需要注意 / N 项问题,一眼可见
  • 检查项:每条带状态、说明与「该做什么」
  • 计数器:approvalSeen / generated / failed / timeouts 等,判断插件是否真的执行过
  • 浏览器半区:是否进了启动图、当前 rev、页面侧上报过的错误与阶段路标
  • 崩溃与自愈:崩溃报告份数与最新文件名、cordis.patch.yml.bak-* 遗迹
  • profile 配置:补丁块数量、模型选择是否在位、已启用 bundle
  • 相关页面 / 日志 / 原始 JSON:可点、可折叠、可复制

打开时每 10 秒自动刷新;↻ 重查;↗ 在应用内打开完整页;Esc 或点外面关闭。判定只在宿主算一次,面板只负责展示;读不到宿主时给出原因与重试,不白屏。

v0.9.0–v0.9.4:审批历史面板

会话头部——也就是「对话 / 轨迹」那一带——新增「审批历史」按钮。点开是在对话上方浮出的面板(和体检面板同一套交互):

  • 头部:记录条数、重新读取、关闭
  • 筛选:关键字(工具 / 路径 / 理由 / 注释正文)、决策(允许一次 / 已拒绝 / 已取消 / 待定)、风险(低 / 中 / 高)——本地即时过滤
  • 列表:每条一行摘要(时间 · 工具 · 风险徽章 · 决策徽章 · 会话),展开看注释全文、风险点、实参摘要
  • 完整页面:跳默认浏览器(清空历史等高级操作在那里)

这个入口的形态改了三轮,如实说明:

版本 形态 结果
0.9.0 相对路径开新窗口 点不动:桌面壳页面跑在 dsh-app://app/,相对路径被解析成 dsh-app://app/...,主进程只放行 http(s),其余静默 deny
0.9.1 拼宿主绝对 URL 再开新窗口 能开,但弹到系统浏览器
0.9.2 应用内内置浏览器标签 / 同窗口兜底 还在 DSH 内,但不是浮层
0.9.3 对话上方浮层面板 日常查看在面板里完成
0.9.4 浮层面板 + 完整页面外跳 「完整页面」按需求跳默认浏览器

经验:桌面壳里相对路径开新窗口一定失败(且没有返回值可判断);面板数据走相对 fetch(由桌面壳代理到宿主)则完全没问题。

升级方式

本项目从 git 源安装,升级 = 先移除再安装:

dsh plugin --profile desktop remove dsh-approval-explainer
dsh plugin --profile desktop add github:ArisuYuuko/dsh-approval-explainer
dsh --profile desktop --dump-config      # 确认多了一个配置层

生效规则:浏览器半区(lib/client.js)刷新页面即可;宿主半区(lib/index.js)必须重启 DSH,/dsh-approval/diag 里的版本号也要重启后才会变。

兼容性

  • engines.dsh:>=0.2.0-rc.1 <0.3.0-0
  • 桌面壳(dsh-app://app/)与浏览器(dsh web)两种模式都支持
  • 与同座位插件共存:审批详情是 single 座位(本插件用 priority: -1 遮蔽官方渲染器);会话头部动作行与侧边栏底部是 list 座位(各用各的 id,不顶掉别人)
  • 所有数据只落本机 profile

验证

  • 31 个套件 / 887 项断言 / 0 失败(含真渲染面板、座位契约、畸形输入、静态防外跳断言)
  • safe-edit 六项门禁全过;prepublish-final 58 项;npm pack 出的 tarball 通过 verify-tarball
  • 版本四处一致:package.json / PLUGIN_VERSION / 发布副本 package.json / 发布副本 lib/*.js

已知限制

  • 本插件不拥有授权决定:只旁听 approval/request,不改变谁能被授权
  • 面板文案是中文;注释语言跟随素材语言
  • 历史面板一次最多显示 200 条;更多、清空等操作走「完整页面」
  • 面板显示的是运行中宿主半区的版本,升版后需重启 DSH 才会变
  • 体检面板里的跳转仍在应用内(内置浏览器标签);只有历史面板的「完整页面」按需求走默认浏览器

English summary

Two in-app entry points, no routing needed.

  • v0.8.0 — Plugin health check: a 🩺 button at the sidebar foot opens a floating report built from /dsh-approval/diag?raw=1 (verdict, checks, counters, browser-half status, crash/self-heal evidence, profile state, related pages, raw JSON). Auto-refreshes every 10 s while open.
  • v0.9.0–0.9.4 — Approval history: a button in the session header opens a floating panel above the conversation (record count, local keyword/decision/risk filters, one expandable row per approval). Its “full page” button opens the host page in the default browser for advanced actions such as clearing the history.

The history entry took four revisions because the desktop shell serves the UI under dsh-app://app/ and its main process only hands http(s) targets to the system browser: relative new-window URLs are denied silently. The final shape is a native floating panel (data fetched relatively through the shell’s proxy) plus a default-browser jump for the full page.

Upgrade: dsh plugin --profile desktop remove dsh-approval-explainer then ... add github:ArisuYuuko/dsh-approval-explainer; reload the page for the browser half, restart DSH for the host half.

Verified: 31 suites / 887 assertions, safe-edit gate, prepublish checks, packed tarball.