@magic6/dsh-compaction-policy-engine 0.0.0-stage → 0.5.4

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.
@@ -0,0 +1,396 @@
1
+ /**
2
+ * Direct readers for this plugin's operator-editable configuration.
3
+ *
4
+ * Two files can carry the section on this deployment, and they are not
5
+ * equivalent:
6
+ *
7
+ * - `$DSH_HOME/settings.yaml` is what the settings provider reads, but a
8
+ * dsh that ships the profile importer renames it to `settings.yaml.imported`
9
+ * at boot and thereafter it never exists. A watcher pointed only here reads
10
+ * ENOENT forever and reports the composition fallback on every poll, so an
11
+ * operator edit reaches the engine only through a restart.
12
+ * - `<profile>/cordis.patch.yml` is the layer the profile actually loads, and
13
+ * in this deployment it is the file a person edits. Nothing in dsh watches
14
+ * it (its own header says a restart is required), so the engine has to poll
15
+ * it to honour "edit and it takes effect".
16
+ *
17
+ * Both are read, patch file last, because the patch file is the layer that
18
+ * wins when dsh builds the composition. A malformed document is reported and
19
+ * ignored, keeping the previous policy.
20
+ *
21
+ * @module dsh-compaction-policy-engine/settings-file
22
+ */
23
+
24
+ import { readFileSync } from 'node:fs';
25
+ import { join } from 'node:path';
26
+
27
+ /** The settings document this plugin's section lives in. */
28
+ export function settingsFilePath(home = process.env.DSH_HOME ?? join(process.env.HOME ?? '', '.dsh')) {
29
+ return join(home, 'settings.yaml');
30
+ }
31
+
32
+ /**
33
+ * The profile patch layer that carries this plugin's entry, if it is present.
34
+ *
35
+ * Every candidate is derived from `DSH_HOME` (or `HOME`), never hardcoded: a
36
+ * test that redirects `DSH_HOME` to a temp directory must not have the real
37
+ * profile's config read into it, and a hardcoded `/Users/...` path did exactly
38
+ * that — it outranked the redirect and silently replaced every fixture.
39
+ *
40
+ * `DSH_PROFILE` names the profile when dsh exports it; `web` is the profile
41
+ * this deployment uses, and a wrong guess only costs one failed read per
42
+ * second because a missing file means "no patch layer".
43
+ *
44
+ * @param env - the environment to read.
45
+ * @returns absolute path candidates, most specific first.
46
+ */
47
+ export function patchFilePaths(env = process.env) {
48
+ const home = env.DSH_HOME ?? join(env.HOME ?? '', '.dsh');
49
+ const profiles = [];
50
+ if (env.DSH_PROFILE !== undefined && env.DSH_PROFILE !== '') profiles.push(env.DSH_PROFILE);
51
+ if (!profiles.includes('web')) profiles.push('web');
52
+ return profiles.map((profile) => join(home, 'profiles', profile, 'cordis.patch.yml'));
53
+ }
54
+
55
+ /**
56
+ * Loader entry ids that can carry this plugin's config, in priority order.
57
+ *
58
+ * The settings plane exposes `compaction-control-settings`, while older profiles
59
+ * and backups may only expose `compaction-control-host`. The panel and engine
60
+ * must read the same authority, so the first entry with a readable config wins.
61
+ *
62
+ * @type {readonly string[]}
63
+ */
64
+ export const PATCH_ENTRY_IDS = ['compaction-control-settings', 'compaction-control-host'];
65
+
66
+ /**
67
+ * Read this plugin's entry config out of a profile patch document.
68
+ *
69
+ * The patch file is a top-level sequence of loader entries. A candidate entry
70
+ * with a `config:` mapping supplies the policy, and only a fully parsed block is
71
+ * returned — a half-read entry would silently replace the policy with a partial
72
+ * document, which is worse than keeping the last good one.
73
+ *
74
+ * @param text - the whole patch document.
75
+ * @param entryId - one loader entry id, or candidate ids in priority order.
76
+ * @returns the first readable entry's config mapping, or undefined when absent.
77
+ */
78
+ export function readPatchEntryConfig(text, entryId = PATCH_ENTRY_IDS) {
79
+ const entryIds = Array.isArray(entryId) ? entryId : [entryId];
80
+ for (const id of entryIds) {
81
+ const config = readOnePatchEntryConfig(text, id);
82
+ if (config !== undefined) return config;
83
+ }
84
+ return undefined;
85
+ }
86
+
87
+ /**
88
+ * Read one loader entry's config, preserving the original file-order merge.
89
+ *
90
+ * `parseSettingsDocument` is built for a mapping-rooted settings file and
91
+ * rejects a sequence root, which is what a patch file has. Scanning the
92
+ * entry's own block by indentation is both simpler and stricter here: it
93
+ * reads exactly the lines under `- id: <entryId>`, so a second entry that
94
+ * mentions the same key cannot bleed into this one.
95
+ *
96
+ * Every matching entry is collected and merged in file order, later entries
97
+ * winning. One id can legitimately appear more than once: the host-plane
98
+ * entry and a preset-plane entry are separate mounts of the same engine, and
99
+ * the operator restates only what differs. Returning the first match dropped
100
+ * the chain whenever the first mount happened to omit it.
101
+ *
102
+ * @param text - the whole patch document.
103
+ * @param entryId - the loader entry id to read.
104
+ * @returns the merged config mapping, or undefined when absent or unreadable.
105
+ */
106
+ function readOnePatchEntryConfig(text, entryId) {
107
+ const lines = text.split('\n');
108
+ const configs = [];
109
+ let index = 0;
110
+ while (index < lines.length) {
111
+ const line = stripComment(lines[index]);
112
+ index += 1;
113
+ // `stripComment` already removed any `#`-prefixed text, so a commented-out
114
+ // mention of the id can never equal the header below — no separate comment
115
+ // check is needed, and adding one only creates an unreachable branch.
116
+ if (line.trim() !== `- id: ${entryId}`) continue;
117
+ // The item's own keys sit at the indent of `id:` plus two (the `- ` cost).
118
+ const itemIndent = line.length - line.trimStart().length;
119
+ const childIndent = itemIndent + 2;
120
+ let configIndent;
121
+ const configLines = [];
122
+ for (; index < lines.length; index += 1) {
123
+ const raw = lines[index];
124
+ const bare = stripComment(raw);
125
+ if (bare.trim() === '') continue;
126
+ const indent = bare.length - bare.trimStart().length;
127
+ // A `- ` at the item indent starts the next entry.
128
+ if (indent <= itemIndent && bare.trimStart().startsWith('- ')) break;
129
+ if (indent <= itemIndent) break;
130
+ if (configIndent === undefined) {
131
+ // `config:` must be a direct child of the entry, not a nested one.
132
+ // Sibling keys at the same indent (`name:`) are skipped, not fatal.
133
+ if (indent === childIndent && bare.trim() === 'config:') {
134
+ configIndent = indent;
135
+ continue;
136
+ }
137
+ continue;
138
+ }
139
+ // Everything indented under `config:` belongs to it.
140
+ if (indent <= configIndent) break;
141
+ // Re-anchor the block to column zero so the settings parser can read it.
142
+ configLines.push(raw.slice(configIndent + 2));
143
+ }
144
+ if (configLines.length === 0) continue;
145
+ const parsed = parseSettingsDocument(`${configLines.join('\n')}\n`);
146
+ if (parsed === undefined || parsed === null || typeof parsed !== 'object' || Array.isArray(parsed)) continue;
147
+ configs.push(parsed);
148
+ }
149
+ if (configs.length === 0) return undefined;
150
+ // Deep-merge so a later entry's single field does not erase the earlier
151
+ // entry's whole `default` block.
152
+ let merged = configs[0];
153
+ for (const config of configs.slice(1)) merged = mergeConfig(merged, config);
154
+ return merged;
155
+ }
156
+
157
+ /**
158
+ * Recursively merge two config mappings, `override` winning on scalars. Arrays
159
+ * replace rather than concatenate: a fallback chain is ordered, and a later
160
+ * entry states the whole order rather than an increment to it.
161
+ *
162
+ * @param base - the lower-precedence mapping.
163
+ * @param override - the higher-precedence mapping.
164
+ * @returns the merged mapping.
165
+ */
166
+ function mergeConfig(base, override) {
167
+ if (base === null || typeof base !== 'object' || Array.isArray(base)) return override;
168
+ if (override === null || typeof override !== 'object' || Array.isArray(override)) return override;
169
+ const merged = { ...base };
170
+ for (const [key, value] of Object.entries(override)) {
171
+ merged[key] = key in merged ? mergeConfig(merged[key], value) : value;
172
+ }
173
+ return merged;
174
+ }
175
+
176
+ /** Strip an inline `# comment`, respecting single and double quotes. */
177
+ function stripComment(text) {
178
+ let quote = null;
179
+ for (let index = 0; index < text.length; index += 1) {
180
+ const char = text[index];
181
+ if (quote !== null) {
182
+ if (char === quote) quote = null;
183
+ continue;
184
+ }
185
+ if (char === '"' || char === "'") {
186
+ quote = char;
187
+ continue;
188
+ }
189
+ if (char === '#' && (index === 0 || text[index - 1] === ' ' || text[index - 1] === '\t')) {
190
+ return text.slice(0, index);
191
+ }
192
+ }
193
+ return text;
194
+ }
195
+
196
+ /** Parse a scalar the way the settings schema accepts it. */
197
+ function scalar(text) {
198
+ const value = text.trim();
199
+ if (value === '') return undefined;
200
+ if (value === 'true') return true;
201
+ if (value === 'false') return false;
202
+ if (value === 'null' || value === '~') return null;
203
+ if (/^-?\d+(\.\d+)?$/.test(value)) return Number(value);
204
+ if ((value.startsWith('"') && value.endsWith('"')) || (value.startsWith("'") && value.endsWith("'"))) {
205
+ return value.slice(1, -1);
206
+ }
207
+ return value;
208
+ }
209
+
210
+ /**
211
+ * Parse a nested YAML mapping well enough for `settings.yaml`: block mappings,
212
+ * block sequences of mappings, and scalars — no anchors, flow collections, or
213
+ * multi-line scalars, because this plugin controls the document's shape and stays
214
+ * dependency-free.
215
+ */
216
+ export function parseSettingsDocument(text) {
217
+ const root = {};
218
+ /** Stack of `{ indent, container }` for the open block at each depth. */
219
+ const stack = [{ indent: -1, container: root }];
220
+
221
+ for (const rawLine of text.split('\n')) {
222
+ if (rawLine.trim() === '' || rawLine.trimStart().startsWith('#')) continue;
223
+ const withoutComment = stripComment(rawLine);
224
+ if (withoutComment.trim() === '') continue;
225
+ const indent = withoutComment.length - withoutComment.trimStart().length;
226
+ const line = withoutComment.trim();
227
+
228
+ while (stack.length > 1 && indent <= stack[stack.length - 1].indent) stack.pop();
229
+ const parent = stack[stack.length - 1].container;
230
+
231
+ if (line.startsWith('- ')) {
232
+ const frame = stack[stack.length - 1];
233
+ let container = frame.container;
234
+ if (!Array.isArray(container)) {
235
+ // The key was provisionally a mapping (`providers:` / a `models[0]`
236
+ // block); the first `- ` item settles that it is a sequence.
237
+ if (frame.key === undefined || frame.owner === undefined) return undefined;
238
+ container = [];
239
+ frame.owner[frame.key] = container;
240
+ frame.container = container;
241
+ }
242
+ const rest = line.slice(2).trim();
243
+ // A `- key: value` item opens a mapping; a bare `- value` is a scalar
244
+ // item (the fallback chain is a list of `provider/model` strings, and
245
+ // treating every item as a mapping produced `[{}, {}, {}]`).
246
+ const colon = rest.indexOf(': ');
247
+ if (colon === -1 && !rest.endsWith(':')) {
248
+ container.push(scalar(rest));
249
+ continue;
250
+ }
251
+ const item = {};
252
+ container.push(item);
253
+ if (colon !== -1) {
254
+ const key = rest.slice(0, colon).trim();
255
+ const value = scalar(rest.slice(colon + 1));
256
+ if (value !== undefined) item[key] = value;
257
+ stack.push({ indent, container: item });
258
+ }
259
+ continue;
260
+ }
261
+
262
+ const colon = line.indexOf(':');
263
+ if (colon === -1 || Array.isArray(parent)) return undefined;
264
+ const key = line.slice(0, colon).trim();
265
+ const rest = line.slice(colon + 1);
266
+
267
+ if (rest.trim() === '') {
268
+ // Open a block; which one it is is decided by the next line, so a
269
+ // placeholder object is installed and replaced when a sequence starts.
270
+ const block = {};
271
+ parent[key] = block;
272
+ stack.push({ indent, container: block, key, owner: parent });
273
+ continue;
274
+ }
275
+ if (rest.trim() === '|' || rest.trim() === '>') return undefined;
276
+ parent[key] = scalar(rest);
277
+ }
278
+
279
+ return root;
280
+ }
281
+
282
+ /**
283
+ * Read this plugin's section out of a settings document.
284
+ * @param text - the whole settings document.
285
+ * @returns the section, or undefined when absent or unreadable.
286
+ */
287
+ export function readSection(text) {
288
+ const parsed = parseSettingsDocument(text);
289
+ if (parsed === undefined || parsed === null || typeof parsed !== 'object') return undefined;
290
+ const section = parsed['compaction-control'];
291
+ if (section === undefined) return undefined;
292
+ if (typeof section !== 'object' || section === null || Array.isArray(section)) return undefined;
293
+ return section;
294
+ }
295
+
296
+ /**
297
+ * Watch `settings.yaml` and report this plugin's section on every change.
298
+ *
299
+ * The initial read is synchronous, so the gate carries the operator's threshold
300
+ * from the very first step. The poll compares the *parsed section* rather than
301
+ * asking `fs.watchFile` whether the stat changed: `watchFile`'s baseline snapshot
302
+ * is taken asynchronously, so an edit landing before it completes becomes the
303
+ * baseline and is never reported (measured: ~1 run in 3 under load). Content
304
+ * comparison has no baseline to lose; the cost is one small read per second.
305
+ *
306
+ * @param options - `file`, `fallbackSection`, `onSection`, `onError`, `intervalMs`.
307
+ * @returns a disposer that stops watching.
308
+ */
309
+ export function watchSettingsFile(options) {
310
+ const { file, fallbackSection, onSection, onError, intervalMs = 1000 } = options;
311
+ let last = null;
312
+ const read = (initial) => {
313
+ let text;
314
+ try {
315
+ text = readFileSync(file, 'utf8');
316
+ } catch (error) {
317
+ // A missing file is normal (the provider may not have written one yet)
318
+ // and must not take the engine down; any other failure is worth a line.
319
+ if (error?.code !== 'ENOENT') onError?.(error);
320
+ if (initial) onSection(fallbackSection, 'composition');
321
+ return;
322
+ }
323
+ let section;
324
+ try {
325
+ section = readSection(text);
326
+ } catch (error) {
327
+ onError?.(error);
328
+ return;
329
+ }
330
+ if (section === undefined) {
331
+ if (initial) onSection(fallbackSection, 'composition');
332
+ return;
333
+ }
334
+ const serialized = JSON.stringify(section);
335
+ if (serialized === last) return;
336
+ last = serialized;
337
+ onSection(section, 'settings.yaml');
338
+ };
339
+ read(true);
340
+ // `unref` rather than `persistent: false`: a plugin-owned timer must never be
341
+ // the reason the host process (or a test runner) stays alive.
342
+ const timer = setInterval(() => read(false), intervalMs);
343
+ timer.unref?.();
344
+ return () => clearInterval(timer);
345
+ }
346
+
347
+ /**
348
+ * Watch a profile patch file and report this plugin's entry config on change.
349
+ *
350
+ * Same contract and same content-comparison poll as {@link watchSettingsFile},
351
+ * but the source is `cordis.patch.yml` and the extracted value is the entry's
352
+ * `config:` mapping rather than a `compaction-control:` section. This is the
353
+ * source that actually feeds the composition in a dsh that ships the profile
354
+ * importer, so without it an edit to the patch file needs a restart.
355
+ *
356
+ * The first candidate that yields a config wins, and the reported `origin`
357
+ * names the file so a log line can tell the two sources apart.
358
+ *
359
+ * @param options - `files`, `entryId` (string or candidate ids), `onConfig`, `onError`, `intervalMs`.
360
+ * @returns a disposer that stops watching.
361
+ */
362
+ export function watchPatchFile(options) {
363
+ const { files, entryId = PATCH_ENTRY_IDS, onConfig, onError, intervalMs = 1000 } = options;
364
+ let last = null;
365
+ const read = () => {
366
+ for (const file of files) {
367
+ let text;
368
+ try {
369
+ text = readFileSync(file, 'utf8');
370
+ } catch (error) {
371
+ // Missing is the normal case for every candidate but one.
372
+ if (error?.code !== 'ENOENT') onError?.(error);
373
+ continue;
374
+ }
375
+ let config;
376
+ try {
377
+ config = readPatchEntryConfig(text, entryId);
378
+ } catch (error) {
379
+ onError?.(error);
380
+ return;
381
+ }
382
+ if (config === undefined) continue;
383
+ const serialized = JSON.stringify(config);
384
+ if (serialized === last) return;
385
+ last = serialized;
386
+ onConfig(config, file);
387
+ return;
388
+ }
389
+ // No candidate carried the entry: leave the last good config in place
390
+ // rather than reverting to the composition on a transient read failure.
391
+ };
392
+ read();
393
+ const timer = setInterval(read, intervalMs);
394
+ timer.unref?.();
395
+ return () => clearInterval(timer);
396
+ }
@@ -0,0 +1,138 @@
1
+ /**
2
+ * Settings wiring for dsh-compaction-policy-engine.
3
+ *
4
+ * `ctx.settings.installSection(ns, schema, entry, hooks)` publishes a namespaced
5
+ * section of the user settings document and hands back a live getter; the
6
+ * provider already merges "schema defaults, then the registrant's composition
7
+ * base, then the user document", so this module must not merge anything itself.
8
+ * Validation is split the same way as `policy.js`: shape here, meaning there.
9
+ *
10
+ * @module dsh-compaction-policy-engine/settings
11
+ */
12
+
13
+ import z from '@deepseek-ai/schemastery';
14
+ import { isVolatile } from '@deepseek-ai/cosmokit';
15
+
16
+ /** The settings namespace this plugin owns. Must be lowercase-hyphenated. */
17
+ export const SETTINGS_NS = 'compaction-control';
18
+
19
+ /**
20
+ * Fields shared by the global default and every override layer. The vocabulary
21
+ * mirrors `policy.js` (`threshold`/`retain`), not the parent's
22
+ * (`thresholdRatio`/`retainRatio`); the translation happens once, in
23
+ * `toBasicConfig`. Every field is optional — a settings section is a partial
24
+ * override by nature.
25
+ */
26
+ const layerFields = {
27
+ threshold: z.number().description('compact at this fraction of the context window'),
28
+ thresholdTokens: z
29
+ .number()
30
+ .step(1)
31
+ .min(1)
32
+ .description('compact at this many tokens of context; needs a route that declares a window'),
33
+ retain: z.number().description('verbatim tail to keep, as a fraction of the context window'),
34
+ retainTokens: z.number().step(1).min(1).description('verbatim tail to keep, in tokens; must be below the threshold'),
35
+ summarizationModel: z.string().description('"auto", or an explicit "provider/model"'),
36
+ summarizationFallback: z
37
+ .array(z.string())
38
+ .description('ordered "provider/model" routes tried when the primary summarization route fails; strongest free first, paid last'),
39
+ headroomTokens: z.number().step(1).min(0).description('tokens kept free below the threshold for the summary to be smaller than what it replaces'),
40
+ maxTokens: z.number().step(1).min(1).description('cap on the generated summary length'),
41
+ compactionRetries: z.number().step(1).min(0).description('retries when summarization fails'),
42
+ maxOverflowRetries: z.number().step(1).min(0).description('retries after a context overflow'),
43
+ };
44
+
45
+ /** One exact-target override: the shared fields plus the route it applies to. */
46
+ const modelLayer = z.object({
47
+ provider: z.string().required(),
48
+ model: z.string().required(),
49
+ ...layerFields,
50
+ });
51
+
52
+ /**
53
+ * Schema of the user's `compaction-control` section.
54
+ *
55
+ * Deliberately the same shape as the plugin's own `Config`, so the same
56
+ * `resolveConfig` accepts either document.
57
+ */
58
+ export const settingsSchema = z.object({
59
+ default: z.object(layerFields).volatile(),
60
+ providers: z.dict(z.object(layerFields)).volatile(),
61
+ models: z.array(modelLayer).volatile(),
62
+ auto: z.boolean().volatile(),
63
+ });
64
+
65
+ /**
66
+ * Publish this plugin's section and keep a live getter for the effective
67
+ * document.
68
+ *
69
+ * `current()` delegates to the provider on every call, so an external edit is
70
+ * visible without a restart; caching it would reintroduce exactly the staleness
71
+ * this module exists to remove. With no settings provider (a bare profile, or a
72
+ * unit test) the section is never published and the plugin runs on its Cordis
73
+ * config alone — a deliberate degradation every existing deployment relies on.
74
+ *
75
+ * @param ctx - context that may provide the `settings` service.
76
+ * @param ns - settings namespace to own.
77
+ * @param schema - schema resolving the section.
78
+ * @param base - the composition default, used until the user overrides it.
79
+ * @param onChange - called when the effective document changes.
80
+ * @returns an object exposing the live document and whether a provider took it.
81
+ */
82
+ /**
83
+ * Unwrap the live cells a `.volatile()` field resolves to.
84
+ *
85
+ * A volatile field's value is a cell exposing `get()`, so every read of this
86
+ * plugin's own config has to read the cells out: `resolveConfig` is written for
87
+ * plain documents, and a cell reaching it would merge as an object.
88
+ */
89
+ export function plainConfig(value) {
90
+ if (isVolatile(value)) return plainConfig(value.get());
91
+ if (Array.isArray(value)) return value.map(plainConfig);
92
+ if (value !== null && typeof value === 'object') {
93
+ return Object.fromEntries(Object.entries(value).map(([key, child]) => [key, plainConfig(child)]));
94
+ }
95
+ return value;
96
+ }
97
+
98
+ export function installSettings(ctx, ns, schema, base, onChange) {
99
+ /**
100
+ * Getter over the provider's resolved document.
101
+ *
102
+ * Starts by returning the composition base, so `current()` is meaningful
103
+ * even before a provider responds — and stays meaningful when none exists.
104
+ */
105
+ let read = () => base;
106
+
107
+ const state = {
108
+ /** Whether a settings provider took the section. */
109
+ installed: false,
110
+ /**
111
+ * The effective document: composition default overlaid by the user
112
+ * section.
113
+ *
114
+ * Delegates to the provider's getter on every call rather than
115
+ * snapshotting, which is what makes an external edit to `settings.yaml`
116
+ * visible without a restart.
117
+ */
118
+ current: () => read(),
119
+ };
120
+
121
+ ctx.inject(['settings'], (settingsCtx) => {
122
+ settingsCtx.settings.installSection(ctx, ns, schema, base, {
123
+ // The provider calls this with a getter over its own resolved value,
124
+ // so calling it here yields the merged document. It is a getter, not a
125
+ // snapshot: re-reading inside `current()` is what makes a later write
126
+ // visible without a restart.
127
+ setSource: (providerRead) => {
128
+ read = providerRead;
129
+ },
130
+ onChange: () => {
131
+ state.installed = true;
132
+ onChange();
133
+ },
134
+ });
135
+ });
136
+
137
+ return state;
138
+ }
package/package.json CHANGED
@@ -1,6 +1,72 @@
1
1
  {
2
2
  "name": "@magic6/dsh-compaction-policy-engine",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.5.4",
4
+ "description": "Layered, live-reloading context compaction policy for DeepSeek Harness: provider-level rules, field-by-field inheritance, ratio/token units and a settings panel on top of the official engine.",
5
+ "type": "module",
6
+ "main": "lib/companion.js",
7
+ "exports": {
8
+ ".": "./lib/companion.js",
9
+ "./engine": "./lib/engine.js",
10
+ "./policy": "./lib/policy.js",
11
+ "./client-policy": "./lib/client-policy.js",
12
+ "./client": "./lib/client.js"
13
+ },
14
+ "files": [
15
+ "lib",
16
+ "docs",
17
+ "examples",
18
+ "cordis.patch.yml",
19
+ "README.md",
20
+ "README.zh-CN.md",
21
+ "CHANGELOG.md",
22
+ "LICENSE"
23
+ ],
24
+ "scripts": {
25
+ "test": "node --test test/*.test.js",
26
+ "prepublishOnly": "npm test"
27
+ },
28
+ "keywords": [
29
+ "dsh",
30
+ "dsh-plugin",
31
+ "deepseek-harness",
32
+ "cordis",
33
+ "compaction",
34
+ "context-management",
35
+ "threshold",
36
+ "summarization"
37
+ ],
38
+ "license": "MIT",
39
+ "author": "T-splines",
40
+ "repository": {
41
+ "type": "git",
42
+ "url": "git+https://github.com/T-splines/dsh-compaction-policy-engine.git"
43
+ },
44
+ "homepage": "https://github.com/T-splines/dsh-compaction-policy-engine#readme",
45
+ "bugs": {
46
+ "url": "https://github.com/T-splines/dsh-compaction-policy-engine/issues"
47
+ },
48
+ "peerDependencies": {
49
+ "@deepseek-ai/dsh-compaction-basic": "^0.2.2-rc.1",
50
+ "@deepseek-ai/schemastery": "^3.18.2",
51
+ "@deepseek-ai/cosmokit": "^1.8.3"
52
+ },
53
+ "dsh": {
54
+ "manifestVersion": 1,
55
+ "bundle": {
56
+ "patch": "./cordis.patch.yml"
57
+ },
58
+ "client": {
59
+ "platform": "web",
60
+ "inject": [
61
+ "@deepseek-ai/dsh-client-locale",
62
+ "@deepseek-ai/dsh-client-ui-settings",
63
+ "@deepseek-ai/dsh-client-ui-slots",
64
+ "@deepseek-ai/dsh-api-remotes"
65
+ ]
66
+ }
67
+ },
68
+ "engines": {
69
+ "node": ">=20.0.0",
70
+ "dsh": ">=0.2.2-0 <0.3.0-0"
71
+ }
72
+ }