@khorsheed/dsh-context-guard 0.2.6 → 0.2.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/CHANGELOG.md +4 -0
- package/README.en.md +5 -3
- package/README.i18n.yaml +2 -2
- package/README.md +5 -2
- package/lib/client.js +20 -20
- package/lib/types/client/icons.d.ts +1 -2
- package/lib/types/client/icons.js +0 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
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-basic/main/docs/screenshots/context-guard-button.png" width="
|
|
9
|
+
<img src="https://raw.githubusercontent.com/Khorsheed/dsh-basic/main/docs/screenshots/context-guard-button.png" width="560" alt="the compact button appears in the composer toolbar once context occupancy crosses the configured ratio">
|
|
10
10
|
|
|
11
11
|
## Features
|
|
12
12
|
|
|
@@ -15,8 +15,6 @@ 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-basic/main/docs/screenshots/context-guard-settings.png" width="640" alt="the trigger ratio is configurable in settings (0.01–1)">
|
|
19
|
-
|
|
20
18
|
## Install
|
|
21
19
|
|
|
22
20
|
```sh
|
|
@@ -33,6 +31,10 @@ dsh plugin --profile web remove @khorsheed/dsh-context-guard
|
|
|
33
31
|
|
|
34
32
|
One tunable, editable in the GUI and live with no restart — on 0.1.5 under Settings → Plugins ("压缩提醒时机 / Compaction reminder timing"); on 0.1.6-alpha.2+ in the bundle's own configuration section on its Plugins-page detail view.
|
|
35
33
|
|
|
34
|
+
<img src="https://raw.githubusercontent.com/Khorsheed/dsh-basic/main/docs/screenshots/context-guard-config-1.png" width="560" alt="The Plugins page's built-in plugin settings: the last card is Compaction reminder timing">
|
|
35
|
+
|
|
36
|
+
<img src="https://raw.githubusercontent.com/Khorsheed/dsh-basic/main/docs/screenshots/context-guard-config-2.png" width="560" alt="The Compaction reminder timing detail page: the reminder ratio set to 0.3 (customized), range 0.01–1, with Reset">
|
|
37
|
+
|
|
36
38
|
| Key | Default | Meaning |
|
|
37
39
|
|---|---|---|
|
|
38
40
|
| `thresholdRatio` | `0.8` | Context occupancy fraction at which the button appears (clamped to (0, 1]). Lower it to be reminded earlier — the provider rejection wall sits below 100% occupancy (see *How it works*). |
|
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: 22b915c36929319553c65fac2892efeaaa8ec4af
|
|
6
|
+
packages/context-guard/README.md: 915c4eb527d89be0c4bc6f6d48878e1ec37592f1
|
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-basic/main/docs/screenshots/context-guard-button.png" width="
|
|
9
|
+
<img src="https://raw.githubusercontent.com/Khorsheed/dsh-basic/main/docs/screenshots/context-guard-button.png" width="560" alt="上下文占用越过配置比例后,输入框工具栏里出现琥珀色的压缩按钮">
|
|
10
10
|
|
|
11
11
|
## 功能
|
|
12
12
|
|
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
- **执行官方 `/compact`**——空闲门控、压缩锁和流程展示都由宿主负责,点击的效果和手打命令一模一样。
|
|
16
16
|
- **一个实时可调项**——提醒阈值在设置里改,保存即生效,不用重启。
|
|
17
17
|
|
|
18
|
-
<img src="https://raw.githubusercontent.com/Khorsheed/dsh-basic/main/docs/screenshots/context-guard-settings.png" width="640" alt="提醒比例可在设置中按偏好调整(0.01–1)">
|
|
19
18
|
|
|
20
19
|
## 安装
|
|
21
20
|
|
|
@@ -33,6 +32,10 @@ dsh plugin --profile web remove @khorsheed/dsh-context-guard
|
|
|
33
32
|
|
|
34
33
|
一个可调项,在 GUI 里改且实时生效,无需重启——0.1.5:设置 → 插件配置 →「压缩提醒时机 / Compaction reminder timing」;0.1.6-alpha.2 起:插件管理页 → 本包详情页的配置区。
|
|
35
34
|
|
|
35
|
+
<img src="https://raw.githubusercontent.com/Khorsheed/dsh-basic/main/docs/screenshots/context-guard-config-1.png" width="560" alt="「插件」页的「内置插件配置」:最后一张是「压缩提醒时机」卡片">
|
|
36
|
+
|
|
37
|
+
<img src="https://raw.githubusercontent.com/Khorsheed/dsh-basic/main/docs/screenshots/context-guard-config-2.png" width="560" alt="「压缩提醒时机」详情页:提醒比例改成 0.3(已自定义),可配置范围 0.01–1,旁边是重置">
|
|
38
|
+
|
|
36
39
|
| 键 | 默认值 | 含义 |
|
|
37
40
|
|---|---|---|
|
|
38
41
|
| `thresholdRatio` | `0.8` | 压缩按钮出现时的上下文占用比例(限制在 (0, 1])。想更早收到提醒就调低——provider 拒绝墙在 100% 占用之下(见「实现原理」)。 |
|
package/lib/client.js
CHANGED
|
@@ -207,11 +207,11 @@ window.__ModuleLoader__.load({
|
|
|
207
207
|
document.head.appendChild(tag);
|
|
208
208
|
}
|
|
209
209
|
var CompactGuardButton_module_css_default = {
|
|
210
|
-
"wrap": "BFFw2a_wrap",
|
|
211
|
-
"button": "BFFw2a_button",
|
|
212
|
-
"icon": "BFFw2a_icon",
|
|
213
210
|
"warning": "BFFw2a_warning",
|
|
214
|
-
"
|
|
211
|
+
"button": "BFFw2a_button",
|
|
212
|
+
"error": "BFFw2a_error",
|
|
213
|
+
"wrap": "BFFw2a_wrap",
|
|
214
|
+
"icon": "BFFw2a_icon"
|
|
215
215
|
};
|
|
216
216
|
//#endregion
|
|
217
217
|
//#region src/client/CompactGuardButton.tsx
|
|
@@ -289,30 +289,30 @@ window.__ModuleLoader__.load({
|
|
|
289
289
|
document.head.appendChild(tag);
|
|
290
290
|
}
|
|
291
291
|
var SettingsCard_module_css_default = {
|
|
292
|
-
"
|
|
293
|
-
"
|
|
294
|
-
"
|
|
295
|
-
"
|
|
292
|
+
"badge": "DKjZXq_badge",
|
|
293
|
+
"inputRow": "DKjZXq_inputRow",
|
|
294
|
+
"headText": "DKjZXq_headText",
|
|
295
|
+
"inputInvalid": "DKjZXq_inputInvalid",
|
|
296
296
|
"reset": "DKjZXq_reset",
|
|
297
|
-
"
|
|
297
|
+
"header": "DKjZXq_header",
|
|
298
298
|
"chevronOpen": "DKjZXq_chevronOpen",
|
|
299
|
-
"saved": "DKjZXq_saved",
|
|
300
299
|
"fieldName": "DKjZXq_fieldName",
|
|
301
|
-
"card": "DKjZXq_card",
|
|
302
|
-
"field": "DKjZXq_field",
|
|
303
|
-
"body": "DKjZXq_body",
|
|
304
|
-
"hint": "DKjZXq_hint",
|
|
305
300
|
"fieldHead": "DKjZXq_fieldHead",
|
|
301
|
+
"chevron": "DKjZXq_chevron",
|
|
302
|
+
"name": "DKjZXq_name",
|
|
303
|
+
"description": "DKjZXq_description",
|
|
304
|
+
"input": "DKjZXq_input",
|
|
305
|
+
"hint": "DKjZXq_hint",
|
|
306
306
|
"status": "DKjZXq_status",
|
|
307
|
-
"footer": "DKjZXq_footer",
|
|
308
307
|
"errorText": "DKjZXq_errorText",
|
|
309
|
-
"
|
|
310
|
-
"
|
|
311
|
-
"badge": "DKjZXq_badge",
|
|
308
|
+
"field": "DKjZXq_field",
|
|
309
|
+
"footer": "DKjZXq_footer",
|
|
312
310
|
"secondary": "DKjZXq_secondary",
|
|
313
|
-
"headText": "DKjZXq_headText",
|
|
314
311
|
"save": "DKjZXq_save",
|
|
315
|
-
"
|
|
312
|
+
"saved": "DKjZXq_saved",
|
|
313
|
+
"cardOpen": "DKjZXq_cardOpen",
|
|
314
|
+
"body": "DKjZXq_body",
|
|
315
|
+
"card": "DKjZXq_card"
|
|
316
316
|
};
|
|
317
317
|
//#endregion
|
|
318
318
|
//#region src/client/SettingsCard.tsx
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Generated by scripts/sync-icon-artwork.mts from @deepseek-ai/dsh-client-ui-primitives
|
|
3
|
-
* (v0.1
|
|
3
|
+
* (v0.2.1-rc.1, harness 1600d8a1e1) — do not edit by hand. The 0.1.5 and rc.1 host lines
|
|
4
4
|
* share no icon export name, so the rc.1 artwork is inlined here: pure SVG,
|
|
5
5
|
* no host runtime identity, identical on every line. Re-run the generator
|
|
6
6
|
* after adding an icon import or bumping the harness checkout.
|
|
@@ -14,6 +14,5 @@ export interface IconProps {
|
|
|
14
14
|
/** Extra class for layout placement; color rides currentColor. */
|
|
15
15
|
className?: string | undefined;
|
|
16
16
|
}
|
|
17
|
-
export declare const IconChevronDownOutlineMedium: ({ size, className }: IconProps) => import("react").JSX.Element;
|
|
18
17
|
export declare const IconWarningOutlineMedium: ({ size, className }: IconProps) => import("react").JSX.Element;
|
|
19
18
|
//# sourceMappingURL=icons.d.ts.map
|
|
@@ -1,3 +1,2 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
export const IconChevronDownOutlineMedium = ({ size = 14, className }) => (_jsx("svg", { width: size, height: size, className: className, viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", strokeWidth: 1.3, children: _jsx("path", { d: "M4 6L7.29289 9.29289C7.68342 9.68342 8.31658 9.68342 8.70711 9.29289L12 6", stroke: "currentColor" }) }));
|
|
3
2
|
export const IconWarningOutlineMedium = ({ size = 16, className }) => (_jsxs("svg", { width: size, height: size, className: className, viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", strokeWidth: 1.3, children: [_jsx("path", { d: "M8 14.5C11.5899 14.5 14.5 11.5899 14.5 8C14.5 4.41015 11.5899 1.5 8 1.5C4.41015 1.5 1.5 4.41015 1.5 8C1.5 11.5899 4.41015 14.5 8 14.5Z", stroke: "currentColor" }), _jsx("path", { d: "M8 4.29199V9.79199", stroke: "currentColor" }), _jsx("path", { d: "M8 10.708V11.708", stroke: "currentColor" })] }));
|