@promptbook/components 0.112.0-104 → 0.112.0-106

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.
@@ -6,6 +6,7 @@ import type { number_positive } from '../../types/number_positive';
6
6
  import type { string_knowledge_source_content } from '../../types/string_knowledge_source_content';
7
7
  import type { string_css_value } from '../../types/string_markdown';
8
8
  import type { HoistedMenuItem } from '../_common/MenuHoisting/MenuHoistingContext';
9
+ import type { BookEditorTheme } from './BookEditorTheme';
9
10
  /**
10
11
  * Monaco diagnostic shown inside `BookEditor`.
11
12
  *
@@ -94,14 +95,14 @@ export type BookEditorProps = {
94
95
  */
95
96
  readonly style?: CSSProperties;
96
97
  /**
97
- * Resolved visual theme used for the editor wrapper and Monaco instance.
98
+ * Resolved host application theme.
98
99
  *
99
- * Host applications should pass the final light/dark theme instead of relying on
100
- * browser media-query inference inside `<BookEditor/>`.
100
+ * `<BookEditor/>` accepts this for integration compatibility, but the notebook
101
+ * editor itself is intentionally rendered as light paper in every app theme.
101
102
  *
102
103
  * @default 'LIGHT'
103
104
  */
104
- readonly theme?: 'LIGHT' | 'DARK';
105
+ readonly theme?: BookEditorTheme;
105
106
  /**
106
107
  * Height of the `BookEditor` component
107
108
  *
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Visual theme accepted by `<BookEditor/>` integrations.
3
+ *
4
+ * @private internal type of `BookEditor`
5
+ */
6
+ export type BookEditorTheme = 'LIGHT' | 'DARK';
7
+ /**
8
+ * Theme used for the actual notebook editor surface.
9
+ *
10
+ * The host application can still pass its resolved app theme, but book sources
11
+ * are intentionally rendered as light paper in both light and dark app modes.
12
+ *
13
+ * @private internal constant of `BookEditor`
14
+ */
15
+ export declare const BOOK_EDITOR_RENDER_THEME = "LIGHT";
16
+ /**
17
+ * Resolves an app-level theme into the visual theme used by `<BookEditor/>`.
18
+ *
19
+ * @param hostTheme - Resolved theme from the embedding application.
20
+ * @returns Light theme used by the Book editor surface.
21
+ *
22
+ * @private internal utility of `BookEditor`
23
+ */
24
+ export declare function resolveBookEditorRenderTheme(hostTheme?: BookEditorTheme): BookEditorTheme;
@@ -1,14 +1,9 @@
1
1
  import type { editor } from 'monaco-editor';
2
+ import type { BookEditorTheme } from './BookEditorTheme';
2
3
  /**
3
4
  * Type describing monaco editor.
4
5
  */
5
6
  type MonacoEditor = typeof import('monaco-editor');
6
- /**
7
- * Resolved visual theme supported by the Book editor.
8
- *
9
- * @private function of BookEditorMonaco
10
- */
11
- type BookEditorTheme = 'LIGHT' | 'DARK';
12
7
  /**
13
8
  * Props for use book editor monaco language.
14
9
  */
@@ -1,12 +1,9 @@
1
1
  import type { editor } from 'monaco-editor';
2
+ import type { BookEditorTheme } from './BookEditorTheme';
2
3
  /**
3
4
  * Type describing monaco editor.
4
5
  */
5
6
  type MonacoEditor = typeof import('monaco-editor');
6
- /**
7
- * Resolved visual theme supported by the Book editor.
8
- */
9
- type BookEditorTheme = 'LIGHT' | 'DARK';
10
7
  /**
11
8
  * Props for use book editor monaco lifecycle.
12
9
  */
@@ -1,3 +1,4 @@
1
+ import type { BookEditorTheme } from './BookEditorTheme';
1
2
  /**
2
3
  * Props for use book editor monaco styles.
3
4
  */
@@ -7,7 +8,7 @@ type UseBookEditorMonacoStylesProps = {
7
8
  readonly scaledContentPaddingLeft: number;
8
9
  readonly scaledVerticalLineLeft: number;
9
10
  readonly zoomLevel: number;
10
- readonly theme: 'LIGHT' | 'DARK';
11
+ readonly theme: BookEditorTheme;
11
12
  };
