@promptbook/cli 0.103.0-43 → 0.103.0-45

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 (64) hide show
  1. package/README.md +6 -18
  2. package/apps/agents-server/README.md +3 -0
  3. package/apps/agents-server/TODO.txt +6 -0
  4. package/apps/agents-server/config.ts.todo +312 -0
  5. package/apps/agents-server/next.config.ts +42 -0
  6. package/apps/agents-server/package.json +11 -0
  7. package/apps/agents-server/postcss.config.mjs +8 -0
  8. package/apps/agents-server/public/.gitkeep +0 -0
  9. package/apps/agents-server/public/favicon.ico +0 -0
  10. package/apps/agents-server/public/logo-blue-white-256.png +0 -0
  11. package/apps/agents-server/src/app/AddAgentButton.tsx +20 -0
  12. package/apps/agents-server/src/app/actions.ts +14 -0
  13. package/apps/agents-server/src/app/agents/[agentName]/AgentUrlCopy.tsx +41 -0
  14. package/apps/agents-server/src/app/agents/[agentName]/TODO.txt +1 -0
  15. package/apps/agents-server/src/app/agents/[agentName]/api/chat/route.ts +60 -0
  16. package/apps/agents-server/src/app/agents/[agentName]/book+chat/SelfLearningBook.tsx +203 -0
  17. package/apps/agents-server/src/app/agents/[agentName]/book+chat/page.tsx +18 -0
  18. package/apps/agents-server/src/app/agents/[agentName]/page.tsx +155 -0
  19. package/apps/agents-server/src/app/api/chat/route.ts +32 -0
  20. package/apps/agents-server/src/app/api/chat-streaming/route.ts +44 -0
  21. package/apps/agents-server/src/app/api/long-running-task/route.ts +7 -0
  22. package/apps/agents-server/src/app/api/long-streaming/route.ts +20 -0
  23. package/apps/agents-server/src/app/globals.css +113 -0
  24. package/apps/agents-server/src/app/layout.tsx +72 -0
  25. package/apps/agents-server/src/app/page.tsx +115 -0
  26. package/apps/agents-server/src/deamons/longRunningTask.ts +37 -0
  27. package/apps/agents-server/src/supabase/TODO.txt +1 -0
  28. package/apps/agents-server/src/supabase/getSupabase.ts +25 -0
  29. package/apps/agents-server/src/supabase/getSupabaseForBrowser.ts +37 -0
  30. package/apps/agents-server/src/supabase/getSupabaseForServer.ts +48 -0
  31. package/apps/agents-server/src/supabase/getSupabaseForWorker.ts +42 -0
  32. package/apps/agents-server/src/tools/$provideAgentCollectionForServer.ts +49 -0
  33. package/apps/agents-server/src/tools/$provideExecutionToolsForServer.ts +110 -0
  34. package/apps/agents-server/src/tools/$provideOpenAiAssistantExecutionToolsForServer.ts +35 -0
  35. package/apps/agents-server/tailwind.config.ts +24 -0
  36. package/apps/agents-server/tsconfig.json +29 -0
  37. package/esm/index.es.js +57 -13
  38. package/esm/index.es.js.map +1 -1
  39. package/esm/typings/src/_packages/types.index.d.ts +8 -0
  40. package/esm/typings/src/book-components/AvatarProfile/AvatarProfile/AvatarProfile.d.ts +5 -0
  41. package/esm/typings/src/collection/agent-collection/AgentCollection.d.ts +2 -28
  42. package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.d.ts +61 -9
  43. package/esm/typings/src/errors/DatabaseError.d.ts +3 -0
  44. package/esm/typings/src/llm-providers/_multiple/getSingleLlmExecutionTools.d.ts +1 -0
  45. package/esm/typings/src/llm-providers/_multiple/joinLlmExecutionTools.d.ts +1 -0
  46. package/esm/typings/src/llm-providers/agent/CreateAgentLlmExecutionToolsOptions.d.ts +2 -1
  47. package/esm/typings/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +1 -1
  48. package/esm/typings/src/llm-providers/google/google-models.d.ts +1 -1
  49. package/esm/typings/src/llm-providers/openai/openai-models.d.ts +1 -1
  50. package/esm/typings/src/remote-server/startAgentServer.d.ts +3 -0
  51. package/esm/typings/src/remote-server/startRemoteServer.d.ts +1 -0
  52. package/esm/typings/src/types/typeAliases.d.ts +19 -1
  53. package/esm/typings/src/utils/color/$randomColor.d.ts +1 -0
  54. package/esm/typings/src/utils/random/$generateBookBoilerplate.d.ts +5 -2
  55. package/esm/typings/src/utils/random/$randomAgentPersona.d.ts +9 -0
  56. package/esm/typings/src/utils/random/$randomFullnameWithColor.d.ts +13 -0
  57. package/esm/typings/src/utils/random/$randomItem.d.ts +9 -0
  58. package/esm/typings/src/utils/random/$randomSeed.d.ts +3 -0
  59. package/esm/typings/src/utils/random/$randomToken.d.ts +1 -0
  60. package/esm/typings/src/version.d.ts +1 -1
  61. package/package.json +1 -1
  62. package/umd/index.umd.js +57 -13
  63. package/umd/index.umd.js.map +1 -1
  64. package/esm/typings/src/commands/_common/parseCommand.test.d.ts +0 -1
