@deepagents/react-input 7.0.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.
- package/COMPOSER_FEATURE_MATRIX.md +71 -0
- package/dist/browser.d.ts +15 -0
- package/dist/browser.d.ts.map +1 -0
- package/dist/browser.js +3406 -0
- package/dist/browser.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +166 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/Composer.d.ts +90 -0
- package/dist/lib/Composer.d.ts.map +1 -0
- package/dist/lib/ComposerAttachments.d.ts +4 -0
- package/dist/lib/ComposerAttachments.d.ts.map +1 -0
- package/dist/lib/ComposerContext.d.ts +49 -0
- package/dist/lib/ComposerContext.d.ts.map +1 -0
- package/dist/lib/ComposerCore.d.ts +57 -0
- package/dist/lib/ComposerCore.d.ts.map +1 -0
- package/dist/lib/ComposerDraft.d.ts +4 -0
- package/dist/lib/ComposerDraft.d.ts.map +1 -0
- package/dist/lib/ComposerRegistry.d.ts +43 -0
- package/dist/lib/ComposerRegistry.d.ts.map +1 -0
- package/dist/lib/ComposerSlashCommands.d.ts +4 -0
- package/dist/lib/ComposerSlashCommands.d.ts.map +1 -0
- package/dist/lib/ComposerSuggestions.d.ts +3 -0
- package/dist/lib/ComposerSuggestions.d.ts.map +1 -0
- package/dist/lib/ComposerTokenText.d.ts +6 -0
- package/dist/lib/ComposerTokenText.d.ts.map +1 -0
- package/dist/lib/ComposerTriggers.d.ts +11 -0
- package/dist/lib/ComposerTriggers.d.ts.map +1 -0
- package/dist/lib/ComposerTypes.d.ts +163 -0
- package/dist/lib/ComposerTypes.d.ts.map +1 -0
- package/dist/lib/ComposerVisibility.d.ts +3 -0
- package/dist/lib/ComposerVisibility.d.ts.map +1 -0
- package/dist/lib/PersistedPromptText.d.ts +4 -0
- package/dist/lib/PersistedPromptText.d.ts.map +1 -0
- package/dist/lib/persisted-prompt-selection.d.ts +2 -0
- package/dist/lib/persisted-prompt-selection.d.ts.map +1 -0
- package/dist/lib/tiptap/ComposerTiptapDomain.d.ts +68 -0
- package/dist/lib/tiptap/ComposerTiptapDomain.d.ts.map +1 -0
- package/dist/persisted-prompt.d.ts +47 -0
- package/dist/persisted-prompt.d.ts.map +1 -0
- package/package.json +76 -0
- package/src/styles.css +115 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# Composer Feature Matrix
|
|
2
|
+
|
|
3
|
+
This package now has one reusable composer implementation:
|
|
4
|
+
`packages/react/input/src/lib/Composer.tsx`.
|
|
5
|
+
|
|
6
|
+
`Composer` is backed by Tiptap/ProseMirror, but the public package API is
|
|
7
|
+
editor-agnostic. Treat it as a structured prompt composer, not a Markdown editor
|
|
8
|
+
or a plain textarea.
|
|
9
|
+
|
|
10
|
+
## Source Notes
|
|
11
|
+
|
|
12
|
+
- Open-source Codex TUI references used during the original audit:
|
|
13
|
+
- `codex-rs/tui/src/chat_composer.rs`
|
|
14
|
+
- `codex-rs/tui/src/bottom_pane/textarea.rs`
|
|
15
|
+
- `codex-rs/tui/src/bottom_pane/command_popup.rs`
|
|
16
|
+
- `codex-rs/tui/src/bottom_pane/slash_input.rs`
|
|
17
|
+
- `codex-rs/tui/src/bottom_pane/attachment_state.rs`
|
|
18
|
+
- `codex-rs/tui/src/bottom_pane/input_queue.rs`
|
|
19
|
+
- `codex-rs/tui/src/bottom_pane/input_restore.rs`
|
|
20
|
+
- `codex-rs/tui/src/keymap.rs`
|
|
21
|
+
- Current Codex desktop/web behavior added to the local contract:
|
|
22
|
+
- slash suggestions and structured slash marks work after whitespace/newlines
|
|
23
|
+
- mentions work anywhere in the editor
|
|
24
|
+
- selecting text and pasting a URL creates a labeled text link
|
|
25
|
+
- rich-link atoms and text-link marks are distinct structured items
|
|
26
|
+
|
|
27
|
+
## Feature Status
|
|
28
|
+
|
|
29
|
+
| Feature | Status | Local Contract |
|
|
30
|
+
| ---------------------------- | ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
31
|
+
| Structured composer state | Supported | The editor serializes to `ComposerState`; public submissions expose only canonical `prompt`, `persistedPrompt`, and semantic items. Editor-only marks never become a parallel transport protocol. |
|
|
32
|
+
| Public compound API | Supported | `Composer.Root`, `Content`, `Toolbar`, `Editor`, `RemoteImages`, `Attachments`, `Error`, `Popup`, `Shortcuts`, `Footer`, `AttachFiles`, `AddRemoteImage`, `InsertPaste`, `InsertRichLink`, `Submit`, and `Reset`. Action triggers are Base UI `Button`s, so `render`, `nativeButton`, and `focusableWhenDisabled` come from it. |
|
|
33
|
+
| Host initialization | Supported | Hosts pass restorable prompt content through `initialDraft`. Controller-only fields such as cursor, inline error, history cursor, reverse search, and kill buffer stay internal. |
|
|
34
|
+
| Draft persistence | Supported | `Composer.Root` accepts a host-supplied `draftKey`, hydrates that draft from `localStorage`, writes on state changes, holds it while an asynchronous `onSubmit` is in flight, clears it on success, and restores it on failure. |
|
|
35
|
+
| Slash commands | Supported | Slash suggestions complete into editable prompt text. Custom prompts use plain `/prompts:<id>` text and expand at submission; built-in command marks remain editor-only. Unknown or disabled leading commands preserve the draft and show inline errors. |
|
|
36
|
+
| Slash filtering and ordering | Supported | Commands and mention candidates support `visibility` (`always`, `hidden`, `before-interaction`, `after-interaction` — phase-gated by the host-supplied `hasInteracted` prop on `Composer.Root`); commands additionally support `aliases`, `searchTerms`, and `availability`. Visible enabled suggestions are ranked by exact/prefix matches and capped. Command resolution (`findSlashCommandByName`) ignores visibility, matching hidden-command behavior. |
|
|
37
|
+
| Mentions | Supported | `/` discovers commands and all mention candidates in one flat list. `@` and `$` remain direct candidate filters. Accepted candidates submit structured items and unmatched mention text can remain literal prompt text. |
|
|
38
|
+
| Popup routing | Supported | One popup model owns navigation for `/`, `@`, and `$`: arrows, Ctrl+P/Ctrl+N, Escape, Tab/Enter insertion, mouse row activation, and direct index acceptance through compound consumers. A second `/` remains ordinary text. |
|
|
39
|
+
| Keyboard shortcuts | Supported subset | Covered user-facing shortcuts include Enter submit/queue, idle Tab no-submit, Shift+Enter and Alt/Ctrl newline paths, Ctrl/Meta+A replacement, Ctrl+E, Ctrl+K/U/W/Y, Alt+B/F, Ctrl/Alt+Left/Right, Ctrl+P/N history, and Ctrl+R/Ctrl+S reverse-history cycling. |
|
|
40
|
+
| Atomic deletion | Supported | Mention, image-attachment, paste, rich-link, and mixed atom/text-link selections prune the matching structured payloads. Slash marks are editable and stale slash metadata is pruned when visible text no longer matches. |
|
|
41
|
+
| Paste and drop | Supported | Image `File`s become attachments; other clipboard/drop files and local paths become file mentions; HTTP(S) DownloadURL values become links; large text becomes paste payloads. A path ending in an image extension is still only a file reference because it carries no bytes. |
|
|
42
|
+
| Text links | Supported | Selected text plus URL paste keeps the selected label and emits a structured `link` item. Collapsed URL paste creates a URL-labeled text link. Non-URL paste over a link clears stale metadata. |
|
|
43
|
+
| Rich links | Supported | Rich-link atoms submit `rich_link` items and can preserve optional host-provided unfurl metadata. Fetching/caching unfurl data remains host-owned. |
|
|
44
|
+
| Remote images | Supported | Remote images can submit without prompt text, can be keyboard selected/removed, and affect attachment renumbering. |
|
|
45
|
+
| Media attachments | Supported | Pasted, dropped, and file-input image, video, and audio files keep their `File` in `Composer.Root` memory behind a required internal attachment ID. Public `image`, `video`, and `audio` submission items contain the required `File`; they never expose an ID or path. Because browser `File`s are not persistable, drafts and history retain the surrounding text but omit attachments entirely. `Composer.Attachments` renders object-URL previews with a remove button, and `Composer.AttachFiles` opens a hidden `image/*,video/*,audio/*` file input. No size or count limits. |
|
|
46
|
+
| Empty submission policy | Host-owned | `onSubmit` fires for every submit gesture, including an empty editor (synthesized empty payload). Hosts decide whether an empty submission is meaningful (e.g. payloads living outside the editor, like annotations) and guard in `onSubmit`. Empty submissions are never recorded in history; `disabled` and modal guards still block the gesture itself. |
|
|
47
|
+
| Disabled/modal guard | Supported | `disabled` blocks typing, paste, toolbar mutations, keyboard submit, action triggers, and remote-image-only submit while still rendering current content. |
|
|
48
|
+
| Prompt length cap | Supported | `maxExpandedTextChars` rejects oversized expanded text before `onSubmit` and preserves the visible draft plus hidden paste payloads. |
|
|
49
|
+
| Shortcut overlay | Supported | `?` toggles shortcuts only while the draft is empty; non-empty `?` remains editable text. Terminal paste-burst state is not implemented. |
|
|
50
|
+
| Queue handoff | Supported as host-owned | `onSubmit` emits the narrow transport separately from a `ComposerDraftSource`. The host stores immutable resolved execution alongside the editable persisted source and its persistable paste sidecars. |
|
|
51
|
+
| History | Supported as editor behavior | In-memory history reuses `ComposerDraftSource`; recall reparses canonical prompt text and reapplies persistable remote-image and paste sidecars. Browser file attachments are deliberately excluded because their bytes cannot be restored. |
|
|
52
|
+
| Shell mode | Supported subset | Leading `!` enters shell mode, submits shell args with Enter, suppresses slash metadata, and exits at a bare shell prompt with Escape/Backspace. |
|
|
53
|
+
| Terminal footer hyperlink | Not supported | This is a TUI status-line feature, not part of the browser composer body. |
|
|
54
|
+
|
|
55
|
+
## Removed With Textarea Migration
|
|
56
|
+
|
|
57
|
+
- Handrolled textarea source and tests.
|
|
58
|
+
- Overlay-token rendering.
|
|
59
|
+
- Textarea DOM selection contracts such as `selectionStart`/`selectionEnd`.
|
|
60
|
+
- Cursor movement over serialized placeholder text.
|
|
61
|
+
- Textarea range bookkeeping for link/mention metadata.
|
|
62
|
+
- Side-by-side textarea/Tiptap playground comparison.
|
|
63
|
+
|
|
64
|
+
## Non-Goals Unless Requested
|
|
65
|
+
|
|
66
|
+
- Terminal paste-burst heuristics.
|
|
67
|
+
- Vim-mode composer editing.
|
|
68
|
+
- Terminal status-line hyperlinks.
|
|
69
|
+
- Full queue ownership inside `@deepagents/react-input`.
|
|
70
|
+
- Durable history storage inside `@deepagents/react-input`.
|
|
71
|
+
- Rich-link unfurl fetching/caching inside `@deepagents/react-input`.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export * from './index.ts';
|
|
2
|
+
export { Composer } from './lib/Composer.tsx';
|
|
3
|
+
export { useComposer } from './lib/ComposerContext.ts';
|
|
4
|
+
export type { ComposerAcceptSuggestionOptions, ComposerActions, ComposerContextApi, ComposerMeta, } from './lib/ComposerContext.ts';
|
|
5
|
+
export type { ComposerAttachmentsProps } from './lib/ComposerAttachments.tsx';
|
|
6
|
+
export { ComposerTokenText } from './lib/ComposerTokenText.tsx';
|
|
7
|
+
export { PersistedPromptText } from './lib/PersistedPromptText.tsx';
|
|
8
|
+
export { reconstructPersistedPromptSelection } from './lib/persisted-prompt-selection.ts';
|
|
9
|
+
export type { ComposerRootProps, ComposerAddRemoteImageProps, ComposerAttachFilesProps, ComposerContentProps, ComposerEditorProps, ComposerErrorProps, ComposerFooterProps, ComposerInsertPasteProps, ComposerInsertRichLinkProps, ComposerPopupProps, ComposerRemoteImagesProps, ComposerResetProps, ComposerShortcutsProps, ComposerSubmitProps, ComposerSubmitContext, ComposerToolbarProps, } from './lib/Composer.tsx';
|
|
10
|
+
export { createComposerState, createComposerDraftSource, createDraftFromPersistedText, createDraftFromSource, createDraftFromState, createPersistedTextFromDraft, decodeComposerTextLinkHref, prepareComposerPayload, pushComposerHistory, } from './lib/ComposerCore.ts';
|
|
11
|
+
export type { ComposerPreparedPayload } from './lib/ComposerCore.ts';
|
|
12
|
+
export { isVisibleInPhase } from './lib/ComposerVisibility.ts';
|
|
13
|
+
export type { ActivePopup, ComposerDropTransfer, ComposerVisibility, ComposerSubmissionItem, ComposerInitialDraft, ComposerDraftSource, ComposerItemBinding, ComposerPendingPaste, ComposerRemoteImage, ComposerRichLinkMetadata, ComposerState, ComposerSubmission, ComposerSuggestion, ComposerPopupTrigger, ComposerTextElement, ComposerItemEntry, ComposerItem, ComposerTriggerSets, CreateComposerStateOptions, } from './lib/ComposerTypes.ts';
|
|
14
|
+
export type { ComposerCommandProps, ComposerMentionProps, ComposerTriggerProps, } from './lib/ComposerRegistry.tsx';
|
|
15
|
+
//# sourceMapping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