dsh-tiddlywiki 0.16.13 → 0.16.15
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/LICENSE +21 -21
- package/README.md +4 -1
- package/cordis.patch.yml +13 -13
- package/lib/client.bundle.js +32 -26
- package/lib/client.js +32 -26
- package/lib/index.js +33 -6
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
- package/src/client/endpoints.ts +10 -10
- package/src/client/markdown-editor.ts +128 -128
- package/src/client/quick-note-dock.ts +133 -133
- package/src/client/session-summary.ts +223 -31
- package/src/client/state.ts +39 -39
- package/src/client/styles.ts +6 -0
- package/src/client/theme-sync.ts +312 -312
- package/src/client/toast.ts +22 -22
- package/src/client/tool-views.ts +604 -604
- package/src/client/ui-config.ts +44 -44
- package/src/host/http.ts +57 -57
- package/src/host/seed-render.ts +66 -66
- package/src/host/seed-send-to-agent.ts +63 -63
- package/src/host/seeds.ts +299 -299
- package/src/host/session-summary.ts +422 -422
- package/src/host/tools.ts +33 -8
- package/src/host/tw-api.ts +231 -231
- package/src/host/wiki.ts +299 -299
- package/src/index.ts +2 -0
- package/src/sdk.ts +204 -204
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 dsh-tiddlywiki contributors
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 dsh-tiddlywiki contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -35,6 +35,8 @@
|
|
|
35
35
|
|
|
36
36
|
> 最近几个主要版本的一句话更新记录(完整变更见 git log / Releases)。
|
|
37
37
|
|
|
38
|
+
- **v0.16.15**(2026-09-07):**修:agent 写笔记不指定内容类型 → 显示解析错乱;现在自动默认 `text/markdown`**。`tiddlywiki_put` / `tiddlywiki_batch_put` 组装 tiddler 时从不设 `type`,TW 把无 type 条目按 wikitext(`text/vnd.tiddlywiki`)解析,agent 写的 Markdown 正文(`##`、`**`、列表…)全部原样显示。修复:两工具在写入前对**未指定类型**的条目自动补 `type: text/markdown`(`$:/` 系统条目除外——config/插件内部件不能被强标 markdown;显式传 `fields.type` 仍然生效,可写 `text/vnd.tiddlywiki`);工具输出新增「类型: …(未指定,已默认 markdown)」让 agent 可见。**顺带修掉一个隐患**:工具描述与 README 里的 `fields` 示例原来是 `{"type":"meeting","date":…}`——`type` 是 TW 的**内容类型保留字段**,agent 照抄示例会把内容类型写成 `meeting`、渲染直接坏掉——示例改为 `{"date":…}` 并在描述/注入提示词里明确警告「业务分类放 tags,不要放 fields.type」。注入提示词新增「**内容类型约定**」段(默认 markdown、如何写 wikitext、fields.type 警告)。host 改动:`npm run build:host` + **重启 dsh web** 后生效(提示词/工具都是启动时装配)。
|
|
39
|
+
- **v0.16.14**(2026-09-07):**修:「知识库」Tab 仍显示「佚失条目」——根因是浏览器端 TW 根本看不到 `$:/temp`**。v0.16.13 的过滤/自愈治标不治本:TW 浏览器端同步机制天生排除 volatile 条目——服务端 recipe 列表默认 `[all[tiddlers]!is[system]]`(`get-tiddlers-json.js`),tiddlyweb adaptor 的请求过滤器又显式 `-[prefix[$:/temp/]]`(`tiddlywebadaptor.js getSkinnyTiddlers`),lazyLoad 只补「已知 skinny」不拉「完全缺失」——所以 iframe 里的 TW 永远拿不到 `$:/temp/dsh/session-summary/<会话ID>`,`#<标题>` hash 直达必然渲染「佚失条目」,客户端再怎么自动重新生成也无济于事(服务端有、浏览器没有)。修复(纯客户端,host 无变化):iframe **不带 hash** 挂载(注入落地前盖加载浮层,不闪现默认页),就绪后由客户端**注入**——同源 `/get` 读回汇总字段 → `iframe.contentWindow.$tw.wiki.addTiddler(...)` 写进 iframe 的 TW store → 设 `contentWindow.location.hash` 走 TW 原生 hash 导航(与中央面板 `openTiddler` 同一机制,落地重试绕开 boot 时序竞争);自愈升级:30s 探测在「服务端丢失(TW 重启)→ 重新生成」之外,新增「服务端仍在而 iframe store 丢失(iframe 自身重载)→ 重新注入并导航」,不打扰用户在 iframe 内的浏览。汇总条目仍只存在于服务端内存 + iframe 内存——**不落盘、不进 git、重启即消失(设计不变)**。刷新页面即生效。
|
|
38
40
|
- **v0.16.13**(2026-09-07):**修:会话「知识库」Tab 出现「佚失条目」**。① 汇总内容里的死链/垃圾条目:会话日志常混入模型的示例/残缺写法(`#…`、`#标题`、带反引号的截断链接),旧代码会把它们原样收进汇总并写成 `[[…`]]` 这种坏 wikitext,TW 渲染成「佚失条目」——现在采集时统一过滤(控制字符 / `]` `|` 反引号 `#` / `…` 占位 / 超长标题一律丢弃)。② 汇总条目本身是 volatile 的 `$:/temp`,**TW 重启即消失**,若 Tab 一直开着,iframe 会停在 TW 的「佚失条目」页——客户端新增自愈:每 30s 探测一次 `/get`,条目不存在就自动重新生成(连续 3 次仍缺失则交还手动「🔄 刷新」)。刷新页面 + 重启 dsh web 后,重新打开 Tab 即生成干净汇总。
|
|
39
41
|
- **v0.16.12**(2026-09-07):**深度代码优化(内部重构,行为不变)**。① **配置链修复**:`ui.sendToAgent`/`ui.allArticles` 默认值不再被 cordis 宽松类型吞掉(改为显式逐层合并),`uiLanguage` 不再被配置覆盖层丢弃;设置页「常规配置」补齐「发送给 Agent」开关/token/endpoint 字段(此前只在代码里生效、设置页没有)。② **去重**:新增 `src/host/http.ts`(路由/管理后台共用的 body 读取 + JSON 响应,删掉 3 份重复实现)与 `src/client/endpoints.ts`(`/status` 端点六处合一);`seeds.ts` 引入 `defineSeed` 工厂(每个 seed 的 id/标题/描述三处重复 + try/catch 样板全部收敛,7 项注册表缩到声明式);`tools.ts` 抽出 `requireWiki`(8 处重复守卫)与 `gitStatusBits`(git 状态文案两处合一);事件名常量统一(`NOTE_STATE_EVENT`/`PANEL_RELOAD_EVENT`)。③ **泄漏修复**:快速笔记卡片标签编辑器与「知识库」FAB 的 document 级监听器在卸载时正确移除;TW 面板的 40×150ms 哈希等待链在卸载后停止(不再驱动已移除 iframe);编辑器弹窗拖拽改用 Pointer Capture(鼠标在 iframe 上松手不再残留 window 监听);保存按钮/同步控制器加防连点与卸载后停轮询。④ **清理**:删除约 40 行无引用 CSS 与 2 个死导出(`mountNoteWidget`/`PANEL_VIEW_SELECTOR`);`admin.ts` 去掉无效的动态 import(消除构建警告);会话「知识库」汇总的笔记状态改为 8 路并发查询。已过 `typecheck` / `build` / `selftest`(含 `session/summary` 端到端用例)。
|
|
40
42
|
- **v0.16.11**(2026-09-06):**新:会话顶部「知识库」Tab(本会话相关 wiki 汇总)**。每个会话顶部在「对话 | 轨迹」旁新增 Tab(默认名「知识库」,`ui.tabLabel` 可改、`ui.showSessionTab` 可关),显示本会话**产生/读取/检索过的 wiki 笔记汇总**,**TW 原生渲染**(同源代理 iframe,不另造 UI)。后端新路由 `POST /dsh-tiddlywiki/session/summary`:用 DSH `sessionQuery.readSession` + `traceSession` 读**本会话 + 后代子代理**的完整事件日志,按 `tool/call` 的 `tiddlywiki_*` 工具名归类——产生 📝(put/batch_put/rename)、读取 👀(get + 助手回复 `/dsh-tiddlywiki/tw/#…` 链接)、检索 🔍(search/recent 记关键词);每篇列出当前标签/修改时间/是否已删除,仅子代理触达的标注「(子代理)」。汇总页写入 **volatile `$:/temp/dsh/session-summary/<会话ID>`**——已实测验证 TW 默认 SyncFilter 显式排除 `$:/temp`,**不落盘、不进 git、TW 重启即消失**。进入 Tab 自动生成、顶栏可手动刷新;侧边栏完整 TW 面板保持原样。本 Tab 判定来源(sessionQuery 服务、conversation.view 槽位契约、$:/temp 行为)均已通过 Inspect 与实测核实,并有 `selftest` 新增 `session/summary` 端到端用例覆盖。
|
|
@@ -108,7 +110,7 @@ dsh plugin --profile web add link:/path/to/your/dsh-tiddlywiki
|
|
|
108
110
|
| `tiddlywiki_recent` | `limit?`, `since?` | 最近修改的笔记(倒序),开工快速了解近期动态 |
|
|
109
111
|
| `tiddlywiki_list_tags` | — | 现有非系统 tag 及各自计数(按使用次数降序) |
|
|
110
112
|
| `tiddlywiki_get` | `title` | 读单个 tiddler 全文 |
|
|
111
|
-
| `tiddlywiki_put` | `title`, `text`, `tags?`, `fields?` | 写/覆盖 tiddler
|
|
113
|
+
| `tiddlywiki_put` | `title`, `text`, `tags?`, `fields?` | 写/覆盖 tiddler;**未指定内容类型时自动默认 `text/markdown`**(`$:/` 系统条目除外,v0.16.15);`fields` 可带业务字段(如 `{"date":"2026-09-02"}`)——⚠️ `fields.type` 是 TW 内容类型保留字段,勿写业务分类值(业务分类放 tags) |
|
|
112
114
|
| `tiddlywiki_batch_put` | `items[]`, `overwrite?` | 批量写入;`overwrite=false` 跳过已存在标题 |
|
|
113
115
|
| `tiddlywiki_rename` | `oldTitle`, `newTitle`, `updateRefs?` | 重命名 + 尽量更新其他 tiddler 里的 `[[旧]]`/`{{旧}}` 引用 |
|
|
114
116
|
| `tiddlywiki_delete` | `title` | 删除 tiddler(幂等) |
|
|
@@ -171,6 +173,7 @@ dsh plugin --profile web add link:/path/to/your/dsh-tiddlywiki
|
|
|
171
173
|
|
|
172
174
|
**📚 会话「知识库」Tab(本会话相关 wiki 汇总)** — 每个会话顶部在「对话 | 轨迹」旁新增一个 Tab(v0.16.11,默认名**「知识库」**,可在设置页改 `ui.tabLabel`;`ui.showSessionTab` 可整体关闭):
|
|
173
175
|
- 进入 Tab 自动生成当前会话的 wiki 汇总页,**TW 原生渲染**(复用同源代理 iframe + TW 自己的主题/链接/导航,不另造 UI);顶栏有「🔄 刷新」按钮可重新生成;
|
|
176
|
+
- 渲染机制(v0.16.14):浏览器端 TW 的同步过滤器天生排除 `$:/temp`(volatile 条目到不了 iframe),因此由客户端在 iframe 就绪后**注入**汇总条目(`addTiddler`)再走 TW 原生 hash 导航显示;
|
|
174
177
|
- 判定「哪些笔记和本会话相关」由后端 `POST /dsh-tiddlywiki/session/summary` 完成:用 DSH `sessionQuery` 读本会话(**含后代子代理**,`traceSession` 递归)的完整事件日志,按工具调用归类——**产生 📝**(`put`/`batch_put`/`rename`)、**读取 👀**(`get` + 助手回复里 `/dsh-tiddlywiki/tw/#…` 引用链接)、**检索 🔍**(`search`/`recent` 记关键词);每篇列出当前标签/修改时间/是否已删除,仅子代理触达的标注「(子代理)」;
|
|
175
178
|
- 汇总页写入 TW 的 **volatile 命名空间 `$:/temp/dsh/session-summary/<会话ID>`**——TW 默认 SyncFilter 显式排除 `$:/temp`,**不落盘、不进 git、TW 重启即消失**,绝不污染知识库;
|
|
176
179
|
- 与左侧边栏「TiddlyWiki」完整面板互不影响:那里保持原样,本 Tab 只是多一个快速入口。
|
package/cordis.patch.yml
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
# dsh-tiddlywiki bundle patch: inserts the plugin row into the web profile
|
|
2
|
-
# roster. Applied as a profile bundle layer (the `dsh.bundle.patch` manifest
|
|
3
|
-
# field) over dsh-base; activate with
|
|
4
|
-
# `dsh plugin --profile web add link:<path-to-this-package>` and restart dsh web.
|
|
5
|
-
#
|
|
6
|
-
# The row is a bare plugin by package name: the node half (exports ".") runs
|
|
7
|
-
# in the host process (WikiServer, routes, tiddlywiki_* tools, prompt section,
|
|
8
|
-
# auto-commit), and the `dsh.client` declaration in package.json makes the
|
|
9
|
-
# browser half (exports "./client", served at /plugins/dsh-tiddlywiki/client.js)
|
|
10
|
-
# load in the web GUI.
|
|
11
|
-
- insert:
|
|
12
|
-
- id: dsh-tiddlywiki
|
|
13
|
-
name: dsh-tiddlywiki
|
|
1
|
+
# dsh-tiddlywiki bundle patch: inserts the plugin row into the web profile
|
|
2
|
+
# roster. Applied as a profile bundle layer (the `dsh.bundle.patch` manifest
|
|
3
|
+
# field) over dsh-base; activate with
|
|
4
|
+
# `dsh plugin --profile web add link:<path-to-this-package>` and restart dsh web.
|
|
5
|
+
#
|
|
6
|
+
# The row is a bare plugin by package name: the node half (exports ".") runs
|
|
7
|
+
# in the host process (WikiServer, routes, tiddlywiki_* tools, prompt section,
|
|
8
|
+
# auto-commit), and the `dsh.client` declaration in package.json makes the
|
|
9
|
+
# browser half (exports "./client", served at /plugins/dsh-tiddlywiki/client.js)
|
|
10
|
+
# load in the web GUI.
|
|
11
|
+
- insert:
|
|
12
|
+
- id: dsh-tiddlywiki
|
|
13
|
+
name: dsh-tiddlywiki
|