dsh-context-compression-improved 0.6.4 → 0.7.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/CHANGELOG.ja.md +51 -0
  2. package/CHANGELOG.ko.md +47 -0
  3. package/CHANGELOG.md +72 -0
  4. package/CHANGELOG.zh.md +47 -0
  5. package/README.ja.md +2 -2
  6. package/README.ko.md +2 -2
  7. package/README.md +6 -3
  8. package/README.zh.md +3 -2
  9. package/eslint.config.js +76 -30
  10. package/package.json +164 -162
  11. package/packages/selector/dsh.plugin.json +16 -16
  12. package/packages/selector/lib/client.js +16 -4
  13. package/packages/selector/lib/index.js +92 -1
  14. package/packages/selector/lib/{advisor-state.js → intent-gate.js} +91 -3
  15. package/packages/selector/lib/profiles.d.ts +9 -0
  16. package/packages/selector/lib/pruner.d.ts +59 -0
  17. package/packages/selector/lib/pruner.js +410 -8
  18. package/packages/selector/package.json +114 -114
  19. package/packages/selector/src/client/decode.ts +6 -2
  20. package/packages/selector/src/client/index.ts +213 -232
  21. package/packages/selector/src/client/scope-face.ts +24 -24
  22. package/packages/selector/src/deepseek-v4-tokenizer.ts +1 -1
  23. package/packages/selector/src/index.ts +418 -412
  24. package/packages/selector/src/preset-overlay.ts +3 -0
  25. package/packages/selector/src/profiles.ts +30 -10
  26. package/packages/selector/src/pruner/content.ts +1 -1
  27. package/packages/selector/src/pruner/state.ts +7 -0
  28. package/packages/selector/src/pruner.ts +253 -10
  29. package/packages/selector/src/runtime/audit.ts +17 -0
  30. package/packages/selector/src/runtime/config.ts +36 -11
  31. package/packages/selector/src/runtime/reducers.ts +1 -1
  32. package/packages/selector/src/runtime/summary-command.ts +133 -0
  33. package/packages/selector/src/runtime/tokenpilot/advisor-prompt.ts +46 -1
  34. package/packages/selector/src/runtime/tokenpilot/advisor-state.ts +55 -0
  35. package/packages/selector/src/runtime/tokenpilot/intent-fold.ts +53 -0
  36. package/packages/selector/src/runtime/tokenpilot/intent-gate.ts +65 -0
  37. package/packages/selector/src/runtime/tokenpilot/intent-input-mask.ts +125 -0
  38. package/packages/selector/src/runtime/tokenpilot/intent-range.ts +37 -0
  39. package/packages/selector/src/runtime/tokenpilot/locator.ts +2 -2
  40. package/packages/selector/src/runtime/tokenpilot/sidechannel.ts +4 -1
  41. package/packages/selector/src/runtime/types.ts +12 -0
  42. package/packages/selector/tests/auto-compact.client.spec.tsx +214 -213
  43. package/packages/selector/tests/built/client-artifact.spec.ts +2 -0
  44. package/packages/selector/tests/code-skeleton.client.spec.ts +94 -93
  45. package/packages/selector/tests/custom-contract.client.spec.ts +3 -2
  46. package/packages/selector/tests/estimator-channel.client.spec.tsx +252 -252
  47. package/packages/selector/tests/helpers/legacy-namespace.ts +8 -4
  48. package/packages/selector/tests/helpers/legacy-settings/index.ts +15 -0
  49. package/packages/selector/tests/helpers/legacy-settings/legacy/provider.d.ts +41 -0
  50. package/packages/selector/tests/helpers/legacy-settings/legacy/provider.js +647 -0
  51. package/packages/selector/tests/helpers/legacy-settings/legacy/redact.js +78 -0
  52. package/packages/selector/tests/helpers/legacy-settings/legacy/util-values.js +234 -0
  53. package/packages/selector/tests/host-preset-overlay.host.spec.ts +204 -206
  54. package/packages/selector/tests/preset-options-write.client.spec.ts +188 -187
  55. package/packages/selector/tests/preset-overlay-loader.e2e.host.spec.ts +200 -206
  56. package/packages/selector/tests/profiles.client.spec.tsx +436 -434
  57. package/packages/selector/tests/public/package-contract.client.spec.ts +78 -78
  58. package/packages/selector/tests/runtime/advice-never-withholds.host.spec.ts +230 -233
  59. package/packages/selector/tests/runtime/audit.spec.ts +275 -274
  60. package/packages/selector/tests/runtime/auto-compact-config.spec.ts +3 -3
  61. package/packages/selector/tests/runtime/deepseek-v4-tokenizer.spec.ts +4 -4
  62. package/packages/selector/tests/runtime/intent-gate.spec.ts +62 -0
  63. package/packages/selector/tests/runtime/intent-summary.spec.ts +156 -0
  64. package/packages/selector/tests/runtime/public/public-runtime.spec.ts +2736 -2727
  65. package/packages/selector/tests/runtime/summary-command.spec.ts +154 -0
  66. package/packages/selector/tests/settings-seat.client.spec.ts +165 -165
  67. package/packages/selector/tests/standing-generation.host.spec.ts +704 -704
  68. package/packages/selector/tests/subagent-cache-reuse.host.spec.ts +18 -2
  69. package/packages/selector/tests/support/ui-primitives.tsx +34 -34
  70. package/pnpm-workspace.yaml +1 -1
  71. package/scripts/packed-components-smoke.mjs +2 -0
  72. package/scripts/packed-install-e2e.mjs +1275 -1273
  73. package/scripts/verify-release.mjs +318 -317
  74. package/tsconfig.tests.json +3 -1
  75. package/vitest.config.ts +14 -0
