dsh-context-compression-improved 0.7.0-beta.1 → 0.7.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.
Files changed (83) hide show
  1. package/.github/workflows/ci.yml +39 -39
  2. package/CHANGELOG.ja.md +217 -220
  3. package/CHANGELOG.ko.md +211 -214
  4. package/CHANGELOG.md +401 -376
  5. package/CHANGELOG.zh.md +196 -199
  6. package/README.md +97 -97
  7. package/README.zh.md +86 -86
  8. package/package.json +1 -1
  9. package/packages/selector/dsh.plugin.json +1 -1
  10. package/packages/selector/lib/client.d.ts +44 -0
  11. package/packages/selector/lib/client.js +1733 -6
  12. package/packages/selector/lib/{intent-gate.js → config.js} +799 -136
  13. package/packages/selector/lib/index.d.ts +13 -1
  14. package/packages/selector/lib/index.js +204 -3
  15. package/packages/selector/lib/profiles.d.ts +6 -0
  16. package/packages/selector/lib/pruner.d.ts +6 -0
  17. package/packages/selector/lib/pruner.js +90 -258
  18. package/packages/selector/lib/style.css +88 -46
  19. package/packages/selector/src/client/CompressionProfileControls.tsx +293 -226
  20. package/packages/selector/src/client/CompressionProfileSelector.module.css +199 -170
  21. package/packages/selector/src/client/CompressionProfileSelector.tsx +85 -83
  22. package/packages/selector/src/client/decode.ts +57 -53
  23. package/packages/selector/src/client/index.ts +307 -213
  24. package/packages/selector/src/client/locales/de.ts +141 -0
  25. package/packages/selector/src/client/locales/es.ts +141 -0
  26. package/packages/selector/src/client/locales/fr.ts +141 -0
  27. package/packages/selector/src/client/locales/it.ts +141 -0
  28. package/packages/selector/src/client/locales/ja.ts +141 -0
  29. package/packages/selector/src/client/locales/ko.ts +141 -0
  30. package/packages/selector/src/client/locales/ru.ts +141 -0
  31. package/packages/selector/src/client/locales.ts +282 -196
  32. package/packages/selector/src/client/monitor-fab.ts +336 -0
  33. package/packages/selector/src/client/savings-card.tsx +150 -0
  34. package/packages/selector/src/client/settings-section.tsx +140 -124
  35. package/packages/selector/src/deepseek-v4-tokenizer.ts +205 -205
  36. package/packages/selector/src/index.ts +207 -5
  37. package/packages/selector/src/preset-overlay.ts +629 -629
  38. package/packages/selector/src/profiles.ts +431 -414
  39. package/packages/selector/src/pruner/content.ts +198 -198
  40. package/packages/selector/src/pruner/state.ts +57 -57
  41. package/packages/selector/src/pruner.ts +2759 -2665
  42. package/packages/selector/src/runtime/audit.ts +303 -303
  43. package/packages/selector/src/runtime/config.ts +756 -731
  44. package/packages/selector/src/runtime/monitor.ts +235 -0
  45. package/packages/selector/src/runtime/reducers.ts +1674 -1674
  46. package/packages/selector/src/runtime/retrieve.ts +479 -457
  47. package/packages/selector/src/runtime/savings.ts +337 -0
  48. package/packages/selector/src/runtime/summary-command.ts +133 -133
  49. package/packages/selector/src/runtime/tokenpilot/advisor-prompt.ts +233 -233
  50. package/packages/selector/src/runtime/tokenpilot/advisor-state.ts +204 -204
  51. package/packages/selector/src/runtime/tokenpilot/intent-fold.ts +53 -53
  52. package/packages/selector/src/runtime/tokenpilot/intent-gate.ts +65 -65
  53. package/packages/selector/src/runtime/tokenpilot/intent-input-mask.ts +125 -125
  54. package/packages/selector/src/runtime/tokenpilot/intent-range.ts +37 -37
  55. package/packages/selector/src/runtime/tokenpilot/locator.ts +128 -128
  56. package/packages/selector/src/runtime/tokenpilot/sidechannel.ts +306 -306
  57. package/packages/selector/src/runtime/types.ts +365 -358
  58. package/packages/selector/tests/built/client-artifact.spec.ts +61 -61
  59. package/packages/selector/tests/code-skeleton.client.spec.ts +2 -2
  60. package/packages/selector/tests/custom-contract.client.spec.ts +2 -2
  61. package/packages/selector/tests/estimator-channel.client.spec.tsx +2 -0
  62. package/packages/selector/tests/estimator-route-registration.host.spec.ts +194 -188
  63. package/packages/selector/tests/helpers/legacy-settings/index.ts +15 -15
  64. package/packages/selector/tests/helpers/legacy-settings/legacy/provider.d.ts +41 -41
  65. package/packages/selector/tests/helpers/legacy-settings/legacy/provider.js +647 -647
  66. package/packages/selector/tests/helpers/legacy-settings/legacy/redact.js +78 -78
  67. package/packages/selector/tests/helpers/legacy-settings/legacy/util-values.js +234 -234
  68. package/packages/selector/tests/host-preset-overlay.host.spec.ts +203 -203
  69. package/packages/selector/tests/monitor-fab.client.spec.ts +138 -0
  70. package/packages/selector/tests/runtime/auto-compact-config.spec.ts +523 -523
  71. package/packages/selector/tests/runtime/deepseek-v4-tokenizer.spec.ts +122 -122
  72. package/packages/selector/tests/runtime/intent-gate.spec.ts +62 -62
  73. package/packages/selector/tests/runtime/intent-summary.spec.ts +156 -156
  74. package/packages/selector/tests/runtime/monitor.spec.ts +301 -0
  75. package/packages/selector/tests/runtime/savings.spec.ts +120 -0
  76. package/packages/selector/tests/runtime/summary-command.spec.ts +154 -154
  77. package/packages/selector/tests/settings-seat.client.spec.ts +177 -165
  78. package/scripts/packed-components-smoke.mjs +734 -734
  79. package/scripts/packed-install-e2e.mjs +1 -1
  80. package/scripts/verify-release.mjs +1 -1
  81. package/tests/TEST_INVENTORY.md +41 -41
  82. package/tsconfig.tests.json +17 -17
  83. package/vitest.config.ts +57 -57