12
13
  /**
13
14
  * Injects notebook-inspired styling that is unique per `BookEditorMonaco` instance.
@@ -28,6 +28,12 @@ export declare const AGENT_QUEUED_MESSAGES_DIRECTORY_PATH: string;
28
28
  * @private internal utility of `ptbk agent-folder`
29
29
  */
30
30
  export declare const AGENT_FINISHED_MESSAGES_DIRECTORY_PATH: string;
31
+ /**
32
+ * Relative path to messages that the agent runner stopped retrying.
33
+ *
34
+ * @private internal utility of `ptbk agent-folder`
35
+ */
36
+ export declare const AGENT_FAILED_MESSAGES_DIRECTORY_PATH: string;
31
37
  /**
32
38
  * Relative path to generated local agent documentation initialized by `ptbk agent-folder init`.
33
39
  *
@@ -15,7 +15,7 @@ export declare const BOOK_LANGUAGE_VERSION: string_semantic_version;
15
15
  export declare const PROMPTBOOK_ENGINE_VERSION: string_promptbook_version;
16
16
  /**
17
17
  * Represents the version string of the Promptbook engine.
18
- * It follows semantic versioning (e.g., `0.112.0-102`).
18
+ * It follows semantic versioning (e.g., `0.112.0-105`).
19
19
  *
20
20
  * @generated
21
21
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/components",
3
- "version": "0.112.0-104",
3
+ "version": "0.112.0-106",
4
4
  "description": "Promptbook: Create persistent AI agents that turn your company's scattered knowledge into action",
5
5
  "private": false,
6
6
  "sideEffects": false,
package/umd/index.umd.js CHANGED
@@ -31,7 +31,7 @@
31
31
  * @generated
32
32
  * @see https://github.com/webgptorg/promptbook
33
33
  */
34
- const PROMPTBOOK_ENGINE_VERSION = '0.112.0-104';
34
+ const PROMPTBOOK_ENGINE_VERSION = '0.112.0-106';
35
35
  /**
36
36
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
37
37
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -5550,10 +5550,7 @@
5550
5550
  Math.max(0, Math.cos(effectiveLongitude)) * 0.1 +
5551
5551
  lowerBlend * tentacleInfluence.core * (0.1 + tentacleInfluence.depthScale * 0.06) -
5552
5552
  Math.max(0, -Math.cos(effectiveLongitude)) * 0.05;
5553
- const tentacleTubeRadius = lowerBlend *
5554
- tentacleInfluence.core *
5555
- (0.11 + tipBlend * 0.06 + tentacleInfluence.widthScale * 0.025) *
5556
- radiusX;
5553
+ const tentacleTubeRadius = lowerBlend * tentacleInfluence.core * (0.11 + tipBlend * 0.06 + tentacleInfluence.widthScale * 0.025) * radiusX;
5557
5554
  const planarRadiusX = cosineLatitude * radiusX * horizontalScale + tentacleTubeRadius;
5558
5555
  const planarRadiusZ = cosineLatitude * radiusZ * depthScale + tentacleTubeRadius * 0.72;
5559
5556
  const lowerDrop = lowerBlend *
@@ -5564,8 +5561,7 @@
5564
5561
  tentacleInfluence.lengthScale * 0.22 +
5565
5562
  (morphologyProfile.tentacles.flowLengthScale - 1) * 0.08));
5566
5563
  return {
5567
- x: Math.sin(effectiveLongitude) * planarRadiusX +
5568
- tentacleWave * radiusX * (0.052 + tipBlend * 0.05),
5564
+ x: Math.sin(effectiveLongitude) * planarRadiusX + tentacleWave * radiusX * (0.052 + tipBlend * 0.05),
5569
5565
  y: Math.sin(latitude) * radiusY * (1 + upperBlend * 0.12) -
5570
5566
  upperBlend * radiusY * 0.1 +
5571
5567
  lowerDrop +
@@ -5639,8 +5635,11 @@
5639
5635
  */
