@agy-daddy/plugin-chat-nav 1.1.0 → 1.1.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/README.md CHANGED
@@ -1,3 +1,111 @@
1
1
  # @agy-daddy/plugin-chat-nav
2
2
 
3
- Agy-Daddy Layer-2 官方插件:对话右侧悬浮导航、对话关键词/正则全文检索、思考块防折叠守卫、扩展位(`chat.navButtons`)、复制会话 ID、多格式导出(MD/HTML/PDF + 保存对话框/默认路径配置)、内联文件编辑与 Cmd+安全外链。
3
+ Agy-Daddy 官方 Layer 2 对话栏增强插件:右侧悬浮导航栏、思考块锁定、产物内联编辑、全文检索与多格式导出(MD/HTML/PDF)。
4
+
5
+ - **npm 包名**:`@agy-daddy/plugin-chat-nav`
6
+ - **Layer 层级**:Layer 2(对话交互与导出层)
7
+ - **信任等级**:官方 `T0`(声明 `dom:read`、`dom:write`、`rpc:read`、`bridge:route`、`process:spawn`、`fs:brain-read`、`fs:user-files` 权限)
8
+ - **适用场景**:长会话快速顶底定位、思考块批量展开、代码产物内联直改、对话全文检索及归档导出。
9
+
10
+ ---
11
+
12
+ ## 核心功能与安全默认值
13
+
14
+ - **右侧悬浮导航栏**:动态贴合对话区右侧边缘,提供一键直达顶部、直达底部、展开思考块、全文检索及复制会话 ID 按钮。
15
+ - **左侧会话导轨与悬停大纲**:在对话区左侧展示章节刻度导轨,悬停展开快速大纲,支持「全部 / 关键提问 / 含代码」筛选及二级标题跳转。
16
+ - **代码块 Sticky 吸顶与长代码块折叠**:Markdown 与 Artifacts 代码块顶栏滚动吸顶;已完成且 `>= 48` 行的代码块支持手动折叠/展开,折叠时自动补偿视口滚动防止跳动。
17
+ - **Alt+↑/↓ 快捷轮次跳转**:在非编辑焦点下使用 `Alt+↑` / `Alt+↓` 快速定位上一轮或下一轮对话。
18
+ - **产物文件头内联编辑**:在对话生成的代码块头部提供直接编辑并保存回工作区文件的能力。
19
+ - **全文检索与高亮定位**:支持普通关键字与正则表达式模式,在多轮对话中精准跳转。
20
+ - **多格式本地导出**:纯函数本地渲染 Markdown、HTML 与 PDF,零网络外传。
21
+ - **安全默认值**:
22
+ - `keepThinkingExpanded: false`:默认折叠思考块保持视窗清爽;
23
+ - `exportSaveBehavior: "dialog"`:导出时默认弹窗确认保存路径,防止静默写入覆盖本地文件。
24
+
25
+ ---
26
+
27
+ ## 安装与启用方式
28
+
29
+ ### 1. 随官方全量安装
30
+ ```sh
31
+ agy-daddy plugin install --official
32
+ ```
33
+
34
+ ### 2. 单独安装
35
+ ```sh
36
+ agy-daddy plugin install npm:@agy-daddy/plugin-chat-nav
37
+ ```
38
+
39
+ ### 3. 宿主设置中心与交互
40
+ 安装后自动激活(`onStartup`)。在对话区右侧自动呈现浮动导航栏,并在对话操作栏扩展按钮。用户可在设置中心「对话栏增强」中配置导出格式偏好与快捷行为。
41
+
42
+ ---
43
+
44
+ ## 配置项说明表
45
+
46
+ 对照 `settings.schema.json`:
47
+
48
+ | Key | 类型 | 默认值 | 说明 |
49
+ |---|---|---|---|
50
+ | `showFloatDock` | `boolean` | `true` | 右侧悬浮导航条:在对话区右下侧显示浮动操作栏(直达顶部/底部、思考块开关与全文搜索) |
51
+ | `showOutlineRail` | `boolean` | `true` | 左侧会话导轨与悬停大纲:展示章节刻度导轨,悬停展开大纲并支持关键提问筛选 |
52
+ | `enableTurnShortcuts` | `boolean` | `true` | Alt+↑/↓ 快捷轮次跳转:非编辑焦点下按 Alt+↑ / Alt+↓ 切换上下轮对话 |
53
+ | `enableCodeBlockSticky` | `boolean` | `true` | 代码块顶栏 Sticky 吸顶:Markdown 与 Artifacts 代码块滚动时保持顶栏可见 |
54
+ | `enableCodeBlockFold` | `boolean` | `true` | 长代码块折叠/展开开关:已完成长代码块支持折叠展开并自动补偿滚动视口 |
55
+ | `codeFoldMinLines` | `number` | `48` | 触发折叠的最小行数:达到或超过该行数显示手动折叠按钮 |
56
+ | `keepThinkingExpanded` | `boolean` | `false` | 锁定思考块保持展开:开启后新进入会话或加载新轮次时,思考内容默认自动展开 |
57
+ | `enableInlineFileEditor` | `boolean` | `true` | 产物文件头内联编辑:在产物卡片与代码块头部提供直接查看与保存原文件的内联编辑器 |
58
+ | `enableCmdClickLinks` | `boolean` | `true` | Cmd/Ctrl+点击安全打开外链:按住 Cmd/Ctrl 键点击对话中的 http/https 链接直接调用外部浏览器打开 |
59
+ | `searchRegexMode` | `boolean` | `false` | 全文检索默认启用正则:会话内快速检索时默认启用正则表达式匹配 |
60
+ | `searchCaseSensitive` | `boolean` | `false` | 全文检索区分大小写:检索消息内容时是否严格匹配大小写 |
61
+ | `exportSaveBehavior` | `enum` | `"dialog"` | 默认保存行为:`dialog`(每次弹出系统保存文件对话框)或 `auto`(静默自动保存至下方默认文件夹) |
62
+ | `exportSaveDir` | `string` | `""` | 默认保存路径:自动保存时的目录路径;可手动输入或点击「选择」 |
63
+ | `exportFormats` | `list` | `["md"]` | 允许导出文件格式:批量导出时支持的格式列表(可选 md, html, pdf) |
64
+
65
+ ---
66
+
67
+ ## 提供的服务 / 事件 / 命令 / 扩展位
68
+
69
+ 严格依据 `agy-plugin.json` 声明:
70
+
71
+ - **Permissions**:`dom:read`、`dom:write`、`rpc:read`、`bridge:route`、`process:spawn`、`fs:brain-read`、`fs:user-files`
72
+ - **Requires Anchors**:
73
+ - `chat.scrollViewport`:对话滚动视口锚点(用于精准顶底滚动与视口定位)
74
+ - `chat.messageList`:消息列表容器锚点(用于检索高亮与消息遍历)
75
+ - `chat.thinkingTrigger`:思考块切换按钮锚点(用于思考块展开/折叠状态监听与锁定)
76
+ - **Services (provides)**:
77
+ - `chat-nav`(版本 `1.0.0`,realm: `page-isolated`)
78
+ - `chat-nav-node`(版本 `1.0.0`,realm: `node`)
79
+ - **Surfaces (provides)**:
80
+ - `chat.navButtons`:对话区导航按钮扩展插槽
81
+ - **Events (provides)**:
82
+ - `chat:thinking-expanded@1`:思考块展开事件广播
83
+ - **States (provides)**:
84
+ - `state:chat-nav.search@1`:全文检索过滤状态
85
+ - **Commands (contributes)**:
86
+ - `chat-nav.scroll-top`:滚动到对话顶部
87
+ - `chat-nav.scroll-bottom`:滚动到对话底部
88
+ - `chat-nav.expand-thinking`:展开全部思考块
89
+ - `chat-nav.search`:执行对话全文检索
90
+ - `chat-nav.copy-id`:复制当前会话 ID
91
+ - `chat-nav.export-md`:导出当前对话为 Markdown
92
+ - `chat-nav.export`:导出当前对话 (MD/HTML/PDF)
93
+ - `chat-nav.export-all`:批量导出当前对话为全部所选格式
94
+ - `chat-nav.browseExportDir`:选择默认导出保存文件夹
95
+ - `chat-nav.toggle-outline`:切换会话快速大纲
96
+ - `chat-nav.collapse-long-code`:折叠或展开长代码块
97
+ - `chat-nav.turn-prev`:跳转到上一轮对话
98
+ - `chat-nav.turn-next`:跳转到下一轮对话
99
+
100
+ ---
101
+
102
+ ## 使用示例与本地测试
103
+
104
+ ### 使用示例
105
+ 在动辄数十轮的长对话中,点击悬浮导航条的搜索图标,输入检索关键字,页面平滑滚动并高亮命中消息;点击导出按钮,即可秒级生成美观规范的 Markdown 或 PDF 归档文件。
106
+
107
+ ### 本地测试
108
+ 在插件目录下执行自动化单元测试:
109
+ ```sh
110
+ npm test
111
+ ```
package/agy-plugin.json CHANGED
@@ -2,15 +2,15 @@
2
2
  "schemaVersion": 1,