package/esm/index.es.js CHANGED
@@ -40,14 +40,14 @@ import { Converter } from 'showdown';
40
40
  * @generated
41
41
  * @see https://github.com/webgptorg/book
42
42
  */
43
- const BOOK_LANGUAGE_VERSION = '1.0.0';
43
+ const BOOK_LANGUAGE_VERSION = '2.0.0';
44
44
  /**
45
45
  * The version of the Promptbook engine
46
46
  *
47
47
  * @generated
48
48
  * @see https://github.com/webgptorg/promptbook
49
49
  */
50
- const PROMPTBOOK_ENGINE_VERSION = '0.103.0-43';
50
+ const PROMPTBOOK_ENGINE_VERSION = '0.103.0-45';
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
@@ -3197,6 +3197,9 @@ class DatabaseError extends Error {
3197
3197
  Object.setPrototypeOf(this, DatabaseError.prototype);
3198
3198
  }
3199
3199
  }
3200
+ /**
3201
+ * TODO: !!!! Explain that NotFoundError (!!! and other specific errors) has priority over DatabaseError in some contexts
3202
+ */
3200
3203
 
3201
3204
  /**
3202
3205
  * This error occurs when some expectation is not met in the execution of the pipeline
@@ -3313,6 +3316,7 @@ function $randomToken(randomness) {
3313
3316
  return randomBytes(randomness).toString('hex');
3314
3317
  }
3315
3318
  /**
3319
+ * TODO: [🤶] Maybe export through `@promptbook/utils` or `@promptbook/random` package
3316
3320
  * TODO: Maybe use nanoid instead https://github.com/ai/nanoid
3317
3321
  */
3318
3322
 
@@ -4675,6 +4679,7 @@ function joinLlmExecutionTools(title, ...llmExecutionTools) {
4675
4679
  return new MultipleLlmExecutionTools(title || 'Multiple LLM Providers joined by `joinLlmExecutionTools`', ...llmExecutionTools);
4676
4680
  }
4677
4681
  /**
4682
+ * TODO: [🙆] `getSingleLlmExecutionTools` vs `joinLlmExecutionTools` - explain difference or pick one
4678
4683
  * TODO: [👷‍♂️] @@@ Manual about construction of llmTools
4679
4684
  */
4680
4685
 
@@ -7322,6 +7327,7 @@ function getSingleLlmExecutionTools(oneOrMoreLlmExecutionTools) {
7322
7327
  return llmTools;
7323
7328
  }
7324
7329
  /**
7330
+ * TODO: [🙆] `getSingleLlmExecutionTools` vs `joinLlmExecutionTools` - explain difference or pick one
7325
7331
  * TODO: [👷‍♂️] @@@ Manual about construction of llmTools
7326
7332
  */
7327
7333
 
