@promptbook/remote-server 0.100.0-45 → 0.100.0-46

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.
@@ -11,6 +11,8 @@ import type { BookEditorProps } from '../book-components/BookEditor/BookEditor';
11
11
  import { BookEditor } from '../book-components/BookEditor/BookEditor';
12
12
  import { DEFAULT_BOOK_FONT_CLASS } from '../book-components/BookEditor/config';
13
13
  import { Chat } from '../book-components/Chat/Chat/Chat';
14
+ import type { ChatMessage } from '../book-components/Chat/interfaces/ChatMessage';
15
+ import type { ChatParticipant } from '../book-components/Chat/interfaces/ChatParticipant';
14
16
  export { BOOK_LANGUAGE_VERSION, PROMPTBOOK_ENGINE_VERSION };
15
17
  export type { AvatarChipProps };
16
18
  export { AvatarChip };
@@ -24,3 +26,5 @@ export type { BookEditorProps };
24
26
  export { BookEditor };
25
27
  export { DEFAULT_BOOK_FONT_CLASS };
26
28
  export { Chat };
29
+ export type { ChatMessage };
30
+ export type { ChatParticipant };
@@ -49,6 +49,7 @@ import { DEFAULT_IS_AUTO_INSTALLED } from '../config';
49
49
  import { DEFAULT_TASK_SIMULATED_DURATION_MS } from '../config';
50
50
  import { DEFAULT_GET_PIPELINE_COLLECTION_FUNCTION_NAME } from '../config';
51
51
  import { DEFAULT_MAX_REQUESTS_PER_MINUTE } from '../config';
52
+ import { API_REQUEST_TIMEOUT } from '../config';
52
53
  import { PROMPTBOOK_LOGO_URL } from '../config';
53
54
  import { MODEL_TRUST_LEVELS } from '../constants';
54
55
  import { MODEL_ORDERS } from '../constants';
@@ -212,6 +213,7 @@ export { DEFAULT_IS_AUTO_INSTALLED };
212
213
  export { DEFAULT_TASK_SIMULATED_DURATION_MS };
213
214
  export { DEFAULT_GET_PIPELINE_COLLECTION_FUNCTION_NAME };
214
215
  export { DEFAULT_MAX_REQUESTS_PER_MINUTE };
216
+ export { API_REQUEST_TIMEOUT };
215
217
  export { PROMPTBOOK_LOGO_URL };
216
218
  export { MODEL_TRUST_LEVELS };
217
219
  export { MODEL_ORDERS };
@@ -17,9 +17,7 @@ import type { AvatarProfileProps } from '../book-components/AvatarProfile/Avatar
17
17
  import type { AvatarProfileFromSourceProps } from '../book-components/AvatarProfile/AvatarProfile/AvatarProfileFromSource';
18
18
  import type { BookEditorProps } from '../book-components/BookEditor/BookEditor';
19
19
  import type { ChatMessage } from '../book-components/Chat/interfaces/ChatMessage';
20
- import type { UserChatMessage } from '../book-components/Chat/interfaces/ChatMessage';
21
- import type { PromptbookPersonaChatMessage } from '../book-components/Chat/interfaces/ChatMessage';
22
- import type { CompleteChatMessage } from '../book-components/Chat/interfaces/ChatMessage';
20
+ import type { ChatParticipant } from '../book-components/Chat/interfaces/ChatParticipant';
23
21
  import type { PipelineCollection } from '../collection/PipelineCollection';
24
22
  import type { Command } from '../commands/_common/types/Command';
25
23
  import type { CommandParser } from '../commands/_common/types/CommandParser';
@@ -344,9 +342,7 @@ export type { AvatarProfileProps };
344
342
  export type { AvatarProfileFromSourceProps };
345
343
  export type { BookEditorProps };
346
344
  export type { ChatMessage };
347
- export type { UserChatMessage };
348
- export type { PromptbookPersonaChatMessage };
349
- export type { CompleteChatMessage };
345
+ export type { ChatParticipant };
350
346
  export type { PipelineCollection };