3
3
  "id": "agy-daddy.chat-nav",
4
4
  "publisher": "agy-daddy",
5
- "version": "1.1.0",
5
+ "version": "1.1.2",
6
6
  "license": "MIT",
7
7
  "displayName": {
8
8
  "zh-CN": "对话栏增强",
9
9
  "en": "Chat Navigation & Editor"
10
10
  },
11
11
  "description": {
12
- "zh-CN": "右侧悬浮对话导航条、对话关键词/正则全文检索、思考块锁定、快捷会话切换、复制会话 ID、多格式对话导出(MD/HTML/PDF)、内联文件编辑与安全外链",
13
- "en": "Floating chat navigation dock, keyword/regex conversation search, thinking expand guard, conversation switching, copy session ID, multi-format export (MD/HTML/PDF), inline file editor, and safe external links"
12
+ "zh-CN": "右侧悬浮对话导航条、左侧章节导轨大纲、代码块吸顶与长代码智能折叠、Alt+↑/↓ 轮次跳转、对话关键词/正则全文检索、思考块锁定、复制会话 ID、多格式对话导出(MD/HTML/PDF)、内联文件编辑与安全外链",
13
+ "en": "Floating chat navigation dock, left chapter rail & hover outline, sticky/foldable code blocks, Alt+Up/Down turn shortcuts, keyword/regex search, thinking expand guard, copy session ID, multi-format export (MD/HTML/PDF), inline file editor, and safe external links"
14
14
  },
