dsh-tidy-display 0.2.0 → 0.2.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 (40) hide show
  1. package/lib/client.js +125 -0
  2. package/lib/client.js.map +1 -1
  3. package/lib/dsh-tidy-display.js +81 -1
  4. package/lib/types/client/config-bridge.d.ts +10 -0
  5. package/lib/types/client/config-bridge.d.ts.map +1 -0
  6. package/lib/types/client/config-bridge.js +89 -0
  7. package/lib/types/client/config-bridge.js.map +1 -0
  8. package/lib/types/client/config-card.d.ts +15 -0
  9. package/lib/types/client/config-card.d.ts.map +1 -0
  10. package/lib/types/client/config-card.js +17 -0
  11. package/lib/types/client/config-card.js.map +1 -0
  12. package/lib/types/client/index.d.ts.map +1 -1
  13. package/lib/types/client/index.js +2 -0
  14. package/lib/types/client/index.js.map +1 -1
  15. package/lib/types/client/settings-slots.d.ts +12 -0
  16. package/lib/types/client/settings-slots.d.ts.map +1 -1
  17. package/lib/types/client/settings.d.ts.map +1 -1
  18. package/lib/types/client/settings.js +2 -0
  19. package/lib/types/client/settings.js.map +1 -1
  20. package/lib/types/config.d.ts +7 -0
  21. package/lib/types/config.d.ts.map +1 -0
  22. package/lib/types/config.js +48 -0
  23. package/lib/types/config.js.map +1 -0
  24. package/lib/types/dsh-tidy-display.d.ts +2 -0
  25. package/lib/types/dsh-tidy-display.d.ts.map +1 -1
  26. package/lib/types/dsh-tidy-display.js +1 -0
  27. package/lib/types/dsh-tidy-display.js.map +1 -1
  28. package/lib/types/reader-prefs.d.ts +30 -0
  29. package/lib/types/reader-prefs.d.ts.map +1 -0
  30. package/lib/types/reader-prefs.js +44 -0
  31. package/lib/types/reader-prefs.js.map +1 -0
  32. package/package.json +142 -141
  33. package/src/client/config-bridge.ts +118 -0
  34. package/src/client/config-card.tsx +22 -0
  35. package/src/client/index.tsx +270 -268
  36. package/src/client/settings-slots.ts +8 -0
  37. package/src/client/settings.tsx +2 -0
  38. package/src/config.ts +53 -0
  39. package/src/dsh-tidy-display.ts +3 -0
  40. package/src/reader-prefs.ts +67 -0
