diff --git a/vendor/dsh-brain/lib/page.js b/vendor/dsh-brain/lib/page.js new file mode 100644 index 0000000..005fb0c --- /dev/null +++ b/vendor/dsh-brain/lib/page.js @@ -0,0 +1,429 @@ +/** + * Standalone configuration page. + * + * This profile runs with the native settings surface disabled + * (`ui-settings` is turned off in `cordis.patch.yml`), so the plugin ships its + * own HTML page at `/dsh-brain`. It is deliberately dependency-free: no + * bundler assets, no CDN, no fonts — one file the host web server can emit. + * + * The page renders tokens as masked values only; the plaintext never leaves + * `$DSH_HOME/dsh-brain.json`. + */ +/** Escape a value for safe interpolation into HTML text/attributes. */ +export function escapeHtml(value) { + return value + .replaceAll('&', '&') + .replaceAll('<', '<') + .replaceAll('>', '>') + .replaceAll('"', '"') + .replaceAll("'", '''); +} +/** Render the configuration page. */ +export function renderConfigPage(options) { + // The client script is plain ES2020 and avoids template literals so this + // outer template stays readable. + return ` + + + + +云端记忆 · DSH 插件 + + + +
+

云端记忆 · DSH 插件

+

v${escapeHtml(options.version)} · 每轮结束上报活动计数 · 提供 memory_search / memory_read / memory_add 工具

+

技能管理(列表 · 启停 · 安装)→

+ +
+

当前状态

+
+
加载中…
+
+ +
+

连接配置

+
+
+ + +
不带结尾斜杠,路径为 /api/longmemory。
+
+
+ + +
上报时附带,便于区分来源设备。
+
+
+ + +
+
+ + +
+
+
+ +
+
+ +
+
+ + +
+
+ +
+

账号登录

+
+
+ + +
+
+ + +
+
+
+ +
+
+ 用云端面板的普通用户账号登录,插件会用一次性会话换取 activity:write 与 memory:write 两个令牌并写入本机。 + 密码只在这一次请求里使用:不保存、不写日志、不回显,换取成功后立即从内存丢弃。 + 管理员账号不能创建个人令牌,请用普通用户账号。 +
+
+ +
+

访问令牌

+
+
+ + +
用于 POST /activity/turn。
+
+
+ + +
memory:write 同时允许读取,一个令牌即可覆盖检索与写入;只有 memory:read 时写入会被拒。
+
+
+ + +
用于 POST /activity/summary:只把已脱敏摘要送进待确认队列。
+
+
+
+ + +
+
+ 在面板「设置 → API 密钥」里各建一个 activity:write 与 memory:write 密钥(一个密钥只有一种权限,所以需要两个)。
+ 令牌只写入本机 ${escapeHtml(options.settingsPath)}(进程退出不丢),不会进入会话上下文、不会上传到云端、也不会出现在本页回显里。 +
+
+ +
+

诊断

+
+ + + +
+
+
+ +
+

最近上报

+ + + + + +
时间状态结果HTTPturn_id
暂无记录
+
+
+
+ + +`; +}