clawport-ui 0.1.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 (132) hide show
  1. package/.env.example +35 -0
  2. package/BRANDING.md +131 -0
  3. package/CLAUDE.md +252 -0
  4. package/README.md +262 -0
  5. package/SETUP.md +337 -0
  6. package/app/agents/[id]/page.tsx +727 -0
  7. package/app/api/agents/route.ts +12 -0
  8. package/app/api/chat/[id]/route.ts +139 -0
  9. package/app/api/cron-runs/route.ts +13 -0
  10. package/app/api/crons/route.ts +12 -0
  11. package/app/api/kanban/chat/[id]/route.ts +119 -0
  12. package/app/api/kanban/chat-history/[ticketId]/route.ts +36 -0
  13. package/app/api/memory/route.ts +12 -0
  14. package/app/api/transcribe/route.ts +37 -0
  15. package/app/api/tts/route.ts +42 -0
  16. package/app/chat/[id]/page.tsx +10 -0
  17. package/app/chat/page.tsx +200 -0
  18. package/app/crons/page.tsx +870 -0
  19. package/app/docs/page.tsx +399 -0
  20. package/app/favicon.ico +0 -0
  21. package/app/globals.css +692 -0
  22. package/app/kanban/page.tsx +327 -0
  23. package/app/layout.tsx +45 -0
  24. package/app/memory/page.tsx +685 -0
  25. package/app/page.tsx +817 -0
  26. package/app/providers.tsx +37 -0
  27. package/app/settings/page.tsx +901 -0
  28. package/app/settings-provider.tsx +209 -0
  29. package/components/AgentAvatar.tsx +54 -0
  30. package/components/AgentNode.tsx +122 -0
  31. package/components/Breadcrumbs.tsx +126 -0
  32. package/components/DynamicFavicon.tsx +62 -0
  33. package/components/ErrorState.tsx +97 -0
  34. package/components/FeedView.tsx +494 -0
  35. package/components/GlobalSearch.tsx +571 -0
  36. package/components/GridView.tsx +532 -0
  37. package/components/ManorMap.tsx +157 -0
  38. package/components/MobileSidebar.tsx +251 -0
  39. package/components/NavLinks.tsx +271 -0
  40. package/components/OnboardingWizard.tsx +1067 -0
  41. package/components/Sidebar.tsx +115 -0
  42. package/components/ThemeToggle.tsx +108 -0
  43. package/components/chat/AgentList.tsx +537 -0
  44. package/components/chat/ConversationView.tsx +1047 -0
  45. package/components/chat/FileAttachment.tsx +140 -0
  46. package/components/chat/MediaPreview.tsx +111 -0
  47. package/components/chat/VoiceMessage.tsx +139 -0
  48. package/components/crons/PipelineGraph.tsx +327 -0
  49. package/components/crons/WeeklySchedule.tsx +630 -0
  50. package/components/docs/AgentsSection.tsx +209 -0
  51. package/components/docs/ApiReferenceSection.tsx +256 -0
  52. package/components/docs/ArchitectureSection.tsx +221 -0
  53. package/components/docs/ComponentsSection.tsx +253 -0
  54. package/components/docs/CronSystemSection.tsx +235 -0
  55. package/components/docs/DocSection.tsx +346 -0
  56. package/components/docs/GettingStartedSection.tsx +169 -0
  57. package/components/docs/ThemingSection.tsx +257 -0
  58. package/components/docs/TroubleshootingSection.tsx +200 -0
  59. package/components/kanban/AgentPicker.tsx +321 -0
  60. package/components/kanban/CreateTicketModal.tsx +333 -0
  61. package/components/kanban/KanbanBoard.tsx +70 -0
  62. package/components/kanban/KanbanColumn.tsx +166 -0
  63. package/components/kanban/TicketCard.tsx +245 -0
  64. package/components/kanban/TicketDetailPanel.tsx +850 -0
  65. package/components/ui/badge.tsx +48 -0
  66. package/components/ui/button.tsx +64 -0
  67. package/components/ui/card.tsx +92 -0
  68. package/components/ui/dialog.tsx +158 -0
  69. package/components/ui/scroll-area.tsx +58 -0
  70. package/components/ui/separator.tsx +28 -0
  71. package/components/ui/skeleton.tsx +27 -0
  72. package/components/ui/tabs.tsx +91 -0
  73. package/components/ui/tooltip.tsx +57 -0
  74. package/components.json +23 -0
  75. package/docs/API.md +648 -0
  76. package/docs/COMPONENTS.md +1059 -0
  77. package/docs/THEMING.md +795 -0
  78. package/lib/agents-registry.ts +35 -0
  79. package/lib/agents.json +282 -0
  80. package/lib/agents.test.ts +367 -0
  81. package/lib/agents.ts +32 -0
  82. package/lib/anthropic.test.ts +422 -0
  83. package/lib/anthropic.ts +220 -0
  84. package/lib/api-error.ts +16 -0
  85. package/lib/audio-recorder.test.ts +72 -0
  86. package/lib/audio-recorder.ts +169 -0
  87. package/lib/conversations.test.ts +331 -0
  88. package/lib/conversations.ts +117 -0
  89. package/lib/cron-pipelines.test.ts +69 -0
  90. package/lib/cron-pipelines.ts +58 -0
  91. package/lib/cron-runs.test.ts +118 -0
  92. package/lib/cron-runs.ts +67 -0
  93. package/lib/cron-utils.test.ts +222 -0
  94. package/lib/cron-utils.ts +160 -0
  95. package/lib/crons.test.ts +502 -0
  96. package/lib/crons.ts +114 -0
  97. package/lib/env.test.ts +44 -0
  98. package/lib/env.ts +14 -0
  99. package/lib/kanban/automation.test.ts +245 -0
  100. package/lib/kanban/automation.ts +143 -0
  101. package/lib/kanban/chat-store.test.ts +149 -0
  102. package/lib/kanban/chat-store.ts +81 -0
  103. package/lib/kanban/store.test.ts +238 -0
  104. package/lib/kanban/store.ts +98 -0
  105. package/lib/kanban/types.ts +50 -0
  106. package/lib/kanban/useAgentWork.ts +78 -0
  107. package/lib/memory.ts +45 -0
  108. package/lib/multimodal.test.ts +219 -0
  109. package/lib/multimodal.ts +68 -0
  110. package/lib/pipeline.integration.test.ts +343 -0
  111. package/lib/sanitize.ts +194 -0
  112. package/lib/settings.test.ts +137 -0
  113. package/lib/settings.ts +94 -0
  114. package/lib/styles.ts +24 -0
  115. package/lib/themes.ts +9 -0
  116. package/lib/transcribe.test.ts +141 -0
  117. package/lib/transcribe.ts +111 -0
  118. package/lib/types.ts +66 -0
  119. package/lib/utils.ts +6 -0
  120. package/lib/validation.test.ts +132 -0
  121. package/lib/validation.ts +80 -0
  122. package/next.config.ts +7 -0
  123. package/package.json +56 -0
  124. package/postcss.config.mjs +7 -0
  125. package/public/file.svg +1 -0
  126. package/public/globe.svg +1 -0
  127. package/public/next.svg +1 -0
  128. package/public/vercel.svg +1 -0
  129. package/public/window.svg +1 -0
  130. package/scripts/setup.mjs +215 -0
  131. package/tsconfig.json +34 -0
  132. package/vitest.config.ts +17 -0
