dsh-aurorix-agentbook 1.8.5 → 1.8.6

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.
Files changed (2) hide show
  1. package/lib/web.js +29 -15
  2. package/package.json +1 -1
package/lib/web.js CHANGED
@@ -405,29 +405,42 @@ export function floatButtonScript(prefix, title) {
405
405
  return `(function(){
406
406
  if (window.__AURORIX_ENTRY__) return; window.__AURORIX_ENTRY__ = true;
407
407
  var HREF = ${JSON.stringify(prefix + '/')}, NAME = ${JSON.stringify(title)};
408
+ // 到达标记:脚本是否注入、是否跑到挂载、挂在哪个锚点,都能从页面直接读出来。
409
+ // 之前入口不出现时无法区分「没注入」和「注入了但挂不上」,只能猜。
410
+ var SELF = 'aurorix-entry';
411
+ function note(stage){
412
+ if (!document.documentElement) return;
413
+ document.documentElement.setAttribute('data-aurorix-stage', stage);
414
+ }
415
+ note('script');
408
416
 
409
417
  var ICON = '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><path d="M4 5.5A1.5 1.5 0 0 1 5.5 4H10a2 2 0 0 1 2 2v14a1.5 1.5 0 0 0-1.5-1.5H5.5A1.5 1.5 0 0 1 4 17V5.5Z"/><path d="M20 5.5A1.5 1.5 0 0 0 18.5 4H14a2 2 0 0 0-2 2v14a1.5 1.5 0 0 1 1.5-1.5h5A1.5 1.5 0 0 0 20 17V5.5Z"/></svg>';
410
418
  var CLOSE = '<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M6 6l12 12M18 6L6 18"/></svg>';
411
419
 
420
+ // 令牌名必须是宿主真实存在的那一套(--dsw-alias-*),写错的后果不是"样式没生效"
421
+ // 而是落到硬编码的浅色值上:浅色主题下就成了白底白字,按钮存在但看不见。
422
+ // 文字与图标一律走 label-primary;拿不到就继承宿主自身的 color,不写死颜色。
412
423
  var CSS = ''
413
- + '.ax-mask{position:fixed;inset:0;z-index:2147483001;background:rgba(0,0,0,.42);display:none}'
424
+ + '.ax-mask{position:fixed;inset:0;z-index:2147483001;background:var(--dsw-alias-bg-mask-1,rgba(0,0,0,.42));display:none}'
414
425
  + '.ax-mask.ax-on{display:block}'
415
426
  + '.ax-panel{position:fixed;z-index:2147483002;display:none;overflow:hidden;'
416
- + 'border-radius:14px;background:var(--dsl-alias-bg-l1,#0d1110);'
417
- + 'border:1px solid var(--dsl-alias-border-l2,rgba(127,127,127,.28));box-shadow:0 24px 64px rgba(0,0,0,.45)}'
427
+ + 'border-radius:var(--dsw-radius-panel,14px);background:var(--dsw-alias-bg-layer-2,#17181b);'
428
+ + 'color:var(--dsw-alias-label-primary,inherit);'
429
+ + 'border:1px solid var(--dsw-alias-border-l2,rgba(127,127,127,.28));box-shadow:var(--dsw-elevation-prominent,0 24px 64px rgba(0,0,0,.45))}'
418
430
  + '.ax-panel.ax-on{display:flex;flex-direction:column}'
419
431
  + '.ax-head{display:flex;align-items:center;justify-content:space-between;gap:10px;'
420
- + 'padding:9px 12px;border-bottom:1px solid var(--dsl-alias-border-l2,rgba(127,127,127,.22));flex:0 0 auto}'
421
- + '.ax-title{font:600 13.5px/1.2 -apple-system,system-ui,"PingFang SC",sans-serif;color:var(--dsl-alias-text-l1,#e9efee)}'
422
- + '.ax-x{display:flex;align-items:center;justify-content:center;width:26px;height:26px;border-radius:8px;'
423
- + 'border:0;background:transparent;color:inherit;cursor:pointer;opacity:.7}'
424
- + '.ax-x:hover{opacity:1;background:rgba(127,127,127,.14)}'
432
+ + 'padding:9px 12px;border-bottom:1px solid var(--dsw-alias-border-l2,rgba(127,127,127,.22));flex:0 0 auto}'
433
+ + '.ax-title{font:600 13.5px/1.2 -apple-system,system-ui,"PingFang SC",sans-serif;color:inherit}'
434
+ + '.ax-x{display:flex;align-items:center;justify-content:center;width:26px;height:26px;'
435
+ + 'border-radius:var(--dsw-radius-sm,8px);border:0;background:transparent;color:inherit;cursor:pointer;opacity:.7}'
436
+ + '.ax-x:hover{opacity:1;background:var(--dsw-alias-interactive-bg-hover,rgba(127,127,127,.14))}'
425
437
  + '.ax-frame{flex:1 1 auto;width:100%;border:0;background:transparent}'
426
- // 找不到宿主锚点时的退路:固定贴在右上角,样式尽量贴近宿主按钮
438
+ // 找不到宿主锚点时的退路:固定贴在右上角,样式尽量贴近宿主按钮。
439
+ // color 用 inherit 而不是写死浅色:主题深浅由宿主决定,写死就会在浅色下白底白字。
427
440
  + '.ax-fab-fallback{position:fixed;top:12px;right:64px;z-index:2147483000;display:flex;align-items:center;'
428
- + 'justify-content:center;width:32px;height:32px;padding:0;border-radius:8px;border:0;cursor:pointer;'
429
- + 'background:transparent;color:var(--dsl-alias-text-l1,#e9efee);opacity:.72}'
430
- + '.ax-fab-fallback:hover{opacity:1;background:rgba(127,127,127,.14)}'
441
+ + 'justify-content:center;width:32px;height:32px;padding:0;border-radius:var(--dsw-radius-md,8px);border:0;cursor:pointer;'
442
+ + 'background:transparent;color:var(--dsw-alias-label-primary,inherit);opacity:.72}'
443
+ + '.ax-fab-fallback:hover{opacity:1;background:var(--dsw-alias-interactive-bg-hover,rgba(127,127,127,.14))}'
431
444
  + '.ax-fab-fallback svg{width:18px;height:18px}';
432
445
 
433
446
  function boot(){
@@ -569,6 +582,7 @@ export function floatButtonScript(prefix, title) {
569
582
  if (entry && document.contains(entry)) return true;
570
583
  var anchor = findAnchor();
571
584
  entry = makeEntry(anchor);
585
+ note(anchor ? 'mounted-anchored' : 'mounted-fallback');
572
586
  // 放在最右那个按钮之后,成为这一组的最后一个,和宿主自己的排列一致
573
587
  if (anchor && anchor.parentNode) anchor.parentNode.insertBefore(entry, anchor.nextSibling || null);
574
588
  else document.body.appendChild(entry);
@@ -871,9 +885,9 @@ export function attachWeb(ctx, { backend }) {
871
885
  path: PREFIX,
872
886
  handler: createWebHandler({ backend, connection: webCtx.connection }),
873
887
  }), 'dsh-aurorix-agentbook: web route')
874
- // 注入监听必须挂在 webCtx 上:宿主在 webServer 这一层 emit 事件,
875
- // 挂在根 ctx 上收不到(client-connection / api-remote-access / client-modules
876
- // 三个插件都挂在 webCtx)。挂错的表现是入口永远不出现,而且不报任何错。
888
+ // 挂在 webCtx 上只为与 client-connection / api-remote-access / client-modules 三个
889
+ // 自带插件保持一致。A/B 实测(1.8.4 挂根 ctx、1.8.5 挂 webCtx)注入条数都是 1,
890
+ // Cordis 的事件会广播到整棵树——所以这里不是入口不出现的根因,别再往这儿找。
877
891
  const off = webCtx.effect(() => webCtx.on('webserver/index-inject', (table) => {
878
892
  table.push({ kind: 'script', placement: 'body-end', text: floatButtonScript(PREFIX, PAGE_TITLE) })
879
893
  }), 'dsh-aurorix-agentbook: entry injection')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-aurorix-agentbook",
3
- "version": "1.8.5",
3
+ "version": "1.8.6",
4
4
  "description": "dsh-aurorix-agentbook:给 dsh-go 接通 Aurorix 记忆库——原生界面(状态条/胶囊/菜单/面板/保险箱)加宿主侧提示词注入、分层快照与四个工具。",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",