@promptbook/node 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/node",
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,
@@ -96,7 +96,7 @@
96
96
  "module": "./esm/index.es.js",
97
97
  "typings": "./esm/typings/src/_packages/node.index.d.ts",
98
98
  "peerDependencies": {
99
- "@promptbook/core": "0.111.0-1"
99
+ "@promptbook/core": "0.111.0-2"
100
100
  },
101
101
  "dependencies": {
102
102
  "@mozilla/readability": "0.6.0",
package/umd/index.umd.js CHANGED
@@ -48,7 +48,7 @@
48
48
  * @generated
49
49
  * @see https://github.com/webgptorg/promptbook
50
50
  */
51
- const PROMPTBOOK_ENGINE_VERSION = '0.111.0-1';
51
+ const PROMPTBOOK_ENGINE_VERSION = '0.111.0-2';
52
52
  /**
53
53
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
54
54
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -27105,7 +27105,6 @@
27105
27105
  doneReading = !!done;
27106
27106
  if (value) {
27107
27107
  const textChunk = decoder.decode(value, { stream: true });
27108
- let sawToolCalls = false;
27109
27108
  let hasNonEmptyText = false;
27110
27109
  const textLines = [];
27111
27110
  const lines = textChunk.split(/\r?\n/);
@@ -27131,7 +27130,6 @@
27131
27130
  rawResponse: {},
27132
27131
  toolCalls: getActiveToolCalls(),
27133
27132
  });
27134
- sawToolCalls = true;
27135
27133
  isToolCallLine = true;
27136
27134
  }
27137
27135
  }
@@ -27141,22 +27139,16 @@
27141
27139
  }
27142
27140
  if (!isToolCallLine) {
27143
27141
  textLines.push(line);
27144
- if (line.length > 0) {
27142
+ if (trimmedLine.length > 0) {
27145
27143
  hasNonEmptyText = true;
27146
27144
  }
27147
27145
  }
27148
27146
  }
27149
- if (sawToolCalls) {
27150
- if (!hasNonEmptyText) {
27151
- continue;
27152
- }
27153
- const textChunkWithoutToolCalls = textLines.join('\n');
27154
- content += textChunkWithoutToolCalls;
27155
- }
27156
- else {
27157
- // console.debug('RemoteAgent chunk:', textChunk);
27158
- content += textChunk;
27147
+ if (!hasNonEmptyText) {
27148
+ continue;
27159
27149
  }
27150
+ const textChunkWithoutToolCalls = textLines.join('\n');
27151
+ content += textChunkWithoutToolCalls;
27160
27152
  if (!hasReceivedModelOutput && content.trim().length > 0) {
27161
27153
  hasReceivedModelOutput = true;
27162
27154
  preparationToolCalls.length = 0;