@promptbook/cli 0.104.0-10 → 0.104.0-11

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 (47) hide show
  1. package/apps/agents-server/src/app/admin/files/FilesGalleryClient.tsx +263 -0
  2. package/apps/agents-server/src/app/admin/files/actions.ts +61 -0
  3. package/apps/agents-server/src/app/admin/files/page.tsx +13 -0
  4. package/apps/agents-server/src/app/admin/image-generator-test/ImageGeneratorTestClient.tsx +169 -0
  5. package/apps/agents-server/src/app/admin/image-generator-test/page.tsx +13 -0
  6. package/apps/agents-server/src/app/admin/images/ImagesGalleryClient.tsx +256 -0
  7. package/apps/agents-server/src/app/admin/images/actions.ts +60 -0
  8. package/apps/agents-server/src/app/admin/images/page.tsx +13 -0
  9. package/apps/agents-server/src/app/admin/search-engine-test/SearchEngineTestClient.tsx +109 -0
  10. package/apps/agents-server/src/app/admin/search-engine-test/actions.ts +17 -0
  11. package/apps/agents-server/src/app/admin/search-engine-test/page.tsx +13 -0
  12. package/apps/agents-server/src/app/api/images/[filename]/route.ts +22 -1
  13. package/apps/agents-server/src/components/AgentProfile/AgentCapabilityChips.tsx +38 -0
  14. package/apps/agents-server/src/components/AgentProfile/AgentProfile.tsx +3 -0
  15. package/apps/agents-server/src/components/Header/Header.tsx +16 -0
  16. package/apps/agents-server/src/components/Homepage/AgentCard.tsx +13 -8
  17. package/apps/agents-server/src/database/$getTableName.ts +1 -0
  18. package/apps/agents-server/src/database/migrations/2025-12-0830-image-purpose.sql +5 -0
  19. package/apps/agents-server/src/database/migrations/2025-12-0890-file-agent-id.sql +5 -0
  20. package/apps/agents-server/src/database/schema.ts +14 -1
  21. package/esm/index.es.js +53 -2
  22. package/esm/index.es.js.map +1 -1
  23. package/esm/typings/src/_packages/types.index.d.ts +6 -0
  24. package/esm/typings/src/book-2.0/agent-source/AgentBasicInformation.d.ts +23 -0
  25. package/esm/typings/src/book-components/Chat/types/ChatMessage.d.ts +2 -2
  26. package/esm/typings/src/book-components/_common/Dropdown/Dropdown.d.ts +1 -1
  27. package/esm/typings/src/book-components/_common/HamburgerMenu/HamburgerMenu.d.ts +1 -1
  28. package/esm/typings/src/book-components/icons/AboutIcon.d.ts +1 -1
  29. package/esm/typings/src/book-components/icons/AttachmentIcon.d.ts +1 -1
  30. package/esm/typings/src/book-components/icons/CameraIcon.d.ts +1 -1
  31. package/esm/typings/src/book-components/icons/DownloadIcon.d.ts +1 -1
  32. package/esm/typings/src/book-components/icons/MenuIcon.d.ts +1 -1
  33. package/esm/typings/src/book-components/icons/SaveIcon.d.ts +1 -1
  34. package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.d.ts +2 -2
  35. package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentsDatabaseSchema.d.ts +0 -54
  36. package/esm/typings/src/llm-providers/_common/utils/count-total-usage/countUsage.d.ts +1 -1
  37. package/esm/typings/src/llm-providers/agent/Agent.d.ts +6 -1
  38. package/esm/typings/src/remote-server/ui/ServerApp.d.ts +1 -1
  39. package/esm/typings/src/search-engines/SearchEngine.d.ts +9 -0
  40. package/esm/typings/src/search-engines/SearchResult.d.ts +18 -0
  41. package/esm/typings/src/search-engines/bing/BingSearchEngine.d.ts +15 -0
  42. package/esm/typings/src/search-engines/dummy/DummySearchEngine.d.ts +15 -0
  43. package/esm/typings/src/utils/random/$randomAgentPersona.d.ts +3 -2
  44. package/esm/typings/src/version.d.ts +1 -1
  45. package/package.json +1 -1
  46. package/umd/index.umd.js +53 -2
  47. package/umd/index.umd.js.map +1 -1
@@ -5,16 +5,17 @@ import { really_any } from '@promptbook-local/types';
5
5
  import { EyeIcon, EyeOffIcon, RotateCcwIcon } from 'lucide-react';
