@promptbook/cli 0.103.0-56 → 0.103.0-67
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.
- package/apps/agents-server/TODO.txt +5 -1
- package/apps/agents-server/config.ts +3 -1
- package/apps/agents-server/package-lock.json +1220 -47
- package/apps/agents-server/package.json +4 -1
- package/apps/agents-server/src/app/actions.ts +3 -1
- package/apps/agents-server/src/app/agents/[agentName]/AgentOptionsMenu.tsx +72 -6
- package/apps/agents-server/src/app/agents/[agentName]/AgentProfileChat.tsx +21 -8
- package/apps/agents-server/src/app/agents/[agentName]/AgentProfileWrapper.tsx +44 -0
- package/apps/agents-server/src/app/agents/[agentName]/generateAgentMetadata.ts +7 -3
- package/apps/agents-server/src/app/agents/[agentName]/layout.tsx +41 -0
- package/apps/agents-server/src/app/agents/[agentName]/page.tsx +47 -100
- package/apps/agents-server/src/app/agents/[agentName]/website-integration/page.tsx +11 -2
- package/apps/agents-server/src/app/embed/page.tsx +2 -2
- package/apps/agents-server/src/app/layout.tsx +8 -24
- package/apps/agents-server/src/app/manifest.ts +8 -3
- package/apps/agents-server/src/components/AgentProfile/AgentProfile.tsx +339 -0
- package/apps/agents-server/src/components/AgentProfile/AgentProfileFromSource.tsx +23 -0
- package/apps/agents-server/src/{app/agents/[agentName] → components/AgentProfile}/AgentQrCode.tsx +8 -1
- package/apps/agents-server/src/components/LayoutWrapper/LayoutWrapper.tsx +7 -6
- package/apps/agents-server/src/database/metadataDefaults.ts +6 -0
- package/apps/agents-server/src/tools/$provideCdnForServer.ts +13 -1
- package/apps/agents-server/src/utils/cdn/classes/DigitalOceanSpaces.ts +119 -0
- package/apps/agents-server/src/utils/cdn/classes/VercelBlobStorage.ts +2 -1
- package/esm/index.es.js +65 -10
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/components.index.d.ts +2 -2
- package/esm/typings/src/_packages/types.index.d.ts +6 -0
- package/esm/typings/src/book-2.0/agent-source/AgentBasicInformation.d.ts +2 -1
- package/esm/typings/src/book-2.0/agent-source/createCommitmentRegex.d.ts +1 -1
- package/esm/typings/src/book-components/Chat/AgentChat/AgentChat.d.ts +3 -0
- package/esm/typings/src/book-components/Chat/Chat/ChatProps.d.ts +6 -0
- package/esm/typings/src/book-components/PromptbookAgent/PromptbookAgentIntegration.d.ts +52 -0
- package/esm/typings/src/book-components/PromptbookAgent/PromptbookAgentSeamlessIntegration.d.ts +14 -0
- package/esm/typings/src/book-components/icons/SendIcon.d.ts +3 -0
- package/esm/typings/src/commitments/CLOSED/CLOSED.d.ts +4 -0
- package/esm/typings/src/commitments/CLOSED/CLOSED.test.d.ts +4 -0
- package/esm/typings/src/commitments/USE_BROWSER/USE_BROWSER.d.ts +4 -0
- package/esm/typings/src/commitments/_base/BaseCommitmentDefinition.d.ts +6 -0
- package/esm/typings/src/llm-providers/agent/Agent.d.ts +3 -1
- package/esm/typings/src/other/templates/getTemplatesPipelineCollection.d.ts +1 -1
- package/esm/typings/src/types/typeAliases.d.ts +6 -0
- package/esm/typings/src/utils/color/Color.d.ts +1 -1
- package/esm/typings/src/utils/random/$generateBookBoilerplate.d.ts +6 -0
- package/esm/typings/src/utils/random/CzechNamePool.d.ts +7 -0
- package/esm/typings/src/utils/random/EnglishNamePool.d.ts +7 -0
- package/esm/typings/src/utils/random/NamePool.d.ts +17 -0
- package/esm/typings/src/utils/random/getNamePool.d.ts +10 -0
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +65 -10
- package/umd/index.umd.js.map +1 -1
- package/apps/agents-server/src/app/agents/[agentName]/AgentProfileView.tsx +0 -233
- package/esm/typings/src/book-components/PromptbookAgent/PromptbookAgent.d.ts +0 -29
- /package/apps/agents-server/src/{app/agents/[agentName] → components/AgentProfile}/QrCodeModal.tsx +0 -0
|
@@ -1,233 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { AgentBasicInformation, string_data_url, string_url_image } from '@promptbook-local/types';
|
|
4
|
-
import { RepeatIcon } from 'lucide-react';
|
|
5
|
-
import { useState } from 'react';
|
|
6
|
-
import { getAgentLinks } from './agentLinks';
|
|
7
|
-
import { AgentOptionsMenu } from './AgentOptionsMenu';
|
|
8
|
-
import { AgentProfileChat } from './AgentProfileChat';
|
|
9
|
-
import { AgentQrCode } from './AgentQrCode';
|
|
10
|
-
import { QrCodeModal } from './QrCodeModal';
|
|
11
|
-
|
|
12
|
-
type AgentProfileViewProps = {
|
|
13
|
-
agentName: string;
|
|
14
|
-
fullname: string;
|
|
15
|
-
personaDescription: string;
|
|
16
|
-
imageUrl: string | null;
|
|
17
|
-
agentUrl: string;
|
|
18
|
-
agentEmail: string;
|
|
19
|
-
brandColorHex: string;
|
|
20
|
-
brandColorLightHex: string;
|
|
21
|
-
brandColorDarkHex: string;
|
|
22
|
-
brandColorsHex: string[];
|
|
23
|
-
backgroundImage: string_url_image & string_data_url;
|
|
24
|
-
meta: AgentBasicInformation['meta'];
|
|
25
|
-
isAdmin?: boolean;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export function AgentProfileView({
|
|
29
|
-
agentName,
|
|
30
|
-
fullname,
|
|
31
|
-
personaDescription,
|
|
32
|
-
imageUrl,
|
|
33
|
-
agentUrl,
|
|
34
|
-
agentEmail,
|
|
35
|
-
brandColorHex,
|
|
36
|
-
brandColorLightHex,
|
|
37
|
-
brandColorDarkHex,
|
|
38
|
-
brandColorsHex,
|
|
39
|
-
backgroundImage,
|
|
40
|
-
meta,
|
|
41
|
-
isAdmin = false,
|
|
42
|
-
}: AgentProfileViewProps) {
|
|
43
|
-
const [isQrModalOpen, setIsQrModalOpen] = useState(false);
|
|
44
|
-
const [isFlipped, setIsFlipped] = useState(false);
|
|
45
|
-
|
|
46
|
-
// Dynamic Font Loading
|
|
47
|
-
const fontString = meta.font;
|
|
48
|
-
let fontStyle: React.CSSProperties = {};
|
|
49
|
-
|
|
50
|
-
if (fontString) {
|
|
51
|
-
const primaryFont = fontString.split(',')[0].trim().replace(/['"]/g, '');
|
|
52
|
-
const googleFontUrl = `https://fonts.googleapis.com/css2?family=${encodeURIComponent(
|
|
53
|
-
primaryFont,
|
|
54
|
-
)}:wght@400;600;700&display=swap`;
|
|
55
|
-
|
|
56
|
-
fontStyle = {
|
|
57
|
-
fontFamily: fontString,
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
// TODO: [🧠] Is this the best way to load fonts? Maybe use next/font/google?
|
|
61
|
-
// But next/font/google requires known font at build time or generic loader which might be tricky dynamically.
|
|
62
|
-
// Inserting a link tag is a simple dynamic solution.
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
return (
|
|
66
|
-
<>
|
|
67
|
-
{fontString && (
|
|
68
|
-
<style jsx global>{`
|
|
69
|
-
@import url('https://fonts.googleapis.com/css2?family=${encodeURIComponent(
|
|
70
|
-
fontString.split(',')[0].trim().replace(/['"]/g, ''),
|
|
71
|
-
)}:wght@400;600;700&display=swap');
|
|
72
|
-
`}</style>
|
|
73
|
-
)}
|
|
74
|
-
|
|
75
|
-
{/* Full-screen background with agent color */}
|
|
76
|
-
<div
|
|
77
|
-
className="min-h-[calc(100vh-60px)] w-full flex flex-col items-center justify-center p-6 md:p-12 relative overflow-hidden"
|
|
78
|
-
style={{
|
|
79
|
-
background: `url("${backgroundImage}")`,
|
|
80
|
-
backgroundSize: 'cover',
|
|
81
|
-
backgroundPosition: 'center',
|
|
82
|
-
...fontStyle,
|
|
83
|
-
}}
|
|
84
|
-
>
|
|
85
|
-
{/* Options menu in top right */}
|
|
86
|
-
<div className="absolute top-4 right-4 z-10">
|
|
87
|
-
<AgentOptionsMenu
|
|
88
|
-
agentName={agentName}
|
|
89
|
-
agentUrl={agentUrl}
|
|
90
|
-
agentEmail={agentEmail}
|
|
91
|
-
brandColorHex={brandColorHex}
|
|
92
|
-
isAdmin={isAdmin}
|
|
93
|
-
onShowQrCode={() => setIsQrModalOpen(true)}
|
|
94
|
-
backgroundImage={backgroundImage}
|
|
95
|
-
/>
|
|
96
|
-
</div>
|
|
97
|
-
|
|
98
|
-
{/* Main profile content */}
|
|
99
|
-
<div className="relative z-10 flex flex-col md:flex-row items-center gap-8 md:gap-12 max-w-5xl w-full">
|
|
100
|
-
{/* Agent image card (Flippable) */}
|
|
101
|
-
<div className="flex-shrink-0 perspective-1000 group" style={{ perspective: '1000px' }}>
|
|
102
|
-
<div
|
|
103
|
-
className="relative w-72 md:w-80 transition-all duration-700 transform-style-3d cursor-pointer"
|
|
104
|
-
style={{
|
|
105
|
-
aspectRatio: '1 / 1.62', // Golden Ratio
|
|
106
|
-
transformStyle: 'preserve-3d',
|
|
107
|
-
transform: isFlipped ? 'rotateY(180deg)' : 'rotateY(0deg)',
|
|
108
|
-
}}
|
|
109
|
-
onClick={() => setIsFlipped(!isFlipped)}
|
|
110
|
-
>
|
|
111
|
-
{/* Front of Card (Image) */}
|
|
112
|
-
<div
|
|
113
|
-
className="absolute inset-0 w-full h-full backface-hidden rounded-3xl shadow-2xl overflow-hidden border-4 border-white/20 backdrop-blur-sm"
|
|
114
|
-
style={{
|
|
115
|
-
backfaceVisibility: 'hidden',
|
|
116
|
-
backgroundColor: brandColorDarkHex,
|
|
117
|
-
boxShadow: `0 25px 50px -12px rgba(0, 0, 0, 0.25), 0 0 0 1px ${brandColorLightHex}40`,
|
|
118
|
-
}}
|
|
119
|
-
>
|
|
120
|
-
{imageUrl ? (
|
|
121
|
-
// eslint-disable-next-line @next/next/no-img-element
|
|
122
|
-
<img src={imageUrl} alt={fullname} className="w-full h-full object-cover" />
|
|
123
|
-
) : (
|
|
124
|
-
<div
|
|
125
|
-
className="w-full h-full flex items-center justify-center text-8xl font-bold text-white/80"
|
|
126
|
-
style={{ backgroundColor: brandColorDarkHex }}
|
|
127
|
-
>
|
|
128
|
-
{fullname.charAt(0).toUpperCase()}
|
|
129
|
-
</div>
|
|
130
|
-
)}
|
|
131
|
-
|
|
132
|
-
{/* Flip hint icon */}
|
|
133
|
-
<div className="absolute bottom-4 right-4 bg-black/30 p-2 rounded-full text-white/80 backdrop-blur-md opacity-0 group-hover:opacity-100 transition-opacity">
|
|
134
|
-
<RepeatIcon className="w-5 h-5" />
|
|
135
|
-
</div>
|
|
136
|
-
</div>
|
|
137
|
-
|
|
138
|
-
{/* Back of Card (QR Code) */}
|
|
139
|
-
<div
|
|
140
|
-
className="absolute inset-0 w-full h-full backface-hidden rounded-3xl shadow-2xl overflow-hidden border-4 border-white/20 backdrop-blur-sm flex flex-col items-center justify-center p-6"
|
|
141
|
-
style={{
|
|
142
|
-
backfaceVisibility: 'hidden',
|
|
143
|
-
transform: 'rotateY(180deg)',
|
|
144
|
-
background: `linear-gradient(135deg, ${brandColorLightHex} 0%, #ffffff 100%)`,
|
|
145
|
-
boxShadow: `0 25px 50px -12px rgba(0, 0, 0, 0.25), 0 0 0 1px ${brandColorLightHex}40`,
|
|
146
|
-
}}
|
|
147
|
-
>
|
|
148
|
-
<div className="transform scale-90 md:scale-100">
|
|
149
|
-
<AgentQrCode
|
|
150
|
-
agentName={agentName}
|
|
151
|
-
agentUrl={agentUrl}
|
|
152
|
-
agentEmail={agentEmail}
|
|
153
|
-
personaDescription={personaDescription}
|
|
154
|
-
meta={meta}
|
|
155
|
-
/>
|
|
156
|
-
</div>
|
|
157
|
-
|
|
158
|
-
{/* Flip hint icon */}
|
|
159
|
-
<div className="absolute bottom-4 right-4 bg-black/10 p-2 rounded-full text-black/50 backdrop-blur-md">
|
|
160
|
-
<RepeatIcon className="w-5 h-5" />
|
|
161
|
-
</div>
|
|
162
|
-
</div>
|
|
163
|
-
</div>
|
|
164
|
-
</div>
|
|
165
|
-
|
|
166
|
-
{/* Agent info */}
|
|
167
|
-
<div className="flex flex-col items-center md:items-start text-center md:text-left gap-6">
|
|
168
|
-
{/* Agent name with custom font */}
|
|
169
|
-
<h1
|
|
170
|
-
className="text-4xl md:text-5xl lg:text-6xl font-bold text-gray-900 tracking-tight"
|
|
171
|
-
style={{
|
|
172
|
-
// fontFamily: 'var(--font-poppins), Poppins, sans-serif', // <- [🧠] Should we keep this fallback or just use inherited font?
|
|
173
|
-
// Using inherited font from the wrapper div which has dynamic font
|
|
174
|
-
textShadow: '0 2px 20px rgba(255, 255, 255, 0.5)',
|
|
175
|
-
}}
|
|
176
|
-
>
|
|
177
|
-
{fullname}
|
|
178
|
-
</h1>
|
|
179
|
-
|
|
180
|
-
{/* Short description */}
|
|
181
|
-
<p className="text-lg md:text-xl text-gray-700 max-w-lg leading-relaxed font-medium">
|
|
182
|
-
{personaDescription}
|
|
183
|
-
</p>
|
|
184
|
-
|
|
185
|
-
{/* Chat */}
|
|
186
|
-
<div className="w-full">
|
|
187
|
-
<AgentProfileChat agentUrl={agentUrl} agentName={agentName} fullname={fullname} />
|
|
188
|
-
</div>
|
|
189
|
-
|
|
190
|
-
{/* Secondary Actions */}
|
|
191
|
-
<div className="flex flex-wrap justify-center md:justify-start items-center gap-4 md:gap-6 mt-2">
|
|
192
|
-
{getAgentLinks(agentName)
|
|
193
|
-
.filter((link) => ['Edit Book', 'Integration', 'All Links'].includes(link.title))
|
|
194
|
-
.map((link) => (
|
|
195
|
-
<a
|
|
196
|
-
key={link.href}
|
|
197
|
-
href={link.href}
|
|
198
|
-
className="flex items-center gap-2 text-gray-600 hover:text-gray-900 transition-colors group"
|
|
199
|
-
title={link.title}
|
|
200
|
-
>
|
|
201
|
-
<div className="p-2 rounded-full bg-white/40 group-hover:bg-white/60 transition-colors shadow-sm">
|
|
202
|
-
<link.icon className="w-5 h-5" />
|
|
203
|
-
</div>
|
|
204
|
-
<span className="font-medium text-sm">{link.title}</span>
|
|
205
|
-
</a>
|
|
206
|
-
))}
|
|
207
|
-
</div>
|
|
208
|
-
</div>
|
|
209
|
-
</div>
|
|
210
|
-
|
|
211
|
-
{/* Subtle gradient overlay at bottom */}
|
|
212
|
-
<div
|
|
213
|
-
className="absolute bottom-0 left-0 right-0 h-32 pointer-events-none"
|
|
214
|
-
style={{
|
|
215
|
-
background: `linear-gradient(to top, ${brandColorDarkHex}40, transparent)`,
|
|
216
|
-
}}
|
|
217
|
-
/>
|
|
218
|
-
</div>
|
|
219
|
-
|
|
220
|
-
{/* QR Code Modal */}
|
|
221
|
-
<QrCodeModal
|
|
222
|
-
isOpen={isQrModalOpen}
|
|
223
|
-
onClose={() => setIsQrModalOpen(false)}
|
|
224
|
-
agentName={agentName}
|
|
225
|
-
meta={meta}
|
|
226
|
-
personaDescription={personaDescription}
|
|
227
|
-
agentUrl={agentUrl}
|
|
228
|
-
agentEmail={agentEmail}
|
|
229
|
-
brandColorHex={brandColorHex}
|
|
230
|
-
/>
|
|
231
|
-
</>
|
|
232
|
-
);
|
|
233
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import type { AgentBasicInformation } from '../../book-2.0/agent-source/AgentBasicInformation';
|
|
2
|
-
type PromptbookAgentProps = {
|
|
3
|
-
/**
|
|
4
|
-
* URL of the agent to connect to
|
|
5
|
-
*
|
|
6
|
-
* @example "http://s6.ptbk.io/benjamin-white"
|
|
7
|
-
*/
|
|
8
|
-
agentUrl: string;
|
|
9
|
-
/**
|
|
10
|
-
* Optional metadata to show before the agent is connected
|
|
11
|
-
* Or to override the agent metadata if the agent does not provide it
|
|
12
|
-
*/
|
|
13
|
-
meta?: Partial<AgentBasicInformation['meta']>;
|
|
14
|
-
/**
|
|
15
|
-
* Callback when the window is opened or closed
|
|
16
|
-
*/
|
|
17
|
-
onOpenChange?: (isOpen: boolean) => void;
|
|
18
|
-
};
|
|
19
|
-
/**
|
|
20
|
-
* Renders a floating agent button that opens a chat window with the remote agent.
|
|
21
|
-
*
|
|
22
|
-
* @public exported from `@promptbook/components`
|
|
23
|
-
*/
|
|
24
|
-
export declare function PromptbookAgent(props: PromptbookAgentProps): import("react/jsx-runtime").JSX.Element;
|
|
25
|
-
export {};
|
|
26
|
-
/**
|
|
27
|
-
* TODO: !!! Load the full branding
|
|
28
|
-
* TODO: !!! <promptbook-agent> element
|
|
29
|
-
*/
|
/package/apps/agents-server/src/{app/agents/[agentName] → components/AgentProfile}/QrCodeModal.tsx
RENAMED
|
File without changes
|