dsh-context-compression-improved 0.12.0 → 0.13.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.
- package/.agents/plans/improve/checklist.md +32 -0
- package/.agents/plans/improve/findings.md +102 -0
- package/.agents/plans/improve/spec.md +53 -0
- package/.agents/plans/improve/tasks.md +70 -0
- package/.gitattributes +2 -0
- package/.githooks/pre-push +37 -0
- package/.github/workflows/ci.yml +47 -0
- package/CHANGELOG.de.md +580 -0
- package/CHANGELOG.es.md +588 -0
- package/CHANGELOG.fr.md +576 -0
- package/CHANGELOG.it.md +577 -0
- package/CHANGELOG.ja.md +261 -0
- package/CHANGELOG.ko.md +254 -0
- package/CHANGELOG.md +582 -0
- package/CHANGELOG.pt.md +167 -0
- package/CHANGELOG.ru.md +554 -0
- package/CHANGELOG.zh.md +247 -0
- package/CONTRIBUTING.md +22 -0
- package/README.de.md +96 -0
- package/README.es.md +96 -0
- package/README.fr.md +96 -0
- package/README.it.md +96 -0
- package/README.ja.md +102 -0
- package/README.ko.md +102 -0
- package/README.md +128 -22
- package/README.pt.md +96 -0
- package/README.ru.md +96 -0
- package/README.zh.md +114 -24
- package/SECURITY.md +18 -0
- package/THIRD_PARTY_NOTICES.md +7 -25
- package/assets/board.png +0 -0
- package/assets/context.png +0 -0
- package/assets/dshfind-card.svg +33 -0
- package/docs/assets/context-compression-selector-profiles.jpg +0 -0
- package/docs/assets/context-compression-selector-settings.png +0 -0
- package/docs/compat-0.1.5-report.md +77 -0
- package/docs/installation.de.md +104 -0
- package/docs/installation.es.md +104 -0
- package/docs/installation.fr.md +104 -0
- package/docs/installation.it.md +104 -0
- package/docs/installation.ja.md +78 -0
- package/docs/installation.ko.md +78 -0
- package/docs/installation.md +103 -0
- package/docs/installation.ru.md +104 -0
- package/docs/installation.zh.md +100 -0
- package/docs/repair-log.md +657 -0
- package/docs/shallow-teaching-preset-template.md +46 -0
- package/eslint.config.js +30 -0
- package/package.json +112 -127
- package/packages/selector/LICENSE +21 -0
- package/packages/selector/README.md +26 -0
- package/packages/selector/README.zh.md +24 -0
- package/packages/selector/THIRD_PARTY_NOTICES.md +32 -0
- package/packages/selector/docs/history-tool-call-working-set-spec.md +112 -0
- package/packages/selector/docs/native-tool-result-selector-spec.md +34 -0
- package/packages/selector/docs/subagent-cache-reuse-spec.md +46 -0
- package/{dsh.plugin.json → packages/selector/dsh.plugin.json} +1 -1
- package/{lib → packages/selector/lib}/client.js +18 -10
- package/packages/selector/lib/style.css +350 -0
- package/packages/selector/package.json +180 -0
- package/packages/selector/screenshots.json +3 -0
- package/packages/selector/src/client/CompressionProfileControls.tsx +352 -0
- package/packages/selector/src/client/CompressionProfileSelector.module.css +199 -0
- package/packages/selector/src/client/CompressionProfileSelector.tsx +89 -0
- package/packages/selector/src/client/CustomPolicyEditor.tsx +216 -0
- package/packages/selector/src/client/EstimatorControls.tsx +277 -0
- package/packages/selector/src/client/bridge-scope.ts +125 -0
- package/packages/selector/src/client/decode.ts +68 -0
- package/packages/selector/src/client/fab-pos.ts +71 -0
- package/packages/selector/src/client/guide-steps.ts +50 -0
- package/packages/selector/src/client/guide.tsx +368 -0
- package/packages/selector/src/client/index.ts +456 -0
- package/packages/selector/src/client/locales/de.ts +167 -0
- package/packages/selector/src/client/locales/es.ts +167 -0
- package/packages/selector/src/client/locales/fr.ts +167 -0
- package/packages/selector/src/client/locales/it.ts +167 -0
- package/packages/selector/src/client/locales/ja.ts +167 -0
- package/packages/selector/src/client/locales/ko.ts +167 -0
- package/packages/selector/src/client/locales/pt.ts +167 -0
- package/packages/selector/src/client/locales/ru.ts +167 -0
- package/packages/selector/src/client/locales.ts +334 -0
- package/packages/selector/src/client/monitor-fab.ts +445 -0
- package/packages/selector/src/client/preset-options.ts +88 -0
- package/packages/selector/src/client/savings-card.tsx +269 -0
- package/packages/selector/src/client/scope-face.ts +24 -0
- package/packages/selector/src/client/settings-section.tsx +171 -0
- package/packages/selector/src/compat/host-generation.ts +96 -0
- package/packages/selector/src/compat/llm-messages.ts +50 -0
- package/packages/selector/src/compat/settings-lease.ts +108 -0
- package/packages/selector/src/compat/tool-result.ts +91 -0
- package/packages/selector/src/css-modules.d.ts +6 -0
- package/packages/selector/src/deepseek-v4-tokenizer.ts +205 -0
- package/packages/selector/src/estimator-catalog.ts +104 -0
- package/packages/selector/src/index.ts +909 -0
- package/packages/selector/src/invariant.ts +113 -0
- package/packages/selector/src/preset-overlay.ts +749 -0
- package/packages/selector/src/profiles.ts +554 -0
- package/packages/selector/src/pruner/content.ts +199 -0
- package/packages/selector/src/pruner/session.ts +97 -0
- package/packages/selector/src/pruner/state.ts +61 -0
- package/packages/selector/src/pruner/tuning.ts +23 -0
- package/packages/selector/src/pruner/types.ts +78 -0
- package/packages/selector/src/pruner.ts +3222 -0
- package/packages/selector/src/runtime/adaptive-cost.ts +205 -0
- package/packages/selector/src/runtime/audit.ts +321 -0
- package/packages/selector/src/runtime/config.ts +887 -0
- package/packages/selector/src/runtime/custom-policy.ts +300 -0
- package/packages/selector/src/runtime/deepseek-official-pricing.ts +298 -0
- package/packages/selector/src/runtime/deepseek-v4-vision-tokens.ts +254 -0
- package/packages/selector/src/runtime/display-prefs.ts +98 -0
- package/packages/selector/src/runtime/fold-router.ts +143 -0
- package/packages/selector/src/runtime/measurement.ts +444 -0
- package/packages/selector/src/runtime/monitor.ts +341 -0
- package/packages/selector/src/runtime/panel-command.ts +213 -0
- package/packages/selector/src/runtime/reducers.ts +1755 -0
- package/packages/selector/src/runtime/retrieve.ts +505 -0
- package/packages/selector/src/runtime/savings-integral.ts +117 -0
- package/packages/selector/src/runtime/savings-projection.ts +229 -0
- package/packages/selector/src/runtime/savings-verify.ts +446 -0
- package/packages/selector/src/runtime/savings.ts +526 -0
- package/packages/selector/src/runtime/sediment-card.ts +126 -0
- package/packages/selector/src/runtime/sediment-clock.ts +87 -0
- package/packages/selector/src/runtime/sediment-guard.ts +136 -0
- package/packages/selector/src/runtime/sediment-publish.ts +144 -0
- package/packages/selector/src/runtime/sediment-span.ts +170 -0
- package/packages/selector/src/runtime/sediment.ts +209 -0
- package/packages/selector/src/runtime/session-events.ts +30 -0
- package/packages/selector/src/runtime/session-file-decode.ts +523 -0
- package/packages/selector/src/runtime/shallow-tools.ts +342 -0
- package/packages/selector/src/runtime/stats-backfill.ts +541 -0
- package/packages/selector/src/runtime/stats-db.ts +492 -0
- package/packages/selector/src/runtime/stats-schema.ts +123 -0
- package/packages/selector/src/runtime/stats-sync.ts +307 -0
- package/packages/selector/src/runtime/summary-command.ts +127 -0
- package/packages/selector/src/runtime/tail-trim.ts +177 -0
- package/packages/selector/src/runtime/token-count.ts +72 -0
- package/packages/selector/src/runtime/tokenpilot/advisor-prompt.ts +233 -0
- package/packages/selector/src/runtime/tokenpilot/advisor-state.ts +204 -0
- package/packages/selector/src/runtime/tokenpilot/advisor.ts +419 -0
- package/packages/selector/src/runtime/tokenpilot/benefit.ts +200 -0
- package/packages/selector/src/runtime/tokenpilot/dedup.ts +82 -0
- package/packages/selector/src/runtime/tokenpilot/estimator.ts +151 -0
- package/packages/selector/src/runtime/tokenpilot/intent-fold.ts +53 -0
- package/packages/selector/src/runtime/tokenpilot/intent-gate.ts +65 -0
- package/packages/selector/src/runtime/tokenpilot/intent-input-mask.ts +125 -0
- package/packages/selector/src/runtime/tokenpilot/intent-range.ts +37 -0
- package/packages/selector/src/runtime/tokenpilot/locator.ts +129 -0
- package/packages/selector/src/runtime/tokenpilot/read-state.ts +98 -0
- package/packages/selector/src/runtime/tokenpilot/sidechannel.ts +303 -0
- package/packages/selector/src/runtime/tool-names.ts +42 -0
- package/packages/selector/src/runtime/toolclass.ts +103 -0
- package/packages/selector/src/runtime/triage/masks.ts +128 -0
- package/packages/selector/src/runtime/triage/shallow.ts +132 -0
- package/packages/selector/src/runtime/triage/signals.ts +167 -0
- package/packages/selector/src/runtime/triage/types.ts +125 -0
- package/packages/selector/src/runtime/types.ts +396 -0
- package/packages/selector/src/runtime/value.ts +48 -0
- package/packages/selector/src/settings-bridge.ts +175 -0
- package/packages/selector/src/tui-command.ts +99 -0
- package/packages/selector/tests/advisor-report.host.spec.ts +223 -0
- package/packages/selector/tests/auto-compact.client.spec.tsx +214 -0
- package/packages/selector/tests/built/client-artifact.spec.ts +56 -0
- package/packages/selector/tests/cache-prefix-audit.spec.ts +123 -0
- package/packages/selector/tests/code-skeleton.client.spec.ts +98 -0
- package/packages/selector/tests/compat/compat-narrow-waist.spec.ts +150 -0
- package/packages/selector/tests/custom-contract.client.spec.ts +226 -0
- package/packages/selector/tests/estimator-catalog.spec.ts +70 -0
- package/packages/selector/tests/estimator-channel.client.spec.tsx +253 -0
- package/packages/selector/tests/estimator-route-registration.host.spec.ts +202 -0
- package/packages/selector/tests/fab-pos.client.spec.ts +47 -0
- package/packages/selector/tests/fixtures/sediment-pool/52adc205-cloud-5.orig.txt +231 -0
- package/packages/selector/tests/fixtures/sediment-pool/95fcba5d-cloud-25.orig.txt +236 -0
- package/packages/selector/tests/fixtures/sediment-pool/95fcba5d-cloud-38.orig.txt +220 -0
- package/packages/selector/tests/fixtures/sediment-pool/95fcba5d-cloud-42.orig.txt +140 -0
- package/packages/selector/tests/fixtures/sediment-pool/95fcba5d-cloud-53.orig.txt +117 -0
- package/packages/selector/tests/fixtures/sediment-pool/95fcba5d-local-10.orig.txt +67 -0
- package/packages/selector/tests/fixtures/sediment-pool/a7a767c0-cloud-45.orig.txt +119 -0
- package/packages/selector/tests/fixtures/sediment-pool/a7a767c0-cloud-49.orig.txt +119 -0
- package/packages/selector/tests/fixtures/sediment-pool/a7a767c0-cloud-63.orig.txt +131 -0
- package/packages/selector/tests/fixtures/sediment-pool/a7a767c0-cloud-75.orig.txt +196 -0
- package/packages/selector/tests/fixtures/sediment-pool/a7a767c0-cloud-76.orig.txt +71 -0
- package/packages/selector/tests/fixtures/sediment-pool/a7a767c0-cloud-85.orig.txt +126 -0
- package/packages/selector/tests/fixtures/sediment-pool/a7a767c0-cloud-86.orig.txt +86 -0
- package/packages/selector/tests/fixtures/sediment-pool/a7a767c0-cloud-87.orig.txt +50 -0
- package/packages/selector/tests/fixtures/sediment-pool/a7a767c0-cloud-96.orig.txt +102 -0
- package/packages/selector/tests/helpers/legacy-namespace.ts +35 -0
- package/packages/selector/tests/helpers/legacy-settings/index.ts +15 -0
- package/packages/selector/tests/helpers/legacy-settings/legacy/provider.d.ts +41 -0
- package/packages/selector/tests/helpers/legacy-settings/legacy/provider.js +647 -0
- package/packages/selector/tests/helpers/legacy-settings/legacy/redact.js +78 -0
- package/packages/selector/tests/helpers/legacy-settings/legacy/util-values.js +234 -0
- package/packages/selector/tests/host-preset-overlay.host.spec.ts +204 -0
- package/packages/selector/tests/monitor-fab.client.spec.ts +240 -0
- package/packages/selector/tests/preset-options-write.client.spec.ts +192 -0
- package/packages/selector/tests/preset-overlay-loader.e2e.host.spec.ts +200 -0
- package/packages/selector/tests/preset-overlay.host.spec.ts +246 -0
- package/packages/selector/tests/profiles.client.spec.tsx +436 -0
- package/packages/selector/tests/ptc-custom-write.client.spec.ts +86 -0
- package/packages/selector/tests/public/package-contract.client.spec.ts +91 -0
- package/packages/selector/tests/runtime/adaptive-cost.spec.ts +167 -0
- package/packages/selector/tests/runtime/advice-never-withholds.host.spec.ts +230 -0
- package/packages/selector/tests/runtime/advisor-invariant.spec.ts +272 -0
- package/packages/selector/tests/runtime/advisor.spec.ts +226 -0
- package/packages/selector/tests/runtime/audit.spec.ts +275 -0
- package/packages/selector/tests/runtime/auto-compact-config.spec.ts +523 -0
- package/packages/selector/tests/runtime/behavior-lock-profiles.spec.ts +128 -0
- package/packages/selector/tests/runtime/char-basis.spec.ts +30 -0
- package/packages/selector/tests/runtime/code-skeleton.spec.ts +152 -0
- package/packages/selector/tests/runtime/deepseek-official-pricing.spec.ts +186 -0
- package/packages/selector/tests/runtime/deepseek-v4-tokenizer.spec.ts +122 -0
- package/packages/selector/tests/runtime/deepseek-v4-vision-tokens.spec.ts +122 -0
- package/packages/selector/tests/runtime/deprecated-preset-options.spec.ts +96 -0
- package/packages/selector/tests/runtime/fallback-diversity.spec.ts +75 -0
- package/packages/selector/tests/runtime/fixtures/profile-baseline.json +273 -0
- package/packages/selector/tests/runtime/fixtures/session-v4-dump.jsonl +46 -0
- package/packages/selector/tests/runtime/fixtures/tokenizer-golden.json +106 -0
- package/packages/selector/tests/runtime/fixtures/vision-golden.json +459 -0
- package/packages/selector/tests/runtime/fold-router.spec.ts +140 -0
- package/packages/selector/tests/runtime/frequency-longstrings.spec.ts +74 -0
- package/packages/selector/tests/runtime/fresh-gate.spec.ts +43 -0
- package/packages/selector/tests/runtime/html-reducer.spec.ts +212 -0
- package/packages/selector/tests/runtime/intent-gate.spec.ts +62 -0
- package/packages/selector/tests/runtime/intent-summary.spec.ts +156 -0
- package/packages/selector/tests/runtime/jsonl-reducer.spec.ts +79 -0
- package/packages/selector/tests/runtime/line-mapping.spec.ts +153 -0
- package/packages/selector/tests/runtime/monitor.spec.ts +354 -0
- package/packages/selector/tests/runtime/panel-command.spec.ts +101 -0
- package/packages/selector/tests/runtime/prose-reducers.spec.ts +133 -0
- package/packages/selector/tests/runtime/ptc-profile.spec.ts +133 -0
- package/packages/selector/tests/runtime/public/public-runtime.spec.ts +2795 -0
- package/packages/selector/tests/runtime/read-input-cap.spec.ts +33 -0
- package/packages/selector/tests/runtime/savings-accounting.spec.ts +291 -0
- package/packages/selector/tests/runtime/savings-integral.spec.ts +169 -0
- package/packages/selector/tests/runtime/savings-projection.spec.ts +89 -0
- package/packages/selector/tests/runtime/savings-verify.spec.ts +226 -0
- package/packages/selector/tests/runtime/savings.spec.ts +139 -0
- package/packages/selector/tests/runtime/search-reducer.spec.ts +110 -0
- package/packages/selector/tests/runtime/sediment-card.spec.ts +111 -0
- package/packages/selector/tests/runtime/sediment-config.spec.ts +56 -0
- package/packages/selector/tests/runtime/sediment-guard.spec.ts +71 -0
- package/packages/selector/tests/runtime/sediment-masks.spec.ts +95 -0
- package/packages/selector/tests/runtime/sediment-orchestrator.spec.ts +166 -0
- package/packages/selector/tests/runtime/sediment-pool-share.spec.ts +65 -0
- package/packages/selector/tests/runtime/sediment-publish.spec.ts +142 -0
- package/packages/selector/tests/runtime/sediment-real-shapes.spec.ts +158 -0
- package/packages/selector/tests/runtime/sediment-settings.spec.ts +73 -0
- package/packages/selector/tests/runtime/sediment-signals.spec.ts +124 -0
- package/packages/selector/tests/runtime/sediment-span.spec.ts +92 -0
- package/packages/selector/tests/runtime/session-events.spec.ts +27 -0
- package/packages/selector/tests/runtime/session-file-decode.spec.ts +281 -0
- package/packages/selector/tests/runtime/settings-unwrap.spec.ts +58 -0
- package/packages/selector/tests/runtime/shallow-primitives.spec.ts +135 -0
- package/packages/selector/tests/runtime/sidechannel.spec.ts +241 -0
- package/packages/selector/tests/runtime/source-kind-audit.spec.ts +79 -0
- package/packages/selector/tests/runtime/stats-backfill-scheduler.spec.ts +167 -0
- package/packages/selector/tests/runtime/stats-backfill.spec.ts +350 -0
- package/packages/selector/tests/runtime/stats-db.spec.ts +361 -0
- package/packages/selector/tests/runtime/stats-privacy.spec.ts +55 -0
- package/packages/selector/tests/runtime/stats-sync.spec.ts +278 -0
- package/packages/selector/tests/runtime/summary-command.spec.ts +154 -0
- package/packages/selector/tests/runtime/toc-and-bundled.spec.ts +159 -0
- package/packages/selector/tests/runtime/tokenizer-golden.spec.ts +53 -0
- package/packages/selector/tests/runtime/tokenpilot/benefit.spec.ts +217 -0
- package/packages/selector/tests/runtime/tokenpilot/dedup.spec.ts +52 -0
- package/packages/selector/tests/runtime/tokenpilot/estimator.spec.ts +79 -0
- package/packages/selector/tests/runtime/tokenpilot/locator.spec.ts +76 -0
- package/packages/selector/tests/runtime/tokenpilot/profile-baseline.spec.ts +121 -0
- package/packages/selector/tests/runtime/tokenpilot/read-state.spec.ts +82 -0
- package/packages/selector/tests/runtime/toolclass.spec.ts +156 -0
- package/packages/selector/tests/runtime/value.spec.ts +23 -0
- package/packages/selector/tests/savings-sessions.client.spec.tsx +140 -0
- package/packages/selector/tests/settings-seat.client.spec.ts +215 -0
- package/packages/selector/tests/standing-generation.host.spec.ts +729 -0
- package/packages/selector/tests/subagent-cache-reuse.host.spec.ts +269 -0
- package/packages/selector/tests/support/cache-prefix-audit.ts +105 -0
- package/packages/selector/tests/support/mock-adapter.ts +37 -0
- package/packages/selector/tests/support/ui-primitives.tsx +34 -0
- package/packages/selector/tsconfig.json +11 -0
- package/packages/selector/tsdown.client.config.ts +102 -0
- package/packages/selector/tsdown.config.ts +20 -0
- package/pnpm-workspace.yaml +76 -0
- package/screenshots.json +6 -3
- package/scripts/capture-profile-baseline.mjs +42 -0
- package/scripts/cell-browser-e2e.mjs +354 -0
- package/scripts/generate-tokenizer-fixtures.py +81 -0
- package/scripts/generate-vision-fixtures.py +208 -0
- package/scripts/hosts.d.mts +3 -0
- package/scripts/hosts.mjs +81 -0
- package/scripts/packed-components-smoke.mjs +763 -0
- package/scripts/packed-install-e2e.mjs +1346 -0
- package/scripts/sediment-latency-report.mjs +63 -0
- package/scripts/sync-hosts.mjs +176 -0
- package/scripts/toolclass-corpus-replay.mjs +281 -0
- package/scripts/verify-release.mjs +342 -0
- package/tests/TEST_INVENTORY.md +41 -0
- package/tsconfig.base.json +18 -0
- package/tsconfig.json +7 -0
- package/tsconfig.tests.json +15 -0
- package/vitest.built.config.ts +9 -0
- package/vitest.config.ts +54 -0
- /package/{assets → packages/selector/assets}/deepseek-v4/LICENSE.DeepSeek-V4-Pro.txt +0 -0
- /package/{assets → packages/selector/assets}/deepseek-v4/manifest.json +0 -0
- /package/{assets → packages/selector/assets}/deepseek-v4/tokenizer.json +0 -0
- /package/{assets → packages/selector/assets}/deepseek-v4/tokenizer_config.json +0 -0
- /package/{assets → packages/selector/assets}/deepseek-v4-vision-exp/LICENSE.DeepSeek-V4-Flash-Vision-Exp.txt +0 -0
- /package/{assets → packages/selector/assets}/deepseek-v4-vision-exp/manifest.json +0 -0
- /package/{assets → packages/selector/assets}/deepseek-v4-vision-exp/tokenizer.json +0 -0
- /package/{assets → packages/selector/assets}/deepseek-v4-vision-exp/tokenizer_config.json +0 -0
- /package/{cordis.patch.yml → packages/selector/cordis.patch.yml} +0 -0
- /package/{lib → packages/selector/lib}/client.d.ts +0 -0
- /package/{lib → packages/selector/lib}/index.d.ts +0 -0
- /package/{lib → packages/selector/lib}/index.js +0 -0
- /package/{lib → packages/selector/lib}/invariant.d.ts +0 -0
- /package/{lib → packages/selector/lib}/invariant.js +0 -0
- /package/{lib → packages/selector/lib}/profiles.d.ts +0 -0
- /package/{lib → packages/selector/lib}/pruner.d.ts +0 -0
- /package/{lib → packages/selector/lib}/pruner.js +0 -0
- /package/{lib → packages/selector/lib}/savings-integral.js +0 -0
- /package/{lib → packages/selector/lib}/tail-trim.js +0 -0
- /package/{lib → packages/selector/lib}/tool-result.js +0 -0
- /package/{locale → packages/selector/locale}/de.json +0 -0
- /package/{locale → packages/selector/locale}/en.json +0 -0
- /package/{locale → packages/selector/locale}/es.json +0 -0
- /package/{locale → packages/selector/locale}/fr.json +0 -0
- /package/{locale → packages/selector/locale}/it.json +0 -0
- /package/{locale → packages/selector/locale}/ja.json +0 -0
- /package/{locale → packages/selector/locale}/ko.json +0 -0
- /package/{locale → packages/selector/locale}/pt.json +0 -0
- /package/{locale → packages/selector/locale}/ru.json +0 -0
- /package/{locale → packages/selector/locale}/zh.json +0 -0
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CompressionProfileControls: dropdown selector for compression profiles,
|
|
3
|
+
* plus AutoCompactThresholdControls and CodeSkeletonControls sub-components.
|
|
4
|
+
*
|
|
5
|
+
* Extracted from CompressionProfileSelector.tsx to reduce god-module size.
|
|
6
|
+
*
|
|
7
|
+
* @module dsh-context-compression-improved/client/CompressionProfileControls
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { useEffect, useId, useState } from 'react'
|
|
11
|
+
import { IconChevronDownOutlineMedium, Menu } from '@deepseek-ai/dsh-client-ui-primitives'
|
|
12
|
+
import type { ContextCompressionLocaleKey } from './locales.ts'
|
|
13
|
+
import css from './CompressionProfileSelector.module.css'
|
|
14
|
+
import {
|
|
15
|
+
AUTO_COMPACT_THRESHOLD_LIMITS,
|
|
16
|
+
COMPRESSION_PROFILES,
|
|
17
|
+
isValidAutoCompactThresholdPercent,
|
|
18
|
+
type CompressionProfile,
|
|
19
|
+
type CustomCompressionPolicyV3,
|
|
20
|
+
} from '../profiles.ts'
|
|
21
|
+
import type { CompressionProfileSelectorProps } from './CompressionProfileSelector.tsx'
|
|
22
|
+
import { CustomPolicyEditor, editableCustom } from './CustomPolicyEditor.tsx'
|
|
23
|
+
|
|
24
|
+
export function CompressionProfileControls({
|
|
25
|
+
useCompression, select, saveCustom, resetCustom, savePtcCustom, resetPtcCustom, t, showCustomEditor,
|
|
26
|
+
}: CompressionProfileSelectorProps & { showCustomEditor: boolean }) {
|
|
27
|
+
const state = useCompression(snapshot => snapshot)
|
|
28
|
+
// Harness 0.1.5 dropped browser-side agentPreset from session summaries; see
|
|
29
|
+
// the section component note. Only Minimal used to block initial
|
|
30
|
+
// configuration, and that signal is no longer available client-side.
|
|
31
|
+
const contextCompressionAvailable = true
|
|
32
|
+
const [open, setOpen] = useState(false)
|
|
33
|
+
const [saving, setSaving] = useState(false)
|
|
34
|
+
const [saveError, setSaveError] = useState<string | null>(null)
|
|
35
|
+
const [draft, setDraft] = useState<CustomCompressionPolicyV3 | null>(null)
|
|
36
|
+
const [ptcDraft, setPtcDraft] = useState<CustomCompressionPolicyV3 | null>(null)
|
|
37
|
+
const unavailableId = useId()
|
|
38
|
+
const current = state.value?.profile ?? 'balanced'
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
if (state.status === 'ready' && state.writable && contextCompressionAvailable) return
|
|
41
|
+
setOpen(false)
|
|
42
|
+
}, [contextCompressionAvailable, state.status, state.writable])
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
const custom = state.value?.custom
|
|
45
|
+
setDraft((current === 'custom' || current === 'tokenpilot-inspired') && custom !== undefined ? editableCustom(custom) : null)
|
|
46
|
+
}, [current, state.value?.custom])
|
|
47
|
+
useEffect(() => {
|
|
48
|
+
const ptcCustom = state.value?.ptcCustom
|
|
49
|
+
setPtcDraft(current === 'ptc' && ptcCustom !== undefined ? editableCustom(ptcCustom) : null)
|
|
50
|
+
}, [current, state.value?.ptcCustom])
|
|
51
|
+
if (state.status === 'unavailable') return null
|
|
52
|
+
const busy = state.status === 'loading' || saving
|
|
53
|
+
const label = busy ? t('status.loading') : t(`profile.${current}`)
|
|
54
|
+
return (
|
|
55
|
+
<div className={css.root}>
|
|
56
|
+
<Menu
|
|
57
|
+
open={open && contextCompressionAvailable}
|
|
58
|
+
onClose={() => { setOpen(false) }}
|
|
59
|
+
selectedId={current}
|
|
60
|
+
items={COMPRESSION_PROFILES.map(profile => ({
|
|
61
|
+
id: profile,
|
|
62
|
+
label: (
|
|
63
|
+
<span className={css.menuCopy}>
|
|
64
|
+
<span className={css.menuTitle}>{t(`profile.${profile}`)}</span>
|
|
65
|
+
<span className={css.menuDetail}>{t(`detail.${profile}`)}</span>
|
|
66
|
+
</span>
|
|
67
|
+
),
|
|
68
|
+
}))}
|
|
69
|
+
onSelect={(id) => {
|
|
70
|
+
setOpen(false)
|
|
71
|
+
if (id === current || !COMPRESSION_PROFILES.includes(id as CompressionProfile)) return
|
|
72
|
+
setSaveError(null)
|
|
73
|
+
setSaving(true)
|
|
74
|
+
void select(id as CompressionProfile).then(
|
|
75
|
+
() => { setSaving(false) },
|
|
76
|
+
(error: unknown) => {
|
|
77
|
+
setSaving(false)
|
|
78
|
+
setSaveError(error instanceof Error && error.message !== '' ? error.message : t('status.saveFailed'))
|
|
79
|
+
},
|
|
80
|
+
)
|
|
81
|
+
}}
|
|
82
|
+
align="start"
|
|
83
|
+
portal
|
|
84
|
+
anchor={(
|
|
85
|
+
<button
|
|
86
|
+
type="button"
|
|
87
|
+
className={css.button}
|
|
88
|
+
aria-haspopup="menu"
|
|
89
|
+
aria-expanded={open && contextCompressionAvailable}
|
|
90
|
+
aria-describedby={contextCompressionAvailable ? undefined : unavailableId}
|
|
91
|
+
disabled={busy || !state.writable || !contextCompressionAvailable}
|
|
92
|
+
onClick={() => { setOpen(value => !value) }}
|
|
93
|
+
>
|
|
94
|
+
<span className={css.copy}>
|
|
95
|
+
<span className={css.label}>{t('label')}</span>
|
|
96
|
+
<span className={css.value}>{label}</span>
|
|
97
|
+
</span>
|
|
98
|
+
<IconChevronDownOutlineMedium className={css.chevron} />
|
|
99
|
+
</button>
|
|
100
|
+
)}
|
|
101
|
+
/>
|
|
102
|
+
{contextCompressionAvailable ? null : (
|
|
103
|
+
<div id={unavailableId} className={css.unavailable} role="status">
|
|
104
|
+
{t('status.minimalUnavailable')}
|
|
105
|
+
</div>
|
|
106
|
+
)}
|
|
107
|
+
<div className={css.pricing}>{t('pricing.disclosure')}</div>
|
|
108
|
+
<div className={css.settingsHint}>
|
|
109
|
+
{t('autoCompact.summaryHint').replace('{percent}', String(state.value?.autoCompact?.thresholdPercent ?? AUTO_COMPACT_THRESHOLD_LIMITS.default))}
|
|
110
|
+
</div>
|
|
111
|
+
{current !== 'custom' && current !== 'tokenpilot-inspired' || showCustomEditor ? null : (
|
|
112
|
+
<div className={css.settingsHint}>{t('custom.settingsHint')}</div>
|
|
113
|
+
)}
|
|
114
|
+
{current !== 'custom' && current !== 'tokenpilot-inspired' || draft === null || !showCustomEditor ? null : (
|
|
115
|
+
<CustomPolicyEditor
|
|
116
|
+
value={draft}
|
|
117
|
+
disabled={busy || !state.writable || !contextCompressionAvailable}
|
|
118
|
+
setValue={setDraft}
|
|
119
|
+
save={() => saveCustom(structuredClone(draft))}
|
|
120
|
+
reset={resetCustom}
|
|
121
|
+
settle={(operation) => {
|
|
122
|
+
setSaveError(null)
|
|
123
|
+
setSaving(true)
|
|
124
|
+
void operation().then(
|
|
125
|
+
() => { setSaving(false) },
|
|
126
|
+
(error: unknown) => {
|
|
127
|
+
setSaving(false)
|
|
128
|
+
setSaveError(error instanceof Error && error.message !== '' ? error.message : t('status.saveFailed'))
|
|
129
|
+
},
|
|
130
|
+
)
|
|
131
|
+
}}
|
|
132
|
+
t={t}
|
|
133
|
+
/>
|
|
134
|
+
)}
|
|
135
|
+
{current !== 'ptc' || ptcDraft === null || !showCustomEditor ? null : (
|
|
136
|
+
<CustomPolicyEditor
|
|
137
|
+
value={ptcDraft}
|
|
138
|
+
disabled={busy || !state.writable || !contextCompressionAvailable}
|
|
139
|
+
setValue={setPtcDraft}
|
|
140
|
+
save={() => savePtcCustom(structuredClone(ptcDraft))}
|
|
141
|
+
reset={resetPtcCustom}
|
|
142
|
+
settle={(operation) => {
|
|
143
|
+
setSaveError(null)
|
|
144
|
+
setSaving(true)
|
|
145
|
+
void operation().then(
|
|
146
|
+
() => { setSaving(false) },
|
|
147
|
+
(error: unknown) => {
|
|
148
|
+
setSaving(false)
|
|
149
|
+
setSaveError(error instanceof Error && error.message !== '' ? error.message : t('status.saveFailed'))
|
|
150
|
+
},
|
|
151
|
+
)
|
|
152
|
+
}}
|
|
153
|
+
t={t}
|
|
154
|
+
/>
|
|
155
|
+
)}
|
|
156
|
+
{saveError === null ? null : <div className={css.error} role="alert">{saveError}</div>}
|
|
157
|
+
</div>
|
|
158
|
+
)
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
interface AutoCompactThresholdControlsProps {
|
|
162
|
+
value: number
|
|
163
|
+
disabled: boolean
|
|
164
|
+
save: (thresholdPercent: number) => Promise<void>
|
|
165
|
+
settle: (operation: () => Promise<void>) => void
|
|
166
|
+
t: (key: ContextCompressionLocaleKey) => string
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* The authoritative Auto Compact threshold editor for the context-compression
|
|
171
|
+
* section. A typed number input and its save path are kept deliberately simple;
|
|
172
|
+
* values outside the recommended 70–85 band warn without blocking.
|
|
173
|
+
*/
|
|
174
|
+
export function AutoCompactThresholdControls({ value, disabled, save, settle, t }: AutoCompactThresholdControlsProps) {
|
|
175
|
+
const [draft, setDraft] = useState(String(value))
|
|
176
|
+
useEffect(() => { setDraft(String(value)) }, [value])
|
|
177
|
+
const parsed = Number(draft)
|
|
178
|
+
// Number inputs legally produce value-equivalent drafts such as '8e1';
|
|
179
|
+
// only the parsed value needs to be a valid threshold.
|
|
180
|
+
const valid = isValidAutoCompactThresholdPercent(parsed)
|
|
181
|
+
const risk = !valid
|
|
182
|
+
? 'autoCompact.invalid'
|
|
183
|
+
: parsed < 70 ? 'autoCompact.riskLow'
|
|
184
|
+
: parsed > 85 ? 'autoCompact.riskHigh'
|
|
185
|
+
: undefined
|
|
186
|
+
return (
|
|
187
|
+
<section className={css.autoCompact} aria-labelledby="context-compression-autocompact-title">
|
|
188
|
+
<h3 id="context-compression-autocompact-title" className={css.autoCompactTitle}>{t('autoCompact.title')}</h3>
|
|
189
|
+
<p className={css.customNote}>{t('autoCompact.description')}</p>
|
|
190
|
+
<label className={css.field}>
|
|
191
|
+
<span>{t('autoCompact.inputLabel')}</span>
|
|
192
|
+
<input
|
|
193
|
+
type="number"
|
|
194
|
+
value={draft}
|
|
195
|
+
min={AUTO_COMPACT_THRESHOLD_LIMITS.min}
|
|
196
|
+
max={AUTO_COMPACT_THRESHOLD_LIMITS.max}
|
|
197
|
+
step={AUTO_COMPACT_THRESHOLD_LIMITS.step}
|
|
198
|
+
disabled={disabled}
|
|
199
|
+
aria-invalid={!valid}
|
|
200
|
+
onChange={(event) => { setDraft(event.currentTarget.value) }}
|
|
201
|
+
/>
|
|
202
|
+
</label>
|
|
203
|
+
{risk === undefined ? null : (
|
|
204
|
+
<div className={risk === 'autoCompact.invalid' ? css.error : css.autoCompactRisk} role={risk === 'autoCompact.invalid' ? 'alert' : 'note'}>
|
|
205
|
+
{t(risk)}
|
|
206
|
+
</div>
|
|
207
|
+
)}
|
|
208
|
+
<div className={css.actions}>
|
|
209
|
+
<button
|
|
210
|
+
type="button"
|
|
211
|
+
disabled={disabled || !valid || parsed === value}
|
|
212
|
+
onClick={() => { settle(() => save(parsed)) }}
|
|
213
|
+
>
|
|
214
|
+
{t('autoCompact.save')}
|
|
215
|
+
</button>
|
|
216
|
+
</div>
|
|
217
|
+
</section>
|
|
218
|
+
)
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
interface CodeSkeletonControlsProps {
|
|
222
|
+
value: boolean
|
|
223
|
+
disabled: boolean
|
|
224
|
+
save: (enabled: boolean) => Promise<void>
|
|
225
|
+
settle: (operation: () => Promise<void>) => void
|
|
226
|
+
t: (key: ContextCompressionLocaleKey) => string
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* The authoritative code-skeleton reducer gate for the context-compression
|
|
231
|
+
* section. Deliberately minimal — an on/off select plus its own save path —
|
|
232
|
+
* because the gate is orthogonal to every profile and carries no parameters.
|
|
233
|
+
*/
|
|
234
|
+
interface IntentSummaryControlsProps {
|
|
235
|
+
value: boolean
|
|
236
|
+
disabled: boolean
|
|
237
|
+
save: (enabled: boolean) => Promise<void>
|
|
238
|
+
settle: (operation: () => Promise<void>) => void
|
|
239
|
+
t: (key: ContextCompressionLocaleKey) => string
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* The turn-tail intent summary fold gate. Same deliberately minimal shape as
|
|
244
|
+
* the code-skeleton gate: an on/off select with its own save path; the fold
|
|
245
|
+
* itself is gated by the growth constants and the per-session /ctx-summary
|
|
246
|
+
* override, none of which belong in this card.
|
|
247
|
+
*/
|
|
248
|
+
export function IntentSummaryControls({ value, disabled, save, settle, t }: IntentSummaryControlsProps) {
|
|
249
|
+
return (
|
|
250
|
+
<section className={css.autoCompact} aria-labelledby="context-compression-intentsummary-title">
|
|
251
|
+
<h3 id="context-compression-intentsummary-title" className={css.autoCompactTitle}>{t('intentSummary.title')}</h3>
|
|
252
|
+
<p className={css.customNote}>{t('intentSummary.description')}</p>
|
|
253
|
+
<label className={css.field}>
|
|
254
|
+
<span>{t('intentSummary.enabled')}</span>
|
|
255
|
+
<select
|
|
256
|
+
value={value ? 'on' : 'off'}
|
|
257
|
+
disabled={disabled}
|
|
258
|
+
onChange={(event) => { settle(() => save(event.currentTarget.value === 'on')) }}
|
|
259
|
+
>
|
|
260
|
+
<option value="on">{t('intentSummary.enabled.on')}</option>
|
|
261
|
+
<option value="off">{t('intentSummary.enabled.off')}</option>
|
|
262
|
+
</select>
|
|
263
|
+
</label>
|
|
264
|
+
</section>
|
|
265
|
+
)
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
interface MonitorPanelControlsProps {
|
|
269
|
+
value: boolean
|
|
270
|
+
disabled: boolean
|
|
271
|
+
save: (enabled: boolean) => Promise<void>
|
|
272
|
+
settle: (operation: () => Promise<void>) => void
|
|
273
|
+
t: (key: ContextCompressionLocaleKey) => string
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* Visibility switch of the floating compression-monitor panel (FAB). The
|
|
278
|
+
* panel itself is a body-level overlay driven by the monitor route; this card
|
|
279
|
+
* only decides whether it mounts.
|
|
280
|
+
*/
|
|
281
|
+
export function MonitorPanelControls({ value, disabled, save, settle, t }: MonitorPanelControlsProps) {
|
|
282
|
+
return (
|
|
283
|
+
<section className={css.autoCompact} aria-labelledby="context-compression-monitorpanel-title">
|
|
284
|
+
<h3 id="context-compression-monitorpanel-title" className={css.autoCompactTitle}>{t('monitorPanel.title')}</h3>
|
|
285
|
+
<p className={css.customNote}>{t('monitorPanel.description')}</p>
|
|
286
|
+
<label className={css.field}>
|
|
287
|
+
<span>{t('monitorPanel.enabled')}</span>
|
|
288
|
+
<select
|
|
289
|
+
value={value ? 'on' : 'off'}
|
|
290
|
+
disabled={disabled}
|
|
291
|
+
onChange={(event) => { settle(() => save(event.currentTarget.value === 'on')) }}
|
|
292
|
+
>
|
|
293
|
+
<option value="on">{t('monitorPanel.enabled.on')}</option>
|
|
294
|
+
<option value="off">{t('monitorPanel.enabled.off')}</option>
|
|
295
|
+
</select>
|
|
296
|
+
</label>
|
|
297
|
+
</section>
|
|
298
|
+
)
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
export function CodeSkeletonControls({ value, disabled, save, settle, t }: CodeSkeletonControlsProps) {
|
|
302
|
+
return (
|
|
303
|
+
<section className={css.autoCompact} aria-labelledby="context-compression-codeskeleton-title">
|
|
304
|
+
<h3 id="context-compression-codeskeleton-title" className={css.autoCompactTitle}>{t('codeSkeleton.title')}</h3>
|
|
305
|
+
<p className={css.customNote}>{t('codeSkeleton.description')}</p>
|
|
306
|
+
<label className={css.field}>
|
|
307
|
+
<span>{t('codeSkeleton.enabled')}</span>
|
|
308
|
+
<select
|
|
309
|
+
value={value ? 'on' : 'off'}
|
|
310
|
+
disabled={disabled}
|
|
311
|
+
onChange={(event) => { settle(() => save(event.currentTarget.value === 'on')) }}
|
|
312
|
+
>
|
|
313
|
+
<option value="on">{t('codeSkeleton.enabled.on')}</option>
|
|
314
|
+
<option value="off">{t('codeSkeleton.enabled.off')}</option>
|
|
315
|
+
</select>
|
|
316
|
+
</label>
|
|
317
|
+
</section>
|
|
318
|
+
)
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
interface SedimentControlsProps {
|
|
322
|
+
value: boolean
|
|
323
|
+
disabled: boolean
|
|
324
|
+
save: (enabled: boolean) => Promise<void>
|
|
325
|
+
settle: (operation: () => Promise<void>) => void
|
|
326
|
+
t: (key: ContextCompressionLocaleKey) => string
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
/**
|
|
330
|
+
* Turn-tail sedimentation gate (plan cci-sedimentation-triage T3.7): on/off
|
|
331
|
+
* select with the display-impact disclosure in its description (M13) —
|
|
332
|
+
* replaced spans leave the transcript view; originals stay in the log.
|
|
333
|
+
*/
|
|
334
|
+
export function SedimentControls({ value, disabled, save, settle, t }: SedimentControlsProps) {
|
|
335
|
+
return (
|
|
336
|
+
<section className={css.autoCompact} aria-labelledby="context-compression-sediment-title">
|
|
337
|
+
<h3 id="context-compression-sediment-title" className={css.autoCompactTitle}>{t('sediment.title')}</h3>
|
|
338
|
+
<p className={css.customNote}>{t('sediment.description')}</p>
|
|
339
|
+
<label className={css.field}>
|
|
340
|
+
<span>{t('sediment.enabled')}</span>
|
|
341
|
+
<select
|
|
342
|
+
value={value ? 'on' : 'off'}
|
|
343
|
+
disabled={disabled}
|
|
344
|
+
onChange={(event) => { settle(() => save(event.currentTarget.value === 'on')) }}
|
|
345
|
+
>
|
|
346
|
+
<option value="on">{t('sediment.enabled.on')}</option>
|
|
347
|
+
<option value="off">{t('sediment.enabled.off')}</option>
|
|
348
|
+
</select>
|
|
349
|
+
</label>
|
|
350
|
+
</section>
|
|
351
|
+
)
|
|
352
|
+
}
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
.settingsSection {
|
|
2
|
+
display: flex;
|
|
3
|
+
max-width: 720px;
|
|
4
|
+
flex-direction: column;
|
|
5
|
+
gap: 12px;
|
|
6
|
+
color: var(--dsw-alias-label-primary);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.settingsTitle {
|
|
10
|
+
margin: 0;
|
|
11
|
+
color: var(--dsw-alias-label-primary);
|
|
12
|
+
font-size: 16px;
|
|
13
|
+
font-weight: 500;
|
|
14
|
+
line-height: 24px;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.settingsDescription {
|
|
18
|
+
margin: 0;
|
|
19
|
+
color: var(--dsw-alias-label-tertiary);
|
|
20
|
+
font-size: 14px;
|
|
21
|
+
line-height: 22px;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.root {
|
|
25
|
+
width: 100%;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.profileGrid {
|
|
29
|
+
display: grid;
|
|
30
|
+
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
31
|
+
gap: 10px;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.profileCard {
|
|
35
|
+
min-height: 112px;
|
|
36
|
+
display: flex;
|
|
37
|
+
flex-direction: column;
|
|
38
|
+
gap: 8px;
|
|
39
|
+
padding: 14px;
|
|
40
|
+
border: 1px solid var(--dsw-alias-border-l2);
|
|
41
|
+
border-radius: 10px;
|
|
42
|
+
background: transparent;
|
|
43
|
+
color: var(--dsw-alias-label-primary);
|
|
44
|
+
cursor: pointer;
|
|
45
|
+
text-align: left;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.profileCard:hover:not(:disabled) { background: var(--dsw-alias-interactive-bg-hover); }
|
|
49
|
+
.profileCard[aria-pressed="true"] { border-color: var(--dsw-alias-label-primary); }
|
|
50
|
+
.profileCard:active:not(:disabled) { transform: scale(.99); }
|
|
51
|
+
.profileCard:disabled { cursor: default; opacity: .6; }
|
|
52
|
+
.profileCard:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
|
|
53
|
+
.profileCardTop { display: flex; align-items: center; gap: 8px; }
|
|
54
|
+
.profileCardTitle { font-size: 14px; font-weight: 500; line-height: 20px; }
|
|
55
|
+
.profileCurrent { padding: 1px 6px; border-radius: 999px; background: var(--dsw-alias-label-primary); color: var(--dsw-alias-bg-base); font-size: 10px; line-height: 14px; }
|
|
56
|
+
.profileCardDetail { color: var(--dsw-alias-label-secondary); font-size: 12px; line-height: 18px; }
|
|
57
|
+
|
|
58
|
+
.button {
|
|
59
|
+
width: 100%;
|
|
60
|
+
min-height: 34px;
|
|
61
|
+
display: flex;
|
|
62
|
+
align-items: center;
|
|
63
|
+
gap: 8px;
|
|
64
|
+
padding: 6px 8px;
|
|
65
|
+
border: 1px solid var(--dsw-alias-border-l2);
|
|
66
|
+
border-radius: 10px;
|
|
67
|
+
background: transparent;
|
|
68
|
+
color: var(--dsw-alias-label-primary);
|
|
69
|
+
cursor: pointer;
|
|
70
|
+
text-align: left;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.button:hover { background: var(--dsw-alias-interactive-bg-hover); }
|
|
74
|
+
.button:disabled { cursor: default; opacity: .6; }
|
|
75
|
+
|
|
76
|
+
.copy { flex: 1; min-width: 0; }
|
|
77
|
+
.label { font-size: 11px; line-height: 14px; color: var(--dsw-alias-label-tertiary); }
|
|
78
|
+
.value { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; line-height: 17px; }
|
|
79
|
+
.chevron { flex: none; color: var(--dsw-alias-label-secondary); }
|
|
80
|
+
|
|
81
|
+
.menuCopy { display: flex; min-width: 220px; flex-direction: column; gap: 2px; }
|
|
82
|
+
.menuTitle { font-size: 13px; line-height: 17px; }
|
|
83
|
+
.menuDetail { max-width: 290px; white-space: normal; font-size: 11px; line-height: 15px; color: var(--dsw-alias-label-tertiary); }
|
|
84
|
+
|
|
85
|
+
.error {
|
|
86
|
+
padding: 4px 8px 0;
|
|
87
|
+
color: var(--dsw-alias-state-error-primary);
|
|
88
|
+
font-size: 11px;
|
|
89
|
+
line-height: 15px;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.unavailable {
|
|
93
|
+
padding: 4px 8px 0;
|
|
94
|
+
color: var(--dsw-alias-label-tertiary);
|
|
95
|
+
font-size: 11px;
|
|
96
|
+
line-height: 15px;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.settingsHint {
|
|
100
|
+
padding: 4px 8px 0;
|
|
101
|
+
color: var(--dsw-alias-label-secondary);
|
|
102
|
+
font-size: 11px;
|
|
103
|
+
line-height: 15px;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.pricing {
|
|
107
|
+
padding: 4px 8px 0;
|
|
108
|
+
color: var(--dsw-alias-label-tertiary);
|
|
109
|
+
font-size: 11px;
|
|
110
|
+
line-height: 15px;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.custom {
|
|
114
|
+
margin-top: 16px;
|
|
115
|
+
padding: 16px 0 0;
|
|
116
|
+
border-top: 1px solid var(--dsw-alias-border-l2);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.customTitle { margin: 0 0 6px; font-size: 13px; line-height: 17px; }
|
|
120
|
+
.customNote { margin: 4px 0; color: var(--dsw-alias-label-tertiary); font-size: 11px; line-height: 15px; }
|
|
121
|
+
|
|
122
|
+
.stage {
|
|
123
|
+
margin: 12px 0 0;
|
|
124
|
+
padding: 12px 0 0;
|
|
125
|
+
border: 0;
|
|
126
|
+
border-top: 1px solid var(--dsw-alias-border-l2);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.stageToggle { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; line-height: 16px; }
|
|
130
|
+
.fieldGrid { display: grid; grid-template-columns: 1fr; gap: 8px; }
|
|
131
|
+
.field { display: flex; min-width: 0; flex-direction: column; gap: 4px; margin-top: 8px; color: var(--dsw-alias-label-secondary); font-size: 11px; line-height: 15px; }
|
|
132
|
+
.field input, .field select {
|
|
133
|
+
width: 100%;
|
|
134
|
+
min-width: 0;
|
|
135
|
+
min-height: 30px;
|
|
136
|
+
box-sizing: border-box;
|
|
137
|
+
padding: 4px 6px;
|
|
138
|
+
border: 1px solid var(--dsw-alias-border-l2);
|
|
139
|
+
border-radius: 7px;
|
|
140
|
+
background: var(--dsw-alias-bg-base);
|
|
141
|
+
color: var(--dsw-alias-label-primary);
|
|
142
|
+
}
|
|
143
|
+
.field input:focus-visible, .field select:focus-visible, .actions button:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
|
|
144
|
+
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
|
|
145
|
+
.actions button { min-height: 30px; padding: 4px 8px; border: 1px solid var(--dsw-alias-border-l2); border-radius: 7px; background: transparent; color: var(--dsw-alias-label-primary); }
|
|
146
|
+
.actions button:active:not(:disabled) { transform: scale(.98); }
|
|
147
|
+
.actions button:disabled { opacity: .6; }
|
|
148
|
+
|
|
149
|
+
@media (max-width: 560px) {
|
|
150
|
+
.profileGrid { grid-template-columns: 1fr; }
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.autoCompact {
|
|
154
|
+
margin-top: 24px;
|
|
155
|
+
padding: 16px;
|
|
156
|
+
border: 1px solid rgba(128, 128, 128, 0.35);
|
|
157
|
+
border-radius: 8px;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.autoCompactTitle {
|
|
161
|
+
margin: 0 0 8px;
|
|
162
|
+
font-size: 15px;
|
|
163
|
+
font-weight: 600;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.autoCompactRisk {
|
|
167
|
+
margin: 8px 0 0;
|
|
168
|
+
font-size: 12px;
|
|
169
|
+
opacity: 0.9;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.savingsCard {
|
|
173
|
+
margin-top: 14px;
|
|
174
|
+
padding: 10px 12px;
|
|
175
|
+
border: 1px solid rgba(255, 255, 255, 0.1);
|
|
176
|
+
border-radius: 8px;
|
|
177
|
+
display: flex;
|
|
178
|
+
flex-direction: column;
|
|
179
|
+
gap: 4px;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.savingsRow {
|
|
183
|
+
display: flex;
|
|
184
|
+
justify-content: space-between;
|
|
185
|
+
align-items: baseline;
|
|
186
|
+
gap: 12px;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.savingsNetPositive strong { color: #30d158; }
|
|
190
|
+
.savingsNetNegative strong { color: #ff9f0a; }
|
|
191
|
+
.savingsMuted { opacity: 0.66; font-size: 0.92em; }
|
|
192
|
+
|
|
193
|
+
.savingsBreakdown {
|
|
194
|
+
border-top: 1px solid rgba(255, 255, 255, 0.08);
|
|
195
|
+
margin-top: 4px;
|
|
196
|
+
padding-top: 4px;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
.savingsNote { opacity: 0.5; font-size: 0.85em; margin-top: 4px; }
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CompressionProfileSelector — thin re-export hub.
|
|
3
|
+
*
|
|
4
|
+
* Component implementations now live in dedicated modules to keep the
|
|
5
|
+
* god-module under control. This file preserves the public API surface so
|
|
6
|
+
* existing consumers see no change.
|
|
7
|
+
*
|
|
8
|
+
* @module dsh-context-compression-improved/client/CompressionProfileSelector
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import type { SettingsScope } from './scope-face.ts'
|
|
12
|
+
import type { InjectFace, PropsLocale } from '@deepseek-ai/dsh-client-ui-slots'
|
|
13
|
+
import {
|
|
14
|
+
COMPRESSION_PROFILES,
|
|
15
|
+
isCustomCompressionPolicy,
|
|
16
|
+
type CompressionProfile,
|
|
17
|
+
type CustomCompressionPolicy,
|
|
18
|
+
type ContextCompressionSettings,
|
|
19
|
+
type PresetOptionsSettings,
|
|
20
|
+
} from '../profiles.ts'
|
|
21
|
+
|
|
22
|
+
export { COMPRESSION_PROFILES, isCustomCompressionPolicy }
|
|
23
|
+
export type { CompressionProfile, CustomCompressionPolicy, ContextCompressionSettings, PresetOptionsSettings }
|
|
24
|
+
|
|
25
|
+
export interface CompressionSelectorInjected {
|
|
26
|
+
hooks: { compression: SettingsScope<ContextCompressionSettings> }
|
|
27
|
+
select: (profile: CompressionProfile) => Promise<void>
|
|
28
|
+
saveCustom: (custom: CustomCompressionPolicy) => Promise<void>
|
|
29
|
+
resetCustom: () => Promise<void>
|
|
30
|
+
savePtcCustom: (custom: CustomCompressionPolicy) => Promise<void>
|
|
31
|
+
resetPtcCustom: () => Promise<void>
|
|
32
|
+
saveAutoCompact: (thresholdPercent: number) => Promise<void>
|
|
33
|
+
saveCodeSkeleton: (enabled: boolean) => Promise<void>
|
|
34
|
+
saveSediment: (enabled: boolean) => Promise<void>
|
|
35
|
+
saveIntentSummary: (enabled: boolean) => Promise<void>
|
|
36
|
+
saveMonitorPanel: (enabled: boolean) => Promise<void>
|
|
37
|
+
/** Patch of `presetOptions` members; an explicit `undefined` clears that field. */
|
|
38
|
+
savePresetOptions: (options: import('./preset-options.ts').PresetOptionsPatch) => Promise<void>
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Owner-agnostic panel props: the same component registers under the 0.1.5
|
|
43
|
+
* `settings.plugins.tab` card (no owner props) and the legacy
|
|
44
|
+
* `settings.section` page (whose shell supplies `close`), so the section
|
|
45
|
+
* owner share stays optional.
|
|
46
|
+
*/
|
|
47
|
+
export type CompressionProfileSelectorProps =
|
|
48
|
+
{ close?: () => void }
|
|
49
|
+
& PropsLocale<'context-compression'>
|
|
50
|
+
& InjectFace<CompressionSelectorInjected>
|
|
51
|
+
|
|
52
|
+
// Re-export sub-components from dedicated modules.
|
|
53
|
+
export {
|
|
54
|
+
ContextCompressionSettingsSection,
|
|
55
|
+
SettingsCompressionProfileControls,
|
|
56
|
+
} from './settings-section.tsx'
|
|
57
|
+
|
|
58
|
+
export {
|
|
59
|
+
CompressionProfileControls,
|
|
60
|
+
AutoCompactThresholdControls,
|
|
61
|
+
CodeSkeletonControls,
|
|
62
|
+
SedimentControls,
|
|
63
|
+
} from './CompressionProfileControls.tsx'
|
|
64
|
+
|
|
65
|
+
export {
|
|
66
|
+
EstimatorControls,
|
|
67
|
+
} from './EstimatorControls.tsx'
|
|
68
|
+
|
|
69
|
+
export {
|
|
70
|
+
CustomPolicyEditor,
|
|
71
|
+
StageFields,
|
|
72
|
+
editableCustom,
|
|
73
|
+
} from './CustomPolicyEditor.tsx'
|
|
74
|
+
|
|
75
|
+
// Imported for the wrapper component below; re-exported above.
|
|
76
|
+
import { CompressionProfileControls } from './CompressionProfileControls.tsx'
|
|
77
|
+
|
|
78
|
+
/** Full-page Settings surface backed by the same durable selector state. */
|
|
79
|
+
export function CompressionProfileSelector({
|
|
80
|
+
...props
|
|
81
|
+
}: CompressionProfileSelectorProps) {
|
|
82
|
+
return <CompressionProfileControls {...props} showCustomEditor={false} />
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
declare module '@deepseek-ai/dsh-client-ui-slots' {
|
|
86
|
+
interface LocaleNamespaceMap {
|
|
87
|
+
'context-compression': import('./locales.ts').ContextCompressionLocaleKey
|
|
88
|
+
}
|
|
89
|
+
}
|