@applica-software-guru/persona-chat-sdk 0.1.102

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 (132) hide show
  1. package/.eslintrc.cjs +11 -0
  2. package/.github/copilot-instructions.md +3 -0
  3. package/.nvmrc +1 -0
  4. package/.prettierignore +5 -0
  5. package/.prettierrc +8 -0
  6. package/CLAUDE.md +3 -0
  7. package/GEMINI.md +3 -0
  8. package/README.md +33 -0
  9. package/bitbucket-pipelines.yml +19 -0
  10. package/components.json +24 -0
  11. package/dist/bundle.cjs.js +28 -0
  12. package/dist/bundle.cjs.js.map +1 -0
  13. package/dist/bundle.es.js +5173 -0
  14. package/dist/bundle.es.js.map +1 -0
  15. package/dist/bundle.iife.js +28 -0
  16. package/dist/bundle.iife.js.map +1 -0
  17. package/dist/bundle.umd.js +28 -0
  18. package/dist/bundle.umd.js.map +1 -0
  19. package/dist/index.d.ts +8 -0
  20. package/dist/index.d.ts.map +1 -0
  21. package/dist/logging.d.ts +18 -0
  22. package/dist/logging.d.ts.map +1 -0
  23. package/dist/messages.d.ts +9 -0
  24. package/dist/messages.d.ts.map +1 -0
  25. package/dist/projects.d.ts +17 -0
  26. package/dist/projects.d.ts.map +1 -0
  27. package/dist/protocol/base.d.ts +25 -0
  28. package/dist/protocol/base.d.ts.map +1 -0
  29. package/dist/protocol/index.d.ts +6 -0
  30. package/dist/protocol/index.d.ts.map +1 -0
  31. package/dist/protocol/rest.d.ts +25 -0
  32. package/dist/protocol/rest.d.ts.map +1 -0
  33. package/dist/protocol/transaction.d.ts +56 -0
  34. package/dist/protocol/transaction.d.ts.map +1 -0
  35. package/dist/protocol/webrtc.d.ts +60 -0
  36. package/dist/protocol/webrtc.d.ts.map +1 -0
  37. package/dist/protocol/websocket.d.ts +22 -0
  38. package/dist/protocol/websocket.d.ts.map +1 -0
  39. package/dist/runtime/context.d.ts +34 -0
  40. package/dist/runtime/context.d.ts.map +1 -0
  41. package/dist/runtime/file-attachment-adapter.d.ts +15 -0
  42. package/dist/runtime/file-attachment-adapter.d.ts.map +1 -0
  43. package/dist/runtime/handlers.d.ts +21 -0
  44. package/dist/runtime/handlers.d.ts.map +1 -0
  45. package/dist/runtime/listeners.d.ts +6 -0
  46. package/dist/runtime/listeners.d.ts.map +1 -0
  47. package/dist/runtime/protocols.d.ts +17 -0
  48. package/dist/runtime/protocols.d.ts.map +1 -0
  49. package/dist/runtime/threads.d.ts +34 -0
  50. package/dist/runtime/threads.d.ts.map +1 -0
  51. package/dist/runtime/utils.d.ts +10 -0
  52. package/dist/runtime/utils.d.ts.map +1 -0
  53. package/dist/runtime.d.ts +6 -0
  54. package/dist/runtime.d.ts.map +1 -0
  55. package/dist/storage/base.d.ts +9 -0
  56. package/dist/storage/base.d.ts.map +1 -0
  57. package/dist/storage/index.d.ts +3 -0
  58. package/dist/storage/index.d.ts.map +1 -0
  59. package/dist/storage/persona.d.ts +29 -0
  60. package/dist/storage/persona.d.ts.map +1 -0
  61. package/dist/tools.d.ts +72 -0
  62. package/dist/tools.d.ts.map +1 -0
  63. package/dist/types.d.ts +237 -0
  64. package/dist/types.d.ts.map +1 -0
  65. package/docs/README.md +13 -0
  66. package/docs/api-reference.md +16 -0
  67. package/docs/contributing.md +21 -0
  68. package/docs/customization.md +74 -0
  69. package/docs/features.md +7 -0
  70. package/docs/installation.md +9 -0
  71. package/docs/messages.md +214 -0
  72. package/docs/protocols.md +39 -0
  73. package/docs/transactions.md +121 -0
  74. package/docs/usage.md +40 -0
  75. package/jsconfig.node.json +10 -0
  76. package/package.json +82 -0
  77. package/playground/index.html +14 -0
  78. package/playground/src/app.tsx +10 -0
  79. package/playground/src/chat.tsx +117 -0
  80. package/playground/src/components/assistant-ui/assistant-modal.tsx +57 -0
  81. package/playground/src/components/assistant-ui/attachment.tsx +197 -0
  82. package/playground/src/components/assistant-ui/markdown-text.tsx +228 -0
  83. package/playground/src/components/assistant-ui/thread-list.tsx +91 -0
  84. package/playground/src/components/assistant-ui/thread.tsx +302 -0
  85. package/playground/src/components/assistant-ui/threadlist-sidebar.tsx +59 -0
  86. package/playground/src/components/assistant-ui/tool-fallback.tsx +93 -0
  87. package/playground/src/components/assistant-ui/tooltip-icon-button.tsx +42 -0
  88. package/playground/src/components/chat/logging.tsx +53 -0
  89. package/playground/src/components/ui/avatar.tsx +51 -0
  90. package/playground/src/components/ui/button.tsx +60 -0
  91. package/playground/src/components/ui/dialog.tsx +141 -0
  92. package/playground/src/components/ui/input.tsx +21 -0
  93. package/playground/src/components/ui/separator.tsx +26 -0
  94. package/playground/src/components/ui/sheet.tsx +139 -0
  95. package/playground/src/components/ui/sidebar.tsx +619 -0
  96. package/playground/src/components/ui/skeleton.tsx +13 -0
  97. package/playground/src/components/ui/tooltip.tsx +59 -0
  98. package/playground/src/hooks/theme.ts +70 -0
  99. package/playground/src/hooks/use-mobile.ts +19 -0
  100. package/playground/src/lib/utils.ts +6 -0
  101. package/playground/src/main.tsx +10 -0
  102. package/playground/src/styles.css +120 -0
  103. package/playground/src/tools.ts +149 -0
  104. package/playground/src/vite-env.d.ts +1 -0
  105. package/preview-build.sh +23 -0
  106. package/src/index.ts +7 -0
  107. package/src/logging.ts +34 -0
  108. package/src/messages.ts +202 -0
  109. package/src/projects.ts +57 -0
  110. package/src/protocol/base.ts +73 -0
  111. package/src/protocol/index.ts +5 -0
  112. package/src/protocol/rest.ts +107 -0
  113. package/src/protocol/transaction.ts +182 -0
  114. package/src/protocol/webrtc.ts +379 -0
  115. package/src/protocol/websocket.ts +111 -0
  116. package/src/runtime/context.ts +88 -0
  117. package/src/runtime/file-attachment-adapter.ts +48 -0
  118. package/src/runtime/handlers.ts +322 -0
  119. package/src/runtime/index.ts +6 -0
  120. package/src/runtime/listeners.ts +79 -0
  121. package/src/runtime/protocols.ts +169 -0
  122. package/src/runtime/threads.ts +105 -0
  123. package/src/runtime/utils.ts +46 -0
  124. package/src/runtime.tsx +334 -0
  125. package/src/storage/base.ts +13 -0
  126. package/src/storage/index.ts +2 -0
  127. package/src/storage/persona.ts +138 -0
  128. package/src/tools.ts +211 -0
  129. package/src/types.ts +284 -0
  130. package/tsconfig.json +36 -0
  131. package/tsconfig.node.json +15 -0
  132. package/vite.config.ts +74 -0