5640
5636
  function resolveContinuousLobeWave(options, longitude) {
5641
5637
  const { morphologyProfile, animationPhase, timeMs } = options;
5642
- return (Math.cos(longitude * OCTOPUS_TENTACLE_COUNT + animationPhase + timeMs / (980 + morphologyProfile.body.lobeCount * 18)) +
5643
- 1) / 2;
5638
+ return ((Math.cos(longitude * OCTOPUS_TENTACLE_COUNT +
5639
+ animationPhase +
5640
+ timeMs / (980 + morphologyProfile.body.lobeCount * 18)) +
5641
+ 1) /
5642
+ 2);
5644
5643
  }
5645
5644
  /**
5646
5645
  * Resolves one base fill tone for a patch on the continuous octopus mesh.
@@ -5704,8 +5703,7 @@
5704
5703
  for (let sampleIndex = 0; sampleIndex < 8; sampleIndex++) {
5705
5704
  const progress = sampleIndex / 7;
5706
5705
  const latitude = -0.46 + progress * 0.74;
5707
- const longitude = baseLongitude +
5708
- Math.sin(timeMs / 1160 + animationPhase + currentIndex * 0.7 + progress * 2) * 0.035;
5706
+ const longitude = baseLongitude + Math.sin(timeMs / 1160 + animationPhase + currentIndex * 0.7 + progress * 2) * 0.035;
5709
5707
  const scenePoint = transformScenePoint(sampleContinuousOctopusSurfacePoint(surfaceOptions, latitude, longitude), center, rotationX, rotationY);
5710
5708
  if (scenePoint.z > center.z - size * 0.016) {
5711
5709
  projectedPoints.push(projectScenePoint(scenePoint, size, sceneCenterX, sceneCenterY));
@@ -23380,6 +23378,30 @@
23380
23378
  DIAGNOSTIC_MARKER_OWNER: 'book-editor-diagnostics',
23381
23379
  };
23382
23380
 
23381
+ /**
23382
+ * Theme used for the actual notebook editor surface.
23383
+ *
23384
+ * The host application can still pass its resolved app theme, but book sources
23385
+ * are intentionally rendered as light paper in both light and dark app modes.
23386
+ *
23387
+ * @private internal constant of `BookEditor`
23388
+ */
23389
+ const BOOK_EDITOR_RENDER_THEME = 'LIGHT';
23390
+ /**
23391
+ * Resolves an app-level theme into the visual theme used by `<BookEditor/>`.
23392
+ *
23393
+ * @param hostTheme - Resolved theme from the embedding application.
23394
+ * @returns Light theme used by the Book editor surface.
23395
+ *
23396
+ * @private internal utility of `BookEditor`
23397
+ */
23398
+ function resolveBookEditorRenderTheme(hostTheme = BOOK_EDITOR_RENDER_THEME) {
23399
+ if (hostTheme === 'DARK') {
23400
+ return BOOK_EDITOR_RENDER_THEME;
23401
+ }
23402
+ return hostTheme;
23403
+ }
23404
+
23383
23405
  /**
23384
23406
  * Gets a commitment definition by its type
23385
23407
  *
@@ -24389,19 +24411,20 @@
24389
24411
  *
24390
24412
  * @private function of BookEditorMonaco
24391
24413
  */
