@promptbook/cli 0.112.0-118 → 0.112.0-119

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 (59) hide show
  1. package/apps/agents-server/src/app/api/page-preview/check/route.ts +31 -0
  2. package/apps/agents-server/src/app/api/page-preview/screenshot/route.ts +57 -0
  3. package/apps/agents-server/src/app/api/upload/route.ts +10 -1
  4. package/apps/agents-server/src/app/s3/[first]/[second]/[hash]/[filename]/route.ts +52 -0
  5. package/apps/agents-server/src/database/$provideClientSql.ts +37 -0
  6. package/apps/agents-server/src/database/$provideSupabaseForServer.ts +41 -0
  7. package/apps/agents-server/src/tools/$provideCdnForServer.ts +24 -0
  8. package/apps/agents-server/src/utils/cdn/classes/DigitalOceanSpaces.ts +30 -2
  9. package/apps/agents-server/src/utils/cdn/utils/getUserFileCdnKey.ts +10 -3
  10. package/apps/agents-server/src/utils/iframe/checkIfUrlCanBeEmbedded.ts +68 -0
  11. package/esm/index.es.js +26 -3
  12. package/esm/index.es.js.map +1 -1
  13. package/esm/src/book-components/BookEditor/BookEditor.d.ts +1 -1
  14. package/esm/src/book-components/BookEditor/BookEditorForClient.d.ts +1 -1
  15. package/esm/src/book-components/Chat/Chat/CitationIframePreview.d.ts +20 -0
  16. package/esm/src/book-components/_common/Dropdown/Dropdown.d.ts +1 -1
  17. package/esm/src/book-components/_common/MenuHoisting/MenuHoistingContext.d.ts +1 -1
  18. package/esm/src/book-components/_common/Modal/Modal.d.ts +1 -1
  19. package/esm/src/book-components/icons/AboutIcon.d.ts +1 -1
  20. package/esm/src/book-components/icons/DownloadIcon.d.ts +1 -1
  21. package/esm/src/book-components/icons/ExitFullscreenIcon.d.ts +1 -1
  22. package/esm/src/book-components/icons/FullscreenIcon.d.ts +1 -1
  23. package/esm/src/version.d.ts +1 -1
  24. package/package.json +1 -1
  25. package/src/book-3.0/LiteAgent.ts +1 -1
  26. package/src/book-components/BookEditor/BookEditor.tsx +6 -6
  27. package/src/book-components/BookEditor/BookEditorForClient.tsx +1 -1
  28. package/src/book-components/Chat/Chat/Chat.module.css +45 -0
  29. package/src/book-components/Chat/Chat/ChatCitationModal.tsx +2 -2
  30. package/src/book-components/Chat/Chat/CitationIframePreview.tsx +83 -0
  31. package/src/book-components/_common/Dropdown/Dropdown.tsx +1 -1
  32. package/src/book-components/_common/MenuHoisting/MenuHoistingContext.tsx +1 -1
  33. package/src/book-components/_common/Modal/Modal.tsx +1 -1
  34. package/src/book-components/icons/AboutIcon.tsx +1 -1
  35. package/src/book-components/icons/DownloadIcon.tsx +1 -1
  36. package/src/book-components/icons/ExitFullscreenIcon.tsx +1 -1
  37. package/src/book-components/icons/FullscreenIcon.tsx +1 -1
  38. package/src/cli/cli-commands/agents-server/buildAgentsServer.ts +31 -1
  39. package/src/execution/createPipelineExecutor/getKnowledgeForTask.ts +1 -1
  40. package/src/llm-providers/openai/OpenAiAgentKitExecutionToolsToolBuilder.ts +1 -1
  41. package/src/llm-providers/openai/OpenAiAssistantExecutionToolsToolRunner.ts +1 -1
  42. package/src/llm-providers/openai/OpenAiVectorStoreKnowledgeSourcePreparer.ts +1 -1
  43. package/src/other/templates/getTemplatesPipelineCollection.ts +732 -687
  44. package/src/scripting/javascript/JavascriptEvalExecutionTools.ts +1 -1
  45. package/src/version.ts +2 -2
  46. package/src/versions.txt +1 -0
  47. package/umd/index.umd.js +26 -3
  48. package/umd/index.umd.js.map +1 -1
  49. package/umd/src/book-components/BookEditor/BookEditor.d.ts +1 -1
  50. package/umd/src/book-components/BookEditor/BookEditorForClient.d.ts +1 -1
  51. package/umd/src/book-components/Chat/Chat/CitationIframePreview.d.ts +20 -0
  52. package/umd/src/book-components/_common/Dropdown/Dropdown.d.ts +1 -1
  53. package/umd/src/book-components/_common/MenuHoisting/MenuHoistingContext.d.ts +1 -1
  54. package/umd/src/book-components/_common/Modal/Modal.d.ts +1 -1
  55. package/umd/src/book-components/icons/AboutIcon.d.ts +1 -1
  56. package/umd/src/book-components/icons/DownloadIcon.d.ts +1 -1
  57. package/umd/src/book-components/icons/ExitFullscreenIcon.d.ts +1 -1
  58. package/umd/src/book-components/icons/FullscreenIcon.d.ts +1 -1
  59. package/umd/src/version.d.ts +1 -1
@@ -23,7 +23,7 @@ import { removeDiacritics as _removeDiacritics } from '../../utils/normalization
23
23
  import { removeEmojis as _removeEmojis } from '../../utils/normalization/removeEmojis';
