dsh-context-compression-improved 0.11.4 → 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 +121 -15
- package/README.pt.md +96 -0
- package/README.ru.md +96 -0
- package/README.zh.md +104 -14
- 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} +2 -2
- package/{lib → packages/selector/lib}/client.js +400 -0
- 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,46 @@
|
|
|
1
|
+
# Parent and child agent cache-prefix audit
|
|
2
|
+
|
|
3
|
+
## Scope
|
|
4
|
+
|
|
5
|
+
This reference characterizes when DeepSeek Harness parent and child requests can present an identical prompt prefix to DeepSeek's automatic context cache. It does not add an explicit cache key, cache breakpoint, cache identifier, or client-side KV cache.
|
|
6
|
+
|
|
7
|
+
The selector plugin owns settings registration and UI only. It has no hook into agent request construction, subagent session creation, or LLM serialization, so this work must not add runtime request behavior to the plugin or modify Harness core.
|
|
8
|
+
|
|
9
|
+
## Three separate questions
|
|
10
|
+
|
|
11
|
+
Context inheritance asks whether a child session receives parent session events. A fork copies the parent event prefix through the last completed turn; a spawn starts without parent messages. The child metadata records the parent session and, for a fork, the seed length.
|
|
12
|
+
|
|
13
|
+
Harness cache control asks whether Harness supplies a DeepSeek cache key or breakpoint across requests or sessions. The DeepSeek adapter serializes ordinary Chat Completions input and reads official usage fields; it supplies no explicit cache control.
|
|
14
|
+
|
|
15
|
+
Server cache reuse asks whether byte-identical request prefixes can hit DeepSeek's automatic context cache. This is best-effort server behavior and is confirmed only when official response usage reports a positive `prompt_cache_hit_tokens` value. Latency and price are not evidence.
|
|
16
|
+
|
|
17
|
+
## Reuse characterization
|
|
18
|
+
|
|
19
|
+
The test-only audit representation is versioned and canonical. Object keys are sorted recursively, while arrays retain their model-visible order. A SHA-256 fingerprint is computed over UTF-8 JSON containing the provider, model, system prompt, tool schemas, and inherited messages.
|
|
20
|
+
|
|
21
|
+
A child is reusable only when it is a fork, declares parent-context inheritance, and its provider, model, system prompt, tools, and inherited messages equal the parent's stable envelope. Spawn mode, a changed persona or system prompt, changed tool schema or order, changed provider or model route, and changed history are rejected. The audit never repairs or concatenates mismatched contexts.
|
|
22
|
+
|
|
23
|
+
The characterization does not guarantee that two independently assembled HTTP bodies have the same byte prefix: JSON property order and the child-only continuation still belong to the DeepSeek adapter. The live test captures the actual immutable agent-loop request options and compares the stable inherited envelope before allowing a cache-reuse claim.
|
|
24
|
+
|
|
25
|
+
## Safe evidence record
|
|
26
|
+
|
|
27
|
+
An evidence event may contain only the audit version, prefix fingerprint, estimated shared-prefix tokens, parent and child session identifiers, mode, eligibility or reason, cache-read tokens, cache-miss tokens, observed prompt tokens, and confirmation status. It must not contain prompts, messages, tool arguments or results, tool schemas, permissions, environment values, credentials, or secrets.
|
|
28
|
+
|
|
29
|
+
Usage is internally consistent only when `cacheReadTokens + cacheMissTokens` equals the observed prompt-token total. A positive cache-read count confirms a natural cache hit for that request. Missing or zero cache-read usage yields `unconfirmed`, never a claimed miss caused by Harness.
|
|
30
|
+
|
|
31
|
+
## TDD acceptance criteria
|
|
32
|
+
|
|
33
|
+
The RED test imports an absent test-support module and defines the required behavior before implementation. The GREEN implementation remains under `tests/support` and exports no product runtime API.
|
|
34
|
+
|
|
35
|
+
- Fork accepts an identical completed-turn prefix and produces the same fingerprint for parent and child views.
|
|
36
|
+
- Spawn is ineligible because it does not inherit parent messages.
|
|
37
|
+
- Persona, tool schema or order, provider, model, and history mismatches are ineligible.
|
|
38
|
+
- Safe evidence records contain only the allowlisted fields and never contain representative secret or tool-result content.
|
|
39
|
+
- Usage projection accepts hit plus miss equaling the prompt total and rejects inconsistent totals.
|
|
40
|
+
- The existing selector runtime source remains unchanged, so disabling or omitting the plugin cannot affect agent requests.
|
|
41
|
+
- A key-gated host-side live DeepSeek E2E test uses an isolated in-memory context and task-local `DSH_HOME`; it reports only sanitized usage evidence.
|
|
42
|
+
- Existing fork, spawn, request-reconstruction, DeepSeek usage-projection, selector-plugin tests, the full build, and `git diff --check` pass.
|
|
43
|
+
|
|
44
|
+
## Operational boundaries
|
|
45
|
+
|
|
46
|
+
Tests do not connect to the active web profile, start or restart a Harness service, deploy code, or write session logs outside the isolated test environment. The test-only implementation adds no product runtime API and does not alter active profile settings or service state.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "dsh-external/dsh-context-compression-improved",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"main": "./lib/index.js",
|
|
5
|
-
"description": "
|
|
5
|
+
"description": "Token-saving, auditable tool-result context-compression selector with code-skeleton gate for DeepSeek Harness — fewer tokens on every turn",
|
|
6
6
|
"engines": {
|
|
7
7
|
"dsh": ">=0.1.0-rc.2 <0.3.0-0"
|
|
8
8
|
},
|
|
@@ -1565,6 +1565,389 @@ window.__ModuleLoader__.load({
|
|
|
1565
1565
|
});
|
|
1566
1566
|
}
|
|
1567
1567
|
//#endregion
|
|
1568
|
+
//#region src/client/guide.tsx
|
|
1569
|
+
/**
|
|
1570
|
+
* ⚠️ 生成副本 —— 请勿手改。真源:mine-dsh-plugins/_tools/guide-kit/guide.tsx
|
|
1571
|
+
* 重新同步:node _tools/guide-kit/sync.mjs
|
|
1572
|
+
*/
|
|
1573
|
+
/**
|
|
1574
|
+
* guide-kit —— 九插件共用的「首次使用引导」件(**生成副本,勿手改**)。
|
|
1575
|
+
*
|
|
1576
|
+
* 唯一真源:`mine-dsh-plugins/_tools/guide-kit/guide.tsx`
|
|
1577
|
+
* 同步命令:`node _tools/guide-kit/sync.mjs`(会覆盖本文件;改这里等于白改)
|
|
1578
|
+
*
|
|
1579
|
+
* 六条契约(见 .agents/plans/unified-i18n-onboarding/spec.md §2):
|
|
1580
|
+
* 1. Skip 恒定可见,任何步骤都能退;
|
|
1581
|
+
* 2. 永远有字:引导外壳(标题/按钮/步进)自带 10 语词表,按 <html lang> 取词,
|
|
1582
|
+
* 认不出的一律落 en;步骤正文按「本语 → en → zh → 任意可用」逐级回退,绝不留空白;
|
|
1583
|
+
* 3. 重启入口:`GuideRestartButton`(或自己调 `resetGuide(ns)` + setOpen(true))就地重开;
|
|
1584
|
+
* 4. 零依赖:只 react + localStorage,不 import 平台包,不抢宿主设置表单;
|
|
1585
|
+
* 5. 引导自己绝不能成为卡面渲染的失败点:样式注入与存储访问全部 try/catch + 能力探测;
|
|
1586
|
+
* 6. 外壳词表与步骤正文分离:外壳跨插件统一(本文件),正文每插件一份 `guide-steps.ts`。
|
|
1587
|
+
*/
|
|
1588
|
+
/** 生态通用的十个语言码(与各插件 `locale/*.json`、README 的十语镜像同口径)。 */
|
|
1589
|
+
const GUIDE_LOCALES = [
|
|
1590
|
+
"zh",
|
|
1591
|
+
"en",
|
|
1592
|
+
"ja",
|
|
1593
|
+
"ko",
|
|
1594
|
+
"fr",
|
|
1595
|
+
"de",
|
|
1596
|
+
"it",
|
|
1597
|
+
"ru",
|
|
1598
|
+
"es",
|
|
1599
|
+
"pt"
|
|
1600
|
+
];
|
|
1601
|
+
/**
|
|
1602
|
+
* 引导外壳词表(10 语)。
|
|
1603
|
+
*
|
|
1604
|
+
* 为什么不塞进各插件 locales:这七个词是**跨插件同一套**,塞进九个字典要重复翻译
|
|
1605
|
+
* 9×10 次,且一旦措辞调整就得动九个仓。外壳留在本文件,正文留各插件。
|
|
1606
|
+
*/
|
|
1607
|
+
const GUIDE_COPY = {
|
|
1608
|
+
zh: {
|
|
1609
|
+
title: "快速上手",
|
|
1610
|
+
skip: "跳过引导",
|
|
1611
|
+
next: "下一步",
|
|
1612
|
+
prev: "上一步",
|
|
1613
|
+
done: "开始使用",
|
|
1614
|
+
restart: "重新查看引导",
|
|
1615
|
+
stepOf: (current, total) => `第 ${current} / ${total} 步`
|
|
1616
|
+
},
|
|
1617
|
+
en: {
|
|
1618
|
+
title: "Quick start",
|
|
1619
|
+
skip: "Skip guide",
|
|
1620
|
+
next: "Next",
|
|
1621
|
+
prev: "Back",
|
|
1622
|
+
done: "Get started",
|
|
1623
|
+
restart: "Show guide again",
|
|
1624
|
+
stepOf: (current, total) => `Step ${current} of ${total}`
|
|
1625
|
+
},
|
|
1626
|
+
ja: {
|
|
1627
|
+
title: "クイックスタート",
|
|
1628
|
+
skip: "ガイドをスキップ",
|
|
1629
|
+
next: "次へ",
|
|
1630
|
+
prev: "戻る",
|
|
1631
|
+
done: "はじめる",
|
|
1632
|
+
restart: "ガイドをもう一度表示",
|
|
1633
|
+
stepOf: (current, total) => `ステップ ${current} / ${total}`
|
|
1634
|
+
},
|
|
1635
|
+
ko: {
|
|
1636
|
+
title: "빠른 시작",
|
|
1637
|
+
skip: "가이드 건너뛰기",
|
|
1638
|
+
next: "다음",
|
|
1639
|
+
prev: "이전",
|
|
1640
|
+
done: "시작하기",
|
|
1641
|
+
restart: "가이드 다시 보기",
|
|
1642
|
+
stepOf: (current, total) => `${current} / ${total} 단계`
|
|
1643
|
+
},
|
|
1644
|
+
fr: {
|
|
1645
|
+
title: "Démarrage rapide",
|
|
1646
|
+
skip: "Ignorer le guide",
|
|
1647
|
+
next: "Suivant",
|
|
1648
|
+
prev: "Retour",
|
|
1649
|
+
done: "Commencer",
|
|
1650
|
+
restart: "Revoir le guide",
|
|
1651
|
+
stepOf: (current, total) => `Étape ${current} sur ${total}`
|
|
1652
|
+
},
|
|
1653
|
+
de: {
|
|
1654
|
+
title: "Schnellstart",
|
|
1655
|
+
skip: "Anleitung überspringen",
|
|
1656
|
+
next: "Weiter",
|
|
1657
|
+
prev: "Zurück",
|
|
1658
|
+
done: "Loslegen",
|
|
1659
|
+
restart: "Anleitung erneut anzeigen",
|
|
1660
|
+
stepOf: (current, total) => `Schritt ${current} von ${total}`
|
|
1661
|
+
},
|
|
1662
|
+
it: {
|
|
1663
|
+
title: "Avvio rapido",
|
|
1664
|
+
skip: "Salta la guida",
|
|
1665
|
+
next: "Avanti",
|
|
1666
|
+
prev: "Indietro",
|
|
1667
|
+
done: "Inizia",
|
|
1668
|
+
restart: "Rivedi la guida",
|
|
1669
|
+
stepOf: (current, total) => `Passo ${current} di ${total}`
|
|
1670
|
+
},
|
|
1671
|
+
ru: {
|
|
1672
|
+
title: "Быстрый старт",
|
|
1673
|
+
skip: "Пропустить руководство",
|
|
1674
|
+
next: "Далее",
|
|
1675
|
+
prev: "Назад",
|
|
1676
|
+
done: "Начать",
|
|
1677
|
+
restart: "Показать руководство снова",
|
|
1678
|
+
stepOf: (current, total) => `Шаг ${current} из ${total}`
|
|
1679
|
+
},
|
|
1680
|
+
es: {
|
|
1681
|
+
title: "Inicio rápido",
|
|
1682
|
+
skip: "Omitir la guía",
|
|
1683
|
+
next: "Siguiente",
|
|
1684
|
+
prev: "Atrás",
|
|
1685
|
+
done: "Empezar",
|
|
1686
|
+
restart: "Ver la guía de nuevo",
|
|
1687
|
+
stepOf: (current, total) => `Paso ${current} de ${total}`
|
|
1688
|
+
},
|
|
1689
|
+
pt: {
|
|
1690
|
+
title: "Início rápido",
|
|
1691
|
+
skip: "Ignorar o guia",
|
|
1692
|
+
next: "Próximo",
|
|
1693
|
+
prev: "Voltar",
|
|
1694
|
+
done: "Começar",
|
|
1695
|
+
restart: "Ver o guia novamente",
|
|
1696
|
+
stepOf: (current, total) => `Passo ${current} de ${total}`
|
|
1697
|
+
}
|
|
1698
|
+
};
|
|
1699
|
+
/** 语言标签 → 语言码:只认主标签,认不出的落 null(由调用方回退 en)。 */
|
|
1700
|
+
function normalizeGuideLocale(tag) {
|
|
1701
|
+
const primary = tag.toLowerCase().trim().split(/[-_]/)[0] ?? "";
|
|
1702
|
+
return GUIDE_LOCALES.includes(primary) ? primary : null;
|
|
1703
|
+
}
|
|
1704
|
+
function htmlLang() {
|
|
1705
|
+
try {
|
|
1706
|
+
return typeof document === "undefined" ? "" : document.documentElement?.lang ?? "";
|
|
1707
|
+
} catch {
|
|
1708
|
+
return "";
|
|
1709
|
+
}
|
|
1710
|
+
}
|
|
1711
|
+
/**
|
|
1712
|
+
* 当前引导语言:以宿主 `<html lang>` 为准(语言切换会改写这个属性)。
|
|
1713
|
+
*
|
|
1714
|
+
* 认不出 → en:引导是「帮助」面,宁可给英文也不能给空白或中文硬串。
|
|
1715
|
+
*/
|
|
1716
|
+
function currentGuideLocale() {
|
|
1717
|
+
return normalizeGuideLocale(htmlLang()) ?? "en";
|
|
1718
|
+
}
|
|
1719
|
+
/** 引导外壳取词。 */
|
|
1720
|
+
function guideLabels(locale = currentGuideLocale()) {
|
|
1721
|
+
return GUIDE_COPY[locale] ?? GUIDE_COPY.en;
|
|
1722
|
+
}
|
|
1723
|
+
/**
|
|
1724
|
+
* 步骤正文取词:本语 → en → zh → 表里第一个可用。
|
|
1725
|
+
*
|
|
1726
|
+
* 为什么需要回退链:九插件分批补语种,某个插件可能只有 zh/en 而宿主是 ru;
|
|
1727
|
+
* 这时给英文是可用的,给空白等于「引导坏了」。`undefined` 步骤表按空表处理。
|
|
1728
|
+
*/
|
|
1729
|
+
function guideSteps(map) {
|
|
1730
|
+
if (map === void 0) return [];
|
|
1731
|
+
const order = [
|
|
1732
|
+
currentGuideLocale(),
|
|
1733
|
+
"en",
|
|
1734
|
+
"zh"
|
|
1735
|
+
];
|
|
1736
|
+
for (const key of order) {
|
|
1737
|
+
const hit = key === void 0 ? void 0 : map[key];
|
|
1738
|
+
if (hit !== void 0 && hit.length > 0) return hit;
|
|
1739
|
+
}
|
|
1740
|
+
for (const key of GUIDE_LOCALES) {
|
|
1741
|
+
const hit = map[key];
|
|
1742
|
+
if (hit !== void 0 && hit.length > 0) return hit;
|
|
1743
|
+
}
|
|
1744
|
+
return [];
|
|
1745
|
+
}
|
|
1746
|
+
function guideStorageKey(ns) {
|
|
1747
|
+
return `dsh.guide.${ns}.skipped`;
|
|
1748
|
+
}
|
|
1749
|
+
/** 是否已跳过(存储不可用时按「未跳过」处理:宁可多教一次,不要静默不教)。 */
|
|
1750
|
+
function isGuideSkipped(ns) {
|
|
1751
|
+
try {
|
|
1752
|
+
return typeof localStorage !== "undefined" && localStorage.getItem(guideStorageKey(ns)) === "1";
|
|
1753
|
+
} catch {
|
|
1754
|
+
return false;
|
|
1755
|
+
}
|
|
1756
|
+
}
|
|
1757
|
+
/** 记下跳过;写失败不抛(隐私模式 / 存储禁用)。 */
|
|
1758
|
+
function skipGuide(ns) {
|
|
1759
|
+
try {
|
|
1760
|
+
localStorage?.setItem(guideStorageKey(ns), "1");
|
|
1761
|
+
} catch {}
|
|
1762
|
+
}
|
|
1763
|
+
/** 清标记 = 允许重新教学。 */
|
|
1764
|
+
function resetGuide(ns) {
|
|
1765
|
+
try {
|
|
1766
|
+
localStorage?.removeItem(guideStorageKey(ns));
|
|
1767
|
+
} catch {}
|
|
1768
|
+
}
|
|
1769
|
+
const GUIDE_CSS = `
|
|
1770
|
+
.sgGuide{border:1px solid var(--dsw-alias-border-l2, rgba(127,127,127,.28));background:var(--dsw-alias-bg-layer-2, rgba(127,127,127,.06));border-radius:12px;padding:14px 16px;margin:0 0 12px}
|
|
1771
|
+
.sgGuideHead{display:flex;align-items:center;gap:8px;margin:0 0 10px}
|
|
1772
|
+
.sgGuideTitle{font-size:14px;font-weight:600;color:var(--dsw-alias-label-primary, currentColor)}
|
|
1773
|
+
.sgGuideStep{font-size:12px;color:var(--dsw-alias-label-tertiary, rgba(127,127,127,.9));margin-left:auto}
|
|
1774
|
+
.sgGuideBody{font-size:13px;line-height:1.6;color:var(--dsw-alias-label-secondary, currentColor);min-height:52px}
|
|
1775
|
+
.sgGuideBody b{color:var(--dsw-alias-label-primary, currentColor);font-weight:600}
|
|
1776
|
+
.sgGuideDots{display:flex;gap:6px;margin:10px 0 0}
|
|
1777
|
+
.sgGuideDot{width:6px;height:6px;border-radius:50%;background:var(--dsw-alias-border-l2, rgba(127,127,127,.3))}
|
|
1778
|
+
.sgGuideDot-on{background:var(--dsw-alias-button-primary-fill, #4d6bfe)}
|
|
1779
|
+
.sgGuideFoot{display:flex;align-items:center;gap:8px;margin:12px 0 0}
|
|
1780
|
+
.sgGuideBtn{appearance:none;font:inherit;font-size:12px;padding:5px 12px;border-radius:8px;border:1px solid var(--dsw-alias-border-l2, rgba(127,127,127,.3));background:transparent;color:var(--dsw-alias-label-primary, currentColor);cursor:pointer}
|
|
1781
|
+
.sgGuideBtn-primary{background:var(--dsw-alias-button-primary-fill, #4d6bfe);border-color:transparent;color:#fff}
|
|
1782
|
+
.sgGuideBtn-skip{margin-right:auto;color:var(--dsw-alias-label-tertiary, rgba(127,127,127,.9));border-color:transparent;text-decoration:underline}
|
|
1783
|
+
.sgGuideRestart{appearance:none;font:inherit;font-size:12px;padding:0;border:0;background:transparent;color:var(--dsw-alias-link-primary, #4d6bfe);cursor:pointer;text-decoration:underline}
|
|
1784
|
+
`;
|
|
1785
|
+
function injectGuideCss() {
|
|
1786
|
+
try {
|
|
1787
|
+
if (typeof document === "undefined") return;
|
|
1788
|
+
if (typeof document.querySelector !== "function") return;
|
|
1789
|
+
if (typeof document.createElement !== "function") return;
|
|
1790
|
+
if (!document.head) return;
|
|
1791
|
+
if (document.querySelector("style[data-plugin-css=\"guide-kit\"]") !== null) return;
|
|
1792
|
+
const tag = document.createElement("style");
|
|
1793
|
+
tag.dataset.pluginCss = "guide-kit";
|
|
1794
|
+
tag.textContent = GUIDE_CSS;
|
|
1795
|
+
document.head.appendChild(tag);
|
|
1796
|
+
} catch {}
|
|
1797
|
+
}
|
|
1798
|
+
/** 语言变更订阅:语言切换后重渲染词表(引导是短生命周期,直接跟随 <html lang>)。 */
|
|
1799
|
+
function useLangTick() {
|
|
1800
|
+
const [, setTick] = (0, react.useState)(0);
|
|
1801
|
+
(0, react.useEffect)(() => {
|
|
1802
|
+
try {
|
|
1803
|
+
if (typeof MutationObserver === "undefined" || typeof document === "undefined") return;
|
|
1804
|
+
if (!document.documentElement) return;
|
|
1805
|
+
const observer = new MutationObserver(() => setTick((n) => n + 1));
|
|
1806
|
+
observer.observe(document.documentElement, {
|
|
1807
|
+
attributes: true,
|
|
1808
|
+
attributeFilter: ["lang"]
|
|
1809
|
+
});
|
|
1810
|
+
return () => observer.disconnect();
|
|
1811
|
+
} catch {
|
|
1812
|
+
return;
|
|
1813
|
+
}
|
|
1814
|
+
}, []);
|
|
1815
|
+
}
|
|
1816
|
+
/**
|
|
1817
|
+
* 引导主体:≤10 步的小教学(惯例:末条讲「用量端点」贴士)+ 恒定可见的 Skip。
|
|
1818
|
+
*
|
|
1819
|
+
* `onClose` 由宿主卡面传:Skip/Done 都会调用它(Skip 同时写标记)。
|
|
1820
|
+
*/
|
|
1821
|
+
function GuidePanel(props) {
|
|
1822
|
+
const { ns, steps, onClose } = props;
|
|
1823
|
+
const [index, setIndex] = (0, react.useState)(0);
|
|
1824
|
+
useLangTick();
|
|
1825
|
+
const labels = guideLabels();
|
|
1826
|
+
(0, react.useEffect)(() => {
|
|
1827
|
+
injectGuideCss();
|
|
1828
|
+
}, []);
|
|
1829
|
+
if (steps.length === 0) return null;
|
|
1830
|
+
const current = steps[Math.min(index, steps.length - 1)];
|
|
1831
|
+
const last = index >= steps.length - 1;
|
|
1832
|
+
const finish = () => {
|
|
1833
|
+
skipGuide(ns);
|
|
1834
|
+
onClose();
|
|
1835
|
+
};
|
|
1836
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
1837
|
+
className: "sgGuide",
|
|
1838
|
+
"aria-label": labels.title,
|
|
1839
|
+
children: [
|
|
1840
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("header", {
|
|
1841
|
+
className: "sgGuideHead",
|
|
1842
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1843
|
+
className: "sgGuideTitle",
|
|
1844
|
+
children: labels.title
|
|
1845
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1846
|
+
className: "sgGuideStep",
|
|
1847
|
+
children: labels.stepOf(index + 1, steps.length)
|
|
1848
|
+
})]
|
|
1849
|
+
}),
|
|
1850
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1851
|
+
className: "sgGuideBody",
|
|
1852
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("b", { children: current.title }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { children: current.body })]
|
|
1853
|
+
}),
|
|
1854
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1855
|
+
className: "sgGuideDots",
|
|
1856
|
+
"aria-hidden": "true",
|
|
1857
|
+
children: steps.map((step, i) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: "sgGuideDot" + (i === index ? " sgGuideDot-on" : "") }, step.title))
|
|
1858
|
+
}),
|
|
1859
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("footer", {
|
|
1860
|
+
className: "sgGuideFoot",
|
|
1861
|
+
children: [
|
|
1862
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
1863
|
+
type: "button",
|
|
1864
|
+
className: "sgGuideBtn sgGuideBtn-skip",
|
|
1865
|
+
onClick: () => finish(),
|
|
1866
|
+
children: labels.skip
|
|
1867
|
+
}),
|
|
1868
|
+
index > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
1869
|
+
type: "button",
|
|
1870
|
+
className: "sgGuideBtn",
|
|
1871
|
+
onClick: () => setIndex(index - 1),
|
|
1872
|
+
children: labels.prev
|
|
1873
|
+
}),
|
|
1874
|
+
last ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
1875
|
+
type: "button",
|
|
1876
|
+
className: "sgGuideBtn sgGuideBtn-primary",
|
|
1877
|
+
onClick: () => finish(),
|
|
1878
|
+
children: labels.done
|
|
1879
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
1880
|
+
type: "button",
|
|
1881
|
+
className: "sgGuideBtn sgGuideBtn-primary",
|
|
1882
|
+
onClick: () => setIndex(index + 1),
|
|
1883
|
+
children: labels.next
|
|
1884
|
+
})
|
|
1885
|
+
]
|
|
1886
|
+
})
|
|
1887
|
+
]
|
|
1888
|
+
});
|
|
1889
|
+
}
|
|
1890
|
+
/**
|
|
1891
|
+
* 重启入口:清标记 + 就地重开引导。
|
|
1892
|
+
*
|
|
1893
|
+
* 统一件,避免九插件各写一份(措辞/样式/清标记时机容易走样)。跳过之后
|
|
1894
|
+
* 用户想再看一次,不需要去清浏览器存储。
|
|
1895
|
+
*/
|
|
1896
|
+
function GuideRestartButton(props) {
|
|
1897
|
+
const { ns, onOpen, style } = props;
|
|
1898
|
+
useLangTick();
|
|
1899
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
1900
|
+
type: "button",
|
|
1901
|
+
className: "sgGuideRestart",
|
|
1902
|
+
style,
|
|
1903
|
+
onClick: () => {
|
|
1904
|
+
resetGuide(ns);
|
|
1905
|
+
onOpen();
|
|
1906
|
+
},
|
|
1907
|
+
children: guideLabels().restart
|
|
1908
|
+
});
|
|
1909
|
+
}
|
|
1910
|
+
//#endregion
|
|
1911
|
+
//#region src/client/guide-steps.ts
|
|
1912
|
+
const CCI_GUIDE_STEPS = {
|
|
1913
|
+
zh: [
|
|
1914
|
+
{
|
|
1915
|
+
title: "先选 Profile,再看正交开关",
|
|
1916
|
+
body: "设置 → 上下文压缩选择器,上方卡片就是压缩档位(平衡模式/节省模式/PTC 模式(绝对水位)等),点一下即改即存。下面的代码骨架压缩、轮尾沉降、回合末意图摘要属于档位之外的正交开关(默认关),Auto Compact 触发水位才是随档位联动的参数。"
|
|
1917
|
+
},
|
|
1918
|
+
{
|
|
1919
|
+
title: "只对新会话生效,沉降还会撤下原消息",
|
|
1920
|
+
body: "运行时首次观察某个会话时就冻结策略,改完当前会话没反应不是保存失败——开新会话才用新档位;只有出现「保存失败,请重试」才是真失败。开启轮尾沉降后,该轮工具调用区间被一张沉降卡替换,原消息会从对话视图撤出(原文仍在会话日志,可用卡里的序号回捞)。"
|
|
1921
|
+
},
|
|
1922
|
+
{
|
|
1923
|
+
title: "看节省去悬浮面板,先分清口径",
|
|
1924
|
+
body: "在设置里打开「悬浮面板」,输入区旁出现可拖拽的悬浮球,点开是压缩监控:净节省、毛节省、负节省(压缩后再读全文的抵消)、缓存命中率与成本估算。设置页底部的「节省统计(本进程)」在首次裁剪前是空的;标注「持久化降级」说明统计只留在内存。"
|
|
1925
|
+
},
|
|
1926
|
+
{
|
|
1927
|
+
title: "压缩与折叠走本地直连端点",
|
|
1928
|
+
body: "两处都能单独指定模型:设置页的「估计器(可选)」(仅「TokenPilot 启发模式」提供)把「通道」选成「直连 OpenAI 兼容端点」,填端点地址(/v1)与一个小模型;轮尾折叠的两层端点(高吞吐档吃 ≤2K 输入、稳定档吃 2~8K,如本地 35B)在配置里写 `sediment.foldMode: direct` 加 `foldBaseUrl` / `foldStrata*` / `foldLocal35*`。停在「宿主模型」时,压缩与对话共用同一个 provider/model,每轮裁剪都在吃对话 token。"
|
|
1929
|
+
}
|
|
1930
|
+
],
|
|
1931
|
+
en: [
|
|
1932
|
+
{
|
|
1933
|
+
title: "Pick a profile first, then the orthogonal switches",
|
|
1934
|
+
body: "Settings → Context compression selector: the cards at the top are the profiles (Balanced, Savings, PTC / Code-mode (absolute), …); a click applies and saves. Code skeleton compression, turn-tail sedimentation, and turn-tail intent summary below are orthogonal switches outside the profile (off by default), while the Auto Compact trigger level is the one parameter that follows the profile."
|
|
1935
|
+
},
|
|
1936
|
+
{
|
|
1937
|
+
title: "New sessions only — and sedimentation pulls originals out of view",
|
|
1938
|
+
body: "A session freezes its policy the first time the runtime observes it, so no visible change in the current session is not a failed save — open a new session; only “Save failed” means the save really failed. With turn-tail sedimentation on, each turn’s tool-call span becomes one sediment card and the replaced messages leave the transcript view (originals stay in the session log and can be retrieved by the card’s sequence numbers)."
|
|
1939
|
+
},
|
|
1940
|
+
{
|
|
1941
|
+
title: "Read savings in the monitor, mind the basis",
|
|
1942
|
+
body: "Turn on “Floating panel” in settings and a draggable ball appears next to the composer; it opens the compression monitor with net Δ, gross Δ, offsets (full reads after compression), cache hit rate, and cost estimates. The “Savings (this process)” card at the bottom of Settings stays empty until the first trim; a “persistence degraded” note means the numbers live in memory only."
|
|
1943
|
+
},
|
|
1944
|
+
{
|
|
1945
|
+
title: "Route compression and folding to local direct endpoints",
|
|
1946
|
+
body: "Two places take an explicit model: the Estimator block in settings (offered only under the TokenPilot-inspired profile) — set Channel to “Direct OpenAI-compatible endpoint” with a /v1 base URL and a small model; and the two turn-tail folding tiers (a high-throughput tier for inputs ≤2K, a stable tier such as local 35B for 2–8K), configured as sediment.foldMode: direct with foldBaseUrl / foldStrata* / foldLocal35*. Left on “Host model”, summarisation shares one provider/model with the conversation, so every trim spends conversation tokens."
|
|
1947
|
+
}
|
|
1948
|
+
]
|
|
1949
|
+
};
|
|
1950
|
+
//#endregion
|
|
1568
1951
|
//#region src/client/settings-section.tsx
|
|
1569
1952
|
/**
|
|
1570
1953
|
* Full-page Settings surface backed by the same durable selector state.
|
|
@@ -1583,6 +1966,7 @@ window.__ModuleLoader__.load({
|
|
|
1583
1966
|
const [saveError, setSaveError] = (0, react.useState)(null);
|
|
1584
1967
|
const [draft, setDraft] = (0, react.useState)(null);
|
|
1585
1968
|
const [ptcDraft, setPtcDraft] = (0, react.useState)(null);
|
|
1969
|
+
const [guideOpen, setGuideOpen] = (0, react.useState)(() => !isGuideSkipped("context-compression"));
|
|
1586
1970
|
const current = state.value?.profile ?? "balanced";
|
|
1587
1971
|
(0, react.useEffect)(() => {
|
|
1588
1972
|
const custom = state.value?.custom;
|
|
@@ -1626,6 +2010,22 @@ window.__ModuleLoader__.load({
|
|
|
1626
2010
|
className: _dsh_context_compression_css_466eb745356d_CompressionProfileSelector_module_css_default.settingsDescription,
|
|
1627
2011
|
children: t("settings.description")
|
|
1628
2012
|
}),
|
|
2013
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
2014
|
+
style: { margin: "0 0 10px" },
|
|
2015
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(GuideRestartButton, {
|
|
2016
|
+
ns: "context-compression",
|
|
2017
|
+
onOpen: () => {
|
|
2018
|
+
setGuideOpen(true);
|
|
2019
|
+
}
|
|
2020
|
+
})
|
|
2021
|
+
}),
|
|
2022
|
+
guideOpen && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(GuidePanel, {
|
|
2023
|
+
ns: "context-compression",
|
|
2024
|
+
steps: guideSteps(CCI_GUIDE_STEPS),
|
|
2025
|
+
onClose: () => {
|
|
2026
|
+
setGuideOpen(false);
|
|
2027
|
+
}
|
|
2028
|
+
}),
|
|
1629
2029
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1630
2030
|
className: _dsh_context_compression_css_466eb745356d_CompressionProfileSelector_module_css_default.profileGrid,
|
|
1631
2031
|
"aria-label": t("label"),
|