@@ -16365,6 +16371,7 @@ function startRemoteServer(options) {
16365
16371
  * TODO: [🃏] Pass here some security token to prevent malitious usage and/or DDoS
16366
16372
  * TODO: [0] Set unavailable models as undefined in `RemoteLlmExecutionTools` NOT throw error here
16367
16373
  * TODO: Allow to constrain anonymous mode for specific models / providers
16374
+ * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
16368
16375
  */
16369
16376
 
16370
16377
  /**
@@ -16697,7 +16704,7 @@ function pricing(value) {
16697
16704
  /**
16698
16705
  * List of available Anthropic Claude models with pricing
16699
16706
  *
16700
- * Note: Synced with official API docs at 2025-08-20
16707
+ * Note: Synced with official API docs at 2025-11-19
16701
16708
  *
16702
16709
  * @see https://docs.anthropic.com/en/docs/models-overview
16703
16710
  * @public exported from `@promptbook/anthropic-claude`
@@ -16705,6 +16712,26 @@ function pricing(value) {
16705
16712
  const ANTHROPIC_CLAUDE_MODELS = exportJson({
16706
16713
  name: 'ANTHROPIC_CLAUDE_MODELS',
16707
16714
  value: [
16715
+ {
16716
+ modelVariant: 'CHAT',
16717
+ modelTitle: 'Claude Sonnet 4.5',
16718
+ modelName: 'claude-sonnet-4-5-20250929',
16719
+ modelDescription: 'Our smartest model for complex agents and coding',
16720
+ pricing: {
16721
+ prompt: pricing(`$3.00 / 1M tokens`),
16722
+ output: pricing(`$15.00 / 1M tokens`),
16723
+ },
16724
+ },
16725
+ {
16726
+ modelVariant: 'CHAT',
16727
+ modelTitle: 'Claude Haiku 4.5',
16728
+ modelName: 'claude-haiku-4-5-20251001',
16729
+ modelDescription: 'Our fastest model with near-frontier intelligence',
16730
+ pricing: {
16731
+ prompt: pricing(`$1.00 / 1M tokens`),
16732
+ output: pricing(`$5.00 / 1M tokens`),
16733
+ },
16734
+ },
16708
16735
  {
16709
16736
  modelVariant: 'CHAT',
16710
16737
  modelTitle: 'Claude Opus 4.1',
@@ -16719,7 +16746,7 @@ const ANTHROPIC_CLAUDE_MODELS = exportJson({
16719
16746
  modelVariant: 'CHAT',
16720
16747
  modelTitle: 'Claude Opus 4',
16721
16748
  modelName: 'claude-opus-4-20250514',
16722
- modelDescription: 'Previous flagship Claude model with 200K token context window. Features very high intelligence and capability with exceptional performance across reasoning, coding, and creative tasks. Maintains strong safety guardrails while delivering sophisticated outputs for complex professional applications.',
16749
+ modelDescription: 'Previous flagship Claude model with 200K token context window. Features very high intelligence and capability with exceptional performance across reasoning, coding, and creative tasks. Maintains strong safety guardrails while delivering sophisticated outputs for complex professional applications. DEPRECATED: Use Claude Opus 4.1 instead.',
16723
16750
  pricing: {
16724
16751
  prompt: pricing(`$15.00 / 1M tokens`),
16725
16752
  output: pricing(`$75.00 / 1M tokens`),
@@ -16729,7 +16756,7 @@ const ANTHROPIC_CLAUDE_MODELS = exportJson({
16729
16756
  modelVariant: 'CHAT',
16730
16757
  modelTitle: 'Claude Sonnet 4',
16731
16758
  modelName: 'claude-sonnet-4-20250514',
16732
- modelDescription: 'High-performance Claude model with exceptional reasoning capabilities and 200K token context window (1M context beta available). Features balanced intelligence and efficiency with enhanced multimodal understanding. Offers optimal performance for most enterprise applications requiring sophisticated AI capabilities.',
16759
+ modelDescription: 'High-performance Claude model with exceptional reasoning capabilities and 200K token context window (1M context beta available). Features balanced intelligence and efficiency with enhanced multimodal understanding. Offers optimal performance for most enterprise applications requiring sophisticated AI capabilities. DEPRECATED: Use Claude Sonnet 4.5 instead.',
16733
16760
  pricing: {
16734
16761
  prompt: pricing(`$3.00 / 1M tokens`),
16735
16762
  output: pricing(`$15.00 / 1M tokens`),
@@ -17258,7 +17285,7 @@ const _AzureOpenAiMetadataRegistration = $llmToolsMetadataRegister.register({
17258
17285
  /**
17259
17286
  * List of available OpenAI models with pricing
17260
17287
  *
17261
- * Note: Synced with official API docs at 2025-08-20
17288
+ * Note: Synced with official API docs at 2025-11-19
17262
17289
  *
17263
17290
  * @see https://platform.openai.com/docs/models/
17264
17291
  * @see https://openai.com/api/pricing/
@@ -17268,11 +17295,21 @@ const OPENAI_MODELS = exportJson({
17268
17295
  name: 'OPENAI_MODELS',
17269
17296
  value: [
17270
17297
  /**/
17298
+ {
17299
+ modelVariant: 'CHAT',
17300
+ modelTitle: 'gpt-5.1',
17301
+ modelName: 'gpt-5.1',
17302
+ modelDescription: 'The best model for coding and agentic tasks with configurable reasoning effort.',
17303
+ pricing: {
17304
+ prompt: pricing(`$1.25 / 1M tokens`),
17305
+ output: pricing(`$10.00 / 1M tokens`),
17306
+ },
17307
+ },
17271
17308
  {
17272
17309
  modelVariant: 'CHAT',
17273
17310
  modelTitle: 'gpt-5',
17274
17311
  modelName: 'gpt-5',
17275
- modelDescription: "OpenAI's most advanced language model with unprecedented reasoning capabilities and 200K context window. Features revolutionary improvements in complex problem-solving, scientific reasoning, and creative tasks. Demonstrates human-level performance across diverse domains with enhanced safety measures and alignment. Represents the next generation of AI with superior understanding, nuanced responses, and advanced multimodal capabilities.",
17312
+ modelDescription: "OpenAI's most advanced language model with unprecedented reasoning capabilities and 200K context window. Features revolutionary improvements in complex problem-solving, scientific reasoning, and creative tasks. Demonstrates human-level performance across diverse domains with enhanced safety measures and alignment. Represents the next generation of AI with superior understanding, nuanced responses, and advanced multimodal capabilities. DEPRECATED: Use gpt-5.1 instead.",
17276
17313
  pricing: {
17277
17314
  prompt: pricing(`$1.25 / 1M tokens`),
17278
17315
  output: pricing(`$10.00 / 1M tokens`),
@@ -18707,7 +18744,7 @@ const _GoogleMetadataRegistration = $llmToolsMetadataRegister.register({
18707
18744
  /**
18708
18745
  * List of available Google models with descriptions
18709
18746
  *
18710
- * Note: Synced with official API docs at 2025-08-20
18747
+ * Note: Synced with official API docs at 2025-11-19
18711
18748
  *
18712
18749
  * @see https://ai.google.dev/models/gemini
18713
18750
  * @public exported from `@promptbook/google`
@@ -18715,6 +18752,13 @@ const _GoogleMetadataRegistration = $llmToolsMetadataRegister.register({
18715
18752
  const GOOGLE_MODELS = exportJson({
18716
18753
  name: 'GOOGLE_MODELS',
18717
18754
  value: [
18755
+ {
18756
+ modelVariant: 'CHAT',
18757
+ modelTitle: 'Gemini 3 Pro',
18758
+ modelName: 'gemini-3-pro-preview',
18759
+ modelDescription: 'The best model in the world for multimodal understanding, and our most powerful agentic and vibe-coding model yet, delivering richer visuals and deeper interactivity, all built on a foundation of state-of-the-art reasoning.',
18760
+ // TODO: [🧠] Add pricing information for Gemini 3 Pro
18761
+ },
18718
18762
  {
18719
18763
  modelVariant: 'CHAT',
18720
18764
  modelTitle: 'Gemini 2.5 Pro',
@@ -20516,11 +20560,11 @@ class OpenAiAssistantExecutionTools extends OpenAiExecutionTools {
20516
20560
  if (!this.isCreatingNewAssistantsAllowed) {
20517
20561
  throw new NotAllowed(`Creating new assistants is not allowed. Set \`isCreatingNewAssistantsAllowed: true\` in options to enable this feature.`);
20518
20562
  }
20519
- await this.playground();
20563
+ // await this.playground();
20520
20564
  const { name, instructions } = options;
20521
20565
  const client = await this.getClient();
20522
- /*
20523
- TODO: !!!
20566
+ /*/
20567
+ //TODO: !!!
20524
20568
  async function downloadFile(url: string, folder = './tmp'): Promise<string> {
20525
20569
  const filename = path.basename(url.split('?')[0]);
20526
20570
  const filepath = path.join(folder, filename);
@@ -20564,8 +20608,8 @@ class OpenAiAssistantExecutionTools extends OpenAiExecutionTools {
20564
20608
  const file = await uploadFileToOpenAI(filepath);
20565
20609
  uploadedFiles.push(file.id);
20566
20610
  }
20567
- */
20568
- alert('!!!! Creating new OpenAI assistant');
20611
+ /**/
20612
+ // alert('!!!! Creating new OpenAI assistant');
20569
20613
  // 3️⃣ Create assistant with uploaded files
20570
20614
  const assistant = await client.beta.assistants.create({
20571
20615
  name,