@khorsheed/dsh-context-guard 0.2.2 → 0.2.4
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/CHANGELOG.md +9 -0
- package/README.en.md +2 -2
- package/README.i18n.yaml +2 -2
- package/README.md +2 -2
- package/lib/client.js +31 -31
- package/lib/index.js +3 -2
- package/lib/types/settings.d.ts +3 -2
- package/lib/types/settings.js +3 -2
- package/package.json +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# 变更记录
|
|
2
2
|
|
|
3
|
+
## 0.2.4(2026-09-30)
|
|
4
|
+
|
|
5
|
+
- **设置面直接调用 schemastery 的类型化 `.volatile()`**:0.2.0 开发线解析到 schemastery 3.18.4,其 `Schema` 已声明 `volatile()`——手写的 `VolatileCapable` 强转探测不再类型重叠(TS2352)。运行期双线行为不变:探测在 0.1.5 的 schemastery 3.18.2(无 `volatile` 方法)上仍回落到普通字段
|
|
6
|
+
- 加宽 `@deepseek-ai/dsh-*` peer 区间以覆盖宿主 0.2.0
|
|
7
|
+
|
|
8
|
+
## 0.2.3(2026-09-27)
|
|
9
|
+
|
|
10
|
+
无功能变更。随宿主 0.1.7-rc.2 基线发布波重发:全量构建+测试在 rc.2 基线通过(rc.1→rc.2 无触及本包的宿主变更,逐类清点见 [Agent Note](../../.agents/notes/implemented/architecture/2026-09-27-host-017-rc2-breaking-changes.md))。
|
|
11
|
+
|
|
3
12
|
## 0.2.2(2026-09-26)
|
|
4
13
|
|
|
5
14
|
适配宿主 rc.1 线并实证 0.1.5/0.1.7 双线可用(0.1.5-rc.1 全量 boot 实证,2026-09-25)。
|
package/README.en.md
CHANGED
|
@@ -6,7 +6,7 @@ A "compact now" button that shows up in the composer before your context runs ou
|
|
|
6
6
|
|
|
7
7
|
The longer a conversation runs, the fuller the context gets — and at the far end the provider starts rejecting requests outright. That wall arrives earlier than the 100% the context ring suggests, because every request also reserves room for the output. This plugin's job is simple: once occupancy crosses the ratio you set, an amber button appears in the composer's toolbar, and clicking it is the same as typing `/compact` yourself. It never compacts for you — it just reminds you while you still can.
|
|
8
8
|
|
|
9
|
-
<img src="https://raw.githubusercontent.com/Khorsheed/dsh-
|
|
9
|
+
<img src="https://raw.githubusercontent.com/Khorsheed/dsh-basic/main/docs/screenshots/context-guard-button.png" width="640" alt="the compact button appears in the composer toolbar once context occupancy crosses the configured ratio">
|
|
10
10
|
|
|
11
11
|
## Features
|
|
12
12
|
|
|
@@ -15,7 +15,7 @@ The longer a conversation runs, the fuller the context gets — and at the far e
|
|
|
15
15
|
- **Runs the official `/compact`** — idle-gating, the compaction lock, and presentation stay host-owned; a click behaves exactly like the typed command.
|
|
16
16
|
- **One live tunable** — the reminder threshold, editable in settings with no restart.
|
|
17
17
|
|
|
18
|
-
<img src="https://raw.githubusercontent.com/Khorsheed/dsh-
|
|
18
|
+
<img src="https://raw.githubusercontent.com/Khorsheed/dsh-basic/main/docs/screenshots/context-guard-settings.png" width="640" alt="the trigger ratio is configurable in settings (0.01–1)">
|
|
19
19
|
|
|
20
20
|
## Install
|
|
21
21
|
|
package/README.i18n.yaml
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
# last confirmed-consistent state. Both languages carry equal authority; after
|
|
3
3
|
# editing either side, bring the other along and re-record with:
|
|
4
4
|
# pnpm run verify-translation-pairing --write packages/context-guard/README.en.md
|
|
5
|
-
packages/context-guard/README.en.md:
|
|
6
|
-
packages/context-guard/README.md:
|
|
5
|
+
packages/context-guard/README.en.md: 7467dc5a37b821125c3f4f026ac65be1a8584591
|
|
6
|
+
packages/context-guard/README.md: 89f1467584d849cf6da1a4717758305a77e25d7a
|
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
聊得越久,上下文占用越高,涨到头 provider 会直接拒收请求——这堵墙比进度环的 100% 来得更早(请求还要给输出留位置)。这个插件就是干这个的:占用一过你设的比例,输入框工具栏里就出现一枚琥珀色按钮,点一下等于亲手输入 `/compact`。它不替你自动压缩,只在你还来得及的时候提醒你。
|
|
8
8
|
|
|
9
|
-
<img src="https://raw.githubusercontent.com/Khorsheed/dsh-
|
|
9
|
+
<img src="https://raw.githubusercontent.com/Khorsheed/dsh-basic/main/docs/screenshots/context-guard-button.png" width="640" alt="上下文占用越过配置比例后,输入框工具栏里出现琥珀色的压缩按钮">
|
|
10
10
|
|
|
11
11
|
## 功能
|
|
12
12
|
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
- **执行官方 `/compact`**——空闲门控、压缩锁和流程展示都由宿主负责,点击的效果和手打命令一模一样。
|
|
16
16
|
- **一个实时可调项**——提醒阈值在设置里改,保存即生效,不用重启。
|
|
17
17
|
|
|
18
|
-
<img src="https://raw.githubusercontent.com/Khorsheed/dsh-
|
|
18
|
+
<img src="https://raw.githubusercontent.com/Khorsheed/dsh-basic/main/docs/screenshots/context-guard-settings.png" width="640" alt="提醒比例可在设置中按偏好调整(0.01–1)">
|
|
19
19
|
|
|
20
20
|
## 安装
|
|
21
21
|
|
package/lib/client.js
CHANGED
|
@@ -210,7 +210,7 @@ window.__ModuleLoader__.load({
|
|
|
210
210
|
}
|
|
211
211
|
//#endregion
|
|
212
212
|
//#region \0dsh-css:src/client/CompactGuardButton.module.css.mjs
|
|
213
|
-
const css$1 = ".
|
|
213
|
+
const css$1 = ".BFFw2a_wrap{align-items:center;gap:6px;display:inline-flex}.BFFw2a_button{cursor:pointer;border:none;border-radius:999px;align-items:center;gap:4px;padding:2px 8px;font-size:13px;font-weight:500;line-height:20px;display:inline-flex}.BFFw2a_button:focus-visible{outline-offset:2px;outline:2px solid}.BFFw2a_button:disabled{opacity:.6;cursor:default}.BFFw2a_icon{color:currentColor;align-items:center;display:inline-flex}.BFFw2a_warning{background:var(--dsw-alias-state-warn-tertiary);color:var(--dsw-alias-state-warn-label)}.BFFw2a_warning:hover:not(:disabled){color:var(--dsw-alias-state-warn-primary)}.BFFw2a_error{color:var(--dsw-alias-state-error-primary);font-size:12px;line-height:18px}";
|
|
214
214
|
const tagId$1 = "@khorsheed/dsh-context-guard/CompactGuardButton.module.css";
|
|
215
215
|
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$1) + "]") === null) {
|
|
216
216
|
const tag = document.createElement("style");
|
|
@@ -220,11 +220,11 @@ window.__ModuleLoader__.load({
|
|
|
220
220
|
document.head.appendChild(tag);
|
|
221
221
|
}
|
|
222
222
|
var CompactGuardButton_module_css_default = {
|
|
223
|
-
"icon": "
|
|
224
|
-
"button": "
|
|
225
|
-
"wrap": "
|
|
226
|
-
"
|
|
227
|
-
"
|
|
223
|
+
"icon": "BFFw2a_icon",
|
|
224
|
+
"button": "BFFw2a_button",
|
|
225
|
+
"wrap": "BFFw2a_wrap",
|
|
226
|
+
"warning": "BFFw2a_warning",
|
|
227
|
+
"error": "BFFw2a_error"
|
|
228
228
|
};
|
|
229
229
|
//#endregion
|
|
230
230
|
//#region src/client/CompactGuardButton.tsx
|
|
@@ -292,7 +292,7 @@ window.__ModuleLoader__.load({
|
|
|
292
292
|
}
|
|
293
293
|
//#endregion
|
|
294
294
|
//#region \0dsh-css:src/client/SettingsCard.module.css.mjs
|
|
295
|
-
const css = ".
|
|
295
|
+
const css = ".DKjZXq_card{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-3);border-radius:12px;list-style:none;transition:border-color .16s,background .16s}.DKjZXq_card:hover{border-color:var(--dsw-alias-label-dimmed)}.DKjZXq_cardOpen{background:var(--dsw-alias-bg-layer-2);border-color:var(--dsw-alias-label-dimmed)}.DKjZXq_header{appearance:none;width:100%;font:inherit;color:inherit;text-align:left;cursor:pointer;background:0 0;border:0;border-radius:12px;align-items:center;gap:12px;padding:14px 16px;display:flex}.DKjZXq_header:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:-2px}.DKjZXq_headText{flex-direction:column;flex:1;gap:4px;min-width:0;display:flex}.DKjZXq_name{color:var(--dsw-alias-label-primary);font-size:15px;font-weight:600;line-height:1.4}.DKjZXq_description{color:var(--dsw-alias-label-tertiary);font-size:13px;line-height:1.5}.DKjZXq_chevron{color:var(--dsw-alias-label-tertiary);flex:none;transition:transform .16s}.DKjZXq_chevronOpen{transform:rotate(180deg)}.DKjZXq_body{border-top:1px solid var(--dsw-alias-border-l2);flex-direction:column;gap:12px;margin:0 16px;padding:12px 0 8px;display:flex}.DKjZXq_field{flex-direction:column;gap:6px;display:flex}.DKjZXq_fieldHead{align-items:center;gap:8px;display:flex}.DKjZXq_fieldName{color:var(--dsw-alias-label-primary);font-size:13px;font-weight:500;line-height:1.4}.DKjZXq_badge{background:var(--dsw-alias-state-warn-tertiary);color:var(--dsw-alias-state-warn-label);border-radius:999px;padding:2px 6px;font-size:11px;line-height:1}.DKjZXq_inputRow{align-items:center;gap:8px;display:flex}.DKjZXq_input{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-1);width:140px;color:var(--dsw-alias-label-primary);border-radius:8px;padding:4px 8px;font-size:13px;line-height:1.4}.DKjZXq_input:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:-1px}.DKjZXq_inputInvalid{border-color:var(--dsw-alias-state-error-primary)}.DKjZXq_reset{appearance:none;color:var(--dsw-alias-label-tertiary);cursor:pointer;background:0 0;border:0;border-radius:6px;padding:2px 6px;font-size:12px;line-height:1.4}.DKjZXq_reset:hover{color:var(--dsw-alias-label-primary)}.DKjZXq_hint{color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:1.5}.DKjZXq_footer{justify-content:flex-end;align-items:center;gap:8px;margin-top:4px;display:flex}.DKjZXq_status{flex:1;min-width:0}.DKjZXq_saved{color:var(--dsw-alias-state-success-primary);font-size:12px}.DKjZXq_errorText{color:var(--dsw-alias-state-error-primary);font-size:12px}.DKjZXq_secondary,.DKjZXq_save{appearance:none;border:1px solid var(--dsw-alias-border-l2);cursor:pointer;background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary);border-radius:8px;padding:4px 12px;font-size:13px;line-height:1.4}.DKjZXq_secondary:disabled,.DKjZXq_save:disabled{opacity:.5;cursor:default}.DKjZXq_save{background:var(--dsw-alias-state-business-primary);color:var(--dsw-alias-label-primary-foreground);border-color:#0000}.DKjZXq_save:hover:not(:disabled){filter:brightness(.95)}";
|
|
296
296
|
const tagId = "@khorsheed/dsh-context-guard/SettingsCard.module.css";
|
|
297
297
|
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId) + "]") === null) {
|
|
298
298
|
const tag = document.createElement("style");
|
|
@@ -302,30 +302,30 @@ window.__ModuleLoader__.load({
|
|
|
302
302
|
document.head.appendChild(tag);
|
|
303
303
|
}
|
|
304
304
|
var SettingsCard_module_css_default = {
|
|
305
|
-
"
|
|
306
|
-
"headText": "
|
|
307
|
-
"
|
|
308
|
-
"
|
|
309
|
-
"
|
|
310
|
-
"
|
|
311
|
-
"
|
|
312
|
-
"
|
|
313
|
-
"
|
|
314
|
-
"body": "
|
|
315
|
-
"
|
|
316
|
-
"
|
|
317
|
-
"
|
|
318
|
-
"
|
|
319
|
-
"
|
|
320
|
-
"
|
|
321
|
-
"
|
|
322
|
-
"
|
|
323
|
-
"
|
|
324
|
-
"
|
|
325
|
-
"
|
|
326
|
-
"
|
|
327
|
-
"
|
|
328
|
-
"chevronOpen": "
|
|
305
|
+
"fieldHead": "DKjZXq_fieldHead",
|
|
306
|
+
"headText": "DKjZXq_headText",
|
|
307
|
+
"chevron": "DKjZXq_chevron",
|
|
308
|
+
"inputRow": "DKjZXq_inputRow",
|
|
309
|
+
"hint": "DKjZXq_hint",
|
|
310
|
+
"saved": "DKjZXq_saved",
|
|
311
|
+
"header": "DKjZXq_header",
|
|
312
|
+
"description": "DKjZXq_description",
|
|
313
|
+
"name": "DKjZXq_name",
|
|
314
|
+
"body": "DKjZXq_body",
|
|
315
|
+
"errorText": "DKjZXq_errorText",
|
|
316
|
+
"field": "DKjZXq_field",
|
|
317
|
+
"reset": "DKjZXq_reset",
|
|
318
|
+
"fieldName": "DKjZXq_fieldName",
|
|
319
|
+
"status": "DKjZXq_status",
|
|
320
|
+
"cardOpen": "DKjZXq_cardOpen",
|
|
321
|
+
"inputInvalid": "DKjZXq_inputInvalid",
|
|
322
|
+
"save": "DKjZXq_save",
|
|
323
|
+
"card": "DKjZXq_card",
|
|
324
|
+
"badge": "DKjZXq_badge",
|
|
325
|
+
"input": "DKjZXq_input",
|
|
326
|
+
"footer": "DKjZXq_footer",
|
|
327
|
+
"secondary": "DKjZXq_secondary",
|
|
328
|
+
"chevronOpen": "DKjZXq_chevronOpen"
|
|
329
329
|
};
|
|
330
330
|
//#endregion
|
|
331
331
|
//#region src/client/SettingsCard.tsx
|
package/lib/index.js
CHANGED
|
@@ -31,8 +31,9 @@ const thresholdField = z.number().min(.01).max(1).default(.8);
|
|
|
31
31
|
* (3.18.4, host rc.1 — SettingsForms serves and edits ONLY volatile fields);
|
|
32
32
|
* 0.1.5's schemastery (3.18.2) has no such method, the probe leaves the field
|
|
33
33
|
* plain, and the legacy register path carries the section (the marker is
|
|
34
|
-
* inert there). The
|
|
35
|
-
*
|
|
34
|
+
* inert there). The probe reads the typed method directly (3.18.4 declares
|
|
35
|
+
* `Schema.prototype.volatile`); the dev line resolves 3.18.4, older floors
|
|
36
|
+
* keep the runtime fallback.
|
|
36
37
|
*/
|
|
37
38
|
const ContextGuardSettingsSchema = z.object({ thresholdRatio: typeof thresholdField.volatile === "function" ? thresholdField.volatile() : thresholdField });
|
|
38
39
|
//#endregion
|
package/lib/types/settings.d.ts
CHANGED
|
@@ -19,8 +19,9 @@ import z from '@deepseek-ai/schemastery';
|
|
|
19
19
|
* (3.18.4, host rc.1 — SettingsForms serves and edits ONLY volatile fields);
|
|
20
20
|
* 0.1.5's schemastery (3.18.2) has no such method, the probe leaves the field
|
|
21
21
|
* plain, and the legacy register path carries the section (the marker is
|
|
22
|
-
* inert there). The
|
|
23
|
-
*
|
|
22
|
+
* inert there). The probe reads the typed method directly (3.18.4 declares
|
|
23
|
+
* `Schema.prototype.volatile`); the dev line resolves 3.18.4, older floors
|
|
24
|
+
* keep the runtime fallback.
|
|
24
25
|
*/
|
|
25
26
|
export declare const ContextGuardSettingsSchema: z;
|
|
26
27
|
//# sourceMappingURL=settings.d.ts.map
|
package/lib/types/settings.js
CHANGED
|
@@ -20,8 +20,9 @@ const thresholdField = z.number().min(0.01).max(1).default(0.8);
|
|
|
20
20
|
* (3.18.4, host rc.1 — SettingsForms serves and edits ONLY volatile fields);
|
|
21
21
|
* 0.1.5's schemastery (3.18.2) has no such method, the probe leaves the field
|
|
22
22
|
* plain, and the legacy register path carries the section (the marker is
|
|
23
|
-
* inert there). The
|
|
24
|
-
*
|
|
23
|
+
* inert there). The probe reads the typed method directly (3.18.4 declares
|
|
24
|
+
* `Schema.prototype.volatile`); the dev line resolves 3.18.4, older floors
|
|
25
|
+
* keep the runtime fallback.
|
|
25
26
|
*/
|
|
26
27
|
export const ContextGuardSettingsSchema = z.object({
|
|
27
28
|
thresholdRatio: typeof thresholdField.volatile === 'function'
|
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"context",
|
|
9
9
|
"compaction"
|
|
10
10
|
],
|
|
11
|
-
"version": "0.2.
|
|
11
|
+
"version": "0.2.4",
|
|
12
12
|
"type": "module",
|
|
13
13
|
"main": "lib/index.js",
|
|
14
14
|
"types": "lib/types/index.d.ts",
|
|
@@ -54,14 +54,14 @@
|
|
|
54
54
|
"license": "MIT",
|
|
55
55
|
"peerDependencies": {
|
|
56
56
|
"@deepseek-ai/cordis": "^4.0.1",
|
|
57
|
-
"@deepseek-ai/dsh-api-remotes": "^0.1.0-rc.6",
|
|
58
|
-
"@deepseek-ai/dsh-client-locale": "^0.1.0-rc.6",
|
|
59
|
-
"@deepseek-ai/dsh-client-ui-conversation": "^0.1.0-rc.6",
|
|
60
|
-
"@deepseek-ai/dsh-client-ui-primitives": "^0.1.0-rc.6",
|
|
61
|
-
"@deepseek-ai/dsh-client-ui-settings": "^0.1.0-rc.6",
|
|
62
|
-
"@deepseek-ai/dsh-client-ui-slots": "^0.1.0-rc.6",
|
|
63
|
-
"@deepseek-ai/dsh-invariants": "^0.1.0-rc.6",
|
|
64
|
-
"@deepseek-ai/dsh-token-meter": "^0.1.0-rc.6",
|
|
57
|
+
"@deepseek-ai/dsh-api-remotes": "^0.1.0-rc.6 || ^0.2.0-rc.1",
|
|
58
|
+
"@deepseek-ai/dsh-client-locale": "^0.1.0-rc.6 || ^0.2.0-rc.1",
|
|
59
|
+
"@deepseek-ai/dsh-client-ui-conversation": "^0.1.0-rc.6 || ^0.2.0-rc.1",
|
|
60
|
+
"@deepseek-ai/dsh-client-ui-primitives": "^0.1.0-rc.6 || ^0.2.0-rc.1",
|
|
61
|
+
"@deepseek-ai/dsh-client-ui-settings": "^0.1.0-rc.6 || ^0.2.0-rc.1",
|
|
62
|
+
"@deepseek-ai/dsh-client-ui-slots": "^0.1.0-rc.6 || ^0.2.0-rc.1",
|
|
63
|
+
"@deepseek-ai/dsh-invariants": "^0.1.0-rc.6 || ^0.2.0-rc.1",
|
|
64
|
+
"@deepseek-ai/dsh-token-meter": "^0.1.0-rc.6 || ^0.2.0-rc.1",
|
|
65
65
|
"react": "^18.2.0"
|
|
66
66
|
},
|
|
67
67
|
"files": [
|