351
347
  export type { Command };
352
348
  export type { CommandParser };
@@ -1,4 +1,4 @@
1
- import { TODO_any } from "../../../_packages/types.index";
1
+ import type { TODO_any } from '../../../utils/organization/TODO_any';
2
2
  /**
3
3
  * Model requirements for an agent
4
4
  *
@@ -1,6 +1,7 @@
1
1
  import type { CSSProperties, ReactNode } from 'react';
2
2
  import type { Promisable } from 'type-fest';
3
3
  import type { ChatMessage } from '../interfaces/ChatMessage';
4
+ import type { ChatParticipant } from '../interfaces/ChatParticipant';
4
5
  /**
5
6
  * @deprecated use `isComplete` instead
6
7
  * @private util of `<Chat />`
@@ -11,11 +12,11 @@ interface ChatProps {
11
12
  * Optional callback to create a new agent from the template.
12
13
  * If provided, renders the [Use this template] button.
13
14
  */
14
- onUseTemplate?: () => void;
15
+ onUseTemplate?(): void;
15
16
  /**
16
17
  * Messages to render - they are rendered as they are
17
18
  */
18
- readonly messages: Array<ChatMessage>;
19
+ readonly messages: ReadonlyArray<ChatMessage>;
19
20
  /**
20
21
  * Called every time the user types or dictated a message
21
22
  */
@@ -38,10 +39,6 @@ interface ChatProps {
38
39
  * The language code to use for voice recognition
39
40
  */
40
41
  readonly voiceLanguage?: string;
41
- /**
42
- * Avatars for each user
43
- */
44
- readonly avatars?: Partial<Record<ChatMessage['from'], string>>;
45
42
  /**
46
43
  * Optional placeholder message for the textarea
47
44
  *
@@ -105,10 +102,7 @@ interface ChatProps {
105
102
  * Optional mapping of participant IDs (message.from) to display metadata for exports.
106
103
  * Keys should match ChatMessage.from values (e.g., 'USER', 'AGENT_{id}', etc.)
107
104
  */
108
- readonly participants?: Record<string, {
109
- name: string;
110
- avatarUrl?: string;
111
- }>;
105
+ readonly participants?: ReadonlyArray<ChatParticipant>;
112
106
  }
