dsh-context-compression-improved 0.3.1 → 0.4.0-beta.1
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/.githooks/pre-push +37 -0
- package/package.json +2 -1
- package/packages/selector/cordis.patch.yml +12 -5
- package/packages/selector/lib/client.d.ts +24 -0
- package/packages/selector/lib/client.js +506 -5
- package/packages/selector/lib/config.js +27 -4
- package/packages/selector/lib/index.d.ts +7 -0
- package/packages/selector/lib/index.js +229 -1
- package/packages/selector/lib/pruner.d.ts +254 -0
- package/packages/selector/lib/pruner.js +714 -25
- package/packages/selector/package.json +0 -1
- package/packages/selector/src/client/EstimatorControls.tsx +101 -0
- package/packages/selector/src/client/ReviewOverlay.tsx +320 -0
- package/packages/selector/src/client/index.ts +17 -0
- package/packages/selector/src/client/locales.ts +38 -0
- package/packages/selector/src/client/preset-options.ts +1 -0
- package/packages/selector/src/client/review-scope.ts +16 -0
- package/packages/selector/src/client/settings-section.tsx +17 -8
- package/packages/selector/src/index.ts +308 -0
- package/packages/selector/src/profiles.ts +28 -1
- package/packages/selector/src/pruner/state.ts +27 -0
- package/packages/selector/src/pruner.ts +430 -10
- package/packages/selector/src/runtime/audit.ts +27 -0
- package/packages/selector/src/runtime/config.ts +33 -1
- package/packages/selector/src/runtime/tokenpilot/estimator.ts +60 -13
- package/packages/selector/src/runtime/tokenpilot/proposal.ts +223 -0
- package/packages/selector/src/runtime/tokenpilot/review-queue.ts +231 -0
- package/packages/selector/src/runtime/tokenpilot/review-storage.ts +122 -0
- package/packages/selector/src/runtime/types.ts +17 -0
- package/packages/selector/tests/code-skeleton.client.spec.ts +3 -2
- package/packages/selector/tests/custom-contract.client.spec.ts +3 -2
- package/packages/selector/tests/preset-options-write.client.spec.ts +34 -1
- package/packages/selector/tests/review-overlay.client.spec.tsx +118 -0
- package/packages/selector/tests/review-routes.host.spec.ts +290 -0
- package/packages/selector/tests/runtime/audit.spec.ts +44 -0
- package/packages/selector/tests/runtime/tokenpilot/estimator.spec.ts +23 -0
- package/packages/selector/tests/runtime/tokenpilot/profile-baseline.spec.ts +5 -0
- package/packages/selector/tests/runtime/tokenpilot/proposal.spec.ts +199 -0
- package/packages/selector/tests/runtime/tokenpilot/pruner-review.spec.ts +313 -0
- package/packages/selector/tests/runtime/tokenpilot/review-queue.spec.ts +168 -0
- package/packages/selector/tests/settings-seat.client.spec.ts +5 -4
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
# lib freshness gate (runs before every push from this repo).
|
|
3
|
+
#
|
|
4
|
+
# The plugin ships lib/ as a committed artifact and never builds on the
|
|
5
|
+
# client at install time, so a stale lib pushed to a branch is what users
|
|
6
|
+
# actually download. Rebuild here and refuse the push when the committed
|
|
7
|
+
# lib no longer matches the committed sources.
|
|
8
|
+
#
|
|
9
|
+
# Skip conditions:
|
|
10
|
+
# - the branch does not track a lib directory (non-plugin branches);
|
|
11
|
+
# - pnpm or the build itself fails for reasons unrelated to freshness
|
|
12
|
+
# (the push is allowed, the build problem surfaces in CI/typecheck).
|
|
13
|
+
|
|
14
|
+
ROOT="$(git rev-parse --show-toplevel)"
|
|
15
|
+
LIB_DIR="packages/selector/lib"
|
|
16
|
+
|
|
17
|
+
# Nothing to guard on branches without the shipped artifact.
|
|
18
|
+
if [ ! -f "$ROOT/$LIB_DIR/index.js" ]; then
|
|
19
|
+
exit 0
|
|
20
|
+
fi
|
|
21
|
+
|
|
22
|
+
echo "[pre-push] rebuilding lib to verify freshness..."
|
|
23
|
+
if ! (cd "$ROOT" && pnpm build >/dev/null 2>&1); then
|
|
24
|
+
echo "[pre-push] WARNING: pnpm build failed; skipping the lib freshness check." >&2
|
|
25
|
+
exit 0
|
|
26
|
+
fi
|
|
27
|
+
|
|
28
|
+
drift="$(git -C "$ROOT" diff --name-only -- "$LIB_DIR"; git -C "$ROOT" diff --cached --name-only -- "$LIB_DIR")"
|
|
29
|
+
if [ -n "$drift" ]; then
|
|
30
|
+
echo >&2 "[pre-push] BLOCKED: packages/selector/lib drifted from the committed sources."
|
|
31
|
+
echo >&2 "[pre-push] The build just refreshed it. Review and commit the lib changes:"
|
|
32
|
+
echo >&2 "[pre-push] git add packages/selector/lib && git commit --amend --no-edit (or a follow-up commit)"
|
|
33
|
+
echo >&2 "[pre-push] Then push again."
|
|
34
|
+
exit 1
|
|
35
|
+
fi
|
|
36
|
+
|
|
37
|
+
exit 0
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-context-compression-improved",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0-beta.1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"registry": "https://registry.npmjs.org",
|
|
6
6
|
"access": "public",
|
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
"client": {
|
|
37
37
|
"inject": [
|
|
38
38
|
"@deepseek-ai/dsh-client-locale",
|
|
39
|
+
"@deepseek-ai/dsh-client-ui-primitives",
|
|
39
40
|
"@deepseek-ai/dsh-client-ui-slots",
|
|
40
41
|
"@deepseek-ai/dsh-client-ui-settings"
|
|
41
42
|
],
|
|
@@ -6,16 +6,23 @@
|
|
|
6
6
|
name: 'dsh-context-compression-improved'
|
|
7
7
|
config:
|
|
8
8
|
presetOverlay: true
|
|
9
|
-
# The
|
|
10
|
-
#
|
|
11
|
-
#
|
|
12
|
-
#
|
|
13
|
-
#
|
|
9
|
+
# The HTTP routes ride their own row so the compression stack stays loadable
|
|
10
|
+
# on profiles that have no host web server. Measured on the host source:
|
|
11
|
+
# `dsh-host-webserver.register` performs no authorization check and
|
|
12
|
+
# `ctx.get(name)` only asks whether the providing fiber is active, so this
|
|
13
|
+
# `inject` is belt-and-braces — the row is simply absent instead of
|
|
14
14
|
# announcing a pending route on a webServer-less profile. The two-channel
|
|
15
15
|
# registration inside the plugin covers both arrival orders on its own.
|
|
16
|
+
#
|
|
17
|
+
# `reviewQueueRoute` belongs here and not on the bundle row: it gates the
|
|
18
|
+
# R4 human-review endpoints (`/review-queue`, `/review-decide`) and was
|
|
19
|
+
# never turned on, so the review overlay polled two 404s and the panel
|
|
20
|
+
# could not open. Both flags are set on exactly one row, so each route is
|
|
21
|
+
# registered exactly once.
|
|
16
22
|
- id: context-compression-improved-estimator-catalog
|
|
17
23
|
name: 'dsh-context-compression-improved'
|
|
18
24
|
inject:
|
|
19
25
|
- webServer
|
|
20
26
|
config:
|
|
21
27
|
estimatorCatalogRoute: true
|
|
28
|
+
reviewQueueRoute: true
|
|
@@ -84,6 +84,11 @@ interface PresetOptionsSettings {
|
|
|
84
84
|
readonly estimatorBaseUrl?: string;
|
|
85
85
|
readonly estimatorApiKey?: string;
|
|
86
86
|
readonly estimatorTimeoutMs?: number;
|
|
87
|
+
/** Review-mode overrides (beta); mirrors the runtime PresetOptions.reviewMode. */
|
|
88
|
+
readonly reviewMode?: boolean;
|
|
89
|
+
readonly reviewTimeoutTurns?: number;
|
|
90
|
+
readonly cacheHitDiscountAlpha?: number;
|
|
91
|
+
readonly reviewHighImpactTokens?: number;
|
|
87
92
|
}
|
|
88
93
|
/** Durable settings section owned by this package. */
|
|
89
94
|
interface ContextCompressionSettings {
|
|
@@ -141,6 +146,25 @@ declare const zh: {
|
|
|
141
146
|
'estimator.apiKey.set': string;
|
|
142
147
|
'estimator.apiKey.clear': string;
|
|
143
148
|
'estimator.apiKey.overwrite': string;
|
|
149
|
+
'review.title': string;
|
|
150
|
+
'review.description': string;
|
|
151
|
+
'review.enabled': string;
|
|
152
|
+
'review.enabled.on': string;
|
|
153
|
+
'review.enabled.off': string;
|
|
154
|
+
'review.timeoutTurns': string;
|
|
155
|
+
'review.alpha': string;
|
|
156
|
+
'review.highImpact': string;
|
|
157
|
+
'review.badge': string;
|
|
158
|
+
'review.summary.autoApplied': string;
|
|
159
|
+
'review.summary.reviewApplied': string;
|
|
160
|
+
'review.summary.expired': string;
|
|
161
|
+
'review.summary.voided': string;
|
|
162
|
+
'review.row.payback': string;
|
|
163
|
+
'review.row.expectedSaving': string;
|
|
164
|
+
'review.row.estimated': string;
|
|
165
|
+
'review.action.approve': string;
|
|
166
|
+
'review.action.reject': string;
|
|
167
|
+
'review.action.ignore': string;
|
|
144
168
|
'detail.tokenpilot-inspired': string;
|
|
145
169
|
'profile.custom': string;
|
|
146
170
|
'profile.native': string;
|