@@ -0,0 +1,141 @@
1
+ import * as React from "react"
2
+ import * as DialogPrimitive from "@radix-ui/react-dialog"
3
+ import { XIcon } from "lucide-react"
4
+
5
+ import { cn } from "@/lib/utils"
6
+
7
+ function Dialog({
8
+ ...props
9
+ }: React.ComponentProps<typeof DialogPrimitive.Root>) {
10
+ return <DialogPrimitive.Root data-slot="dialog" {...props} />
11
+ }
12
+
13
+ function DialogTrigger({
14
+ ...props
15
+ }: React.ComponentProps<typeof DialogPrimitive.Trigger>) {
16
+ return <DialogPrimitive.Trigger data-slot="dialog-trigger" {...props} />
17
+ }
18
+
19
+ function DialogPortal({
20
+ ...props
21
+ }: React.ComponentProps<typeof DialogPrimitive.Portal>) {
22
+ return <DialogPrimitive.Portal data-slot="dialog-portal" {...props} />
23
+ }
24
+
25
+ function DialogClose({
26
+ ...props
27
+ }: React.ComponentProps<typeof DialogPrimitive.Close>) {
28
+ return <DialogPrimitive.Close data-slot="dialog-close" {...props} />
29
+ }
30
+
31
+ function DialogOverlay({
32
+ className,
33
+ ...props
34
+ }: React.ComponentProps<typeof DialogPrimitive.Overlay>) {
35
+ return (
36
+ <DialogPrimitive.Overlay
37
+ data-slot="dialog-overlay"
38
+ className={cn(
39
+ "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
40
+ className
41
+ )}
42
+ {...props}
43
+ />
44
+ )
45
+ }
46
+
47
+ function DialogContent({
48
+ className,
49
+ children,
50
+ showCloseButton = true,
51
+ ...props
52
+ }: React.ComponentProps<typeof DialogPrimitive.Content> & {
53
+ showCloseButton?: boolean
54
+ }) {
55
+ return (
56
+ <DialogPortal data-slot="dialog-portal">
57
+ <DialogOverlay />
58
+ <DialogPrimitive.Content
59
+ data-slot="dialog-content"
60
+ className={cn(
61
+ "bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",
62
+ className
63
+ )}
64
+ {...props}
65
+ >
66
+ {children}
67
+ {showCloseButton && (
68
+ <DialogPrimitive.Close
69
+ data-slot="dialog-close"
70
+ className="ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4"
71
+ >
72
+ <XIcon />
73
+ <span className="sr-only">Close</span>
74
+ </DialogPrimitive.Close>
75
+ )}
76
+ </DialogPrimitive.Content>
77
+ </DialogPortal>
78
+ )
79
+ }
80
+
81
+ function DialogHeader({ className, ...props }: React.ComponentProps<"div">) {
82
+ return (
83
+ <div
84
+ data-slot="dialog-header"
85
+ className={cn("flex flex-col gap-2 text-center sm:text-left", className)}
86
+ {...props}
87
+ />
88
+ )
89
+ }
90
+
91
+ function DialogFooter({ className, ...props }: React.ComponentProps<"div">) {
92
+ return (
93
+ <div
94
+ data-slot="dialog-footer"
95
+ className={cn(
96
+ "flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
97
+ className
98
+ )}
99
+ {...props}
100
+ />
101
+ )
102
+ }
103
+
104
+ function DialogTitle({
105
+ className,
106
+ ...props
107
+ }: React.ComponentProps<typeof DialogPrimitive.Title>) {
108
+ return (
109
+ <DialogPrimitive.Title
110
+ data-slot="dialog-title"
111
+ className={cn("text-lg leading-none font-semibold", className)}
112
+ {...props}
113
+ />
114
+ )
115
+ }
116
+
117
+ function DialogDescription({
118
+ className,
119
+ ...props
120
+ }: React.ComponentProps<typeof DialogPrimitive.Description>) {
121
+ return (
122
+ <DialogPrimitive.Description
123
+ data-slot="dialog-description"
124
+ className={cn("text-muted-foreground text-sm", className)}
125
+ {...props}
126
+ />
127
+ )
128
+ }
129
+
130
+ export {
131
+ Dialog,
132
+ DialogClose,
133
+ DialogContent,
134
+ DialogDescription,
135
+ DialogFooter,
136
+ DialogHeader,
137
+ DialogOverlay,
138
+ DialogPortal,
139
+ DialogTitle,
140
+ DialogTrigger,
141
+ }
@@ -0,0 +1,21 @@
1
+ import * as React from "react"
2
+
3
+ import { cn } from "@/lib/utils"
4
+
5
+ function Input({ className, type, ...props }: React.ComponentProps<"input">) {
6
+ return (
7
+ <input
8
+ type={type}
9
+ data-slot="input"
10
+ className={cn(
11
+ "file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
12
+ "focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
13
+ "aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
14
+ className
15
+ )}
16
+ {...props}
17
+ />
18
+ )
19
+ }
20
+
21
+ export { Input }
@@ -0,0 +1,26 @@
1
+ import * as React from "react"
2
+ import * as SeparatorPrimitive from "@radix-ui/react-separator"
3
+
4
+ import { cn } from "@/lib/utils"
5
+
6
+ function Separator({
7
+ className,
8
+ orientation = "horizontal",
9
+ decorative = true,
10
+ ...props
11
+ }: React.ComponentProps<typeof SeparatorPrimitive.Root>) {
12
+ return (
13
+ <SeparatorPrimitive.Root
14
+ data-slot="separator"
15
+ decorative={decorative}
16
+ orientation={orientation}
17
+ className={cn(
18
+ "bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",
19
+ className
20
+ )}
21
+ {...props}
22
+ />
23
+ )
24
+ }
25
+
26
+ export { Separator }
@@ -0,0 +1,139 @@
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import * as SheetPrimitive from "@radix-ui/react-dialog"
5
+ import { XIcon } from "lucide-react"
6
+
7
+ import { cn } from "@/lib/utils"
8
+
9
+ function Sheet({ ...props }: React.ComponentProps<typeof SheetPrimitive.Root>) {
10
+ return <SheetPrimitive.Root data-slot="sheet" {...props} />
11
+ }
12
+
13
+ function SheetTrigger({
14
+ ...props
15
+ }: React.ComponentProps<typeof SheetPrimitive.Trigger>) {
16
+ return <SheetPrimitive.Trigger data-slot="sheet-trigger" {...props} />
17
+ }
18
+
19
+ function SheetClose({
20
+ ...props
21
+ }: React.ComponentProps<typeof SheetPrimitive.Close>) {
22
+ return <SheetPrimitive.Close data-slot="sheet-close" {...props} />
23
+ }
24
+
25
+ function SheetPortal({
26
+ ...props
27
+ }: React.ComponentProps<typeof SheetPrimitive.Portal>) {
28
+ return <SheetPrimitive.Portal data-slot="sheet-portal" {...props} />
29
+ }
30
+
31
+ function SheetOverlay({
32
+ className,
33
+ ...props
34
+ }: React.ComponentProps<typeof SheetPrimitive.Overlay>) {
35
+ return (
36
+ <SheetPrimitive.Overlay
37
+ data-slot="sheet-overlay"
38
+ className={cn(
39
+ "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
40
+ className
41
+ )}
42
+ {...props}
43
+ />
44
+ )
45
+ }
46
+
47
+ function SheetContent({
48
+ className,
49
+ children,
50
+ side = "right",
51
+ ...props
52
+ }: React.ComponentProps<typeof SheetPrimitive.Content> & {
53
+ side?: "top" | "right" | "bottom" | "left"
54
+ }) {
55
+ return (
56
+ <SheetPortal>
57
+ <SheetOverlay />
58
+ <SheetPrimitive.Content
59
+ data-slot="sheet-content"
60
+ className={cn(
61
+ "bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500",
62
+ side === "right" &&
63
+ "data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm",
64
+ side === "left" &&
65
+ "data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm",
66
+ side === "top" &&
67
+ "data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b",
68
+ side === "bottom" &&
69
+ "data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t",
70
+ className
71
+ )}
72
+ {...props}
73
+ >
74
+ {children}
75
+ <SheetPrimitive.Close className="ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none">
76
+ <XIcon className="size-4" />
77
+ <span className="sr-only">Close</span>
78
+ </SheetPrimitive.Close>
79
+ </SheetPrimitive.Content>
80
+ </SheetPortal>
81
+ )
82
+ }
83
+
84
+ function SheetHeader({ className, ...props }: React.ComponentProps<"div">) {
85
+ return (
86
+ <div
87
+ data-slot="sheet-header"
88
+ className={cn("flex flex-col gap-1.5 p-4", className)}
89
+ {...props}
90
+ />
91
+ )
92
+ }
93
+
94
+ function SheetFooter({ className, ...props }: React.ComponentProps<"div">) {
95
+ return (
96
+ <div
97
+ data-slot="sheet-footer"
98
+ className={cn("mt-auto flex flex-col gap-2 p-4", className)}
99
+ {...props}
100
+ />
101
+ )
102
+ }
103
+
104
+ function SheetTitle({
105
+ className,
106
+ ...props
107
+ }: React.ComponentProps<typeof SheetPrimitive.Title>) {
108
+ return (
109
+ <SheetPrimitive.Title
110
+ data-slot="sheet-title"
111
+ className={cn("text-foreground font-semibold", className)}
112
+ {...props}
113
+ />
114
+ )
115
+ }
116
+
117
+ function SheetDescription({
118
+ className,
119
+ ...props
120
+ }: React.ComponentProps<typeof SheetPrimitive.Description>) {
121
+ return (
122
+ <SheetPrimitive.Description
123
+ data-slot="sheet-description"
124
+ className={cn("text-muted-foreground text-sm", className)}
125
+ {...props}
126
+ />
127
+ )
128
+ }
129
+
130
+ export {
131
+ Sheet,
132
+ SheetTrigger,
133
+ SheetClose,
134
+ SheetContent,
135
+ SheetHeader,
136
+ SheetFooter,
137
+ SheetTitle,
138
+ SheetDescription,
139
+ }