24392
- function ensureBookEditorMonacoLanguage(monaco, theme = 'LIGHT') {
24414
+ function ensureBookEditorMonacoLanguage(monaco, theme = BOOK_EDITOR_RENDER_THEME) {
24415
+ const renderedTheme = resolveBookEditorRenderTheme(theme);
24393
24416
  const monacoWithLanguageState = monaco;
24394
24417
  if (monacoWithLanguageState[BOOK_EDITOR_LANGUAGE_INITIALIZED_FLAG]) {
24395
- if (monacoWithLanguageState[BOOK_EDITOR_THEME_MODE_FLAG] !== theme) {
24396
- applyBookEditorMonacoTheme(monaco, theme);
24397
- monacoWithLanguageState[BOOK_EDITOR_THEME_MODE_FLAG] = theme;
24418
+ if (monacoWithLanguageState[BOOK_EDITOR_THEME_MODE_FLAG] !== renderedTheme) {
24419
+ applyBookEditorMonacoTheme(monaco, renderedTheme);
24420
+ monacoWithLanguageState[BOOK_EDITOR_THEME_MODE_FLAG] = renderedTheme;
24398
24421
  return;
24399
24422
  }
24400
24423
  monaco.editor.setTheme(BookEditorMonacoConstants.BOOK_THEME_ID);
24401
24424
  return;
24402
24425
  }
24403
24426
  monacoWithLanguageState[BOOK_EDITOR_LANGUAGE_INITIALIZED_FLAG] = true;
24404
- monacoWithLanguageState[BOOK_EDITOR_THEME_MODE_FLAG] = theme;
24427
+ monacoWithLanguageState[BOOK_EDITOR_THEME_MODE_FLAG] = renderedTheme;
24405
24428
  monaco.languages.register({ id: BookEditorMonacoConstants.BOOK_LANGUAGE_ID });
24406
24429
  const commitmentDefinitions = getAllCommitmentDefinitions();
24407
24430
  const commitmentTypes = [...new Set(commitmentDefinitions.map(({ type }) => type))];
@@ -24511,7 +24534,7 @@
24511
24534
  return { links };
24512
24535
  },
24513
24536
  });
24514
- applyBookEditorMonacoTheme(monaco, theme);
24537
+ applyBookEditorMonacoTheme(monaco, renderedTheme);
24515
24538
  }
24516
24539
  /**
24517
24540
  * Ensures the mounted Monaco editor model uses Book language and Book theme.
@@ -24524,8 +24547,9 @@
24524
24547
  * @private function of BookEditorMonaco
24525
24548
  */
