@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,107 @@
1
+ /** Public, platform-neutral contract. No browser, React or runtime-vendor types. */
2
+ export { AttachmentController } from "./attachments.js";
3
+ export type { AttachmentItem, AttachmentIssue, AttachmentSnapshot, UploadAdapter, UploadPolicy, UploadSource, } from "./attachments.js";
4
+ export type ChatStatus = "idle" | "waiting" | "streaming" | "complete" | "cancelled" | "error" | "interrupted";
5
+ export interface ChatMessage {
6
+ readonly id: string;
7
+ readonly role: "user" | "assistant";
8
+ readonly text: string;
9
+ readonly files?: readonly ChatFile[];
10
+ readonly metadata?: Readonly<Record<string, unknown>>;
11
+ }
12
+ export interface ChatCapabilities {
13
+ readonly send: boolean;
14
+ readonly cancel: boolean;
15
+ /** Restart a response, not continuation of an interrupted stream. */
16
+ readonly retry: boolean;
17
+ readonly attachments?: boolean;
18
+ /** Host explicitly permits replaying a question; this does not undo server work. */
19
+ readonly edit?: boolean;
20
+ readonly regenerate?: boolean;
21
+ readonly branches?: boolean;
22
+ }
23
+ export interface ChatBranch {
24
+ readonly index: number;
25
+ readonly count: number;
26
+ }
27
+ /** A verified reference from the consumer's upload service, never a browser File. */
28
+ export interface ChatFile {
29
+ readonly id: string;
30
+ readonly name: string;
31
+ readonly mediaType: string;
32
+ readonly size: number;
33
+ readonly url: string;
34
+ }
35
+ export interface ChatSnapshot {
36
+ readonly messages: readonly ChatMessage[];
37
+ readonly status: ChatStatus;
38
+ readonly capabilities: ChatCapabilities;
39
+ readonly branches?: Readonly<Record<string, ChatBranch>>;
40
+ }
41
+ export interface ChatRequest {
42
+ readonly requestId: string;
43
+ readonly messages: readonly ChatMessage[];
44
+ }
45
+ export type ChatEvent = {
46
+ type: "text";
47
+ text: string;
48
+ } | {
49
+ type: "replace-text";
50
+ text: string;
51
+ } | {
52
+ type: "metadata";
53
+ metadata: Readonly<Record<string, unknown>>;
54
+ } | {
55
+ type: "finish";
56
+ } | {
57
+ type: "error";
58
+ };
59
+ export interface ChatAdapter {
60
+ readonly capabilities: ChatCapabilities;
61
+ run(request: ChatRequest, signal: AbortSignal): AsyncIterable<ChatEvent>;
62
+ }
63
+ export interface ChatActions {
64
+ send(text: string, files?: readonly ChatFile[]): boolean;
65
+ cancel(): void;
66
+ retry(): boolean;
67
+ edit?(messageId: string, text: string): boolean;
68
+ regenerate?(messageId: string): boolean;
69
+ selectBranch?(messageId: string, direction: "previous" | "next"): boolean;
70
+ }
71
+ export declare class ChatInterrupted extends Error {
72
+ constructor();
73
+ }
74
+ export declare function parseChatFile(value: unknown): ChatFile;
75
+ /** Validates the small wire protocol. Provider/server errors never become UI copy. */
76
+ export declare function parseChatEvent(value: unknown): ChatEvent;
77
+ export declare function parseChatRequest(value: unknown): ChatRequest;
78
+ /** One bounded, in-memory conversation tree. Snapshots contain only its selected path. */
79
+ export declare class ChatController implements ChatActions {
80
+ private readonly adapter;
81
+ private readonly id;
82
+ private snapshot;
83
+ private readonly listeners;
84
+ private readonly nodes;
85
+ private readonly children;
86
+ private readonly selected;
87
+ private active;
88
+ private generation;
89
+ constructor(adapter: ChatAdapter, id: () => string);
90
+ getSnapshot: () => ChatSnapshot;
91
+ subscribe: (listener: () => void) => (() => void);
92
+ private path;
93
+ private publish;
94
+ private add;
95
+ private room;
96
+ send: (text: string, files?: readonly ChatFile[]) => boolean;
97
+ edit: (messageId: string, text: string) => boolean;
98
+ regenerate: (messageId: string) => boolean;
99
+ selectBranch: (messageId: string, direction: "previous" | "next") => boolean;
100
+ retry: () => boolean;
101
+ cancel: () => void;
102
+ dispose: () => void;
103
+ private begin;
104
+ private consume;
105
+ }
106
+ export * from "../review/types.js";
107
+ export { ReviewController, reviewReducer } from "../review/controller.js";
@@ -0,0 +1,14 @@
1
+ import { type ChatAdapter } from "../core/index.js";
2
+ export interface HttpChatOptions {
3
+ endpoint: string;
4
+ /** Opt into editing, regeneration and versions. Restart is controlled separately by retry. */
5
+ conversationActions?: boolean;
6
+ /** Allow Restart as a new run. Defaults to true; disable for endpoints without replay safety. */
7
+ retry?: boolean;
8
+ /** Consumer-owned, evaluated each request so refreshed auth is used. */
9
+ headers?: () => HeadersInit | Promise<HeadersInit>;
10
+ credentials?: RequestCredentials;
11
+ fetch?: typeof globalThis.fetch;
12
+ }
13
+ /** Newline-delimited JSON over customer-owned HTTP. No hosted account required. */
14
+ export declare function createHttpChatAdapter(options: HttpChatOptions): ChatAdapter;
@@ -0,0 +1,45 @@
1
+ import { type StructuredAction } from "./schema.js";
2
+ export interface GenerativeRequest {
3
+ readonly key: string;
4
+ readonly action: StructuredAction;
5
+ }
6
+ export interface GenerativeReceipt {
7
+ key: string;
8
+ type: string;
9
+ state: "complete" | "not-applied";
10
+ message: string;
11
+ }
12
+ export interface GenerativeActionHandler {
13
+ /** Host-owned copy and intent. A model cannot mark an action safe or grant permission. */
14
+ label: string;
15
+ description: string;
16
+ kind: "inspect" | "mutate" | "dismiss";
17
+ /** Must enforce authorization and idempotency at the destination. The frozen request survives retries. */
18
+ execute: (request: GenerativeRequest, signal: AbortSignal) => Promise<GenerativeReceipt>;
19
+ /** Return null only if no receipt is available yet; this does not prove an action wasn't applied. */
20
+ lookup?: (request: GenerativeRequest, signal: AbortSignal) => Promise<GenerativeReceipt | null>;
21
+ }
22
+ export type GenerativeActions = Readonly<Record<string, GenerativeActionHandler>>;
23
+ export type GenerativeStage = "ready" | "confirm" | "submitting" | "failed" | "uncertain" | "checking" | "complete" | "dismissed";
24
+ export interface GenerativeActionSnapshot {
25
+ stage: GenerativeStage;
26
+ request?: GenerativeRequest;
27
+ label?: string;
28
+ description?: string;
29
+ message?: string;
30
+ noReceipt?: boolean;
31
+ }
32
+ /** One state owner. No execution before explicit confirmation of host-declared mutations. */
33
+ export declare function createGenerativeActionController(actions: GenerativeActions, makeKey?: () => `${string}-${string}-${string}-${string}-${string}`): {
34
+ subscribe: (listener: () => void) => () => void;
35
+ getSnapshot: () => GenerativeActionSnapshot;
36
+ request: (input: unknown) => boolean;
37
+ confirm: () => boolean;
38
+ back: () => boolean;
39
+ retry: () => boolean;
40
+ check: () => boolean;
41
+ reset: () => boolean;
42
+ dispose: () => void;
43
+ };
44
+ export type GenerativeActionController = ReturnType<typeof createGenerativeActionController>;
45
+ export declare const unavailableActionMessage: "This action isn’t available here.";
@@ -0,0 +1,48 @@
1
+ export declare const generativeCopy: {
2
+ readonly stepReady: "Ready";
3
+ readonly stepLoading: "Loading";
4
+ readonly stepReview: "Review";
5
+ readonly stepFailed: "Not applied";
6
+ readonly stepUncertain: "Unconfirmed";
7
+ readonly stepResult: "Result";
8
+ readonly stepPast: "Previous state";
9
+ readonly loading: "Preparing your response";
10
+ readonly streaming: "The response is arriving. Actions will be available when it’s complete.";
11
+ readonly empty: "There’s nothing to show yet.";
12
+ readonly invalid: "We couldn’t display this response.";
13
+ readonly invalidNote: "Your work is still here. Try requesting the response again.";
14
+ readonly retry: "Try again";
15
+ readonly back: "Back";
16
+ readonly confirm: "Confirm action";
17
+ readonly working: "Applying";
18
+ readonly checking: "Checking";
19
+ readonly review: "Review before continuing";
20
+ readonly input: "Your details";
21
+ readonly noHandler: "This action isn’t available here.";
22
+ readonly failed: "The action wasn’t applied.";
23
+ readonly failedNote: "Your details are saved here. You can try again.";
24
+ readonly uncertain: "We haven’t received confirmation.";
25
+ readonly uncertainNote: "Check the result before trying again. Your details are kept here.";
26
+ readonly check: "Check status";
27
+ readonly noReceipt: "There’s no confirmation yet. Check again or retry this same request.";
28
+ readonly complete: "Action complete";
29
+ readonly dismissed: "Dismissed";
30
+ readonly fieldRequired: "Enter a value to continue.";
31
+ readonly email: "Enter an email address like name@company.com.";
32
+ readonly date: "Enter a valid date.";
33
+ readonly imageMissing: "Image unavailable";
34
+ readonly data: "View data";
35
+ readonly point: "Point";
36
+ readonly series: "Value";
37
+ readonly mediaSelected: "Track selected";
38
+ readonly quoted: "Quoted amount";
39
+ readonly validation: "Check the highlighted fields.";
40
+ readonly updated: "A new response is available. Finish or dismiss this action before opening it.";
41
+ readonly next: "Open new response";
42
+ readonly quoteUnavailable: "We couldn’t confirm the amount. Try again before continuing.";
43
+ readonly actionInvalid: "We couldn’t prepare this action.";
44
+ readonly actionInvalidNote: "Your details are still here. Check the entries, shorten long text and try again.";
45
+ };
46
+ export type GenerativeCopy = {
47
+ [K in keyof typeof generativeCopy]: string;
48
+ };
@@ -0,0 +1,4 @@
1
+ import type { GenerativeChartProps, GenerativeTableProps } from "./schema.js";
2
+ export declare function GenerativeTable({ label, columns, rows, sortable }: GenerativeTableProps): import("react").JSX.Element;
3
+ /** Upstream chart geometry, host tokens, and the same values in a keyboard-accessible table. */
4
+ export declare function GenerativeChart(props: GenerativeChartProps): import("react").JSX.Element;
@@ -0,0 +1,30 @@
1
+ import { type ReactNode } from "react";
2
+ import { type GenerativeCopy } from "./copy.js";
3
+ import { type GenerativeLibraryOptions } from "./vocabulary.js";
4
+ import { type GenerativeActions, type GenerativeActionController, type GenerativeRequest } from "./actions.js";
5
+ export { createSuperxdGenerativeLibrary, GenerativeForm } from "./vocabulary.js";
6
+ export type { GenerativeLibraryOptions, GenerativeFormProps, GenerativeFactResolver, } from "./vocabulary.js";
7
+ export { GenerativeChart, GenerativeTable } from "./data.js";
8
+ export { parseStructuredSpec, chartSchema, tableSchema, nodeSchemas } from "./schema.js";
9
+ export type { StructuredSpec, StructuredAction, GenerativeChartProps, GenerativeTableProps, } from "./schema.js";
10
+ export { createGenerativeActionController } from "./actions.js";
11
+ export type { GenerativeActionController, GenerativeActions, GenerativeActionHandler, GenerativeActionSnapshot, GenerativeStage, GenerativeRequest, GenerativeReceipt, } from "./actions.js";
12
+ export { generativeCopy } from "./copy.js";
13
+ export type { GenerativeCopy } from "./copy.js";
14
+ export interface StructuredResponseProps extends GenerativeLibraryOptions {
15
+ /** Stable identity of this response. A different response owns a different action session. */
16
+ responseId: string;
17
+ spec: unknown;
18
+ status?: "loading" | "streaming" | "done" | "error";
19
+ /** Host-authored allowlist; an omitted handler renders its action unavailable. Keep stable for this response. */
20
+ actions?: GenerativeActions;
21
+ controller?: GenerativeActionController;
22
+ onRetry?: () => void;
23
+ /** Host-owned destination shown only after a matching successful receipt. Return null for the default receipt. */
24
+ renderResult?: (request: GenerativeRequest) => ReactNode;
25
+ /** Keep action steps on the canvas; earlier steps become read-only previews. Off by default. */
26
+ retainSteps?: boolean;
27
+ copy?: GenerativeCopy;
28
+ className?: string;
29
+ }
30
+ export declare function StructuredResponse(props: StructuredResponseProps): import("react").JSX.Element;
@@ -0,0 +1,303 @@
1
+ import { z } from "zod";
2
+ export declare const actionSchema: z.ZodIntersection<z.ZodRecord<z.ZodString, z.ZodJSONSchema>, z.ZodObject<{
3
+ type: z.ZodString;
4
+ }, z.core.$strip>>;
5
+ export type StructuredAction = z.infer<typeof actionSchema>;
6
+ export declare const chartSchema: z.ZodObject<{
7
+ label: z.ZodString;
8
+ variant: z.ZodEnum<{
9
+ bar: "bar";
10
+ line: "line";
11
+ area: "area";
12
+ sparkline: "sparkline";
13
+ }>;
14
+ data: z.ZodOptional<z.ZodArray<z.ZodObject<{
15
+ label: z.ZodString;
16
+ value: z.ZodNumber;
17
+ }, z.core.$strict>>>;
18
+ series: z.ZodOptional<z.ZodArray<z.ZodObject<{
19
+ label: z.ZodString;
20
+ data: z.ZodArray<z.ZodObject<{
21
+ label: z.ZodString;
22
+ value: z.ZodNumber;
23
+ }, z.core.$strict>>;
24
+ }, z.core.$strict>>>;
25
+ stacked: z.ZodOptional<z.ZodBoolean>;
26
+ showAxis: z.ZodOptional<z.ZodBoolean>;
27
+ showLegend: z.ZodOptional<z.ZodBoolean>;
28
+ }, z.core.$strict>;
29
+ export type GenerativeChartProps = z.infer<typeof chartSchema>;
30
+ export declare const tableSchema: z.ZodObject<{
31
+ label: z.ZodString;
32
+ columns: z.ZodArray<z.ZodObject<{
33
+ label: z.ZodString;
34
+ align: z.ZodOptional<z.ZodEnum<{
35
+ start: "start";
36
+ end: "end";
37
+ }>>;
38
+ }, z.core.$strict>>;
39
+ rows: z.ZodArray<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
40
+ sortable: z.ZodOptional<z.ZodBoolean>;
41
+ }, z.core.$strict>;
42
+ export type GenerativeTableProps = z.infer<typeof tableSchema>;
43
+ export declare const nodeSchemas: {
44
+ Card: z.ZodObject<{
45
+ title: z.ZodOptional<z.ZodString>;
46
+ asForm: z.ZodOptional<z.ZodBoolean>;
47
+ confirm: z.ZodOptional<z.ZodObject<{
48
+ label: z.ZodString;
49
+ $action: z.ZodOptional<z.ZodIntersection<z.ZodRecord<z.ZodString, z.ZodJSONSchema>, z.ZodObject<{
50
+ type: z.ZodString;
51
+ }, z.core.$strip>>>;
52
+ }, z.core.$strict>>;
53
+ cancel: z.ZodOptional<z.ZodObject<{
54
+ label: z.ZodString;
55
+ $action: z.ZodOptional<z.ZodIntersection<z.ZodRecord<z.ZodString, z.ZodJSONSchema>, z.ZodObject<{
56
+ type: z.ZodString;
57
+ }, z.core.$strip>>>;
58
+ }, z.core.$strict>>;
59
+ }, z.core.$strict>;
60
+ Form: z.ZodObject<{}, z.core.$strict>;
61
+ Row: z.ZodObject<{
62
+ justify: z.ZodOptional<z.ZodEnum<{
63
+ start: "start";
64
+ center: "center";
65
+ end: "end";
66
+ between: "between";
67
+ }>>;
68
+ gap: z.ZodOptional<z.ZodNumber>;
69
+ align: z.ZodOptional<z.ZodEnum<{
70
+ start: "start";
71
+ center: "center";
72
+ end: "end";
73
+ }>>;
74
+ }, z.core.$strict>;
75
+ Col: z.ZodObject<{
76
+ gap: z.ZodOptional<z.ZodNumber>;
77
+ align: z.ZodOptional<z.ZodEnum<{
78
+ start: "start";
79
+ center: "center";
80
+ end: "end";
81
+ }>>;
82
+ }, z.core.$strict>;
83
+ Text: z.ZodObject<{
84
+ value: z.ZodString;
85
+ size: z.ZodOptional<z.ZodEnum<{
86
+ sm: "sm";
87
+ md: "md";
88
+ lg: "lg";
89
+ xl: "xl";
90
+ "2xl": "2xl";
91
+ "3xl": "3xl";
92
+ }>>;
93
+ weight: z.ZodOptional<z.ZodEnum<{
94
+ bold: "bold";
95
+ normal: "normal";
96
+ medium: "medium";
97
+ semibold: "semibold";
98
+ }>>;
99
+ color: z.ZodOptional<z.ZodEnum<{
100
+ emphasis: "emphasis";
101
+ secondary: "secondary";
102
+ }>>;
103
+ }, z.core.$strict>;
104
+ Header: z.ZodObject<{
105
+ text: z.ZodString;
106
+ size: z.ZodOptional<z.ZodEnum<{
107
+ sm: "sm";
108
+ md: "md";
109
+ lg: "lg";
110
+ xl: "xl";
111
+ "2xl": "2xl";
112
+ "3xl": "3xl";
113
+ }>>;
114
+ }, z.core.$strict>;
115
+ Caption: z.ZodObject<{
116
+ value: z.ZodString;
117
+ }, z.core.$strict>;
118
+ Markdown: z.ZodObject<{
119
+ value: z.ZodString;
120
+ }, z.core.$strict>;
121
+ Badge: z.ZodObject<{
122
+ value: z.ZodString;
123
+ variant: z.ZodOptional<z.ZodEnum<{
124
+ success: "success";
125
+ info: "info";
126
+ warning: "warning";
127
+ neutral: "neutral";
128
+ }>>;
129
+ }, z.core.$strict>;
130
+ Fact: z.ZodObject<{
131
+ label: z.ZodString;
132
+ value: z.ZodString;
133
+ binding: z.ZodOptional<z.ZodString>;
134
+ }, z.core.$strict>;
135
+ Divider: z.ZodObject<{}, z.core.$strict>;
136
+ Spacer: z.ZodObject<{}, z.core.$strict>;
137
+ Accent: z.ZodObject<{}, z.core.$strict>;
138
+ Icon: z.ZodObject<{
139
+ name: z.ZodEnum<{
140
+ user: "user";
141
+ search: "search";
142
+ check: "check";
143
+ sun: "sun";
144
+ moon: "moon";
145
+ cloud: "cloud";
146
+ rain: "rain";
147
+ snow: "snow";
148
+ wind: "wind";
149
+ play: "play";
150
+ pause: "pause";
151
+ x: "x";
152
+ star: "star";
153
+ heart: "heart";
154
+ "arrow-right": "arrow-right";
155
+ "arrow-up-right": "arrow-up-right";
156
+ "chevron-right": "chevron-right";
157
+ calendar: "calendar";
158
+ clock: "clock";
159
+ "map-pin": "map-pin";
160
+ plane: "plane";
161
+ truck: "truck";
162
+ "credit-card": "credit-card";
163
+ bell: "bell";
164
+ }>;
165
+ size: z.ZodOptional<z.ZodEnum<{
166
+ sm: "sm";
167
+ md: "md";
168
+ lg: "lg";
169
+ }>>;
170
+ }, z.core.$strict>;
171
+ Image: z.ZodObject<{
172
+ src: z.ZodString;
173
+ alt: z.ZodString;
174
+ size: z.ZodOptional<z.ZodEnum<{
175
+ sm: "sm";
176
+ md: "md";
177
+ lg: "lg";
178
+ }>>;
179
+ round: z.ZodOptional<z.ZodBoolean>;
180
+ }, z.core.$strict>;
181
+ Avatar: z.ZodObject<{
182
+ name: z.ZodString;
183
+ }, z.core.$strict>;
184
+ Alert: z.ZodObject<{
185
+ tone: z.ZodEnum<{
186
+ success: "success";
187
+ info: "info";
188
+ warning: "warning";
189
+ danger: "danger";
190
+ }>;
191
+ title: z.ZodString;
192
+ description: z.ZodOptional<z.ZodString>;
193
+ }, z.core.$strict>;
194
+ ListView: z.ZodObject<{}, z.core.$strict>;
195
+ ListViewItem: z.ZodObject<{}, z.core.$strict>;
196
+ Input: z.ZodObject<{
197
+ placeholder: z.ZodOptional<z.ZodString>;
198
+ multiline: z.ZodOptional<z.ZodBoolean>;
199
+ inputType: z.ZodOptional<z.ZodEnum<{
200
+ text: "text";
201
+ email: "email";
202
+ }>>;
203
+ name: z.ZodString;
204
+ label: z.ZodString;
205
+ defaultValue: z.ZodOptional<z.ZodString>;
206
+ required: z.ZodOptional<z.ZodBoolean>;
207
+ }, z.core.$strict>;
208
+ Select: z.ZodObject<{
209
+ options: z.ZodArray<z.ZodObject<{
210
+ label: z.ZodString;
211
+ value: z.ZodString;
212
+ }, z.core.$strict>>;
213
+ placeholder: z.ZodOptional<z.ZodString>;
214
+ name: z.ZodString;
215
+ label: z.ZodString;
216
+ defaultValue: z.ZodOptional<z.ZodString>;
217
+ required: z.ZodOptional<z.ZodBoolean>;
218
+ }, z.core.$strict>;
219
+ DatePicker: z.ZodObject<{
220
+ name: z.ZodString;
221
+ label: z.ZodString;
222
+ defaultValue: z.ZodOptional<z.ZodString>;
223
+ required: z.ZodOptional<z.ZodBoolean>;
224
+ }, z.core.$strict>;
225
+ RadioGroup: z.ZodObject<{
226
+ options: z.ZodArray<z.ZodObject<{
227
+ label: z.ZodString;
228
+ value: z.ZodString;
229
+ }, z.core.$strict>>;
230
+ name: z.ZodString;
231
+ label: z.ZodString;
232
+ defaultValue: z.ZodOptional<z.ZodString>;
233
+ required: z.ZodOptional<z.ZodBoolean>;
234
+ }, z.core.$strict>;
235
+ Checkbox: z.ZodObject<{
236
+ name: z.ZodString;
237
+ label: z.ZodString;
238
+ defaultChecked: z.ZodOptional<z.ZodBoolean>;
239
+ }, z.core.$strict>;
240
+ Button: z.ZodObject<{
241
+ label: z.ZodString;
242
+ buttonStyle: z.ZodOptional<z.ZodEnum<{
243
+ secondary: "secondary";
244
+ danger: "danger";
245
+ primary: "primary";
246
+ outline: "outline";
247
+ ghost: "ghost";
248
+ }>>;
249
+ block: z.ZodOptional<z.ZodBoolean>;
250
+ submit: z.ZodOptional<z.ZodBoolean>;
251
+ }, z.core.$strict>;
252
+ Progress: z.ZodObject<{
253
+ label: z.ZodString;
254
+ value: z.ZodNumber;
255
+ max: z.ZodNumber;
256
+ }, z.core.$strict>;
257
+ Chart: z.ZodObject<{
258
+ label: z.ZodString;
259
+ variant: z.ZodEnum<{
260
+ bar: "bar";
261
+ line: "line";
262
+ area: "area";
263
+ sparkline: "sparkline";
264
+ }>;
265
+ data: z.ZodOptional<z.ZodArray<z.ZodObject<{
266
+ label: z.ZodString;
267
+ value: z.ZodNumber;
268
+ }, z.core.$strict>>>;
269
+ series: z.ZodOptional<z.ZodArray<z.ZodObject<{
270
+ label: z.ZodString;
271
+ data: z.ZodArray<z.ZodObject<{
272
+ label: z.ZodString;
273
+ value: z.ZodNumber;
274
+ }, z.core.$strict>>;
275
+ }, z.core.$strict>>>;
276
+ stacked: z.ZodOptional<z.ZodBoolean>;
277
+ showAxis: z.ZodOptional<z.ZodBoolean>;
278
+ showLegend: z.ZodOptional<z.ZodBoolean>;
279
+ }, z.core.$strict>;
280
+ Table: z.ZodObject<{
281
+ label: z.ZodString;
282
+ columns: z.ZodArray<z.ZodObject<{
283
+ label: z.ZodString;
284
+ align: z.ZodOptional<z.ZodEnum<{
285
+ start: "start";
286
+ end: "end";
287
+ }>>;
288
+ }, z.core.$strict>>;
289
+ rows: z.ZodArray<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
290
+ sortable: z.ZodOptional<z.ZodBoolean>;
291
+ }, z.core.$strict>;
292
+ };
293
+ export type StructuredSpec = {
294
+ readonly $type: string;
295
+ readonly $key?: string | number;
296
+ readonly $action?: StructuredAction;
297
+ readonly children?: StructuredSpec | readonly StructuredSpec[];
298
+ readonly [property: string]: unknown;
299
+ };
300
+ /** Bound the whole JSON tree before recursive schemas, including action payloads. */
301
+ export declare function assertBoundedJson(input: unknown, maxBytes?: number): void;
302
+ /** Validate BEFORE the upstream renderer; its property schemas describe tools, not input validation. */
303
+ export declare function parseStructuredSpec(input: unknown): StructuredSpec;
@@ -0,0 +1,21 @@
1
+ import { type ReactNode } from "react";
2
+ import type { GenerativeActionController, GenerativeActionSnapshot, GenerativeActions } from "./actions.js";
3
+ import type { GenerativeCopy } from "./copy.js";
4
+ type ResponseStatus = "loading" | "streaming" | "done" | "error";
5
+ interface Step {
6
+ snapshot: GenerativeActionSnapshot;
7
+ spec: unknown;
8
+ status: ResponseStatus;
9
+ input?: Readonly<Record<string, string | boolean>>;
10
+ result?: ReactNode;
11
+ label?: string;
12
+ }
13
+ export declare function ResponseTimeline({ controller, spec, status, actions, copy, children, }: {
14
+ controller: GenerativeActionController;
15
+ spec: unknown;
16
+ status: ResponseStatus;
17
+ actions: GenerativeActions;
18
+ copy: GenerativeCopy;
19
+ children: (step: Step, onRequest: (input: unknown) => void) => ReactNode;
20
+ }): import("react").JSX.Element;
21
+ export {};
@@ -0,0 +1,34 @@
1
+ import { type ReactNode } from "react";
2
+ import type { GenerativeUILibrary, GenerativeUIDispatch } from "@assistant-ui/react-generative-ui";
3
+ import { buttonStyles } from "../../components/button.js";
4
+ import { type StructuredAction } from "./schema.js";
5
+ export declare const GenerativeRuntimeContext: import("react").Context<{
6
+ blocked: boolean;
7
+ available: ReadonlySet<string> | undefined;
8
+ captureInput: ((input: unknown) => void) | undefined;
9
+ initialValues: Readonly<Record<string, string | boolean>> | undefined;
10
+ }>;
11
+ export type GenerativeFactResolver = (binding: string, values: Readonly<Record<string, string | boolean>>) => string | undefined;
12
+ export interface GenerativeFormProps {
13
+ children?: ReactNode;
14
+ action?: StructuredAction;
15
+ dispatch?: GenerativeUIDispatch;
16
+ title?: string;
17
+ confirm?: {
18
+ label: string;
19
+ $action?: StructuredAction;
20
+ };
21
+ cancel?: {
22
+ label: string;
23
+ $action?: StructuredAction;
24
+ };
25
+ resolveFact?: GenerativeFactResolver;
26
+ }
27
+ export declare function GenerativeForm({ children, action, dispatch, title, confirm, cancel, resolveFact, }: GenerativeFormProps): import("react").JSX.Element;
28
+ export interface GenerativeLibraryOptions {
29
+ /** Only host-approved images may load. No arbitrary model-supplied network requests. */ resolveImage?: (src: string) => string | undefined;
30
+ /** Host-derived values, such as a quote. The destination must revalidate them. */ resolveFact?: GenerativeFactResolver;
31
+ }
32
+ /** Same wire vocabulary as upstream, with SuperXD controls and a closed token-only presentation. */
33
+ export declare function createSuperxdGenerativeLibrary(options?: GenerativeLibraryOptions): GenerativeUILibrary;
34
+ export { buttonStyles };