package/package.json CHANGED
@@ -1,141 +1,142 @@
1
- {
2
- "name": "dsh-tidy-display",
3
- "version": "0.2.0",
4
- "description": "One plugin for a calmer DeepSeek Harness: reading view + message rail + smart history loading, for the Harness 0.2.0 line.",
5
- "type": "module",
6
- "license": "MIT",
7
- "publishConfig": {
8
- "registry": "https://registry.npmjs.org",
9
- "access": "public",
10
- "tag": "dsh-0.1.7"
11
- },
12
- "main": "lib/dsh-tidy-display.js",
13
- "types": "lib/types/dsh-tidy-display.d.ts",
14
- "exports": {
15
- ".": {
16
- "types": "./lib/types/dsh-tidy-display.d.ts",
17
- "default": "./lib/dsh-tidy-display.js"
18
- },
19
- "./client": {
20
- "types": "./lib/types/client/index.d.ts",
21
- "default": "./lib/client.js"
22
- },
23
- "./package.json": "./package.json"
24
- },
25
- "dsh": {
26
- "bundle": {
27
- "patch": "./cordis.patch.yml"
28
- },
29
- "client": {
30
- "platform": "web",
31
- "inject": [
32
- "@deepseek-ai/dsh-api-session-controller",
33
- "@deepseek-ai/dsh-client-ui-chat",
34
- "@deepseek-ai/dsh-client-ui-conversation",
35
- "@deepseek-ai/dsh-client-ui-renderer",
36
- "@deepseek-ai/dsh-client-ui-session"
37
- ]
38
- }
39
- },
40
- "scripts": {
41
- "build": "node scripts/check-harness-compat.mjs && tsc -p tsconfig.json && tsdown",
42
- "check:harness": "node scripts/check-harness-compat.mjs",
43
- "test:official": "node scripts/verify-official-bridge.mjs",
44
- "test:auto-fold": "node scripts/verify-auto-fold.mjs",
45
- "typecheck": "tsc -p tsconfig.json --noEmit",
46
- "test": "node --import tsx/esm --test tests/*.test.ts",
47
- "link:harness": "node scripts/link-harness-dependencies.mjs",
48
- "lint": "eslint .",
49
- "check": "npm run typecheck && npm run lint && npm test"
50
- },
51
- "peerDependencies": {
52
- "@deepseek-ai/cordis": "~4.0.4",
53
- "@deepseek-ai/dsh-api-session-controller": ">=0.2.0-rc.1 <0.2.1-0",
54
- "@deepseek-ai/dsh-attachment": ">=0.2.0-rc.1 <0.2.1-0",
55
- "@deepseek-ai/dsh-client-store": ">=0.2.0-rc.1 <0.2.1-0",
56
- "@deepseek-ai/dsh-client-ui-chat": ">=0.2.0-rc.1 <0.2.1-0",
57
- "@deepseek-ai/dsh-client-ui-conversation": ">=0.2.0-rc.1 <0.2.1-0",
58
- "@deepseek-ai/dsh-client-ui-primitives": ">=0.2.0-rc.1 <0.2.1-0",
59
- "@deepseek-ai/dsh-client-ui-renderer": ">=0.2.0-rc.1 <0.2.1-0",
60
- "@deepseek-ai/dsh-client-ui-session": ">=0.2.0-rc.1 <0.2.1-0",
61
- "@deepseek-ai/dsh-client-ui-slots": ">=0.2.0-rc.1 <0.2.1-0",
62
- "@deepseek-ai/dsh-client-ui-tool": ">=0.2.0-rc.1 <0.2.1-0",
63
- "@deepseek-ai/dsh-session": ">=0.2.0-rc.1 <0.2.1-0",
64
- "@deepseek-ai/dsh-util-workspace-path": ">=0.2.0-rc.1 <0.2.1-0",
65
- "react": "^18.2.0"
66
- },
67
- "devDependencies": {
68
- "@deepseek-ai/dsh-api-remotes": "0.2.0-rc.2",
69
- "@deepseek-ai/dsh-api-session-controller": "0.2.0-rc.2",
70
- "@deepseek-ai/dsh-client-connection": "0.2.0-rc.2",
71
- "@deepseek-ai/dsh-session-turn-outline": "0.2.0-rc.2",
72
- "@eslint/js": "^10.0.1",
73
- "@types/mdast": "^4.0.4",
74
- "@types/node": "^22.20.0",
75
- "@types/react": "~18.3.1",
76
- "eslint": "^10.11.0",
77
- "globals": "^17.12.0",
78
- "lightningcss": "^1.33.0",
79
- "tsdown": "^0.22.2",
80
- "tsx": "^4.22.4",
81
- "typescript": "^6.0.3",
82
- "typescript-eslint": "^8.70.1"
83
- },
84
- "dependencies": {
85
- "clsx": "^2.0.0",
86
- "katex": "^0.16.47",
87
- "mdast-util-from-markdown": "^2.0.3",
88
- "mdast-util-gfm": "^3.1.0",
89
- "mdast-util-math": "^3.0.0",
90
- "micromark-core-commonmark": "^2.0.3",
91
- "micromark-extension-gfm": "^3.0.0",
92
- "micromark-extension-math": "^3.1.0",
93
- "micromark-factory-space": "^2.0.1",
94
- "micromark-util-character": "^2.1.1",
95
- "micromark-util-classify-character": "^2.0.1",
96
- "micromark-util-sanitize-uri": "^2.0.1",
97
- "micromark-util-symbol": "^2.0.1",
98
- "micromark-util-types": "^2.0.2"
99
- },
100
- "files": [
101
- "lib",
102
- "skills",
103
- "src",
104
- "tests",
105
- "scripts",
106
- "cordis.yml",
107
- "cordis.patch.yml",
108
- "dshx.yml",
109
- "tsconfig.json",
110
- "tsdown.config.ts",
111
- "README.md",
112
- "README.en.md",
113
- "DESIGN.md",
114
- "LICENSE",
115
- "THIRD_PARTY_NOTICES.md",
116
- "CHANGELOG.md",
117
- "compat",
118
- "docs"
119
- ],
120
- "engines": {
121
- "node": "^22.19.0 || >=24.0.0"
122
- },
123
- "repository": {
124
- "type": "git",
125
- "url": "git+https://github.com/drscrewdriver/dsh-tidy-display.git"
126
- },
127
- "homepage": "https://github.com/drscrewdriver/dsh-tidy-display#readme",
128
- "bugs": {
129
- "url": "https://github.com/drscrewdriver/dsh-tidy-display/issues"
130
- },
131
- "keywords": [
132
- "deepseek-harness",
133
- "dsh",
134
- "dsh-plugin",
135
- "dshx",
136
- "conversation",
137
- "reasoning",
138
- "streaming",
139
- "accessibility"
140
- ]
141
- }
1
+ {
2
+ "name": "dsh-tidy-display",
3
+ "version": "0.2.1",
4
+ "description": "One plugin for a calmer DeepSeek Harness: reading view + message rail + smart history loading, for the Harness 0.2.0 line.",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "publishConfig": {
8
+ "registry": "https://registry.npmjs.org",
9
+ "access": "public",
10
+ "tag": "dsh-0.1.7"
11
+ },
12
+ "main": "lib/dsh-tidy-display.js",
13
+ "types": "lib/types/dsh-tidy-display.d.ts",
14
+ "exports": {
15
+ ".": {
16
+ "types": "./lib/types/dsh-tidy-display.d.ts",
17
+ "default": "./lib/dsh-tidy-display.js"
18
+ },
19
+ "./client": {
20
+ "types": "./lib/types/client/index.d.ts",
21
+ "default": "./lib/client.js"
22
+ },
23
+ "./package.json": "./package.json"
24
+ },
25
+ "dsh": {
26
+ "bundle": {
27
+ "patch": "./cordis.patch.yml"
28
+ },
29
+ "client": {
30
+ "platform": "web",
31
+ "inject": [
32
+ "@deepseek-ai/dsh-api-session-controller",
33
+ "@deepseek-ai/dsh-client-ui-chat",
34
+ "@deepseek-ai/dsh-client-ui-conversation",
35
+ "@deepseek-ai/dsh-client-ui-renderer",
36
+ "@deepseek-ai/dsh-client-ui-session"
37
+ ]
38
+ }
39
+ },
40
+ "scripts": {
41
+ "build": "node scripts/check-harness-compat.mjs && tsc -p tsconfig.json && tsdown",
42
+ "check:harness": "node scripts/check-harness-compat.mjs",
43
+ "test:official": "node scripts/verify-official-bridge.mjs",
44
+ "test:auto-fold": "node scripts/verify-auto-fold.mjs",
45
+ "typecheck": "tsc -p tsconfig.json --noEmit",
46
+ "test": "node --import tsx/esm --test tests/*.test.ts",
47
+ "link:harness": "node scripts/link-harness-dependencies.mjs",
48
+ "lint": "eslint .",
49
+ "check": "npm run typecheck && npm run lint && npm test"
50
+ },
51
+ "peerDependencies": {
52
+ "@deepseek-ai/cordis": "~4.0.4",
53
+ "@deepseek-ai/dsh-api-session-controller": ">=0.2.0-rc.1 <0.2.1-0",
54
+ "@deepseek-ai/dsh-attachment": ">=0.2.0-rc.1 <0.2.1-0",
55
+ "@deepseek-ai/dsh-client-store": ">=0.2.0-rc.1 <0.2.1-0",
56
+ "@deepseek-ai/dsh-client-ui-chat": ">=0.2.0-rc.1 <0.2.1-0",
57
+ "@deepseek-ai/dsh-client-ui-conversation": ">=0.2.0-rc.1 <0.2.1-0",
58
+ "@deepseek-ai/dsh-client-ui-primitives": ">=0.2.0-rc.1 <0.2.1-0",
59
+ "@deepseek-ai/dsh-client-ui-renderer": ">=0.2.0-rc.1 <0.2.1-0",
60
+ "@deepseek-ai/dsh-client-ui-session": ">=0.2.0-rc.1 <0.2.1-0",
61
+ "@deepseek-ai/dsh-client-ui-slots": ">=0.2.0-rc.1 <0.2.1-0",
62
+ "@deepseek-ai/dsh-client-ui-tool": ">=0.2.0-rc.1 <0.2.1-0",
63
+ "@deepseek-ai/dsh-session": ">=0.2.0-rc.1 <0.2.1-0",
64
+ "@deepseek-ai/dsh-util-workspace-path": ">=0.2.0-rc.1 <0.2.1-0",
65
+ "react": "^18.2.0"
66
+ },
67
+ "devDependencies": {
68
+ "@deepseek-ai/dsh-api-remotes": "0.2.0-rc.2",
69
+ "@deepseek-ai/dsh-api-session-controller": "0.2.0-rc.2",
70
+ "@deepseek-ai/dsh-client-connection": "0.2.0-rc.2",
71
+ "@deepseek-ai/dsh-session-turn-outline": "0.2.0-rc.2",
72
+ "@eslint/js": "^10.0.1",
73
+ "@types/mdast": "^4.0.4",
74
+ "@types/node": "^22.20.0",
75
+ "@types/react": "~18.3.1",
76
+ "eslint": "^10.11.0",
77
+ "globals": "^17.12.0",
78
+ "lightningcss": "^1.33.0",
79
+ "tsdown": "^0.22.2",
80
+ "tsx": "^4.22.4",
81
+ "typescript": "^6.0.3",
82
+ "typescript-eslint": "^8.70.1",
83
+ "@deepseek-ai/schemastery": "^3.18.4"
84
+ },
85
+ "dependencies": {
86
+ "clsx": "^2.0.0",
87
+ "katex": "^0.16.47",
88
+ "mdast-util-from-markdown": "^2.0.3",
89
+ "mdast-util-gfm": "^3.1.0",
90
+ "mdast-util-math": "^3.0.0",
91
+ "micromark-core-commonmark": "^2.0.3",
92
+ "micromark-extension-gfm": "^3.0.0",
93
+ "micromark-extension-math": "^3.1.0",
94
+ "micromark-factory-space": "^2.0.1",
95
+ "micromark-util-character": "^2.1.1",
96
+ "micromark-util-classify-character": "^2.0.1",
97
+ "micromark-util-sanitize-uri": "^2.0.1",
98
+ "micromark-util-symbol": "^2.0.1",
99
+ "micromark-util-types": "^2.0.2"
100
+ },
101
+ "files": [
102
+ "lib",
103
+ "skills",
104
+ "src",
105
+ "tests",
106
+ "scripts",
107
+ "cordis.yml",
108
+ "cordis.patch.yml",
109
+ "dshx.yml",
110
+ "tsconfig.json",
111
+ "tsdown.config.ts",
112
+ "README.md",
113
+ "README.en.md",
114
+ "DESIGN.md",
115
+ "LICENSE",
116
+ "THIRD_PARTY_NOTICES.md",
117
+ "CHANGELOG.md",
118
+ "compat",
119
+ "docs"
120
+ ],
121
+ "engines": {
122
+ "node": "^22.19.0 || >=24.0.0"
123
+ },
124
+ "repository": {
125
+ "type": "git",
126
+ "url": "git+https://github.com/drscrewdriver/dsh-tidy-display.git"
127
+ },
128
+ "homepage": "https://github.com/drscrewdriver/dsh-tidy-display#readme",
129
+ "bugs": {
130
+ "url": "https://github.com/drscrewdriver/dsh-tidy-display/issues"
131
+ },
132
+ "keywords": [
133
+ "deepseek-harness",
134
+ "dsh",
135
+ "dsh-plugin",
136
+ "dshx",
137
+ "conversation",
138
+ "reasoning",
139
+ "streaming",
140
+ "accessibility"
141
+ ]
142
+ }
@@ -0,0 +1,118 @@
1
+ import type { Context } from '@deepseek-ai/cordis';
2
+ import { READER_CONFIG_DEFAULTS, READER_CONFIG_FIELDS, type ReaderConfig, type ReaderConfigField } from '../reader-prefs.js';
3
+
4
+ /**
5
+ * Two-way bridge between the entry config (namespace = entry id `tidy-display`,
6
+ * the volatile fields of `src/config.ts`) and the reader root store (persist key
7
+ * `dsh.reader.v1`).
8
+ *
9
+ * Direction 1 (preference edits): every writer — the family-tab card, the
10
+ * Plugins-page card, the reader chrome — acts on the store; the bridge pushes
11
+ * changed fields into the config form. Volatile-only commits never remount.
12
+ *
13
+ * Direction 2 (config edits from elsewhere — profile patch hand-edits, another
14
+ * device): form snapshots apply back into the store.
15
+ *
16
+ * Migration: per field, an absent config value adopts the store's non-default
17
+ * value once, on the first ready snapshot. Idempotent — an override (even one
18
+ * equal to the default) is never touched again.
19
+ */
20
+
21
+ /** Minimal structural face of the configForms service (avoid a hard peer). */
22
+ interface ConfigFormsFace {
23
+ get?<T = unknown>(entryId: string): ConfigFormFace<T> | undefined;
24
+ whileServed?(namespaces: readonly string[], register: () => void): () => void;
25
+ }
26
+
27
+ interface ConfigFormFace<T = unknown> {
28
+ getSnapshot(): { status: 'loading' | 'ready' | 'unavailable'; value: Partial<T> | undefined; writable: boolean };
29
+ subscribe(listener: () => void): () => void;
30
+ set(field: string, value: unknown): Promise<boolean>;
31
+ }
32
+
33
+ /** Store-facing slice the bridge needs (baked actions + snapshot source). */
34
+ interface PrefsFace {
35
+ getSnapshot(): Record<string, unknown>;
36
+ subscribe(fn: () => void): () => void;
37
+ actions: Record<string, ((value: never) => void) | undefined>;
38
+ }
39
+ function configFormsOf(ctx: Context): ConfigFormsFace | undefined {
40
+ const forms = (ctx as unknown as { get?: (name: string) => unknown }).get?.('configForms') as ConfigFormsFace | undefined;
41
+ if (forms && typeof forms.get === 'function') return forms;
42
+ return undefined;
43
+ }
44
+
45
+ export function installConfigBridge(ctx: Context, prefs: PrefsFace): void {
46
+ const forms = configFormsOf(ctx);
47
+ if (!forms) return; // legacy host: the persist key stays the only copy
48
+
49
+ const lastKnown = new Map<string, unknown>();
50
+ const disposers: Array<() => void> = [];
51
+
52
+ const push = (field: ReaderConfigField, value: unknown, form: ConfigFormFace): void => {
53
+ lastKnown.set(field, value);
54
+ void form.set(field, value).catch(() => {});
55
+ };
56
+
57
+ const applyField = (field: ReaderConfigField, value: unknown): void => {
58
+ const set = prefs.actions[`set${field[0]!.toUpperCase()}${field.slice(1)}`];
59
+ set?.(value as never);
60
+ };
61
+
62
+ const attach = (form: ConfigFormFace): void => {
63
+ // store → config
64
+ disposers.push(prefs.subscribe(() => {
65
+ const snap = form.getSnapshot();
66
+ if (snap.status !== 'ready' || !snap.writable) return;
67
+ const store = prefs.getSnapshot();
68
+ for (const field of READER_CONFIG_FIELDS) {
69
+ const value = store[field];
70
+ if (value === undefined || Object.is(value, lastKnown.get(field))) continue;
71
+ push(field, value, form);
72
+ }
73
+ }));
74
+ const drain = (): void => {
75
+ const snap = form.getSnapshot();
76
+ if (snap.status !== 'ready') return;
77
+ const store = prefs.getSnapshot();
78
+ for (const field of READER_CONFIG_FIELDS) {
79
+ const configValue = (snap.value as Partial<ReaderConfig> | undefined)?.[field];
80
+ if (configValue === undefined) {
81
+ // migration: an absent config field adopts a non-default store value once
82
+ const storeValue = store[field];
83
+ if (snap.writable && storeValue !== undefined && !Object.is(storeValue, READER_CONFIG_DEFAULTS[field]) && !lastKnown.has(field)) {
84
+ push(field, storeValue, form);
85
+ } else if (storeValue !== undefined && !lastKnown.has(field)) {
86
+ // default-valued absent field: pin it so later unrelated store
87
+ // changes don't sweep the default into the config section
88
+ lastKnown.set(field, storeValue);
89
+ }
90
+ continue;
91
+ }
92
+ if (Object.is(configValue, lastKnown.get(field))) continue;
93
+ lastKnown.set(field, configValue);
94
+ if (!Object.is(configValue, store[field])) applyField(field, configValue);
95
+ }
96
+ };
97
+ // config → store
98
+ disposers.push(form.subscribe(drain));
99
+ drain(); // in case the form was already ready before this attach
100
+ };
101
+
102
+ const form = forms.get?.<ReaderConfig>('tidy-display');
103
+ if (form) attach(form);
104
+ // attach later when the host starts serving the namespace
105
+ if (typeof forms.whileServed === 'function') {
106
+ disposers.push(forms.whileServed(['tidy-display'], () => {
107
+ if (!form) {
108
+ const again = forms.get?.<ReaderConfig>('tidy-display');
109
+ if (again) attach(again);
110
+ }
111
+ }));
112
+ }
113
+ ctx.effect(() => () => {
114
+ for (const off of disposers) {
115
+ try { off(); } catch { /* already gone */ }
116
+ }
117
+ });
118
+ }
@@ -0,0 +1,22 @@
1
+ import { createElement } from 'react';
2
+ import type { Context } from '@deepseek-ai/cordis';
3
+ import type { BetterDisplaySettingsInjected } from './SettingsSection.js';
4
+ import { SettingsSection } from './SettingsSection.js';
5
+
6
+ /**
7
+ * The Plugins-page configuration card (`plugins.bundle.config`, keyed by the
8
+ * package name `dsh-tidy-display`): renders the SAME settings section as the
9
+ * family tab, over the same OpenPrefs face — both surfaces stay one source of
10
+ * truth, and the config-bridge commits edits into the entry's volatile config.
11
+ *
12
+ * The page hands its own `form` prop (keyed by package name), but this entry's
13
+ * namespace is the entry id `tidy-display` ≠ package name, so the page's handle
14
+ * would never resolve; the card renders from prefs instead and the bridge owns
15
+ * the config writes.
16
+ */
17
+ export function installPluginConfigCard(ctx: Context, injected: () => BetterDisplaySettingsInjected): void {
18
+ ctx.slots.inject('plugins.bundle.config', () => ctx.slots.register(
19
+ { name: 'plugins.bundle.config', key: 'dsh-tidy-display' },
20
+ () => createElement(SettingsSection, injected()),
21
+ ));
22
+ }