@anthusai/papyrus 1.0.0 → 1.1.1-next.1

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 (33) hide show
  1. package/amplify/auth/prospectus-google-client.js +66 -0
  2. package/amplify/auth/prospectus-google-client.ts +71 -0
  3. package/amplify/auth/resource.js +4 -1
  4. package/amplify/auth/resource.ts +5 -1
  5. package/amplify/data/schema.js +0 -2
  6. package/amplify/data/schema.ts +0 -2
  7. package/amplify/functions/email-submission-processor/handler.py +3 -1
  8. package/amplify/functions/ses-inbound-receive/handler.ts +32 -4
  9. package/amplify/functions/shared/email-submission.ts +109 -1
  10. package/amplify/site-backend.js +8 -1
  11. package/amplify/site-backend.ts +9 -1
  12. package/app/api/auth/prospectus/callback/route.ts +9 -0
  13. package/app/api/auth/prospectus/selection/route.ts +9 -0
  14. package/app/api/auth/prospectus/session/route.ts +9 -0
  15. package/app/api/auth/prospectus/sign-in/route.ts +9 -0
  16. package/app/api/auth/prospectus/sign-out/route.ts +9 -0
  17. package/app/tailwind.css +0 -6
  18. package/components/newsroom-board-view.tsx +2 -2
  19. package/components/priming-proof-page.tsx +7 -5
  20. package/components/topic-steering-workspace.tsx +0 -2
  21. package/infra/amplify-app-shell.js +20 -2
  22. package/infra/amplify-app-shell.ts +22 -2
  23. package/infra/site-config.js +1 -1
  24. package/infra/site-config.ts +1 -1
  25. package/lib/approved-priming-proof-reports.ts +1 -1
  26. package/lib/newsroom-board.ts +8 -5
  27. package/lib/priming-proof-report.ts +1 -0
  28. package/lib/prospectus-publication-access.ts +53 -0
  29. package/lib/prospectus-session.ts +196 -0
  30. package/lib/prospectus-sign-in-routes.ts +284 -0
  31. package/package.json +10 -8
  32. package/routes.manifest.json +56 -1
  33. package/components/ai-elements/message.tsx +0 -360