@@ -4,7 +4,8 @@ import { Context } from '@deepseek-ai/cordis'
4
4
  import AgentLoop from '@deepseek-ai/dsh-agent-loop'
5
5
  import { mountAgentLoopTestDependencies } from '@deepseek-ai/dsh-agent-loop-testkit'
6
6
  import { createUserMessage, type GenerateOptions } from '@deepseek-ai/dsh-llm'
7
- import * as LlmDeepSeek from '@deepseek-ai/dsh-llm-deepseek'
7
+ import { getOrCreateAnonymousUserId } from '@deepseek-ai/dsh-anonymous-user-id'
8
+ import { DeepSeekAdapter, resolveAdapterOptions } from '@deepseek-ai/dsh-llm-deepseek'
8
9
  import { SessionId } from '@deepseek-ai/dsh-session'
9
10
  import SubagentRuntime from '@deepseek-ai/dsh-subagent'
10
11
  import * as Fork from '@deepseek-ai/dsh-subagent-fork-in-process'
@@ -56,7 +57,22 @@ async function liveHarness(requests: Map<string, GenerateOptions[]>): Promise<Co
56
57
  await created.plugin(SubagentRuntime).await()
57
58
  await created.plugin(Fork).await()
58
59
  await created.plugin(Spawn).await()
