@promptbook/editable 0.100.0-45 → 0.100.0-47

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 (24) hide show
  1. package/esm/index.es.js +8 -1
  2. package/esm/index.es.js.map +1 -1
  3. package/esm/typings/src/_packages/components.index.d.ts +4 -0
  4. package/esm/typings/src/_packages/core.index.d.ts +2 -0
  5. package/esm/typings/src/_packages/types.index.d.ts +2 -6
  6. package/esm/typings/src/book-2.0/commitments/_misc/AgentModelRequirements.d.ts +1 -1
  7. package/esm/typings/src/book-components/Chat/Chat/Chat.d.ts +4 -10
  8. package/esm/typings/src/book-components/Chat/interfaces/ChatMessage.d.ts +12 -26
  9. package/esm/typings/src/book-components/Chat/interfaces/ChatParticipant.d.ts +30 -0
  10. package/esm/typings/src/book-components/Chat/utils/exportChatHistory.d.ts +2 -4
  11. package/esm/typings/src/book-components/Chat/utils/generatePdfContent.d.ts +2 -4
  12. package/esm/typings/src/book-components/Chat/utils/messagesToHtml.d.ts +2 -4
  13. package/esm/typings/src/book-components/Chat/utils/messagesToMarkdown.d.ts +2 -4
  14. package/esm/typings/src/book-components/Chat/utils/messagesToText.d.ts +2 -4
  15. package/esm/typings/src/config.d.ts +7 -0
  16. package/esm/typings/src/execution/ExecutionTask.d.ts +8 -0
  17. package/esm/typings/src/llm-providers/openai/OpenAiCompatibleExecutionTools.d.ts +8 -0
  18. package/esm/typings/src/playground/permanent/error-handling-playground.d.ts +5 -0
  19. package/esm/typings/src/utils/organization/preserve.d.ts +21 -0
  20. package/esm/typings/src/version.d.ts +1 -1
  21. package/package.json +2 -2
  22. package/umd/index.umd.js +8 -1
  23. package/umd/index.umd.js.map +1 -1
  24. package/esm/typings/src/scripting/javascript/utils/preserve.d.ts +0 -14
@@ -0,0 +1,30 @@
1
+ import type { string_name } from '../../../types/typeAliases';
2
+ import type { string_person_fullname } from '../../../types/typeAliases';
3
+ import type { string_url_image } from '../../../types/typeAliases';
4
+ /**
5
+ * A participant in the chat
6
+ *
7
+ * @public exported from `@promptbook/components`
8
+ */
9
+ export type ChatParticipant = {
10
+ /**
11
+ * Identifies the participant by their name, same as `message.from`
12
+ */
13
+ name: string_name;
14
+ /**
15
+ * Full name of the participant
16
+ */
17
+ fullname: string_person_fullname;
18
+ /**
19
+ * Am I the participant? (i.e. is this the user)
20
+ */
21
+ isMe?: boolean;
22
+ /**
23
+ * Profile picture
24
+ */
25
+ avatarSrc?: string_url_image;
26
+ /**
27
+ * Color associated with the participant
28
+ */
29
+ color: string;
30
+ };
@@ -1,11 +1,9 @@
1
1
  import type { ChatMessage } from '../interfaces/ChatMessage';
2
+ import type { ChatParticipant } from '../interfaces/ChatParticipant';
2
3
  import type { ExportFormat } from './ExportFormat';
3
4
  /**
4
5
  * Exports chat messages in the specified format
5
6
  *
6
7
  * @private utility of `<Chat/>` component
7
8
  */
8
- export declare function exportChatHistory(messages: ChatMessage[], format: ExportFormat, headerMarkdown?: string, participants?: Record<string, {
9
- name: string;
10
- avatarUrl?: string;
11
- }>): Promise<void>;
9
+ export declare function exportChatHistory(messages: ChatMessage[], format: ExportFormat, headerMarkdown?: string, participants?: ReadonlyArray<ChatParticipant>): Promise<void>;
@@ -1,10 +1,8 @@
1
1
  import type { ChatMessage } from '../interfaces/ChatMessage';
