@huanlin/dsh-plugin-input-history 0.1.2 → 0.2.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.
@@ -1,99 +1,142 @@
1
1
  /**
2
- * DOM helpers for the composer textarea.
2
+ * DOM helpers for the Lexical composer surface.
3
3
  *
4
- * The DSH InputBar's textarea is not exposed through any public API —
5
- * plugins cannot obtain a React ref or a slot-currency handle to it.
6
- * The two operations this plugin needs (locate the textarea, decide
7
- * whether the caret is on the first/last line of a multi-line draft) are
8
- * pure functions over DOM and string state, kept here for unit testing.
4
+ * The DSH composer's text surface is a Lexical-bound contenteditable div,
5
+ * not a textarea: plugins cannot obtain a React ref or a slot-currency
6
+ * handle to it, and writing text goes through `inputActions.setDraft` (the
7
+ * public machine action), not the DOM. What remains DOM-bound is geometry
8
+ * and focus: locating the editable the keystroke targeted, detecting an
9
+ * open trigger menu, and deciding whether the collapsed caret sits on the
10
+ * first/last visual line of a multi-line draft.
9
11
  *
10
- * The locator queries the stable (but undocumented) `data-composer-card`
11
- * attribute on the composer card root (`InputBar.tsx:629`) and returns
12
- * the descendant `<textarea>`. The attribute is internal to
13
- * `@deepseek-ai/dsh-client-ui-conversation` and may change across
14
- * upstream versions; the locator is the single point to update.
12
+ * All markers queried here are internal to `@deepseek-ai/dsh-client-ui-conversation`
13
+ * (`InputBar.tsx` / `ComposerContentEditable.tsx`) or
14
+ * `@deepseek-ai/dsh-client-ui-input-trigger` (`MenuView.tsx`); they are
15
+ * stable but undocumented, and the locators below are the single point to
16
+ * update if upstream changes them.
15
17
  *
16
18
  * @module @huanlin/dsh-plugin-input-history/client/dom
17
19
  */
18
20
  /**
19
- * Compute the caret's line position in a textarea value.
21
+ * Pure decision over caret geometry: where a caret resting at `caretTop`
22
+ * sits relative to the box whose visual line tops are `lineTops` (ascending,
23
+ * one entry per visual line, viewport coordinates).
20
24
  *
21
- * Lines are split on `\n` (the textarea's own line break character). The
22
- * caret must be collapsed (`selectionStart === selectionEnd`) for the
23
- * `atFirstLine` / `atLastLine` flags to be true a non-collapsed
24
- * selection spanning multiple lines should not trigger history navigation.
25
- *
26
- * @param value - the textarea's current value.
27
- * @param selectionStart - the textarea's `selectionStart`.
28
- * @param selectionEnd - the textarea's `selectionEnd` (defaults to `selectionStart`).
29
- * @returns the caret's line information.
25
+ * @param caretTop - viewport `top` of the collapsed caret's box.
26
+ * @param lineTops - viewport `top` of each visual line, ascending.
27
+ * @param tolerance - px slop absorbing subpixel rounding between the caret
28
+ * rect and its line's rect.
29
+ * @returns the boundary flags; an empty `lineTops` (empty editable) is
30
+ * treated as a single virtual line, so both flags are true.
30
31
  */