59
- await created.plugin(LlmDeepSeek).await()
60
+ // 0.1.7 dropped the llm-deepseek self-contained plugin: register the live
61
+ // provider the way the host does (registerDeepSeekProvider minus its
62
+ // settings-form policy, which no test harness mounts). The block stays
63
+ // gated on DEEPSEEK_API_KEY and the credential comes from the environment.
64
+ created.llm.registerAdapter(['deepseek-official'], new DeepSeekAdapter({
65
+ options: () => resolveAdapterOptions({}, undefined),
66
+ resolveAuth: async () => {
67
+ const apiKey = process.env.DEEPSEEK_API_KEY
68
+ if (apiKey === undefined || apiKey.length === 0) {
69
+ throw new Error('liveHarness: DEEPSEEK_API_KEY is not set')
70
+ }
71
+ return { headers: { authorization: `Bearer ${apiKey}` } }
72
+ },
73
+ resolveUserId: () => getOrCreateAnonymousUserId(),
74
+ prepareExtensions: () => Promise.resolve({ fields: {}, accept: () => Promise.resolve() }),
75
+ }))
60
76
  created.on('llm/stream', (options, next) => {
61
77
  const sessionId = String(options.sessionId)
62
78
  requests.set(sessionId, [...(requests.get(sessionId) ?? []), options])
@@ -1,34 +1,34 @@
1
- import type { ReactNode } from 'react'
2
-
3
- interface MenuItem {
4
- id: string
5
- label: ReactNode
6
- }
7
-
8
- interface MenuProps {
9
- anchor: ReactNode
10
- items: readonly MenuItem[]
11
- onSelect: (id: string) => void
12
- open: boolean
13
- }
14
-
15
- export function IconChevronDownOutlineMedium({ className }: { className?: string }) {
16
- return <span aria-hidden="true" className={className}>⌄</span>
17
- }
18
-
19
- export function Menu({ anchor, items, onSelect, open }: MenuProps) {
20
- return (
21
- <>
22
- {anchor}
23
- {open ? (
24
- <div role="menu">
25
- {items.map(item => (
26
- <button key={item.id} role="menuitem" type="button" onClick={() => { onSelect(item.id) }}>
27
- {item.label}
28
- </button>
29
- ))}
30
- </div>
31
- ) : null}
32
- </>
33
- )
34
- }
1
+ import type { ReactNode } from 'react'
2
+
3
+ interface MenuItem {
4
+ id: string
5
+ label: ReactNode
6
+ }
7
+
8
+ interface MenuProps {
9
+ anchor: ReactNode
10
+ items: readonly MenuItem[]
11
+ onSelect: (id: string) => void
12
+ open: boolean
13
+ }
14
+
15
+ export function IconChevronDownOutlineMedium({ className }: { className?: string }) {
16
+ return <span aria-hidden="true" className={className}>⌄</span>
17
+ }
18
+
19
+ export function Menu({ anchor, items, onSelect, open }: MenuProps) {
20
+ return (
21
+ <>
22
+ {anchor}
23
+ {open ? (
24
+ <div role="menu">
25
+ {items.map(item => (
26
+ <button key={item.id} role="menuitem" type="button" onClick={() => { onSelect(item.id) }}>
27
+ {item.label}
28
+ </button>
29
+ ))}
30
+ </div>
31
+ ) : null}
32
+ </>
33
+ )
34
+ }
@@ -18,7 +18,7 @@ overrides:
18
18
  '@deepseek-ai/cordis-plugin-loader': '1.0.2'
19
19
  '@deepseek-ai/dsh-agent': '0.1.7-rc.2'
20
20
  '@deepseek-ai/dsh-agent-loop': '0.1.7-rc.2'
21
- '@deepseek-ai/dsh-agent-loop-testkit': '0.1.7-rc.1'
21
+ '@deepseek-ai/dsh-agent-loop-testkit': '0.1.7-rc.2'
22
22
  '@deepseek-ai/dsh-agent-presets': '0.1.6-alpha.2'
23
23
  '@deepseek-ai/dsh-client-locale': '0.1.7-rc.2'
24
24
  '@deepseek-ai/dsh-client-ui-primitives': '0.1.7-rc.2'
@@ -71,6 +71,8 @@ class NativeSummaryAdapter extends LlmAdapter {
71
71
  })
72
72
  }
73
73
 
74
+ // Async generator shape is required by the llm service contract; no await needed.
75
+ // eslint-disable-next-line @typescript-eslint/require-await
74
76
  async * stream(options) {
75
77
  options.signal?.throwIfAborted()
76
78
  const text = this.responses.shift()