dsh-context-compression-improved 0.7.0-beta.1 → 0.8.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.
Files changed (65) hide show
  1. package/CHANGELOG.ja.md +226 -220
  2. package/CHANGELOG.ko.md +220 -214
  3. package/CHANGELOG.md +366 -376
  4. package/CHANGELOG.zh.md +204 -199
  5. package/README.ja.md +85 -85
  6. package/README.ko.md +85 -85
  7. package/README.md +98 -97
  8. package/README.zh.md +85 -86
  9. package/eslint.config.js +30 -76
  10. package/package.json +53 -55
  11. package/packages/selector/dsh.plugin.json +2 -2
  12. package/packages/selector/lib/{intent-gate.js → advisor-state.js} +3 -91
  13. package/packages/selector/lib/client.js +3 -14
  14. package/packages/selector/lib/index.js +1 -92
  15. package/packages/selector/lib/profiles.d.ts +0 -9
  16. package/packages/selector/lib/pruner.d.ts +0 -59
  17. package/packages/selector/lib/pruner.js +7 -410
  18. package/packages/selector/lib/style.css +46 -46
  19. package/packages/selector/package.json +114 -114
  20. package/packages/selector/src/client/decode.ts +2 -6
  21. package/packages/selector/src/deepseek-v4-tokenizer.ts +1 -1
  22. package/packages/selector/src/index.ts +411 -418
  23. package/packages/selector/src/preset-overlay.ts +0 -3
  24. package/packages/selector/src/profiles.ts +10 -30
  25. package/packages/selector/src/pruner/content.ts +1 -1
  26. package/packages/selector/src/pruner/state.ts +0 -7
  27. package/packages/selector/src/pruner.ts +9 -253
  28. package/packages/selector/src/runtime/audit.ts +0 -17
  29. package/packages/selector/src/runtime/config.ts +11 -36
  30. package/packages/selector/src/runtime/reducers.ts +1 -1
  31. package/packages/selector/src/runtime/tokenpilot/advisor-prompt.ts +1 -46
  32. package/packages/selector/src/runtime/tokenpilot/advisor-state.ts +0 -55
  33. package/packages/selector/src/runtime/tokenpilot/locator.ts +2 -2
  34. package/packages/selector/src/runtime/tokenpilot/sidechannel.ts +1 -4
  35. package/packages/selector/src/runtime/types.ts +0 -12
  36. package/packages/selector/tests/auto-compact.client.spec.tsx +213 -214
  37. package/packages/selector/tests/built/client-artifact.spec.ts +59 -61
  38. package/packages/selector/tests/code-skeleton.client.spec.ts +93 -94
  39. package/packages/selector/tests/custom-contract.client.spec.ts +222 -223
  40. package/packages/selector/tests/estimator-channel.client.spec.tsx +252 -252
  41. package/packages/selector/tests/host-preset-overlay.host.spec.ts +204 -204
  42. package/packages/selector/tests/preset-options-write.client.spec.ts +187 -188
  43. package/packages/selector/tests/preset-overlay-loader.e2e.host.spec.ts +200 -200
  44. package/packages/selector/tests/profiles.client.spec.tsx +434 -436
  45. package/packages/selector/tests/public/package-contract.client.spec.ts +78 -78
  46. package/packages/selector/tests/runtime/advice-never-withholds.host.spec.ts +230 -230
  47. package/packages/selector/tests/runtime/audit.spec.ts +274 -275
  48. package/packages/selector/tests/runtime/auto-compact-config.spec.ts +3 -3
  49. package/packages/selector/tests/runtime/deepseek-v4-tokenizer.spec.ts +4 -4
  50. package/packages/selector/tests/runtime/public/public-runtime.spec.ts +2731 -2736
  51. package/packages/selector/tests/standing-generation.host.spec.ts +724 -704
  52. package/pnpm-workspace.yaml +66 -66
  53. package/scripts/packed-components-smoke.mjs +0 -2
  54. package/scripts/packed-install-e2e.mjs +5 -7
  55. package/scripts/verify-release.mjs +2 -3
  56. package/tsconfig.tests.json +1 -3
  57. package/vitest.config.ts +0 -14
  58. package/packages/selector/src/runtime/summary-command.ts +0 -133
  59. package/packages/selector/src/runtime/tokenpilot/intent-fold.ts +0 -53
  60. package/packages/selector/src/runtime/tokenpilot/intent-gate.ts +0 -65
  61. package/packages/selector/src/runtime/tokenpilot/intent-input-mask.ts +0 -125
  62. package/packages/selector/src/runtime/tokenpilot/intent-range.ts +0 -37
  63. package/packages/selector/tests/runtime/intent-gate.spec.ts +0 -62
  64. package/packages/selector/tests/runtime/intent-summary.spec.ts +0 -156
  65. package/packages/selector/tests/runtime/summary-command.spec.ts +0 -154
