@duskmoon-dev/components 0.5.6 → 0.6.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.
Files changed (41) hide show
  1. package/README.md +85 -2
  2. package/dist/chunk-b1jnq16e.js +727 -0
  3. package/dist/chunk-kg46s2vk.js +238 -0
  4. package/dist/components/chat/Chat.types.d.ts +8 -0
  5. package/dist/components/chat/ChatAuthoritativeQueue.d.ts +4 -0
  6. package/dist/components/chat/ChatSessionComposer.d.ts +4 -0
  7. package/dist/components/chat/ChatSessionComposer.types.d.ts +42 -0
  8. package/dist/components/chat/ComposerAttachment.types.d.ts +80 -0
  9. package/dist/components/chat/ComposerDraft.types.d.ts +89 -0
  10. package/dist/components/chat/ComposerProvider.types.d.ts +66 -0
  11. package/dist/components/chat/ComposerQueue.types.d.ts +64 -0
  12. package/dist/components/chat/ComposerSession.types.d.ts +78 -0
  13. package/dist/components/chat/ComposerSettings.d.ts +4 -0
  14. package/dist/components/chat/composer/CompletionList.d.ts +10 -0
  15. package/dist/components/chat/composer/ComposerShell.d.ts +19 -4
  16. package/dist/components/chat/composer/DraftLifecycle.d.ts +17 -0
  17. package/dist/components/chat/composer/EditorAdapter.types.d.ts +36 -0
  18. package/dist/components/chat/composer/PlainEditor.d.ts +2 -0
  19. package/dist/components/chat/composer/PlainSemanticEditor.d.ts +6 -0
  20. package/dist/components/chat/composer/PreservedDraft.d.ts +7 -0
  21. package/dist/components/chat/composer/SemanticComposer.d.ts +10 -0
  22. package/dist/components/chat/composer/attachments.d.ts +4 -0
  23. package/dist/components/chat/composer/document.d.ts +3 -1
  24. package/dist/components/chat/composer/drafts.d.ts +2 -0
  25. package/dist/components/chat/composer/providers.d.ts +40 -0
  26. package/dist/components/chat/composer/session.d.ts +30 -0
  27. package/dist/components/chat/composer/useComposerAttachments.d.ts +3 -0
  28. package/dist/components/chat/composer/useComposerDraft.d.ts +3 -0
  29. package/dist/components/chat/composer/useComposerProviders.d.ts +7 -0
  30. package/dist/components/chat/composer/useComposerSession.d.ts +16 -0
  31. package/dist/components/chat/index.d.ts +17 -0
  32. package/dist/components/chat/index.js +4386 -1074
  33. package/dist/components/chat/rich/LexicalEditor.d.ts +10 -0
  34. package/dist/components/chat/rich/RichChatComposer.d.ts +4 -0
  35. package/dist/components/chat/rich/index.d.ts +2 -0
  36. package/dist/components/chat/rich/index.js +3437 -0
  37. package/dist/components/chat/rich/nodes.d.ts +49 -0
  38. package/dist/generated/version.d.ts +1 -1
  39. package/dist/index.js +7107 -4252
  40. package/dist/infrastructure.js +1 -1
  41. package/package.json +25 -4
package/README.md CHANGED
@@ -100,8 +100,91 @@ copy and freeze portable JSON. `exportComposerText` and `exportComposerMarkdown`
100
100
  project references through `plainText` and retain quote attribution. Invalid
101
101
  snapshots throw instead of silently discarding unsupported fields. Portable
102
102
  examples are published at `@duskmoon-dev/components/chat/contracts.v1.json`.