@@ -416,7 +416,7 @@ async function runOfficialCloneCliSmoke(referenceRoot, registry, upgradeFrom, ca
416
416
  * ui-slot packages) the web bundler supplies, and that stack is verified
417
417
  * from the built client libraries below.
418
418
  */
419
- const HOST_PLANE_ENTRIES = ['index.js', 'pruner.js', 'advisor-state.js', 'tail-trim.js', 'invariant.js']
419
+ const HOST_PLANE_ENTRIES = ['index.js', 'pruner.js', 'config.js', 'tail-trim.js', 'invariant.js']
420
420
 
421
421
  /**
422
422
  * Bare package names the installed package's host-plane runtime files import.
@@ -49,7 +49,7 @@ const INSTALLATION_PROVIDED_RUNTIME = new Set([
49
49
  // stack (`react`, the ui-slot packages); its requires are reviewed from the
50
50
  // built artifact further down instead.
51
51
  const HOST_PLANE_ENTRIES = [
52
- 'lib/intent-gate.js',
52
+ 'lib/config.js',
53
53
  'lib/index.js',
54
54
  'lib/invariant.js',
55
55
  'lib/pruner.js',
@@ -1,41 +1,41 @@
1
- # Test inventory
2
-
3
- Every checked-in spec belongs to an active test project. There is no silent
4
- legacy-test allowlist.
5
-
6
- ## Root suite
7
-
8
- - Runtime: `packages/runtime/tests/**/*.spec.ts` under the `runtime` project.
9
- - Selector Host: `cache-prefix-audit.spec.ts` plus every `*.host.spec.ts` under
10
- the `selector-host` project.
11
- - Selector client: every `*.client.spec.ts` or `*.client.spec.tsx` under the
12
- `selector-client` project.
13
- - Built browser artifact: `packages/selector/tests/built/client-artifact.spec.ts`
14
- under the separate `vitest.built.config.ts` gate, after `pnpm build`.
15
-
16
- The root `pnpm test`, both package-local `pnpm test` commands, and
17
- `pnpm test:built` are release gates. `scripts/verify-release.mjs` compares the
18
- checked-in spec inventory with these project rules so a new test cannot be
19
- silently excluded.
20
-
21
- ## Removed transition tests
22
-
23
- The standalone extraction initially carried twelve specs copied from the
24
- integrated Harness worktree. They depended on removed private packages,
25
- monorepo-relative fixtures, or the retired `compaction/group-trim` event and
26
- were not executable in a public checkout. They were removed instead of
27
- reintroducing Harness core dependencies.
28
-
29
- Their supported behavior is covered by active public tests:
30
-
31
- - policy resolution, reducers, exact measurement, Fresh, Aggregate, routine
32
- and capacity-pressure History, Native pruning, TailTrim publication,
33
- recovery, replay and orphan fail-open behavior:
34
- `packages/selector/tests/runtime/public/public-runtime.spec.ts`;
35
- - Loader composition, preset overlay, Minimal pause/restore and parent/child
36
- service identity: `packages/selector/tests/preset-overlay-loader.e2e.host.spec.ts`;
37
- - package/export/tarball contract:
38
- `packages/selector/tests/public/package-contract.client.spec.ts` and
39
- `scripts/packed-install-e2e.mjs`;
40
- - profile and Custom editor behavior:
41
- `packages/selector/tests/profiles.client.spec.tsx`.
1
+ # Test inventory
2
+
3
+ Every checked-in spec belongs to an active test project. There is no silent
4
+ legacy-test allowlist.
5
+
6
+ ## Root suite
7
+
8
+ - Runtime: `packages/selector/tests/runtime/**/*.spec.ts` under the `runtime` project.
9
+ - Selector Host: `cache-prefix-audit.spec.ts` plus every `*.host.spec.ts` under
10
+ the `selector-host` project.
11
+ - Selector client: every `*.client.spec.ts` or `*.client.spec.tsx` under the
12
+ `selector-client` project.
13
+ - Built browser artifact: `packages/selector/tests/built/client-artifact.spec.ts`
14
+ under the separate `vitest.built.config.ts` gate, after `pnpm build`.
15
+
16
+ The root `pnpm test`, both package-local `pnpm test` commands, and
17
+ `pnpm test:built` are release gates. `scripts/verify-release.mjs` compares the
18
+ checked-in spec inventory with these project rules so a new test cannot be
19
+ silently excluded.
20
+
21
+ ## Removed transition tests
22
+
23
+ The standalone extraction initially carried twelve specs copied from the
24
+ integrated Harness worktree. They depended on removed private packages,
25
+ monorepo-relative fixtures, or the retired `compaction/group-trim` event and
26
+ were not executable in a public checkout. They were removed instead of
27
+ reintroducing Harness core dependencies.
28
+
29
+ Their supported behavior is covered by active public tests:
30
+
31
+ - policy resolution, reducers, exact measurement, Fresh, Aggregate, routine
32
+ and capacity-pressure History, Native pruning, TailTrim publication,
33
+ recovery, replay and orphan fail-open behavior:
34
+ `packages/selector/tests/runtime/public/public-runtime.spec.ts`;
35
+ - Loader composition, preset overlay, Minimal pause/restore and parent/child
36
+ service identity: `packages/selector/tests/preset-overlay-loader.e2e.host.spec.ts`;
37
+ - package/export/tarball contract:
38
+ `packages/selector/tests/public/package-contract.client.spec.ts` and
39
+ `scripts/packed-install-e2e.mjs`;
40
+ - profile and Custom editor behavior:
41
+ `packages/selector/tests/profiles.client.spec.tsx`.
@@ -1,17 +1,17 @@
1
- {
2
- "extends": "./tsconfig.base.json",
3
- "compilerOptions": {
4
- "noEmit": true,
5
- "composite": false
6
- },
7
- "include": [
8
- "packages/selector/src/**/*.ts",
9
- "packages/selector/src/**/*.tsx",
10
- "packages/selector/tests/**/*.ts",
11
- "packages/selector/tests/**/*.tsx",
12
- "vitest.config.ts",
13
- "vitest.built.config.ts",
14
- "packages/selector/tsdown.config.ts",
15
- "packages/selector/tsdown.client.config.ts"
16
- ]
17
- }
1
+ {
2
+ "extends": "./tsconfig.base.json",
3
+ "compilerOptions": {
4
+ "noEmit": true,
5
+ "composite": false
6
+ },
7
+ "include": [
8
+ "packages/selector/src/**/*.ts",
9
+ "packages/selector/src/**/*.tsx",
10
+ "packages/selector/tests/**/*.ts",
11
+ "packages/selector/tests/**/*.tsx",
12
+ "vitest.config.ts",
13
+ "vitest.built.config.ts",
14
+ "packages/selector/tsdown.config.ts",
15
+ "packages/selector/tsdown.client.config.ts"
16
+ ]
17
+ }
package/vitest.config.ts CHANGED
@@ -1,57 +1,57 @@
1
- import { defineConfig } from 'vitest/config'
2
- import { fileURLToPath } from 'node:url'
3
-
4
- export default defineConfig({
5
- test: {
6
- passWithNoTests: false,
7
- coverage: {
8
- provider: 'v8',
9
- include: ['packages/selector/src/**'],
10
- exclude: ['**/*.d.ts'],
11
- reporter: ['text', 'json-summary'],
12
- // Ratcheted just under the measured 0.1.7 baseline
13
- // (lines 82.16 / functions 83.95 / branches 69.93 / statements 78.40).
14
- thresholds: {
15
- lines: 82,
16
- functions: 83,
17
- branches: 69,
18
- statements: 78,
19
- },
20
- },
21
- projects: [
22
- {
23
- test: {
24
- name: 'runtime',
25
- environment: 'node',
26
- include: ['packages/selector/tests/runtime/**/*.spec.ts'],
27
- },
28
- },
29
- {
30
- test: {
31
- name: 'selector-host',
32
- environment: 'node',
33
- include: [
34
- 'packages/selector/tests/cache-prefix-audit.spec.ts',
35
- 'packages/selector/tests/estimator-catalog.spec.ts',
36
- 'packages/selector/tests/**/*.host.spec.ts',
37
- ],
38
- },
39
- },
40
- {
41
- resolve: {
42
- alias: {
43
- '@deepseek-ai/dsh-client-ui-primitives': fileURLToPath(new URL(
44
- './packages/selector/tests/support/ui-primitives.tsx',
45
- import.meta.url,
46
- )),
47
- },
48
- },
49
- test: {
50
- name: 'selector-client',
51
- environment: 'jsdom',
52
- include: ['packages/selector/tests/**/*.client.spec.{ts,tsx}'],
53
- },
54
- },
55
- ],
56
- },
57
- })
1
+ import { defineConfig } from 'vitest/config'
2
+ import { fileURLToPath } from 'node:url'
3
+
4
+ export default defineConfig({
5
+ test: {
6
+ passWithNoTests: false,
7
+ coverage: {
8
+ provider: 'v8',
9
+ include: ['packages/selector/src/**'],
10
+ exclude: ['**/*.d.ts'],
11
+ reporter: ['text', 'json-summary'],
12
+ // Ratcheted just under the measured 0.1.7 baseline
13
+ // (lines 82.16 / functions 83.95 / branches 69.93 / statements 78.40).
14
+ thresholds: {
15
+ lines: 82,
16
+ functions: 83,
17
+ branches: 69,
18
+ statements: 78,
19
+ },
20
+ },
21
+ projects: [
22
+ {
23
+ test: {
24
+ name: 'runtime',
25
+ environment: 'node',
26
+ include: ['packages/selector/tests/runtime/**/*.spec.ts'],
27
+ },
28
+ },
29
+ {
30
+ test: {
31
+ name: 'selector-host',
32
+ environment: 'node',
33
+ include: [
34
+ 'packages/selector/tests/cache-prefix-audit.spec.ts',
35
+ 'packages/selector/tests/estimator-catalog.spec.ts',
36
+ 'packages/selector/tests/**/*.host.spec.ts',
37
+ ],
38
+ },
39
+ },
40
+ {
41
+ resolve: {
42
+ alias: {
43
+ '@deepseek-ai/dsh-client-ui-primitives': fileURLToPath(new URL(
44
+ './packages/selector/tests/support/ui-primitives.tsx',
45
+ import.meta.url,
46
+ )),
47
+ },
48
+ },
49
+ test: {
50
+ name: 'selector-client',
51
+ environment: 'jsdom',
52
+ include: ['packages/selector/tests/**/*.client.spec.{ts,tsx}'],
53
+ },
54
+ },
55
+ ],
56
+ },
57
+ })