@superxd-studio/adptr 0.5.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 (221) hide show
  1. package/GENERATIVE.md +101 -0
  2. package/INTERACTIONS.md +51 -0
  3. package/LICENSE +21 -0
  4. package/README.md +57 -0
  5. package/REUSE.md +170 -0
  6. package/REVIEW.md +68 -0
  7. package/THIRD-PARTY-NOTICES.md +28 -0
  8. package/ai-sdk/index.js +96 -0
  9. package/assets/ibm-plex-mono-cyrillic-400-normal.woff2 +0 -0
  10. package/assets/ibm-plex-mono-cyrillic-500-normal.woff2 +0 -0
  11. package/assets/ibm-plex-mono-cyrillic-ext-400-normal.woff2 +0 -0
  12. package/assets/ibm-plex-mono-cyrillic-ext-500-normal.woff2 +0 -0
  13. package/assets/ibm-plex-mono-latin-400-normal.woff2 +0 -0
  14. package/assets/ibm-plex-mono-latin-500-normal.woff2 +0 -0
  15. package/assets/ibm-plex-mono-latin-ext-400-normal.woff2 +0 -0
  16. package/assets/ibm-plex-mono-latin-ext-500-normal.woff2 +0 -0
  17. package/assets/ibm-plex-mono-vietnamese-400-normal.woff2 +0 -0
  18. package/assets/ibm-plex-mono-vietnamese-500-normal.woff2 +0 -0
  19. package/assets/instrument-sans-latin-ext-wght-normal.woff2 +0 -0
  20. package/assets/instrument-sans-latin-wght-normal.woff2 +0 -0
  21. package/assistant-ui/index.js +139 -0
  22. package/chunks/callout-DKMHSnjc.js +342 -0
  23. package/chunks/canvas-BJ15-XxE.js +598 -0
  24. package/chunks/controller-Cfpg0C7v.js +180 -0
  25. package/chunks/core-BCqVRLUy.js +312 -0
  26. package/chunks/text-field-BLtoaZFn.js +41 -0
  27. package/chunks/types-BGF7r1my.js +115 -0
  28. package/chunks/ui-9DyNsYXY.js +967 -0
  29. package/core/index.js +4 -0
  30. package/custom/index.js +64 -0
  31. package/examples/ai-sdk-backend/package.json +11 -0
  32. package/examples/ai-sdk-backend/server.mjs +316 -0
  33. package/examples/custom-backend/copy.mjs +7 -0
  34. package/examples/custom-backend/server.mjs +118 -0
  35. package/examples/generative/specs.json +2094 -0
  36. package/examples/review-backend/copy.mjs +27 -0
  37. package/examples/review-backend/package.json +11 -0
  38. package/examples/review-backend/server.mjs +276 -0
  39. package/examples/web-ai-sdk/index.html +12 -0
  40. package/examples/web-ai-sdk/package.json +21 -0
  41. package/examples/web-ai-sdk/src/copy.ts +1 -0
  42. package/examples/web-ai-sdk/src/main.tsx +64 -0
  43. package/examples/web-ai-sdk/tsconfig.json +13 -0
  44. package/examples/web-generative/index.html +12 -0
  45. package/examples/web-generative/package.json +23 -0
  46. package/examples/web-generative/src/copy.ts +42 -0
  47. package/examples/web-generative/src/main.tsx +74 -0
  48. package/examples/web-generative/tsconfig.json +14 -0
  49. package/examples/web-independent/index.html +12 -0
  50. package/examples/web-independent/package.json +20 -0
  51. package/examples/web-independent/src/main.tsx +32 -0
  52. package/examples/web-independent/tsconfig.json +14 -0
  53. package/examples/web-interactions/index.html +12 -0
  54. package/examples/web-interactions/package.json +21 -0
  55. package/examples/web-interactions/src/copy.ts +215 -0
  56. package/examples/web-interactions/src/examples.tsx +628 -0
  57. package/examples/web-interactions/src/main.tsx +116 -0
  58. package/examples/web-interactions/tsconfig.json +14 -0
  59. package/examples/web-review/index.html +12 -0
  60. package/examples/web-review/package.json +20 -0
  61. package/examples/web-review/src/main.tsx +59 -0
  62. package/examples/web-review/tsconfig.json +14 -0
  63. package/fonts.css +117 -0
  64. package/generative/index.js +1560 -0
  65. package/interactions/index.js +1591 -0
  66. package/langgraph-review/index.js +36 -0
  67. package/licenses/ai-sdk.txt +13 -0
  68. package/licenses/assistant-ui-generative.txt +21 -0
  69. package/licenses/assistant-ui.txt +23 -0
  70. package/licenses/ibm-plex-mono.txt +93 -0
  71. package/licenses/instrument-sans.txt +93 -0
  72. package/licenses/internationalized-date.txt +201 -0
  73. package/licenses/langgraph.txt +21 -0
  74. package/licenses/lucide.txt +43 -0
  75. package/licenses/react-markdown.txt +21 -0
  76. package/licenses/remark-gfm.txt +22 -0
  77. package/licenses/zod.txt +21 -0
  78. package/package.json +138 -0
  79. package/review/index.js +31 -0
  80. package/source/components/avatar.tsx +50 -0
  81. package/source/components/button.tsx +155 -0
  82. package/source/components/callout.tsx +65 -0
  83. package/source/components/canvas/connector.tsx +14 -0
  84. package/source/components/canvas/copy.ts +34 -0
  85. package/source/components/canvas/index.tsx +257 -0
  86. package/source/components/canvas/recorder.ts +36 -0
  87. package/source/components/date-time-field.tsx +77 -0
  88. package/source/components/flow-motion.tsx +109 -0
  89. package/source/components/icons.tsx +275 -0
  90. package/source/components/responsive-overlay.tsx +91 -0
  91. package/source/components/scenario-picker/copy.ts +5 -0
  92. package/source/components/scenario-picker/index.tsx +142 -0
  93. package/source/components/scroll-area.tsx +59 -0
  94. package/source/components/search-picker.tsx +127 -0
  95. package/source/components/segmented-control.tsx +123 -0
  96. package/source/components/skeleton.tsx +11 -0
  97. package/source/components/spinner.tsx +19 -0
  98. package/source/components/superxd-arrow.tsx +22 -0
  99. package/source/components/switch.tsx +45 -0
  100. package/source/components/text-field.tsx +81 -0
  101. package/source/components/thinking.tsx +16 -0
  102. package/source/components/ui/copy.ts +12 -0
  103. package/source/components/ui/display.tsx +276 -0
  104. package/source/components/ui/navigation.tsx +346 -0
  105. package/source/components/ui/portal-theme.tsx +28 -0
  106. package/source/components/ui/selection.tsx +336 -0
  107. package/source/lib/cn.ts +23 -0
  108. package/source/reusable/ai-sdk/index.ts +114 -0
  109. package/source/reusable/assistant-ui/index.tsx +266 -0
  110. package/source/reusable/core/attachments.ts +163 -0
  111. package/source/reusable/core/index.ts +417 -0
  112. package/source/reusable/custom/index.ts +90 -0
  113. package/source/reusable/generative/actions.ts +188 -0
  114. package/source/reusable/generative/copy.ts +47 -0
  115. package/source/reusable/generative/data.tsx +126 -0
  116. package/source/reusable/generative/index.tsx +517 -0
  117. package/source/reusable/generative/schema.ts +327 -0
  118. package/source/reusable/generative/timeline.tsx +214 -0
  119. package/source/reusable/generative/vocabulary.tsx +847 -0
  120. package/source/reusable/interactions/agent.ts +259 -0
  121. package/source/reusable/interactions/artifact.ts +236 -0
  122. package/source/reusable/interactions/context.tsx +38 -0
  123. package/source/reusable/interactions/copy.ts +117 -0
  124. package/source/reusable/interactions/feedback.ts +73 -0
  125. package/source/reusable/interactions/index.ts +11 -0
  126. package/source/reusable/interactions/presentation.tsx +483 -0
  127. package/source/reusable/interactions/store.ts +74 -0
  128. package/source/reusable/interactions/threads.ts +126 -0
  129. package/source/reusable/interactions/web.tsx +574 -0
  130. package/source/reusable/langgraph-review/index.ts +73 -0
  131. package/source/reusable/review/controller.ts +263 -0
  132. package/source/reusable/review/index.ts +47 -0
  133. package/source/reusable/review/types.ts +189 -0
  134. package/source/reusable/ui/index.ts +25 -0
  135. package/source/reusable/uploads/index.ts +48 -0
  136. package/source/reusable/web/attachments/copy.ts +23 -0
  137. package/source/reusable/web/attachments/index.tsx +233 -0
  138. package/source/reusable/web/copy.ts +22 -0
  139. package/source/reusable/web/index.tsx +470 -0
  140. package/source/reusable/web/message/copy.ts +26 -0
  141. package/source/reusable/web/message/index.tsx +388 -0
  142. package/source/reusable/web/message/streaming.ts +64 -0
  143. package/source/reusable/web/message/styles.css +21 -0
  144. package/source/reusable/web/review/copy.ts +78 -0
  145. package/source/reusable/web/review/flow.ts +24 -0
  146. package/source/reusable/web/review/index.tsx +506 -0
  147. package/source/reusable/web/styles.ts +2 -0
  148. package/source/styles/library.css +612 -0
  149. package/source/styles/theme.css +228 -0
  150. package/styles.css +3 -0
  151. package/styles.d.ts +1 -0
  152. package/types/components/avatar.d.ts +14 -0
  153. package/types/components/button.d.ts +36 -0
  154. package/types/components/callout.d.ts +19 -0
  155. package/types/components/canvas/connector.d.ts +2 -0
  156. package/types/components/canvas/copy.d.ts +34 -0
  157. package/types/components/canvas/index.d.ts +33 -0
  158. package/types/components/canvas/recorder.d.ts +10 -0
  159. package/types/components/date-time-field.d.ts +11 -0
  160. package/types/components/flow-motion.d.ts +38 -0
  161. package/types/components/icons.d.ts +138 -0
  162. package/types/components/responsive-overlay.d.ts +15 -0
  163. package/types/components/scenario-picker/copy.d.ts +5 -0
  164. package/types/components/scenario-picker/index.d.ts +14 -0
  165. package/types/components/scroll-area.d.ts +14 -0
  166. package/types/components/search-picker.d.ts +27 -0
  167. package/types/components/segmented-control.d.ts +23 -0
  168. package/types/components/skeleton.d.ts +4 -0
  169. package/types/components/spinner.d.ts +4 -0
  170. package/types/components/superxd-arrow.d.ts +5 -0
  171. package/types/components/switch.d.ts +8 -0
  172. package/types/components/text-field.d.ts +19 -0
  173. package/types/components/thinking.d.ts +8 -0
  174. package/types/components/ui/copy.d.ts +12 -0
  175. package/types/components/ui/display.d.ts +50 -0
  176. package/types/components/ui/navigation.d.ts +63 -0
  177. package/types/components/ui/portal-theme.d.ts +8 -0
  178. package/types/components/ui/selection.d.ts +37 -0
  179. package/types/lib/cn.d.ts +3 -0
  180. package/types/reusable/ai-sdk/index.d.ts +15 -0
  181. package/types/reusable/assistant-ui/index.d.ts +12 -0
  182. package/types/reusable/core/attachments.d.ts +54 -0
  183. package/types/reusable/core/index.d.ts +107 -0
  184. package/types/reusable/custom/index.d.ts +14 -0
  185. package/types/reusable/generative/actions.d.ts +45 -0
  186. package/types/reusable/generative/copy.d.ts +48 -0
  187. package/types/reusable/generative/data.d.ts +4 -0
  188. package/types/reusable/generative/index.d.ts +30 -0
  189. package/types/reusable/generative/schema.d.ts +303 -0
  190. package/types/reusable/generative/timeline.d.ts +21 -0
  191. package/types/reusable/generative/vocabulary.d.ts +34 -0
  192. package/types/reusable/interactions/agent.d.ts +98 -0
  193. package/types/reusable/interactions/artifact.d.ts +118 -0
  194. package/types/reusable/interactions/context.d.ts +130 -0
  195. package/types/reusable/interactions/copy.d.ts +115 -0
  196. package/types/reusable/interactions/feedback.d.ts +34 -0
  197. package/types/reusable/interactions/index.d.ts +10 -0
  198. package/types/reusable/interactions/presentation.d.ts +97 -0
  199. package/types/reusable/interactions/store.d.ts +29 -0
  200. package/types/reusable/interactions/threads.d.ts +38 -0
  201. package/types/reusable/interactions/web.d.ts +22 -0
  202. package/types/reusable/langgraph-review/index.d.ts +5 -0
  203. package/types/reusable/review/controller.d.ts +52 -0
  204. package/types/reusable/review/index.d.ts +12 -0
  205. package/types/reusable/review/types.d.ts +61 -0
  206. package/types/reusable/ui/index.d.ts +19 -0
  207. package/types/reusable/uploads/index.d.ts +11 -0
  208. package/types/reusable/web/attachments/copy.d.ts +25 -0
  209. package/types/reusable/web/attachments/index.d.ts +24 -0
  210. package/types/reusable/web/copy.d.ts +24 -0
  211. package/types/reusable/web/index.d.ts +41 -0
  212. package/types/reusable/web/message/copy.d.ts +27 -0
  213. package/types/reusable/web/message/index.d.ts +56 -0
  214. package/types/reusable/web/message/streaming.d.ts +27 -0
  215. package/types/reusable/web/review/copy.d.ts +72 -0
  216. package/types/reusable/web/review/flow.d.ts +3 -0
  217. package/types/reusable/web/review/index.d.ts +38 -0
  218. package/types/reusable/web/styles.d.ts +2 -0
  219. package/ui/index.js +4 -0
  220. package/uploads/index.js +34 -0
  221. package/web/index.js +931 -0