@@ -1,360 +0,0 @@
1
- "use client";
2
-
3
- import { Button } from "../ui/button";
4
- import {
5
- ButtonGroup,
6
- ButtonGroupText,
7
- } from "../ui/button-group";
8
- import {
9
- Tooltip,
10
- TooltipContent,
11
- TooltipProvider,
12
- TooltipTrigger,
13
- } from "../ui/tooltip";
14
- import { cn } from "../../lib/utils";
15
- import { cjk } from "@streamdown/cjk";
16
- import { code } from "@streamdown/code";
17
- import { math } from "@streamdown/math";
18
- import { mermaid } from "@streamdown/mermaid";
19
- import type { UIMessage } from "ai";
20
- import { ChevronLeftIcon, ChevronRightIcon } from "lucide-react";
21
- import type { ComponentProps, HTMLAttributes, ReactElement } from "react";
22
- import {
23
- createContext,
24
- memo,
25
- useCallback,
26
- useContext,
27
- useEffect,
28
- useMemo,
29
- useState,
30
- } from "react";
31
- import { Streamdown } from "streamdown";
32
-
33
- export type MessageProps = HTMLAttributes<HTMLDivElement> & {
34
- from: UIMessage["role"];
35
- };
36
-
37
- export const Message = ({ className, from, ...props }: MessageProps) => (
38
- <div
39
- className={cn(
40
- "group flex w-full max-w-[95%] flex-col gap-2",
41
- from === "user" ? "is-user ml-auto justify-end" : "is-assistant",
42
- className
43
- )}
44
- {...props}
45
- />
46
- );
47
-
48
- export type MessageContentProps = HTMLAttributes<HTMLDivElement>;
49
-
50
- export const MessageContent = ({
51
- children,
52
- className,
53
- ...props
54
- }: MessageContentProps) => (
55
- <div
56
- className={cn(
57
- "is-user:dark flex w-fit min-w-0 max-w-full flex-col gap-2 overflow-hidden text-sm",
58
- "group-[.is-user]:ml-auto group-[.is-user]:rounded-lg group-[.is-user]:bg-secondary group-[.is-user]:px-4 group-[.is-user]:py-3 group-[.is-user]:text-foreground",
59
- "group-[.is-assistant]:text-foreground",
60
- className
61
- )}
62
- {...props}
63
- >
64
- {children}
65
- </div>
66
- );
67
-
68
- export type MessageActionsProps = ComponentProps<"div">;
69
-
70
- export const MessageActions = ({
71
- className,
72
- children,
73
- ...props
74
- }: MessageActionsProps) => (
75
- <div className={cn("flex items-center gap-1", className)} {...props}>
76
- {children}
77
- </div>
78
- );
79
-
80
- export type MessageActionProps = ComponentProps<typeof Button> & {
81
- tooltip?: string;
82
- label?: string;
83
- };
84
-
85
- export const MessageAction = ({
86
- tooltip,
87
- children,
88
- label,
89
- variant = "ghost",
90
- size = "icon-sm",
91
- ...props
92
- }: MessageActionProps) => {
93
- const button = (
94
- <Button size={size} type="button" variant={variant} {...props}>
95
- {children}
96
- <span className="sr-only">{label || tooltip}</span>
97
- </Button>
98
- );
99
-
100
- if (tooltip) {
101
- return (
102
- <TooltipProvider>
103
- <Tooltip>
104
- <TooltipTrigger>{button}</TooltipTrigger>
105
- <TooltipContent>
106
- <p>{tooltip}</p>
107
- </TooltipContent>
108
- </Tooltip>
109
- </TooltipProvider>
110
- );
111
- }
112
-
113
- return button;
114
- };
115
-
116
- interface MessageBranchContextType {
117
- currentBranch: number;
118
- totalBranches: number;
119
- goToPrevious: () => void;
120
- goToNext: () => void;
121
- branches: ReactElement[];
122
- setBranches: (branches: ReactElement[]) => void;
123
- }
124
-
125
- const MessageBranchContext = createContext<MessageBranchContextType | null>(
126
- null
127
- );
128
-
129
- const useMessageBranch = () => {
130
- const context = useContext(MessageBranchContext);
131
-
132
- if (!context) {
133
- throw new Error(
134
- "MessageBranch components must be used within MessageBranch"
135
- );
136
- }
137
-
138
- return context;
139
- };
140
-
141
- export type MessageBranchProps = HTMLAttributes<HTMLDivElement> & {
142
- defaultBranch?: number;
143
- onBranchChange?: (branchIndex: number) => void;
144
- };
145
-
146
- export const MessageBranch = ({
147
- defaultBranch = 0,
148
- onBranchChange,
149
- className,
150
- ...props
151
- }: MessageBranchProps) => {
152
- const [currentBranch, setCurrentBranch] = useState(defaultBranch);
153
- const [branches, setBranches] = useState<ReactElement[]>([]);
154
-
155
- const handleBranchChange = useCallback(
156
- (newBranch: number) => {
157
- setCurrentBranch(newBranch);
158
- onBranchChange?.(newBranch);
159
- },
160
- [onBranchChange]
161
- );
162
-
163
- const goToPrevious = useCallback(() => {
164
- const newBranch =
165
- currentBranch > 0 ? currentBranch - 1 : branches.length - 1;
166
- handleBranchChange(newBranch);
167
- }, [currentBranch, branches.length, handleBranchChange]);
168
-
169
- const goToNext = useCallback(() => {
170
- const newBranch =
171
- currentBranch < branches.length - 1 ? currentBranch + 1 : 0;
172
- handleBranchChange(newBranch);
173
- }, [currentBranch, branches.length, handleBranchChange]);
174
-
175
- const contextValue = useMemo<MessageBranchContextType>(
176
- () => ({
177
- branches,
178
- currentBranch,
179
- goToNext,
180
- goToPrevious,
181
- setBranches,
182
- totalBranches: branches.length,
183
- }),
184
- [branches, currentBranch, goToNext, goToPrevious]
185
- );
186
-
187
- return (
188
- <MessageBranchContext.Provider value={contextValue}>
189
- <div
190
- className={cn("grid w-full gap-2 [&>div]:pb-0", className)}
191
- {...props}
192
- />
193
- </MessageBranchContext.Provider>
194
- );
195
- };
196
-
197
- export type MessageBranchContentProps = HTMLAttributes<HTMLDivElement>;
198
-
199
- export const MessageBranchContent = ({
200
- children,
201
- ...props
202
- }: MessageBranchContentProps) => {
203
- const { currentBranch, setBranches, branches } = useMessageBranch();
204
- const childrenArray = useMemo(
205
- () => (Array.isArray(children) ? children : [children]),
206
- [children]
207
- );
208
-
209
- // Use useEffect to update branches when they change
210
- useEffect(() => {
211
- if (branches.length !== childrenArray.length) {
212
- setBranches(childrenArray);
213
- }
214
- }, [childrenArray, branches, setBranches]);
215
-
216
- return childrenArray.map((branch, index) => (
217
- <div
218
- className={cn(
219
- "grid gap-2 overflow-hidden [&>div]:pb-0",
220
- index === currentBranch ? "block" : "hidden"
221
- )}
222
- key={branch.key}
223
- {...props}
224
- >
225
- {branch}
226
- </div>
227
- ));
228
- };
229
-
230
- export type MessageBranchSelectorProps = ComponentProps<typeof ButtonGroup>;
231
-
232
- export const MessageBranchSelector = ({
233
- className,
234
- ...props
235
- }: MessageBranchSelectorProps) => {
236
- const { totalBranches } = useMessageBranch();
237
-
238
- // Don't render if there's only one branch
239
- if (totalBranches <= 1) {
240
- return null;
241
- }
242
-
243
- return (
244
- <ButtonGroup
245
- className={cn(
246
- "[&>*:not(:first-child)]:rounded-l-md [&>*:not(:last-child)]:rounded-r-md",
247
- className
248
- )}
249
- orientation="horizontal"
250
- {...props}
251
- />
252
- );
253
- };
254
-
255
- export type MessageBranchPreviousProps = ComponentProps<typeof Button>;
256
-
257
- export const MessageBranchPrevious = ({
258
- children,
259
- ...props
260
- }: MessageBranchPreviousProps) => {
261
- const { goToPrevious, totalBranches } = useMessageBranch();
262
-
263
- return (
264
- <Button
265
- aria-label="Previous branch"
266
- disabled={totalBranches <= 1}
267
- onClick={goToPrevious}
268
- size="icon-sm"
269
- type="button"
270
- variant="ghost"
271
- {...props}
272
- >
273
- {children ?? <ChevronLeftIcon size={14} />}
274
- </Button>
275
- );
276
- };
277
-
278
- export type MessageBranchNextProps = ComponentProps<typeof Button>;
279
-
280
- export const MessageBranchNext = ({
281
- children,
282
- ...props
283
- }: MessageBranchNextProps) => {
284
- const { goToNext, totalBranches } = useMessageBranch();
285
-
286
- return (
287
- <Button
288
- aria-label="Next branch"
289
- disabled={totalBranches <= 1}
290
- onClick={goToNext}
291
- size="icon-sm"
292
- type="button"
293
- variant="ghost"
294
- {...props}
295
- >
296
- {children ?? <ChevronRightIcon size={14} />}
297
- </Button>
298
- );
299
- };
300
-
301
- export type MessageBranchPageProps = HTMLAttributes<HTMLSpanElement>;
302
-
303
- export const MessageBranchPage = ({
304
- className,
305
- ...props
306
- }: MessageBranchPageProps) => {
307
- const { currentBranch, totalBranches } = useMessageBranch();
308
-
309
- return (
310
- <ButtonGroupText
311
- className={cn(
312
- "border-none bg-transparent text-muted-foreground shadow-none",
313
- className
314
- )}
315
- {...props}
316
- >
317
- {currentBranch + 1} of {totalBranches}
318
- </ButtonGroupText>
319
- );
320
- };
321
-
322
- export type MessageResponseProps = ComponentProps<typeof Streamdown>;
323
-
324
- const streamdownPlugins = { cjk, code, math, mermaid };
325
-
326
- export const MessageResponse = memo(
327
- ({ className, ...props }: MessageResponseProps) => (
328
- <Streamdown
329
- className={cn(
330
- "size-full [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",
331
- className
332
- )}
333
- plugins={streamdownPlugins}
334
- {...props}
335
- />
336
- ),
337
- (prevProps, nextProps) =>
338
- prevProps.children === nextProps.children &&
339
- nextProps.isAnimating === prevProps.isAnimating
340
- );
341
-
342
- MessageResponse.displayName = "MessageResponse";
343
-
344
- export type MessageToolbarProps = ComponentProps<"div">;
345
-
346
- export const MessageToolbar = ({
347
- className,
348
- children,
349
- ...props
350
- }: MessageToolbarProps) => (
351
- <div
352
- className={cn(
353
- "mt-4 flex w-full items-center justify-between gap-4",
354
- className
355
- )}
356
- {...props}
357
- >
358
- {children}
359
- </div>
360
- );