2
+ import type { ChatParticipant } from '../interfaces/ChatParticipant';
2
3
  /**
3
4
  * Generates PDF content using HTML and triggers print dialog
4
5
  *
5
6
  * @private utility of `<Chat/>` component
6
7
  */
7
- export declare function generatePdfContent(messages: ChatMessage[], shareUrl: string, qrDataUrl?: string | null, headerMarkdown?: string, participants?: Record<string, {
8
- name: string;
9
- avatarUrl?: string;
10
- }>): void;
8
+ export declare function generatePdfContent(messages: ChatMessage[], shareUrl: string, qrDataUrl?: string | null, headerMarkdown?: string, participants?: ReadonlyArray<ChatParticipant>): void;
@@ -1,10 +1,8 @@
1
1
  import type { ChatMessage } from '../interfaces/ChatMessage';
2
+ import type { ChatParticipant } from '../interfaces/ChatParticipant';
2
3
  /**
3
4
  * Converts chat messages to HTML format
4
5
  *
5
6
  * @private utility of `<Chat/>` component
6
7
  */
7
- export declare function messagesToHtml(messages: ChatMessage[], shareUrl: string, qrDataUrl?: string | null, headerMarkdown?: string, participants?: Record<string, {
8
- name: string;
9
- avatarUrl?: string;
10
- }>): string;
8
+ export declare function messagesToHtml(messages: ChatMessage[], shareUrl: string, qrDataUrl?: string | null, headerMarkdown?: string, participants?: ReadonlyArray<ChatParticipant>): string;
@@ -1,10 +1,8 @@
1
1
  import type { ChatMessage } from '../interfaces/ChatMessage';
2
+ import type { ChatParticipant } from '../interfaces/ChatParticipant';
2
3
  /**
3
4
  * Converts chat messages to Markdown format
4
5
  *
5
6
  * @private utility of `<Chat/>` component
6
7
  */
7
- export declare function messagesToMarkdown(messages: ChatMessage[], shareUrl: string, qrDataUrl?: string | null, headerMarkdown?: string, participants?: Record<string, {
8
- name: string;
9
- avatarUrl?: string;
10
- }>): string;
8
+ export declare function messagesToMarkdown(messages: ChatMessage[], shareUrl: string, qrDataUrl?: string | null, headerMarkdown?: string, participants?: ReadonlyArray<ChatParticipant>): string;
@@ -1,10 +1,8 @@
1
1
  import type { ChatMessage } from '../interfaces/ChatMessage';
2
+ import type { ChatParticipant } from '../interfaces/ChatParticipant';
2
3
  /**
3
4
  * Converts chat messages to plain text format
4
5
  *
5
6
  * @private utility of `<Chat/>` component
6
7
  */
7
- export declare function messagesToText(messages: ChatMessage[], shareUrl: string, headerMarkdown?: string, participants?: Record<string, {
8
- name: string;
9
- avatarUrl?: string;
10
- }>): string;
8
+ export declare function messagesToText(messages: ChatMessage[], shareUrl: string, headerMarkdown?: string, participants?: ReadonlyArray<ChatParticipant>): string;
@@ -301,6 +301,13 @@ export declare const DEFAULT_GET_PIPELINE_COLLECTION_FUNCTION_NAME = "getPipelin
301
301
  * @public exported from `@promptbook/core`
302
302
  */
303
303
  export declare const DEFAULT_MAX_REQUESTS_PER_MINUTE = 60;
304
+ /**
305
+ * API request timeout in milliseconds
306
+ * Can be overridden via API_REQUEST_TIMEOUT environment variable
307
+ *
308
+ * @public exported from `@promptbook/core`
309
+ */
310
+ export declare const API_REQUEST_TIMEOUT: number;
304
311
  /**
305
312
  * URL of the Promptbook logo
306
313
  *
@@ -110,6 +110,14 @@ export type AbstractTask<TTaskResult extends AbstractTaskResult> = {
110
110
  * Gets a promise that resolves with the task result
111
111
  */
