@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.
- package/README.md +85 -2
- package/dist/chunk-b1jnq16e.js +727 -0
- package/dist/chunk-kg46s2vk.js +238 -0
- package/dist/components/chat/Chat.types.d.ts +8 -0
- package/dist/components/chat/ChatAuthoritativeQueue.d.ts +4 -0
- package/dist/components/chat/ChatSessionComposer.d.ts +4 -0
- package/dist/components/chat/ChatSessionComposer.types.d.ts +42 -0
- package/dist/components/chat/ComposerAttachment.types.d.ts +80 -0
- package/dist/components/chat/ComposerDraft.types.d.ts +89 -0
- package/dist/components/chat/ComposerProvider.types.d.ts +66 -0
- package/dist/components/chat/ComposerQueue.types.d.ts +64 -0
- package/dist/components/chat/ComposerSession.types.d.ts +78 -0
- package/dist/components/chat/ComposerSettings.d.ts +4 -0
- package/dist/components/chat/composer/CompletionList.d.ts +10 -0
- package/dist/components/chat/composer/ComposerShell.d.ts +19 -4
- package/dist/components/chat/composer/DraftLifecycle.d.ts +17 -0
- package/dist/components/chat/composer/EditorAdapter.types.d.ts +36 -0
- package/dist/components/chat/composer/PlainEditor.d.ts +2 -0
- package/dist/components/chat/composer/PlainSemanticEditor.d.ts +6 -0
- package/dist/components/chat/composer/PreservedDraft.d.ts +7 -0
- package/dist/components/chat/composer/SemanticComposer.d.ts +10 -0
- package/dist/components/chat/composer/attachments.d.ts +4 -0
- package/dist/components/chat/composer/document.d.ts +3 -1
- package/dist/components/chat/composer/drafts.d.ts +2 -0
- package/dist/components/chat/composer/providers.d.ts +40 -0
- package/dist/components/chat/composer/session.d.ts +30 -0
- package/dist/components/chat/composer/useComposerAttachments.d.ts +3 -0
- package/dist/components/chat/composer/useComposerDraft.d.ts +3 -0
- package/dist/components/chat/composer/useComposerProviders.d.ts +7 -0
- package/dist/components/chat/composer/useComposerSession.d.ts +16 -0
- package/dist/components/chat/index.d.ts +17 -0
- package/dist/components/chat/index.js +4386 -1074
- package/dist/components/chat/rich/LexicalEditor.d.ts +10 -0
- package/dist/components/chat/rich/RichChatComposer.d.ts +4 -0
- package/dist/components/chat/rich/index.d.ts +2 -0
- package/dist/components/chat/rich/index.js +3437 -0
- package/dist/components/chat/rich/nodes.d.ts +49 -0
- package/dist/generated/version.d.ts +1 -1
- package/dist/index.js +7107 -4252
- package/dist/infrastructure.js +1 -1
- package/package.json +25 -4
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import type { ComposerCapabilities, ComposerCommand, ComposerDocument, ComposerError, ComposerIntent, ComposerJson, ComposerReceipt, ComposerScope, ComposerSendableAttachment, ComposerSubmission } from "./Composer.types";
|
|
2
|
+
/** Run state is independent of admission, editing, and attachment preparation. */
|
|
3
|
+
export interface ComposerRuntimeState {
|
|
4
|
+
readonly status: "idle" | "running" | "disconnected" | "read_only";
|
|
5
|
+
readonly activeTurnId?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface ComposerActionPolicy {
|
|
8
|
+
/** Default while a run is active. Never implies that the host supports it. */
|
|
9
|
+
readonly runningIntent?: "follow_up" | "steer";
|
|
10
|
+
/** Plain Composer keeps its historical shortcut unless explicitly selected. */
|
|
11
|
+
readonly shortcut?: "modifier_enter" | "enter";
|
|
12
|
+
}
|
|
13
|
+
export interface ComposerAttempt {
|
|
14
|
+
readonly snapshot: ComposerSubmission;
|
|
15
|
+
readonly instanceId: string;
|
|
16
|
+
readonly instanceGeneration: number;
|
|
17
|
+
readonly createdAt: number;
|
|
18
|
+
readonly status: "pending" | "accepted" | "rejected" | "unknown";
|
|
19
|
+
readonly receipt?: ComposerReceipt;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* An application-owned object that outlives an editor mount. Retention does not
|
|
23
|
+
* itself promise reload persistence. Never evict pending/unknown attempts.
|
|
24
|
+
*/
|
|
25
|
+
export interface ComposerRecoveryOwner {
|
|
26
|
+
readonly getSnapshot: () => readonly ComposerAttempt[];
|
|
27
|
+
readonly subscribe: (listener: () => void) => () => void;
|
|
28
|
+
readonly retain: (attempt: ComposerAttempt) => void;
|
|
29
|
+
}
|
|
30
|
+
export interface ComposerSessionHost {
|
|
31
|
+
readonly capabilities: ComposerCapabilities;
|
|
32
|
+
readonly recovery: ComposerRecoveryOwner;
|
|
33
|
+
readonly submit: (snapshot: ComposerSubmission, signal: AbortSignal) => Promise<ComposerReceipt>;
|
|
34
|
+
/** A missing record is still unresolved; lookup never implicitly retries. */
|
|
35
|
+
readonly reconcile?: (snapshot: ComposerSubmission, signal: AbortSignal) => Promise<ComposerReceipt | {
|
|
36
|
+
readonly outcome: "not_found";
|
|
37
|
+
}>;
|
|
38
|
+
/** Explicit host authorization is required before resending the SAME snapshot. */
|
|
39
|
+
readonly authorizeRetry?: (attempt: ComposerAttempt) => Promise<boolean>;
|
|
40
|
+
/** The host catalog distinguishes prompt commands from non-prompt actions. */
|
|
41
|
+
readonly commandOperation?: (command: ComposerCommand) => "prompt" | "command";
|
|
42
|
+
}
|
|
43
|
+
export interface ComposerSessionContext {
|
|
44
|
+
readonly scope: ComposerScope;
|
|
45
|
+
readonly draftKey: string;
|
|
46
|
+
readonly document: ComposerDocument;
|
|
47
|
+
readonly revision: number;
|
|
48
|
+
readonly instanceGeneration: number;
|
|
49
|
+
readonly runtime: ComposerRuntimeState;
|
|
50
|
+
readonly host: ComposerSessionHost;
|
|
51
|
+
readonly policy?: ComposerActionPolicy;
|
|
52
|
+
readonly attachments?: readonly ComposerSendableAttachment[];
|
|
53
|
+
readonly attachmentsPending?: boolean;
|
|
54
|
+
readonly options?: Readonly<Record<string, ComposerJson>>;
|
|
55
|
+
readonly disabled?: boolean;
|
|
56
|
+
readonly busy?: boolean;
|
|
57
|
+
readonly canSubmit?: boolean;
|
|
58
|
+
readonly allowAttachmentOnly?: boolean;
|
|
59
|
+
/** Called only for the exact still-current submitted document revision. */
|
|
60
|
+
readonly onAccepted?: (snapshot: ComposerSubmission) => void;
|
|
61
|
+
/** Attachment clearing uses occurrence identity, independently of text edits. */
|
|
62
|
+
readonly onAcceptedAttachments?: (attachments: readonly ComposerSendableAttachment[]) => void;
|
|
63
|
+
}
|
|
64
|
+
export interface ComposerActionEligibility {
|
|
65
|
+
readonly allowed: boolean;
|
|
66
|
+
readonly intent?: ComposerIntent;
|
|
67
|
+
readonly operation: "prompt" | "command";
|
|
68
|
+
readonly label: string;
|
|
69
|
+
readonly reason?: string;
|
|
70
|
+
}
|
|
71
|
+
export interface ComposerSessionSnapshot {
|
|
72
|
+
readonly submitting: boolean;
|
|
73
|
+
readonly error?: ComposerError;
|
|
74
|
+
readonly lastReceipt?: ComposerReceipt;
|
|
75
|
+
/** Failed host handoffs remain inspectable, including after disposal. Export or
|
|
76
|
+
* persist these snapshots before discarding their controller. No auto-retry. */
|
|
77
|
+
readonly recoveryFailures?: readonly ComposerAttempt[];
|
|
78
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { ComposerSettingsProps } from "./ComposerQueue.types";
|
|
3
|
+
/** Host-owned choices and values. A click requests a change, never confirms it. */
|
|
4
|
+
export declare function ComposerSettings(props: ComposerSettingsProps): React.JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { ChatComposerCompletion } from "../Chat.types";
|
|
3
|
+
export declare function completionOptionId(composerId: string, candidateId: string): string;
|
|
4
|
+
export declare function CompletionList({ composerId, label, candidates, activeId, onSelect, }: {
|
|
5
|
+
composerId: string;
|
|
6
|
+
label: string;
|
|
7
|
+
candidates: readonly ChatComposerCompletion[];
|
|
8
|
+
activeId?: string;
|
|
9
|
+
onSelect: (item: ChatComposerCompletion) => void;
|
|
10
|
+
}): React.JSX.Element;
|
|
@@ -1,13 +1,24 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { ChatComposerCompletion, ChatComposerProps } from "../Chat.types";
|
|
3
|
-
import type {
|
|
3
|
+
import type { ComposerAttachmentSource } from "../ComposerAttachment.types";
|
|
4
|
+
export interface ComposerShellAttachment {
|
|
5
|
+
id: number | string;
|
|
6
|
+
file?: File;
|
|
7
|
+
name?: string;
|
|
8
|
+
previewUrl?: string;
|
|
9
|
+
state?: string;
|
|
10
|
+
status?: React.ReactNode;
|
|
11
|
+
progress?: number;
|
|
12
|
+
retry?: () => void;
|
|
13
|
+
cancel?: () => void;
|
|
14
|
+
}
|
|
4
15
|
interface ComposerShellProps extends Omit<React.ComponentProps<"div">, "children" | "onSubmit"> {
|
|
5
16
|
editor: React.ReactNode;
|
|
6
17
|
composerId: string;
|
|
7
|
-
entries: readonly
|
|
18
|
+
entries: readonly ComposerShellAttachment[];
|
|
8
19
|
renderAttachment?: ChatComposerProps["renderAttachment"];
|
|
9
|
-
removeAttachment: (id: number) => void;
|
|
10
|
-
addAttachments: (files: File[]) => void;
|
|
20
|
+
removeAttachment: (id: number | string) => void;
|
|
21
|
+
addAttachments: (files: File[], source: ComposerAttachmentSource) => void;
|
|
11
22
|
onAttachmentsChange?: ChatComposerProps["onAttachmentsChange"];
|
|
12
23
|
pickerRef: React.RefObject<HTMLInputElement | null>;
|
|
13
24
|
accept?: string;
|
|
@@ -24,6 +35,10 @@ interface ComposerShellProps extends Omit<React.ComponentProps<"div">, "children
|
|
|
24
35
|
selectCompletion: (item: ChatComposerCompletion) => void;
|
|
25
36
|
visibleError: React.ReactNode;
|
|
26
37
|
hasError: boolean;
|
|
38
|
+
intakeEvents?: boolean;
|
|
39
|
+
completionHeader?: React.ReactNode;
|
|
40
|
+
completionStatus?: React.ReactNode;
|
|
41
|
+
statusContent?: React.ReactNode;
|
|
27
42
|
attachLabel: string;
|
|
28
43
|
sendLabel: string;
|
|
29
44
|
stopLabel: string;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { ComposerDocumentUpdate, ComposerScope } from "../Composer.types";
|
|
3
|
+
import type { ComposerDraftAdapter } from "../ComposerDraft.types";
|
|
4
|
+
import type { ComposerAttachmentController } from "../ComposerAttachment.types";
|
|
5
|
+
interface Props {
|
|
6
|
+
adapter: ComposerDraftAdapter;
|
|
7
|
+
scope: ComposerScope;
|
|
8
|
+
draftKey: string;
|
|
9
|
+
generation: number;
|
|
10
|
+
value: ComposerDocumentUpdate;
|
|
11
|
+
attachments: ComposerAttachmentController;
|
|
12
|
+
onDocumentChange: (value: ComposerDocumentUpdate) => void;
|
|
13
|
+
disabled: boolean;
|
|
14
|
+
}
|
|
15
|
+
/** Host storage is optional; no autosave cadence or browser storage is assumed. */
|
|
16
|
+
export declare function DraftLifecycle({ adapter, scope, draftKey, generation, value, attachments, onDocumentChange, disabled, }: Props): React.JSX.Element;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
import type { ComposerCommand, ComposerDocumentUpdate, ComposerQuoteNode, ComposerReferenceNode } from "../Composer.types";
|
|
3
|
+
import type { ComposerProviderSelection, ComposerProviderSelectionEffect } from "../ComposerProvider.types";
|
|
4
|
+
/** Public semantic insertion commands never expose editor classes or node keys. */
|
|
5
|
+
export interface ComposerEditorHandle {
|
|
6
|
+
focus: () => void;
|
|
7
|
+
insertReference: (reference: ComposerReferenceNode) => void;
|
|
8
|
+
insertQuote: (quote: ComposerQuoteNode) => void;
|
|
9
|
+
claimCommand: (command: ComposerCommand, source: string) => void;
|
|
10
|
+
insertText: (text: string) => void;
|
|
11
|
+
applyProvider: (effect: ComposerProviderSelectionEffect) => boolean;
|
|
12
|
+
selection: () => ComposerProviderSelection | null;
|
|
13
|
+
}
|
|
14
|
+
/** Private adapter boundary; the wrapper owns providers/admission, never history. */
|
|
15
|
+
export interface ComposerEditorAdapterProps {
|
|
16
|
+
readonly value: ComposerDocumentUpdate;
|
|
17
|
+
readonly onChange: (value: ComposerDocumentUpdate) => void;
|
|
18
|
+
readonly onSelectionChange: (selection: ComposerProviderSelection | null) => void;
|
|
19
|
+
readonly instanceGeneration: number;
|
|
20
|
+
readonly disabled?: boolean;
|
|
21
|
+
readonly minRows?: number;
|
|
22
|
+
readonly maxRows?: number;
|
|
23
|
+
readonly id: string;
|
|
24
|
+
readonly label: string;
|
|
25
|
+
readonly describedBy?: string;
|
|
26
|
+
readonly invalid?: boolean;
|
|
27
|
+
readonly controls?: string;
|
|
28
|
+
readonly activeDescendant?: string;
|
|
29
|
+
readonly hasSuggestions?: boolean;
|
|
30
|
+
/** Invoked only after the adapter's IME/229 and consumer preventDefault gates. */
|
|
31
|
+
readonly onKeyDown?: React.KeyboardEventHandler<HTMLDivElement>;
|
|
32
|
+
readonly onPaste?: React.ClipboardEventHandler<HTMLDivElement>;
|
|
33
|
+
readonly onDrop?: React.DragEventHandler<HTMLDivElement>;
|
|
34
|
+
readonly onError?: (error: Error) => void;
|
|
35
|
+
readonly onReady?: (ready: boolean) => void;
|
|
36
|
+
}
|
|
@@ -3,6 +3,7 @@ import type { ChatComposerCompletionContext, ChatComposerProps } from "../Chat.t
|
|
|
3
3
|
export interface PlainEditorHandle {
|
|
4
4
|
focus: () => void;
|
|
5
5
|
selection: (value: string) => ChatComposerCompletionContext;
|
|
6
|
+
select: (start: number, end: number) => void;
|
|
6
7
|
}
|
|
7
8
|
interface PlainEditorProps {
|
|
8
9
|
value: string;
|
|
@@ -16,6 +17,7 @@ interface PlainEditorProps {
|
|
|
16
17
|
hasCompletion: boolean;
|
|
17
18
|
showCompletion: boolean;
|
|
18
19
|
activeIndex: number;
|
|
20
|
+
activeDescendant?: string;
|
|
19
21
|
onChange: (value: string) => void;
|
|
20
22
|
onKeyDown: React.KeyboardEventHandler<HTMLTextAreaElement>;
|
|
21
23
|
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { ComposerDocument } from "../Composer.types";
|
|
3
|
+
import type { ComposerEditorAdapterProps, ComposerEditorHandle } from "./EditorAdapter.types";
|
|
4
|
+
export declare function isPlainComposerDocument(document: ComposerDocument): boolean;
|
|
5
|
+
/** Native textarea adapter for protocol sessions; structured data is never flattened. */
|
|
6
|
+
export declare const PlainSemanticEditor: React.ForwardRefExoticComponent<ComposerEditorAdapterProps & React.RefAttributes<ComposerEditorHandle>>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
/** A failed/unsupported editor never replaces the host's semantic draft with text. */
|
|
3
|
+
export declare function PreservedDraft({ input, reason, state, }: {
|
|
4
|
+
input: unknown;
|
|
5
|
+
reason: string;
|
|
6
|
+
state?: "error" | "unknown" | "pending";
|
|
7
|
+
}): React.JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { ChatSessionComposerProps } from "../ChatSessionComposer.types";
|
|
3
|
+
import type { ComposerEditorAdapterProps, ComposerEditorHandle } from "./EditorAdapter.types";
|
|
4
|
+
interface Props extends ChatSessionComposerProps {
|
|
5
|
+
Editor: React.ComponentType<ComposerEditorAdapterProps & React.RefAttributes<ComposerEditorHandle>>;
|
|
6
|
+
structured: boolean;
|
|
7
|
+
}
|
|
8
|
+
/** One shell/lifecycle for semantic plain and optional rich editor adapters. */
|
|
9
|
+
export declare const SemanticComposer: React.ForwardRefExoticComponent<Props & React.RefAttributes<ComposerEditorHandle>>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ComposerAttachmentController, ComposerAttachmentIntakePolicy, ComposerAttachmentIntakeResult, ComposerAttachmentOptions, ComposerAttachmentSource } from "../ComposerAttachment.types";
|
|
2
|
+
/** Shared validation for native pickers, file paste and drops, including legacy APIs. */
|
|
3
|
+
export declare function validateComposerAttachmentIntake(files: readonly File[], existingCount: number, policy?: ComposerAttachmentIntakePolicy, source?: ComposerAttachmentSource): ComposerAttachmentIntakeResult;
|
|
4
|
+
export declare function createComposerAttachmentController(options: ComposerAttachmentOptions): ComposerAttachmentController;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ComposerDocument, ComposerDraft, ComposerScope, ComposerSubmission } from "../Composer.types";
|
|
1
|
+
import type { ComposerDocument, ComposerDraft, ComposerJson, ComposerScope, ComposerSubmission } from "../Composer.types";
|
|
2
2
|
export type ComposerReadResult<T> = {
|
|
3
3
|
readonly status: "compatible";
|
|
4
4
|
readonly value: T;
|
|
@@ -8,6 +8,8 @@ export type ComposerReadResult<T> = {
|
|
|
8
8
|
readonly input: unknown;
|
|
9
9
|
readonly reason: string;
|
|
10
10
|
};
|
|
11
|
+
/** Internal portable-data boundary shared by the lifecycle adapters. */
|
|
12
|
+
export declare function snapshotComposerJson(value: unknown): ComposerJson;
|
|
11
13
|
/** A legacy string always becomes exactly one editable text node, even if empty. */
|
|
12
14
|
export declare function migrateLegacyComposerDocument(text: string): ComposerDocument;
|
|
13
15
|
/** Unknown versions, fields and nodes remain available as the original input. */
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { ComposerProviderRequest } from "../Composer.types";
|
|
2
|
+
import type { ComposerCompletionProvider, ComposerProviderContext, ComposerProviderSelectionEffect, ComposerProviderSnapshot } from "../ComposerProvider.types";
|
|
3
|
+
type Trigger = ComposerProviderRequest["trigger"];
|
|
4
|
+
export declare function composerProviderItemId(providerId: string, candidateId: string): string;
|
|
5
|
+
/** Detect only editable text; atomic nodes and claimed commands stay adapter-owned. */
|
|
6
|
+
export declare function matchComposerProviderTrigger(context: ComposerProviderContext, provider: ComposerCompletionProvider): Trigger | undefined;
|
|
7
|
+
/** Scope-safe request bookkeeping; contains no editor state or submission behavior. */
|
|
8
|
+
export declare class ComposerProviderController {
|
|
9
|
+
private readonly prefix;
|
|
10
|
+
private requestSequence;
|
|
11
|
+
private generation;
|
|
12
|
+
private input?;
|
|
13
|
+
private disposed;
|
|
14
|
+
private dismissed;
|
|
15
|
+
private navigationProvider?;
|
|
16
|
+
private breadcrumbs;
|
|
17
|
+
private preferredActiveId?;
|
|
18
|
+
private readonly requests;
|
|
19
|
+
private readonly listeners;
|
|
20
|
+
private snapshot;
|
|
21
|
+
readonly getSnapshot: () => ComposerProviderSnapshot;
|
|
22
|
+
readonly subscribe: (listener: () => void) => () => boolean;
|
|
23
|
+
/** React StrictMode may reconnect a disposed effect without reusing old work. */
|
|
24
|
+
activate(): void;
|
|
25
|
+
update(context: ComposerProviderContext): void;
|
|
26
|
+
dismiss(): void;
|
|
27
|
+
retry(): void;
|
|
28
|
+
/** A depth of zero returns to all matching providers; default goes up one folder. */
|
|
29
|
+
back(depth?: number): void;
|
|
30
|
+
move(direction: 1 | -1): void;
|
|
31
|
+
/** Current adapter state can be supplied to close a just-invalidated selection race. */
|
|
32
|
+
select(itemId?: string | undefined, current?: ComposerProviderContext): ComposerProviderSelectionEffect | undefined;
|
|
33
|
+
dispose(): void;
|
|
34
|
+
private cancel;
|
|
35
|
+
private disabledReason;
|
|
36
|
+
private publish;
|
|
37
|
+
private query;
|
|
38
|
+
private replaceGroup;
|
|
39
|
+
}
|
|
40
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { ComposerAttempt, ComposerActionEligibility, ComposerRecoveryOwner, ComposerSessionContext, ComposerSessionSnapshot } from "../ComposerSession.types";
|
|
2
|
+
import type { ComposerIntent, ComposerReceipt, ComposerScope, ComposerSubmission } from "../Composer.types";
|
|
3
|
+
export declare function sameComposerScope(a: ComposerScope, b: ComposerScope): boolean;
|
|
4
|
+
export declare class ComposerUncertainTransportError extends Error {
|
|
5
|
+
readonly code = "uncertain_transport";
|
|
6
|
+
}
|
|
7
|
+
/** All callbacks receive detached immutable snapshots, never live editor state. */
|
|
8
|
+
export declare function createComposerRecoveryOwner(initial?: readonly ComposerAttempt[], onRetain?: (attempt: ComposerAttempt) => void): ComposerRecoveryOwner & {
|
|
9
|
+
forget: (id: string) => void;
|
|
10
|
+
};
|
|
11
|
+
/** Visible actions and keyboard gestures must share this exact policy. */
|
|
12
|
+
export declare function composerActionEligibility(context: ComposerSessionContext, requestedIntent?: ComposerIntent): ComposerActionEligibility;
|
|
13
|
+
/** Untrusted host replies cannot manufacture acceptance or prompt identities. */
|
|
14
|
+
export declare function snapshotComposerReceipt(input: unknown, submission: ComposerSubmission): ComposerReceipt;
|
|
15
|
+
export declare function createComposerSessionController(initial: ComposerSessionContext, identity: {
|
|
16
|
+
readonly instanceId: string;
|
|
17
|
+
readonly nextSubmissionId?: () => string;
|
|
18
|
+
}): {
|
|
19
|
+
/** React StrictMode may replay effects; old attempts never regain editor ownership. */
|
|
20
|
+
activate(): void;
|
|
21
|
+
getSnapshot: () => ComposerSessionSnapshot;
|
|
22
|
+
subscribe: (listener: () => void) => () => boolean;
|
|
23
|
+
update(next: ComposerSessionContext): void;
|
|
24
|
+
eligibility: (intent?: ComposerIntent) => ComposerActionEligibility;
|
|
25
|
+
submit(intent?: ComposerIntent): Promise<ComposerReceipt | undefined>;
|
|
26
|
+
reconcile(id: string): Promise<ComposerReceipt | undefined>;
|
|
27
|
+
retry(id: string): Promise<ComposerReceipt | undefined>;
|
|
28
|
+
dispose(): void;
|
|
29
|
+
};
|
|
30
|
+
export type ComposerSessionController = ReturnType<typeof createComposerSessionController>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { ComposerAttachmentOptions, UseComposerAttachmentsResult } from "../ComposerAttachment.types";
|
|
2
|
+
/** Mounted ownership only; hosts retain portable draft/recovery snapshots separately. */
|
|
3
|
+
export declare function useComposerAttachments(options: ComposerAttachmentOptions): UseComposerAttachmentsResult;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { ComposerDraftContext, UseComposerDraftResult } from "../ComposerDraft.types";
|
|
2
|
+
/** Storage policy stays with the host; this hook does not impose an autosave cadence. */
|
|
3
|
+
export declare function useComposerDraft(context: ComposerDraftContext): UseComposerDraftResult;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ComposerProviderContext } from "../ComposerProvider.types";
|
|
2
|
+
import { ComposerProviderController } from "./providers";
|
|
3
|
+
/** The adapter supplies semantic selection; this hook never reads editor DOM/history. */
|
|
4
|
+
export declare function useComposerProviders(context: ComposerProviderContext): {
|
|
5
|
+
controller: ComposerProviderController;
|
|
6
|
+
snapshot: import("..").ComposerProviderSnapshot;
|
|
7
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ComposerSessionContext } from "../ComposerSession.types";
|
|
2
|
+
/** Editing stays controlled; only admission and recovery are stored here. */
|
|
3
|
+
export declare function useComposerSession(context: ComposerSessionContext): {
|
|
4
|
+
controller: {
|
|
5
|
+
activate(): void;
|
|
6
|
+
getSnapshot: () => import("..").ComposerSessionSnapshot;
|
|
7
|
+
subscribe: (listener: () => void) => () => boolean;
|
|
8
|
+
update(next: ComposerSessionContext): void;
|
|
9
|
+
eligibility: (intent?: import("..").ComposerIntent) => import("..").ComposerActionEligibility;
|
|
10
|
+
submit(intent?: import("..").ComposerIntent): Promise<import("..").ComposerReceipt | undefined>;
|
|
11
|
+
reconcile(id: string): Promise<import("..").ComposerReceipt | undefined>;
|
|
12
|
+
retry(id: string): Promise<import("..").ComposerReceipt | undefined>;
|
|
13
|
+
dispose(): void;
|
|
14
|
+
};
|
|
15
|
+
snapshot: import("..").ComposerSessionSnapshot;
|
|
16
|
+
};
|
|
@@ -1,7 +1,24 @@
|
|
|
1
1
|
export * from "./Chat";
|
|
2
2
|
export * from "./ChatComposer";
|
|
3
|
+
export * from "./ChatSessionComposer";
|
|
4
|
+
export * from "./ChatAuthoritativeQueue";
|
|
5
|
+
export * from "./ComposerSettings";
|
|
3
6
|
export * from "./ChatPrimitives";
|
|
4
7
|
export type * from "./Chat.types";
|
|
5
8
|
export type * from "./Composer.types";
|
|
9
|
+
export type * from "./ChatSessionComposer.types";
|
|
10
|
+
export type * from "./ComposerAttachment.types";
|
|
11
|
+
export type * from "./ComposerProvider.types";
|
|
12
|
+
export type * from "./ComposerSession.types";
|
|
13
|
+
export type * from "./ComposerDraft.types";
|
|
14
|
+
export type * from "./ComposerQueue.types";
|
|
15
|
+
export { useComposerDraft } from "./composer/useComposerDraft";
|
|
16
|
+
export { createComposerDraftController } from "./composer/drafts";
|
|
17
|
+
export { useComposerAttachments } from "./composer/useComposerAttachments";
|
|
18
|
+
export { createComposerAttachmentController, validateComposerAttachmentIntake, } from "./composer/attachments";
|
|
19
|
+
export { useComposerProviders } from "./composer/useComposerProviders";
|
|
20
|
+
export { ComposerProviderController } from "./composer/providers";
|
|
21
|
+
export { useComposerSession } from "./composer/useComposerSession";
|
|
22
|
+
export { createComposerSessionController, createComposerRecoveryOwner, composerActionEligibility, ComposerUncertainTransportError, snapshotComposerReceipt, } from "./composer/session";
|
|
6
23
|
export { readComposerDocument, readComposerDraft, snapshotComposerDocument, snapshotComposerSubmission, exportComposerText, exportComposerMarkdown, } from "./composer/document";
|
|
7
24
|
export type { ComposerReadResult } from "./composer/document";
|