dsh-better-memo 0.2.0 → 0.2.2
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 +24 -0
- package/README.md +8 -8
- package/client.js +180 -102
- package/index.js +9 -4
- package/lib/store.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.2.2 — 2026-11-20
|
|
4
|
+
|
|
5
|
+
只改编辑区尺寸(用户:编辑栏太小,尤其修改的时候,正文框宽度要翻三倍)。
|
|
6
|
+
|
|
7
|
+
- **改一条时整页放宽**:`.bm-page:has(.bm-edit)` 从 `min(720px,92vw)` 放到 `min(1760px,96vw)`,正文框可用宽从约 660px 变成约 1700px(窗口够宽时约 2.6–3 倍);宽度带 180ms 过渡,进出编辑不闪跳。收起编辑后自动回到 720px。
|
|
8
|
+
- **正文框加高**:编辑态 `min-height` 62 → **200px**、`rows` 3 → **8**;新增表单的正文框 62 → **120px**。
|
|
9
|
+
- 版本号 0.2.2(client 与 package 同步);宿主半边零改动。
|
|
10
|
+
|
|
11
|
+
## 0.2.1 — 2026-11-20
|
|
12
|
+
|
|
13
|
+
视觉与手感修(用户:黑的看不清、UI 有点丑、点设置页外面也该收起)。
|
|
14
|
+
|
|
15
|
+
- **浮窗卡片与设置页固定浅色**:不再跟宿主深色主题走,卡片/设置页底色 `#fff`、正文 `#1f2328`、次要文字 `#57606a`,边框与阴影全部按浅色重配;输入框、下拉、开关行同步改浅色底(`#f2f5f9`),不再出现「白底白字」或「黑底黑字」。
|
|
16
|
+
- **顶栏胶囊同样改白底**(原来深灰底 + 继承宿主文字色,深色主题下几乎看不清)。
|
|
17
|
+
- **卡片重排**:行改成扁平列表 + 悬停高亮,去掉每行的方框;归属用彩色圆点 + 同色系小药丸标签(会话蓝 / 共享绿 / 私人橙);标题与摘要两行;底部一行灰字提示「点一行即可复制;齿轮里管理全部」;计数改成浅色药丸。
|
|
18
|
+
- **点设置页外的区域也会收起设置页**(原来只有 ESC 和关闭按钮),用 `mousedown` 判定,从设置页内部拖到外面不会误触。
|
|
19
|
+
- **胶囊只在真会话里出现**:欢迎页 / 新建但还没说话的会话不显示这个按钮(读 `sessions.list` 的 `retainedBy.mainView` 且跳过 `blank` 会话,订阅列表变化后即时显隐)。
|
|
20
|
+
- 胶囊与同行图标按钮对齐:高 28、圆角 8、`top:11px`(原来 28 高但 `top:6px`、圆角 14,比同行高出一截)。
|
|
21
|
+
- 三档文案改为「本会话 / 全局共享 / 仅用户」(分组标题、下拉选项、提示语同步)。
|
|
22
|
+
- `memo_edit` 的 `add` 显式拒绝 `scope=user`:schema 早已把 user 排除,但直接调用会绕过枚举写出 user 条目,现在返回错误。
|
|
23
|
+
- `memo_edit` 的 `add` 不给 `scope` 时不再报错,**默认写到本会话**(`session`);要跨会话共享才显式写 `profile`。
|
|
24
|
+
- 每条备忘录都记下来源会话 `sessionId`(写 `profile` 时也记),`memo_list` 与面板接口返回里都带这个字段。
|
|
25
|
+
- 版本号 0.2.1(client 与 package 同步)。
|
|
26
|
+
|
|
3
27
|
## 0.2.0 — 2026-11-20
|
|
4
28
|
|
|
5
29
|
改成浮窗卡片(用户口径:不要整页)。
|
package/README.md
CHANGED
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
| 作用域 | 谁收得到 | AI 能看 | AI 能写 |
|
|
6
6
|
|---|---|---|---|
|
|
7
|
-
| **本会话** `session` |
|
|
8
|
-
|
|
|
9
|
-
|
|
|
7
|
+
| **本会话** `session` | 只有这一个会话(**写备忘录时的默认档**) | ✅ | ✅ |
|
|
8
|
+
| **全局共享** `profile` | 这个 profile 的所有会话 | ✅ | ✅ |
|
|
9
|
+
| **仅用户** `user` | 只有你自己 | ❌ 永远不返回 | ❌ 只有你能写 |
|
|
10
10
|
|
|
11
11
|
## 安装
|
|
12
12
|
|
|
@@ -19,13 +19,13 @@ dsh plugin --profile <你的 profile> add dsh-better-memo
|
|
|
19
19
|
## 用
|
|
20
20
|
|
|
21
21
|
1. **顶栏胶囊**(窗口右上角,`备忘录`):点一下弹出浮窗卡片。
|
|
22
|
-
2. **浮窗卡片**:一条一条,左边彩色圆点区分三档(蓝=本会话 /
|
|
22
|
+
2. **浮窗卡片**:一条一条,左边彩色圆点区分三档(蓝=本会话 / 绿=全局共享 / 黄=仅用户)。**点一条 = 复制到剪贴板**(格式 `标题\n正文`),右下角浮出「已复制」。点卡片外面、按 ESC、或再点胶囊都能关。
|
|
23
23
|
3. **齿轮 → 设置页**:卡片右上角的齿轮点进去是整页模式,可以做全部管理(新增、勾完成、行内改、两次确认删),顶部有开关 **「在会话 tab 行显示「备忘录」入口」**,**默认关**。打开后会话 tab 行才出现「备忘录」座位,关掉立刻消失,不用重启。
|
|
24
24
|
|
|
25
25
|
## 给 AI 的两个工具
|
|
26
26
|
|
|
27
|
-
- **`memo_list`** —— 返回本会话该查收的条目:本会话的 `session` + 本 profile 的 `profile
|
|
28
|
-
- **`memo_edit`** —— `op=add|update|delete`。`add`
|
|
27
|
+
- **`memo_list`** —— 返回本会话该查收的条目:本会话的 `session` + 本 profile 的 `profile`,已勾完成的会过滤掉。**`仅用户` 的条目永远不会出现在这里。**
|
|
28
|
+
- **`memo_edit`** —— `op=add|update|delete`。`add` 不必给 `scope`:**默认就是 `session`,归写它的那个会话**;要跨会话共享才显式写 `profile`。`update`/`delete` 要 `id`。只能改自己看得到的条目,跨会话或 `user` 条目会被拒。不论哪一档,条目都会记下来源会话 `sessionId`(写 `profile` 时也一样),方便区分是谁记的。
|
|
29
29
|
|
|
30
30
|
会话开始时若用户提到「备忘录 / 备忘 / 记一下 / 待办」,会先调 `memo_list`(插件自带这段系统提示,一般不用再写)。
|
|
31
31
|
|
|
@@ -38,8 +38,8 @@ dsh plugin --profile <你的 profile> add dsh-better-memo
|
|
|
38
38
|
## 已知限制
|
|
39
39
|
|
|
40
40
|
- **复制依赖窗口焦点**:用的是 `navigator.clipboard.writeText`,失败时退回 `document.execCommand('copy')`;两个都失败会明确显示「复制失败」,不会假装成功。窗口失焦的后台环境两个都会失败(这是浏览器的规矩,不是插件 bug)。
|
|
41
|
-
-
|
|
42
|
-
-
|
|
41
|
+
- 顶栏胶囊与同一行图标按钮同高同圆角(高 28、圆角 8、`top:11px; right:150px`)。**只在真正打开了一个会话时才显示**:欢迎页 / 新会话尚未进入对话时没有这个按钮。如果没有 `shell.overlay` 槽(个别环境),入口会退化成右下角的固定圆钮。
|
|
42
|
+
- 单机单文件,没有多端同步;全局共享档只在本 profile 内共享。
|
|
43
43
|
- 没有提醒/定时:这不是提醒插件,是备忘录。
|
|
44
44
|
|
|
45
45
|
## License
|
package/client.js
CHANGED
|
@@ -33,7 +33,7 @@ window.__ModuleLoader__.load({
|
|
|
33
33
|
const ReactDOMClient = require('react-dom/client');
|
|
34
34
|
|
|
35
35
|
const NS = 'better-memo';
|
|
36
|
-
const VERSION = '0.2.
|
|
36
|
+
const VERSION = '0.2.2';
|
|
37
37
|
const SLOT = 'conversation.view';
|
|
38
38
|
const SEAT_ID = 'better-memo-seat';
|
|
39
39
|
const TOPBAR_SLOT = 'shell.overlay';
|
|
@@ -52,11 +52,11 @@ window.__ModuleLoader__.load({
|
|
|
52
52
|
const RETRY_MS = 250;
|
|
53
53
|
|
|
54
54
|
const FALLBACK_LIMITS = { title: 120, body: 4000, entries: 500 };
|
|
55
|
-
const GROUP_LABEL = { session: '
|
|
55
|
+
const GROUP_LABEL = { session: '本会话:', profile: '全局共享:', user: '仅用户:' };
|
|
56
56
|
const SCOPE_TAG = { session: '会话', profile: '共享', user: '私人' };
|
|
57
57
|
const HINT_TEXT =
|
|
58
|
-
'
|
|
59
|
-
'
|
|
58
|
+
'本会话只在本会话里出现;全局共享会出现在同一 profile 的所有会话;' +
|
|
59
|
+
'仅用户只有你自己在这个面板里看得到,AI 读不到,也改不了。';
|
|
60
60
|
|
|
61
61
|
/** One style element per page, injected once; guarded by this flag inside the factory. */
|
|
62
62
|
let styleInjected = false;
|
|
@@ -65,91 +65,109 @@ window.__ModuleLoader__.load({
|
|
|
65
65
|
let an accidental backtick truncate the file and break the whole bundle. */
|
|
66
66
|
const CSS = [
|
|
67
67
|
/* ---- management UI (unchanged from 0.1.0) ---- */
|
|
68
|
-
'.bm-panel{display:flex;flex-direction:column;gap:
|
|
68
|
+
'.bm-panel{display:flex;flex-direction:column;gap:16px;padding:16px 18px 20px;font-size:13px;color:inherit;box-sizing:border-box;animation:bm-enter-frames 200ms cubic-bezier(.22,1,.36,1) both}',
|
|
69
69
|
'.bm-panel *{box-sizing:border-box}',
|
|
70
70
|
'.bm-head{display:flex;align-items:center;gap:6px}',
|
|
71
71
|
'.bm-title{font-size:15px;font-weight:600;margin:0}',
|
|
72
72
|
'.bm-version{font-size:11px;color:var(--dsw-alias-label-secondary,#8a8f98);margin-left:2px}',
|
|
73
73
|
'.bm-head-spacer{flex:1 1 auto}',
|
|
74
|
-
'.bm-btn{font:inherit;font-size:12px;line-height:1;border-radius:
|
|
75
|
-
'.bm-btn:hover{border-color:var(--dsw-alias-border-
|
|
74
|
+
'.bm-btn{font:inherit;font-size:12px;line-height:1;border-radius:8px;border:1px solid var(--dsw-alias-border-l3,rgba(15,23,42,.16));background:var(--bm-surface,#fff);color:inherit;padding:7px 12px;cursor:pointer;transition:background 120ms ease,border-color 120ms ease}',
|
|
75
|
+
'.bm-btn:hover{background:var(--bm-hover,#eff3f8);border-color:var(--dsw-alias-border-l4,rgba(15,23,42,.22))}',
|
|
76
76
|
'.bm-btn:disabled{opacity:.45;cursor:not-allowed}',
|
|
77
77
|
'.bm-btn-primary{background:var(--dsw-alias-accent,#3b82f6);border-color:transparent;color:#fff}',
|
|
78
|
-
'.bm-btn-
|
|
79
|
-
'.bm-btn-
|
|
78
|
+
'.bm-btn-primary:hover{background:#2560d8;border-color:transparent}',
|
|
79
|
+
'.bm-btn-ghost{border-color:transparent;background:transparent;color:var(--dsw-alias-label-secondary,#8a8f98);padding:6px 8px}',
|
|
80
|
+
'.bm-btn-ghost:hover{background:var(--bm-hover,#eff3f8);color:var(--dsw-alias-label-primary,#1f2328)}',
|
|
81
|
+
'.bm-btn-danger{color:var(--dsw-alias-danger,#e5484d);border-color:rgba(209,36,47,.35);background:#fff}',
|
|
80
82
|
'.bm-hint{margin:0;font-size:12px;line-height:18px;color:var(--dsw-alias-label-secondary,#8a8f98)}',
|
|
81
|
-
'.bm-form{display:flex;flex-direction:column;gap:
|
|
83
|
+
'.bm-form{display:flex;flex-direction:column;gap:10px;padding:14px;border-radius:12px;background:var(--bm-surface-2,#f6f8fa);border:1px solid var(--bm-line,rgba(15,23,42,.09))}',
|
|
82
84
|
'.bm-form-top{display:flex;gap:8px;align-items:center}',
|
|
83
85
|
'.bm-field{display:flex;align-items:center;gap:6px;font-size:12px;color:var(--dsw-alias-label-secondary,#8a8f98)}',
|
|
84
|
-
'.bm-input{font:inherit;font-size:13px;width:100%;border-radius:8px;border:1px solid var(--dsw-alias-border-
|
|
85
|
-
'.bm-input:focus{outline:none;border-color:var(--dsw-alias-accent,#3b82f6)}',
|
|
86
|
-
'.bm-select{font:inherit;font-size:13px;border-radius:8px;border:1px solid var(--dsw-alias-border-
|
|
87
|
-
'.bm-textarea{resize:vertical;min-height:
|
|
86
|
+
'.bm-input{font:inherit;font-size:13px;width:100%;border-radius:8px;border:1px solid var(--dsw-alias-border-l3,rgba(15,23,42,.16));background:#fff;color:inherit;padding:8px 10px;transition:border-color 120ms ease,box-shadow 120ms ease}',
|
|
87
|
+
'.bm-input:focus{outline:none;border-color:var(--dsw-alias-accent,#3b82f6);box-shadow:0 0 0 3px rgba(47,111,237,.14)}',
|
|
88
|
+
'.bm-select{font:inherit;font-size:13px;border-radius:8px;border:1px solid var(--dsw-alias-border-l3,rgba(15,23,42,.16));background:#fff;color:inherit;padding:6px 8px}',
|
|
89
|
+
'.bm-textarea{resize:vertical;min-height:62px;line-height:19px}',
|
|
90
|
+
'.bm-form .bm-textarea{min-height:120px}',
|
|
91
|
+
// 改一条的时候正文框是主角:高 200px(原来 62),并且把整个页面撑宽到接近窗口
|
|
92
|
+
'.bm-edit{padding:2px 0 4px}',
|
|
93
|
+
'.bm-edit .bm-textarea{min-height:200px;font-size:13px}',
|
|
88
94
|
'.bm-form-actions{display:flex;justify-content:flex-end;gap:8px}',
|
|
89
95
|
'.bm-note{margin:0;font-size:11px;color:var(--dsw-alias-label-tertiary,#9aa0a6)}',
|
|
90
|
-
'.bm-groups{display:flex;flex-direction:column;gap:
|
|
91
|
-
'.bm-group{display:flex;flex-direction:column;gap:
|
|
92
|
-
'.bm-group-head{font-size:
|
|
93
|
-
'.bm-empty{margin:0;font-size:12px;color:var(--dsw-alias-label-tertiary,#9aa0a6);padding:
|
|
94
|
-
'.bm-list{display:flex;flex-direction:column;gap:
|
|
95
|
-
'.bm-row{display:flex;flex-direction:column;gap:6px;padding:10px 12px;border-radius:
|
|
96
|
+
'.bm-groups{display:flex;flex-direction:column;gap:18px}',
|
|
97
|
+
'.bm-group{display:flex;flex-direction:column;gap:4px}',
|
|
98
|
+
'.bm-group-head{font-size:11.5px;font-weight:600;letter-spacing:.02em;color:var(--dsw-alias-label-secondary,#8a8f98);margin:0 0 2px;text-transform:none}',
|
|
99
|
+
'.bm-empty{margin:0;font-size:12px;color:var(--dsw-alias-label-tertiary,#9aa0a6);padding:6px 2px}',
|
|
100
|
+
'.bm-list{display:flex;flex-direction:column;gap:2px;margin:0;padding:0;list-style:none}',
|
|
101
|
+
'.bm-row{display:flex;flex-direction:column;gap:6px;padding:10px 12px;border-radius:10px;border:1px solid transparent;background:transparent;animation:bm-item-frames 240ms cubic-bezier(.22,1,.36,1) both;transition:background 120ms ease,border-color 120ms ease}',
|
|
102
|
+
'.bm-row:hover{background:var(--bm-hover,#eff3f8);border-color:var(--bm-line,rgba(15,23,42,.09))}',
|
|
96
103
|
'.bm-row-out{animation:bm-out-frames 160ms cubic-bezier(.4,0,1,1) forwards;pointer-events:none}',
|
|
97
104
|
'.bm-row-head{display:flex;align-items:flex-start;gap:8px}',
|
|
98
105
|
'.bm-check{display:flex;align-items:flex-start;gap:8px;flex:1 1 auto;min-width:0;cursor:pointer}',
|
|
99
|
-
'.bm-check input{margin:2px 0 0}',
|
|
100
|
-
'.bm-row-title{font-size:13px;font-weight:500;word-break:break-word}',
|
|
106
|
+
'.bm-check input{margin:2px 0 0;accent-color:var(--dsw-alias-accent,#3b82f6)}',
|
|
107
|
+
'.bm-row-title{font-size:13px;font-weight:500;line-height:18px;word-break:break-word}',
|
|
101
108
|
'.bm-done{text-decoration:line-through;color:var(--dsw-alias-label-tertiary,#9aa0a6)}',
|
|
102
|
-
'.bm-row-body{margin:0;font-size:12px;line-height:18px;color:var(--dsw-alias-label-secondary,#8a8f98);white-space:pre-wrap;word-break:break-word;max-height:120px;overflow:auto}',
|
|
103
|
-
'.bm-row-actions{display:flex;
|
|
109
|
+
'.bm-row-body{margin:0;padding-left:26px;font-size:12px;line-height:18px;color:var(--dsw-alias-label-secondary,#8a8f98);white-space:pre-wrap;word-break:break-word;max-height:120px;overflow:auto}',
|
|
110
|
+
'.bm-row-actions{display:flex;flex:0 0 auto;gap:2px;opacity:.55;transition:opacity 120ms ease}',
|
|
111
|
+
'.bm-row:hover .bm-row-actions,.bm-row:focus-within .bm-row-actions{opacity:1}',
|
|
112
|
+
'.bm-row-act{font-size:11.5px;padding:4px 8px;border-radius:6px}',
|
|
104
113
|
'.bm-edit{display:flex;flex-direction:column;gap:6px}',
|
|
105
114
|
'.bm-edit-actions{display:flex;justify-content:flex-end;gap:6px}',
|
|
106
|
-
'.bm-error{display:flex;align-items:center;gap:10px;padding:10px 12px;border-radius:8px;border:1px solid
|
|
115
|
+
'.bm-error{display:flex;align-items:center;gap:10px;padding:10px 12px;border-radius:8px;border:1px solid rgba(209,36,47,.32);background:rgba(209,36,47,.06);color:#b3252f;font-size:12px}',
|
|
107
116
|
'.bm-error-spacer{flex:1 1 auto}',
|
|
108
117
|
'.bm-loading{margin:0;font-size:12px;color:var(--dsw-alias-label-secondary,#8a8f98)}',
|
|
109
118
|
/* ---- entry capsule ---- */
|
|
110
|
-
'.bm-capsule{position:fixed;top:
|
|
111
|
-
'.bm-capsule:hover{border-color:
|
|
112
|
-
'.bm-capsule[data-bm-open="1"]{border-color
|
|
113
|
-
'.bm-capsule-floating{top:auto;right:16px;bottom:16px;height:40px;min-width:40px;padding:0 14px;border-radius:20px;box-shadow:0
|
|
114
|
-
'.bm-capsule-label{font-weight:500;white-space:nowrap}',
|
|
115
|
-
'.bm-capsule-count{min-width:16px;height:16px;padding:0 4px;border-radius:8px;background
|
|
119
|
+
'.bm-capsule{position:fixed;top:11px;right:150px;z-index:2147483000;display:inline-flex;align-items:center;gap:6px;height:28px;padding:0 12px;border-radius:8px;border:1px solid rgba(15,23,42,.14);background:#fff;color:#1f2328;font:inherit;font-size:12px;line-height:1;cursor:pointer;pointer-events:auto;-webkit-app-region:no-drag;box-shadow:0 1px 3px rgba(16,24,40,.10);transition:background 120ms ease,border-color 120ms ease}',
|
|
120
|
+
'.bm-capsule:hover{background:#f2f5f9;border-color:rgba(15,23,42,.22)}',
|
|
121
|
+
'.bm-capsule[data-bm-open="1"]{border-color:#2f6fed;background:#fff}',
|
|
122
|
+
'.bm-capsule-floating{top:auto;right:16px;bottom:16px;height:40px;min-width:40px;padding:0 14px;border-radius:20px;box-shadow:0 8px 22px rgba(16,24,40,.18)}',
|
|
123
|
+
'.bm-capsule-label{font-weight:500;white-space:nowrap;color:#1f2328}',
|
|
124
|
+
'.bm-capsule-count{min-width:16px;height:16px;padding:0 4px;border-radius:8px;background:#2f6fed;color:#fff;font-size:10px;line-height:16px;text-align:center}',
|
|
125
|
+
/* ---- popout surfaces: light and high contrast whatever the host theme is ---- */
|
|
126
|
+
'.bm-card,.bm-page{--bm-fg:#1f2328;--bm-fg2:#57606a;--bm-fg3:#8b949e;--bm-line:rgba(15,23,42,.09);--bm-line-2:rgba(15,23,42,.14);--bm-hover:#eff3f8;--bm-surface:#fff;--bm-surface-2:#f6f8fa;--bm-accent:#2f6fed;color-scheme:light;--dsw-alias-bg-base:#fff;--dsw-alias-bg-l1:#fff;--dsw-alias-bg-l2:#f2f5f9;--dsw-alias-label-primary:#1f2328;--dsw-alias-label-secondary:#57606a;--dsw-alias-label-tertiary:#8b949e;--dsw-alias-border-l2:rgba(15,23,42,.10);--dsw-alias-border-l3:rgba(15,23,42,.16);--dsw-alias-border-l4:rgba(15,23,42,.22);--dsw-alias-accent:#2f6fed;--dsw-alias-danger:#d1242f}',
|
|
116
127
|
/* ---- floating card ---- */
|
|
117
|
-
'.bm-card{position:fixed;top:40px;right:150px;width:
|
|
128
|
+
'.bm-card{position:fixed;top:40px;right:150px;width:332px;max-height:58vh;z-index:2147483100;display:flex;flex-direction:column;border-radius:14px;border:1px solid var(--bm-line-2);background:var(--bm-surface);color:var(--bm-fg);box-shadow:0 12px 32px rgba(16,24,40,.14),0 2px 6px rgba(16,24,40,.08);overflow:hidden;pointer-events:auto;-webkit-app-region:no-drag;animation:bm-enter-frames 200ms cubic-bezier(.22,1,.36,1) both}',
|
|
118
129
|
'.bm-card-floating{top:auto;right:16px;bottom:64px}',
|
|
119
130
|
'.bm-card-out{animation:bm-out-frames 160ms cubic-bezier(.4,0,1,1) forwards;pointer-events:none}',
|
|
120
|
-
'.bm-card-head{display:flex;align-items:center;gap:
|
|
121
|
-
'.bm-card-title{font-size:
|
|
122
|
-
'.bm-card-count{
|
|
131
|
+
'.bm-card-head{display:flex;align-items:center;gap:8px;padding:11px 12px 11px 14px;border-bottom:1px solid var(--bm-line)}',
|
|
132
|
+
'.bm-card-title{font-size:13.5px;font-weight:600;letter-spacing:.01em;color:var(--bm-fg)}',
|
|
133
|
+
'.bm-card-count{min-width:18px;padding:1px 6px;border-radius:9px;background:var(--bm-surface-2);color:var(--bm-fg2);font-size:11px;line-height:15px;text-align:center}',
|
|
123
134
|
'.bm-card-spacer{flex:1 1 auto}',
|
|
124
|
-
'.bm-card-gear{display:inline-flex;align-items:center;justify-content:center;width:
|
|
125
|
-
'.bm-card-gear:hover{background:var(--
|
|
126
|
-
'.bm-card-body{display:flex;flex-direction:column;gap:
|
|
127
|
-
'.bm-card-
|
|
128
|
-
'.bm-card-
|
|
129
|
-
'.bm-card-
|
|
130
|
-
'.bm-card-item:
|
|
131
|
-
'.bm-card-
|
|
132
|
-
'.bm-card-
|
|
133
|
-
'.bm-card-dot
|
|
134
|
-
'.bm-card-dot[data-bm-scope="
|
|
135
|
-
'.bm-card-
|
|
136
|
-
'.bm-card-
|
|
137
|
-
'.bm-card-item-
|
|
138
|
-
'.bm-card-
|
|
139
|
-
'.bm-card-
|
|
140
|
-
|
|
141
|
-
'.bm-
|
|
142
|
-
'.bm-
|
|
143
|
-
'.bm-
|
|
135
|
+
'.bm-card-gear{display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;padding:0;border-radius:8px;border:1px solid transparent;background:transparent;color:var(--bm-fg3);cursor:pointer;transition:background 120ms ease,color 120ms ease}',
|
|
136
|
+
'.bm-card-gear:hover{background:var(--bm-hover);color:var(--bm-fg)}',
|
|
137
|
+
'.bm-card-body{display:flex;flex-direction:column;gap:2px;padding:6px;overflow:auto}',
|
|
138
|
+
'.bm-card-foot{padding:8px 14px 10px;border-top:1px solid var(--bm-line);font-size:11px;color:var(--bm-fg3)}',
|
|
139
|
+
'.bm-card-empty{margin:0;padding:22px 8px;text-align:center;font-size:12px;color:var(--bm-fg3)}',
|
|
140
|
+
'.bm-card-error{display:flex;align-items:center;gap:8px;margin:4px;padding:10px;border-radius:8px;border:1px solid rgba(209,36,47,.32);background:rgba(209,36,47,.06);color:#b3252f;font-size:12px}',
|
|
141
|
+
'.bm-card-item{display:flex;align-items:flex-start;gap:9px;width:100%;text-align:left;padding:9px 10px;border-radius:10px;border:1px solid transparent;background:transparent;color:var(--bm-fg);font:inherit;cursor:pointer;animation:bm-item-frames 240ms cubic-bezier(.22,1,.36,1) both;transition:background 120ms ease,border-color 120ms ease}',
|
|
142
|
+
'.bm-card-item:hover{background:var(--bm-hover);border-color:var(--bm-line)}',
|
|
143
|
+
'.bm-card-item:active{background:#e8eef7}',
|
|
144
|
+
'.bm-card-dot{flex:0 0 auto;width:7px;height:7px;margin-top:6px;border-radius:50%;background:var(--bm-fg3);box-shadow:0 0 0 3px rgba(15,23,42,.08)}',
|
|
145
|
+
'.bm-card-dot[data-bm-scope="session"]{background:#2f6fed;box-shadow:0 0 0 3px rgba(47,111,237,.14)}',
|
|
146
|
+
'.bm-card-dot[data-bm-scope="profile"]{background:#12a150;box-shadow:0 0 0 3px rgba(18,161,80,.14)}',
|
|
147
|
+
'.bm-card-dot[data-bm-scope="user"]{background:#e08700;box-shadow:0 0 0 3px rgba(224,135,0,.16)}',
|
|
148
|
+
'.bm-card-item-text{display:flex;flex-direction:column;gap:2px;flex:1 1 auto;min-width:0}',
|
|
149
|
+
'.bm-card-item-title{font-size:13px;font-weight:500;line-height:17px;color:var(--bm-fg);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}',
|
|
150
|
+
'.bm-card-item-sub{font-size:11.5px;line-height:15px;color:var(--bm-fg2);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}',
|
|
151
|
+
'.bm-card-tag{flex:0 0 auto;align-self:center;padding:2px 7px;border-radius:999px;font-size:10.5px;line-height:14px;color:var(--bm-fg2);background:var(--bm-surface-2);border:1px solid var(--bm-line)}',
|
|
152
|
+
'.bm-card-tag[data-bm-scope="session"]{color:#2559c4;background:rgba(47,111,237,.09);border-color:rgba(47,111,237,.18)}',
|
|
153
|
+
'.bm-card-tag[data-bm-scope="profile"]{color:#0d7f42;background:rgba(18,161,80,.09);border-color:rgba(18,161,80,.18)}',
|
|
154
|
+
'.bm-card-tag[data-bm-scope="user"]{color:#a86200;background:rgba(224,135,0,.10);border-color:rgba(224,135,0,.20)}',
|
|
155
|
+
'.bm-card-toast{position:absolute;right:12px;bottom:12px;padding:7px 13px;border-radius:999px;background:var(--bm-accent);color:#fff;font-size:12px;line-height:1;box-shadow:0 8px 20px rgba(16,24,40,.22);animation:bm-fade-frames 120ms ease both}',
|
|
156
|
+
/* ---- settings page ---- */
|
|
157
|
+
'.bm-overlay-backdrop{position:fixed;inset:0;z-index:2147483200;display:flex;align-items:center;justify-content:center;background:rgba(16,24,40,.32);pointer-events:auto;-webkit-app-region:no-drag}',
|
|
158
|
+
'.bm-page{display:flex;flex-direction:column;width:min(720px,92vw);height:min(80vh,80vh);max-height:80vh;border-radius:16px;border:1px solid var(--bm-line-2);background:var(--bm-surface);color:var(--bm-fg);box-shadow:0 24px 64px rgba(16,24,40,.22),0 4px 12px rgba(16,24,40,.10);overflow:hidden;transition:width 180ms cubic-bezier(.22,1,.36,1);animation:bm-enter-frames 200ms cubic-bezier(.22,1,.36,1) both}',
|
|
159
|
+
'.bm-page-head{display:flex;align-items:center;gap:8px;padding:12px 14px;border-bottom:1px solid var(--bm-line)}',
|
|
144
160
|
'.bm-page-back{font-size:12px}',
|
|
145
|
-
'.bm-page-title{font-size:14px;font-weight:600}',
|
|
161
|
+
'.bm-page-title{font-size:14px;font-weight:600;color:var(--bm-fg)}',
|
|
146
162
|
'.bm-page-spacer{flex:1 1 auto}',
|
|
147
163
|
'.bm-page-close{font-size:18px;line-height:1;padding:4px 10px}',
|
|
148
|
-
'.bm-page-switch{display:flex;align-items:center;gap:10px;padding:
|
|
149
|
-
'.bm-switch{display:inline-flex;align-items:center;gap:8px;font-size:12.5px;cursor:pointer}',
|
|
164
|
+
'.bm-page-switch{display:flex;align-items:center;gap:10px;padding:12px 16px;border-bottom:1px solid var(--bm-line);flex-wrap:wrap;background:var(--bm-surface-2)}',
|
|
165
|
+
'.bm-switch{display:inline-flex;align-items:center;gap:8px;font-size:12.5px;color:var(--bm-fg);cursor:pointer}',
|
|
150
166
|
'.bm-switch input{cursor:pointer;margin:0}',
|
|
151
|
-
'.bm-switch-error{font-size:11px;color
|
|
152
|
-
'.bm-page-body{flex:1 1 auto;overflow:auto;min-height:0}',
|
|
167
|
+
'.bm-switch-error{font-size:11px;color:#d1242f}',
|
|
168
|
+
'.bm-page-body{flex:1 1 auto;overflow:auto;min-height:0;background:var(--bm-surface)}',
|
|
169
|
+
// 只要页里有条正在编辑,就把整页放宽(720 → 近满宽),正文框随之从约 660px 到约 1700px
|
|
170
|
+
'.bm-page:has(.bm-edit){width:min(1760px,96vw)}',
|
|
153
171
|
/* ---- keyframes ---- */
|
|
154
172
|
'@keyframes bm-enter-frames{from{opacity:0;transform:translateY(8px) scale(.98)}to{opacity:1;transform:none}}',
|
|
155
173
|
'@keyframes bm-item-frames{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}',
|
|
@@ -256,7 +274,12 @@ window.__ModuleLoader__.load({
|
|
|
256
274
|
return { showTabEntry: settings !== null && settings.showTabEntry === true };
|
|
257
275
|
}
|
|
258
276
|
|
|
259
|
-
/**
|
|
277
|
+
/**
|
|
278
|
+
* The id of the session currently shown in the main view, or '' when the
|
|
279
|
+
* view is not on a real conversation. A session that exists but is still
|
|
280
|
+
* blank (`session.blank === true`) counts as "no conversation": the host
|
|
281
|
+
* renders the welcome screen for it, and the capsule stays hidden there.
|
|
282
|
+
*/
|
|
260
283
|
function currentSessionId(ctx) {
|
|
261
284
|
try {
|
|
262
285
|
const sessions = typeof ctx.get === 'function' ? ctx.get('sessions') : undefined;
|
|
@@ -267,6 +290,7 @@ window.__ModuleLoader__.load({
|
|
|
267
290
|
const ids = Object.keys(byId);
|
|
268
291
|
for (let index = 0; index < ids.length; index += 1) {
|
|
269
292
|
const record = byId[ids[index]];
|
|
293
|
+
if (record && record.blank === true) continue;
|
|
270
294
|
const retained = record && record.retainedBy ? record.retainedBy : null;
|
|
271
295
|
if (retained && (retained.mainView | 0) > 0) return ids[index];
|
|
272
296
|
}
|
|
@@ -595,8 +619,8 @@ window.__ModuleLoader__.load({
|
|
|
595
619
|
},
|
|
596
620
|
[
|
|
597
621
|
h('option', { key: 'session', value: 'session', disabled: !hasSession }, '本会话'),
|
|
598
|
-
h('option', { key: 'profile', value: 'profile' }, '
|
|
599
|
-
h('option', { key: 'user', value: 'user' }, '
|
|
622
|
+
h('option', { key: 'profile', value: 'profile' }, '全局共享'),
|
|
623
|
+
h('option', { key: 'user', value: 'user' }, '仅用户'),
|
|
600
624
|
],
|
|
601
625
|
),
|
|
602
626
|
]),
|
|
@@ -632,7 +656,7 @@ window.__ModuleLoader__.load({
|
|
|
632
656
|
: h(
|
|
633
657
|
'p',
|
|
634
658
|
{ key: 'note', className: 'bm-note' },
|
|
635
|
-
'
|
|
659
|
+
'这个视图没带会话,只能用「全局共享」或「仅用户」。',
|
|
636
660
|
),
|
|
637
661
|
h('div', { key: 'actions', className: 'bm-form-actions' }, [
|
|
638
662
|
h(
|
|
@@ -675,7 +699,7 @@ window.__ModuleLoader__.load({
|
|
|
675
699
|
h('textarea', {
|
|
676
700
|
key: 'eb',
|
|
677
701
|
className: 'bm-input bm-textarea',
|
|
678
|
-
rows:
|
|
702
|
+
rows: 8,
|
|
679
703
|
maxLength: limits.body,
|
|
680
704
|
placeholder: '要记住的事',
|
|
681
705
|
value: editBody,
|
|
@@ -712,6 +736,7 @@ window.__ModuleLoader__.load({
|
|
|
712
736
|
]),
|
|
713
737
|
);
|
|
714
738
|
} else {
|
|
739
|
+
const confirming = confirmId === entry.id;
|
|
715
740
|
children.push(
|
|
716
741
|
h('div', { key: 'head', className: 'bm-row-head' }, [
|
|
717
742
|
h('label', { key: 'label', className: 'bm-check' }, [
|
|
@@ -730,42 +755,39 @@ window.__ModuleLoader__.load({
|
|
|
730
755
|
displayTitleOf(entry),
|
|
731
756
|
),
|
|
732
757
|
]),
|
|
758
|
+
h('div', { key: 'actions', className: 'bm-row-actions' }, [
|
|
759
|
+
h(
|
|
760
|
+
'button',
|
|
761
|
+
{
|
|
762
|
+
key: 'edit',
|
|
763
|
+
type: 'button',
|
|
764
|
+
className: 'bm-btn bm-btn-ghost bm-row-act',
|
|
765
|
+
'data-bm-edit': entry.id,
|
|
766
|
+
onClick: function () {
|
|
767
|
+
startEdit(entry);
|
|
768
|
+
},
|
|
769
|
+
},
|
|
770
|
+
'改',
|
|
771
|
+
),
|
|
772
|
+
h(
|
|
773
|
+
'button',
|
|
774
|
+
{
|
|
775
|
+
key: 'delete',
|
|
776
|
+
type: 'button',
|
|
777
|
+
className: confirming ? 'bm-btn bm-btn-danger bm-row-act' : 'bm-btn bm-btn-ghost bm-row-act',
|
|
778
|
+
'data-bm-delete': entry.id,
|
|
779
|
+
onClick: function () {
|
|
780
|
+
requestDelete(entry);
|
|
781
|
+
},
|
|
782
|
+
},
|
|
783
|
+
confirming ? '确定删?' : '删',
|
|
784
|
+
),
|
|
785
|
+
]),
|
|
733
786
|
]),
|
|
734
787
|
);
|
|
735
788
|
if (typeof entry.body === 'string' && entry.body !== '') {
|
|
736
789
|
children.push(h('div', { key: 'body', className: 'bm-row-body' }, entry.body));
|
|
737
790
|
}
|
|
738
|
-
const confirming = confirmId === entry.id;
|
|
739
|
-
children.push(
|
|
740
|
-
h('div', { key: 'actions', className: 'bm-row-actions' }, [
|
|
741
|
-
h(
|
|
742
|
-
'button',
|
|
743
|
-
{
|
|
744
|
-
key: 'edit',
|
|
745
|
-
type: 'button',
|
|
746
|
-
className: 'bm-btn',
|
|
747
|
-
'data-bm-edit': entry.id,
|
|
748
|
-
onClick: function () {
|
|
749
|
-
startEdit(entry);
|
|
750
|
-
},
|
|
751
|
-
},
|
|
752
|
-
'改',
|
|
753
|
-
),
|
|
754
|
-
h(
|
|
755
|
-
'button',
|
|
756
|
-
{
|
|
757
|
-
key: 'delete',
|
|
758
|
-
type: 'button',
|
|
759
|
-
className: confirming ? 'bm-btn bm-btn-danger' : 'bm-btn',
|
|
760
|
-
'data-bm-delete': entry.id,
|
|
761
|
-
onClick: function () {
|
|
762
|
-
requestDelete(entry);
|
|
763
|
-
},
|
|
764
|
-
},
|
|
765
|
-
confirming ? '确定删?' : '删',
|
|
766
|
-
),
|
|
767
|
-
]),
|
|
768
|
-
);
|
|
769
791
|
}
|
|
770
792
|
|
|
771
793
|
return h(
|
|
@@ -793,7 +815,7 @@ window.__ModuleLoader__.load({
|
|
|
793
815
|
}),
|
|
794
816
|
);
|
|
795
817
|
return h('section', { key: key, className: 'bm-group', 'data-bm-group': key }, [
|
|
796
|
-
h('div', { key: 'head', className: 'bm-group-head' }, GROUP_LABEL[key] +
|
|
818
|
+
h('div', { key: 'head', className: 'bm-group-head' }, GROUP_LABEL[key] + String(entries.length)),
|
|
797
819
|
list,
|
|
798
820
|
]);
|
|
799
821
|
}
|
|
@@ -853,6 +875,7 @@ window.__ModuleLoader__.load({
|
|
|
853
875
|
injectStyle();
|
|
854
876
|
|
|
855
877
|
const getSessionId = props && typeof props.getSessionId === 'function' ? props.getSessionId : function () { return ''; };
|
|
878
|
+
const subscribeSessions = props && typeof props.subscribe === 'function' ? props.subscribe : null;
|
|
856
879
|
const seat = props && props.seat ? props.seat : null;
|
|
857
880
|
const variant = props && props.variant === 'floating' ? 'floating' : 'topbar';
|
|
858
881
|
|
|
@@ -865,7 +888,12 @@ window.__ModuleLoader__.load({
|
|
|
865
888
|
const [settingsSaving, setSettingsSaving] = React.useState(false);
|
|
866
889
|
const [settingsError, setSettingsError] = React.useState(null);
|
|
867
890
|
const [toast, setToast] = React.useState(null);
|
|
868
|
-
const [sessionId, setSessionId] = React.useState(
|
|
891
|
+
const [sessionId, setSessionId] = React.useState(function () {
|
|
892
|
+
return getSessionId();
|
|
893
|
+
});
|
|
894
|
+
const [hasSession, setHasSession] = React.useState(function () {
|
|
895
|
+
return getSessionId() !== '';
|
|
896
|
+
});
|
|
869
897
|
|
|
870
898
|
const cardRef = React.useRef(null);
|
|
871
899
|
const capsuleRef = React.useRef(null);
|
|
@@ -889,6 +917,7 @@ window.__ModuleLoader__.load({
|
|
|
889
917
|
React.useEffect(function () {
|
|
890
918
|
const sid = getSessionId();
|
|
891
919
|
setSessionId(sid);
|
|
920
|
+
setHasSession(sid !== '');
|
|
892
921
|
requestState(sid)
|
|
893
922
|
.then(function (next) {
|
|
894
923
|
setPayload(next);
|
|
@@ -905,6 +934,30 @@ window.__ModuleLoader__.load({
|
|
|
905
934
|
};
|
|
906
935
|
}, []);
|
|
907
936
|
|
|
937
|
+
/* The capsule belongs to a conversation. On the new-session / welcome
|
|
938
|
+
screen there is no session in the main view, so it stays hidden. */
|
|
939
|
+
React.useEffect(function () {
|
|
940
|
+
if (subscribeSessions === null) return undefined;
|
|
941
|
+
const sync = function () {
|
|
942
|
+
const next = getSessionId();
|
|
943
|
+
setSessionId(function (prev) {
|
|
944
|
+
return prev === next ? prev : next;
|
|
945
|
+
});
|
|
946
|
+
setHasSession(next !== '');
|
|
947
|
+
if (next === '') setPhase('closed');
|
|
948
|
+
};
|
|
949
|
+
sync();
|
|
950
|
+
let stop = null;
|
|
951
|
+
try {
|
|
952
|
+
stop = subscribeSessions(sync);
|
|
953
|
+
} catch (thrown) {
|
|
954
|
+
stop = null;
|
|
955
|
+
}
|
|
956
|
+
return function () {
|
|
957
|
+
if (typeof stop === 'function') stop();
|
|
958
|
+
};
|
|
959
|
+
}, []);
|
|
960
|
+
|
|
908
961
|
React.useEffect(
|
|
909
962
|
function () {
|
|
910
963
|
if (toast === null) return undefined;
|
|
@@ -998,7 +1051,8 @@ window.__ModuleLoader__.load({
|
|
|
998
1051
|
[phase, closing],
|
|
999
1052
|
);
|
|
1000
1053
|
|
|
1001
|
-
/* ESC backs out of the page.
|
|
1054
|
+
/* ESC backs out of the page; a click on the area outside the page does the same.
|
|
1055
|
+
mousedown (not click) so a drag that starts inside the page never counts. */
|
|
1002
1056
|
React.useEffect(
|
|
1003
1057
|
function () {
|
|
1004
1058
|
if (phase !== 'page') return undefined;
|
|
@@ -1008,9 +1062,17 @@ window.__ModuleLoader__.load({
|
|
|
1008
1062
|
backToCard();
|
|
1009
1063
|
}
|
|
1010
1064
|
}
|
|
1065
|
+
function onDown(event) {
|
|
1066
|
+
const backdrop = document.querySelector('[data-bm-backdrop="1"]');
|
|
1067
|
+
if (!backdrop) return;
|
|
1068
|
+
if (backdrop.contains(event.target) && event.target !== backdrop) return;
|
|
1069
|
+
backToCard();
|
|
1070
|
+
}
|
|
1011
1071
|
document.addEventListener('keydown', onKey, true);
|
|
1072
|
+
document.addEventListener('mousedown', onDown, true);
|
|
1012
1073
|
return function () {
|
|
1013
1074
|
document.removeEventListener('keydown', onKey, true);
|
|
1075
|
+
document.removeEventListener('mousedown', onDown, true);
|
|
1014
1076
|
};
|
|
1015
1077
|
},
|
|
1016
1078
|
[phase],
|
|
@@ -1101,7 +1163,7 @@ window.__ModuleLoader__.load({
|
|
|
1101
1163
|
h('span', { key: 't', className: 'bm-card-item-title' }, displayTitleOf(item.entry)),
|
|
1102
1164
|
sub !== '' ? h('span', { key: 's', className: 'bm-card-item-sub' }, sub) : null,
|
|
1103
1165
|
]),
|
|
1104
|
-
h('span', { key: 'tag', className: 'bm-card-tag' }, SCOPE_TAG[item.scope] || item.scope),
|
|
1166
|
+
h('span', { key: 'tag', className: 'bm-card-tag', 'data-bm-scope': item.scope }, SCOPE_TAG[item.scope] || item.scope),
|
|
1105
1167
|
];
|
|
1106
1168
|
items.push(
|
|
1107
1169
|
h(
|
|
@@ -1156,6 +1218,9 @@ window.__ModuleLoader__.load({
|
|
|
1156
1218
|
),
|
|
1157
1219
|
]),
|
|
1158
1220
|
h('div', { key: 'body', className: 'bm-card-body' }, cardBody()),
|
|
1221
|
+
count > 0
|
|
1222
|
+
? h('div', { key: 'foot', className: 'bm-card-foot' }, '点一行即可复制;齿轮里管理全部')
|
|
1223
|
+
: null,
|
|
1159
1224
|
toast !== null ? h('div', { key: 'toast', className: 'bm-card-toast', role: 'status' }, toast) : null,
|
|
1160
1225
|
],
|
|
1161
1226
|
);
|
|
@@ -1209,6 +1274,8 @@ window.__ModuleLoader__.load({
|
|
|
1209
1274
|
]);
|
|
1210
1275
|
}
|
|
1211
1276
|
|
|
1277
|
+
if (hasSession === false) return null;
|
|
1278
|
+
|
|
1212
1279
|
let overlay = null;
|
|
1213
1280
|
if (phase === 'card') overlay = cardNode();
|
|
1214
1281
|
else if (phase === 'page') overlay = pageNode();
|
|
@@ -1324,7 +1391,7 @@ window.__ModuleLoader__.load({
|
|
|
1324
1391
|
host.setAttribute('data-better-memo-overlay', '');
|
|
1325
1392
|
document.body.appendChild(host);
|
|
1326
1393
|
const root = ReactDOMClient.createRoot(host);
|
|
1327
|
-
root.render(h(OverlayEntry, { seat: deps.seat, getSessionId: deps.getSessionId, variant: 'floating' }));
|
|
1394
|
+
root.render(h(OverlayEntry, { seat: deps.seat, getSessionId: deps.getSessionId, subscribe: deps.subscribe, variant: 'floating' }));
|
|
1328
1395
|
} catch (thrown) {
|
|
1329
1396
|
console.error('[better-memo] floating entry failed', thrown);
|
|
1330
1397
|
}
|
|
@@ -1338,6 +1405,17 @@ window.__ModuleLoader__.load({
|
|
|
1338
1405
|
getSessionId: function () {
|
|
1339
1406
|
return currentSessionId(ctx);
|
|
1340
1407
|
},
|
|
1408
|
+
/* Sessions list changes decide whether a conversation is on screen at
|
|
1409
|
+
all; the capsule hides itself while the welcome screen is up. */
|
|
1410
|
+
subscribe: function (listener) {
|
|
1411
|
+
try {
|
|
1412
|
+
const sessions = typeof ctx.get === 'function' ? ctx.get('sessions') : undefined;
|
|
1413
|
+
if (!sessions || !sessions.list || typeof sessions.list.subscribe !== 'function') return null;
|
|
1414
|
+
return sessions.list.subscribe(listener);
|
|
1415
|
+
} catch (thrown) {
|
|
1416
|
+
return null;
|
|
1417
|
+
}
|
|
1418
|
+
},
|
|
1341
1419
|
};
|
|
1342
1420
|
|
|
1343
1421
|
let overlayMounted = false;
|
|
@@ -1361,7 +1439,7 @@ window.__ModuleLoader__.load({
|
|
|
1361
1439
|
slots.register(
|
|
1362
1440
|
{ name: TOPBAR_SLOT, id: CAPSULE_ID, order: 0, label: function () { return '备忘录'; } },
|
|
1363
1441
|
function () {
|
|
1364
|
-
return h(OverlayEntry, { seat: seat, getSessionId: deps.getSessionId, variant: 'topbar' });
|
|
1442
|
+
return h(OverlayEntry, { seat: seat, getSessionId: deps.getSessionId, subscribe: deps.subscribe, variant: 'topbar' });
|
|
1365
1443
|
},
|
|
1366
1444
|
);
|
|
1367
1445
|
overlayMounted = true;
|
package/index.js
CHANGED
|
@@ -55,6 +55,7 @@ function shape(entry) {
|
|
|
55
55
|
return {
|
|
56
56
|
id: entry.id,
|
|
57
57
|
scope: entry.scope,
|
|
58
|
+
sessionId: entry.sessionId,
|
|
58
59
|
title: entry.title,
|
|
59
60
|
body: entry.body,
|
|
60
61
|
done: entry.done,
|
|
@@ -217,13 +218,13 @@ export function apply(ctx, config = {}) {
|
|
|
217
218
|
ctx.tools.register({
|
|
218
219
|
name: 'memo_edit',
|
|
219
220
|
description:
|
|
220
|
-
'新增 / 修改 / 删除备忘录。op=add 需要
|
|
221
|
-
'op=update / op=delete 需要 id。只能改自己看得到的 session / profile 条目,user 条目改不了。',
|
|
221
|
+
'新增 / 修改 / 删除备忘录。op=add 需要 title 或 body,scope 默认 session(归本会话),' +
|
|
222
|
+
'要共享才写 profile;op=update / op=delete 需要 id。只能改自己看得到的 session / profile 条目,user 条目改不了。',
|
|
222
223
|
parameters: schema(
|
|
223
224
|
{
|
|
224
225
|
op: { type: 'string', enum: ['add', 'update', 'delete'], description: '要做的操作。' },
|
|
225
226
|
id: { type: 'string', description: 'update / delete 用的条目 id(memo_list 返回的那个)。' },
|
|
226
|
-
scope: { type: 'string', enum: AGENT_SCOPES, description: 'add
|
|
227
|
+
scope: { type: 'string', enum: AGENT_SCOPES, description: 'add 用:默认 session,只给本会话;写 profile 才会给本 profile 所有会话。' },
|
|
227
228
|
title: { type: 'string', description: `一句话标题,最多 ${LIMITS.title} 字。` },
|
|
228
229
|
body: { type: 'string', description: `正文,最多 ${LIMITS.body} 字。` },
|
|
229
230
|
done: { type: 'boolean', description: 'update 用:是否标记为已完成。' },
|
|
@@ -239,8 +240,12 @@ export function apply(ctx, config = {}) {
|
|
|
239
240
|
const op = args?.op;
|
|
240
241
|
try {
|
|
241
242
|
if (op === 'add') {
|
|
243
|
+
const scope = args?.scope === undefined ? 'session' : args?.scope;
|
|
244
|
+
if (AGENT_SCOPES.includes(scope) === false) {
|
|
245
|
+
return { ok: false, error: `scope must be one of ${AGENT_SCOPES.join('|')} (you cannot write "user")` };
|
|
246
|
+
}
|
|
242
247
|
const entry = addEntry(db, {
|
|
243
|
-
scope
|
|
248
|
+
scope,
|
|
244
249
|
sessionId,
|
|
245
250
|
profile,
|
|
246
251
|
title: args?.title,
|
package/lib/store.js
CHANGED
|
@@ -174,7 +174,7 @@ export function addEntry(db, input) {
|
|
|
174
174
|
const entry = {
|
|
175
175
|
id: newId(),
|
|
176
176
|
scope,
|
|
177
|
-
sessionId:
|
|
177
|
+
sessionId: str(input.sessionId, 128) || null,
|
|
178
178
|
profile: scope === 'session' ? str(input.profile, 64) || 'default' : str(input.profile, 64) || 'default',
|
|
179
179
|
title,
|
|
180
180
|
body,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-better-memo",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "A popout memo card for DeepSeek Harness: top-bar capsule, one-line memos you copy with a click, three scopes (this session / this profile / you only) and agent tools to read and edit them. 浮窗备忘录:顶栏胶囊、点一条即复制、三档归属。",
|
|
6
6
|
"type": "module",
|