103
- These contracts are integration groundwork; the optional rich editor, upload
104
- transport, provider lookup and authoritative queue mutation remain separate work.
103
+ `ChatSessionComposer` uses those contracts with a controlled semantic document,
104
+ application-owned `ComposerSessionHost`, scope and draft key. The original
105
+ string/File-based `Chat.Composer` remains available with its existing ref and
106
+ callbacks. The optional editor is imported separately:
107
+
108
+ ```tsx
109
+ import { useState } from "react";
110
+ import type {
111
+ ComposerDocumentUpdate,
112
+ ComposerScope,
113
+ ComposerSessionHost,
114
+ } from "@duskmoon-dev/components/chat";
115
+ import { RichChatComposer } from "@duskmoon-dev/components/chat/rich";
116
+
117
+ export function PromptBox({
118
+ host,
119
+ scope,
120
+ }: {
121
+ host: ComposerSessionHost;
122
+ scope: ComposerScope;
123
+ }) {
124
+ const [value, setValue] = useState<ComposerDocumentUpdate>({
125
+ document: { schemaVersion: 1, content: [{ type: "text", text: "" }] },
126
+ revision: 0,
127
+ origin: "replace",
128
+ originId: "initial-draft",
129
+ });
130
+ return (
131
+ <RichChatComposer
132
+ value={value}
133
+ onDocumentChange={setValue}
134
+ scope={scope}
135
+ draftKey="main-prompt"
136
+ host={host}
137
+ />
138
+ );
139
+ }
140
+ ```
141
+
142
+ Use `ChatSessionComposer` from root or `/chat` with the same props for text-only
143
+ semantic drafts. RichChatComposer is available only from `/chat/rich`. Keep a
144
+ single compatible Lexical runtime in consumers that also import Lexical directly;
145
+ ordinary root and `/chat` imports do not initialize it.
146
+
147
+ Echo each `onDocumentChange` update unchanged. The rich editor retains selection
148
+ and undo for echoes; explicit replace, restore, scope switch and clear operations
149
+ reset its history. Remounts restore semantic content, not undo history. Its ref
150
+ inserts references, quotes, text and claimed commands without exposing Lexical.
151
+ References and quotes are atomic. Claimed command identity stays distinct from
152
+ editable skill text. Rich copy/cut includes portable semantic content and plain
153
+ text; rich paste creates fresh occurrence IDs, while external paste uses plain
154
+ text. Mixed file/text paste preserves text and validates files through the shared
155
+ picker/paste/drop policy. Unsupported content is retained for recovery rather
156
+ than silently flattened if the editor cannot load or a draft is incompatible.
157
+
158
+ Keep `host.recovery = createComposerRecoveryOwner()` outside the editor's mount
159
+ lifetime. Pending and unknown attempts retain the exact immutable submission
160
+ snapshot and ID. An accepted prompt reports actual delivery and persistence;
161
+ an accepted command returns a result without claiming a queued prompt or turn.
162
+ Unknown outcomes preserve the draft: reconcile using `host.reconcile` before any
163
+ explicit `host.authorizeRetry` of the same snapshot. Admission is not completed
164
+ generation. Stop is a separate `onStop` action and remains available while file
165
+ preparation or admission is pending. Host capabilities determine which active-turn
166
+ intents and controls are available.
167
+
168
+ Optional `attachmentOptions` validates and prepares each file occurrence, with
169
+ cancellation, progress, failure and retry. Only ready portable handles enter a
170
+ submission; runtime `File` objects and preview URLs stay out of saved documents.
171
+ Recovered files require reattachment unless the host explicitly confirms handle
172
+ recovery. A stable optional `draftAdapter` loads scoped drafts and supports explicit
173
+ Save draft; storage durability, retention and coordination with other writers
174
+ belong to the application. The UI never automatically overwrites incompatible
175
+ stored content.
176
+
177
+ `providers` supply scoped asynchronous candidates, disabled reasons, directory
178
+ drill-down and insert/invoke actions. The host resolves and authorizes references,
179
+ quote provenance, commands and attachment handles; portable validity is not
180
+ authorization. `ChatAuthoritativeQueue` renders confirmed projections and requests
181
+ revision-checked edit/remove/promote mutations. Apply canonical projections through
182
+ `onProjection`; an optimistic click does not confirm membership or order.
183
+ `ComposerSettings` likewise keeps values controlled until the host acknowledges
184
+ and applies a request. The host owns transport, model execution, uploads,
185
+ idempotency, persistence and execution policy. The Chat documentation includes
186
+ interactive fake-host examples with real local state transitions; their memory
187
+ storage survives editor remounts only and makes no durable delivery claim.
105
188
 
106
189
  Core 1.21.0 still has a known Moonlight contrast gap for neutral outlined/ghost
107
190
  labels ([duskmoonui#78](https://github.com/duskmoon-dev/duskmoonui/issues/78)).