113
107
  /**
114
108
  * Renders a chat with messages and input for new messages
@@ -1,30 +1,16 @@
1
- export type ChatMessage = UserChatMessage | PromptbookPersonaChatMessage;
2
- export interface UserChatMessage {
3
- id: string;
4
- date: Date;
5
- from: 'USER';
6
- content: string;
7
- isComplete: boolean;
8
- expectedAnswer?: string;
9
- isVoiceCall?: boolean;
10
- }
11
- export interface PromptbookPersonaChatMessage {
1
+ import type { string_markdown } from '../../../types/typeAliases';
2
+ import type { string_name } from '../../../types/typeAliases';
3
+ /**
4
+ * A message in the chat
5
+ *
6
+ * @public exported from `@promptbook/components`
7
+ */
8
+ export type ChatMessage = {
12
9
  id: string;
13
10
  date: Date;
14
- from: 'PROMPTBOOK_PERSONA';
15
- avatar?: string | {
16
- src: string;
17
- width?: number;
18
- height?: number;
19
- };
20
- content: string;
21
- isComplete: boolean;
11
+ from: string_name;
12
+ content: string_markdown;
13
+ isComplete?: boolean;
22
14
  expectedAnswer?: string;
23
15
  isVoiceCall?: boolean;
24
- }
25
- export interface CompleteChatMessage {
26
- isComplete: true;
27
- }
28
- /**
29
- * TODO: [🧠] ACRY Rename PROMPTBOOK_PERSONA + USER, Teacher, teacher to sth else
30
- */
16
+ };
@@ -0,0 +1,12 @@
1
+ import type { string_name } from '../../../types/typeAliases';
2
+ import type { string_url_image } from '../../../types/typeAliases';
3
+ /**
4
+ * A participant in the chat
5
+ *
6
+ * @public exported from `@promptbook/components`
7
+ */
8
+ export type ChatParticipant = {
9
+ name: string_name;
10
+ avatarUrl?: string_url_image;
11
+ color: string;
12
+ };
@@ -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-45`).
19
19
  *
20
20
  * @generated
21
21
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/remote-server",
3
- "version": "0.100.0-45",
3
+ "version": "0.100.0-46",
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/remote-server.index.d.ts",
97
97
  "peerDependencies": {
98
- "@promptbook/core": "0.100.0-45"
98
+ "@promptbook/core": "0.100.0-46"
99
99
  },
100
100
  "dependencies": {
101
101
  "colors": "1.4.0",
@@ -104,7 +104,6 @@
104
104
  "express": "4.21.2",
105
105
  "express-openapi-validator": "^5.4.9",
106
106
  "papaparse": "5.4.1",
107
- "prettier": "2.8.1",
108
107
  "rxjs": "7.8.1",
109
108
  "socket.io": "4.8.1",
110
109
  "spacetrim": "0.11.59",
package/umd/index.umd.js CHANGED
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('colors'), require('express'), require('express-openapi-validator'), require('http'), require('socket.io'), require('spacetrim'), require('swagger-ui-express'), require('waitasecond'), require('crypto'), require('child_process'), require('fs/promises'), require('path'), require('rxjs'), require('prettier'), require('prettier/parser-html'), require('crypto-js/enc-hex'), require('crypto-js/sha256'), require('crypto-js'), require('mime-types'), require('papaparse')) :
3
- typeof define === 'function' && define.amd ? define(['exports', 'colors', 'express', 'express-openapi-validator', 'http', 'socket.io', 'spacetrim', 'swagger-ui-express', 'waitasecond', 'crypto', 'child_process', 'fs/promises', 'path', 'rxjs', 'prettier', 'prettier/parser-html', 'crypto-js/enc-hex', 'crypto-js/sha256', 'crypto-js', 'mime-types', 'papaparse'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-remote-server"] = {}, global.colors, global.express, global.OpenApiValidator, global.http, global.socket_io, global.spaceTrim, global.swaggerUi, global.waitasecond, global.crypto, global.child_process, global.promises, global.path, global.rxjs, global.prettier, global.parserHtml, global.hexEncoder, global.sha256, global.cryptoJs, global.mimeTypes, global.papaparse));
5
- })(this, (function (exports, colors, express, OpenApiValidator, http, socket_io, spaceTrim, swaggerUi, waitasecond, crypto, child_process, promises, path, rxjs, prettier, parserHtml, hexEncoder, sha256, cryptoJs, mimeTypes, papaparse) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('colors'), require('express'), require('express-openapi-validator'), require('http'), require('socket.io'), require('spacetrim'), require('swagger-ui-express'), require('waitasecond'), require('crypto'), require('child_process'), require('fs/promises'), require('path'), require('rxjs'), require('prettier/parser-html'), require('prettier/parser-markdown'), require('prettier/standalone'), require('crypto-js/enc-hex'), require('crypto-js/sha256'), require('crypto-js'), require('mime-types'), require('papaparse')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'colors', 'express', 'express-openapi-validator', 'http', 'socket.io', 'spacetrim', 'swagger-ui-express', 'waitasecond', 'crypto', 'child_process', 'fs/promises', 'path', 'rxjs', 'prettier/parser-html', 'prettier/parser-markdown', 'prettier/standalone', 'crypto-js/enc-hex', 'crypto-js/sha256', 'crypto-js', 'mime-types', 'papaparse'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-remote-server"] = {}, global.colors, global.express, global.OpenApiValidator, global.http, global.socket_io, global.spaceTrim, global.swaggerUi, global.waitasecond, global.crypto, global.child_process, global.promises, global.path, global.rxjs, global.parserHtml, global.parserMarkdown, global.standalone, global.hexEncoder, global.sha256, global.cryptoJs, global.mimeTypes, global.papaparse));
5
+ })(this, (function (exports, colors, express, OpenApiValidator, http, socket_io, spaceTrim, swaggerUi, waitasecond, crypto, child_process, promises, path, rxjs, parserHtml, parserMarkdown, standalone, hexEncoder, sha256, cryptoJs, mimeTypes, papaparse) { 'use strict';
6
6
 
7
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
8
 
@@ -31,6 +31,7 @@
31
31
  var spaceTrim__default = /*#__PURE__*/_interopDefaultLegacy(spaceTrim);
32
32
  var swaggerUi__default = /*#__PURE__*/_interopDefaultLegacy(swaggerUi);
33
33
  var parserHtml__default = /*#__PURE__*/_interopDefaultLegacy(parserHtml);
34
+ var parserMarkdown__default = /*#__PURE__*/_interopDefaultLegacy(parserMarkdown);
34
35
  var hexEncoder__default = /*#__PURE__*/_interopDefaultLegacy(hexEncoder);
35
36
  var sha256__default = /*#__PURE__*/_interopDefaultLegacy(sha256);
36
37
 
@@ -48,7 +49,7 @@
48
49
  * @generated
49
50
  * @see https://github.com/webgptorg/promptbook
50
51
  */
51
- const PROMPTBOOK_ENGINE_VERSION = '0.100.0-45';
52
+ const PROMPTBOOK_ENGINE_VERSION = '0.100.0-46';
52
53
  /**
53
54
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
54
55
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -237,6 +238,13 @@
237
238
  * @public exported from `@promptbook/core`
238
239
  */
239
240
  const DEFAULT_TASK_SIMULATED_DURATION_MS = 5 * 60 * 1000; // 5 minutes
241
+ /**
242
+ * API request timeout in milliseconds
243
+ * Can be overridden via API_REQUEST_TIMEOUT environment variable
244
+ *
245
+ * @public exported from `@promptbook/core`
246
+ */
247
+ parseInt(process.env.API_REQUEST_TIMEOUT || '90000');
240
248
  /**
241
249
  * Indicates whether pipeline logic validation is enabled. When true, the pipeline logic is checked for consistency.
242
250
  *
@@ -2373,9 +2381,9 @@
2373
2381
  */
2374
2382
  function prettifyMarkdown(content) {
2375
2383
  try {
2376
- return prettier.format(content, {
2384
+ return standalone.format(content, {
2377
2385
  parser: 'markdown',
2378
- plugins: [parserHtml__default["default"]],
2386
+ plugins: [parserMarkdown__default["default"], parserHtml__default["default"]],
2379
2387
  // TODO: DRY - make some import or auto-copy of .prettierrc
2380
2388
  endOfLine: 'lf',
2381
2389
  tabWidth: 4,
@@ -3117,7 +3125,7 @@
3117
3125
  const result = await preparePersonaExecutor({
3118
3126
  availableModels /* <- Note: Passing as JSON */,
3119
3127
  personaDescription,
3120
- }).asPromise();
3128
+ }).asPromise({ isCrashedOnError: true });
3121
3129
  const { outputParameters } = result;
3122
3130
  const { modelsRequirements: modelsRequirementsJson } = outputParameters;
3123
3131
  let modelsRequirementsUnchecked = jsonParse(modelsRequirementsJson);
@@ -4268,7 +4276,7 @@
4268
4276
  });
4269
4277
  const result = await prepareTitleExecutor({
4270
4278
  book: sources.map(({ content }) => content).join('\n\n'),
4271
- }).asPromise();
4279
+ }).asPromise({ isCrashedOnError: true });
4272
4280
  const { outputParameters } = result;
4273
4281
  const { title: titleRaw } = outputParameters;
4274
4282
  if (isVerbose) {
@@ -6500,64 +6508,74 @@
6500
6508
  });
6501
6509
  });
6502
6510
  };
6503
- const pipelineExecutor = (inputParameters) => createTask({
6504
- taskType: 'EXECUTION',
6505
- title: pipeline.title,
6506
- taskProcessCallback(updateOngoingResult, updateTldr) {
6507
- return pipelineExecutorWithCallback(inputParameters, async (newOngoingResult) => {
6508
- var _a;
6509
- updateOngoingResult(newOngoingResult);
6510
- // Calculate and update tldr based on pipeline progress
6511
- const cv = newOngoingResult;
6512
- // Calculate progress based on pipeline tasks
6513
- const totalTasks = pipeline.tasks.length;
6514
- let completedTasks = 0;
6515
- let currentTaskName = '';
6516
- // Check execution report for completed tasks
6517
- if ((_a = cv === null || cv === void 0 ? void 0 : cv.executionReport) === null || _a === void 0 ? void 0 : _a.promptExecutions) {
6518
- const executedTaskTitles = new Set(cv.executionReport.promptExecutions.map((execution) => execution.prompt.title));
6519
- // Count completed tasks by matching titles
6520
- const completedTasksByTitle = pipeline.tasks.filter((task) => executedTaskTitles.has(task.title));
6521
- completedTasks = completedTasksByTitle.length;
6522
- // Find current task being executed (first task not yet completed)
6523
- const remainingTasks = pipeline.tasks.filter((task) => !executedTaskTitles.has(task.title));
6524
- if (remainingTasks.length > 0) {
6525
- currentTaskName = remainingTasks[0].name;
6511
+ const pipelineExecutor = (inputParameters) => {
6512
+ const startTime = new Date().getTime();
6513
+ return createTask({
6514
+ taskType: 'EXECUTION',
6515
+ title: pipeline.title,
6516
+ taskProcessCallback(updateOngoingResult, updateTldr) {
6517
+ return pipelineExecutorWithCallback(inputParameters, async (newOngoingResult) => {
6518
+ var _a, _b;
6519
+ updateOngoingResult(newOngoingResult);
6520
+ // Calculate and update tldr based on pipeline progress
6521
+ const cv = newOngoingResult;
6522
+ // Calculate progress based on parameters resolved vs total parameters
6523
+ const totalParameters = pipeline.parameters.filter(p => !p.isInput).length;
6524
+ let resolvedParameters = 0;
6525
+ let currentTaskTitle = '';
6526
+ // Get the resolved parameters from output parameters
6527
+ if (cv === null || cv === void 0 ? void 0 : cv.outputParameters) {
6528
+ // Count how many output parameters have non-empty values
6529
+ resolvedParameters = Object.values(cv.outputParameters).filter(value => value !== undefined && value !== null && String(value).trim() !== '').length;
6526
6530
  }
6527
- }
6528
- // Calculate progress percentage
6529
- let percent = totalTasks > 0 ? completedTasks / totalTasks : 0;
6530
- // Add time-based progress for current task (assuming 5 minutes total)
6531
- if (completedTasks < totalTasks) {
6532
- const elapsedMs = new Date().getTime() - new Date().getTime(); // Will be overridden by actual elapsed time in task
6533
- const totalMs = 5 * 60 * 1000; // 5 minutes
6534
- const timeProgress = Math.min(elapsedMs / totalMs, 1);
6535
- // Add partial progress for current task
6536
- percent += (1 / totalTasks) * timeProgress;
6537
- }
6538
- // Clamp to [0,1]
6539
- percent = Math.min(Math.max(percent, 0), 1);
6540
- // Generate message
6541
- let message = '';
6542
- if (currentTaskName) {
6543
- // Find the task to get its title
6544
- const currentTask = pipeline.tasks.find((task) => task.name === currentTaskName);
6545
- const taskTitle = (currentTask === null || currentTask === void 0 ? void 0 : currentTask.title) || currentTaskName;
6546
- message = `Working on task ${taskTitle}`;
6547
- }
6548
- else if (completedTasks === 0) {
6549
- message = 'Starting pipeline execution';
6550
- }
6551
- else {
6552
- message = `Processing pipeline (${completedTasks}/${totalTasks} tasks completed)`;
6553
- }
6554
- updateTldr({
6555
- percent: percent,
6556
- message,
6531
+ // Try to determine current task from execution report
6532
+ if (((_a = cv === null || cv === void 0 ? void 0 : cv.executionReport) === null || _a === void 0 ? void 0 : _a.promptExecutions) && cv.executionReport.promptExecutions.length > 0) {
6533
+ const lastExecution = cv.executionReport.promptExecutions[cv.executionReport.promptExecutions.length - 1];
6534
+ if ((_b = lastExecution === null || lastExecution === void 0 ? void 0 : lastExecution.prompt) === null || _b === void 0 ? void 0 : _b.title) {
6535
+ currentTaskTitle = lastExecution.prompt.title;
6536
+ }
6537
+ }
6538
+ // Calculate base progress percentage
6539
+ let percent = totalParameters > 0 ? resolvedParameters / totalParameters : 0;
6540
+ // Add time-based progress for current task if we haven't completed all parameters
6541
+ if (resolvedParameters < totalParameters) {
6542
+ const elapsedMs = new Date().getTime() - startTime;
6543
+ const estimatedTotalMs = totalParameters * 30 * 1000; // Estimate 30 seconds per parameter
6544
+ const timeProgress = Math.min(elapsedMs / estimatedTotalMs, 0.9); // Cap at 90% for time-based progress
6545
+ // If we have time progress but no parameter progress, show time progress
6546
+ if (percent === 0 && timeProgress > 0) {
6547
+ percent = Math.min(timeProgress, 0.1); // Show some progress but not more than 10%
6548
+ }
6549
+ else if (percent < 1) {
6550
+ // Add partial progress for current task
6551
+ const taskProgress = totalParameters > 0 ? (1 / totalParameters) * 0.5 : 0; // 50% of task progress
6552
+ percent = Math.min(percent + taskProgress, 0.95); // Cap at 95% until fully complete
6553
+ }
6554
+ }
6555
+ // Clamp to [0,1]
6556
+ percent = Math.min(Math.max(percent, 0), 1);
6557
+ // Generate message
6558
+ let message = '';
6559
+ if (currentTaskTitle) {
6560
+ message = `Executing: ${currentTaskTitle}`;
6561
+ }
6562
+ else if (resolvedParameters === 0) {
6563
+ message = 'Starting pipeline execution';
6564
+ }
6565
+ else if (resolvedParameters < totalParameters) {
6566
+ message = `Processing pipeline (${resolvedParameters}/${totalParameters} parameters resolved)`;
6567
+ }
6568
+ else {
6569
+ message = 'Completing pipeline execution';
6570
+ }
6571
+ updateTldr({
6572
+ percent: percent,
6573
+ message,
6574
+ });
6557
6575
  });
6558
- });
6559
- },
6560
- });
6576
+ },
6577
+ });
6578
+ };
6561
6579
  // <- TODO: Make types such as there is no need to do `as` for `createTask`
6562
6580
  return pipelineExecutor;
6563
6581
  }
@@ -7164,31 +7182,23 @@
7164
7182
  return content;
7165
7183
  }
7166
7184
 
7185
+ /**
7186
+ * @private internal for `preserve`
7187
+ */
7188
+ const _preserved = [];
7167
7189
  /**
7168
7190
  * Does nothing, but preserves the function in the bundle
7169
7191
  * Compiler is tricked into thinking the function is used
7170
7192
  *
7171
7193
  * @param value any function to preserve
7172
7194
  * @returns nothing
7173
- * @private internal function of `JavascriptExecutionTools` and `JavascriptEvalExecutionTools`
7174
- */
7175
- function preserve(func) {
7176
- // Note: NOT calling the function
7177
- (async () => {
7178
- // TODO: [💩] Change to `await forEver` or `forTime(Infinity)`
7179
- await waitasecond.forTime(100000000);
7180
- // [1]
7181
- try {
7182
- await func();
7183
- }
7184
- finally {
7185
- // do nothing
7186
- }
7187
- })();
7195
+ * @private within the repository
7196
+ */
7197
+ function $preserve(...value) {
7198
+ _preserved.push(...value);
7188
7199
  }
7189
7200
  /**
7190
- * TODO: Probably remove in favour of `keepImported`
7191
- * TODO: [1] This maybe does memory leak
7201
+ * Note: [💞] Ignore a discrepancy between file name and entity name
7192
7202
  */
7193
7203
 
7194
7204
  // Note: [💎]
@@ -7216,25 +7226,25 @@
7216
7226
  // Note: [💎]
7217
7227
  // Note: Using direct eval, following variables are in same scope as eval call so they are accessible from inside the evaluated script:
7218
7228
  const spaceTrim = (_) => spaceTrim__default["default"](_);
7219
- preserve(spaceTrim);
7229
+ $preserve(spaceTrim);
7220
7230
  const removeQuotes$1 = removeQuotes;
7221
- preserve(removeQuotes$1);
7231
+ $preserve(removeQuotes$1);
7222
7232
  const unwrapResult$1 = unwrapResult;
7223
- preserve(unwrapResult$1);
7233
+ $preserve(unwrapResult$1);
7224
7234
  const trimEndOfCodeBlock$1 = trimEndOfCodeBlock;
7225
- preserve(trimEndOfCodeBlock$1);
7235
+ $preserve(trimEndOfCodeBlock$1);
7226
7236
  const trimCodeBlock$1 = trimCodeBlock;
7227
- preserve(trimCodeBlock$1);
7237
+ $preserve(trimCodeBlock$1);
7228
7238
  // TODO: DRY [🍯]
7229
7239
  const trim = (str) => str.trim();
7230
- preserve(trim);
7240
+ $preserve(trim);
7231
7241
  // TODO: DRY [🍯]
7232
7242
  const reverse = (str) => str.split('').reverse().join('');
7233
- preserve(reverse);
7243
+ $preserve(reverse);
7234
7244
  const removeEmojis$1 = removeEmojis;
7235
- preserve(removeEmojis$1);
7245
+ $preserve(removeEmojis$1);
7236
7246
  const prettifyMarkdown$1 = prettifyMarkdown;
7237
- preserve(prettifyMarkdown$1);
7247
+ $preserve(prettifyMarkdown$1);
7238
7248
  //-------[n12:]---
7239
7249
  const capitalize$1 = capitalize;
7240
7250
  const decapitalize$1 = decapitalize;
@@ -7250,18 +7260,18 @@
7250
7260
  // TODO: DRY [🍯]
7251
7261
  Array.from(parseKeywordsFromString(input)).join(', '); /* <- TODO: [🧠] What is the best format comma list, bullet list,...? */
7252
7262
  const normalizeTo_SCREAMING_CASE$1 = normalizeTo_SCREAMING_CASE;
7253
- preserve(capitalize$1);
7254
- preserve(decapitalize$1);
7255
- preserve(nameToUriPart$1);
7256
- preserve(nameToUriParts$1);
7257
- preserve(removeDiacritics$1);
7258
- preserve(normalizeWhitespaces$1);
7259
- preserve(normalizeToKebabCase$1);
7260
- preserve(normalizeTo_camelCase$1);
7261
- preserve(normalizeTo_snake_case$1);
7262
- preserve(normalizeTo_PascalCase$1);
7263
- preserve(parseKeywords);
7264
- preserve(normalizeTo_SCREAMING_CASE$1);
7263
+ $preserve(capitalize$1);
7264
+ $preserve(decapitalize$1);
7265
+ $preserve(nameToUriPart$1);
7266
+ $preserve(nameToUriParts$1);
7267
+ $preserve(removeDiacritics$1);
7268
+ $preserve(normalizeWhitespaces$1);
7269
+ $preserve(normalizeToKebabCase$1);
7270
+ $preserve(normalizeTo_camelCase$1);
7271
+ $preserve(normalizeTo_snake_case$1);
7272
+ $preserve(normalizeTo_PascalCase$1);
7273
+ $preserve(parseKeywords);
7274
+ $preserve(normalizeTo_SCREAMING_CASE$1);
7265
7275
  //-------[/n12]---
7266
7276
  if (!script.includes('return')) {
7267
7277
  script = `return ${script}`;