15
15
  "engines": {
16
16
  "agyDaddy": "^1.0.0",
@@ -19,18 +19,36 @@
19
19
  "main": "./src/node.js",
20
20
  "renderer": "./src/renderer.js",
21
21
  "world": "isolated",
22
- "activationEvents": ["onStartup"],
22
+ "activationEvents": [
23
+ "onStartup"
24
+ ],
23
25
  "requires": {
24
- "anchors": ["chat.scrollViewport", "chat.messageList", "chat.thinkingTrigger"]
26
+ "anchors": [
27
+ "chat.scrollViewport",
28
+ "chat.messageList",
29
+ "chat.thinkingTrigger"
30
+ ]
25
31
  },
26
32
  "provides": {
27
33
  "services": {
28
- "chat-nav": { "version": "1.0.0", "realm": "page-isolated" },
29
- "chat-nav-node": { "version": "1.0.0", "realm": "node" }
34
+ "chat-nav": {
35
+ "version": "1.0.0",
36
+ "realm": "page-isolated"
37
+ },
38
+ "chat-nav-node": {
39
+ "version": "1.0.0",
40
+ "realm": "node"
41
+ }
30
42
  },
31
- "events": ["chat:thinking-expanded@1"],
32
- "states": ["state:chat-nav.search@1"],
33
- "surfaces": ["chat.navButtons"]
43
+ "events": [
44
+ "chat:thinking-expanded@1"
45
+ ],
46
+ "states": [
47
+ "state:chat-nav.search@1"
48
+ ],
49
+ "surfaces": [
50
+ "chat.navButtons"
51
+ ]
34
52
  },
35
53
  "permissions": [
36
54
  "dom:read",
@@ -42,17 +60,101 @@
42
60
  "fs:user-files"
43
61
  ],
44
62
  "contributes": {
45
- "settings": { "schema": "./settings.schema.json" },
63
+ "settings": {
64
+ "schema": "./settings.schema.json"
65
+ },
46
66
  "commands": [
47
- { "id": "chat-nav.scroll-top", "title": { "zh-CN": "滚动到对话顶部", "en": "Scroll to top" } },
48
- { "id": "chat-nav.scroll-bottom", "title": { "zh-CN": "滚动到对话底部", "en": "Scroll to bottom" } },
49
- { "id": "chat-nav.expand-thinking", "title": { "zh-CN": "展开全部思考块", "en": "Expand thinking blocks" } },
50
- { "id": "chat-nav.search", "title": { "zh-CN": "执行对话全文检索", "en": "Search conversation messages" } },
51
- { "id": "chat-nav.copy-id", "title": { "zh-CN": "复制当前会话 ID", "en": "Copy current session ID" } },
52
- { "id": "chat-nav.export-md", "title": { "zh-CN": "导出当前对话为 Markdown", "en": "Export conversation as Markdown" } },
53
- { "id": "chat-nav.export", "title": { "zh-CN": "导出当前对话 (MD/HTML/PDF)", "en": "Export conversation (MD/HTML/PDF)" } },
54
- { "id": "chat-nav.export-all", "title": { "zh-CN": "批量导出当前对话为全部所选格式", "en": "Export conversation in all selected formats" } },
55
- { "id": "chat-nav.browseExportDir", "title": { "zh-CN": "选择默认导出保存文件夹", "en": "Browse default export directory" } }
67
+ {
68
+ "id": "chat-nav.scroll-top",
69
+ "title": {
70
+ "zh-CN": "滚动到对话顶部",
71
+ "en": "Scroll to top"
72
+ }
73
+ },
74
+ {
75
+ "id": "chat-nav.scroll-bottom",
76
+ "title": {
77
+ "zh-CN": "滚动到对话底部",
78
+ "en": "Scroll to bottom"
79
+ }
80
+ },
81
+ {
82
+ "id": "chat-nav.expand-thinking",
83
+ "title": {
84
+ "zh-CN": "展开全部思考块",
85
+ "en": "Expand thinking blocks"
86
+ }
87
+ },
88
+ {
89
+ "id": "chat-nav.search",
90
+ "title": {
91
+ "zh-CN": "执行对话全文检索",
92
+ "en": "Search conversation messages"
93
+ }
94
+ },
95
+ {
96
+ "id": "chat-nav.copy-id",
97
+ "title": {
98
+ "zh-CN": "复制当前会话 ID",
99
+ "en": "Copy current session ID"
100
+ }
101
+ },
102
+ {
103
+ "id": "chat-nav.export-md",
104
+ "title": {
105
+ "zh-CN": "导出当前对话为 Markdown",
106
+ "en": "Export conversation as Markdown"
107
+ }
108
+ },
109
+ {
110
+ "id": "chat-nav.export",
111
+ "title": {
112
+ "zh-CN": "导出当前对话 (MD/HTML/PDF)",
113
+ "en": "Export conversation (MD/HTML/PDF)"
114
+ }
115
+ },
116
+ {
117
+ "id": "chat-nav.export-all",
118
+ "title": {
119
+ "zh-CN": "批量导出当前对话为全部所选格式",
120
+ "en": "Export conversation in all selected formats"
121
+ }
122
+ },
123
+ {
124
+ "id": "chat-nav.browseExportDir",
125
+ "title": {
126
+ "zh-CN": "选择默认导出保存文件夹",
127
+ "en": "Browse default export directory"
128
+ }
129
+ },
130
+ {
131
+ "id": "chat-nav.toggle-outline",
132
+ "title": {
133
+ "zh-CN": "切换会话快速大纲",
134
+ "en": "Toggle conversation outline"
135
+ }
136
+ },
137
+ {
138
+ "id": "chat-nav.collapse-long-code",
139
+ "title": {
140
+ "zh-CN": "折叠或展开长代码块",
141
+ "en": "Toggle long code blocks"
142
+ }
143
+ },
144
+ {
145
+ "id": "chat-nav.turn-prev",
146
+ "title": {
147
+ "zh-CN": "跳转到上一轮对话",
148
+ "en": "Jump to previous turn"
149
+ }
150
+ },
151
+ {
152
+ "id": "chat-nav.turn-next",
153
+ "title": {
154
+ "zh-CN": "跳转到下一轮对话",
155
+ "en": "Jump to next turn"
156
+ }
157
+ }
56
158
  ],
57
159
  "locales": "./locales"
58
160
  }
package/locales/en.json CHANGED
@@ -6,5 +6,12 @@
6
6
  "nav.think": "Expand Thinking",
7
7
  "nav.copyId": "Copy Session ID",
8
8
  "nav.exportMd": "Export Conversation",
9
- "search.placeholder": "Search messages (regex supported)..."
9
+ "search.placeholder": "Search messages (regex supported)...",
10
+ "code.fold": "Collapse",
11
+ "code.expand": "Expand",
12
+ "code.copy": "Copy",
13
+ "outline.title": "Conversation Outline",
14
+ "outline.all": "All",
15
+ "outline.questions": "Key Questions",
16
+ "outline.code": "With Code"
10
17
  }