package/eslint.config.js CHANGED
@@ -1,76 +1,30 @@
1
- import js from '@eslint/js'
2
- import globals from 'globals'
3
- import tseslint from 'typescript-eslint'
4
-
5
- const noUnusedVars = ['error', {
6
- argsIgnorePattern: '^_',
7
- varsIgnorePattern: '^_',
8
- caughtErrorsIgnorePattern: '^_',
9
- destructuredArrayIgnorePattern: '^_',
10
- }]
11
-
12
- // Gate scripts and test hosts legitimately traffic in `any` (JSON payloads,
13
- // untyped Harness service bridges); the unsafe-family noise there would drown
14
- // the signal, so they are scoped out while every other type-checked rule stays.
15
- const noUnsafeFamily = Object.fromEntries(
16
- [
17
- 'no-unsafe-argument',
18
- 'no-unsafe-assignment',
19
- 'no-unsafe-call',
20
- 'no-unsafe-member-access',
21
- 'no-unsafe-return',
22
- ].map(rule => [`@typescript-eslint/${rule}`, 'off']),
23
- )
24
-
25
- export default tseslint.config(
26
- {
27
- ignores: [
28
- '**/node_modules/**', '**/lib/**', '**/dist/**', '**/coverage/**',
29
- 'docs/**', 'scripts-dist/**',
30
- // Vendored 0.1.5-era helper shipped as plain JS; it has no tsconfig
31
- // project, so type-checked rules cannot run on it.
32
- 'packages/selector/tests/helpers/legacy-settings/**',
33
- ],
34
- },
35
- js.configs.recommended,
36
- ...tseslint.configs.recommendedTypeChecked,
37
- {
38
- // First-party TypeScript: full type-checked strength. Everything linted
39
- // here is included in tsconfig.tests.json (the only root-level project).
40
- files: ['packages/**/*.ts', 'packages/**/*.tsx', 'vitest.config.ts', 'vitest.built.config.ts'],
41
- languageOptions: {
42
- globals: { ...globals.browser, ...globals.node },
43
- parserOptions: {
44
- project: ['tsconfig.tests.json'],
45
- tsconfigRootDir: import.meta.dirname,
46
- },
47
- },
48
- rules: { '@typescript-eslint/no-unused-vars': noUnusedVars },
49
- },
50
- {
51
- // Spec files implement mock async methods purely to satisfy typed host
52
- // interfaces; requiring an await inside every one of them is noise.
53
- files: ['packages/selector/tests/**'],
54
- rules: { '@typescript-eslint/require-await': 'off', ...noUnsafeFamily },
55
- },
56
- {
57
- // Standalone .mjs gate scripts live outside every tsconfig; the default
58
- // project gives type-checked rules a loose type surface to work with.
59
- files: ['scripts/**/*.{js,mjs}', 'eslint.config.js'],
60
- languageOptions: {
61
- globals: { ...globals.browser, ...globals.node },
62
- parserOptions: {
63
- projectService: {
64
- allowDefaultProject: ['eslint.config.js', 'scripts/*.mjs'],
65
- },
66
- tsconfigRootDir: import.meta.dirname,
67
- },
68
- },
69
- rules: { '@typescript-eslint/no-unused-vars': noUnusedVars, ...noUnsafeFamily },
70
- },
71
- {
72
- // Terminal normalization intentionally matches ANSI/BEL control characters.
73
- files: ['packages/selector/src/runtime/reducers.ts'],
74
- rules: { 'no-control-regex': 'off' },
75
- },
76
- )
1
+ import js from '@eslint/js'
2
+ import globals from 'globals'
3
+ import tseslint from 'typescript-eslint'
4
+
5
+ export default tseslint.config(
6
+ {
7
+ ignores: ['**/node_modules/**', '**/lib/**', '**/dist/**', '**/coverage/**', 'docs/**'],
8
+ },
9
+ js.configs.recommended,
10
+ ...tseslint.configs.recommended,
11
+ {
12
+ files: ['packages/**/*.{ts,tsx}', 'scripts/**/*.{js,mjs}', 'eslint.config.js'],
13
+ languageOptions: {
14
+ globals: { ...globals.browser, ...globals.node },
15
+ },
16
+ rules: {
17
+ '@typescript-eslint/no-unused-vars': ['error', {
18
+ argsIgnorePattern: '^_',
19
+ varsIgnorePattern: '^_',
20
+ caughtErrorsIgnorePattern: '^_',
21
+ destructuredArrayIgnorePattern: '^_',
22
+ }],
23
+ },
24
+ },
25
+ {
26
+ // Terminal normalization intentionally matches ANSI/BEL control characters.
27
+ files: ['packages/selector/src/runtime/reducers.ts'],
28
+ rules: { 'no-control-regex': 'off' },
29
+ },
30
+ )
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "dsh-context-compression-improved",
3
- "version": "0.7.0-beta.1",
3
+ "version": "0.8.0-beta.1",
4
4
  "publishConfig": {
5
- "tag": "dsh-0.1.7"
5
+ "tag": "dsh-0.2.0"
6
6
  },
7
7
  "type": "module",
8
8
  "main": "packages/selector/lib/index.js",
@@ -52,13 +52,13 @@
52
52
  },
53
53
  "engines": {
54
54
  "node": "^22.19.0 || >=24.0.0",
55
- "dsh": ">=0.1.7-rc.1 <0.1.8-0"
55
+ "dsh": ">=0.2.0-rc.1 <0.2.1-0"
56
56
  },
