dsh-context-compression-improved 0.6.5 → 0.7.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/.github/workflows/ci.yml +39 -39
  2. package/CHANGELOG.ja.md +217 -211
  3. package/CHANGELOG.ko.md +211 -205
  4. package/CHANGELOG.md +392 -350
  5. package/CHANGELOG.zh.md +196 -190
  6. package/README.md +97 -96
  7. package/README.zh.md +86 -85
  8. package/eslint.config.js +76 -30
  9. package/package.json +3 -1
  10. package/packages/selector/dsh.plugin.json +1 -1
  11. package/packages/selector/lib/client.js +747 -3
  12. package/packages/selector/lib/index.js +92 -1
  13. package/packages/selector/lib/{advisor-state.js → intent-gate.js} +91 -3
  14. package/packages/selector/lib/profiles.d.ts +9 -0
  15. package/packages/selector/lib/pruner.d.ts +59 -0
  16. package/packages/selector/lib/pruner.js +410 -8
  17. package/packages/selector/src/client/decode.ts +53 -49
  18. package/packages/selector/src/client/index.ts +30 -0
  19. package/packages/selector/src/client/locales/de.ts +98 -0
  20. package/packages/selector/src/client/locales/es.ts +98 -0
  21. package/packages/selector/src/client/locales/fr.ts +98 -0
  22. package/packages/selector/src/client/locales/it.ts +98 -0
  23. package/packages/selector/src/client/locales/ja.ts +98 -0
  24. package/packages/selector/src/client/locales/ko.ts +98 -0
  25. package/packages/selector/src/client/locales/ru.ts +98 -0
  26. package/packages/selector/src/deepseek-v4-tokenizer.ts +205 -205
  27. package/packages/selector/src/index.ts +418 -411
  28. package/packages/selector/src/preset-overlay.ts +629 -626
  29. package/packages/selector/src/profiles.ts +414 -394
  30. package/packages/selector/src/pruner/content.ts +198 -198
  31. package/packages/selector/src/pruner/state.ts +57 -50
  32. package/packages/selector/src/pruner.ts +2665 -2421
  33. package/packages/selector/src/runtime/audit.ts +303 -286
  34. package/packages/selector/src/runtime/config.ts +731 -706
  35. package/packages/selector/src/runtime/reducers.ts +1674 -1674
  36. package/packages/selector/src/runtime/summary-command.ts +133 -0
  37. package/packages/selector/src/runtime/tokenpilot/advisor-prompt.ts +233 -188
  38. package/packages/selector/src/runtime/tokenpilot/advisor-state.ts +204 -149
  39. package/packages/selector/src/runtime/tokenpilot/intent-fold.ts +53 -0
  40. package/packages/selector/src/runtime/tokenpilot/intent-gate.ts +65 -0
  41. package/packages/selector/src/runtime/tokenpilot/intent-input-mask.ts +125 -0
  42. package/packages/selector/src/runtime/tokenpilot/intent-range.ts +37 -0
  43. package/packages/selector/src/runtime/tokenpilot/locator.ts +128 -128
  44. package/packages/selector/src/runtime/tokenpilot/sidechannel.ts +306 -303
  45. package/packages/selector/src/runtime/types.ts +358 -346
  46. package/packages/selector/tests/auto-compact.client.spec.tsx +214 -213
  47. package/packages/selector/tests/built/client-artifact.spec.ts +61 -59
  48. package/packages/selector/tests/code-skeleton.client.spec.ts +94 -93
  49. package/packages/selector/tests/custom-contract.client.spec.ts +223 -222
  50. package/packages/selector/tests/estimator-channel.client.spec.tsx +252 -252
  51. package/packages/selector/tests/preset-options-write.client.spec.ts +188 -187
  52. package/packages/selector/tests/profiles.client.spec.tsx +436 -434
  53. package/packages/selector/tests/runtime/audit.spec.ts +275 -274
  54. package/packages/selector/tests/runtime/auto-compact-config.spec.ts +523 -523
  55. package/packages/selector/tests/runtime/deepseek-v4-tokenizer.spec.ts +122 -122
  56. package/packages/selector/tests/runtime/intent-gate.spec.ts +62 -0
  57. package/packages/selector/tests/runtime/intent-summary.spec.ts +156 -0
  58. package/packages/selector/tests/runtime/public/public-runtime.spec.ts +5 -0
  59. package/packages/selector/tests/runtime/summary-command.spec.ts +154 -0
  60. package/packages/selector/tests/standing-generation.host.spec.ts +15 -35
  61. package/scripts/packed-components-smoke.mjs +734 -732
  62. package/scripts/packed-install-e2e.mjs +1275 -1273
  63. package/scripts/verify-release.mjs +318 -317
  64. package/tests/TEST_INVENTORY.md +41 -41
  65. package/tsconfig.tests.json +17 -15
  66. package/vitest.config.ts +57 -43
  67. package/.agents-stash-064.patch +0 -39
  68. package/_dsh_devdeps.json +0 -50
  69. package/_verify064/package/package.json +0 -162
  70. package/_verify064/package/packages/selector/src/client/index.ts +0 -232