@@ -0,0 +1,140 @@
1
+ 'use client'
2
+ import React from 'react'
3
+
4
+ interface FileAttachmentProps {
5
+ name: string
6
+ size?: number
7
+ mimeType?: string
8
+ url: string
9
+ isUser: boolean
10
+ }
11
+
12
+ function formatFileSize(bytes: number): string {
13
+ if (bytes < 1024) return `${bytes} B`
14
+ if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(0)} KB`
15
+ return `${(bytes / (1024 * 1024)).toFixed(1)} MB`
16
+ }
17
+
18
+ function fileIcon(mimeType?: string, name?: string): React.ReactNode {
19
+ const ext = name?.split('.').pop()?.toLowerCase() || ''
20
+ const isPdf = mimeType === 'application/pdf' || ext === 'pdf'
21
+ const isDoc = ['doc', 'docx'].includes(ext) || mimeType?.includes('wordprocessingml')
22
+ const isText = ['txt', 'csv', 'json', 'md'].includes(ext) || mimeType?.startsWith('text/')
23
+ const isArchive = ['zip', 'tar', 'gz', 'rar', '7z'].includes(ext)
24
+
25
+ if (isPdf) return (
26
+ <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
27
+ <path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" />
28
+ <polyline points="14 2 14 8 20 8" />
29
+ <line x1="9" y1="15" x2="15" y2="15" />
30
+ </svg>
31
+ )
32
+ if (isDoc) return (
33
+ <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
34
+ <path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" />
35
+ <polyline points="14 2 14 8 20 8" />
36
+ <line x1="16" y1="13" x2="8" y2="13" />
37
+ <line x1="16" y1="17" x2="8" y2="17" />
38
+ <polyline points="10 9 9 9 8 9" />
39
+ </svg>
40
+ )
41
+ if (isText) return (
42
+ <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
43
+ <path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" />
44
+ <polyline points="14 2 14 8 20 8" />
45
+ </svg>
46
+ )
47
+ if (isArchive) return (
48
+ <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
49
+ <path d="M21 8v13H3V8" />
50
+ <path d="M1 3h22v5H1z" />
51
+ <path d="M10 12h4" />
52
+ </svg>
53
+ )
54
+ // Generic file
55
+ return (
56
+ <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
57
+ <path d="M13 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z" />
58
+ <polyline points="13 2 13 9 20 9" />
59
+ </svg>
60
+ )
61
+ }
62
+
63
+ export function FileAttachment({ name, size, mimeType, url, isUser }: FileAttachmentProps) {
64
+ return (
65
+ <div style={{
66
+ display: 'flex',
67
+ alignItems: 'center',
68
+ gap: 'var(--space-3)',
69
+ padding: 'var(--space-3) var(--space-4)',
70
+ borderRadius: 'var(--radius-lg)',
71
+ background: isUser ? 'var(--accent)' : 'var(--material-thin)',
72
+ border: isUser ? 'none' : '1px solid var(--separator)',
73
+ maxWidth: 280,
74
+ minWidth: 180,
75
+ }}>
76
+ {/* File icon */}
77
+ <div style={{
78
+ width: 36,
79
+ height: 36,
80
+ borderRadius: 'var(--radius-sm)',
81
+ background: isUser ? 'rgba(0,0,0,0.15)' : 'var(--fill-tertiary)',
82
+ display: 'flex',
83
+ alignItems: 'center',
84
+ justifyContent: 'center',
85
+ flexShrink: 0,
86
+ color: isUser ? '#000' : 'var(--text-secondary)',
87
+ }}>
88
+ {fileIcon(mimeType, name)}
89
+ </div>
90
+
91
+ {/* Name + size */}
92
+ <div style={{ flex: 1, minWidth: 0 }}>
93
+ <div style={{
94
+ fontSize: 'var(--text-footnote)',
95
+ fontWeight: 'var(--weight-medium)',
96
+ color: isUser ? '#000' : 'var(--text-primary)',
97
+ overflow: 'hidden',
98
+ textOverflow: 'ellipsis',
99
+ whiteSpace: 'nowrap',
100
+ }}>
101
+ {name}
102
+ </div>
103
+ {size != null && (
104
+ <div style={{
105
+ fontSize: 'var(--text-caption2)',
106
+ color: isUser ? 'rgba(0,0,0,0.5)' : 'var(--text-tertiary)',
107
+ marginTop: 1,
108
+ }}>
109
+ {formatFileSize(size)}
110
+ </div>
111
+ )}
112
+ </div>
113
+
114
+ {/* Download button */}
115
+ <a
116
+ href={url}
117
+ download={name}
118
+ aria-label={`Download ${name}`}
119
+ style={{
120
+ width: 28,
121
+ height: 28,
122
+ borderRadius: '50%',
123
+ background: isUser ? 'rgba(0,0,0,0.15)' : 'var(--fill-secondary)',
124
+ display: 'flex',
125
+ alignItems: 'center',
126
+ justifyContent: 'center',
127
+ flexShrink: 0,
128
+ color: isUser ? '#000' : 'var(--text-secondary)',
129
+ textDecoration: 'none',
130
+ }}
131
+ >
132
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
133
+ <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" />
134
+ <polyline points="7 10 12 15 17 10" />
135
+ <line x1="12" y1="15" x2="12" y2="3" />
136
+ </svg>
137
+ </a>
138
+ </div>
139
+ )
140
+ }
@@ -0,0 +1,111 @@
1
+ 'use client'
2
+ import React from 'react'
3
+ import type { MediaAttachment } from '@/lib/conversations'
4
+
5
+ interface MediaPreviewProps {
6
+ attachments: MediaAttachment[]
7
+ onRemove: (index: number) => void
8
+ }
9
+
10
+ export function MediaPreview({ attachments, onRemove }: MediaPreviewProps) {
11
+ if (attachments.length === 0) return null
12
+
13
+ return (
14
+ <div style={{
15
+ display: 'flex',
16
+ gap: 'var(--space-2)',
17
+ padding: 'var(--space-2) var(--space-3)',
18
+ overflowX: 'auto',
19
+ overflowY: 'hidden',
20
+ }}>
21
+ {attachments.map((att, i) => (
22
+ <div key={i} style={{
23
+ position: 'relative',
24
+ width: 56,
25
+ height: 56,
26
+ flexShrink: 0,
27
+ borderRadius: 'var(--radius-sm)',
28
+ overflow: 'hidden',
29
+ background: 'var(--fill-tertiary)',
30
+ border: '1px solid var(--separator)',
31
+ }}>
32
+ {att.type === 'image' ? (
33
+ <img
34
+ src={att.url}
35
+ alt={att.name || 'Preview'}
36
+ style={{
37
+ width: '100%',
38
+ height: '100%',
39
+ objectFit: 'cover',
40
+ }}
41
+ />
42
+ ) : (
43
+ <div style={{
44
+ width: '100%',
45
+ height: '100%',
46
+ display: 'flex',
47
+ flexDirection: 'column',
48
+ alignItems: 'center',
49
+ justifyContent: 'center',
50
+ gap: 2,
51
+ padding: 4,
52
+ }}>
53
+ {att.type === 'audio' ? (
54
+ <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="var(--text-tertiary)" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
55
+ <path d="M9 18V5l12-2v13" />
56
+ <circle cx="6" cy="18" r="3" />
57
+ <circle cx="18" cy="16" r="3" />
58
+ </svg>
59
+ ) : (
60
+ <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="var(--text-tertiary)" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
61
+ <path d="M13 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z" />
62
+ <polyline points="13 2 13 9 20 9" />
63
+ </svg>
64
+ )}
65
+ <span style={{
66
+ fontSize: 8,
67
+ color: 'var(--text-quaternary)',
68
+ overflow: 'hidden',
69
+ textOverflow: 'ellipsis',
70
+ whiteSpace: 'nowrap',
71
+ maxWidth: '100%',
72
+ textAlign: 'center',
73
+ }}>
74
+ {att.name?.split('.').pop()?.toUpperCase() || att.type.toUpperCase()}
75
+ </span>
76
+ </div>
77
+ )}
78
+
79
+ {/* Remove button */}
80
+ <button
81
+ onClick={() => onRemove(i)}
82
+ aria-label="Remove attachment"
83
+ style={{
84
+ position: 'absolute',
85
+ top: 2,
86
+ right: 2,
87
+ width: 18,
88
+ height: 18,
89
+ borderRadius: '50%',
90
+ background: 'rgba(0,0,0,0.6)',
91
+ border: 'none',
92
+ cursor: 'pointer',
93
+ display: 'flex',
94
+ alignItems: 'center',
95
+ justifyContent: 'center',
96
+ color: '#fff',
97
+ fontSize: 11,
98
+ lineHeight: 1,
99
+ padding: 0,
100
+ }}
101
+ >
102
+ <svg width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="3" strokeLinecap="round">
103
+ <line x1="18" y1="6" x2="6" y2="18" />
104
+ <line x1="6" y1="6" x2="18" y2="18" />
105
+ </svg>
106
+ </button>
107
+ </div>
108
+ ))}
109
+ </div>
110
+ )
111
+ }
@@ -0,0 +1,139 @@
1
+ 'use client'
2
+ import React, { useEffect, useRef, useState, useCallback } from 'react'
3
+ import { formatDuration } from '@/lib/audio-recorder'
4
+
5
+ interface VoiceMessageProps {
6
+ src: string
7
+ duration: number
8
+ waveform: number[]
9
+ isUser: boolean
10
+ }
11
+
12
+ export function VoiceMessage({ src, duration, waveform, isUser }: VoiceMessageProps) {
13
+ const audioRef = useRef<HTMLAudioElement | null>(null)
14
+ const [playing, setPlaying] = useState(false)
15
+ const [progress, setProgress] = useState(0) // 0-1
16
+ const [currentTime, setCurrentTime] = useState(0)
17
+
18
+ useEffect(() => {
19
+ const audio = new Audio(src)
20
+ audioRef.current = audio
21
+
22
+ audio.addEventListener('timeupdate', () => {
23
+ if (audio.duration && isFinite(audio.duration)) {
24
+ setProgress(audio.currentTime / audio.duration)
25
+ setCurrentTime(audio.currentTime)
26
+ }
27
+ })
28
+ audio.addEventListener('ended', () => {
29
+ setPlaying(false)
30
+ setProgress(0)
31
+ setCurrentTime(0)
32
+ })
33
+ audio.addEventListener('pause', () => setPlaying(false))
34
+ audio.addEventListener('play', () => setPlaying(true))
35
+
36
+ return () => {
37
+ audio.pause()
38
+ audio.src = ''
39
+ }
40
+ }, [src])
41
+
42
+ const toggle = useCallback(() => {
43
+ const audio = audioRef.current
44
+ if (!audio) return
45
+ if (playing) {
46
+ audio.pause()
47
+ } else {
48
+ audio.play().catch(() => {})
49
+ }
50
+ }, [playing])
51
+
52
+ const bars = waveform.length > 0 ? waveform : Array(50).fill(0.1)
53
+ const displayTime = playing ? currentTime : duration
54
+
55
+ return (
56
+ <div style={{
57
+ display: 'flex',
58
+ alignItems: 'center',
59
+ gap: 'var(--space-3)',
60
+ padding: 'var(--space-3) var(--space-4)',
61
+ borderRadius: 'var(--radius-lg)',
62
+ background: isUser ? 'var(--accent)' : 'var(--material-thin)',
63
+ border: isUser ? 'none' : '1px solid var(--separator)',
64
+ maxWidth: 280,
65
+ minWidth: 200,
66
+ }}>
67
+ {/* Play/Pause button */}
68
+ <button
69
+ onClick={toggle}
70
+ aria-label={playing ? 'Pause' : 'Play'}
71
+ style={{
72
+ width: 28,
73
+ height: 28,
74
+ borderRadius: '50%',
75
+ background: isUser ? 'rgba(0,0,0,0.2)' : 'var(--fill-secondary)',
76
+ border: 'none',
77
+ cursor: 'pointer',
78
+ display: 'flex',
79
+ alignItems: 'center',
80
+ justifyContent: 'center',
81
+ flexShrink: 0,
82
+ color: isUser ? '#000' : 'var(--text-primary)',
83
+ }}
84
+ >
85
+ {playing ? (
86
+ <svg width="12" height="12" viewBox="0 0 24 24" fill="currentColor">
87
+ <rect x="6" y="4" width="4" height="16" rx="1" />
88
+ <rect x="14" y="4" width="4" height="16" rx="1" />
89
+ </svg>
90
+ ) : (
91
+ <svg width="12" height="12" viewBox="0 0 24 24" fill="currentColor">
92
+ <polygon points="6,4 20,12 6,20" />
93
+ </svg>
94
+ )}
95
+ </button>
96
+
97
+ {/* Waveform bars */}
98
+ <div style={{
99
+ flex: 1,
100
+ display: 'flex',
101
+ alignItems: 'center',
102
+ gap: 2,
103
+ height: 28,
104
+ }}>
105
+ {bars.map((amp, i) => {
106
+ const barProgress = i / bars.length
107
+ const isPlayed = barProgress <= progress
108
+ return (
109
+ <div
110
+ key={i}
111
+ style={{
112
+ width: 3,
113
+ borderRadius: 1.5,
114
+ height: `${Math.max(4, amp * 24)}px`,
115
+ background: isUser
116
+ ? (isPlayed ? 'rgba(0,0,0,0.7)' : 'rgba(0,0,0,0.25)')
117
+ : (isPlayed ? 'var(--accent)' : 'var(--fill-primary)'),
118
+ transition: 'background 100ms ease',
119
+ flexShrink: 0,
120
+ }}
121
+ />
122
+ )
123
+ })}
124
+ </div>
125
+
126
+ {/* Duration label */}
127
+ <span style={{
128
+ fontSize: 'var(--text-caption2)',
129
+ color: isUser ? 'rgba(0,0,0,0.6)' : 'var(--text-tertiary)',
130
+ fontVariantNumeric: 'tabular-nums',
131
+ flexShrink: 0,
132
+ minWidth: 28,
133
+ textAlign: 'right',
134
+ }}>
135
+ {formatDuration(displayTime)}
136
+ </span>
137
+ </div>
138
+ )
139
+ }