31
- export function cursorLineInfo(value, selectionStart, selectionEnd = selectionStart) {
32
- // Swap if reversed (the browser allows selectionStart > selectionEnd when
33
- // the user drags upwards); clamp to value bounds.
34
- const rawStart = Math.min(selectionStart, selectionEnd);
35
- const rawEnd = Math.max(selectionStart, selectionEnd);
36
- const clampedStart = Math.max(0, Math.min(rawStart, value.length));
37
- const clampedEnd = Math.max(clampedStart, Math.min(rawEnd, value.length));
38
- const collapsed = clampedStart === clampedEnd;
39
- const lines = value.split('\n');
40
- const totalLines = lines.length;
41
- let currentLine = 0;
42
- let runningLength = 0;
43
- for (let i = 0; i < totalLines; i++) {
44
- const line = lines[i];
45
- // The caret at position `p` belongs to line `i` if `p` is in
46
- // [runningLength, runningLength + line.length + 1) — the `+1` covers
47
- // the position immediately after the line's last character, which is
48
- // still on this line (right before the `\n`). The very end of the
49
- // value (after the last line's last char) belongs to the last line.
50
- const lineEnd = runningLength + line.length;
51
- const isLastLine = i === totalLines - 1;
52
- const upperBound = isLastLine ? lineEnd + 1 : lineEnd + 1; // include the `\n` position
53
- if (clampedStart >= runningLength && clampedStart < upperBound) {
54
- currentLine = i;
55
- break;
56
- }
57
- runningLength = lineEnd + 1; // +1 for the `\n`
58
- }
32
+ export function boundaryFromLineTops(caretTop, lineTops, tolerance) {
33
+ if (lineTops.length === 0)
34
+ return { atFirstLine: true, atLastLine: true };
59
35
  return {
60
- currentLine,
61
- totalLines,
62
- atFirstLine: collapsed && currentLine === 0,
63
- atLastLine: collapsed && currentLine === totalLines - 1,
36
+ atFirstLine: caretTop <= lineTops[0] + tolerance,
37
+ atLastLine: caretTop >= lineTops[lineTops.length - 1] - tolerance,
64
38
  };
65
39
  }
66
40
  /**
67
- * Locate the DSH composer textarea in the current document.
68
- *
69
- * Walks from the event target up to find the closest `[data-composer-card]`
70
- * ancestor, then queries the descendant `<textarea>` inside it. Returns
71
- * `null` when the target is not inside the composer card (e.g. the user
72
- * is typing in another input or the textarea is momentarily absent).
41
+ * Locate the DSH composer editable the event targeted.
73
42
  *
74
- * When called without an event target, falls back to a document-wide
75
- * query used in tests and ad-hoc probing.
43
+ * Walks from the event target up to the closest `[data-composer-card]`
44
+ * ancestor, queries the `[data-composer-input]` contenteditable inside it,
45
+ * and confirms the target sits inside that editable (keystrokes on the
46
+ * card's buttons and chrome do not navigate history). Returns `null` when
47
+ * the target is not inside the composer editable.
76
48
  *
77
- * @param from - the event target (or any node inside the composer card).
78
- * @returns the textarea element, or `null` when not found.
49
+ * @param from - the event target (or any node inside the composer editable).
50
+ * @returns the editable element, or `null` when not found.
79
51
  */
80
- export function findComposerTextarea(from) {
52
+ export function findComposerEditable(from) {
81
53
  if (typeof document === 'undefined')
82
54
  return null;
83
- if (from === undefined) {
84
- // No argument: document-wide query.
85
- return document.querySelector('[data-composer-card] textarea');
86
- }
87
- // `null` or an actual target: do NOT fall back to document-wide query.
88
- if (from === null)
55
+ if (from === null || !(from instanceof Element))
56
+ return null;
57
+ const card = from.closest('[data-composer-card]');
58
+ if (card === null)
59
+ return null;
60
+ const editable = card.querySelector('[data-composer-input]');
61
+ if (editable === null)
89
62
  return null;
90
- // `closest` is on Element; EventTarget may be a Text node or other
91
- // non-Element node. Narrow with an instanceof check.
92
- const card = from instanceof Element ? from.closest('[data-composer-card]') : null;
93
- if (card !== null) {
94
- const ta = card.querySelector('textarea');
95
- if (ta !== null)
96
- return ta;
63
+ return editable.contains(from) ? editable : null;
64
+ }
65
+ /**
66
+ * Detect an open trigger (slash-command / @-mention) menu inside the
67
+ * composer card that owns `editable`.
68
+ *
69
+ * While the menu is open, ArrowUp/ArrowDown move the highlighted row and
70
+ * must not recall history. The menu renders inside the same
71
+ * `[data-composer-card]` as the editable and carries the stable
72
+ * `data-trigger-menu` marker.
73
+ *
74
+ * @param editable - the composer editable element.
75
+ * @returns the menu element, or `null` when no menu is open.
76
+ */
77
+ export function findTriggerMenu(editable) {
78
+ const card = editable.closest('[data-composer-card]');
79
+ return card === null ? null : card.querySelector('[data-trigger-menu]');
80
+ }
81
+ /**
82
+ * Decide the collapsed caret's line boundary inside the composer editable.
83
+ *
84
+ * Compares the caret's viewport box against the editable content's visual
85
+ * line boxes (`Range.getClientRects()` yields one rect per line fragment;
86
+ * fragments of the same visual line share a top within subpixel slop, so
87
+ * tops are deduped with a 2px threshold). A non-collapsed selection and a
88
+ * geometry-less environment (headless/jsdom) both return `null`, which the
89
+ * caller must treat as "do not navigate".
90
+ *
91
+ * @param editable - the composer editable element.
92
+ * @param tolerance - px slop between the caret rect and its line rect
93
+ * (defaults to 4px).
94
+ * @returns the boundary flags, or `null` when they cannot be determined.
95
+ */
96
+ export function caretLineBoundary(editable, tolerance = 4) {
97
+ const selection = window.getSelection();
98
+ if (selection === null || selection.rangeCount === 0)
99
+ return null;
100
+ if (!selection.isCollapsed)
101
+ return null;
102
+ const caretTop = caretTopOf(selection);
103
+ if (caretTop === null)
104
+ return null;
105
+ const lineTops = contentLineTops(editable);
106
+ if (lineTops === null)
107
+ return null;
108
+ return boundaryFromLineTops(caretTop, lineTops, tolerance);
109
+ }
110
+ /** Viewport `top` of the collapsed caret's box, or `null` when unmeasurable. */
111
+ function caretTopOf(selection) {
112
+ const rects = selection.getRangeAt(0).getClientRects();
113
+ for (let i = 0; i < rects.length; i++) {
114
+ const rect = rects[i];
115
+ if (rect.height === 0 && rect.width === 0)
116
+ continue;
117
+ return rect.top;
118
+ }
119
+ // Some engines report a zero-box collapsed caret; the anchor's element
120
+ // box is the line the caret sits on (the same ruler InputBar's reveal uses).
121
+ const anchor = selection.anchorNode;
122
+ const el = anchor instanceof HTMLElement ? anchor : anchor?.parentElement;
123
+ return el === undefined || el === null ? null : el.getBoundingClientRect().top;
124
+ }
125
+ /** Ascending, deduped tops of the editable content's visual lines; `null` without geometry. Empty for an empty editable. */
126
+ function contentLineTops(editable) {
127
+ const range = document.createRange();
128
+ range.selectNodeContents(editable);
129
+ const rects = range.getClientRects();
130
+ const tops = [];
131
+ for (let i = 0; i < rects.length; i++) {
132
+ const rect = rects[i];
133
+ if (rect.height === 0 && rect.width === 0)
134
+ continue;
135
+ const top = rect.top;
136
+ // Rects come in document order; fragments of one visual line differ by
137
+ // subpixel amounts, real lines by a full line height.
138
+ if (tops.length === 0 || Math.abs(top - tops[tops.length - 1]) > 2)
139
+ tops.push(top);
97
140
  }
98
- return null;
141
+ return tops;
99
142
  }
@@ -1,30 +1,22 @@
1
1
  /**
2
2
  * dsh-plugin-input-history — browser half.
3
3
  *
4
- * Two registrations:
5
- * - `conversation.composer.dock` list slot (id `dsh-plugin-input-history`,
6
- * order 100) renders an invisible anchor that collects history from
7
- * `session.nodes` every render. The dock is session-scoped; DSH treats
8
- * blank sessions as "hero" and suppresses the dock, so history
9
- * collection only runs in active sessions. That is fine: the first
10
- * message in a blank session is collected after the session becomes
11
- * active (the message makes it non-blank).
12
- * - A document-level `keydown` listener attached in `apply` (NOT in the
13
- * dock component) — this ensures the listener is always active,
14
- * including in hero/blank mode where the dock is suppressed. The
15
- * listener uses the native `value` setter + `dispatchEvent('input')`
16
- * to feed history text into the textarea, which triggers InputBar's
17
- * `onChange` → `keyboard.setDraft` — the same path the user's typing
18
- * takes.
4
+ * One registration: the `conversation.composer.dock` list slot (id
5
+ * `dsh-plugin-input-history`, order 100) mounts the invisible dock entry
6
+ * that owns both plugin behaviors prompt-history collection from the
7
+ * Chat target's user/steering nodes, and the capture-phase document
8
+ * keydown listener that navigates the composer draft through
9
+ * `inputActions.setDraft`. See [HistoryDock.tsx](./HistoryDock.tsx) for
10
+ * the data flow; the dock is session-scoped, so in hero/blank mode the
11
+ * plugin is dormant (no input machine exists there to drive).
19
12
  *
20
- * History is collected from `user` and `steering` conversation nodes as
21
- * they appear in any session's `ConversationSnapshot`, persisted to
22
- * `localStorage` (FIFO, 500 entries), and shared across all sessions
23
- * in the same browser profile.
13
+ * History is collected from `user` and `steering` chat nodes of any active
14
+ * session, persisted to `localStorage` (FIFO, 500 entries), and shared
15
+ * across all sessions in the same browser profile.
24
16
  *
25
17
  * @module @huanlin/dsh-plugin-input-history/client
26
18
  */
27
- import type { ClientContext } from '@deepseek-ai/dsh-client-runtime/client';
19
+ import type { Context } from '@deepseek-ai/cordis';
28
20
  import { type InputHistoryKey } from './locales.ts';
29
21
  declare module '@deepseek-ai/dsh-client-ui-slots' {
30
22
  interface LocaleNamespaceMap {
@@ -35,8 +27,8 @@ declare module '@deepseek-ai/dsh-client-ui-slots' {
35
27
  /** Required services: slots + locale. */
36
28
  export declare const inject: string[];
37
29
  /**
38
- * Client plugin body: register the dock + attach the keydown listener.
30
+ * Client plugin body: register the dock + locale dictionaries.
39
31
  *
40
32
  * @param ctx - client root context.
41
33
  */
42
- export declare function apply(ctx: ClientContext): void;
34
+ export declare function apply(ctx: Context): void;
@@ -1,46 +1,28 @@
1
1
  /**
2
2
  * dsh-plugin-input-history — browser half.
3
3
  *
4
- * Two registrations:
5
- * - `conversation.composer.dock` list slot (id `dsh-plugin-input-history`,
6
- * order 100) renders an invisible anchor that collects history from
7
- * `session.nodes` every render. The dock is session-scoped; DSH treats
8
- * blank sessions as "hero" and suppresses the dock, so history
9
- * collection only runs in active sessions. That is fine: the first
10
- * message in a blank session is collected after the session becomes
11
- * active (the message makes it non-blank).
12
- * - A document-level `keydown` listener attached in `apply` (NOT in the
13
- * dock component) — this ensures the listener is always active,
14
- * including in hero/blank mode where the dock is suppressed. The
15
- * listener uses the native `value` setter + `dispatchEvent('input')`
16
- * to feed history text into the textarea, which triggers InputBar's
17
- * `onChange` → `keyboard.setDraft` — the same path the user's typing
18
- * takes.
4
+ * One registration: the `conversation.composer.dock` list slot (id
5
+ * `dsh-plugin-input-history`, order 100) mounts the invisible dock entry
6
+ * that owns both plugin behaviors prompt-history collection from the
7
+ * Chat target's user/steering nodes, and the capture-phase document
8
+ * keydown listener that navigates the composer draft through
9
+ * `inputActions.setDraft`. See [HistoryDock.tsx](./HistoryDock.tsx) for
10
+ * the data flow; the dock is session-scoped, so in hero/blank mode the
11
+ * plugin is dormant (no input machine exists there to drive).
19
12
  *
20
- * History is collected from `user` and `steering` conversation nodes as
21
- * they appear in any session's `ConversationSnapshot`, persisted to
22
- * `localStorage` (FIFO, 500 entries), and shared across all sessions
23
- * in the same browser profile.
13
+ * History is collected from `user` and `steering` chat nodes of any active
14
+ * session, persisted to `localStorage` (FIFO, 500 entries), and shared
15
+ * across all sessions in the same browser profile.
24
16
  *
25
17
  * @module @huanlin/dsh-plugin-input-history/client
26
18
  */
27
- import { HistoryDock, getHistoryStore } from "./HistoryDock.js";
28
- import { isImeComposition } from "./ime.js";
29
- import { cursorLineInfo, findComposerTextarea } from "./dom.js";
30
- import { nextIndex, entryAt } from "./history.js";
19
+ import { HistoryDock } from "./HistoryDock.js";
31
20
  import { en, NS, zh } from "./locales.js";
32
21
  import { dicts } from "./dictionaries.js";
33
22
  /** Required services: slots + locale. */
34
23
  export const inject = ['slots', 'locale'];
35
24
  /**
36
- * Navigation cursor + saved draft for the keydown listener. Module-scoped
37
- * because the listener is attached once in `apply` and must persist across
38
- * dock mount/unmount cycles.
39
- */
40
- let navCursor = null;
41
- let savedDraft = null;
42
- /**
43
- * Client plugin body: register the dock + attach the keydown listener.
25
+ * Client plugin body: register the dock + locale dictionaries.
44
26
  *
45
27
  * @param ctx - client root context.
46
28
  */
@@ -68,103 +50,13 @@ export function apply(ctx) {
68
50
  dispose?.();
69
51
  };
70
52
  }, 'dsh-plugin-input-history: better-locale override dicts');
71
- // The dock collects history from session.nodes. It is session-scoped;
72
- // in hero/blank mode it is suppressed, but the keydown listener below
73
- // still works (it reads from the module-scope HistoryStore, which
74
- // persists across dock mount/unmount cycles via localStorage).
53
+ // The dock collects history from the Chat target's nodes and attaches the
54
+ // capture-phase keydown listener. It is session-scoped; in hero/blank mode
55
+ // it is unmounted and the plugin is dormant (no input machine exists there).
75
56
  ctx.slots.inject('conversation.composer.dock', () => ctx.slots.register({
76
57
  name: 'conversation.composer.dock',
77
58
  id: 'dsh-plugin-input-history',
78
59
  order: 100,
79
60
  locale: NS,
80
61
  }, HistoryDock));
81
- // Attach the document-level keydown listener. This lives in `apply`
82
- // (not in the dock component) so it stays active even when the dock is
83
- // suppressed (hero/blank sessions — ConversationRoot.tsx:79-80 treats
84
- // blank sessions as hero, and line 156 skips the dock render).
85
- ctx.effect(() => {
86
- if (typeof document === 'undefined')
87
- return () => { };
88
- const handler = (event) => {
89
- if (event.key !== 'ArrowUp' && event.key !== 'ArrowDown')
90
- return;
91
- if (isImeComposition(event))
92
- return;
93
- if (event.defaultPrevented)
94
- return;
95
- const textarea = findComposerTextarea(event.target);
96
- if (textarea === null)
97
- return;
98
- if (event.target !== textarea)
99
- return;
100
- // Skip if the textarea is readOnly or disabled — hero mode's
101
- // workspace-picker trigger, or a submitting machine phase.
102
- if (textarea.readOnly || textarea.disabled)
103
- return;
104
- const store = getHistoryStore();
105
- const history = store.list;
106
- // Multi-line boundary check.
107
- const info = cursorLineInfo(textarea.value, textarea.selectionStart, textarea.selectionEnd);
108
- if (event.key === 'ArrowUp' && !info.atFirstLine)
109
- return;
110
- if (event.key === 'ArrowDown' && !info.atLastLine)
111
- return;
112
- const dir = event.key === 'ArrowUp' ? 'up' : 'down';
113
- const next = nextIndex(navCursor, history.length, dir);
114
- // Down off the newest end: restore the saved draft (if any).
115
- if (next === null) {
116
- const saved = savedDraft;
117
- navCursor = null;
118
- if (saved !== null) {
119
- setNativeTextareaValue(textarea, saved);
120
- savedDraft = null;
121
- }
122
- event.preventDefault();
123
- return;
124
- }
125
- // Entering history: save the current draft the first time we
126
- // navigate away from "not navigating".
127
- if (navCursor === null && savedDraft === null) {
128
- savedDraft = textarea.value;
129
- }
130
- const entry = entryAt(history, next);
131
- if (entry === null)
132
- return;
133
- navCursor = next;
134
- setNativeTextareaValue(textarea, entry);
135
- event.preventDefault();
136
- };
137
- document.addEventListener('keydown', handler, false);
138
- return () => {
139
- document.removeEventListener('keydown', handler, false);
140
- };
141
- }, 'dsh-plugin-input-history: keydown listener');
142
- }
143
- /**
144
- * Set the textarea value via the native prototype setter and dispatch an
145
- * `input` event so React's controlled-component onChange fires.
146
- *
147
- * React 18 tracks the textarea's value internally; directly assigning
148
- * `textarea.value = x` does NOT trigger React's onChange because React's
149
- * value tracker compares against its last-seen value. Using the native
150
- * prototype setter bypasses React's tracker, and the dispatched `input`
151
- * event makes React detect the change and run InputBar's `onChange` →
152
- * `keyboard.setDraft(next)`. This is the same technique used by
153
- * browser automation libraries (Playwright, Testing Library) to simulate
154
- * user typing in React controlled inputs.
155
- *
156
- * @param textarea - the target textarea element.
157
- * @param value - the new value to set.
158
- */
159
- function setNativeTextareaValue(textarea, value) {
160
- const proto = window.HTMLTextAreaElement.prototype;
161
- const descriptor = Object.getOwnPropertyDescriptor(proto, 'value');
162
- if (descriptor === undefined || descriptor.set === undefined) {
163
- // Fallback: direct assignment (may not trigger React onChange in
164
- // all browsers, but better than nothing).
165
- textarea.value = value;
166
- return;
167
- }
168
- descriptor.set.call(textarea, value);
169
- textarea.dispatchEvent(new Event('input', { bubbles: true }));
170
62
  }
@@ -3,14 +3,13 @@
3
3
  *
4
4
  * Client-only plugin: the host half has no runtime work. The browser half
5
5
  * (`./client`) registers an invisible entry in `conversation.composer.dock`
6
- * that attaches a document-level `keydown` listener and implements
7
- * terminal-style prompt history navigation (ArrowUp/ArrowDown) over the
8
- * composer textarea.
6
+ * that collects prompt history from the Chat target's user/steering nodes
7
+ * and implements terminal-style history navigation (ArrowUp/ArrowDown) over
8
+ * the composer's Lexical surface through `inputActions.setDraft`.
9
9
  *
10
- * History is collected from `user` and `steering` conversation nodes as
11
- * they appear in any session's `ConversationSnapshot`, persisted to
12
- * `localStorage` (FIFO, capacity 500), and shared across all sessions
13
- * in the same browser profile.
10
+ * History is collected from `user` and `steering` chat nodes of any active
11
+ * session, persisted to `localStorage` (FIFO, capacity 500), and shared
12
+ * across all sessions in the same browser profile.
14
13
  *
15
14
  * @module @huanlin/dsh-plugin-input-history
16
15
  */
@@ -3,14 +3,13 @@
3
3
  *
4
4
  * Client-only plugin: the host half has no runtime work. The browser half
5
5
  * (`./client`) registers an invisible entry in `conversation.composer.dock`
6
- * that attaches a document-level `keydown` listener and implements
7
- * terminal-style prompt history navigation (ArrowUp/ArrowDown) over the
8
- * composer textarea.
6
+ * that collects prompt history from the Chat target's user/steering nodes
7
+ * and implements terminal-style history navigation (ArrowUp/ArrowDown) over
8
+ * the composer's Lexical surface through `inputActions.setDraft`.
9
9
  *
10
- * History is collected from `user` and `steering` conversation nodes as
11
- * they appear in any session's `ConversationSnapshot`, persisted to
12
- * `localStorage` (FIFO, capacity 500), and shared across all sessions
13
- * in the same browser profile.
10
+ * History is collected from `user` and `steering` chat nodes of any active
11
+ * session, persisted to `localStorage` (FIFO, capacity 500), and shared
12
+ * across all sessions in the same browser profile.
14
13
  *
15
14
  * @module @huanlin/dsh-plugin-input-history
16
15
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@huanlin/dsh-plugin-input-history",
3
- "version": "0.1.2",
3
+ "version": "0.2.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -17,10 +17,6 @@
17
17
  "types": "./lib/types/index.d.ts",
18
18
  "import": "./lib/index.js"
19
19
  },
20
- "./invariant": {
21
- "types": "./lib/types/invariant.d.ts",
22
- "import": "./lib/invariant.js"
23
- },
24
20
  "./client": {
25
21
  "types": "./lib/types/client/index.d.ts",
26
22
  "default": "./lib/client.js"
@@ -38,41 +34,42 @@
38
34
  },
39
35
  "client": {
40
36
  "inject": [
41
- "@deepseek-ai/dsh-client-runtime",
42
37
  "@deepseek-ai/dsh-client-locale",
43
38
  "@deepseek-ai/dsh-client-ui-slots",
44
- "@deepseek-ai/dsh-client-ui-conversation"
39
+ "@deepseek-ai/dsh-client-ui-conversation",
40
+ "@deepseek-ai/dsh-client-ui-chat",
41
+ "@deepseek-ai/dsh-client-ui-renderer"
45
42
  ],
46
43
  "platform": "web"
47
44
  }
48
45
  },
49
46
  "peerDependencies": {
50
- "@deepseek-ai/dsh-client-locale": "^0.0.1-rc.1",
51
- "@deepseek-ai/dsh-client-runtime": "^0.0.1-rc.1",
52
- "@deepseek-ai/dsh-client-ui-conversation": "^0.0.1-rc.1",
53
- "@deepseek-ai/dsh-client-ui-slots": "^0.0.1-rc.1",
54
- "@deepseek-ai/dsh-invariants": "^0.0.1-rc.1",
55
- "@deepseek-ai/cordis": "^4.0.1-rc.1",
47
+ "@deepseek-ai/cordis": "^4.0.1",
48
+ "@deepseek-ai/dsh-client-ui-slots": "^0.1.2-rc.1",
49
+ "@deepseek-ai/dsh-client-locale": "^0.1.2-rc.1",
50
+ "@deepseek-ai/dsh-client-ui-chat": "^0.1.2-rc.1",
51
+ "@deepseek-ai/dsh-client-ui-conversation": "^0.1.2-rc.1",
52
+ "@deepseek-ai/dsh-client-ui-renderer": "^0.1.2-rc.1",
56
53
  "react": "^18.2.0",
57
54
  "react-dom": "^18.2.0"
58
55
  },
59
56
  "peerDependenciesMeta": {
60
- "@deepseek-ai/dsh-client-locale": {
57
+ "@deepseek-ai/cordis": {
61
58
  "optional": true
62
59
  },
63
- "@deepseek-ai/dsh-client-runtime": {
60
+ "@deepseek-ai/dsh-client-locale": {
64
61
  "optional": true
65
62
  },
66
- "@deepseek-ai/dsh-client-ui-conversation": {
63
+ "@deepseek-ai/dsh-client-ui-chat": {
67
64
  "optional": true
68
65
  },
69
- "@deepseek-ai/dsh-client-ui-slots": {
66
+ "@deepseek-ai/dsh-client-ui-conversation": {
70
67
  "optional": true
71
68
  },
72
- "@deepseek-ai/dsh-invariants": {
69
+ "@deepseek-ai/dsh-client-ui-renderer": {
73
70
  "optional": true
74
71
  },
75
- "@deepseek-ai/cordis": {
72
+ "@deepseek-ai/dsh-client-ui-slots": {
76
73
  "optional": true
77
74
  },
78
75
  "react": {
package/lib/invariant.js DELETED
@@ -1,24 +0,0 @@
1
- //#region src/invariant.ts
2
- const PACKAGE_NAME = "@huanlin/dsh-plugin-input-history";
3
- /** Cordis companion plugin name. */
4
- const name = "dsh-plugin-input-history-invariant";
5
- /** Service required before the companion can reserve package ownership. */
6
- const inject = ["invariants"];
7
- /**
8
- * No runtime invariant: the single `conversation.composer.dock` slot
9
- * registration is a registry-owned contribution whose disposal is proven
10
- * by the HMR-safety spec. The plugin's only mutable state is the
11
- * localStorage-backed history array, whose lifecycle is bounded by the
12
- * browser profile (not the cordis fiber) and whose write path is
13
- * last-writer-wins with try/catch containment.
14
- */
15
- const install = () => {};
16
- /**
17
- * Register this package's invariant companion.
18
- * @param ctx - Cordis context carrying the invariant service.
19
- * @returns the installed registration's disposer after setup succeeds.
20
- */
21
- const apply = (ctx) => Promise.resolve(ctx.invariants.register(PACKAGE_NAME, install));
22
-
23
- //#endregion
24
- export { apply, inject, name };
@@ -1,16 +0,0 @@
1
- /**
2
- * Package-owned invariant companion for `@huanlin/dsh-plugin-input-history`.
3
- *
4
- * @module @huanlin/dsh-plugin-input-history/invariant
5
- */
6
- import type { Context } from '@deepseek-ai/cordis';
7
- /** Cordis companion plugin name. */
8
- export declare const name = "dsh-plugin-input-history-invariant";
9
- /** Service required before the companion can reserve package ownership. */
10
- export declare const inject: string[];
11
- /**
12
- * Register this package's invariant companion.
13
- * @param ctx - Cordis context carrying the invariant service.
14
- * @returns the installed registration's disposer after setup succeeds.
15
- */
16
- export declare const apply: (ctx: Context) => Promise<() => void>;
@@ -1,26 +0,0 @@
1
- /**
2
- * Package-owned invariant companion for `@huanlin/dsh-plugin-input-history`.
3
- *
4
- * @module @huanlin/dsh-plugin-input-history/invariant
5
- */
6
- const PACKAGE_NAME = '@huanlin/dsh-plugin-input-history';
7
- /** Cordis companion plugin name. */
8
- export const name = 'dsh-plugin-input-history-invariant';
9
- /** Service required before the companion can reserve package ownership. */
10
- export const inject = ['invariants'];
11
- /**
12
- * No runtime invariant: the single `conversation.composer.dock` slot
13
- * registration is a registry-owned contribution whose disposal is proven
14
- * by the HMR-safety spec. The plugin's only mutable state is the
15
- * localStorage-backed history array, whose lifecycle is bounded by the
16
- * browser profile (not the cordis fiber) and whose write path is
17
- * last-writer-wins with try/catch containment.
18
- */
19
- const install = () => { };
20
- /**
21
- * Register this package's invariant companion.
22
- * @param ctx - Cordis context carrying the invariant service.
23
- * @returns the installed registration's disposer after setup succeeds.
24
- */
25
- export const apply = (ctx) => Promise.resolve(ctx.invariants.register(PACKAGE_NAME, install));
26
- /* jscpd:ignore-end */