@@ -6,5 +6,12 @@
6
6
  "nav.think": "展开思考",
7
7
  "nav.copyId": "复制会话 ID",
8
8
  "nav.exportMd": "导出对话",
9
- "search.placeholder": "搜索当前对话 (支持正则)..."
9
+ "search.placeholder": "搜索当前对话 (支持正则)...",
10
+ "code.fold": "折叠",
11
+ "code.expand": "展开",
12
+ "code.copy": "复制",
13
+ "outline.title": "会话大纲",
14
+ "outline.all": "全部",
15
+ "outline.questions": "关键提问",
16
+ "outline.code": "含代码"
10
17
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agy-daddy/plugin-chat-nav",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "Agy-Daddy floating chat navigation, thinking expand guard, search slot, copy session ID, multi-format export (MD/HTML/PDF), inline file editor, and safe external link plugin",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -8,6 +8,48 @@
8
8
  "label": { "zh-CN": "右侧悬浮导航条", "en": "Floating navigation dock" },
9
9
  "description": { "zh-CN": "在对话视口右侧显示置顶、置底、上/下一轮、思考展开、复制会话 ID 与导出 Markdown 控制栏", "en": "Show top, bottom, turn step, thinking, copy session ID, and Markdown export controls alongside chat" }
10
10
  },
