@promptbook/cli 0.104.0-1 → 0.104.0-10
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/config.ts +1 -3
- package/apps/agents-server/next.config.ts +2 -2
- package/apps/agents-server/package.json +7 -3
- package/apps/agents-server/public/fonts/OpenMoji-color-cbdt.woff2 +0 -0
- package/apps/agents-server/public/swagger.json +115 -0
- package/apps/agents-server/scripts/generate-reserved-paths/generate-reserved-paths.ts +54 -0
- package/apps/agents-server/scripts/generate-reserved-paths/tsconfig.json +19 -0
- package/apps/agents-server/src/app/AddAgentButton.tsx +47 -21
- package/apps/agents-server/src/app/actions.ts +22 -5
- package/apps/agents-server/src/app/admin/browser-test/BrowserTestClient.tsx +211 -0
- package/apps/agents-server/src/app/admin/browser-test/page.tsx +13 -0
- package/apps/agents-server/src/app/admin/chat-feedback/ChatFeedbackClient.tsx +221 -274
- package/apps/agents-server/src/app/admin/chat-history/ChatHistoryClient.tsx +94 -137
- package/apps/agents-server/src/app/admin/messages/MessagesClient.tsx +294 -0
- package/apps/agents-server/src/app/admin/messages/page.tsx +13 -0
- package/apps/agents-server/src/app/admin/messages/send-email/SendEmailClient.tsx +104 -0
- package/apps/agents-server/src/app/admin/messages/send-email/actions.ts +35 -0
- package/apps/agents-server/src/app/admin/messages/send-email/page.tsx +13 -0
- package/apps/agents-server/src/app/admin/metadata/MetadataClient.tsx +23 -19
- package/apps/agents-server/src/app/agents/[agentName]/AgentChatWrapper.tsx +15 -1
- package/apps/agents-server/src/app/agents/[agentName]/AgentOptionsMenu.tsx +51 -9
- package/apps/agents-server/src/app/agents/[agentName]/AgentProfileChat.tsx +47 -4
- package/apps/agents-server/src/app/agents/[agentName]/AgentProfileWrapper.tsx +53 -11
- package/apps/agents-server/src/app/agents/[agentName]/_utils.ts +23 -3
- package/apps/agents-server/src/app/agents/[agentName]/agentLinks.tsx +8 -8
- package/apps/agents-server/src/app/agents/[agentName]/api/agents/route.ts +17 -26
- package/apps/agents-server/src/app/agents/[agentName]/api/book/route.ts +4 -2
- package/apps/agents-server/src/app/agents/[agentName]/api/chat/route.ts +20 -0
- package/apps/agents-server/src/app/agents/[agentName]/api/mcp/route.ts +6 -11
- package/apps/agents-server/src/app/agents/[agentName]/api/profile/route.ts +5 -1
- package/apps/agents-server/src/app/agents/[agentName]/api/voice/route.ts +5 -2
- package/apps/agents-server/src/app/agents/[agentName]/book/BookEditorWrapper.tsx +20 -16
- package/apps/agents-server/src/app/agents/[agentName]/book/page.tsx +15 -2
- package/apps/agents-server/src/app/agents/[agentName]/book+chat/page.tsx +15 -2
- package/apps/agents-server/src/app/agents/[agentName]/chat/page.tsx +12 -0
- package/apps/agents-server/src/app/agents/[agentName]/code/api/route.ts +68 -0
- package/apps/agents-server/src/app/agents/[agentName]/code/page.tsx +223 -0
- package/apps/agents-server/src/app/agents/[agentName]/generateAgentMetadata.ts +5 -0
- package/apps/agents-server/src/app/agents/[agentName]/history/actions.ts +2 -2
- package/apps/agents-server/src/app/agents/[agentName]/history/page.tsx +10 -3
- package/apps/agents-server/src/app/agents/[agentName]/images/default-avatar.png/getAgentDefaultAvatarPrompt.ts +31 -0
- package/apps/agents-server/src/app/agents/[agentName]/images/default-avatar.png/route.ts +194 -0
- package/apps/agents-server/src/app/agents/[agentName]/images/icon-256.png/route.tsx +14 -2
- package/apps/agents-server/src/app/agents/[agentName]/images/page.tsx +200 -0
- package/apps/agents-server/src/app/agents/[agentName]/images/screenshot-fullhd.png/route.tsx +4 -3
- package/apps/agents-server/src/app/agents/[agentName]/images/screenshot-phone.png/route.tsx +4 -3
- package/apps/agents-server/src/app/agents/[agentName]/integration/page.tsx +10 -3
- package/apps/agents-server/src/app/agents/[agentName]/links/page.tsx +11 -4
- package/apps/agents-server/src/app/agents/[agentName]/opengraph-image.tsx +11 -2
- package/apps/agents-server/src/app/agents/[agentName]/page.tsx +18 -10
- package/apps/agents-server/src/app/agents/[agentName]/system-message/page.tsx +100 -0
- package/apps/agents-server/src/app/api/admin-email/route.ts +12 -0
- package/apps/agents-server/src/app/api/agents/[agentName]/clone/route.ts +13 -14
- package/apps/agents-server/src/app/api/agents/[agentName]/restore/route.ts +20 -0
- package/apps/agents-server/src/app/api/agents/[agentName]/route.ts +43 -1
- package/apps/agents-server/src/app/api/agents/route.ts +28 -3
- package/apps/agents-server/src/app/api/api-tokens/route.ts +6 -7
- package/apps/agents-server/src/app/api/browser-test/act/route.ts +141 -0
- package/apps/agents-server/src/app/api/browser-test/screenshot/route.ts +30 -0
- package/apps/agents-server/src/app/api/browser-test/scroll-facebook/route.ts +62 -0
- package/apps/agents-server/src/app/api/docs/book.md/route.ts +61 -0
- package/apps/agents-server/src/app/api/emails/incoming/sendgrid/route.ts +48 -0
- package/apps/agents-server/src/app/api/federated-agents/route.ts +12 -0
- package/apps/agents-server/src/app/api/images/[filename]/route.ts +107 -0
- package/apps/agents-server/src/app/api/messages/route.ts +102 -0
- package/apps/agents-server/src/app/api/metadata/route.ts +5 -6
- package/apps/agents-server/src/app/api/upload/route.ts +128 -45
- package/apps/agents-server/src/app/docs/[docId]/page.tsx +2 -3
- package/apps/agents-server/src/app/docs/page.tsx +12 -12
- package/apps/agents-server/src/app/globals.css +140 -33
- package/apps/agents-server/src/app/humans.txt/route.ts +1 -1
- package/apps/agents-server/src/app/layout.tsx +27 -22
- package/apps/agents-server/src/app/page.tsx +54 -6
- package/apps/agents-server/src/app/recycle-bin/actions.ts +20 -14
- package/apps/agents-server/src/app/recycle-bin/page.tsx +27 -41
- package/apps/agents-server/src/app/robots.txt/route.ts +1 -1
- package/apps/agents-server/src/app/security.txt/route.ts +1 -1
- package/apps/agents-server/src/app/sitemap.xml/route.ts +9 -7
- package/apps/agents-server/src/app/swagger/page.tsx +14 -0
- package/apps/agents-server/src/components/AgentProfile/AgentProfile.tsx +41 -116
- package/apps/agents-server/src/components/AgentProfile/AgentProfileImage.tsx +92 -0
- package/apps/agents-server/src/components/AgentProfile/QrCodeModal.tsx +0 -1
- package/apps/agents-server/src/components/AgentProfile/useAgentBackground.ts +97 -0
- package/apps/agents-server/src/components/Auth/AuthControls.tsx +5 -4
- package/apps/agents-server/src/components/DeletedAgentBanner.tsx +26 -0
- package/apps/agents-server/src/components/DocsToolbar/DocsToolbar.tsx +38 -0
- package/apps/agents-server/src/components/DocumentationContent/DocumentationContent.tsx +11 -9
- package/apps/agents-server/src/components/Footer/Footer.tsx +5 -5
- package/apps/agents-server/src/components/ForgottenPasswordDialog/ForgottenPasswordDialog.tsx +61 -0
- package/apps/agents-server/src/components/Header/Header.tsx +114 -40
- package/apps/agents-server/src/components/Homepage/AgentCard.tsx +145 -23
- package/apps/agents-server/src/components/Homepage/AgentsList.tsx +93 -15
- package/apps/agents-server/src/components/Homepage/DeletedAgentsList.tsx +66 -0
- package/apps/agents-server/src/components/Homepage/ExternalAgentsSection.tsx +12 -3
- package/apps/agents-server/src/components/Homepage/ExternalAgentsSectionClient.tsx +19 -10
- package/apps/agents-server/src/components/LayoutWrapper/LayoutWrapper.tsx +3 -2
- package/apps/agents-server/src/components/LoginForm/LoginForm.tsx +50 -1
- package/apps/agents-server/src/components/NewAgentDialog/NewAgentDialog.tsx +88 -0
- package/apps/agents-server/src/components/NotFoundPage/NotFoundPage.tsx +7 -2
- package/apps/agents-server/src/components/OpenMojiIcon/OpenMojiIcon.tsx +16 -7
- package/apps/agents-server/src/components/PrintHeader/PrintHeader.tsx +4 -4
- package/apps/agents-server/src/components/RegisterUserDialog/RegisterUserDialog.tsx +61 -0
- package/apps/agents-server/src/components/VercelDeploymentCard/VercelDeploymentCard.tsx +2 -0
- package/apps/agents-server/src/components/_utils/generateMetaTxt.ts +12 -10
- package/apps/agents-server/src/components/_utils/headlessParam.tsx +7 -3
- package/apps/agents-server/src/database/$provideSupabaseForBrowser.ts +3 -3
- package/apps/agents-server/src/database/$provideSupabaseForServer.ts +1 -1
- package/apps/agents-server/src/database/$provideSupabaseForWorker.ts +3 -3
- package/apps/agents-server/src/database/metadataDefaults.ts +19 -1
- package/apps/agents-server/src/database/migrate.ts +34 -1
- package/apps/agents-server/src/database/migrations/2025-11-0001-initial-schema.sql +1 -3
- package/apps/agents-server/src/database/migrations/2025-11-0002-metadata-table.sql +1 -3
- package/apps/agents-server/src/database/migrations/2025-12-0240-agent-public-id.sql +3 -0
- package/apps/agents-server/src/database/migrations/2025-12-0360-agent-deleted-at.sql +1 -0
- package/apps/agents-server/src/database/migrations/2025-12-0370-image-table.sql +19 -0
- package/apps/agents-server/src/database/migrations/2025-12-0380-agent-visibility.sql +1 -0
- package/apps/agents-server/src/database/migrations/2025-12-0390-upload-tracking.sql +20 -0
- package/apps/agents-server/src/database/migrations/2025-12-0401-file-upload-status.sql +13 -0
- package/apps/agents-server/src/database/migrations/2025-12-0402-message-table.sql +42 -0
- package/apps/agents-server/src/database/migrations/2025-12-0403-generation-lock-table.sql +15 -0
- package/apps/agents-server/src/database/migrations/2025-12-0640-openai-assistant-cache.sql +12 -0
- package/apps/agents-server/src/database/migrations/2025-12-0820-agent-history-permanent-id.sql +29 -0
- package/apps/agents-server/src/database/schema.ts +231 -4
- package/apps/agents-server/src/generated/reservedPaths.ts +32 -0
- package/apps/agents-server/src/message-providers/email/_common/Email.ts +73 -0
- package/apps/agents-server/src/message-providers/email/_common/utils/TODO.txt +1 -0
- package/apps/agents-server/src/message-providers/email/_common/utils/parseEmailAddress.test.ts.todo +108 -0
- package/apps/agents-server/src/message-providers/email/_common/utils/parseEmailAddress.ts +62 -0
- package/apps/agents-server/src/message-providers/email/_common/utils/parseEmailAddresses.test.ts.todo +117 -0
- package/apps/agents-server/src/message-providers/email/_common/utils/parseEmailAddresses.ts +19 -0
- package/apps/agents-server/src/message-providers/email/_common/utils/stringifyEmailAddress.test.ts.todo +119 -0
- package/apps/agents-server/src/message-providers/email/_common/utils/stringifyEmailAddress.ts +19 -0
- package/apps/agents-server/src/message-providers/email/_common/utils/stringifyEmailAddresses.test.ts.todo +74 -0
- package/apps/agents-server/src/message-providers/email/_common/utils/stringifyEmailAddresses.ts +14 -0
- package/apps/agents-server/src/message-providers/email/sendgrid/SendgridMessageProvider.ts +44 -0
- package/apps/agents-server/src/message-providers/email/sendgrid/parseInboundSendgridEmail.ts +49 -0
- package/apps/agents-server/src/message-providers/email/zeptomail/ZeptomailMessageProvider.ts +51 -0
- package/apps/agents-server/src/message-providers/index.ts +13 -0
- package/apps/agents-server/src/message-providers/interfaces/MessageProvider.ts +11 -0
- package/apps/agents-server/src/middleware.ts +19 -23
- package/apps/agents-server/src/tools/$provideBrowserForServer.ts +32 -0
- package/apps/agents-server/src/tools/$provideCdnForServer.ts +7 -2
- package/apps/agents-server/src/utils/auth.ts +117 -17
- package/apps/agents-server/src/utils/cdn/classes/TrackedFilesStorage.ts +57 -0
- package/apps/agents-server/src/utils/cdn/classes/VercelBlobStorage.ts +4 -0
- package/apps/agents-server/src/utils/cdn/interfaces/IFilesStorage.ts +18 -0
- package/apps/agents-server/src/utils/content/extractBodyContentFromHtml.ts +19 -0
- package/apps/agents-server/src/utils/getUserIdFromRequest.ts +35 -0
- package/apps/agents-server/src/utils/handleChatCompletion.ts +65 -5
- package/apps/agents-server/src/utils/messages/sendMessage.ts +91 -0
- package/apps/agents-server/src/utils/messagesAdmin.ts +72 -0
- package/apps/agents-server/src/utils/normalization/filenameToPrompt.test.ts +36 -0
- package/apps/agents-server/src/utils/normalization/filenameToPrompt.ts +25 -0
- package/apps/agents-server/src/utils/validateApiKey.ts +7 -11
- package/esm/index.es.js +2890 -2737
- package/esm/index.es.js.map +1 -1
- package/esm/typings/servers.d.ts +8 -0
- package/esm/typings/src/_packages/core.index.d.ts +2 -0
- package/esm/typings/src/_packages/types.index.d.ts +10 -2
- package/esm/typings/src/book-2.0/agent-source/AgentBasicInformation.d.ts +6 -1
- package/esm/typings/src/book-2.0/agent-source/createAgentModelRequirements.d.ts +6 -6
- package/esm/typings/src/book-2.0/agent-source/createAgentModelRequirementsWithCommitments.closed.test.d.ts +1 -0
- package/esm/typings/src/book-2.0/utils/generatePlaceholderAgentProfileImageUrl.d.ts +3 -3
- package/esm/typings/src/book-components/Chat/Chat/ChatMessageItem.d.ts +5 -1
- package/esm/typings/src/book-components/Chat/Chat/ChatProps.d.ts +5 -0
- package/esm/typings/src/book-components/Chat/CodeBlock/CodeBlock.d.ts +13 -0
- package/esm/typings/src/book-components/Chat/MarkdownContent/MarkdownContent.d.ts +1 -0
- package/esm/typings/src/book-components/Chat/types/ChatMessage.d.ts +7 -11
- package/esm/typings/src/book-components/_common/Dropdown/Dropdown.d.ts +2 -2
- package/esm/typings/src/book-components/_common/MenuHoisting/MenuHoistingContext.d.ts +56 -0
- package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.d.ts +21 -11
- package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentsDatabaseSchema.d.ts +80 -14
- package/esm/typings/src/commitments/DICTIONARY/DICTIONARY.d.ts +46 -0
- package/esm/typings/src/commitments/index.d.ts +2 -1
- package/esm/typings/src/llm-providers/_multiple/MultipleLlmExecutionTools.d.ts +6 -2
- package/esm/typings/src/llm-providers/agent/AgentLlmExecutionTools.d.ts +1 -1
- package/esm/typings/src/llm-providers/ollama/OllamaExecutionTools.d.ts +1 -1
- package/esm/typings/src/llm-providers/openai/createOpenAiCompatibleExecutionTools.d.ts +1 -1
- package/esm/typings/src/llm-providers/remote/RemoteLlmExecutionTools.d.ts +1 -0
- package/esm/typings/src/types/Message.d.ts +49 -0
- package/esm/typings/src/types/ModelRequirements.d.ts +38 -14
- package/esm/typings/src/types/typeAliases.d.ts +23 -1
- package/esm/typings/src/utils/color/utils/colorToDataUrl.d.ts +2 -1
- package/esm/typings/src/utils/environment/$detectRuntimeEnvironment.d.ts +4 -4
- package/esm/typings/src/utils/environment/$isRunningInBrowser.d.ts +1 -1
- package/esm/typings/src/utils/environment/$isRunningInJest.d.ts +1 -1
- package/esm/typings/src/utils/environment/$isRunningInNode.d.ts +1 -1
- package/esm/typings/src/utils/environment/$isRunningInWebWorker.d.ts +1 -1
- package/esm/typings/src/utils/markdown/extractAllBlocksFromMarkdown.d.ts +2 -2
- package/esm/typings/src/utils/markdown/extractOneBlockFromMarkdown.d.ts +2 -2
- package/esm/typings/src/utils/random/$randomBase58.d.ts +12 -0
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +1 -1
- package/umd/index.umd.js +4018 -3865
- package/umd/index.umd.js.map +1 -1
- package/apps/agents-server/package-lock.json +0 -27
- package/apps/agents-server/public/fonts/download-font.js +0 -22
- package/apps/agents-server/src/components/PrintButton/PrintButton.tsx +0 -18
- package/esm/typings/src/book-2.0/utils/generateGravatarUrl.d.ts +0 -10
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { Loader2 } from 'lucide-react';
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
|
+
|
|
4
|
+
type AgentProfileImageProps = {
|
|
5
|
+
readonly src: string;
|
|
6
|
+
readonly alt: string;
|
|
7
|
+
readonly className?: string;
|
|
8
|
+
readonly style?: React.CSSProperties;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export function AgentProfileImage({ src, alt, className, style }: AgentProfileImageProps) {
|
|
12
|
+
const [imageSrc, setImageSrc] = useState<string | null>(null);
|
|
13
|
+
const [isLoading, setIsLoading] = useState(true);
|
|
14
|
+
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
let isMounted = true;
|
|
17
|
+
let timeoutId: NodeJS.Timeout;
|
|
18
|
+
let objectUrl: string | null = null;
|
|
19
|
+
|
|
20
|
+
const fetchImage = async () => {
|
|
21
|
+
try {
|
|
22
|
+
const response = await fetch(src);
|
|
23
|
+
if (response.ok) {
|
|
24
|
+
const blob = await response.blob();
|
|
25
|
+
if (!isMounted) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
objectUrl = URL.createObjectURL(blob);
|
|
30
|
+
setImageSrc(objectUrl);
|
|
31
|
+
setIsLoading(false);
|
|
32
|
+
} else {
|
|
33
|
+
// Retry on non-200
|
|
34
|
+
if (isMounted) {
|
|
35
|
+
timeoutId = setTimeout(fetchImage, 2000);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
} catch (error) {
|
|
39
|
+
console.warn('Failed to fetch image, retrying...', error);
|
|
40
|
+
if (isMounted) {
|
|
41
|
+
timeoutId = setTimeout(fetchImage, 2000);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const isExternal = (() => {
|
|
47
|
+
try {
|
|
48
|
+
return new URL(src, window.location.href).origin !== window.location.origin;
|
|
49
|
+
} catch {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
})();
|
|
53
|
+
|
|
54
|
+
if (isExternal) {
|
|
55
|
+
setImageSrc(src);
|
|
56
|
+
setIsLoading(false);
|
|
57
|
+
} else {
|
|
58
|
+
setIsLoading(true);
|
|
59
|
+
fetchImage();
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return () => {
|
|
63
|
+
isMounted = false;
|
|
64
|
+
clearTimeout(timeoutId);
|
|
65
|
+
if (objectUrl) {
|
|
66
|
+
URL.revokeObjectURL(objectUrl);
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
}, [src]);
|
|
70
|
+
|
|
71
|
+
return (
|
|
72
|
+
<div className={`relative ${className}`} style={style}>
|
|
73
|
+
{/* Note: We apply style to the container, so backgroundImage works here */}
|
|
74
|
+
|
|
75
|
+
{isLoading && (
|
|
76
|
+
<div className="absolute inset-0 flex items-center justify-center">
|
|
77
|
+
<Loader2 className="w-8 h-8 animate-spin text-white/50" />
|
|
78
|
+
</div>
|
|
79
|
+
)}
|
|
80
|
+
|
|
81
|
+
{imageSrc && (
|
|
82
|
+
// eslint-disable-next-line @next/next/no-img-element
|
|
83
|
+
<img
|
|
84
|
+
src={imageSrc}
|
|
85
|
+
alt={alt}
|
|
86
|
+
className="w-full h-full object-cover"
|
|
87
|
+
// We don't pass style here because it is applied to container
|
|
88
|
+
/>
|
|
89
|
+
)}
|
|
90
|
+
</div>
|
|
91
|
+
);
|
|
92
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { Color } from '../../../../../src/utils/color/Color';
|
|
2
|
+
import { darken } from '../../../../../src/utils/color/operators/darken';
|
|
3
|
+
import { lighten } from '../../../../../src/utils/color/operators/lighten';
|
|
4
|
+
import { useMemo } from 'react';
|
|
5
|
+
import spaceTrim from 'spacetrim';
|
|
6
|
+
|
|
7
|
+
export function useAgentBackground(colorString: string | undefined) {
|
|
8
|
+
return useMemo(() => {
|
|
9
|
+
// [🧠] Default color should be imported constant, but for now hardcoded fallback
|
|
10
|
+
const PROMPTBOOK_COLOR_HEX = '#f15b24'; // TODO: Import PROMPTBOOK_COLOR
|
|
11
|
+
const brandColorString = colorString || PROMPTBOOK_COLOR_HEX;
|
|
12
|
+
|
|
13
|
+
let brandColor;
|
|
14
|
+
try {
|
|
15
|
+
brandColor = Color.fromSafe(brandColorString.split(',')[0].trim());
|
|
16
|
+
} catch {
|
|
17
|
+
brandColor = Color.fromHex(PROMPTBOOK_COLOR_HEX);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const brandColorHex = brandColor.toHex();
|
|
21
|
+
const brandColorLightHex = brandColor.then(lighten(0.2)).toHex();
|
|
22
|
+
const brandColorDarkHex = brandColor.then(darken(0.15)).toHex();
|
|
23
|
+
|
|
24
|
+
// Generate Noisy SVG Background
|
|
25
|
+
const color1 = brandColor;
|
|
26
|
+
// const color2 = brandColors[1] || brandColors[0]!; // Use secondary color if available?
|
|
27
|
+
// For simplicity using primary color for now or derive second one
|
|
28
|
+
const color2 = brandColor;
|
|
29
|
+
|
|
30
|
+
// [🧠] Make colors much lighter for the background
|
|
31
|
+
const color1Light = color1.then(lighten(0.3)).toHex();
|
|
32
|
+
const color1Main = color1.toHex();
|
|
33
|
+
const color1Dark = color1.then(darken(0.3)).toHex();
|
|
34
|
+
|
|
35
|
+
const color2Light = color2.then(lighten(0.3)).toHex();
|
|
36
|
+
const color2Main = color2.toHex();
|
|
37
|
+
const color2Dark = color2.then(darken(0.3)).toHex();
|
|
38
|
+
|
|
39
|
+
const svgContent = spaceTrim(`
|
|
40
|
+
<svg xmlns="http://www.w3.org/2000/svg"
|
|
41
|
+
viewBox="0 0 1920 1080"
|
|
42
|
+
width="1920" height="1080"
|
|
43
|
+
preserveAspectRatio="xMidYMid slice">
|
|
44
|
+
<defs>
|
|
45
|
+
<!-- Bottom-left -->
|
|
46
|
+
<radialGradient id="grad1" cx="0%" cy="100%" r="90%">
|
|
47
|
+
<stop offset="0%" stop-color="${color1Light}" />
|
|
48
|
+
<stop offset="50%" stop-color="${color1Main}" />
|
|
49
|
+
<stop offset="100%" stop-color="${color1Dark}" />
|
|
50
|
+
</radialGradient>
|
|
51
|
+
|
|
52
|
+
<!-- Bottom-right -->
|
|
53
|
+
<radialGradient id="grad2" cx="100%" cy="100%" r="90%">
|
|
54
|
+
<stop offset="0%" stop-color="${color2Light}" />
|
|
55
|
+
<stop offset="50%" stop-color="${color2Main}" />
|
|
56
|
+
<stop offset="100%" stop-color="${color2Dark}" />
|
|
57
|
+
</radialGradient>
|
|
58
|
+
|
|
59
|
+
<!-- White top fade -->
|
|
60
|
+
<linearGradient id="whiteTopGrad" x1="0%" y1="0%" x2="0%" y2="100%">
|
|
61
|
+
<stop offset="0%" stop-color="#ffffff" stop-opacity="1" />
|
|
62
|
+
<stop offset="100%" stop-color="#ffffff" stop-opacity="0.3" />
|
|
63
|
+
</linearGradient>
|
|
64
|
+
|
|
65
|
+
<!-- Strong grain -->
|
|
66
|
+
<filter id="grain" x="-10%" y="-10%" width="120%" height="120%">
|
|
67
|
+
<feTurbulence type="fractalNoise" baseFrequency="3.5" numOctaves="3" seed="8" result="noise" />
|
|
68
|
+
<feComponentTransfer>
|
|
69
|
+
<feFuncR type="linear" slope="3.5" intercept="-1.2" />
|
|
70
|
+
<feFuncG type="linear" slope="3.5" intercept="-1.2" />
|
|
71
|
+
<feFuncB type="linear" slope="3.5" intercept="-1.2" />
|
|
72
|
+
<feFuncA type="table" tableValues="0 0.8" />
|
|
73
|
+
</feComponentTransfer>
|
|
74
|
+
</filter>
|
|
75
|
+
</defs>
|
|
76
|
+
|
|
77
|
+
<!-- White base -->
|
|
78
|
+
<rect width="100%" height="100%" fill="#ffffff" />
|
|
79
|
+
|
|
80
|
+
<!-- Gradients -->
|
|
81
|
+
<rect width="100%" height="100%" fill="url(#grad1)" />
|
|
82
|
+
<rect width="100%" height="100%" fill="url(#grad2)" style="mix-blend-mode:screen; opacity:0.85" />
|
|
83
|
+
|
|
84
|
+
<!-- White fade on top -->
|
|
85
|
+
<rect width="100%" height="100%" fill="url(#whiteTopGrad)" />
|
|
86
|
+
|
|
87
|
+
<!-- Strong visible noise -->
|
|
88
|
+
<rect width="100%" height="100%" filter="url(#grain)"
|
|
89
|
+
style="mix-blend-mode:soft-light; opacity:1.2" />
|
|
90
|
+
</svg>
|
|
91
|
+
`);
|
|
92
|
+
|
|
93
|
+
const backgroundImage = `data:image/svg+xml;charset=utf-8,${encodeURIComponent(svgContent)}`;
|
|
94
|
+
|
|
95
|
+
return { brandColorHex, brandColorLightHex, brandColorDarkHex, backgroundImage };
|
|
96
|
+
}, [colorString]);
|
|
97
|
+
}
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import { useState } from 'react';
|
|
4
|
-
import { useRouter } from 'next/navigation';
|
|
5
4
|
|
|
6
5
|
type AuthControlsProps = {
|
|
7
6
|
initialUser: { username: string; isAdmin: boolean } | null;
|
|
8
7
|
};
|
|
9
8
|
|
|
10
9
|
export function AuthControls({ initialUser }: AuthControlsProps) {
|
|
11
|
-
const router = useRouter();
|
|
12
|
-
const [user
|
|
10
|
+
// const router = useRouter();
|
|
11
|
+
const [user] = useState(initialUser);
|
|
13
12
|
const [isLoginOpen, setIsLoginOpen] = useState(false);
|
|
14
13
|
const [username, setUsername] = useState('');
|
|
15
14
|
const [password, setPassword] = useState('');
|
|
@@ -52,7 +51,9 @@ export function AuthControls({ initialUser }: AuthControlsProps) {
|
|
|
52
51
|
<div className="flex items-center space-x-4">
|
|
53
52
|
<span className="text-gray-600">
|
|
54
53
|
Logged in as <strong>{user.username}</strong>
|
|
55
|
-
{user.isAdmin &&
|
|
54
|
+
{user.isAdmin && (
|
|
55
|
+
<span className="ml-2 bg-blue-100 text-blue-800 text-xs px-2 py-1 rounded">Admin</span>
|
|
56
|
+
)}
|
|
56
57
|
</span>
|
|
57
58
|
<button
|
|
58
59
|
onClick={handleLogout}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
type DeletedAgentBannerProps = {
|
|
4
|
+
message?: string;
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
export function DeletedAgentBanner({
|
|
8
|
+
message = "This agent has been deleted. You can restore it from the Recycle Bin."
|
|
9
|
+
}: DeletedAgentBannerProps) {
|
|
10
|
+
return (
|
|
11
|
+
<div className="bg-yellow-50 border border-yellow-200 rounded-lg p-4 mb-6">
|
|
12
|
+
<div className="flex">
|
|
13
|
+
<div className="flex-shrink-0">
|
|
14
|
+
<svg className="h-5 w-5 text-yellow-400" viewBox="0 0 20 20" fill="currentColor">
|
|
15
|
+
<path fillRule="evenodd" d="M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z" clipRule="evenodd" />
|
|
16
|
+
</svg>
|
|
17
|
+
</div>
|
|
18
|
+
<div className="ml-3">
|
|
19
|
+
<p className="text-sm text-yellow-700">
|
|
20
|
+
{message}
|
|
21
|
+
</p>
|
|
22
|
+
</div>
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { Download, PrinterIcon } from 'lucide-react';
|
|
4
|
+
import Link from 'next/link';
|
|
5
|
+
import { OpenMojiIcon } from '../OpenMojiIcon/OpenMojiIcon';
|
|
6
|
+
|
|
7
|
+
export function DocsToolbar() {
|
|
8
|
+
return (
|
|
9
|
+
<div className="flex flex-wrap items-center justify-between gap-4 p-4 mb-8 bg-white rounded-xl shadow-sm border border-gray-100 print:hidden">
|
|
10
|
+
<div className="flex items-center gap-2">
|
|
11
|
+
<OpenMojiIcon icon="📚" className="text-2xl" />
|
|
12
|
+
<span className="font-semibold text-gray-700">Documentation</span>
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
<div className="flex flex-wrap gap-2">
|
|
16
|
+
<button
|
|
17
|
+
onClick={() => window.print()}
|
|
18
|
+
className="flex items-center gap-2 px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-lg hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 transition-colors"
|
|
19
|
+
title="Print this page or save as PDF"
|
|
20
|
+
>
|
|
21
|
+
<PrinterIcon className="w-4 h-4" />
|
|
22
|
+
Print / Save as PDF
|
|
23
|
+
</button>
|
|
24
|
+
|
|
25
|
+
<Link
|
|
26
|
+
href="/api/docs/book.md"
|
|
27
|
+
download="book.md"
|
|
28
|
+
target="_blank"
|
|
29
|
+
className="flex items-center gap-2 px-4 py-2 text-sm font-medium text-blue-700 bg-blue-50 border border-blue-200 rounded-lg hover:bg-blue-100 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 transition-colors"
|
|
30
|
+
title="Download raw Markdown documentation"
|
|
31
|
+
>
|
|
32
|
+
<Download className="w-4 h-4" />
|
|
33
|
+
Download Markdown
|
|
34
|
+
</Link>
|
|
35
|
+
</div>
|
|
36
|
+
</div>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
@@ -17,34 +17,36 @@ export function DocumentationContent({ primary, aliases = [], isPrintOnly = fals
|
|
|
17
17
|
<div
|
|
18
18
|
className={`bg-white rounded-xl shadow-lg border border-gray-200 overflow-hidden ${
|
|
19
19
|
isPrintOnly ? 'shadow-none border-none' : ''
|
|
20
|
-
}`}
|
|
20
|
+
} print:shadow-none print:border-none print:rounded-none`}
|
|
21
21
|
>
|
|
22
22
|
<div
|
|
23
23
|
className={`p-8 border-b border-gray-100 bg-gray-50/50 ${
|
|
24
24
|
isPrintOnly ? 'border-none bg-white p-0 mb-4' : ''
|
|
25
|
-
}`}
|
|
25
|
+
} print:p-0 print:border-none print:bg-white print:mb-4`}
|
|
26
26
|
>
|
|
27
27
|
<div className="flex items-center gap-4 mb-4">
|
|
28
|
-
<h1 className="text-4xl font-bold text-gray-900 tracking-tight">
|
|
29
|
-
<OpenMojiIcon icon={primary.icon} className="mr-3" />
|
|
28
|
+
<h1 className="text-4xl font-bold text-gray-900 tracking-tight print:text-3xl">
|
|
29
|
+
<OpenMojiIcon icon={primary.icon} variant="color" className="mr-3" />
|
|
30
30
|
{primary.type}
|
|
31
31
|
{aliases.length > 0 && (
|
|
32
|
-
<span className="text-gray-400 font-normal ml-4 text-2xl"
|
|
32
|
+
<span className="text-gray-400 font-normal ml-4 text-2xl print:text-xl">
|
|
33
|
+
/ {aliases.join(' / ')}
|
|
34
|
+
</span>
|
|
33
35
|
)}
|
|
34
36
|
</h1>
|
|
35
37
|
{!isPrintOnly && (
|
|
36
|
-
<span className="px-3 py-1 rounded-full text-xs font-medium bg-blue-100 text-blue-700">
|
|
38
|
+
<span className="px-3 py-1 rounded-full text-xs font-medium bg-blue-100 text-blue-700 print:hidden">
|
|
37
39
|
Commitment
|
|
38
40
|
</span>
|
|
39
41
|
)}
|
|
40
42
|
</div>
|
|
41
43
|
{primary.description && (
|
|
42
|
-
<p className="text-xl text-gray-600 leading-relaxed max-w-3xl">{primary.description}</p>
|
|
44
|
+
<p className="text-xl text-gray-600 leading-relaxed max-w-3xl print:text-lg">{primary.description}</p>
|
|
43
45
|
)}
|
|
44
46
|
</div>
|
|
45
47
|
|
|
46
|
-
<div className={`p-8 ${isPrintOnly ? 'p-0' : ''}`}>
|
|
47
|
-
<article className="prose prose-lg prose-slate max-w-none prose-headings:font-bold prose-headings:tracking-tight prose-headings:text-gray-900 prose-h1:text-4xl prose-h1:mb-8 prose-h2:text-2xl prose-h2:mt-12 prose-h2:mb-6 prose-h2:pb-2 prose-h2:border-b prose-h2:border-gray-200 prose-h3:text-xl prose-h3:mt-8 prose-h3:mb-4 prose-h3:text-gray-800 prose-p:text-gray-600 prose-p:leading-relaxed prose-p:mb-6 prose-a:text-blue-600 prose-a:no-underline hover:prose-a:text-blue-700 hover:prose-a:underline prose-a:transition-colors prose-strong:font-bold prose-strong:text-gray-900 prose-code:text-blue-600 prose-code:bg-blue-50 prose-code:px-1.5 prose-code:py-0.5 prose-code:rounded-md prose-code:before:content-none prose-code:after:content-none prose-code:font-medium prose-pre:bg-gray-900 prose-pre:text-gray-100 prose-pre:shadow-lg prose-pre:rounded-xl prose-pre:p-6 prose-ul:list-disc prose-ul:pl-6 prose-li:marker:text-gray-400 prose-li:mb-2 prose-ol:list-decimal prose-ol:pl-6 prose-li:mb-2 prose-blockquote:border-l-4 prose-blockquote:border-blue-500 prose-blockquote:bg-blue-50/50 prose-blockquote:py-2 prose-blockquote:px-4 prose-blockquote:rounded-r-lg prose-blockquote:not-italic prose-blockquote:text-gray-700 prose-blockquote:my-8 prose-img:rounded-xl prose-img:shadow-md prose-img:my-8 prose-hr:border-gray-200 prose-hr:my-10 prose-table:w-full prose-th:text-left prose-th:py-2 prose-th:px-3 prose-th:bg-gray-100 prose-th:font-semibold prose-th:text-gray-900 prose-td:py-2 prose-td:px-3 prose-td:border-b prose-td:border-gray-200 prose-tr:hover:bg-gray-50">
|
|
48
|
+
<div className={`p-8 ${isPrintOnly ? 'p-0' : ''} print:p-0`}>
|
|
49
|
+
<article className="prose prose-lg prose-slate max-w-none prose-headings:font-bold prose-headings:tracking-tight prose-headings:text-gray-900 prose-h1:text-4xl prose-h1:mb-8 prose-h2:text-2xl prose-h2:mt-12 prose-h2:mb-6 prose-h2:pb-2 prose-h2:border-b prose-h2:border-gray-200 prose-h3:text-xl prose-h3:mt-8 prose-h3:mb-4 prose-h3:text-gray-800 prose-p:text-gray-600 prose-p:leading-relaxed prose-p:mb-6 prose-a:text-blue-600 prose-a:no-underline hover:prose-a:text-blue-700 hover:prose-a:underline prose-a:transition-colors prose-strong:font-bold prose-strong:text-gray-900 prose-code:text-blue-600 prose-code:bg-blue-50 prose-code:px-1.5 prose-code:py-0.5 prose-code:rounded-md prose-code:before:content-none prose-code:after:content-none prose-code:font-medium prose-pre:bg-gray-900 prose-pre:text-gray-100 prose-pre:shadow-lg prose-pre:rounded-xl prose-pre:p-6 prose-ul:list-disc prose-ul:pl-6 prose-li:marker:text-gray-400 prose-li:mb-2 prose-ol:list-decimal prose-ol:pl-6 prose-li:mb-2 prose-blockquote:border-l-4 prose-blockquote:border-blue-500 prose-blockquote:bg-blue-50/50 prose-blockquote:py-2 prose-blockquote:px-4 prose-blockquote:rounded-r-lg prose-blockquote:not-italic prose-blockquote:text-gray-700 prose-blockquote:my-8 prose-img:rounded-xl prose-img:shadow-md prose-img:my-8 prose-hr:border-gray-200 prose-hr:my-10 prose-table:w-full prose-th:text-left prose-th:py-2 prose-th:px-3 prose-th:bg-gray-100 prose-th:font-semibold prose-th:text-gray-900 prose-td:py-2 prose-td:px-3 prose-td:border-b prose-td:border-gray-200 prose-tr:hover:bg-gray-50 print:prose-base print:max-w-none">
|
|
48
50
|
<MarkdownContent
|
|
49
51
|
content={primary.documentation}
|
|
50
52
|
/* TODO: !!!!
|
|
@@ -114,10 +114,7 @@ export function Footer(props: FooterProps) {
|
|
|
114
114
|
</a>
|
|
115
115
|
</li>
|
|
116
116
|
<li>
|
|
117
|
-
<a
|
|
118
|
-
href="https://discord.gg/x3QWNaa89N"
|
|
119
|
-
className="text-gray-500 hover:text-gray-900"
|
|
120
|
-
>
|
|
117
|
+
<a href="https://discord.gg/x3QWNaa89N" className="text-gray-500 hover:text-gray-900">
|
|
121
118
|
Discord
|
|
122
119
|
</a>
|
|
123
120
|
</li>
|
|
@@ -160,8 +157,10 @@ export function Footer(props: FooterProps) {
|
|
|
160
157
|
💜
|
|
161
158
|
</p>
|
|
162
159
|
</div>
|
|
160
|
+
{/*
|
|
161
|
+
TODO: [🧠] Should we show this in the footer?
|
|
163
162
|
<div className="flex flex-col items-center mt-8">
|
|
164
|
-
{/* <Image src={TechnologyIncubation} alt="Our Sponsor" className="h-32 w-auto" />
|
|
163
|
+
{/* <Image src={TechnologyIncubation} alt="Our Sponsor" className="h-32 w-auto" /> * /}
|
|
165
164
|
<p className="text-center text-sm text-gray-500 mt-4 max-w-lg">
|
|
166
165
|
This project was implemented with funding from the national budget
|
|
167
166
|
<br />
|
|
@@ -169,6 +168,7 @@ export function Footer(props: FooterProps) {
|
|
|
169
168
|
Incubation programme.
|
|
170
169
|
</p>
|
|
171
170
|
</div>
|
|
171
|
+
*/}
|
|
172
172
|
</div>
|
|
173
173
|
</footer>
|
|
174
174
|
);
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { X } from 'lucide-react';
|
|
4
|
+
import { Portal } from '../Portal/Portal';
|
|
5
|
+
|
|
6
|
+
type ForgottenPasswordDialogProps = {
|
|
7
|
+
isOpen: boolean;
|
|
8
|
+
onClose: () => void;
|
|
9
|
+
adminEmail: string;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export function ForgottenPasswordDialog(props: ForgottenPasswordDialogProps) {
|
|
13
|
+
const { isOpen, onClose, adminEmail } = props;
|
|
14
|
+
|
|
15
|
+
if (!isOpen) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<Portal>
|
|
21
|
+
<div className="fixed inset-0 z-[9999] flex items-center justify-center bg-black/50 backdrop-blur-sm animate-in fade-in duration-200">
|
|
22
|
+
<div className="relative w-full max-w-md bg-white rounded-lg shadow-lg border border-gray-200 p-6 animate-in zoom-in-95 duration-200">
|
|
23
|
+
<button
|
|
24
|
+
onClick={onClose}
|
|
25
|
+
className="absolute top-4 right-4 text-gray-400 hover:text-gray-500 transition-colors"
|
|
26
|
+
>
|
|
27
|
+
<X className="w-5 h-5" />
|
|
28
|
+
<span className="sr-only">Close</span>
|
|
29
|
+
</button>
|
|
30
|
+
|
|
31
|
+
<div className="mb-6">
|
|
32
|
+
<h2 className="text-xl font-semibold text-gray-900">Forgotten Password</h2>
|
|
33
|
+
<p className="text-sm text-gray-500 mt-1">Reset your password</p>
|
|
34
|
+
</div>
|
|
35
|
+
|
|
36
|
+
<div className="space-y-4">
|
|
37
|
+
<div className="p-4 bg-blue-50 border border-blue-200 rounded-md">
|
|
38
|
+
<p className="text-sm text-blue-800">
|
|
39
|
+
This Promptbook server has no email capability. Please contact the administrator at{' '}
|
|
40
|
+
<a
|
|
41
|
+
href={`mailto:${adminEmail}`}
|
|
42
|
+
className="font-medium text-blue-900 underline hover:text-blue-800"
|
|
43
|
+
>
|
|
44
|
+
{adminEmail}
|
|
45
|
+
</a>{' '}
|
|
46
|
+
to reset your password.
|
|
47
|
+
</p>
|
|
48
|
+
</div>
|
|
49
|
+
|
|
50
|
+
<button
|
|
51
|
+
onClick={onClose}
|
|
52
|
+
className="w-full inline-flex items-center justify-center rounded-md text-sm font-medium h-10 px-4 py-2 bg-gray-100 text-gray-900 hover:bg-gray-200 focus:outline-none focus:ring-2 focus:ring-gray-500 focus:ring-offset-2 transition-colors"
|
|
53
|
+
>
|
|
54
|
+
Close
|
|
55
|
+
</button>
|
|
56
|
+
</div>
|
|
57
|
+
</div>
|
|
58
|
+
</div>
|
|
59
|
+
</Portal>
|
|
60
|
+
);
|
|
61
|
+
}
|