@comchatx/cx-topics 0.1.5 → 0.1.7
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 +5 -57
- package/README.zh-CN.md +5 -57
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -1,61 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
Each time you start something new, it gets a title in History, in your own words, and when the work changes, so does its title. When you quote a message, cx reads it with the ones around it before it answers.
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## What it costs
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Jev tells whether a message starts something new, paid from your balance or with your own TypeSafe API key. The model you chat on writes the titles, billed as your chat is.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## What it needs
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
**Where it carries on.** A progress entry naming a message no longer on the branch carries on from the branch's newest seller message, asking nothing. A first load with no progress entry and no unseen install token writes a starting entry at the branch's newest seller message and asks nothing.
|
|
12
|
-
|
|
13
|
-
**When it starts over.** Only an install starts from the first message: it clears every title the package wrote and titles the conversation again. pi tells a package nothing of how it came to be loaded, so the host records each install with a fresh token in `.pi/cx-installs.json` under the project (`INSTALLS_FILE`), keyed by the package's source with any npm version dropped (`installKey`), and the package reads a load as an install when the token for its own key is in none of its progress entries. Its key is the source pi lists for the `quoted` tool whose file is the package's own, so another package's `quoted` lends none. No key, no file, no token or a file that does not read: it carries on.
|
|
14
|
-
|
|
15
|
-
**When it titles.**
|
|
16
|
-
- The conversation's first seller message with words, and a message Jev judges new work: the title model titles it from the seller's message alone.
|
|
17
|
-
- A continuation: the same Jev call answers whether the current title still names the work in the topic. At 0.2 or less (`ROUTING_LIMITS.staleTitle`) the title model rewrites the title from that title and the topic's seller messages.
|
|
18
|
-
- A title is written only while the label it was asked on still stands, and only where it differs from it.
|
|
19
|
-
|
|
20
|
-
**What Jev is shown.** The topic in progress, from pi's branch: its title and the seller's own words in it, `<quote>` markers taken out, and the message judged; none of cx's words, tool calls, thinking or images. Past 31 seller messages, the newest 31 (`ROUTING_LIMITS.sellerMessages`). Each message over 512 code points and the latest over 2,048 keep their head and tail around `\n[… N characters omitted …]\n`. The topic's length sets how sure Jev must be that a message continues it: in a topic of two seller messages or fewer an even answer continues it, from eight on the confident 0.8, and between the two the bar rises evenly (`ROUTING_LIMITS`). The largest request Jev is sent is 109,260 bytes.
|
|
21
|
-
|
|
22
|
-
**The models.** Jev by pi's catalogue, `typesafe` `jev-latest` (`JEV`). The title model is the one the seller is chatting on, read from pi (`ctx.model`) at each title call, so a model the seller switches to writes the next title. A title is the seller's, written by the model they chose (Jack, 2026-10-28), and the package names no model of its own and offers no setting for one. On a physical model the title call (`modelRegistry.complete`) asks at most 128 output tokens with no thinking, no tools and no cache retention, within 20,000 ms. On a virtual model the seller selected, pi routes it (`modelRegistry.streamSimple`, with the same options) and the thinking level the seller's router returns applies, pi adding its budget to the 128: that is the seller's own configuration, billed as their chat is, since pi 1.4.0 offers an extension no public way to route a request and then bound it. The package holds no address or key: where pi has no Jev configured nothing is asked, and where the session has no model, or pi holds no key or sign-in for it, no title is written and the pass stops at that message as on a refused call.
|
|
23
|
-
|
|
24
|
-
**Failures write nothing.** Only a result pi ends with `stop` that answers every question is a verdict, and only an answer pi ends with `stop` is a title. A call that was answered, or a request refused as it is (`400`, `413`, `422`, or a `403` without one of the gate's codes), moves on to the next message; a call that failed otherwise stops the pass at that message, to ask it again at the next seller message or the next load, never in a loop. No call is retried.
|
|
25
|
-
|
|
26
|
-
**Stop.** Stop ends cx's answer, not the filing of the seller's message: a Jev call and a title call in flight are left to finish, each on its own deadline, and the title is written.
|
|
27
|
-
|
|
28
|
-
## `quoted`
|
|
29
|
-
|
|
30
|
-
`quoted` takes `entry`, a pi entry id. It reads pi's whole session (`getEntries`, compacted or not) and answers the quoted message with up to 2 messages of the seller's or cx's on each side: who, when, the words, and one line per tool step an answer took. The time is to the minute, on the zone of the newest quote marker naming one, else in UTC. The quoted message is cut at 8,000 characters and its neighbours at 1,000, each cut naming what it left. An id the session does not hold answers that the message is from an earlier conversation.
|
|
31
|
-
|
|
32
|
-
On every request of a session that loads the package the model is told, in the system prompt's tools section, that `quoted` reads a quoted message by the `entry` attribute of its `<quote>` tag, and in its rules section that a message holding a quote is answered after `quoted` reads it: 255 characters, about 64 tokens.
|
|
33
|
-
|
|
34
|
-
## The quote marker
|
|
35
|
-
|
|
36
|
-
A quote inside the seller's message is sent as
|
|
37
|
-
|
|
38
|
-
```
|
|
39
|
-
<quote entry="<pi entry id>" at="<epoch>:<seq>" zone="<IANA zone>">the quoted or selected words</quote>
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
one marker per quoted message or selection, before the seller's own words. Quoted words never carry a literal `</quote>`. `entry` is what `quoted` reads; `zone` is the zone the quote's card shows its time in. Without this package the model reads the quoted words inline.
|
|
43
|
-
|
|
44
|
-
## How it is built
|
|
45
|
-
|
|
46
|
-
- `src/core/` holds the pure parts — the protocol of Jev's questions, the routing bars and the title's cut — and imports nothing but itself.
|
|
47
|
-
- `src/extensions/topics.ts` is the one extension; `judge.ts` asks and writes, `pass.ts` walks the branch. `npm run build` bundles `topics.ts` into `dist/extensions/topics.js`, pi's own packages left for pi to supply; the package ships that file alone. The built module also exports `INSTALLS_FILE`, `installKey` and `JEV`, for a host to hold the package to.
|
|
48
|
-
- `package.json` declares no `type`. pi's loader then reads the bundle at the path pi lists the `quoted` tool's source by; declared a module, it is loaded natively and knows itself by its real path, which behind a symlink is not the path pi lists, so the package would find no key of its own and miss an install.
|
|
49
|
-
|
|
50
|
-
## Tests
|
|
51
|
-
|
|
52
|
-
- `test/core/` — the protocol, the routing bars against a fixed comparison (`test/support/routing-comparison.json`), the title's cut, and that the core imports nothing else and the bundle carries the live files alone.
|
|
53
|
-
- `test/extensions/` — the title and the quote reading on pi's own session shapes, Jev's verdict and the titles, and the pass: an install's clears and its judging from the first, carrying on, a branch left, one pass at a time, a reload's cut call asked again, and the key read from pi's tool list.
|
|
54
|
-
- `test/support/replay.test.ts` and `replay-main.test.ts` — the calibration replay on a stand-in through pi's own registry, with no key: the title request names the session's model, a model switched between two messages titles the second, a virtual model is routed to its physical model, the output tokens and thinking a physical and a routed request carry, and a model pi holds no key for is asked nothing.
|
|
55
|
-
- `test/package.test.ts` — the pinned pi loads the built extension with its tool and handlers; the built module exports what a host holds it to; the package ships the built extension alone.
|
|
56
|
-
|
|
57
|
-
**The calibration set.** `test/support/calibration-cases.ts`, replayed by hand by `test/support/replay-main.ts`, bundled with esbuild as `replay-main.test.ts` does (`--live --keys <env file>`): each seller message judged by the package's own judge on pi's registry, against TypeSafe and OpenRouter on development keys read from an env file by name, and held to the outcome wanted — a new topic, a continuation with its title standing or a rewrite asked. With no key it runs on a stand-in. The set was measured with the session on `balance` `minimax/minimax-m3`, the platform's default (`CALIBRATED`); Jev's verdicts do not depend on the session's model, while a title's wording now varies with the model the seller chats on.
|
|
58
|
-
|
|
59
|
-
## Release
|
|
60
|
-
|
|
61
|
-
Each version is published by `.github/workflows/release.yml` on a `v<version>` tag, from this repository as the package's trusted publisher on npm.
|
|
9
|
+
It needs Jev, which Plugins installs with it.
|
package/README.zh-CN.md
CHANGED
|
@@ -1,61 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
你每开始一件新事,「历史」里就会多一个标题,用的是你的话,方便以后找回;事情变了,标题也跟着改。你引用一条消息时,cx 会连同它前后的几条一起读,再回答你。
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## 费用
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
判断一条消息是不是一件新事,用的是 Jev,按用量从余额扣费,也可以使用你自己的 TypeSafe API Key。标题由你对话所用的模型来写,和对话一样计费。
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## 需要
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
**从哪里继续。** 如果进度记录指向的消息已不在当前分支上,就从分支上最新的一条卖家消息继续,不发起任何调用。首次加载时,如果没有进度记录,也没有未处理过的安装令牌,就在分支上最新的一条卖家消息处写一条起始记录,不发起任何调用。
|
|
12
|
-
|
|
13
|
-
**何时从头开始。** 只有安装会从第一条消息开始:清除这个包写过的所有标题,再为整段对话重新写标题。pi 不会告诉一个包它是怎样被加载的,所以每次安装时,宿主都会在项目下的 `.pi/cx-installs.json`(`INSTALLS_FILE`)里记下一个新令牌,键是这个包的来源、去掉其中的 npm 版本号(`installKey`);如果自己这个键对应的令牌不在任何一条进度记录里,这个包就把这次加载当作一次安装。它的键取自 pi 为 `quoted` 工具列出的来源,并且这个工具的文件必须是这个包自己的,所以别的包里的 `quoted` 不会提供键。没有键、没有文件、没有令牌,或者文件读不出来,都照常继续。
|
|
14
|
-
|
|
15
|
-
**何时写标题。**
|
|
16
|
-
- 对话中第一条有文字的卖家消息,以及 Jev 判断为新工作的消息:写标题的模型只根据这条卖家消息写标题。
|
|
17
|
-
- 接着当前工作的消息:同一次 Jev 调用还会回答当前标题是否仍能概括这项工作。结果在 0.2 或以下(`ROUTING_LIMITS.staleTitle`)时,写标题的模型根据原标题和这项工作中的卖家消息改写标题。
|
|
18
|
-
- 只有发起请求时所依据的标签仍然存在,并且新标题与它不同,才会写入标题。
|
|
19
|
-
|
|
20
|
-
**Jev 看到什么。** 从 pi 的分支中取出的当前工作:它的标题、其中卖家自己的话(去掉 `<quote>` 标记),以及被判断的这条消息;cx 说的话、步骤、思考过程和图片一概不给。卖家消息超过 31 条时,只给最新的 31 条(`ROUTING_LIMITS.sellerMessages`)。超过 512 个码位的消息、以及超过 2,048 个码位的最新一条消息,只保留开头和结尾,中间换成 `\n[… N characters omitted …]\n`。这项工作有多长,决定了 Jev 要有多大把握,才算一条消息是接着它的:卖家消息不超过两条时,五五开就算接着;从八条起,需要 0.8 的把握;两者之间,门槛均匀升高(`ROUTING_LIMITS`)。发给 Jev 的请求最大为 109,260 字节。
|
|
21
|
-
|
|
22
|
-
**模型。** Jev 取自 pi 的模型列表,即 `typesafe` `jev-latest`(`JEV`)。写标题的模型就是卖家对话时所用的模型,每次写标题时从 pi 读取(`ctx.model`),所以卖家换了模型,下一个标题就由新模型来写。标题属于卖家,由卖家自己选的模型来写(Jack,2026-10-28),这个包不指定自己的模型,也不提供这方面的设置。对于实体模型,写标题的调用(`modelRegistry.complete`)最多要 128 个输出 token,不思考、不用工具、不保留缓存,限时 20,000 毫秒。如果卖家选的是虚拟模型,由 pi 负责路由(`modelRegistry.streamSimple`,选项相同),并采用卖家的路由器返回的思考强度,pi 会在 128 之外再加上相应的思考预算。这是卖家自己的配置,和对话一样计费,因为 pi 1.4.0 没有给扩展提供公开的方法,先路由请求、再加以限制。这个包不保存任何地址或密钥。pi 没有配置 Jev 时,不发起任何调用;对话没有模型,或者 pi 没有这个模型的密钥或登录时,不写标题,这一轮处理停在这条消息上,和调用被拒绝时一样。
|
|
23
|
-
|
|
24
|
-
**失败时什么都不写。** 只有 pi 以 `stop` 结束、并且回答了每个问题的结果,才算判断结论;只有 pi 以 `stop` 结束的回答,才算标题。已得到回答的调用,或者请求本身被拒绝(`400`、`413`、`422`,或者不带网关错误码的 `403`),会继续处理下一条消息;以其他方式失败的调用,会让这一轮处理停在这条消息上,等下一条卖家消息或下一次加载时再调用,绝不循环。任何调用都不重试。
|
|
25
|
-
|
|
26
|
-
**停止。** 「停止」只结束 cx 的回答,卖家的消息仍会照常归档:正在进行的 Jev 调用和写标题调用会各按自己的时限完成,标题照常写入。
|
|
27
|
-
|
|
28
|
-
## `quoted`
|
|
29
|
-
|
|
30
|
-
`quoted` 接收 `entry`,即 pi 的一个记录 id。它读取 pi 的整个会话(`getEntries`,无论是否已整理成摘要),返回被引用的消息,以及它前后各最多 2 条卖家或 cx 的消息:谁说的、什么时候说的、说了什么,回答中的每个步骤各占一行。时间精确到分钟,按最新一个注明时区的引用标记的时区显示,没有就用 UTC。被引用的消息超过 8,000 个字符、前后的消息超过 1,000 个字符时截断,每处截断都会注明省略了什么。如果会话里没有这个 id,就回答这条消息来自更早的对话。
|
|
31
|
-
|
|
32
|
-
加载了这个包的会话,每次请求都会在系统提示词的工具部分告诉模型,`quoted` 按 `<quote>` 标签的 `entry` 属性读取被引用的消息;并在规则部分告诉模型,带引用的消息要在 `quoted` 读取之后再回答。共 255 个字符,约 64 个 token。
|
|
33
|
-
|
|
34
|
-
## 引用标记
|
|
35
|
-
|
|
36
|
-
卖家消息中的引用按以下格式发送:
|
|
37
|
-
|
|
38
|
-
```
|
|
39
|
-
<quote entry="<pi entry id>" at="<epoch>:<seq>" zone="<IANA zone>">the quoted or selected words</quote>
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
每条被引用的消息或每段选中的文字对应一个标记,放在卖家自己的话前面。被引用的文字里不会出现字面的 `</quote>`。`entry` 是 `quoted` 读取的内容;`zone` 是引用卡片显示时间所用的时区。没有这个包时,模型直接读取标记里的引用文字。
|
|
43
|
-
|
|
44
|
-
## 实现方式
|
|
45
|
-
|
|
46
|
-
- `src/core/` 存放纯逻辑部分,包括 Jev 问题的协议、路由门槛和标题的裁剪,只引用自身。
|
|
47
|
-
- `src/extensions/topics.ts` 是唯一的扩展;`judge.ts` 负责调用和写入,`pass.ts` 负责遍历分支。`npm run build` 把 `topics.ts` 打包成 `dist/extensions/topics.js`,pi 自己的包留给 pi 提供;这个包只发布这一个文件。构建出的模块还导出 `INSTALLS_FILE`、`installKey` 和 `JEV`,供宿主据此约束这个包。
|
|
48
|
-
- `package.json` 不声明 `type`。这样,pi 的加载器会按 pi 列出 `quoted` 工具来源时所用的路径读取打包文件;如果声明为模块,它会被原生加载,并以真实路径识别自己,而在符号链接后面,真实路径与 pi 列出的路径不同,这个包就会找不到自己的键,从而漏掉一次安装。
|
|
49
|
-
|
|
50
|
-
## 测试
|
|
51
|
-
|
|
52
|
-
- `test/core/`:协议;对照固定的比较表(`test/support/routing-comparison.json`)检查路由门槛;标题的裁剪;以及核心部分不引用任何其他代码、打包文件只包含实际使用的文件。
|
|
53
|
-
- `test/extensions/`:在 pi 自己的会话结构上检查标题和引用读取;Jev 的判断与标题;以及处理过程,包括安装后的清除和从第一条开始的判断、继续处理、离开分支、同一时间只有一轮处理、重新加载后再次发起被中断的调用,以及从 pi 的工具列表中读取键。
|
|
54
|
-
- `test/support/replay.test.ts` 和 `replay-main.test.ts`:不用密钥,通过 pi 自己的注册表在替身上重放校准集,检查写标题的请求指定的是对话所用的模型;在两条消息之间换模型时,第二条由新模型写标题;虚拟模型被路由到对应的实体模型;实体模型请求和经路由的请求各自带的输出 token 与思考设置;以及 pi 没有密钥的模型不会被调用。
|
|
55
|
-
- `test/package.test.ts`:锁定版本的 pi 能加载构建出的扩展及其工具和处理函数;构建出的模块导出宿主用来约束它的内容;这个包只发布构建出的扩展。
|
|
56
|
-
|
|
57
|
-
**校准集。** `test/support/calibration-cases.ts`,由 `test/support/replay-main.ts` 手动重放,并像 `replay-main.test.ts` 那样用 esbuild 打包(`--live --keys <env file>`):每条卖家消息都由这个包自己的判断程序在 pi 的注册表上判断,调用 TypeSafe 和 OpenRouter,所用的开发密钥按名称从 env 文件读取,并与期望的结果对照,即新工作、标题不变的延续,或要求改写标题。没有密钥时,在替身上运行。这套用例是在对话使用 `balance` `minimax/minimax-m3`(ComChatX 默认的模型,`CALIBRATED`)时测得的;Jev 的判断与对话所用的模型无关,而标题的措辞现在会随卖家对话所用的模型而变。
|
|
58
|
-
|
|
59
|
-
## 发布
|
|
60
|
-
|
|
61
|
-
每个版本在打上 `v<version>` 标签时,由 `.github/workflows/release.yml` 发布;本仓库是这个包在 npm 上的可信发布者。
|
|
9
|
+
它需要 Jev,「插件」页会一并安装。
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@comchatx/cx-topics",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.1.7",
|
|
4
|
+
"description": "Titles each piece of work, and reads quotes in context.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "ComChatX",
|
|
7
7
|
"homepage": "https://github.com/comchatx/cx-topics#readme",
|
|
@@ -29,7 +29,8 @@
|
|
|
29
29
|
"test": "vitest run"
|
|
30
30
|
},
|
|
31
31
|
"comchatx": {
|
|
32
|
-
"
|
|
32
|
+
"name": "Conversation Titles",
|
|
33
|
+
"about": "每件事都有标题,引用旧消息时 cx 连前后一起读。",
|
|
33
34
|
"mark": {
|
|
34
35
|
"line": "hash"
|
|
35
36
|
},
|