@@ -423,42 +423,22 @@ describe('real AgentPresets standing generations with the overlay threshold', ()
423
423
  expect(files.length).toBeGreaterThanOrEqual(3)
424
424
  const buckets = await Promise.all(files.map(async file => Math.floor((await stat(file.path)).mtimeMs / 1000)))
425
425
  expect(new Set(buckets).size).toBe(buckets.length)
426
- // No staging leftovers survive a publish. A spec file running in parallel
427
- // disposes its own store while this scan runs, so a vanished directory means
428
- // "no leftovers to find" rather than a failure (mirrors overlayFiles).
429
- // No staging leftovers survive a publish. Scan only this test's own store,
430
- // identified by its latest source marker: a concurrently running spec's
431
- // store may legitimately hold .tmp staging while this scan runs, and a
432
- // vanished directory means "no leftovers to find" (mirrors overlayFiles).
433
- const storeDirs = await Promise.all(
434
- (await readdir(tmpdir(), { withFileTypes: true }))
435
- .filter(entry => entry.isDirectory() && entry.name.startsWith('dsh-context-compression-presets-'))
436
- .map(async entry => {
437
- const directory = join(tmpdir(), entry.name)
438
- try {
439
- return { directory, entries: await readdir(directory) }
440
- } catch {
441
- return { directory: '', entries: [] as string[] }
442
- }
443
- }),
444
- )
445
- const ownStores: string[] = []
446
- await Promise.all(storeDirs.map(async ({ directory, entries }) => {
447
- if (directory === '') return
448
- for (const name of entries) {
449
- if (!name.startsWith('standard-') || !name.endsWith('.agent.cordis.yml')) continue
450
- try {
451
- const rendered = await readFile(join(directory, name), 'utf8')
452
- if (rendered.includes('marker-00000wil.mjs')) {
453
- ownStores.push(directory)
454
- return
455
- }
456
- } catch { /* a concurrent spec disposed its store mid-scan */ }
426
+ // No staging leftovers survive a publish. Scope the scan to the store
427
+ // directories this test's own overlays were published into: the shared
428
+ // tmpdir also holds stores from concurrent spec files mid-publish and from
429
+ // earlier crashed runs, whose stale `.tmp` entries say nothing about this
430
+ // publish (a vanished directory still means "no leftovers to find").
431
+ const ownStoreDirs = [...new Set(files.map(file => dirname(file.path)))]
432
+ const leftovers: string[] = []
433
+ for (const directory of ownStoreDirs) {
434
+ let children: string[]
435
+ try {
436
+ children = await readdir(directory)
437
+ } catch {
438
+ continue
457
439
  }
458
- }))
459
- const leftovers = (await Promise.all(ownStores.map(directory => readdir(directory))))
460
- .flat()
461
- .filter(name => name.endsWith('.tmp'))
440
+ leftovers.push(...children.filter(name => name.endsWith('.tmp')))
441
+ }
462
442
  expect(leftovers).toEqual([])
463
443
 
464
444
  await bundle.dispose()