@kirkchinese/dsh-citeciter 0.2.1 → 0.3.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/README.md +65 -38
- package/README.zh.md +59 -51
- package/lib/client.js +15928 -1067
- package/lib/index.js +1094 -242
- package/lib/topic-CjNNXSWB.js +211 -0
- package/lib/typert-common-CPi6bVCr.js +32 -0
- package/lib/typert.host.js +30 -11
- package/lib/typert.remote-client.js +2 -2
- package/lib/types/client/citation.d.ts +10 -0
- package/lib/types/client/companion-controller.d.ts +37 -0
- package/lib/types/client/components/CiteCiterSettings.d.ts +7 -0
- package/lib/types/client/components/CitePanel.d.ts +7 -10
- package/lib/types/client/components/SelectionMenu.d.ts +6 -11
- package/lib/types/client/index.d.ts +2 -2
- package/lib/types/client/markdown-source-map.d.ts +16 -0
- package/lib/types/client/response-guard.d.ts +4 -0
- package/lib/types/client/types.d.ts +16 -31
- package/lib/types/index.d.ts +33 -22
- package/lib/types/observer.d.ts +44 -0
- package/lib/types/topic-runtime.d.ts +50 -0
- package/lib/types/topic.d.ts +419 -0
- package/lib/types/typert-common.d.ts +177 -69
- package/lib/types/typert.host.d.ts +445 -58
- package/lib/types/typert.remote-client.d.ts +3 -8
- package/package.json +58 -32
- package/lib/thread-D7ig_Lk7.js +0 -68
- package/lib/typert-common-CLPMRe7a.js +0 -51
- package/lib/types/client/explainer-controller.d.ts +0 -31
- package/lib/types/client/explainer.d.ts +0 -5
- package/lib/types/client/thread.d.ts +0 -22
- package/lib/types/client/transcript.d.ts +0 -14
- package/lib/types/projection.d.ts +0 -4
- package/lib/types/read-only.d.ts +0 -13
- package/lib/types/thread.d.ts +0 -107
- package/lib/types/validation.d.ts +0 -4
package/README.md
CHANGED
|
@@ -1,65 +1,77 @@
|
|
|
1
1
|
# `@kirkchinese/dsh-citeciter`
|
|
2
2
|
|
|
3
|
-
**A learning companion
|
|
3
|
+
**A private learning companion for live DeepSeek Harness conversations.** Select text from a committed assistant model call, ask beside the selection, and continue the discussion in an independent CiteCiter Topic while the source Agent keeps working.
|
|
4
4
|
|
|
5
|
-
[中文说明](
|
|
5
|
+
[中文说明](README.zh.md) · [GitHub](https://github.com/kirkchinese/CiteCiter) · [Issues](https://github.com/kirkchinese/CiteCiter/issues)
|
|
6
6
|
|
|
7
|
-
> **Early development:** v0.
|
|
7
|
+
> **Early development:** v0.3 replaces ordinary DSH child Threads with private Observer Topics. APIs, storage, compatibility, and installation details may still change.
|
|
8
8
|
|
|
9
9
|
## Install
|
|
10
10
|
|
|
11
|
-
CiteCiter requires Node.js `^22.19.0 || >=24.0.0`, DSH Web, and a configured model provider.
|
|
11
|
+
CiteCiter requires Node.js `^22.19.0 || >=24.0.0`, DSH Web `>=0.1.0-rc.7 <0.1.0-rc.8` (tested on `0.1.0-rc.7`), and a configured model provider.
|
|
12
12
|
|
|
13
13
|
```sh
|
|
14
|
-
dsh plugin --profile web add @kirkchinese/dsh-citeciter@0.
|
|
14
|
+
dsh plugin --profile web add @kirkchinese/dsh-citeciter@0.3.0
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
-
Restart the corresponding DSH Web process and refresh the page
|
|
18
|
-
|
|
19
|
-
The package declares DSH peers from `^0.1.0-rc.6`. Focused builds use the rc.6 package set; the v0.2 browser flow was also verified on a fresh DSH `0.1.0-rc.7` process.
|
|
17
|
+
Restart the corresponding DSH Web process and refresh the page after installation or upgrade. The Host, Typert descriptors, and browser bundle are resolved when the process starts.
|
|
20
18
|
|
|
21
19
|
## Use
|
|
22
20
|
|
|
23
|
-
1. Select text
|
|
24
|
-
2. Right-click and choose `Citer!`.
|
|
25
|
-
3.
|
|
26
|
-
4. Continue with
|
|
27
|
-
5.
|
|
21
|
+
1. Select text inside a committed assistant model call. The surrounding Agent turn may still be running.
|
|
22
|
+
2. Right-click, enter the first question in the selection popover, and choose `Citer!`.
|
|
23
|
+
3. CiteCiter creates a new Topic for every submission and opens it in the wide learning dock.
|
|
24
|
+
4. Continue with normal follow-up questions, or reopen an older Topic from CiteCiter's own Topic rail.
|
|
25
|
+
5. Adjust the model, reasoning effort, title, archive state, and dock width without changing the source Session.
|
|
28
26
|
|
|
29
|
-
|
|
27
|
+
The default mode is Observer. Exact Fork remains an advanced mode for a source turn that has already ended; `exact-when-available` uses Observer when that stable fork boundary does not exist.
|
|
30
28
|
|
|
31
|
-
## What v0.
|
|
29
|
+
## What v0.3 implements
|
|
32
30
|
|
|
33
|
-
- **
|
|
34
|
-
- **
|
|
35
|
-
- **
|
|
36
|
-
- **
|
|
37
|
-
- **
|
|
38
|
-
- **
|
|
39
|
-
- **
|
|
40
|
-
- **
|
|
41
|
-
- **
|
|
31
|
+
- **Model-call citation boundary.** A committed `assistant/message` is enough to create an Observer Topic; CiteCiter does not wait for `turn/end`.
|
|
32
|
+
- **Exact Markdown selections.** Rendered selections map through GFM source positions to the original Markdown. Emphasis, deletion, links, and code retain Host-verifiable UTF-16 ranges while the UI keeps the text the user actually saw.
|
|
33
|
+
- **One submission, one Topic.** Repeating the same selection creates another private conversation instead of silently reusing an earlier one.
|
|
34
|
+
- **Private standard DSH Sessions.** Topic logs use the DSH Session, Agent Loop, tool, title, and persistence services under CiteCiter-owned storage in `$DSH_HOME/citeciter/`; they do not appear in the ordinary Session list.
|
|
35
|
+
- **Bound Observer evidence.** The Topic-only `read_source_session` tool reads structured committed events from its fixed source Session, records the captured seq, and never exposes the physical Session file to the model.
|
|
36
|
+
- **Independent titles and model controls.** New Topics copy the source model route, generate a DSH title after the first prompt, and can later switch model and reasoning effort independently.
|
|
37
|
+
- **Source-aware settings.** The DSH settings page controls the default context mode, source reasoning, optional read-only source-file access, dock width, and reopening the last Topic.
|
|
38
|
+
- **Read-only execution.** The private Agent uses a read-only sandbox. Only `read_source_session` and, when enabled and available, the standard file `read` tool reach the model.
|
|
39
|
+
- **Independent lifecycle.** Topics can be reopened, renamed, archived, restored, stopped, and continued without navigating or writing to the source Session.
|
|
40
|
+
- **Safe rich answers.** Markdown, code, and KaTeX render normally. Conservative SVG and sandboxed HTML handling falls back to visible source when content is incomplete or unsafe.
|
|
42
41
|
|
|
43
|
-
##
|
|
42
|
+
## Model input
|
|
44
43
|
|
|
45
44
|
```text
|
|
46
|
-
system:
|
|
47
|
-
history:
|
|
48
|
-
user context: durable,
|
|
45
|
+
system: the Topic-scoped CiteCiter Tutor and read-only policy
|
|
46
|
+
history: this Topic's own DSH history (plus a frozen prefix only in Exact Fork)
|
|
47
|
+
user context: the durable Citation record, explicitly marked as untrusted evidence
|
|
48
|
+
tool result: bounded source Session or source-workspace evidence read on demand
|
|
49
49
|
user: the person's actual first question and follow-ups
|
|
50
50
|
```
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
Source text, reasoning, tool arguments, tool results, and workspace files remain untrusted evidence. They never receive system authority. See [ADR 0002](https://github.com/kirkchinese/CiteCiter/blob/main/docs/architecture/0002-observer-learning-companion.zh.md) for the product and storage decisions.
|
|
53
|
+
|
|
54
|
+
## Upgrade from v0.2
|
|
55
|
+
|
|
56
|
+
Installing v0.3 replaces the plugin code but does not rewrite the source Sessions or v0.2 forked Citation Threads. Those older child Sessions remain ordinary DSH data and are not imported into the v0.3 Topic rail. New discussions use the private v0.3 store.
|
|
57
|
+
|
|
58
|
+
Use a valid three-part version such as `0.3.0`, then verify the installed result rather than relying only on the package-manager completion line:
|
|
59
|
+
|
|
60
|
+
```sh
|
|
61
|
+
dsh plugin --profile web add @kirkchinese/dsh-citeciter@0.3.0
|
|
62
|
+
dsh plugin --profile web list --depth 0
|
|
63
|
+
```
|
|
53
64
|
|
|
54
65
|
## Compatibility and limitations
|
|
55
66
|
|
|
56
|
-
- DSH Web and
|
|
57
|
-
-
|
|
58
|
-
-
|
|
59
|
-
-
|
|
60
|
-
-
|
|
61
|
-
-
|
|
62
|
-
-
|
|
67
|
+
- CiteCiter supports DSH Web and selections contained in one committed assistant flow. Cross-message and cross-block selections are not supported.
|
|
68
|
+
- KaTeX layout and footnote numbers are renderer-generated DOM without stable source-character coordinates, so selecting those elements does not open CiteCiter; ordinary text around a formula remains citable.
|
|
69
|
+
- Observer sees only committed Session events. It cannot cite an unfinished streaming fragment that has not produced `assistant/message`.
|
|
70
|
+
- Source reasoning is available only when it was recorded by the source provider and the CiteCiter setting remains enabled.
|
|
71
|
+
- Source-file access requires the running DSH composition to provide its filesystem service; it remains read-only and can be disabled.
|
|
72
|
+
- A missing source Session does not delete an existing Topic, but fresh source reads fail and the dock reports that the source is unavailable.
|
|
73
|
+
- The interface currently uses Chinese product copy and has no complete localization or cross-platform browser CI.
|
|
74
|
+
- DSH remains prerelease software; later DSH APIs may require a CiteCiter update.
|
|
63
75
|
|
|
64
76
|
## Development
|
|
65
77
|
|
|
@@ -72,10 +84,25 @@ pnpm --dir packages/citeciter test
|
|
|
72
84
|
pnpm run build
|
|
73
85
|
```
|
|
74
86
|
|
|
75
|
-
The repository tracks `packages/citeciter/lib/`.
|
|
87
|
+
The repository tracks `packages/citeciter/lib/`. Rebuild after changing source or build configuration, and inspect the real npm tarball before publishing.
|
|
88
|
+
|
|
89
|
+
For browser work, use a disposable DSH home and a dynamically assigned port so an existing server on `3080` is never touched:
|
|
90
|
+
|
|
91
|
+
```sh
|
|
92
|
+
CITECITER_DSH_ROOT="$(mktemp -d /tmp/citeciter-dsh.XXXXXX)"
|
|
93
|
+
mkdir -p "$CITECITER_DSH_ROOT/profiles/node_modules/@kirkchinese"
|
|
94
|
+
ln -s "$(pwd)/packages/citeciter" \
|
|
95
|
+
"$CITECITER_DSH_ROOT/profiles/node_modules/@kirkchinese/dsh-citeciter"
|
|
96
|
+
node packages/citeciter/dev/seed-smoke-session.mjs \
|
|
97
|
+
"$CITECITER_DSH_ROOT" "$(pwd)"
|
|
98
|
+
DSH_HOME="$CITECITER_DSH_ROOT" dsh --profile web \
|
|
99
|
+
--patch "$(pwd)/packages/citeciter/dev/patch.yml" --port 0
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Use the printed URL for browser inspection and stop only that disposable process.
|
|
76
103
|
|
|
77
104
|
## Contributing and license
|
|
78
105
|
|
|
79
|
-
|
|
106
|
+
Please open an [issue](https://github.com/kirkchinese/CiteCiter/issues) or submit a pull request. Contributor rules are in [AGENTS.md](https://github.com/kirkchinese/CiteCiter/blob/main/AGENTS.md).
|
|
80
107
|
|
|
81
108
|
MIT © CiteCiter contributors
|
package/README.zh.md
CHANGED
|
@@ -1,65 +1,77 @@
|
|
|
1
1
|
# `@kirkchinese/dsh-citeciter`
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**服务于进行中 DeepSeek Harness 对话的独立学习伴侣。** 在一次已经提交的助手模型调用中选中文字,就地提问;来源 Agent 可以继续工作,讨论则在独立的 CiteCiter Topic 中多轮进行。
|
|
4
4
|
|
|
5
5
|
[English](README.md) · [GitHub](https://github.com/kirkchinese/CiteCiter) · [问题反馈](https://github.com/kirkchinese/CiteCiter/issues)
|
|
6
6
|
|
|
7
|
-
> **开发状态:** v0.
|
|
7
|
+
> **开发状态:** v0.3 用独立 Observer Topic 取代了普通 DSH 子 Thread。API、存储、兼容范围和安装方式仍可能变化。
|
|
8
8
|
|
|
9
9
|
## 安装
|
|
10
10
|
|
|
11
|
-
需要 Node.js `^22.19.0 || >=24.0.0`、DSH Web
|
|
11
|
+
需要 Node.js `^22.19.0 || >=24.0.0`、DSH Web `>=0.1.0-rc.7 <0.1.0-rc.8`(当前验证线为 `0.1.0-rc.7`)和已经配置的模型提供方。
|
|
12
12
|
|
|
13
13
|
```sh
|
|
14
|
-
dsh plugin --profile web add @kirkchinese/dsh-citeciter@0.
|
|
14
|
+
dsh plugin --profile web add @kirkchinese/dsh-citeciter@0.3.0
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
-
安装或升级后,请重启对应的 DSH Web 进程并刷新页面。Host
|
|
18
|
-
|
|
19
|
-
包声明的 DSH peer range 从 `^0.1.0-rc.6` 开始。focused build 使用 rc.6 包集;v0.2 浏览器全链路也在一个全新启动的 DSH `0.1.0-rc.7` 进程中通过验证。
|
|
17
|
+
安装或升级后,请重启对应的 DSH Web 进程并刷新页面。Host、Typert 描述和浏览器 bundle 都在进程启动时解析。
|
|
20
18
|
|
|
21
19
|
## 使用
|
|
22
20
|
|
|
23
|
-
1.
|
|
24
|
-
2.
|
|
25
|
-
3.
|
|
26
|
-
4.
|
|
27
|
-
5.
|
|
21
|
+
1. 在一次已经提交的助手模型调用中选择文字;外层 Agent 轮次可以仍在运行。
|
|
22
|
+
2. 右键,在选区旁的浮层输入第一个问题,然后点击 `Citer!`。
|
|
23
|
+
3. CiteCiter 为每次提交创建一个新 Topic,并在宽学习栏中打开它。
|
|
24
|
+
4. 继续普通多轮追问,或从 CiteCiter 自己的 Topic 栏恢复旧讨论。
|
|
25
|
+
5. 独立调整模型、思考强度、标题、归档状态和学习栏宽度,不改变来源 Session。
|
|
28
26
|
|
|
29
|
-
|
|
27
|
+
默认模式是 Observer。Exact Fork 是来源轮次已经结束时使用的高级模式;`exact-when-available` 在不存在稳定 fork 边界时使用 Observer。
|
|
30
28
|
|
|
31
|
-
## v0.
|
|
29
|
+
## v0.3 已实现能力
|
|
32
30
|
|
|
33
|
-
-
|
|
34
|
-
-
|
|
35
|
-
-
|
|
36
|
-
-
|
|
37
|
-
-
|
|
38
|
-
-
|
|
39
|
-
-
|
|
40
|
-
-
|
|
41
|
-
-
|
|
31
|
+
- **模型调用级引用。** 已提交的 `assistant/message` 足以创建 Observer Topic,不需要等待 `turn/end`。
|
|
32
|
+
- **精确 Markdown 选区。** 渲染后的可见选区会通过 GFM 源位置映射回原始 Markdown;强调、删除线、链接和代码中的引用都保留 Host 可复验的 UTF-16 范围,UI 仍显示用户看到的文字。
|
|
33
|
+
- **一次提交一个 Topic。** 即使选区相同,再次提交也会创建另一条独立对话,不会静默复用旧讨论。
|
|
34
|
+
- **独立的标准 DSH Session。** Topic 在 `$DSH_HOME/citeciter/` 下使用 DSH Session、Agent Loop、工具、标题和持久化服务,不进入普通 Session 列表。
|
|
35
|
+
- **绑定来源的 Observer 证据。** Topic 专属的 `read_source_session` 只读取固定来源 Session 的结构化已提交事件,记录实际捕获 seq,并且不向模型暴露物理 Session 文件。
|
|
36
|
+
- **独立标题和模型控制。** 新 Topic 复制来源模型路由,在首问后通过 DSH 标题流程生成标题,之后可以独立切换模型和思考强度。
|
|
37
|
+
- **来源与界面设置。** DSH 设置页可以配置默认上下文模式、来源 reasoning、可选的只读来源文件访问、学习栏宽度和是否恢复上次 Topic。
|
|
38
|
+
- **只读执行。** 独立 Agent 使用 read-only sandbox。只有 `read_source_session`,以及启用且可用时的标准文件 `read` 工具会提供给模型。
|
|
39
|
+
- **独立生命周期。** Topic 可以恢复、重命名、归档、取消归档、停止和继续,而不导航或写入来源 Session。
|
|
40
|
+
- **安全富文本。** Markdown、代码和 KaTeX 正常渲染;保守的 SVG 与沙箱 HTML 处理会在内容不完整或不安全时显示源码。
|
|
42
41
|
|
|
43
42
|
## 模型输入结构
|
|
44
43
|
|
|
45
44
|
```text
|
|
46
|
-
system
|
|
47
|
-
history
|
|
48
|
-
user context
|
|
49
|
-
|
|
45
|
+
system:Topic 作用域的 CiteCiter Tutor 与只读策略
|
|
46
|
+
history:该 Topic 自己的 DSH 历史;只有 Exact Fork 额外带冻结前缀
|
|
47
|
+
user context:持久 Citation 记录,并明确标记为不可信证据
|
|
48
|
+
tool result:按需读取的有界来源 Session 或来源工作区证据
|
|
49
|
+
user:用户真正输入的首问和后续问题
|
|
50
50
|
```
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
来源文本、reasoning、工具参数、工具结果和工作区文件始终是不可信证据,不会获得 system 权限。产品与存储决定见 [ADR 0002](https://github.com/kirkchinese/CiteCiter/blob/main/docs/architecture/0002-observer-learning-companion.zh.md)。
|
|
53
|
+
|
|
54
|
+
## 从 v0.2 升级
|
|
55
|
+
|
|
56
|
+
安装 v0.3 会替换插件代码,但不会改写来源 Session 或 v0.2 fork 出来的 Citation Thread。旧子 Session 仍是普通 DSH 数据,不会导入 v0.3 Topic 栏;新讨论使用 v0.3 独立存储。
|
|
57
|
+
|
|
58
|
+
请使用 `0.3.0` 这样的合法三段版本号,并检查实际安装结果,不要只依赖包管理器显示的完成提示:
|
|
59
|
+
|
|
60
|
+
```sh
|
|
61
|
+
dsh plugin --profile web add @kirkchinese/dsh-citeciter@0.3.0
|
|
62
|
+
dsh plugin --profile web list --depth 0
|
|
63
|
+
```
|
|
53
64
|
|
|
54
|
-
##
|
|
65
|
+
## 兼容性与限制
|
|
55
66
|
|
|
56
|
-
-
|
|
57
|
-
-
|
|
58
|
-
-
|
|
59
|
-
-
|
|
60
|
-
-
|
|
61
|
-
-
|
|
62
|
-
-
|
|
67
|
+
- CiteCiter 支持 DSH Web,以及完整位于一个已提交助手 flow 内的选区;暂不支持跨消息或跨 block 引用。
|
|
68
|
+
- KaTeX 排版和脚注编号是渲染器生成的 DOM,没有稳定的原文字符坐标,因此直接选中这些元素不会打开 CiteCiter;公式周围的普通文本仍可引用。
|
|
69
|
+
- Observer 只能看到已经提交的 Session 事件,不能引用尚未形成 `assistant/message` 的流式片段。
|
|
70
|
+
- 只有来源提供方实际记录了 reasoning 且 CiteCiter 设置保持开启时,来源 reasoning 才可读取。
|
|
71
|
+
- 来源文件访问要求当前 DSH 组合提供文件系统服务;它始终只读,并且可以关闭。
|
|
72
|
+
- 来源 Session 缺失不会删除已有 Topic,但新的来源读取会失败,学习栏会显示来源不可用。
|
|
73
|
+
- 界面目前使用中文产品文案,尚无完整国际化和跨平台浏览器 CI。
|
|
74
|
+
- DSH 仍处于预发布阶段,后续 DSH API 变化可能要求同步更新 CiteCiter。
|
|
63
75
|
|
|
64
76
|
## 构建与验证
|
|
65
77
|
|
|
@@ -72,29 +84,25 @@ pnpm --dir packages/citeciter test
|
|
|
72
84
|
pnpm run build
|
|
73
85
|
```
|
|
74
86
|
|
|
75
|
-
仓库跟踪 `packages/citeciter/lib
|
|
87
|
+
仓库跟踪 `packages/citeciter/lib/`。修改源码或构建配置后必须重新构建,并在发布前检查真实 npm tarball。
|
|
76
88
|
|
|
77
|
-
|
|
89
|
+
浏览器开发应使用一次性 DSH home 和动态端口,绝不触碰已经运行在 `3080` 的服务:
|
|
78
90
|
|
|
79
91
|
```sh
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
/tmp/citeciter-dsh-home/profiles/node_modules/@kirkchinese/dsh-citeciter
|
|
92
|
+
CITECITER_DSH_ROOT="$(mktemp -d /tmp/citeciter-dsh.XXXXXX)"
|
|
93
|
+
mkdir -p "$CITECITER_DSH_ROOT/profiles/node_modules/@kirkchinese"
|
|
94
|
+
ln -s "$(pwd)/packages/citeciter" \
|
|
95
|
+
"$CITECITER_DSH_ROOT/profiles/node_modules/@kirkchinese/dsh-citeciter"
|
|
85
96
|
node packages/citeciter/dev/seed-smoke-session.mjs \
|
|
86
|
-
|
|
87
|
-
DSH_HOME
|
|
88
|
-
--patch "$(pwd)/packages/citeciter/dev/patch.yml" --port
|
|
89
|
-
node packages/citeciter/dev/smoke.mjs \
|
|
90
|
-
http://127.0.0.1:3907 CiteCiter \
|
|
91
|
-
/tmp/citeciter-dsh-home/citeciter-smoke.json
|
|
97
|
+
"$CITECITER_DSH_ROOT" "$(pwd)"
|
|
98
|
+
DSH_HOME="$CITECITER_DSH_ROOT" dsh --profile web \
|
|
99
|
+
--patch "$(pwd)/packages/citeciter/dev/patch.yml" --port 0
|
|
92
100
|
```
|
|
93
101
|
|
|
94
|
-
|
|
102
|
+
使用命令打印的 URL 进行浏览器检查,并且只停止这个一次性进程。
|
|
95
103
|
|
|
96
104
|
## 贡献与许可证
|
|
97
105
|
|
|
98
|
-
请到 [GitHub](https://github.com/kirkchinese/CiteCiter)
|
|
106
|
+
请到 [GitHub](https://github.com/kirkchinese/CiteCiter) 提交 Issue 或 Pull Request,并先阅读仓库 [AGENTS.md](https://github.com/kirkchinese/CiteCiter/blob/main/AGENTS.md)。
|
|
99
107
|
|
|
100
108
|
MIT © CiteCiter contributors
|