57
57
  "peerDependencies": {
58
- "@deepseek-ai/dsh-client-locale": ">=0.1.7-rc.1 <0.1.8-0",
59
- "@deepseek-ai/dsh-client-ui-primitives": ">=0.1.7-rc.1 <0.1.8-0",
60
- "@deepseek-ai/dsh-client-ui-settings": ">=0.1.7-rc.1 <0.1.8-0",
61
- "@deepseek-ai/dsh-client-ui-slots": ">=0.1.7-rc.1 <0.1.8-0"
58
+ "@deepseek-ai/dsh-client-locale": ">=0.2.0-rc.1 <0.2.1-0",
59
+ "@deepseek-ai/dsh-client-ui-primitives": ">=0.2.0-rc.1 <0.2.1-0",
60
+ "@deepseek-ai/dsh-client-ui-settings": ">=0.2.0-rc.1 <0.2.1-0",
61
+ "@deepseek-ai/dsh-client-ui-slots": ">=0.2.0-rc.1 <0.2.1-0"
62
62
  },
63
63
  "peerDependenciesMeta": {
64
64
  "@deepseek-ai/dsh-client-locale": {
@@ -79,54 +79,54 @@
79
79
  "@deepseek-ai/cordis-plugin-group": "1.0.1",
80
80
  "@deepseek-ai/cordis-plugin-include": "1.0.6",
81
81
  "@deepseek-ai/cordis-plugin-loader": "1.0.2",
82
- "@deepseek-ai/dsh-agent": "0.1.7-rc.2",
83
- "@deepseek-ai/dsh-agent-loop": "0.1.7-rc.2",
84
- "@deepseek-ai/dsh-agent-loop-testkit": "0.1.7-rc.2",
82
+ "@deepseek-ai/dsh-agent": "0.2.0-rc.1",
83
+ "@deepseek-ai/dsh-agent-loop": "0.2.0-rc.1",
84
+ "@deepseek-ai/dsh-agent-loop-testkit": "0.2.0-rc.1",
85
85
  "@deepseek-ai/dsh-agent-presets": "0.1.6-alpha.2",
86
- "@deepseek-ai/dsh-anonymous-user-id": "0.1.7-rc.2",
87
- "@deepseek-ai/dsh-api-remotes": "0.1.7-rc.2",
88
- "@deepseek-ai/dsh-api-session-controller": "0.1.7-rc.2",
89
- "@deepseek-ai/dsh-atomic-write": "0.1.7-rc.2",
90
- "@deepseek-ai/dsh-attachment": "0.1.7-rc.2",
91
- "@deepseek-ai/dsh-client-locale": "0.1.7-rc.2",
92
- "@deepseek-ai/dsh-client-store": "0.1.7-rc.2",
93
- "@deepseek-ai/dsh-client-ui-primitives": "0.1.7-rc.2",
94
- "@deepseek-ai/dsh-client-ui-session": "0.1.7-rc.2",
95
- "@deepseek-ai/dsh-client-ui-settings": "0.1.7-rc.2",
96
- "@deepseek-ai/dsh-client-ui-slots": "0.1.7-rc.2",
97
- "@deepseek-ai/dsh-client-ui-workspace": "0.1.7-rc.2",
86
+ "@deepseek-ai/dsh-anonymous-user-id": "0.2.0-rc.1",
87
+ "@deepseek-ai/dsh-api-remotes": "0.2.0-rc.1",
88
+ "@deepseek-ai/dsh-api-session-controller": "0.2.0-rc.1",
89
+ "@deepseek-ai/dsh-atomic-write": "0.2.0-rc.1",
90
+ "@deepseek-ai/dsh-attachment": "0.2.0-rc.1",
91
+ "@deepseek-ai/dsh-client-locale": "0.2.0-rc.1",
92
+ "@deepseek-ai/dsh-client-store": "0.2.0-rc.1",
93
+ "@deepseek-ai/dsh-client-ui-primitives": "0.2.0-rc.1",
94
+ "@deepseek-ai/dsh-client-ui-session": "0.2.0-rc.1",
95
+ "@deepseek-ai/dsh-client-ui-settings": "0.2.0-rc.1",
96
+ "@deepseek-ai/dsh-client-ui-slots": "0.2.0-rc.1",
97
+ "@deepseek-ai/dsh-client-ui-workspace": "0.2.0-rc.1",
98
98
  "@deepseek-ai/dsh-code-runtime": "0.1.5-rc.3",
99
- "@deepseek-ai/dsh-command-compact": "0.1.7-rc.2",
100
- "@deepseek-ai/dsh-commands": "0.1.7-rc.2",
101
- "@deepseek-ai/dsh-compaction": "0.1.7-rc.2",
102
- "@deepseek-ai/dsh-compaction-basic": "0.1.7-rc.2",
103
- "@deepseek-ai/dsh-cordis-host-runner": "0.1.7-rc.2",
104
- "@deepseek-ai/dsh-credentials": "0.1.7-rc.2",
105
- "@deepseek-ai/dsh-goal": "0.1.7-rc.2",
106
- "@deepseek-ai/dsh-home-paths": "0.1.7-rc.2",
107
- "@deepseek-ai/dsh-host-plugin-inventory": "0.1.7-rc.2",
108
- "@deepseek-ai/dsh-invariants": "0.1.7-rc.2",
109
- "@deepseek-ai/dsh-jobs": "0.1.7-rc.2",
110
- "@deepseek-ai/dsh-launch-environment": "0.1.7-rc.2",
111
- "@deepseek-ai/dsh-llm": "0.1.7-rc.2",
112
- "@deepseek-ai/dsh-llm-deepseek": "0.1.7-rc.2",
113
- "@deepseek-ai/dsh-llm-retry": "0.1.7-rc.2",
114
- "@deepseek-ai/dsh-message-feedback": "0.1.7-rc.2",
115
- "@deepseek-ai/dsh-sandbox": "0.1.7-rc.2",
116
- "@deepseek-ai/dsh-scope": "0.1.7-rc.2",
117
- "@deepseek-ai/dsh-session": "0.1.7-rc.2",
118
- "@deepseek-ai/dsh-session-persistence": "0.1.7-rc.2",
119
- "@deepseek-ai/dsh-session-projection": "0.1.7-rc.2",
120
- "@deepseek-ai/dsh-settings": "0.1.7-rc.2",
121
- "@deepseek-ai/dsh-subagent": "0.1.7-rc.2",
122
- "@deepseek-ai/dsh-subagent-fork-in-process": "0.1.7-rc.2",
123
- "@deepseek-ai/dsh-subagent-in-process-driver": "0.1.7-rc.2",
124
- "@deepseek-ai/dsh-subagent-spawn-in-process": "0.1.7-rc.2",
125
- "@deepseek-ai/dsh-system-prompt": "0.1.7-rc.2",
126
- "@deepseek-ai/dsh-token-meter": "0.1.7-rc.2",
127
- "@deepseek-ai/dsh-tools": "0.1.7-rc.2",
128
- "@deepseek-ai/dsh-user-approval": "0.1.7-rc.2",
129
- "@deepseek-ai/dsh-user-questions": "0.1.7-rc.2",
99
+ "@deepseek-ai/dsh-command-compact": "0.2.0-rc.1",
100
+ "@deepseek-ai/dsh-commands": "0.2.0-rc.1",
101
+ "@deepseek-ai/dsh-compaction": "0.2.0-rc.1",
102
+ "@deepseek-ai/dsh-compaction-basic": "0.2.0-rc.1",
103
+ "@deepseek-ai/dsh-cordis-host-runner": "0.2.0-rc.1",
104
+ "@deepseek-ai/dsh-credentials": "0.2.0-rc.1",
105
+ "@deepseek-ai/dsh-goal": "0.2.0-rc.1",
106
+ "@deepseek-ai/dsh-home-paths": "0.2.0-rc.1",
107
+ "@deepseek-ai/dsh-host-plugin-inventory": "0.2.0-rc.1",
108
+ "@deepseek-ai/dsh-invariants": "0.2.0-rc.1",
109
+ "@deepseek-ai/dsh-jobs": "0.2.0-rc.1",
110
+ "@deepseek-ai/dsh-launch-environment": "0.2.0-rc.1",
111
+ "@deepseek-ai/dsh-llm": "0.2.0-rc.1",
112
+ "@deepseek-ai/dsh-llm-deepseek": "0.2.0-rc.1",
113
+ "@deepseek-ai/dsh-llm-retry": "0.2.0-rc.1",
114
+ "@deepseek-ai/dsh-message-feedback": "0.2.0-rc.1",
115
+ "@deepseek-ai/dsh-sandbox": "0.2.0-rc.1",
116
+ "@deepseek-ai/dsh-scope": "0.2.0-rc.1",
117
+ "@deepseek-ai/dsh-session": "0.2.0-rc.1",
118
+ "@deepseek-ai/dsh-session-persistence": "0.2.0-rc.1",
119
+ "@deepseek-ai/dsh-session-projection": "0.2.0-rc.1",
120
+ "@deepseek-ai/dsh-settings": "0.2.0-rc.1",
121
+ "@deepseek-ai/dsh-subagent": "0.2.0-rc.1",
122
+ "@deepseek-ai/dsh-subagent-fork-in-process": "0.2.0-rc.1",
123
+ "@deepseek-ai/dsh-subagent-in-process-driver": "0.2.0-rc.1",
124
+ "@deepseek-ai/dsh-subagent-spawn-in-process": "0.2.0-rc.1",
125
+ "@deepseek-ai/dsh-system-prompt": "0.2.0-rc.1",
126
+ "@deepseek-ai/dsh-token-meter": "0.2.0-rc.1",
127
+ "@deepseek-ai/dsh-tools": "0.2.0-rc.1",
128
+ "@deepseek-ai/dsh-user-approval": "0.2.0-rc.1",
129
+ "@deepseek-ai/dsh-user-questions": "0.2.0-rc.1",
130
130
  "@deepseek-ai/schemastery": "3.18.4",
131
131
  "@eslint/js": "^10.0.1",
132
132
  "@testing-library/react": "^16.3.2",
@@ -134,7 +134,6 @@
134
134
  "@types/js-yaml": "^4.0.9",
135
135
  "@types/node": "^22.20.0",
136
136
  "@types/react": "~18.3.1",
137
- "@vitest/coverage-v8": "^4.1.11",
138
137
  "eslint": "^10.10.0",
139
138
  "globals": "^17.12.0",
140
139
  "jsdom": "29.1.1",
@@ -153,7 +152,6 @@
153
152
  "lint": "eslint packages scripts eslint.config.js",
154
153
  "lint:fix": "eslint packages scripts eslint.config.js --fix",
155
154
  "test": "vitest run",
156
- "test:coverage": "vitest run --coverage",
157
155
  "test:watch": "vitest",
158
156
  "test:built": "vitest run --config vitest.built.config.ts",
159
157
  "test:e2e:packed": "node scripts/packed-install-e2e.mjs",
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "id": "dsh-external/dsh-context-compression-improved",
3
- "version": "0.7.0-beta.1",
3
+ "version": "0.8.0-beta.1",
4
4
  "main": "./lib/index.js",
5
5
  "description": "Auditable tool-result context-compression selector with code-skeleton gate for DeepSeek Harness",
6
6
  "engines": {
7
- "dsh": ">=0.1.7-rc.1 <0.2.0-0"
7
+ "dsh": ">=0.2.0-rc.1 <0.2.1-0"
8
8
  },
9
9
  "contributes": {
10
10
  "tools": [],
@@ -373,20 +373,6 @@ function parseCodeSkeletonSettings(value) {
373
373
  return { enabled };
374
374
  }
375
375
  /**
376
- * Strictly parse the persisted intentSummary section. Mirrors the codeSkeleton
377
- * section semantics: absent inherits the lossless `false` default, while a
378
- * present-but-invalid section is an explicitly invalid document.
379
- */
380
- function parseIntentSummarySettings(value) {
381
- if (value === void 0) return { enabled: false };
382
- if (!isPlainRecord(value)) throw new TypeError("Context-compression intentSummary must be a plain object");
383
- const keys = Object.keys(value);
384
- if (keys.length !== 1 || keys[0] !== "enabled") throw new TypeError(`Context-compression intentSummary: expected exactly "enabled", got "${keys.join("\", \"")}"`);
385
- const enabled = value.enabled;
386
- if (typeof enabled !== "boolean") throw new TypeError("Context-compression intentSummary.enabled must be a boolean");
387
- return { enabled };
388
- }
389
- /**
390
376
  * Parse the optional tokenpilot-inspired preset sub-capability section. Absent
391
377
  * inherits the preset defaults; present-but-invalid is rejected, mirroring the
392
378
  * codeSkeleton section semantics.
@@ -493,8 +479,7 @@ const DEFAULT_CONTEXT_COMPRESSION_SETTINGS = {
493
479
  profile: "balanced",
494
480
  custom: structuredClone(DEFAULT_CUSTOM_COMPRESSION_POLICY),
495
481
  autoCompact: { thresholdPercent: AUTO_COMPACT_THRESHOLD_LIMITS.default },
496
- codeSkeleton: { enabled: false },
497
- intentSummary: { enabled: false }
482
+ codeSkeleton: { enabled: false }
498
483
  };
499
484
  /**
500
485
  * Parse one settings document with the persisted-section semantics: `undefined`
@@ -512,19 +497,17 @@ const ContextCompressionSettingsSchema = z.transform(z.any().required(), (value)
512
497
  if (!isPlainRecord(value)) throw new TypeError("Context-compression settings must be a plain object");
513
498
  assertPlainDataTree(value);
514
499
  const candidate = structuredClone(value);
515
- const unknown = Object.keys(candidate).find((key) => key !== "profile" && key !== "custom" && key !== "autoCompact" && key !== "codeSkeleton" && key !== "intentSummary" && key !== "presetOptions");
500
+ const unknown = Object.keys(candidate).find((key) => key !== "profile" && key !== "custom" && key !== "autoCompact" && key !== "codeSkeleton" && key !== "presetOptions");
516
501
  if (unknown !== void 0) throw new TypeError(`Context-compression settings: unknown key "${unknown}"`);
517
502
  assertPresentSection(candidate, "profile", isSupportedProfile);
518
503
  assertPresentSection(candidate, "custom", isUsableCustomDocument);
519
504
  const autoCompact = parseAutoCompactSettings(candidate.autoCompact);
520
505
  const codeSkeleton = parseCodeSkeletonSettings(candidate.codeSkeleton);
521
- const intentSummary = parseIntentSummarySettings(candidate.intentSummary);
522
506
  const presetOptions = parsePresetOptionsSettings(candidate.presetOptions);
523
507
  return {
524
508
  ...contextCompressionSettingsInputSchema(candidate),
525
509
  autoCompact,
526
510
  codeSkeleton,
527
- intentSummary,
528
511
  ...presetOptions === void 0 ? {} : { presetOptions }
529
512
  };
530
513
  }).default(DEFAULT_CONTEXT_COMPRESSION_SETTINGS);
@@ -975,76 +958,5 @@ function invalidateOnTaskChange(state, todoVersion) {
975
958
  state.lastSummaryTurn = -1;
976
959
  return true;
977
960
  }
978
- /**
979
- * `/ctx-summary off|on` overrides, keyed by session id (string). The command
980
- * handler only sees `invocation.agent.session.id`, not the pruner's Session
981
- * object, so these are id-keyed rather than WeakMap'd. Entries are two-char
982
- * strings per session and cleared whenever the override is lifted.
983
- */
984
- const summaryOverrides = /* @__PURE__ */ new Map();
985
- /** Read the session's `/ctx-summary` override; `undefined` = default (settings-driven). */
986
- function getSummaryOverride(sessionId) {
987
- return summaryOverrides.get(sessionId);
988
- }
989
- /** Set or clear (`undefined`) the session's `/ctx-summary` override. */
990
- function setSummaryOverride(sessionId, value) {
991
- if (value === void 0) summaryOverrides.delete(sessionId);
992
- else summaryOverrides.set(sessionId, value);
993
- }
994
- /** Last observed `intentSummary.enabled` for a session, for `/ctx-summary status`. */
995
- const lastObservedIntentEnabled = /* @__PURE__ */ new Map();
996
- /** Record the gate input the pass last evaluated for this session. */
997
- function observeIntentEnabled(sessionId, enabled) {
998
- lastObservedIntentEnabled.set(sessionId, enabled);
999
- }
1000
- /** The settings-side enabled flag last observed for the session, if any. */
1001
- function getObservedIntentEnabled(sessionId) {
1002
- return lastObservedIntentEnabled.get(sessionId);
1003
- }
1004
- const lastIntentFolds = /* @__PURE__ */ new Map();
1005
- /** Record a landed intent fold for the session (newest wins). */
1006
- function recordIntentFold(sessionId, record) {
1007
- lastIntentFolds.set(sessionId, record);
1008
- }
1009
- /** The most recent landed intent fold for the session, if any. */
1010
- function getLastIntentFold(sessionId) {
1011
- return lastIntentFolds.get(sessionId);
1012
- }
1013
- //#endregion
1014
- //#region src/runtime/tokenpilot/intent-gate.ts
1015
- /**
1016
- * Turn-tail intent-summary growth gate (TokenPilot-inspired E2).
1017
- *
1018
- * Pure decision helper evaluated at the turn-boundary postflight: it decides
1019
- * whether this turn may spend a summary-writer LLM call and stage a fold for
1020
- * the next pressure round. The gate is deliberately conservative — every
1021
- * unresolved input (unknown context window, non-finite counters) fails closed
1022
- * toward "do not run", because a skipped fold is free while a wasted summary
1023
- * call is not. Content safety is unaffected either way: fail-open semantics
1024
- * live in the fold landing path, not here.
1025
- */
1026
- /** Floor: the live surface must exceed this fraction of the context window. */
1027
- const INTENT_GATE_FLOOR_FRACTION = .45;
1028
- /** Growth: the live surface must have grown by more than this since the last landed fold. */
1029
- const INTENT_GATE_GROWTH_TOKENS = 5e4;
1030
- function isUsableNumber(value) {
1031
- return Number.isFinite(value) && value >= 0;
1032
- }
1033
- /** Same evaluation with the reason attached, for audits and `/ctx-summary status`. */
1034
- function evaluateIntentGate(input) {
1035
- const snapshot = (decision, reason) => ({
1036
- ...input,
1037
- decision,
1038
- reason
1039
- });
1040
- if (!input.enabled) return snapshot(false, "disabled");
1041
- if (input.override === "off") return snapshot(false, "override-off");
1042
- if (!isUsableNumber(input.liveTokens)) return snapshot(false, "below-floor");
1043
- if (input.contextWindow === void 0 || !isUsableNumber(input.contextWindow)) return snapshot(false, "no-window");
1044
- if (!(input.liveTokens > input.contextWindow * .45)) return snapshot(false, "below-floor");
1045
- if (!isUsableNumber(input.baselineTokens)) return snapshot(false, "below-growth");
1046
- if (!(input.liveTokens - input.baselineTokens > 5e4)) return snapshot(false, "below-growth");
1047
- return snapshot(true, "passed");
1048
- }
1049
961
  //#endregion
1050
- export { resolveCustomPolicy as A, isCompressionProfile as C, resolvePolicy as D, resolveConfig as E, deepFreeze as M, COMPRESSION_PROFILES as N, CustomCompressionPolicySchema as O, codePointLength as S, parseContextCompressionSettings as T, DEFAULTS as _, getLastIntentFold as a, charsForTokens as b, invalidateOnTaskChange as c, recordRecertified as d, recordScore as f, ContextCompressionSettingsSchema as g, CONTEXT_COMPRESSION_SETTINGS_NAMESPACE as h, getAdvisorState as i, assertNever as j, DEFAULT_CUSTOM_COMPRESSION_POLICY as k, observeIntentEnabled as l, AUTO_COMPACT_THRESHOLD_LIMITS as m, INTENT_GATE_GROWTH_TOKENS as n, getObservedIntentEnabled as o, setSummaryOverride as p, evaluateIntentGate as r, getSummaryOverride as s, INTENT_GATE_FLOOR_FRACTION as t, recordIntentFold as u, DEFAULT_CONTEXT_COMPRESSION_SETTINGS as v, isValidAutoCompactThresholdPercent as w, charsToTokens as x, PRUNE_MARKER as y };
962
+ export { deepFreeze as C, assertNever as S, resolveConfig as _, AUTO_COMPACT_THRESHOLD_LIMITS as a, DEFAULT_CUSTOM_COMPRESSION_POLICY as b, DEFAULTS as c, charsForTokens as d, charsToTokens as f, parseContextCompressionSettings as g, isValidAutoCompactThresholdPercent as h, recordScore as i, DEFAULT_CONTEXT_COMPRESSION_SETTINGS as l, isCompressionProfile as m, invalidateOnTaskChange as n, CONTEXT_COMPRESSION_SETTINGS_NAMESPACE as o, codePointLength as p, recordRecertified as r, ContextCompressionSettingsSchema as s, getAdvisorState as t, PRUNE_MARKER as u, resolvePolicy as v, COMPRESSION_PROFILES as w, resolveCustomPolicy as x, CustomCompressionPolicySchema as y };
@@ -60,15 +60,6 @@ window.__ModuleLoader__.load({
60
60
  const enabled = value.enabled;
61
61
  return typeof enabled === "boolean" ? { enabled } : void 0;
62
62
  }
63
- /** Browser-safe mirror of the runtime intentSummary section (absent inherits off). */
64
- function decodeIntentSummarySettings(value) {
65
- if (value === void 0) return { enabled: false };
66
- if (!isPlainRecord(value)) return void 0;
67
- const keys = Object.keys(value);
68
- if (keys.length !== 1 || keys[0] !== "enabled") return void 0;
69
- const enabled = value.enabled;
70
- return typeof enabled === "boolean" ? { enabled } : void 0;
71
- }
72
63
  /**
73
64
  * Browser mirror of the runtime presetOptions section: absent inherits the
74
65
  * preset defaults (decodes to `undefined`); present values must be a plain
@@ -1169,7 +1160,7 @@ window.__ModuleLoader__.load({
1169
1160
  /**
1170
1161
  * Decode one stored context-compression settings document with exactly the
1171
1162
  * runtime schema's strictness: a plain object with only `profile`, `custom`,
1172
- * `autoCompact`, `codeSkeleton`, and `intentSummary` keys, a supported profile, a valid Custom
1163
+ * `autoCompact`, and `codeSkeleton` keys, a supported profile, a valid Custom
1173
1164
  * document canonicalized to v3 exactly as the runtime resolver would, a
1174
1165
  * strictly-shaped autoCompact section (absent inherits the 80% default), and
1175
1166
  * a strictly-shaped codeSkeleton gate (absent inherits off). Anything else
@@ -1178,19 +1169,17 @@ window.__ModuleLoader__.load({
1178
1169
  */
1179
1170
  function decodeSettings(value) {
1180
1171
  if (!isPlainRecord(value)) return void 0;
1181
- if (Object.keys(value).some((key) => key !== "profile" && key !== "custom" && key !== "autoCompact" && key !== "codeSkeleton" && key !== "intentSummary" && key !== "presetOptions")) return;
1172
+ if (Object.keys(value).some((key) => key !== "profile" && key !== "custom" && key !== "autoCompact" && key !== "codeSkeleton" && key !== "presetOptions")) return;
1182
1173
  const profile = value.profile;
1183
1174
  const custom = value.custom;
1184
1175
  const autoCompact = decodeAutoCompactSettings(value.autoCompact);
1185
1176
  const codeSkeleton = decodeCodeSkeletonSettings(value.codeSkeleton);
1186
- const intentSummary = decodeIntentSummarySettings(value.intentSummary);
1187
1177
  const presetOptions = decodePresetOptionsSettings(value.presetOptions);
1188
- return typeof profile === "string" && COMPRESSION_PROFILES.includes(profile) && isCustomCompressionPolicy(custom) && autoCompact !== void 0 && codeSkeleton !== void 0 && intentSummary !== void 0 ? {
1178
+ return typeof profile === "string" && COMPRESSION_PROFILES.includes(profile) && isCustomCompressionPolicy(custom) && autoCompact !== void 0 && codeSkeleton !== void 0 ? {
1189
1179
  profile,
1190
1180
  custom: canonicalizeCustomPolicy(custom),
1191
1181
  autoCompact,
1192
1182
  codeSkeleton,
1193
- intentSummary,
1194
1183
  ...presetOptions === void 0 ? {} : { presetOptions }
1195
1184
  } : void 0;
1196
1185
  }
@@ -1,4 +1,4 @@
1
- import { a as getLastIntentFold, i as getAdvisorState, n as INTENT_GATE_GROWTH_TOKENS, o as getObservedIntentEnabled, p as setSummaryOverride, s as getSummaryOverride, t as INTENT_GATE_FLOOR_FRACTION, v as DEFAULT_CONTEXT_COMPRESSION_SETTINGS } from "./intent-gate.js";
1
+ import { l as DEFAULT_CONTEXT_COMPRESSION_SETTINGS, t as getAdvisorState } from "./advisor-state.js";
2
2
  import z from "@deepseek-ai/schemastery";
3
3
  import { AsyncLocalStorage } from "node:async_hooks";
4
4
  import { createHash } from "node:crypto";
@@ -75,96 +75,6 @@ async function buildEstimatorCatalog(deps) {
75
75
  };
76
76
  }
77
77
  //#endregion
78
- //#region src/runtime/summary-command.ts
79
- const SUMMARY_COMMAND_NAME = "ctx-summary";
80
- const USAGE = "Usage: /ctx-summary off|on|status";
81
- /** Parse the raw argument string; `undefined` = unrecognized (usage error). */
82
- function parseSummaryCommandArgs(rawInput) {
83
- const token = rawInput.trim().toLowerCase();
84
- if (token === "off" || token === "on" || token === "status") return token;
85
- }
86
- function describeFold(sessionId) {
87
- const fold = getLastIntentFold(sessionId);
88
- if (fold === void 0) return "none";
89
- return `turn ${fold.turn}, seq ${fold.startSeq}..${fold.endSeq}`;
90
- }
91
- /** Human-facing status line; observability only, never a decision input. */
92
- function formatSummaryStatus(sessionId) {
93
- const override = getSummaryOverride(sessionId);
94
- const enabled = getObservedIntentEnabled(sessionId);
95
- const enabledText = enabled === void 0 ? "unknown (gate not evaluated yet)" : enabled ? "yes" : "no";
96
- return [
97
- `ctx-summary status:`,
98
- ` override: ${override ?? "default (settings-driven)"}`,
99
- ` intentSummary enabled (settings): ${enabledText}`,
100
- ` gate: floor >${Math.round(INTENT_GATE_FLOOR_FRACTION * 100)}% of window AND growth >${INTENT_GATE_GROWTH_TOKENS} tokens since last fold`,
101
- ` last fold: ${describeFold(sessionId)}`
102
- ].join("\n");
103
- }
104
- /** Resolve the invoking agent's session id (`''` when the host exposes none). */
105
- function sessionIdOf(agent) {
106
- const session = agent?.session;
107
- if (session === void 0 || session.id === void 0 || session.id === null) return "";
108
- return String(session.id);
109
- }
110
- /** Best-effort `CommandDefinitionId` brand; `undefined` on stripped hosts (registered without it). */
111
- async function loadCommandDefinitionId() {
112
- try {
113
- return (await import("@deepseek-ai/dsh-commands")).CommandDefinitionId;
114
- } catch {
115
- return;
116
- }
117
- }
118
- /**
119
- * Mount `/ctx-summary` for every composed human-command adapter. Never
120
- * throws: the command is a convenience surface, and a host without the
121
- * commands service (or with an incompatible registry shape) simply runs
122
- * without it.
123
- */
124
- function registerSummaryCommand(ctx) {
125
- ctx.inject(["commands"], (injected) => {
126
- const commands = injected.commands;
127
- if (commands === void 0 || typeof commands.register !== "function") return;
128
- (async () => {
129
- try {
130
- const definitionId = await loadCommandDefinitionId();
131
- await commands.register({
132
- name: SUMMARY_COMMAND_NAME,
133
- description: "Turn-tail intent summary: temporarily disable/resume or inspect status",
134
- ...definitionId === void 0 ? {} : { definitionId: definitionId("dsh-context-compression-improved/ctx-summary") },
135
- handler: async (invocation) => {
136
- const args = parseSummaryCommandArgs(typeof invocation.rawInput === "string" ? invocation.rawInput : "");
137
- if (args === void 0) return {
138
- kind: "error",
139
- text: USAGE
140
- };
141
- const sessionId = sessionIdOf(invocation.agent);
142
- if (args === "status") {
143
- if (sessionId === "") return {
144
- kind: "error",
145
- text: "ctx-summary: no session is attached to this invocation"
146
- };
147
- return {
148
- kind: "success",
149
- text: formatSummaryStatus(sessionId)
150
- };
151
- }
152
- if (sessionId === "") return {
153
- kind: "error",
154
- text: "ctx-summary: no session is attached to this invocation"
155
- };
156
- setSummaryOverride(sessionId, args);
157
- return {
158
- kind: "success",
159
- text: args === "off" ? "ctx-summary: turn-tail intent summary paused for this session (until process restart or `/ctx-summary on`)" : "ctx-summary: turn-tail intent summary resumed for this session (numeric gates still apply)"
160
- };
161
- }
162
- });
163
- } catch {}
164
- })();
165
- });
166
- }
167
- //#endregion
168
78
  //#region src/preset-overlay.ts
169
79
  /** Plugin-owned, reversible compression overlays for native agent presets. */
170
80
  /**
@@ -832,7 +742,6 @@ function apply(ctx, config = {}) {
832
742
  try {
833
743
  if (config.estimatorCatalogRoute === true) registerEstimatorCatalogRoute(ctx);
834
744
  if (config.advisorReportRoute === true) registerAdvisorReportRoute(ctx);
835
- registerSummaryCommand(ctx);
836
745
  if (config.presetOverlay !== true) return;
837
746
  ctx.inject(["agentPresets"], (presetsCtx) => {
838
747
  const installation = decorateAgentPresets(presetsCtx.agentPresets, {
@@ -68,13 +68,6 @@ interface AutoCompactSettings {
68
68
  interface CodeSkeletonSettings {
69
69
  enabled: boolean;
70
70
  }
71
- /**
72
- * Orthogonal turn-tail intent-summary gate, mirrored browser-safe from the
73
- * runtime: independent of every profile, default off.
74
- */
75
- interface IntentSummarySettings {
76
- enabled: boolean;
77
- }
78
71
  /** Browser-safe mirror of the runtime presetOptions section. */
79
72
  interface PresetOptionsSettings {
80
73
  readonly dedupeToolResults?: boolean;
@@ -105,8 +98,6 @@ interface ContextCompressionSettings {
105
98
  autoCompact: AutoCompactSettings;
106
99
  /** Code-skeleton reducer gate captured independently of `profile`. */
107
100
  codeSkeleton: CodeSkeletonSettings;
108
- /** Turn-tail intent-summary gate captured independently of `profile`. */
109
- intentSummary: IntentSummarySettings;
110
101
  /** Optional tokenpilot-inspired sub-capability overrides (presence-validated only). */
111
102
  presetOptions?: PresetOptionsSettings;
112
103
  }