11
+ {
12
+ "key": "showOutlineRail",
13
+ "type": "boolean",
14
+ "default": true,
15
+ "label": { "zh-CN": "左侧会话导轨与悬停大纲", "en": "Left outline rail & hover index" },
16
+ "description": { "zh-CN": "在对话区左侧展示章节刻度导轨,悬停展开快速大纲并支持关键提问筛选", "en": "Show chapter ticks on the left edge of chat with hover outline and key-question filtering" }
17
+ },
18
+ {
19
+ "key": "enableTurnShortcuts",
20
+ "type": "boolean",
21
+ "default": true,
22
+ "label": { "zh-CN": "Alt+↑/↓ 快捷轮次跳转", "en": "Alt+Up/Down turn navigation shortcuts" },
23
+ "description": { "zh-CN": "非编辑焦点下按 Alt+↑ / Alt+↓ 快速定位上一轮或下一轮对话", "en": "Press Alt+Up / Alt+Down outside editable inputs to jump between conversation turns" }
24
+ },
25
+ {
26
+ "key": "enableCodeBlockSticky",
27
+ "type": "boolean",
28
+ "default": true,
29
+ "group": { "zh-CN": "代码块增强", "en": "Code Blocks" },
30
+ "label": { "zh-CN": "代码块顶栏 Sticky 吸顶", "en": "Sticky code block headers" },
31
+ "description": { "zh-CN": "滚动长会话或 Artifacts 时保持代码块顶栏语言标签与操作按钮可见", "en": "Keep code block language label and actions pinned while scrolling Markdown or Artifacts" }
32
+ },
33
+ {
34
+ "key": "enableCodeBlockFold",
35
+ "type": "boolean",
36
+ "default": true,
37
+ "group": { "zh-CN": "代码块增强", "en": "Code Blocks" },
38
+ "label": { "zh-CN": "长代码块折叠/展开开关", "en": "Long code block fold toggle" },
39
+ "description": { "zh-CN": "为已完成且超过阈值的长代码块提供折叠/展开开关,折叠时自动补偿视口滚动防止跳动", "en": "Add collapse/expand controls to completed long code blocks with scroll-jump compensation" }
40
+ },
41
+ {
42
+ "key": "codeFoldMinLines",
43
+ "type": "number",
44
+ "min": 12,
45
+ "max": 500,
46
+ "default": 48,
47
+ "group": { "zh-CN": "代码块增强", "en": "Code Blocks" },
48
+ "unit": { "zh-CN": "行", "en": "lines" },
49
+ "placeholder": "48",
50
+ "label": { "zh-CN": "触发折叠的最小行数", "en": "Minimum lines for folding" },
51
+ "description": { "zh-CN": "已完成代码块达到或超过该行数时显示手动折叠开关(默认 48 行)", "en": "Show fold toggle when a completed code block reaches at least this many lines (default 48)" }
52
+ },
11
53
  {
12
54
  "key": "keepThinkingExpanded",
13
55
  "type": "boolean",