24526
24549
  function ensureBookEditorMonacoLanguageForEditor(props) {
24527
- const { monaco, monacoEditor, theme = 'LIGHT' } = props;
24528
- ensureBookEditorMonacoLanguage(monaco, theme);
24550
+ const { monaco, monacoEditor, theme = BOOK_EDITOR_RENDER_THEME } = props;
24551
+ const renderedTheme = resolveBookEditorRenderTheme(theme);
24552
+ ensureBookEditorMonacoLanguage(monaco, renderedTheme);
24529
24553
  const model = monacoEditor.getModel();
24530
24554
  if (!model) {
24531
24555
  return;
@@ -25757,7 +25781,8 @@
25757
25781
  * @private Internal component used by `BookEditor`
25758
25782
  */
25759
25783
  function BookEditorMonaco(props) {
25760
- const { value, onChange, diagnostics, isReadonly, theme = 'LIGHT', translations, onFileUpload, isUploadButtonShown, isCameraButtonShown, isDownloadButtonShown, isAboutButtonShown = true, isFullscreenButtonShown = true, onFullscreenClick, isFullscreen, zoom = 1, monacoModelPath, hoistedMenuItems, } = props;
25784
+ const { value, onChange, diagnostics, isReadonly, theme: hostTheme = BOOK_EDITOR_RENDER_THEME, translations, onFileUpload, isUploadButtonShown, isCameraButtonShown, isDownloadButtonShown, isAboutButtonShown = true, isFullscreenButtonShown = true, onFullscreenClick, isFullscreen, zoom = 1, monacoModelPath, hoistedMenuItems, } = props;
25785
+ const theme = resolveBookEditorRenderTheme(hostTheme);
25761
25786
  const zoomLevel = zoom;
25762
25787
  const { scaledLineHeight, scaledContentPaddingLeft, scaledVerticalLineLeft, scaledFontSize, scaledScrollbarSize } = createBookEditorMonacoScale(zoomLevel);
25763
25788
  const monaco = MonacoEditor.useMonaco();
@@ -25846,15 +25871,16 @@
25846
25871
  * @public exported from `@promptbook/components`
25847
25872
  */
25848
25873
  function BookEditor(props) {
25849
- const { agentSource, className, style, theme = 'LIGHT', zoom = 1, value, onChange, diagnostics, onFileUpload, isVerbose = DEFAULT_IS_VERBOSE, isBorderRadiusDisabled = false, isReadonly = false, translations, isUploadButtonShown = true, isCameraButtonShown, isDownloadButtonShown = true, isAboutButtonShown = true, isFullscreenButtonShown = true, sync, monacoModelPath, hoistedMenuItems, } = props;
25874
+ const { agentSource, className, style, theme: hostTheme = BOOK_EDITOR_RENDER_THEME, zoom = 1, value, onChange, diagnostics, onFileUpload, isVerbose = DEFAULT_IS_VERBOSE, isBorderRadiusDisabled = false, isReadonly = false, translations, isUploadButtonShown = true, isCameraButtonShown, isDownloadButtonShown = true, isAboutButtonShown = true, isFullscreenButtonShown = true, sync, monacoModelPath, hoistedMenuItems, } = props;
25850
25875
  const [isFullscreen, setIsFullscreen] = react.useState(false);
25876
+ const renderedTheme = resolveBookEditorRenderTheme(hostTheme);
25851
25877
  /**
25852
25878
  * Toggles fullscreen mode for the editor.
25853
25879
  */
25854
25880
  const handleFullscreenToggle = () => {
25855
25881
  setIsFullscreen(!isFullscreen);
25856
25882
  };
25857
- const editorContent = (jsxRuntime.jsx("div", { "data-book-component": "BookEditor", "data-book-editor-theme": theme.toLowerCase(), className: classNames(styles$d.BookEditor, isVerbose && styles$d.isVerbose, styles$d.bookEditorWrapper, isBorderRadiusDisabled && styles$d.isBorderRadiusDisabled, isFullscreen && styles$d.fullscreen, className), style: isFullscreen
25883
+ const editorContent = (jsxRuntime.jsx("div", { "data-book-component": "BookEditor", "data-book-editor-theme": renderedTheme.toLowerCase(), className: classNames(styles$d.BookEditor, isVerbose && styles$d.isVerbose, styles$d.bookEditorWrapper, isBorderRadiusDisabled && styles$d.isBorderRadiusDisabled, isFullscreen && styles$d.fullscreen, className), style: isFullscreen
25858
25884
  ? style
25859
25885
  : {
25860
25886
  ...(style || {}),
@@ -25865,7 +25891,7 @@
25865
25891
  ? `${props.height}px`
25866
25892
  : props.height || `${DEFAULT_BOOK_EDITOR_HEIGHT}px`,
25867
25893
  }),
25868
- }, children: jsxRuntime.jsx(BookEditorMonaco, { value: agentSource || value, onChange: onChange, diagnostics: diagnostics, onFileUpload: onFileUpload, isVerbose: isVerbose, isBorderRadiusDisabled: isBorderRadiusDisabled, isReadonly: isReadonly, translations: translations, isUploadButtonShown: isUploadButtonShown, isCameraButtonShown: isCameraButtonShown, isDownloadButtonShown: isDownloadButtonShown, isAboutButtonShown: isAboutButtonShown, isFullscreenButtonShown: isFullscreenButtonShown, onFullscreenClick: handleFullscreenToggle, isFullscreen: isFullscreen, sync: sync, zoom: zoom, monacoModelPath: monacoModelPath, hoistedMenuItems: hoistedMenuItems, theme: theme }) }));
25894
+ }, children: jsxRuntime.jsx(BookEditorMonaco, { value: agentSource || value, onChange: onChange, diagnostics: diagnostics, onFileUpload: onFileUpload, isVerbose: isVerbose, isBorderRadiusDisabled: isBorderRadiusDisabled, isReadonly: isReadonly, translations: translations, isUploadButtonShown: isUploadButtonShown, isCameraButtonShown: isCameraButtonShown, isDownloadButtonShown: isDownloadButtonShown, isAboutButtonShown: isAboutButtonShown, isFullscreenButtonShown: isFullscreenButtonShown, onFullscreenClick: handleFullscreenToggle, isFullscreen: isFullscreen, sync: sync, zoom: zoom, monacoModelPath: monacoModelPath, hoistedMenuItems: hoistedMenuItems, theme: renderedTheme }) }));
25869
25895
  return isFullscreen && typeof document !== 'undefined' ? reactDom.createPortal(editorContent, document.body) : editorContent;
25870
25896
  }
25871
25897