@promptbook/cli 0.104.0-6 → 0.104.0-8
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/src/app/admin/browser-test/BrowserTestClient.tsx +85 -0
- package/apps/agents-server/src/app/admin/browser-test/page.tsx +13 -0
- package/apps/agents-server/src/app/agents/[agentName]/AgentProfileWrapper.tsx +49 -10
- package/apps/agents-server/src/app/agents/[agentName]/_utils.ts +0 -3
- package/apps/agents-server/src/app/agents/[agentName]/code/page.tsx +5 -2
- 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 +56 -38
- package/apps/agents-server/src/app/agents/[agentName]/images/icon-256.png/route.tsx +10 -1
- 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 +5 -4
- package/apps/agents-server/src/app/agents/[agentName]/images/screenshot-phone.png/route.tsx +5 -4
- package/apps/agents-server/src/app/agents/[agentName]/integration/page.tsx +8 -1
- package/apps/agents-server/src/app/agents/[agentName]/links/page.tsx +8 -1
- package/apps/agents-server/src/app/agents/[agentName]/opengraph-image.tsx +7 -2
- package/apps/agents-server/src/app/agents/[agentName]/page.tsx +3 -4
- package/apps/agents-server/src/app/agents/[agentName]/system-message/page.tsx +15 -3
- package/apps/agents-server/src/app/api/browser-test/screenshot/route.ts +30 -0
- package/apps/agents-server/src/app/humans.txt/route.ts +1 -1
- package/apps/agents-server/src/app/page.tsx +4 -2
- package/apps/agents-server/src/app/recycle-bin/page.tsx +3 -1
- 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 +4 -5
- package/apps/agents-server/src/components/AgentProfile/AgentProfile.tsx +22 -13
- package/apps/agents-server/src/components/Header/Header.tsx +4 -0
- package/apps/agents-server/src/components/Homepage/AgentCard.tsx +46 -9
- package/apps/agents-server/src/components/Homepage/AgentsList.tsx +32 -14
- package/apps/agents-server/src/components/Homepage/DeletedAgentsList.tsx +22 -6
- 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/VercelDeploymentCard/VercelDeploymentCard.tsx +2 -0
- package/apps/agents-server/src/components/_utils/generateMetaTxt.ts +12 -10
- package/apps/agents-server/src/tools/$provideBrowserForServer.ts +29 -0
- package/apps/agents-server/src/tools/$provideCdnForServer.ts +1 -1
- package/esm/index.es.js +8 -9
- 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 +2 -0
- package/esm/typings/src/book-2.0/utils/generatePlaceholderAgentProfileImageUrl.d.ts +2 -2
- package/esm/typings/src/types/ModelRequirements.d.ts +38 -14
- package/esm/typings/src/types/typeAliases.d.ts +7 -1
- package/esm/typings/src/utils/color/utils/colorToDataUrl.d.ts +2 -1
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +1 -1
- package/umd/index.umd.js +8 -9
- package/umd/index.umd.js.map +1 -1
|
@@ -3,16 +3,25 @@ import { AgentCard } from './AgentCard';
|
|
|
3
3
|
import { Section } from './Section';
|
|
4
4
|
|
|
5
5
|
type ExternalAgentsSectionProps = {
|
|
6
|
-
|
|
6
|
+
/**
|
|
7
|
+
* @@@
|
|
8
|
+
*/
|
|
9
|
+
readonly agentsByServer: AgentsByServer[];
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Base URL of the agents server
|
|
13
|
+
*/
|
|
14
|
+
readonly publicUrl: URL;
|
|
7
15
|
};
|
|
8
16
|
|
|
9
|
-
export function ExternalAgentsSection(
|
|
17
|
+
export function ExternalAgentsSection(props: ExternalAgentsSectionProps) {
|
|
18
|
+
const { agentsByServer, publicUrl } = props;
|
|
10
19
|
return (
|
|
11
20
|
<>
|
|
12
21
|
{agentsByServer.map(({ serverUrl, agents }) => (
|
|
13
22
|
<Section key={serverUrl} title={`Agents from ${new URL(serverUrl).hostname} (${agents.length})`}>
|
|
14
23
|
{agents.map((agent) => (
|
|
15
|
-
<AgentCard key={agent.url} agent={agent} href={agent.url} />
|
|
24
|
+
<AgentCard key={agent.url} agent={agent} href={agent.url} publicUrl={publicUrl} />
|
|
16
25
|
))}
|
|
17
26
|
</Section>
|
|
18
27
|
))}
|
|
@@ -15,7 +15,15 @@ type ServerState = {
|
|
|
15
15
|
error?: string;
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
type ExternalAgentsSectionClientProps = {
|
|
19
|
+
/**
|
|
20
|
+
* Base URL of the agents server
|
|
21
|
+
*/
|
|
22
|
+
readonly publicUrl: URL;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export function ExternalAgentsSectionClient(props: ExternalAgentsSectionClientProps) {
|
|
26
|
+
const { publicUrl } = props;
|
|
19
27
|
const [servers, setServers] = useState<Record<string, ServerState>>({});
|
|
20
28
|
const [initialLoading, setInitialLoading] = useState(true);
|
|
21
29
|
|
|
@@ -26,24 +34,23 @@ export function ExternalAgentsSectionClient() {
|
|
|
26
34
|
try {
|
|
27
35
|
const response = await fetch('/api/federated-agents');
|
|
28
36
|
if (!response.ok) throw new Error('Failed to fetch federated servers');
|
|
29
|
-
|
|
37
|
+
|
|
30
38
|
const data: FederatedServersResponse = await response.json();
|
|
31
|
-
|
|
39
|
+
|
|
32
40
|
if (isCancelled) return;
|
|
33
41
|
|
|
34
42
|
const initialServerState: Record<string, ServerState> = {};
|
|
35
|
-
data.federatedServers.forEach(serverUrl => {
|
|
43
|
+
data.federatedServers.forEach((serverUrl) => {
|
|
36
44
|
initialServerState[serverUrl] = { status: 'loading', agents: [] };
|
|
37
45
|
});
|
|
38
|
-
|
|
46
|
+
|
|
39
47
|
setServers(initialServerState);
|
|
40
48
|
setInitialLoading(false);
|
|
41
49
|
|
|
42
50
|
// Fetch agents for each server independently
|
|
43
|
-
data.federatedServers.forEach(serverUrl => {
|
|
51
|
+
data.federatedServers.forEach((serverUrl) => {
|
|
44
52
|
fetchAgentsForServer(serverUrl);
|
|
45
53
|
});
|
|
46
|
-
|
|
47
54
|
} catch (error) {
|
|
48
55
|
console.error('Failed to load federated servers list', error);
|
|
49
56
|
if (!isCancelled) setInitialLoading(false);
|
|
@@ -80,7 +87,9 @@ export function ExternalAgentsSectionClient() {
|
|
|
80
87
|
const response = await fetch(proxyUrl);
|
|
81
88
|
|
|
82
89
|
if (!response.ok) {
|
|
83
|
-
throw new Error(
|
|
90
|
+
throw new Error(
|
|
91
|
+
`Failed to fetch agents from ${serverUrl} via proxy (Status: ${response.status})`,
|
|
92
|
+
);
|
|
84
93
|
}
|
|
85
94
|
|
|
86
95
|
const data = await response.json();
|
|
@@ -134,7 +143,7 @@ export function ExternalAgentsSectionClient() {
|
|
|
134
143
|
|
|
135
144
|
return (
|
|
136
145
|
<>
|
|
137
|
-
{serverUrls.map(serverUrl => {
|
|
146
|
+
{serverUrls.map((serverUrl) => {
|
|
138
147
|
const state = servers[serverUrl];
|
|
139
148
|
const hostname = (() => {
|
|
140
149
|
try {
|
|
@@ -169,7 +178,7 @@ export function ExternalAgentsSectionClient() {
|
|
|
169
178
|
return (
|
|
170
179
|
<Section key={serverUrl} title={`Agents from ${hostname} (${state.agents.length})`}>
|
|
171
180
|
{state.agents.map((agent) => (
|
|
172
|
-
<AgentCard key={agent.url} agent={agent} href={agent.url} />
|
|
181
|
+
<AgentCard key={agent.url} agent={agent} href={agent.url} publicUrl={publicUrl} />
|
|
173
182
|
))}
|
|
174
183
|
</Section>
|
|
175
184
|
);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
NEXT_PUBLIC_SITE_URL,
|
|
2
3
|
NEXT_PUBLIC_VERCEL_BRANCH_URL,
|
|
3
4
|
NEXT_PUBLIC_VERCEL_ENV,
|
|
4
5
|
NEXT_PUBLIC_VERCEL_GIT_COMMIT_AUTHOR_LOGIN,
|
|
@@ -24,6 +25,7 @@ import { TechInfoCard } from '../Homepage/TechInfoCard';
|
|
|
24
25
|
export default function VercelDeploymentCard() {
|
|
25
26
|
return (
|
|
26
27
|
<TechInfoCard title="Vercel Deployment">
|
|
28
|
+
<p className="text-gray-600">NEXT_PUBLIC_SITE_URL: {NEXT_PUBLIC_SITE_URL?.href || 'undefined'}</p>
|
|
27
29
|
<p className="text-gray-600">NEXT_PUBLIC_VERCEL_ENV: {NEXT_PUBLIC_VERCEL_ENV}</p>
|
|
28
30
|
<p className="text-gray-600">NEXT_PUBLIC_VERCEL_TARGET_ENV: {NEXT_PUBLIC_VERCEL_TARGET_ENV}</p>
|
|
29
31
|
<p className="text-gray-600">NEXT_PUBLIC_VERCEL_URL: {NEXT_PUBLIC_VERCEL_URL}</p>
|
|
@@ -1,26 +1,28 @@
|
|
|
1
1
|
// Utility to generate content for robots.txt, security.txt, and humans.txt [DRY]
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { $provideServer } from '@/src/tools/$provideServer';
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
export function generateRobotsTxt(): string {
|
|
9
|
-
return ['User-agent: *', `Sitemap: ${baseUrl}sitemap.xml`, ''].join('\n');
|
|
5
|
+
export async function generateRobotsTxt(): Promise<string> {
|
|
6
|
+
const { publicUrl } = await $provideServer();
|
|
7
|
+
return ['User-agent: *', `Sitemap: ${publicUrl.href}sitemap.xml`, ''].join('\n');
|
|
10
8
|
}
|
|
11
9
|
|
|
12
|
-
export function generateSecurityTxt(): string {
|
|
10
|
+
export async function generateSecurityTxt(): Promise<string> {
|
|
11
|
+
const { publicUrl } = await $provideServer();
|
|
13
12
|
// See https://securitytxt.org/ for more fields
|
|
14
13
|
return [
|
|
15
14
|
`Contact: mailto:security@ptbk.io`,
|
|
16
15
|
`Expires: ${new Date(Date.now() + 365 * 24 * 60 * 60 * 1000).toISOString().split('T')[0]}`,
|
|
17
|
-
`Canonical: ${
|
|
16
|
+
`Canonical: ${publicUrl.href}security.txt`,
|
|
18
17
|
'',
|
|
19
18
|
].join('\n');
|
|
20
19
|
}
|
|
21
20
|
|
|
22
|
-
export function generateHumansTxt(): string {
|
|
23
|
-
|
|
21
|
+
export async function generateHumansTxt(): Promise<string> {
|
|
22
|
+
const { publicUrl } = await $provideServer();
|
|
23
|
+
return ['/* TEAM */', 'Developer: Promptbook Team', `Site: https://ptbk.io`, `Instance: ${publicUrl.href}`].join(
|
|
24
|
+
'\n',
|
|
25
|
+
);
|
|
24
26
|
}
|
|
25
27
|
|
|
26
28
|
/**
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { locateChrome } from 'locate-app';
|
|
2
|
+
import { join } from 'path';
|
|
3
|
+
import { BrowserContext, chromium } from 'playwright';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Cache of browser instance
|
|
7
|
+
*
|
|
8
|
+
* @private internal cache for `$provideBrowserForServer`
|
|
9
|
+
*/
|
|
10
|
+
let browserInstance: BrowserContext | null = null;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @@@
|
|
14
|
+
*/
|
|
15
|
+
export async function $provideBrowserForServer(): Promise<BrowserContext> {
|
|
16
|
+
if (browserInstance === null /* || !browserInstance.isConnected() */) {
|
|
17
|
+
console.log('Launching new browser instance...');
|
|
18
|
+
browserInstance = await chromium.launchPersistentContext(
|
|
19
|
+
join(process.cwd(), '.promptbook', 'puppeteer', 'user-data'),
|
|
20
|
+
{
|
|
21
|
+
executablePath: await locateChrome(),
|
|
22
|
+
headless: false,
|
|
23
|
+
// defaultViewport: null,
|
|
24
|
+
// downloadsPath
|
|
25
|
+
},
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
return browserInstance;
|
|
29
|
+
}
|
package/esm/index.es.js
CHANGED
|
@@ -47,7 +47,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
|
|
|
47
47
|
* @generated
|
|
48
48
|
* @see https://github.com/webgptorg/promptbook
|
|
49
49
|
*/
|
|
50
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.104.0-
|
|
50
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.104.0-8';
|
|
51
51
|
/**
|
|
52
52
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
53
53
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -57,6 +57,8 @@ const PROMPTBOOK_ENGINE_VERSION = '0.104.0-6';
|
|
|
57
57
|
* Core Promptbook server configuration.
|
|
58
58
|
*
|
|
59
59
|
* This server is also used for auto-federation in the Agents Server.
|
|
60
|
+
*
|
|
61
|
+
* @public exported from `@promptbook/core`
|
|
60
62
|
*/
|
|
61
63
|
const CORE_SERVER = {
|
|
62
64
|
title: 'Promptbook Core',
|
|
@@ -11402,11 +11404,7 @@ const modelCommandParser = {
|
|
|
11402
11404
|
// TODO: [🚜] DRY
|
|
11403
11405
|
if ($taskJson.modelRequirements[command.key] !== undefined) {
|
|
11404
11406
|
if ($taskJson.modelRequirements[command.key] === command.value) {
|
|
11405
|
-
console.warn(`Multiple commands \`MODEL ${{
|
|
11406
|
-
modelName: 'NAME',
|
|
11407
|
-
modelVariant: 'VARIANT',
|
|
11408
|
-
maxTokens: '???',
|
|
11409
|
-
}[command.key]} ${command.value}\` in the task "${$taskJson.title || $taskJson.name}"`);
|
|
11407
|
+
console.warn(`Multiple commands \`MODEL ${command.key} ${command.value}\` in the task "${$taskJson.title || $taskJson.name}"`);
|
|
11410
11408
|
// <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
|
|
11411
11409
|
}
|
|
11412
11410
|
else {
|
|
@@ -19892,13 +19890,14 @@ class OpenAiCompatibleExecutionTools {
|
|
|
19892
19890
|
const modelName = currentModelRequirements.modelName || this.getDefaultImageGenerationModel().modelName;
|
|
19893
19891
|
const modelSettings = {
|
|
19894
19892
|
model: modelName,
|
|
19895
|
-
|
|
19896
|
-
|
|
19897
|
-
|
|
19893
|
+
size: currentModelRequirements.size,
|
|
19894
|
+
quality: currentModelRequirements.quality,
|
|
19895
|
+
style: currentModelRequirements.style,
|
|
19898
19896
|
};
|
|
19899
19897
|
const rawPromptContent = templateParameters(content, { ...parameters, modelName });
|
|
19900
19898
|
const rawRequest = {
|
|
19901
19899
|
...modelSettings,
|
|
19900
|
+
size: modelSettings.size || '1024x1024',
|
|
19902
19901
|
prompt: rawPromptContent,
|
|
19903
19902
|
user: (_a = this.options.userId) === null || _a === void 0 ? void 0 : _a.toString(),
|
|
19904
19903
|
response_format: 'url', // TODO: [🧠] Maybe allow b64_json
|