6
6
  import Link from 'next/link';
7
7
  import { AgentBasicInformation } from '../../../../../src/book-2.0/agent-source/AgentBasicInformation';
8
+ import { AgentCapabilityChips } from '../AgentProfile/AgentCapabilityChips';
8
9
  import { useAgentBackground } from '../AgentProfile/useAgentBackground';
9
10
 
10
11
  type AgentCardProps = {
11
12
  /**
12
- * @@@
13
+ * The basic information of the agent to display
13
14
  */
14
15
  readonly agent: AgentBasicInformation;
15
16
 
16
17
  /**
17
- * @@@
18
+ * The URL to navigate to when the card is clicked
18
19
  */
19
20
  readonly href: string;
20
21
 
@@ -24,32 +25,32 @@ type AgentCardProps = {
24
25
  readonly publicUrl: URL;
25
26
 
26
27
  /**
27
- * @@@
28
+ * Whether the current user has admin privileges
28
29
  */
29
30
  readonly isAdmin?: boolean;
30
31
 
31
32
  /**
32
- * @@@
33
+ * Callback function to delete the agent
33
34
  */
34
35
  readonly onDelete?: (agentIdentifier: string) => void;
35
36
 
36
37
  /**
37
- * @@@
38
+ * Callback function to clone the agent
38
39
  */
39
40
  readonly onClone?: (agentIdentifier: string) => void;
40
41
 
41
42
  /**
42
- * @@@
43
+ * Callback function to toggle the agent's visibility
43
44
  */
44
45
  readonly onToggleVisibility?: (agentIdentifier: string) => void;
45
46
 
46
47
  /**
47
- * @@@
48
+ * Callback function to restore a deleted agent
48
49
  */
49
50
  readonly onRestore?: (agentIdentifier: string) => void;
50
51
 
51
52
  /**
52
- * @@@
53
+ * The current visibility status of the agent
53
54
  */
54
55
  readonly visibility?: 'PUBLIC' | 'PRIVATE';
55
56
  };
@@ -122,6 +123,10 @@ export function AgentCard({
122
123
  <p className="text-sm text-gray-800 text-center line-clamp-3 leading-relaxed font-medium mix-blend-hard-light">
123
124
  {personaDescription}
124
125
  </p>
126
+
127
+ <div className="flex justify-center w-full">
128
+ <AgentCapabilityChips agent={agent} className="justify-center mt-3 opacity-90 scale-90" />
129
+ </div>
125
130
  </div>
126
131
  </div>
127
132
  </Link>
@@ -15,4 +15,5 @@ type string_table_name = keyof AgentsServerDatabase['public']['Tables'];
15
15
  export async function $getTableName<TTable extends string_table_name>(tableName: TTable): Promise<TTable> {
16
16
  const { tablePrefix } = await $provideServer();
17
17
  return `${tablePrefix}${tableName}` as TTable;
18
+ // <- TODO: [🏧] DRY
18
19
  }
@@ -0,0 +1,5 @@
1
+ ALTER TABLE "prefix_Image" ADD COLUMN "agentId" BIGINT REFERENCES "prefix_Agent"("id") ON DELETE CASCADE;
2
+ ALTER TABLE "prefix_Image" ADD COLUMN "purpose" TEXT CHECK ("purpose" IN ('AVATAR', 'TESTING'));
3
+
4
+ COMMENT ON COLUMN "prefix_Image"."agentId" IS 'The agent this image belongs to (nullable for testing images)';
5
+ COMMENT ON COLUMN "prefix_Image"."purpose" IS 'The purpose of the image (AVATAR or TESTING)';
@@ -0,0 +1,5 @@
1
+ -- Add agentId column to associate files with agents
2
+ ALTER TABLE "prefix_File" ADD COLUMN IF NOT EXISTS "agentId" INTEGER NULL;
3
+
4
+ -- Add foreign key constraint to Agent table
5
+ ALTER TABLE "prefix_File" ADD CONSTRAINT "File_agentId_fkey" FOREIGN KEY ("agentId") REFERENCES "prefix_Agent" ("id") ON DELETE SET NULL;
@@ -389,6 +389,8 @@ export type AgentsServerDatabase = {
389
389
  prompt: string;
390
390
  cdnUrl: string;
391
391
  cdnKey: string;
392
+ agentId: number | null;
393
+ purpose: 'AVATAR' | 'TESTING' | null;
392
394
  };
393
395
  Insert: {
394
396
  id?: number;
@@ -398,6 +400,8 @@ export type AgentsServerDatabase = {
398
400
  prompt: string;
399
401
  cdnUrl: string;
400
402
  cdnKey: string;
403
+ agentId?: number | null;
404
+ purpose?: 'AVATAR' | 'TESTING' | null;
401
405
  };
402
406
  Update: {
403
407
  id?: number;
@@ -407,8 +411,17 @@ export type AgentsServerDatabase = {
407
411
  prompt?: string;
408
412
  cdnUrl?: string;
409
413
  cdnKey?: string;
414
+ agentId?: number | null;
415
+ purpose?: 'AVATAR' | 'TESTING' | null;
410
416
  };
411
- Relationships: [];
417
+ Relationships: [
418
+ {
419
+ foreignKeyName: 'Image_agentId_fkey';
420
+ columns: ['agentId'];
421
+ referencedRelation: 'Agent';
422
+ referencedColumns: ['id'];
423
+ },
424
+ ];
412
425
  };
413
426
  File: {
414
427
  Row: {
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-10';
50
+ const PROMPTBOOK_ENGINE_VERSION = '0.104.0-11';
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
@@ -5410,7 +5410,7 @@ function countUsage(llmTools) {
5410
5410
  * TODO: [🧠] Is there some meaningfull way how to test this util
5411
5411
  * TODO: [🧠][🌯] Maybe a way how to hide ability to `get totalUsage`
5412
5412
  * > const [llmToolsWithUsage,getUsage] = countTotalUsage(llmTools);
5413
- * TODO: [👷‍♂️] @@@ Manual about construction of llmTools
5413
+ * TODO: [👷‍♂️] Write a comprehensive manual explaining the construction and usage of LLM tools in the Promptbook ecosystem
5414
5414
  */
5415
5415
 
5416
5416
  /**
@@ -26534,7 +26534,57 @@ function parseAgentSource(agentSource) {
26534
26534
  }
26535
26535
  const meta = {};
26536
26536
  const links = [];
26537
+ const capabilities = [];
26537
26538
  for (const commitment of parseResult.commitments) {
26539
+ if (commitment.type === 'USE BROWSER') {
26540
+ capabilities.push({
26541
+ type: 'browser',
26542
+ label: 'Browser',
26543
+ iconName: 'Globe',
26544
+ });
26545
+ continue;
26546
+ }
26547
+ if (commitment.type === 'USE SEARCH ENGINE') {
26548
+ capabilities.push({
26549
+ type: 'search-engine',
26550
+ label: 'Search Internet',
26551
+ iconName: 'Search',
26552
+ });
26553
+ continue;
26554
+ }
26555
+ if (commitment.type === 'KNOWLEDGE') {
26556
+ const content = spaceTrim$2(commitment.content).split('\n')[0] || '';
26557
+ let label = content;
26558
+ let iconName = 'Book';
26559
+ if (content.startsWith('http://') || content.startsWith('https://')) {
26560
+ try {
26561
+ const url = new URL(content);
26562
+ if (url.pathname.endsWith('.pdf')) {
26563
+ label = url.pathname.split('/').pop() || 'Document.pdf';
26564
+ iconName = 'FileText';
26565
+ }
26566
+ else {
26567
+ label = url.hostname.replace(/^www\./, '');
26568
+ }
26569
+ }
26570
+ catch (e) {
26571
+ // Invalid URL, treat as text
26572
+ }
26573
+ }
26574
+ else {
26575
+ // Text content - take first few words
26576
+ const words = content.split(/\s+/);
26577
+ if (words.length > 4) {
26578
+ label = words.slice(0, 4).join(' ') + '...';
26579
+ }
26580
+ }
26581
+ capabilities.push({
26582
+ type: 'knowledge',
26583
+ label,
26584
+ iconName,
26585
+ });
26586
+ continue;
26587
+ }
26538
26588
  if (commitment.type === 'META LINK') {
26539
26589
  const linkValue = spaceTrim$2(commitment.content);
26540
26590
  links.push(linkValue);
@@ -26581,6 +26631,7 @@ function parseAgentSource(agentSource) {
26581
26631
  meta,
26582
26632
  links,
26583
26633
  parameters,
26634
+ capabilities,
26584
26635
  };
26585
26636
  }
26586
26637
  /**