dsh-aiyayi 1.17.0 → 1.19.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
@@ -5,6 +5,18 @@
5
5
  > (`dev-ledger/`,不进公开仓、不随 npm 包发布)。
6
6
  > 版本事实以 npm registry 为准。文中「坑 #N」指下方「已知坑」清单的编号。
7
7
 
8
+ ## 1.19.0(2026-11-26)
9
+ - **Web 客户端:朗读引擎可切换,晓晓上线**:右键朗读开关(🔊/🔇)弹出引擎菜单,可在「✦ 晓晓(微软在线神经音色 zh-CN-XiaoxiaoNeural)」与「系统语音」之间一键互切;当前是晓晓时按钮带 ✦ 徽标。选晓晓需要本机跑着 edge-tts 合成服务(`python -m edge_tts` 生态,监听 `127.0.0.1:52123`,见仓库 tools 说明),没跑时朗读会红闪 ⚠ 提示并自动重试一次,之后静默回退无声——想回系统语音就右键切回去。
10
+ - **Web 客户端:晓晓模式不挑浏览器**:晓晓模式不走浏览器 `speechSynthesis`(文本发本地服务合成 mp3 回来播),所以没有语音合成能力的内嵌 WebView 也能出声;引擎菜单在哑窗口同样可右键呼出。
11
+ - **兼容性**:不装 edge-tts 服务时一切照旧——引擎开关默认「系统语音」,原自动朗读行为(1.17.0 引入)不变。
12
+ - 这版没有破坏性变更,你不需要做任何操作;升级后重启 DSH 生效(patchReload 不拾取 bundle 内变化,见坑 #37)。
13
+
14
+ ## 1.18.0(2026-11-26)
15
+ - **新增:GET /api/aiyayi/auth-url 端点**:登录态保护(挂在 `/api` 认证栅栏后,未登录 401),返回带认证的完整 web URL;响应 `no-store`;基底 URL 优先 `--public-url` 指定的对外地址。
16
+ - **Web 客户端:哑窗口点击 🔊 现在能自救**:无 `speechSynthesis` 的内嵌 WebView 里,点击置灰的 🔊 按钮会自动复制带认证的完整 URL 到剪贴板(剪贴板不可用时降级为弹窗展示 URL 手动复制),粘到 Chrome / Edge / Firefox 打开即可自动朗读;文案含安全提示「此 URL 是长期有效的引擎钥匙,自用可以,别发给别人」。
17
+ - persona 无新增(本版纯功能版)。
18
+ - 这版没有破坏性变更,你不需要做任何操作;升级后重启 DSH 生效(patchReload 不拾取 bundle 内变化,见坑 #37)。
19
+
8
20
  ## 1.17.0(2026-11-26)
9
21
  - **Web 客户端 V1:新消息自动朗读(TTS)**:在 dsh web 页面右侧新增 🔊/🔇 浮动开关,开启后助手每条最终回复自动整条朗读(不逐字流式、不念工具过程),朗读前自动清洗 markdown(代码块/图片/链接/表格记号),优先挑选中文语音,新消息到来先掐掉上一条避免叠音。开关状态记在浏览器本地。需要浏览器支持语音合成(speechSynthesis)——Chrome / Edge / Firefox 桌面版均可。
10
22
  - **哑窗口降级**:页面不支持语音合成时,开关按钮仍渲染但置灰呈禁用态,点击弹提示说明原因与正路,不会"点了没声还以为坏了"。
package/README.md CHANGED
@@ -131,7 +131,7 @@ npm 包为平铺结构(仓库若保留 bundle/ 子目录,发布时把其内
131
131
 
132
132
  配置脚本(create-bot.js)、卡片渲染与历史修复等细节见 **[飞书接入与排障](./docs/飞书接入与排障.md)**。
133
133
 
134
- - **自动朗读(TTS)需要带语音合成的浏览器**:dsh web 页面的 🔊 自动朗读开关依赖 `speechSynthesis`;内嵌 WebView(如 DSH-Go App 窗口)普遍没有它,自动朗读在里面天然无声——这不是 bug,请用 **Chrome / Edge / Firefox** 打开 dsh web 启动时打印的**带 token 的 URL**。不支持时开关按钮会置灰并弹提示。
134
+ - **自动朗读(TTS)需要带语音合成的浏览器**:dsh web 页面的 🔊 自动朗读开关依赖 `speechSynthesis`;内嵌 WebView(如 DSH-Go App 窗口)普遍没有它,自动朗读在里面天然无声——这不是 bug,请用 **Chrome / Edge / Firefox** 打开 dsh web 启动时打印的**带 token 的 URL**(1.18.0 起,在哑窗口里点 🔊 按钮可直接复制该 URL 到剪贴板)。不支持时开关按钮会置灰并弹提示。**1.19.0 起有第二条路**:右键朗读开关切「✦ 晓晓」引擎,文本发本机 edge-tts 服务(`127.0.0.1:52123`)合成 mp3 播放,不走 `speechSynthesis`,内嵌 WebView 也能出声;服务没跑时按钮红闪 ⚠ 提示。
135
135
 
136
136
  ## 更新日志
137
137
 
@@ -0,0 +1,57 @@
1
+ // 阿依娅伊:认证 URL 端点(1.17.0 本地测试态,随引擎重启生效)。
2
+ // GET /api/aiyayi/auth-url —— 返回 { url: "<带启动 token 的完整 Web URL>" }。
3
+ // 用途:哑窗口(无 speechSynthesis 的内嵌 WebView)里点 🔊 按钮时,把
4
+ // dsh web 启动时打印的那种带 token 的 URL 递到剪贴板,用正路浏览器打开朗读。
5
+ //
6
+ // 鉴权与实现参照宿主自带范式(读源码核对过,不发明新机制):
7
+ // - 路由挂在 Connection 的 exact fetch 注册表(connection.fetch.register)。
8
+ // 该注册表的 HTTP 面是 client-connection 在 /api 前缀上挂的统一路由
9
+ // (dsh-client-connection lib/index.js apply() L1044-1058):每个 /api 请求
10
+ // 都先过 admit() —— Host/Origin 栅栏 + 浏览器 cookie / API 凭据认证,
11
+ // 未登录请求根本到不了本 handler,所以路径必须以 /api/ 开头。
12
+ // - URL 生成用 connection.authenticatedUrl()(dsh-web-app printUrl 同款
13
+ // 调用链,dsh-web-app/lib/index.js L156-162),基底 URL 优先取 webApp
14
+ // 服务的 getAdvertisedUrl()(--public-url 意识),取不到退回 getOrigin()。
15
+ //
16
+ // 安全口径:只答 GET;无副作用;响应 no-store;路径与响应头不带任何 secret
17
+ // (启动 token 只进响应体 url,不进日志、不进路径);失败 5xx 且不泄内部细节。
18
+
19
+ /** exact fetch 路由路径(必须在 /api 前缀下才在认证栅栏后面)。 */
20
+ export const AUTH_URL_PATH = '/api/aiyayi/auth-url'
21
+
22
+ /**
23
+ * 注册认证 URL 路由。须在能解析到宿主 connection / webServer 服务的上下文里
24
+ * 调用(本插件 apply(ctx) 在 preset 作用域,ctx.inject 从宿主根解析这两个
25
+ * 服务;没有 web 面的 profile 里 inject 永不落地,静默零开销)。
26
+ * @param ctx - 插件上下文。
27
+ */
28
+ export function registerAuthUrlRoute(ctx) {
29
+ ctx.inject(['connection', 'webServer'], (scope) => {
30
+ // 基底 URL 请求时才解析:启动早期 listener 可能还没绑端口(getOrigin 会
31
+ // throw "origin read before the listener bound a port"),lazy 口径同
32
+ // dsh-web-app 的 appRootUrl 闭包。
33
+ const resolveOrigin = () => {
34
+ const advertised = scope.get('webApp')?.getAdvertisedUrl?.()
35
+ return advertised ?? scope.webServer.getOrigin()
36
+ }
37
+ return scope.connection.fetch.register({
38
+ path: AUTH_URL_PATH,
39
+ methods: ['GET'],
40
+ requestBody: 'buffered',
41
+ fetch: () => {
42
+ try {
43
+ const url = scope.connection.authenticatedUrl(resolveOrigin())
44
+ return Response.json({ url }, { headers: { 'cache-control': 'no-store' } })
45
+ } catch {
46
+ // 不把内部错误细节(token 机制、绑定地址等)带给页面
47
+ return Response.json(
48
+ { error: 'aiyayi: failed to build the authenticated URL' },
49
+ { status: 500, headers: { 'cache-control': 'no-store' } },
50
+ )
51
+ }
52
+ },
53
+ })
54
+ // 返回值是 inject 的 fiber;fetch.register 自己返回的 disposer 挂在
55
+ // inject 子作用域上,插件卸载时自动反注册 exact 路由,不占坑。
56
+ })
57
+ }
package/lib/client.js CHANGED
@@ -10,9 +10,15 @@
10
10
  // - 朗读前清洗 markdown(代码块/图片/链接/表格分隔符等),优先挑中文 voice。
11
11
  // - 新消息到来先 cancel 上一条,避免叠音;rate 1.1 稍快。
12
12
  // - 哑窗口降级(1.17.0):页面没有 window.speechSynthesis(或其 speak 不可用)
13
- // 时,开关按钮仍然渲染但置灰、样式呈禁用态,点击弹提示说明正路(用
14
- // Chrome / Edge / Firefox 打开 dsh web 启动时打印的带 token 的 URL);
13
+ // 时,开关按钮仍然渲染但置灰、样式呈禁用态;点击改为向引擎要一个带认证的
14
+ // 完整 URL(GET /api/aiyayi/auth-url,登录态栅栏后的 exact fetch 路由),
15
+ // 复制到剪贴板并用弹窗提示正路(用 Chrome / Edge / Firefox 打开即可自动
16
+ // 朗读);剪贴板不可用时降级为 prompt 手动复制,接口失败弹失败说明。
15
17
  // 朗读全链路不启动。支持时行为完全不变。
18
+ // - edge-tts 桥(1.19.0):localStorage["dsh-aiyayi-tts.engine"] === "edge" 时,
19
+ // 朗读文本转投本地合成服务(http://127.0.0.1:52123/tts,微软在线神经音色
20
+ // zh-CN-XiaoxiaoNeural 晓晓),mp3 用 <audio> 播放,不依赖 speechSynthesis;
21
+ // 服务不在/失败时静默回退无声,不炸页面。未设或其余值 = 原 Web Speech 逻辑。
16
22
 
17
23
  window.__ModuleLoader__?.load({
18
24
  id: "dsh-aiyayi",
@@ -23,6 +29,12 @@ window.__ModuleLoader__?.load({
23
29
  const NS = "aiyayi-tts";
24
30
  const STORE_KEY = "dsh-aiyayi-tts.enabled";
25
31
  const MAX_SPEAK_CHARS = 2000;
32
+ // 1.19.0 edge-tts 桥:engine 开关切朗读后端。'edge' 走本地合成服务
33
+ // (G:\阿依娅伊\tools\edge_tts_server.py,127.0.0.1:52123,微软晓晓
34
+ // zh-CN-XiaoxiaoNeural);其余/未设 = 'default',原 speechSynthesis 兜底。
35
+ const ENGINE_KEY = "dsh-aiyayi-tts.engine";
36
+ const EDGE_TTS_ENDPOINT = "http://127.0.0.1:52123/tts";
37
+ const EDGE_TTS_RATE = "+10%"; // 原 rate 1.1 的 edge-tts 口径近似
26
38
 
27
39
  //#region 开关状态
28
40
  function readEnabled() {
@@ -38,6 +50,15 @@ window.__ModuleLoader__?.load({
38
50
  } catch {}
39
51
  }
40
52
  let enabled = readEnabled();
53
+
54
+ /** 当前朗读引擎:localStorage[ENGINE_KEY] === 'edge' 时走 edge-tts 桥,否则 default。 */
55
+ function readEngine() {
56
+ try {
57
+ return localStorage.getItem(ENGINE_KEY) === "edge" ? "edge" : "default";
58
+ } catch {
59
+ return "default";
60
+ }
61
+ }
41
62
  //#endregion
42
63
 
43
64
  //#region 文本清洗:把 markdown/URL 清成适合念出来的话
@@ -69,7 +90,9 @@ window.__ModuleLoader__?.load({
69
90
  //#region 语音
70
91
  // 能力检测(1.17.0):内嵌 WebView(如 DSH-Go App 窗口)常无 speechSynthesis,
71
92
  // 直接打开会"点了开关也没声"。检测口径:对象不存在,或 speak 不是函数,都算不支持。
72
- const ttsSupported = typeof window !== "undefined" && typeof window.speechSynthesis !== "undefined" && typeof window.speechSynthesis?.speak === "function";
93
+ // 1.19.0:engine=edge 时走本地 edge-tts 服务,不依赖 speechSynthesis,也算支持。
94
+ const hasWebSpeech = typeof window !== "undefined" && typeof window.speechSynthesis !== "undefined" && typeof window.speechSynthesis?.speak === "function";
95
+ const ttsSupported = () => hasWebSpeech || readEngine() === "edge";
73
96
  let cachedVoice;
74
97
  if (typeof window !== "undefined" && window.speechSynthesis?.addEventListener) {
75
98
  window.speechSynthesis.addEventListener("voiceschanged", () => {
@@ -86,11 +109,58 @@ window.__ModuleLoader__?.load({
86
109
  cachedVoice = zh.find((voice) => (voice.lang || "").toLowerCase() === "zh-cn") ?? zh[0];
87
110
  return cachedVoice;
88
111
  }
112
+ //#region edge-tts 桥(1.19.0):文本 POST 给本地合成服务,mp3 回来用 <audio> 播
113
+ let edgeAudio;
114
+ function stopEdgeAudio() {
115
+ if (edgeAudio) {
116
+ try {
117
+ edgeAudio.pause();
118
+ } catch {}
119
+ edgeAudio = undefined;
120
+ }
121
+ }
122
+ async function speakViaEdge(cleanText) {
123
+ stopEdgeAudio();
124
+ const url = `${EDGE_TTS_ENDPOINT}?text=${encodeURIComponent(cleanText)}&rate=${encodeURIComponent(EDGE_TTS_RATE)}`;
125
+ const response = await fetch(url, { cache: "no-store" });
126
+ if (!response.ok) throw new Error(`edge-tts HTTP ${response.status}`);
127
+ const blob = await response.blob();
128
+ stopEdgeAudio(); // 合成期间可能有更新消息进来,播放前再掐一次
129
+ const audio = new Audio(URL.createObjectURL(blob));
130
+ edgeAudio = audio;
131
+ audio.play().catch(() => {});
132
+ }
133
+ /** edge 桥故障提示:开关上 ⚠ 红色一瞬(服务不在/合成失败给个看得见的信号,不弹窗不打扰)。 */
134
+ function flashEdgeFault() {
135
+ if (typeof document === "undefined") return;
136
+ const node = document.getElementById("dsh-aiyayi-tts-toggle");
137
+ if (!node) return;
138
+ node.textContent = `${node.textContent}⚠`;
139
+ node.style.color = "#e5484d";
140
+ setTimeout(() => {
141
+ node.style.color = "";
142
+ refreshButton(node);
143
+ }, 2500);
144
+ }
145
+ //#endregion
146
+
89
147
  function speak(text) {
90
- const synth = window.speechSynthesis;
91
- if (!synth) return;
92
148
  const clean = cleanForSpeech(text);
93
149
  if (!clean) return;
150
+ if (readEngine() === "edge") {
151
+ // 服务不在/合成失败:红闪提示 + 1.5s 后重试一次(期间服务可能被自启机制拉起)。
152
+ // 注意:浏览器安全模型不允许页面拉起本机进程——"自动启动服务"做不到,
153
+ // 自愈闭环靠开机自启(Startup bat)或 set_tts_engine 的 ensureServer。
154
+ speakViaEdge(clean).catch(() => {
155
+ flashEdgeFault();
156
+ setTimeout(() => {
157
+ speakViaEdge(clean).catch(() => {});
158
+ }, 1500);
159
+ });
160
+ return;
161
+ }
162
+ const synth = window.speechSynthesis;
163
+ if (!synth) return;
94
164
  // 新消息先掐掉上一条,避免叠音
95
165
  synth.cancel();
96
166
  const utterance = new SpeechSynthesisUtterance(clean);
@@ -102,13 +172,42 @@ window.__ModuleLoader__?.load({
102
172
  synth.speak(utterance);
103
173
  }
104
174
  function stopSpeaking() {
175
+ stopEdgeAudio();
105
176
  window.speechSynthesis?.cancel();
106
177
  }
107
178
  //#endregion
108
179
 
109
180
  //#region 浮动开关按钮
110
181
  const BUTTON_SIZE = 40;
111
- const UNSUPPORTED_TIP = "当前浏览器不支持语音合成(自动朗读),点了也不会有声——这不是 bug。请用 Chrome / Edge / Firefox 打开 dsh web 启动时打印的带 token 的 URL。";
182
+ //#region 哑窗口:复制带认证的完整 URL
183
+ // 向引擎要带 token 的 URL(服务端见 lib/auth-url.js;/api 前缀路由,
184
+ // 未登录会被 Connection 栅栏 401 拦下,这里把失败讲成"请先登录 dsh web")。
185
+ async function copyAuthenticatedUrl() {
186
+ try {
187
+ const response = await fetch("/api/aiyayi/auth-url", { method: "GET", cache: "no-store" });
188
+ if (!response.ok) {
189
+ window.alert("获取认证 URL 失败:" + (response.status === 401 ? "请先登录 dsh web。" : "HTTP " + response.status + "——请确认已登录 dsh web。"));
190
+ return;
191
+ }
192
+ const data = await response.json();
193
+ const url = data?.url;
194
+ if (typeof url !== "string" || url === "") {
195
+ window.alert("获取认证 URL 失败:服务端没有返回 url——请确认已登录 dsh web。");
196
+ return;
197
+ }
198
+ try {
199
+ await navigator.clipboard.writeText(url);
200
+ window.alert("已复制带认证的完整 URL,粘贴到 Chrome/Edge/Firefox 打开即可自动朗读。\n注意:此 URL 是长期有效的引擎钥匙,自用可以,别发给别人。");
201
+ } catch {
202
+ // WebView 常见 NotAllowedError:剪贴板 API 不可用,降级手动复制
203
+ window.prompt("剪贴板不可用,请手动复制:", url);
204
+ }
205
+ } catch (error) {
206
+ window.alert("获取认证 URL 失败:" + (error?.message ?? String(error)) + "——请确认已登录 dsh web。");
207
+ }
208
+ }
209
+ //#endregion
210
+
112
211
  function ensureButton(onToggle) {
113
212
  if (typeof document === "undefined" || !document.body || document.getElementById("dsh-aiyayi-tts-toggle")) return;
114
213
  const button = document.createElement("button");
@@ -137,8 +236,8 @@ window.__ModuleLoader__?.load({
137
236
  boxShadow: "0 2px 8px rgba(0,0,0,.15)",
138
237
  transition: "opacity .15s"
139
238
  });
140
- if (!ttsSupported) {
141
- // 哑窗口:按钮置灰 + 禁用态样式,点击弹提示(行为不变的那条路径被封在这里)
239
+ if (!ttsSupported()) {
240
+ // 哑窗口:按钮置灰 + 禁用态样式,点击复制带认证的完整 URL(B 半逻辑)
142
241
  button.style.cursor = "not-allowed";
143
242
  button.style.filter = "grayscale(1)";
144
243
  button.style.opacity = "0.3";
@@ -149,7 +248,7 @@ window.__ModuleLoader__?.load({
149
248
  button.style.opacity = "0.3";
150
249
  });
151
250
  button.addEventListener("click", () => {
152
- window.alert(UNSUPPORTED_TIP);
251
+ copyAuthenticatedUrl();
153
252
  });
154
253
  } else {
155
254
  button.addEventListener("mouseenter", () => {
@@ -160,15 +259,73 @@ window.__ModuleLoader__?.load({
160
259
  });
161
260
  button.addEventListener("click", () => onToggle());
162
261
  }
262
+ // 右键弹引擎切换菜单(晓晓/系统),哑窗口也能切到 edge 续命
263
+ button.addEventListener("contextmenu", (event) => {
264
+ event.preventDefault();
265
+ toggleEngineMenu();
266
+ });
163
267
  document.body.appendChild(button);
164
268
  refreshButton(button);
165
269
  }
166
270
  function refreshButton(button) {
167
271
  const node = button ?? document.getElementById("dsh-aiyayi-tts-toggle");
168
272
  if (!node) return;
169
- node.textContent = enabled ? "🔊" : "🔇";
170
- node.style.opacity = !ttsSupported ? "0.3" : enabled ? "1" : "0.55";
273
+ // ✦ 徽标:当前 engine=edge(晓晓在线合成)时挂在 🔊/🔇 后面
274
+ node.textContent = (enabled ? "🔊" : "🔇") + (readEngine() === "edge" ? "✦" : "");
275
+ node.style.opacity = !ttsSupported() ? "0.3" : enabled ? "1" : "0.55";
171
276
  }
277
+ //#region 引擎切换小控件:右键朗读开关弹出,晓晓 ↔ 系统一键互切
278
+ function toggleEngineMenu() {
279
+ const existing = document.getElementById("dsh-aiyayi-tts-engine-menu");
280
+ if (existing) {
281
+ existing.remove();
282
+ return;
283
+ }
284
+ const menu = document.createElement("div");
285
+ menu.id = "dsh-aiyayi-tts-engine-menu";
286
+ const current = readEngine();
287
+ const items = [
288
+ { value: "edge", label: "✦ 晓晓(微软在线)" },
289
+ { value: "default", label: "系统语音(兜底)" },
290
+ ];
291
+ for (const item of items) {
292
+ const row = document.createElement("div");
293
+ row.textContent = `${current === item.value ? "●" : "○"} ${item.label}`;
294
+ Object.assign(row.style, {
295
+ padding: "6px 14px",
296
+ cursor: "pointer",
297
+ whiteSpace: "nowrap",
298
+ fontSize: "12px",
299
+ color: current === item.value ? "var(--dsw-alias-label-primary, #111)" : "var(--dsw-alias-label-secondary, #666)",
300
+ });
301
+ row.addEventListener("click", () => {
302
+ try {
303
+ localStorage.setItem(ENGINE_KEY, item.value);
304
+ } catch {}
305
+ menu.remove();
306
+ refreshButton();
307
+ });
308
+ menu.appendChild(row);
309
+ }
310
+ Object.assign(menu.style, {
311
+ position: "fixed",
312
+ right: "12px",
313
+ bottom: `${128 + BUTTON_SIZE + 6}px`,
314
+ background: "var(--dsw-alias-bg-base, #fff)",
315
+ border: "1px solid var(--dsw-alias-border-l2, rgba(128,128,128,.4))",
316
+ borderRadius: "8px",
317
+ boxShadow: "0 2px 8px rgba(0,0,0,.15)",
318
+ padding: "4px 0",
319
+ zIndex: "61",
320
+ userSelect: "none",
321
+ });
322
+ document.body.appendChild(menu);
323
+ // 点菜单外面任意处收起(capture 先于菜单行自己的 click,contains 放行行内点击)
324
+ document.addEventListener("click", (event) => {
325
+ if (!menu.contains(event.target)) menu.remove();
326
+ }, { once: true, capture: true });
327
+ }
328
+ //#endregion
172
329
  function mountButton(onToggle) {
173
330
  if (typeof document === "undefined") return;
174
331
  if (document.readyState === "loading") {
@@ -240,10 +397,14 @@ window.__ModuleLoader__?.load({
240
397
  refreshButton();
241
398
  if (!enabled) stopSpeaking();
242
399
  });
400
+ // 验证/调试钩子:控制台 window.__aiyayiTts.speak("文本") 可直接触发一次朗读
401
+ try {
402
+ window.__aiyayiTts = { speak: (raw) => speak(raw) };
403
+ } catch {}
243
404
  ctx.effect(() => () => {
244
405
  stopSpeaking();
245
406
  }, "aiyayi-tts: stop speech on teardown");
246
- if (!ttsSupported) return; // 哑窗口:朗读全链路(事件订阅)不启动
407
+ if (!ttsSupported()) return; // 哑窗口:朗读全链路(事件订阅)不启动
247
408
  await ctx.inject(["sessions"], (scope) => {
248
409
  const sessions = scope.sessions ?? scope.get?.("sessions");
249
410
  if (!sessions?.list || typeof sessions.binding !== "function") return;
package/lib/index.js CHANGED
@@ -46,6 +46,7 @@ import {
46
46
  treeDir,
47
47
  } from './home.js'
48
48
  import { registerOwnTool } from './own-tools.js'
49
+ import { registerAuthUrlRoute } from './auth-url.js'
49
50
  import { auditManifestPaths } from './toolkit-manifest.js'
50
51
 
51
52
  /** Loader 身份。 */
@@ -1090,6 +1091,15 @@ export function apply(ctx) {
1090
1091
  registerOwnTool('memory_location')
1091
1092
  registerOwnTool('memory_relocate')
1092
1093
 
1094
+ // 认证 URL 端点(1.17.0 本地测试态):哑窗口点 🔊 按钮复制带 token 的
1095
+ // 完整 URL 用。GET /api/aiyayi/auth-url,登录态栅栏后、无副作用、no-store;
1096
+ // 无 web 面的 profile 里 inject 不落地,静默零开销。
1097
+ try {
1098
+ registerAuthUrlRoute(ctx)
1099
+ } catch {
1100
+ /* 端点注册失败不影响记忆本体,页面侧拿不到 URL 会走各自的失败提示。 */
1101
+ }
1102
+
1093
1103
  ctx.effect(
1094
1104
  () =>
1095
1105
  ctx.systemPrompt.section({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-aiyayi",
3
- "version": "1.17.0",
3
+ "version": "1.19.0",
4
4
  "license": "MIT",
5
5
  "author": "巴依浩爷 (bayihy)",
6
6
  "keywords": [
@@ -38,6 +38,7 @@
38
38
  },
39
39
  "files": [
40
40
  "lib/index.js",
41
+ "lib/auth-url.js",
41
42
  "lib/home.js",
42
43
  "lib/restrict.js",
43
44
  "lib/presence.js",