@weibaohui/context-razor 0.2.0 → 0.4.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 +1 -0
- package/client/bundle.js +6 -1
- package/client/index.js +6 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
- **逐条列出**:当前会话模型可见的每条上下文(用户/助手/工具结果)按序排列,带预览、字符数与 ≈token 估算,点 ⋯ 查看全文与真实 usage
|
|
13
13
|
- **超阈值标红**:可调阈值(默认 500 token,本地记忆),超限条目红色高亮;「只看超阈值」过滤 + 「token 高→低」排序,大头一眼可见
|
|
14
14
|
- **精确裁剪**:勾选任意条目一键删除——连续段自动合并处理。删除走宿主 surface replace 协议(与官方 compaction 同款机制),**不经 LLM 总结**,删了什么、删了多少完全由你决定
|
|
15
|
+
- **不重排**:本插件不会改变上下文条目顺序,只会剔除选中条目;「token 高→低」排序仅影响页面显示,模型可见顺序始终由会话 surface 决定
|
|
15
16
|
- **安全护栏**:会话运行中禁止裁剪(等当前回合结束);每次替换附带一条 notice 标记消息,模型知道这段历史被你移除了,需要时会主动向你确认
|
|
16
17
|
- **非破坏**:append-only 日志保留全部痕迹(宿主机制如此)。「删除」= 从模型视野与界面投影中移除
|
|
17
18
|
|
package/client/bundle.js
CHANGED
|
@@ -65,6 +65,7 @@ window.__ModuleLoader__.load({
|
|
|
65
65
|
sortLabel: '排序',
|
|
66
66
|
sortOrder: '上下文顺序',
|
|
67
67
|
sortTokens: 'token 高→低',
|
|
68
|
+
orderNote: '本插件不会改变上下文条目顺序,只会剔除选中条目。',
|
|
68
69
|
selectVisible: '选中可见',
|
|
69
70
|
selectVisibleHint: '选中当前显示的全部条目(配合色块筛选)',
|
|
70
71
|
clearSelect: '清空选择',
|
|
@@ -102,6 +103,7 @@ window.__ModuleLoader__.load({
|
|
|
102
103
|
sortLabel: 'Sort',
|
|
103
104
|
sortOrder: 'Context order',
|
|
104
105
|
sortTokens: 'tokens high→low',
|
|
106
|
+
orderNote: 'This plugin never reorders context entries; it only removes the selected ones.',
|
|
105
107
|
selectVisible: 'Select shown',
|
|
106
108
|
selectVisibleHint: 'Select every currently shown entry (pairs with tier filters)',
|
|
107
109
|
clearSelect: 'Clear selection',
|
|
@@ -137,7 +139,9 @@ window.__ModuleLoader__.load({
|
|
|
137
139
|
|
|
138
140
|
const kindI18n = (key) => 'kind' + key[0].toUpperCase() + key.slice(1)
|
|
139
141
|
|
|
140
|
-
/** 排序:order =
|
|
142
|
+
/** 排序:order = 投影原序(模型可见序);tokens = 降序(并列按 seq,缺 token 沉底)。
|
|
143
|
+
* 只有两档且都是显示层——裁剪过的会话里 seq 升序 ≠ 模型可见序(replace 标记 seq 大但位置在中间),
|
|
144
|
+
* 与「本页展示模型可见上下文」相悖,故不提供 seq 档。 */
|
|
141
145
|
function sortEntries(entries, sortBy) {
|
|
142
146
|
if (sortBy !== 'tokens') return entries
|
|
143
147
|
return [...entries].sort((a, b) => {
|
|
@@ -405,6 +409,7 @@ window.__ModuleLoader__.load({
|
|
|
405
409
|
!sessionId && h('div', { className: 'rz-empty' }, t('pickSession')),
|
|
406
410
|
sessionId && ctxLoading && h('div', { className: 'rz-loading' }, t('loading')),
|
|
407
411
|
sessionId && !ctxLoading && context && [
|
|
412
|
+
h('div', { key: 'note', className: 'rz-hint' }, t('orderNote')),
|
|
408
413
|
h('div', { key: 'bar', className: 'rz-stats' },
|
|
409
414
|
h('span', null, t('stats', { nodes: context.nodes, tokens: formatNum(context.totalTokens), mode: context.encoder === 'heuristic' ? t('modeHeuristic') : '' })),
|
|
410
415
|
h('span', { className: 'rz-legend' + (tierFilter.size > 0 ? ' filtering' : ''), title: t('legendTitle') },
|
package/client/index.js
CHANGED
|
@@ -55,6 +55,7 @@ const ZH = {
|
|
|
55
55
|
sortLabel: '排序',
|
|
56
56
|
sortOrder: '上下文顺序',
|
|
57
57
|
sortTokens: 'token 高→低',
|
|
58
|
+
orderNote: '本插件不会改变上下文条目顺序,只会剔除选中条目。',
|
|
58
59
|
selectVisible: '选中可见',
|
|
59
60
|
selectVisibleHint: '选中当前显示的全部条目(配合色块筛选)',
|
|
60
61
|
clearSelect: '清空选择',
|
|
@@ -92,6 +93,7 @@ const EN = {
|
|
|
92
93
|
sortLabel: 'Sort',
|
|
93
94
|
sortOrder: 'Context order',
|
|
94
95
|
sortTokens: 'tokens high→low',
|
|
96
|
+
orderNote: 'This plugin never reorders context entries; it only removes the selected ones.',
|
|
95
97
|
selectVisible: 'Select shown',
|
|
96
98
|
selectVisibleHint: 'Select every currently shown entry (pairs with tier filters)',
|
|
97
99
|
clearSelect: 'Clear selection',
|
|
@@ -127,7 +129,9 @@ const PAGE_SIZE = 150
|
|
|
127
129
|
|
|
128
130
|
const kindI18n = (key) => 'kind' + key[0].toUpperCase() + key.slice(1)
|
|
129
131
|
|
|
130
|
-
/** 排序:order =
|
|
132
|
+
/** 排序:order = 投影原序(模型可见序);tokens = 降序(并列按 seq,缺 token 沉底)。
|
|
133
|
+
* 只有两档且都是显示层——裁剪过的会话里 seq 升序 ≠ 模型可见序(replace 标记 seq 大但位置在中间),
|
|
134
|
+
* 与「本页展示模型可见上下文」相悖,故不提供 seq 档。 */
|
|
131
135
|
function sortEntries(entries, sortBy) {
|
|
132
136
|
if (sortBy !== 'tokens') return entries
|
|
133
137
|
return [...entries].sort((a, b) => {
|
|
@@ -395,6 +399,7 @@ function RazorPage({ t, fixedSessionId }) {
|
|
|
395
399
|
!sessionId && h('div', { className: 'rz-empty' }, t('pickSession')),
|
|
396
400
|
sessionId && ctxLoading && h('div', { className: 'rz-loading' }, t('loading')),
|
|
397
401
|
sessionId && !ctxLoading && context && [
|
|
402
|
+
h('div', { key: 'note', className: 'rz-hint' }, t('orderNote')),
|
|
398
403
|
h('div', { key: 'bar', className: 'rz-stats' },
|
|
399
404
|
h('span', null, t('stats', { nodes: context.nodes, tokens: formatNum(context.totalTokens), mode: context.encoder === 'heuristic' ? t('modeHeuristic') : '' })),
|
|
400
405
|
h('span', { className: 'rz-legend' + (tierFilter.size > 0 ? ' filtering' : ''), title: t('legendTitle') },
|