112
112
  asPromise(options?: {
113
+ /**
114
+ * Do the task throws on error
115
+ *
116
+ * - If `true` when error occurs the returned promise will rejects
117
+ * - If `false` the promise will resolve with object with all listed errors and warnings and partial result
118
+ *
119
+ * @default true
120
+ */
113
121
  readonly isCrashedOnError?: boolean;
114
122
  }): Promise<TTaskResult>;
115
123
  /**
@@ -82,6 +82,14 @@ export declare abstract class OpenAiCompatibleExecutionTools implements LlmExecu
82
82
  * Default model for completion variant.
83
83
  */
84
84
  protected abstract getDefaultEmbeddingModel(): AvailableModel;
85
+ /**
86
+ * Makes a request with retry logic for network errors like ECONNRESET
87
+ */
88
+ private makeRequestWithRetry;
89
+ /**
90
+ * Determines if an error is retryable (network-related errors)
91
+ */
92
+ private isRetryableNetworkError;
85
93
  }
86
94
  /**
87
95
  * TODO: [🛄] Some way how to re-wrap the errors from `OpenAiCompatibleExecutionTools`
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ts-node
2
+ export {};
3
+ /**
4
+ * Note: [⚫] Code in this file should never be published in any package
5
+ */
@@ -0,0 +1,21 @@
1
+ import type { really_any } from './really_any';
2
+ /**
3
+ * Does nothing, but preserves the function in the bundle
4
+ * Compiler is tricked into thinking the function is used
5
+ *
6
+ * @param value any function to preserve
7
+ * @returns nothing
8
+ * @private within the repository
9
+ */
10
+ export declare function $preserve(...value: Array<really_any>): void;
11
+ /**
12
+ * DO NOT USE THIS FUNCTION
13
+ * Only purpose of this function is to trick the compiler and javascript engine
14
+ * that `_preserved` array can be used in the future and should not be garbage collected
15
+ *
16
+ * @private internal for `preserve`
17
+ */
18
+ export declare function __DO_NOT_USE_getPreserved(): Array<really_any>;
19
+ /**
20
+ * Note: [💞] Ignore a discrepancy between file name and entity name
21
+ */
@@ -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.100.0-44`).
18
+ * It follows semantic versioning (e.g., `0.100.0-46`).
19
19
  *
20
20
  * @generated
21
21
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/editable",
3
- "version": "0.100.0-45",
3
+ "version": "0.100.0-47",
4
4
  "description": "Promptbook: Run AI apps in plain human language across multiple models and platforms",
5
5
  "private": false,
6
6
  "sideEffects": false,
@@ -95,7 +95,7 @@
95
95
  "module": "./esm/index.es.js",
96
96
  "typings": "./esm/typings/src/_packages/editable.index.d.ts",
97
97
  "peerDependencies": {
98
- "@promptbook/core": "0.100.0-45"
98
+ "@promptbook/core": "0.100.0-47"
99
99
  },
100
100
  "dependencies": {
101
101
  "crypto-js": "4.2.0",
package/umd/index.umd.js CHANGED
@@ -23,7 +23,7 @@
23
23
  * @generated
24
24
  * @see https://github.com/webgptorg/promptbook
25
25
  */
26
- const PROMPTBOOK_ENGINE_VERSION = '0.100.0-45';
26
+ const PROMPTBOOK_ENGINE_VERSION = '0.100.0-47';
27
27
  /**
28
28
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
29
29
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -101,6 +101,13 @@
101
101
  newline: '\n',
102
102
  skipEmptyLines: true,
103
103
  });
104
+ /**
105
+ * API request timeout in milliseconds
106
+ * Can be overridden via API_REQUEST_TIMEOUT environment variable
107
+ *
108
+ * @public exported from `@promptbook/core`
109
+ */
110
+ parseInt(process.env.API_REQUEST_TIMEOUT || '90000');
104
111
  /**
105
112
  * Note: [💞] Ignore a discrepancy between file name and entity name
106
113
  * TODO: [🧠][🧜‍♂️] Maybe join remoteServerUrl and path into single value