@promptbook/core 0.111.0-1 → 0.111.0-2

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.
@@ -0,0 +1,17 @@
1
+ import 'leaflet/dist/leaflet.css';
2
+ import type { GeoJsonObject } from 'geojson';
3
+ /**
4
+ * Props for `<ChatMessageMap/>`.
5
+ *
6
+ * @private internal helper of `<ChatMessageItem/>`
7
+ */
8
+ type ChatMessageMapProps = {
9
+ data: GeoJsonObject;
10
+ };
11
+ /**
12
+ * Renders a Leaflet map for GeoJSON data inside the chat bubble.
13
+ *
14
+ * @private internal helper of `<ChatMessageItem/>`
15
+ */
16
+ export declare function ChatMessageMap({ data }: ChatMessageMapProps): import("react/jsx-runtime").JSX.Element;
17
+ export {};
@@ -0,0 +1,38 @@
1
+ import { ChatParticipant } from '../types/ChatParticipant';
2
+ import type { ParsedCitation } from './parseCitationsFromContent';
3
+ /**
4
+ * Returns whether the provided value is a valid HTTP(S) URL.
5
+ *
6
+ * @param value - Candidate string to inspect.
7
+ * @returns True when the value parses as an HTTP or HTTPS URL.
8
+ * @private utility of `<Chat/>` citation rendering
9
+ */
10
+ export declare function isCitationUrl(value: string): boolean;
11
+ /**
12
+ * Determines whether a citation should be displayed as a text snippet instead of a file/URL.
13
+ *
14
+ * @param citation - Parsed citation metadata.
15
+ * @returns True when the citation looks like inline text instead of a document or URL.
16
+ * @private utility of `<Chat/>` citation rendering
17
+ */
18
+ export declare function isPlainTextCitation(citation: ParsedCitation): boolean;
19
+ /**
20
+ * Builds a label that matches the desired chip/modal title for a citation.
21
+ *
22
+ * @param citation - Parsed citation metadata.
23
+ * @returns The friendly label shown on chips and modal headers.
24
+ * @private utility of `<Chat/>` citation rendering
25
+ */
26
+ export declare function getCitationLabel(citation: ParsedCitation): string;
27
+ /**
28
+ * Resolves the preview URL used inside the citation modal iframe.
29
+ *
30
+ * @param citation - Parsed citation metadata.
31
+ * @param participants - Known chat participants for agent knowledge lookup.
32
+ * @returns URL string suitable for iframe preview or null when unavailable.
33
+ * @private utility of `<Chat/>` citation rendering
34
+ */
35
+ export declare function resolveCitationPreviewUrl(citation: ParsedCitation, participants: ReadonlyArray<ChatParticipant>): string | null;
36
+ /**
37
+ * TODO: [💞] Spread into multiple files
38
+ */
@@ -0,0 +1,41 @@
1
+ import type { GeoJsonObject } from 'geojson';
2
+ import type { ImagePromptSegment } from './parseImagePrompts';
3
+ /**
4
+ * Segment that represents plain markdown text inside a chat message.
5
+ */
6
+ /**
7
+ * Segment that represents plain markdown text inside a chat message.
8
+ *
9
+ * @private internal helper of `<ChatMessageItem/>`
10
+ */
11
+ export type ChatTextSegment = {
12
+ type: 'text';
13
+ content: string;
14
+ };
15
+ /**
16
+ * Segment that represents a Leaflet-ready map rendered from GeoJSON data.
17
+ */
18
+ /**
19
+ * Segment that represents a Leaflet-ready map rendered from GeoJSON data.
20
+ *
21
+ * @private internal helper of `<ChatMessageItem/>`
22
+ */
23
+ export type ChatMapSegment = {
24
+ type: 'map';
25
+ data: GeoJsonObject;
26
+ };
27
+ /**
28
+ * Composite segment type that covers text, image prompts, and map features.
29
+ */
30
+ /**
31
+ * Composite segment type that covers text, image prompts, and map features.
32
+ *
33
+ * @private internal helper of `<ChatMessageItem/>`
34
+ */
35
+ export type ChatMessageContentSegment = ImagePromptSegment | ChatTextSegment | ChatMapSegment;
36
+ /**
37
+ * Splits chat message content into markdown, image prompt, and map segments while preserving their order.
38
+ *
39
+ * @private internal helper of `<ChatMessageItem/>`
40
+ */
41
+ export declare function splitMessageContentIntoSegments(content: string): ReadonlyArray<ChatMessageContentSegment>;
@@ -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.111.0-0`).
18
+ * It follows semantic versioning (e.g., `0.111.0-1`).
19
19
  *
20
20
  * @generated
21
21
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/core",
3
- "version": "0.111.0-1",
3
+ "version": "0.111.0-2",
4
4
  "description": "Promptbook: Turn your company's scattered knowledge into AI ready books",
5
5
  "private": false,
6
6
  "sideEffects": false,
package/umd/index.umd.js CHANGED
@@ -28,7 +28,7 @@
28
28
  * @generated
29
29
  * @see https://github.com/webgptorg/promptbook
30
30
  */
31
- const PROMPTBOOK_ENGINE_VERSION = '0.111.0-1';
31
+ const PROMPTBOOK_ENGINE_VERSION = '0.111.0-2';
32
32
  /**
33
33
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
34
34
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -26897,7 +26897,6 @@
26897
26897
  doneReading = !!done;
26898
26898
  if (value) {
26899
26899
  const textChunk = decoder.decode(value, { stream: true });
26900
- let sawToolCalls = false;
26901
26900
  let hasNonEmptyText = false;
26902
26901
  const textLines = [];
26903
26902
  const lines = textChunk.split(/\r?\n/);
@@ -26923,7 +26922,6 @@
26923
26922
  rawResponse: {},
26924
26923
  toolCalls: getActiveToolCalls(),
26925
26924
  });
26926
- sawToolCalls = true;
26927
26925
  isToolCallLine = true;
26928
26926
  }
26929
26927
  }
@@ -26933,22 +26931,16 @@
26933
26931
  }
26934
26932
  if (!isToolCallLine) {
26935
26933
  textLines.push(line);
26936
- if (line.length > 0) {
26934
+ if (trimmedLine.length > 0) {
26937
26935
  hasNonEmptyText = true;
26938
26936
  }
26939
26937
  }
26940
26938
  }
26941
- if (sawToolCalls) {
26942
- if (!hasNonEmptyText) {
26943
- continue;
26944
- }
26945
- const textChunkWithoutToolCalls = textLines.join('\n');
26946
- content += textChunkWithoutToolCalls;
26947
- }
26948
- else {
26949
- // console.debug('RemoteAgent chunk:', textChunk);
26950
- content += textChunk;
26939
+ if (!hasNonEmptyText) {
26940
+ continue;
26951
26941
  }
26942
+ const textChunkWithoutToolCalls = textLines.join('\n');
26943
+ content += textChunkWithoutToolCalls;
26952
26944
  if (!hasReceivedModelOutput && content.trim().length > 0) {
26953
26945
  hasReceivedModelOutput = true;
26954
26946
  preparationToolCalls.length = 0;