24
24
  import { removeQuotes as _removeQuotes } from '../../utils/normalization/removeQuotes';
25
25
  import { unwrapResult as _unwrapResult } from '../../utils/normalization/unwrapResult';
26
- import { TODO_any } from '../../utils/organization/TODO_any';
26
+ import type { TODO_any } from '../../utils/organization/TODO_any';
27
27
  import { $preserve } from '../../utils/organization/preserve';
28
28
  import type { JavascriptExecutionToolsOptions } from './JavascriptExecutionToolsOptions';
29
29
 
package/src/version.ts CHANGED
@@ -16,11 +16,11 @@ export const BOOK_LANGUAGE_VERSION: string_semantic_version = '2.0.0';
16
16
  * @generated
17
17
  * @see https://github.com/webgptorg/promptbook
18
18
  */
19
- export const PROMPTBOOK_ENGINE_VERSION: string_promptbook_version = '0.112.0-118';
19
+ export const PROMPTBOOK_ENGINE_VERSION: string_promptbook_version = '0.112.0-119';
20
20
 
21
21
  /**
22
22
  * Represents the version string of the Promptbook engine.
23
- * It follows semantic versioning (e.g., `0.112.0-117`).
23
+ * It follows semantic versioning (e.g., `0.112.0-118`).
24
24
  *
25
25
  * @generated
26
26
  */
package/src/versions.txt CHANGED
@@ -1152,3 +1152,4 @@
1152
1152
  0.112.0-116
1153
1153
  0.112.0-117
1154
1154
  0.112.0-118
1155
+ 0.112.0-119
package/umd/index.umd.js CHANGED
@@ -63,7 +63,7 @@
63
63
  * @generated
64
64
  * @see https://github.com/webgptorg/promptbook
65
65
  */
66
- const PROMPTBOOK_ENGINE_VERSION = '0.112.0-118';
66
+ const PROMPTBOOK_ENGINE_VERSION = '0.112.0-119';
67
67
  /**
68
68
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
69
69
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -3277,6 +3277,16 @@
3277
3277
  * @private internal constant of `ptbk agents-server`
3278
3278
  */
3279
3279
  const DEFAULT_AGENTS_SERVER_NEXT_DIST_DIRECTORY_NAME = '.next';
3280
+ /**
3281
+ * Node.js heap size limit (in MiB) injected into `NODE_OPTIONS` for the Next.js production build.
3282
+ *
3283
+ * Next.js webpack peaks at ~1.9 GiB on a fresh install; the Node.js default cap is ~1.7 GiB,
3284
+ * which causes an OOM crash on first-run VPS installations where swap is the primary resource.
3285
+ * Raising the limit lets the build complete on the first attempt.
3286
+ *
3287
+ * @private internal constant of `ptbk agents-server`
3288
+ */
3289
+ const AGENTS_SERVER_BUILD_MAX_OLD_SPACE_MIB = 4096;
3280
3290
  /**
3281
3291
  * Environment variable passed to the bundled Next app so webpack can resolve dependencies
3282
3292
  * installed beside `ptbk` even when the app sources are materialized into a project cache.
@@ -3674,7 +3684,10 @@
3674
3684
  var _a, _b;
3675
3685
  const buildProcess = child_process.spawn(process.execPath, [options.nextCliPath, 'build'], {
3676
3686
  cwd: options.appPath,
3677
- env: options.environment,
3687
+ env: {
3688
+ ...options.environment,
3689
+ NODE_OPTIONS: mergeNodeOptionsWithHeapSize(options.environment.NODE_OPTIONS, AGENTS_SERVER_BUILD_MAX_OLD_SPACE_MIB),
3690
+ },
3678
3691
  stdio: ['ignore', 'pipe', 'pipe'],
3679
3692
  });
3680
3693
  (_a = buildProcess.stdout) === null || _a === void 0 ? void 0 : _a.on('data', (chunk) => {
@@ -3693,6 +3706,16 @@
3693
3706
  });
3694
3707
  });
3695
3708
  }
3709
+ /**
3710
+ * Prepends `--max-old-space-size=<mib>` to `NODE_OPTIONS` unless the caller already set one.
3711
+ */
3712
+ function mergeNodeOptionsWithHeapSize(existingNodeOptions, maxOldSpaceMib) {
3713
+ if (existingNodeOptions !== undefined && /--max-old-space-size[= ]/u.test(existingNodeOptions)) {
3714
+ return existingNodeOptions;
3715
+ }
3716
+ const heapFlag = `--max-old-space-size=${maxOldSpaceMib}`;
3717
+ return existingNodeOptions ? `${heapFlag} ${existingNodeOptions}` : heapFlag;
3718
+ }
3696
3719
  /**
3697
3720
  * Sends one Next build output chunk through the caller handler or to the foreground terminal.
3698
3721
  */
@@ -58464,7 +58487,7 @@
58464
58487
  return { skippedReason: 'invalid_data_url' };
58465
58488
  }
58466
58489
  return {
58467
- file: new File([parsed.buffer], parsed.filename, {
58490
+ file: new File([new Uint8Array(parsed.buffer)], parsed.filename, {
58468
58491
  type: parsed.mimeType,
58469
58492
  }),
58470
58493
  sizeBytes: parsed.buffer.length,