@@ -0,0 +1,22 @@
1
+ import { type ReactNode } from "react";
2
+ import type { AgentController } from "./agent.js";
3
+ import type { ArtifactController } from "./artifact.js";
4
+ import type { FeedbackController } from "./feedback.js";
5
+ import type { ThreadController, ThreadDocument } from "./threads.js";
6
+ export declare function AgentSupervision({ controller, label, }: {
7
+ controller: AgentController;
8
+ label?: string;
9
+ }): import("react").JSX.Element;
10
+ export declare function ArtifactWorkspace({ controller, label, }: {
11
+ controller: ArtifactController;
12
+ label?: string;
13
+ }): import("react").JSX.Element;
14
+ export declare function ResponseFeedback({ controller, label, }: {
15
+ controller: FeedbackController;
16
+ label?: string;
17
+ }): import("react").JSX.Element;
18
+ export declare function ConversationHistory({ controller, renderThread, label, }: {
19
+ controller: ThreadController;
20
+ renderThread: (thread: ThreadDocument) => ReactNode;
21
+ label?: string;
22
+ }): import("react").JSX.Element;
@@ -0,0 +1,5 @@
1
+ import { type ReviewProposal, type ReviewDecision, type ReviewReceipt } from "../review/types.js";
2
+ export declare function createLangGraphReviewDriver(commit: (decision: ReviewDecision) => Promise<ReviewReceipt>): {
3
+ start(proposal: ReviewProposal, threadId: string): Promise<import("@langchain/langgraph").Interrupt<unknown> | undefined>;
4
+ resume(value: ReviewDecision, threadId: string): Promise<ReviewReceipt>;
5
+ };
@@ -0,0 +1,52 @@
1
+ import { type ReviewAdapter, type ReviewDecision, type ReviewRecord, type ReviewReceipt, type ReviewSnapshot } from "./types.js";
2
+ type Action = {
3
+ type: "loading";
4
+ } | {
5
+ type: "loaded";
6
+ record: ReviewRecord;
7
+ } | {
8
+ type: "selected";
9
+ ids: readonly string[];
10
+ } | {
11
+ type: "prepared";
12
+ decision: ReviewDecision;
13
+ } | {
14
+ type: "back";
15
+ } | {
16
+ type: "sending";
17
+ } | {
18
+ type: "checking";
19
+ } | {
20
+ type: "settled";
21
+ receipt: ReviewReceipt;
22
+ } | {
23
+ type: "unapplied";
24
+ } | {
25
+ type: "failed";
26
+ status: "load-error" | "uncertain" | "conflict" | "blocked";
27
+ };
28
+ /** One owner for the task, selection and immutable confirmation across all presentations. */
29
+ export declare function reviewReducer(state: ReviewSnapshot, action: Action): ReviewSnapshot;
30
+ export declare class ReviewController {
31
+ private adapter;
32
+ private newId;
33
+ private state;
34
+ private listeners;
35
+ private operation;
36
+ private generation;
37
+ constructor(adapter: ReviewAdapter, newId?: () => string);
38
+ getSnapshot: () => ReviewSnapshot;
39
+ subscribe: (callback: () => void) => (() => void);
40
+ private dispatch;
41
+ private run;
42
+ load: () => boolean;
43
+ select: (id: string, selected: boolean) => boolean;
44
+ prepare: (choice: ReviewDecision["choice"]) => boolean;
45
+ back: () => boolean;
46
+ private verifyReceipt;
47
+ submit: () => boolean;
48
+ recover: () => boolean;
49
+ /** End host-owned observation explicitly, never on a presentation unmount. Cannot undo server work. */
50
+ disconnect: () => void;
51
+ }
52
+ export {};
@@ -0,0 +1,12 @@
1
+ export * from "./types.js";
2
+ export { ReviewController, reviewReducer } from "./controller.js";
3
+ import { type ReviewAdapter } from "./types.js";
4
+ export interface HttpReviewOptions {
5
+ /** URL for an existing customer-owned review. Never place credentials in this URL. */
6
+ endpoint: string;
7
+ headers?: () => HeadersInit | Promise<HeadersInit>;
8
+ credentials?: RequestCredentials;
9
+ fetch?: typeof globalThis.fetch;
10
+ timeoutMs?: number;
11
+ }
12
+ export declare function createHttpReviewAdapter(options: HttpReviewOptions): ReviewAdapter;
@@ -0,0 +1,61 @@
1
+ /** Portable review contract. The host owns authorization, revisions and side effects. */
2
+ export interface ReviewChange {
3
+ readonly id: string;
4
+ readonly title: string;
5
+ readonly before: string;
6
+ readonly after: string;
7
+ readonly reason: string;
8
+ }
9
+ export interface ReviewProposal {
10
+ readonly id: string;
11
+ readonly revision: number;
12
+ readonly title: string;
13
+ readonly destination: string;
14
+ readonly changes: readonly ReviewChange[];
15
+ readonly canDecide: boolean;
16
+ }
17
+ export interface ReviewRecord {
18
+ readonly proposal: ReviewProposal;
19
+ readonly appliedIds: readonly string[];
20
+ readonly remainingIds: readonly string[];
21
+ readonly outcome: "pending" | "partial" | "complete" | "denied";
22
+ }
23
+ export interface ReviewDecision {
24
+ readonly requestId: string;
25
+ readonly proposalId: string;
26
+ readonly revision: number;
27
+ readonly choice: "approve" | "deny";
28
+ readonly changeIds: readonly string[];
29
+ }
30
+ export interface ReviewReceipt {
31
+ readonly requestId: string;
32
+ readonly choice: "approve" | "deny";
33
+ readonly appliedIds: readonly string[];
34
+ readonly record: ReviewRecord;
35
+ }
36
+ export interface ReviewRecovery {
37
+ readonly record: ReviewRecord;
38
+ readonly receipt: ReviewReceipt | null;
39
+ }
40
+ export interface ReviewAdapter {
41
+ load(signal: AbortSignal): Promise<ReviewRecord>;
42
+ decide(decision: ReviewDecision, signal: AbortSignal): Promise<ReviewReceipt>;
43
+ recover(requestId: string, signal: AbortSignal): Promise<ReviewRecovery>;
44
+ }
45
+ export type ReviewStatus = "idle" | "loading" | "ready" | "confirming" | "submitting" | "checking" | "load-error" | "uncertain" | "conflict" | "blocked" | "partial" | "complete" | "denied";
46
+ export interface ReviewSnapshot {
47
+ readonly status: ReviewStatus;
48
+ readonly record: ReviewRecord | null;
49
+ readonly selectedIds: readonly string[];
50
+ readonly decision: ReviewDecision | null;
51
+ readonly issue: "not-applied" | null;
52
+ }
53
+ export declare class ReviewFault extends Error {
54
+ readonly kind: "conflict" | "blocked";
55
+ constructor(kind: "conflict" | "blocked");
56
+ }
57
+ export declare function parseReviewProposal(value: unknown): ReviewProposal;
58
+ export declare function parseReviewDecision(value: unknown): ReviewDecision;
59
+ export declare function parseReviewRecord(value: unknown): ReviewRecord;
60
+ export declare function parseReviewReceipt(value: unknown): ReviewReceipt;
61
+ export declare function parseReviewRecovery(value: unknown): ReviewRecovery;
@@ -0,0 +1,19 @@
1
+ /** Standalone React web foundations, styled by the host's SuperXD tokens. */
2
+ export * from "../../components/ui/selection.js";
3
+ export * from "../../components/ui/navigation.js";
4
+ export * from "../../components/ui/display.js";
5
+ export { uiCopy } from "../../components/ui/copy.js";
6
+ export { Button, ButtonLink, TextLink, buttonStyles } from "../../components/button.js";
7
+ export type { ButtonProps, ButtonLinkProps, ButtonSize, ButtonVariant, } from "../../components/button.js";
8
+ export type { TextFieldProps } from "../../components/text-field.js";
9
+ export { Switch } from "../../components/switch.js";
10
+ export { SearchPicker } from "../../components/search-picker.js";
11
+ export { SegmentedControl } from "../../components/segmented-control.js";
12
+ export { Callout } from "../../components/callout.js";
13
+ export { Avatar } from "../../components/avatar.js";
14
+ export { Skeleton } from "../../components/skeleton.js";
15
+ export { Spinner } from "../../components/spinner.js";
16
+ export { ScrollArea } from "../../components/scroll-area.js";
17
+ export { ResponsiveOverlay } from "../../components/responsive-overlay.js";
18
+ export { DateTimeField } from "../../components/date-time-field.js";
19
+ export { ScenarioPicker } from "../../components/scenario-picker/index.js";
@@ -0,0 +1,11 @@
1
+ import { type UploadAdapter } from "../core/index.js";
2
+ export interface HttpUploadOptions {
3
+ endpoint: string;
4
+ headers?: () => HeadersInit | Promise<HeadersInit>;
5
+ credentials?: RequestCredentials;
6
+ fetch?: typeof globalThis.fetch;
7
+ /** Consumer-provided deletion endpoint, only for draft references it owns. */
8
+ releaseEndpoint?: (id: string) => string;
9
+ }
10
+ /** Raw binary upload, with Unicode-safe filename metadata. Auth is consumer-owned. */
11
+ export declare function createHttpUploadAdapter(options: HttpUploadOptions): UploadAdapter<Blob>;
@@ -0,0 +1,25 @@
1
+ export declare const attachmentCopy: {
2
+ readonly label: "Attachments";
3
+ readonly add: "Add files";
4
+ readonly empty: "No files attached";
5
+ readonly uploading: "Uploading";
6
+ readonly ready: "Ready";
7
+ readonly error: "Upload failed";
8
+ readonly cancelled: "Upload stopped";
9
+ readonly rejected: "Can’t attach this file";
10
+ readonly remove: "Remove";
11
+ readonly retry: "Retry upload";
12
+ readonly cancel: "Stop upload";
13
+ readonly type: "Choose a supported file type.";
14
+ readonly size: "This file is empty or exceeds the size limit.";
15
+ readonly count: "The file limit is reached. Remove a file before adding more.";
16
+ readonly failed: "The file couldn’t upload. Retry or remove it; your message is still here.";
17
+ readonly unavailable: "File uploads aren’t available in this connection.";
18
+ readonly selected: "files selected";
19
+ readonly image: "Image";
20
+ readonly document: "Document";
21
+ readonly file: "File";
22
+ };
23
+ export type AttachmentCopy = {
24
+ [Key in keyof typeof attachmentCopy]: string;
25
+ };
@@ -0,0 +1,24 @@
1
+ import { type AttachmentController, type AttachmentItem } from "../../core/index.js";
2
+ import { type AttachmentCopy } from "./copy.js";
3
+ export declare function useAttachments<Data>(controller: AttachmentController<Data>): import("../../core/attachments.js").AttachmentSnapshot;
4
+ export interface AttachmentListProps {
5
+ items: readonly AttachmentItem[];
6
+ variant?: "list" | "grid" | "inline";
7
+ className?: string;
8
+ copy?: AttachmentCopy;
9
+ /** Explicit opt-in: host is responsible for trusting image origins. No PDFs/HTML are embedded. */
10
+ previewImages?: boolean;
11
+ onRemove?: (id: string) => void;
12
+ onRetry?: (id: string) => void;
13
+ onCancel?: (id: string) => void;
14
+ }
15
+ /** Standalone supplied-data display; no chat, upload or vendor provider is required. */
16
+ export declare function AttachmentList({ items, variant, className, copy, previewImages, onRemove, onRetry, onCancel, }: AttachmentListProps): import("react").JSX.Element;
17
+ export interface AttachmentPickerProps {
18
+ controller: AttachmentController<Blob>;
19
+ isDisabled?: boolean;
20
+ description: string;
21
+ copy?: AttachmentCopy;
22
+ className?: string;
23
+ }
24
+ export declare function AttachmentPicker({ controller, isDisabled, description, copy, className, }: AttachmentPickerProps): import("react").JSX.Element;
@@ -0,0 +1,24 @@
1
+ export declare const chatCopy: {
2
+ readonly label: "Conversation";
3
+ readonly emptyTitle: "What are you working on?";
4
+ readonly emptyNote: "Start with a question, an idea or something you want to make clearer.";
5
+ readonly user: "You";
6
+ readonly assistant: "Assistant";
7
+ readonly input: "Message";
8
+ readonly placeholder: "Ask a question or describe what you need";
9
+ readonly send: "Send message";
10
+ readonly stop: "Stop response";
11
+ readonly retry: "Restart response";
12
+ readonly hint: "Enter to send · Shift + Enter for a new line";
13
+ readonly touchHint: "Use Send to submit your message";
14
+ readonly idle: "";
15
+ readonly waiting: "Preparing a response";
16
+ readonly streaming: "Responding";
17
+ readonly complete: "Response ready";
18
+ readonly cancelled: "Response stopped. Your partial response is still here.";
19
+ readonly error: "The response couldn’t finish. Your message is still here.";
20
+ readonly interrupted: "The connection ended before the response finished. Restart to try again.";
21
+ };
22
+ export type ChatCopy = {
23
+ [Key in keyof typeof chatCopy]: string;
24
+ };
@@ -0,0 +1,41 @@
1
+ import { type ReactNode } from "react";
2
+ import type { ChatActions, ChatController, ChatFile, ChatMessage, ChatSnapshot } from "../core/index.js";
3
+ export { AttachmentList, AttachmentPicker, useAttachments } from "./attachments/index.js";
4
+ export type { AttachmentListProps, AttachmentPickerProps } from "./attachments/index.js";
5
+ export { attachmentCopy } from "./attachments/copy.js";
6
+ import { type ChatCopy } from "./copy.js";
7
+ import { type MessageCopy } from "./message/index.js";
8
+ export { BranchPicker, CopyButton, CodeBlock, MessageEditor, MessageMarkdown, StreamingMessage, messageCopy, } from "./message/index.js";
9
+ export type { BranchPickerProps, CopyButtonProps, CodeBlockProps, MessageEditorProps, MessageMarkdownProps, MessageCopy, } from "./message/index.js";
10
+ export type { ChatCopy } from "./copy.js";
11
+ export type { ChatActions, ChatMessage, ChatSnapshot } from "../core/index.js";
12
+ export declare function useChatController(controller: ChatController): ChatSnapshot;
13
+ export interface ChatProps {
14
+ snapshot: ChatSnapshot;
15
+ actions: ChatActions;
16
+ copy?: ChatCopy;
17
+ className?: string;
18
+ /** Render supplied text using the application's safe Markdown renderer if wanted. */
19
+ renderMessage?: (message: ChatMessage) => ReactNode;
20
+ footer?: ReactNode;
21
+ attachmentPicker?: ReactNode;
22
+ draftFiles?: readonly ChatFile[];
23
+ isAttachmentBlocked?: boolean;
24
+ /** Clear a draft queue only after the state owner accepts the message. */
25
+ onSent?: () => void;
26
+ messageCopy?: MessageCopy;
27
+ writeText?: (text: string) => Promise<void>;
28
+ /** Opt into the existing bounded conversation height; follows only while at the bottom. */
29
+ scrollable?: boolean;
30
+ autoScroll?: boolean;
31
+ /** Prompts offered in an empty conversation. Choosing one puts it in the message box. */
32
+ suggestions?: readonly string[];
33
+ /** Text already in the message box when the conversation first appears. */
34
+ defaultDraft?: string;
35
+ /** A user message already open for editing when it first appears (specimens; no focus move). */
36
+ defaultEditing?: string;
37
+ }
38
+ /** A controlled presentation: state comes from the host, not a mandatory provider. */
39
+ export declare function Chat({ snapshot, actions, copy, className, renderMessage, footer, attachmentPicker, draftFiles, isAttachmentBlocked, onSent, messageCopy: words, writeText, scrollable, autoScroll, suggestions, defaultDraft, defaultEditing, }: ChatProps): import("react").JSX.Element;
40
+ export { DraftReview, ReviewChangeCard, ReviewDecisionPanel, useReview, reviewCopy, } from "./review/index.js";
41
+ export type { DraftReviewProps, ReviewChangeCardProps, ReviewDecisionPanelProps, ReviewCopy, } from "./review/index.js";
@@ -0,0 +1,27 @@
1
+ export declare const messageCopy: {
2
+ readonly copy: "Copy response";
3
+ readonly copyCode: "Copy code";
4
+ readonly copying: "Copying";
5
+ readonly copied: "Copied";
6
+ readonly copyFailed: "Couldn’t copy. Select the text and copy it instead.";
7
+ readonly code: "Code";
8
+ readonly table: "Response table";
9
+ readonly footnotes: "Notes";
10
+ readonly back: "Back to the reference";
11
+ readonly previous: "Previous version";
12
+ readonly next: "Next version";
13
+ readonly versions: "Message versions";
14
+ readonly version: "Version";
15
+ readonly edit: "Edit your message";
16
+ readonly editInput: "Edit message";
17
+ readonly save: "Save and resend";
18
+ readonly cancel: "Cancel edit";
19
+ readonly editNote: "Resending creates a new version. The original conversation stays available.";
20
+ readonly editFailed: "This message couldn’t be resent. Your edit is still here. Try again when the response has stopped.";
21
+ readonly regenerate: "Regenerate response";
22
+ readonly latest: "Jump to latest message";
23
+ readonly transcript: "Conversation messages";
24
+ };
25
+ export type MessageCopy = {
26
+ [Key in keyof typeof messageCopy]: string;
27
+ };
@@ -0,0 +1,56 @@
1
+ import type { ChatBranch } from "../../core/index.js";
2
+ import { type MessageCopy } from "./copy.js";
3
+ export { messageCopy } from "./copy.js";
4
+ export type { MessageCopy } from "./copy.js";
5
+ export interface CopyButtonProps {
6
+ text: string;
7
+ label?: string;
8
+ iconOnly?: boolean;
9
+ isDisabled?: boolean;
10
+ copy?: MessageCopy;
11
+ /** Consumer-owned clipboard I/O. Rejections never report success. */
12
+ writeText?: (text: string) => Promise<void>;
13
+ }
14
+ export declare function CopyButton({ text, label, iconOnly, isDisabled, copy, writeText, }: CopyButtonProps): import("react").JSX.Element;
15
+ export interface CodeBlockProps extends Pick<CopyButtonProps, "writeText" | "copy"> {
16
+ code: string;
17
+ language?: string;
18
+ className?: string;
19
+ isStreaming?: boolean;
20
+ }
21
+ /** Code is readable/copyable text, never executed or embedded. */
22
+ export declare function CodeBlock({ code, language, className, isStreaming, writeText, copy, }: CodeBlockProps): import("react").JSX.Element;
23
+ export declare function safeMarkdownUrl(url: string): string;
24
+ export interface MessageMarkdownProps extends Pick<CodeBlockProps, "copy" | "writeText" | "isStreaming"> {
25
+ text: string;
26
+ className?: string;
27
+ /** The answer is arriving now: tint the newest words and show the cursor. */
28
+ streamingTail?: boolean;
29
+ }
30
+ /** Established CommonMark/GFM parser, without raw HTML, remote images or executable previews. */
31
+ export declare function MessageMarkdown({ text, className, copy, writeText, isStreaming, streamingTail, }: MessageMarkdownProps): import("react").JSX.Element;
32
+ /**
33
+ * A streaming answer, like assistant-ui's streaming text: the newest words arrive tinted in
34
+ * the info colour and fade back to plain text as more arrive; the cursor follows the
35
+ * last word. When the stream ends, it's ordinary text.
36
+ */
37
+ export declare function StreamingMessage(props: Omit<MessageMarkdownProps, "isStreaming" | "streamingTail">): import("react").JSX.Element;
38
+ export interface BranchPickerProps {
39
+ branch: ChatBranch;
40
+ isDisabled?: boolean;
41
+ onPrevious?: () => void;
42
+ onNext?: () => void;
43
+ copy?: MessageCopy;
44
+ }
45
+ export declare function BranchPicker({ branch, isDisabled, onPrevious, onNext, copy, }: BranchPickerProps): import("react").JSX.Element | null;
46
+ export interface MessageEditorProps {
47
+ text: string;
48
+ /** Enable only for an editor opened by the visitor. Specimens do not move focus. */
49
+ autoFocus?: boolean;
50
+ hasFiles?: boolean;
51
+ isDisabled?: boolean;
52
+ onSave: (text: string) => boolean;
53
+ onCancel: () => void;
54
+ copy?: MessageCopy;
55
+ }
56
+ export declare function MessageEditor({ text, autoFocus, hasFiles, isDisabled, onSave, onCancel, copy, }: MessageEditorProps): import("react").JSX.Element;
@@ -0,0 +1,27 @@
1
+ interface Text {
2
+ type: "text";
3
+ value: string;
4
+ }
5
+ interface Element {
6
+ type: "element";
7
+ tagName: string;
8
+ properties: Record<string, unknown>;
9
+ children: Node[];
10
+ }
11
+ type Node = Text | Element | {
12
+ type: string;
13
+ children?: Node[];
14
+ };
15
+ interface Root {
16
+ type: "root";
17
+ children: Node[];
18
+ }
19
+ /**
20
+ * For an answer that is still arriving: wraps each word so the newest ones can be tinted, and
21
+ * puts the cursor after the last word. The tint fades back to plain text (see library.css) as
22
+ * newer words arrive. Modelled on assistant-ui's streaming text.
23
+ */
24
+ export declare function rehypeStreamingTail({ fresh }?: {
25
+ fresh?: number;
26
+ }): (tree: Root) => void;
27
+ export {};
@@ -0,0 +1,72 @@
1
+ export declare const reviewCopy: {
2
+ readonly proposed: "Proposed changes";
3
+ readonly before: "Current";
4
+ readonly after: "Proposed";
5
+ readonly reason: "Why this change";
6
+ readonly applied: "Applied";
7
+ readonly unchanged: "Unchanged";
8
+ readonly viewChange: (title: string) => string;
9
+ readonly selectChange: (title: string) => string;
10
+ readonly selected: (n: number, total: number) => string;
11
+ readonly review: (n: number) => string;
12
+ readonly apply: (n: number) => string;
13
+ readonly complete: (n: number) => string;
14
+ readonly kept: (n: number) => string;
15
+ readonly confirm: "Confirm your decision";
16
+ readonly summary: "Your selection";
17
+ readonly target: "Apply to";
18
+ readonly applying: "Applying";
19
+ readonly checking: "Checking status";
20
+ readonly noSelection: "Choose the changes you want to keep.";
21
+ readonly approvalNote: "Only these changes will be applied. The rest stay as they are.";
22
+ readonly deny: "Decline all";
23
+ readonly declineRemaining: "Decline remaining";
24
+ readonly declineRemainingTitle: "Decline the remaining changes?";
25
+ readonly declineRemainingNote: "Applied changes are kept. The remaining changes will stay as they were.";
26
+ readonly denyConfirm: "Decline these changes?";
27
+ readonly denyAction: "Decline changes";
28
+ readonly denyNote: "The current draft will stay as it is.";
29
+ readonly denied: "Changes declined";
30
+ readonly deniedNote: "The draft is unchanged.";
31
+ readonly back: "Back to review";
32
+ readonly retry: "Try again";
33
+ readonly check: "Check status";
34
+ readonly reload: "Review latest draft";
35
+ readonly loading: "Preparing your review";
36
+ readonly loadingNote: "The proposed changes are being loaded.";
37
+ readonly loadError: "The review couldn’t be loaded.";
38
+ readonly loadErrorNote: "Try again to see the proposed changes.";
39
+ readonly uncertain: "Let’s check what happened.";
40
+ readonly uncertainNote: "Your decision may have reached the server. Check its status before trying again. Your choices are kept.";
41
+ readonly notApplied: "No changes recorded yet.";
42
+ readonly notAppliedNote: "Your choices are kept. You can check again or confirm the same decision.";
43
+ readonly conflict: "The draft has changed.";
44
+ readonly conflictNote: "Nothing from this decision was applied. Review the latest draft before deciding again.";
45
+ readonly blocked: "You can view this review.";
46
+ readonly blockedNote: "You don’t have permission to apply or decline these changes.";
47
+ readonly partial: (applied: number, left: number) => string;
48
+ readonly partialNote: "The applied changes are kept. Review the remaining changes before trying them again.";
49
+ readonly empty: "No changes to review";
50
+ readonly emptyNote: "The current draft is unchanged.";
51
+ readonly unavailable: "Review not available";
52
+ readonly announcement: {
53
+ readonly ready: "Changes ready to review.";
54
+ readonly confirming: "Decision ready to confirm.";
55
+ readonly submitting: "Applying your decision.";
56
+ readonly checking: "Checking your decision’s status.";
57
+ readonly partial: "Some changes were applied. Review the remaining changes.";
58
+ readonly complete: "Selected changes applied.";
59
+ readonly denied: "Changes declined. The draft is unchanged.";
60
+ readonly conflict: "The draft changed. Review it again.";
61
+ readonly blocked: "You do not have permission to decide.";
62
+ readonly uncertain: "Check status before retrying your decision.";
63
+ readonly "load-error": "The review could not be loaded.";
64
+ readonly loading: "Preparing your review.";
65
+ readonly idle: "";
66
+ };
67
+ };
68
+ type CustomWords<T> = {
69
+ [K in keyof T]: T[K] extends string ? string : T[K] extends (...args: infer A) => string ? (...args: A) => string : CustomWords<T[K]>;
70
+ };
71
+ export type ReviewCopy = CustomWords<typeof reviewCopy>;
72
+ export {};
@@ -0,0 +1,3 @@
1
+ import { type FlowType } from "../../../components/flow-motion.js";
2
+ import type { ReviewStatus } from "../../review/types.js";
3
+ export declare function reviewFlow(from: ReviewStatus, to: ReviewStatus): FlowType | null;
@@ -0,0 +1,38 @@
1
+ import type { ReviewChange, ReviewSnapshot } from "../../review/types.js";
2
+ import type { ReviewController } from "../../review/controller.js";
3
+ import { type ReviewCopy } from "./copy.js";
4
+ export { reviewCopy } from "./copy.js";
5
+ export type { ReviewCopy } from "./copy.js";
6
+ export interface ReviewChangeCardProps {
7
+ change: ReviewChange;
8
+ isSelected?: boolean;
9
+ onSelectionChange?: (selected: boolean) => void;
10
+ isDisabled?: boolean;
11
+ isApplied?: boolean;
12
+ isExpanded?: boolean;
13
+ onExpandedChange?: (expanded: boolean) => void;
14
+ /** Side-by-side comparison on a roomy canvas. The content remains the same. */
15
+ comparison?: "columns" | "stacked";
16
+ copy?: ReviewCopy;
17
+ }
18
+ export declare function ReviewChangeCard({ change, isSelected, onSelectionChange, isDisabled, isApplied, isExpanded, onExpandedChange, comparison, copy, }: ReviewChangeCardProps): import("react").JSX.Element;
19
+ export interface ReviewDecisionPanelProps {
20
+ snapshot: ReviewSnapshot;
21
+ headingLevel?: 2 | 3;
22
+ onReview: () => void;
23
+ onDecline: () => void;
24
+ onConfirm: () => void;
25
+ onBack: () => void;
26
+ onRecover: () => void;
27
+ onReload: () => void;
28
+ copy?: ReviewCopy;
29
+ }
30
+ /** Provider-free decision display. The controller and the server, not this panel, own authority. */
31
+ export declare function ReviewDecisionPanel({ snapshot: s, headingLevel, onReview, onDecline, onConfirm, onBack, onRecover, onReload, copy, }: ReviewDecisionPanelProps): import("react").JSX.Element;
32
+ export declare function useReview(controller: ReviewController): ReviewSnapshot;
33
+ export interface DraftReviewProps {
34
+ controller: ReviewController;
35
+ copy?: ReviewCopy;
36
+ className?: string;
37
+ }
38
+ export declare function DraftReview(props: DraftReviewProps): import("react").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import "../../styles/library.css";
2
+ import "./message/styles.css";
package/ui/index.js ADDED
@@ -0,0 +1,4 @@
1
+ "use client";
2
+ import { a as e, i as t, n, o as r, r as i, t as a } from "../chunks/callout-DKMHSnjc.js";
3
+ import { A as o, C as s, D as c, E as l, F as u, M as d, N as f, O as p, P as m, S as h, T as g, _, a as v, b as y, c as b, d as x, f as S, g as C, h as w, i as T, j as E, k as D, l as O, m as k, n as A, o as j, p as M, r as N, s as P, t as F, u as I, v as L, w as R, x as z, y as B } from "../chunks/ui-9DyNsYXY.js";
4
+ export { y as Accordion, I as AspectRatio, j as Avatar, x as Badge, z as Breadcrumbs, n as Button, i as ButtonLink, a as Callout, S as Card, c as Checkbox, p as CheckboxGroup, M as DataTable, A as DateTimeField, D as Form, k as KeyboardHint, h as Menu, s as ModalDialog, R as Pagination, w as Progress, o as RadioGroup, N as ResponsiveOverlay, F as ScenarioPicker, T as ScrollArea, b as SearchPicker, P as SegmentedControl, E as Select, C as Separator, v as Skeleton, d as Slider, r as Spinner, O as Switch, g as Tabs, f as TextField, t as TextLink, _ as ToastRegion, m as Toggle, l as Tooltip, e as buttonStyles, L as createNotificationQueue, B as sortRows, u as uiCopy };
@@ -0,0 +1,34 @@
1
+ import { i as e } from "../chunks/core-BCqVRLUy.js";
2
+ //#region src/reusable/uploads/index.ts
3
+ function t(t) {
4
+ let n = t.fetch ?? globalThis.fetch, r = t.releaseEndpoint;
5
+ return {
6
+ async upload(r, i) {
7
+ let a = await n(t.endpoint, {
8
+ method: "POST",
9
+ signal: i,
10
+ credentials: t.credentials ?? "same-origin",
11
+ headers: {
12
+ ...Object.fromEntries(new Headers(await t.headers?.()).entries()),
13
+ "content-type": r.mediaType,
14
+ "x-file-name": encodeURIComponent(r.name),
15
+ "x-upload-id": r.id ?? globalThis.crypto.randomUUID()
16
+ },
17
+ body: r.data
18
+ });
19
+ if (!a.ok || !a.headers.get("content-type")?.startsWith("application/json")) throw Error("Upload unavailable");
20
+ let o = await a.text();
21
+ if (o.length > 1e4) throw Error("Upload reference too large");
22
+ return e(JSON.parse(o));
23
+ },
24
+ ...r ? { async release(e) {
25
+ if (!(await n(r(e.id), {
26
+ method: "DELETE",
27
+ credentials: t.credentials ?? "same-origin",
28
+ headers: await t.headers?.()
29
+ })).ok) throw Error("Release unavailable");
30
+ } } : {}
31
+ };
32
+ }
33
+ //#endregion
34
+ export { t as createHttpUploadAdapter };