@promptbook/markitdown 0.100.0-36 → 0.100.0-39
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.
- package/esm/index.es.js +72 -3
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/book-components/BookEditor/BookEditor.d.ts +8 -4
- package/esm/typings/src/book-components/_common/react-utils/classNames.d.ts +7 -0
- package/esm/typings/src/execution/ExecutionTask.d.ts +13 -0
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +72 -3
- package/umd/index.umd.js.map +1 -1
|
@@ -3,20 +3,24 @@ export interface BookEditorProps {
|
|
|
3
3
|
/**
|
|
4
4
|
* Additional CSS classes to apply to the editor container.
|
|
5
5
|
*/
|
|
6
|
-
className?: string;
|
|
6
|
+
readonly className?: string;
|
|
7
7
|
/**
|
|
8
8
|
* CSS className for a font (e.g. from next/font) to style the editor text.
|
|
9
9
|
* If omitted, defaults to system serif fonts.
|
|
10
10
|
*/
|
|
11
|
-
fontClassName?: string;
|
|
11
|
+
readonly fontClassName?: string;
|
|
12
12
|
/**
|
|
13
13
|
* The book which is being edited.
|
|
14
14
|
*/
|
|
15
|
-
value?: string_book;
|
|
15
|
+
readonly value?: string_book;
|
|
16
16
|
/**
|
|
17
17
|
* Callback function to handle changes in the book content.
|
|
18
18
|
*/
|
|
19
|
-
onChange
|
|
19
|
+
onChange?(value: string_book): void;
|
|
20
|
+
/**
|
|
21
|
+
* If true, logs verbose debug info to the console and shows additional visual cues
|
|
22
|
+
*/
|
|
23
|
+
readonly isVerbose?: boolean;
|
|
20
24
|
}
|
|
21
25
|
/**
|
|
22
26
|
* Renders a book editor
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { string_css_class } from '../../../types/typeAliases';
|
|
2
|
+
/**
|
|
3
|
+
* Utility function for joining multiple truthy class names into one string
|
|
4
|
+
*
|
|
5
|
+
* @private within the `@promptbook/components`
|
|
6
|
+
*/
|
|
7
|
+
export declare function classNames(...classes: Array<string_css_class | undefined | false | null>): string_css_class;
|
|
@@ -29,6 +29,19 @@ type CreateTaskOptions<TTaskResult extends AbstractTaskResult> = {
|
|
|
29
29
|
*/
|
|
30
30
|
readonly title?: AbstractTask<TTaskResult>['title'];
|
|
31
31
|
}) => void): Promise<TTaskResult>;
|
|
32
|
+
/**
|
|
33
|
+
* Optional callback to provide custom tldr information
|
|
34
|
+
* @param createdAt When the task was created
|
|
35
|
+
* @param status Current task status
|
|
36
|
+
* @param currentValue Current partial result
|
|
37
|
+
* @param errors Current errors
|
|
38
|
+
* @param warnings Current warnings
|
|
39
|
+
* @returns Custom tldr information
|
|
40
|
+
*/
|
|
41
|
+
tldrProvider?(createdAt: Date, status: task_status, currentValue: PartialDeep<TTaskResult>, errors: Array<Error>, warnings: Array<Error>): {
|
|
42
|
+
readonly percent: number_percent;
|
|
43
|
+
readonly message: string;
|
|
44
|
+
};
|
|
32
45
|
};
|
|
33
46
|
/**
|
|
34
47
|
* Helper to create a new task
|
|
@@ -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-
|
|
18
|
+
* It follows semantic versioning (e.g., `0.100.0-38`).
|
|
19
19
|
*
|
|
20
20
|
* @generated
|
|
21
21
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptbook/markitdown",
|
|
3
|
-
"version": "0.100.0-
|
|
3
|
+
"version": "0.100.0-39",
|
|
4
4
|
"description": "Promptbook: Run AI apps in plain human language across multiple models and platforms",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
"module": "./esm/index.es.js",
|
|
92
92
|
"typings": "./esm/typings/src/_packages/markitdown.index.d.ts",
|
|
93
93
|
"peerDependencies": {
|
|
94
|
-
"@promptbook/core": "0.100.0-
|
|
94
|
+
"@promptbook/core": "0.100.0-39"
|
|
95
95
|
},
|
|
96
96
|
"dependencies": {
|
|
97
97
|
"crypto": "1.0.1",
|
package/umd/index.umd.js
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
* @generated
|
|
26
26
|
* @see https://github.com/webgptorg/promptbook
|
|
27
27
|
*/
|
|
28
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.100.0-
|
|
28
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.100.0-39';
|
|
29
29
|
/**
|
|
30
30
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
31
31
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -2518,7 +2518,7 @@
|
|
|
2518
2518
|
* @private internal helper function
|
|
2519
2519
|
*/
|
|
2520
2520
|
function createTask(options) {
|
|
2521
|
-
const { taskType, taskProcessCallback } = options;
|
|
2521
|
+
const { taskType, taskProcessCallback, tldrProvider } = options;
|
|
2522
2522
|
let { title } = options;
|
|
2523
2523
|
// TODO: [🐙] DRY
|
|
2524
2524
|
const taskId = `${taskType.toLowerCase().substring(0, 4)}-${$randomToken(8 /* <- TODO: To global config + Use Base58 to avoid similar char conflicts */)}`;
|
|
@@ -2593,7 +2593,11 @@
|
|
|
2593
2593
|
},
|
|
2594
2594
|
get tldr() {
|
|
2595
2595
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
2596
|
-
//
|
|
2596
|
+
// Use custom tldr provider if available
|
|
2597
|
+
if (tldrProvider) {
|
|
2598
|
+
return tldrProvider(createdAt, status, currentValue, errors, warnings);
|
|
2599
|
+
}
|
|
2600
|
+
// Fallback to default implementation
|
|
2597
2601
|
const cv = currentValue;
|
|
2598
2602
|
// If explicit percent is provided, use it
|
|
2599
2603
|
let percentRaw = (_f = (_d = (_b = (_a = cv === null || cv === void 0 ? void 0 : cv.tldr) === null || _a === void 0 ? void 0 : _a.percent) !== null && _b !== void 0 ? _b : (_c = cv === null || cv === void 0 ? void 0 : cv.usage) === null || _c === void 0 ? void 0 : _c.percent) !== null && _d !== void 0 ? _d : (_e = cv === null || cv === void 0 ? void 0 : cv.progress) === null || _e === void 0 ? void 0 : _e.percent) !== null && _f !== void 0 ? _f : cv === null || cv === void 0 ? void 0 : cv.percent;
|
|
@@ -6145,6 +6149,71 @@
|
|
|
6145
6149
|
updateOngoingResult(newOngoingResult);
|
|
6146
6150
|
});
|
|
6147
6151
|
},
|
|
6152
|
+
tldrProvider(createdAt, status, currentValue, errors) {
|
|
6153
|
+
var _a;
|
|
6154
|
+
// Better progress estimation based on pipeline structure
|
|
6155
|
+
const cv = currentValue;
|
|
6156
|
+
// Handle finished/error states
|
|
6157
|
+
if (status === 'FINISHED') {
|
|
6158
|
+
return {
|
|
6159
|
+
percent: 1,
|
|
6160
|
+
message: 'Finished',
|
|
6161
|
+
};
|
|
6162
|
+
}
|
|
6163
|
+
if (status === 'ERROR') {
|
|
6164
|
+
const errorMessage = errors.length > 0 ? errors[errors.length - 1].message : 'Error';
|
|
6165
|
+
return {
|
|
6166
|
+
percent: 0,
|
|
6167
|
+
message: errorMessage,
|
|
6168
|
+
};
|
|
6169
|
+
}
|
|
6170
|
+
// Calculate progress based on pipeline tasks
|
|
6171
|
+
const totalTasks = pipeline.tasks.length;
|
|
6172
|
+
let completedTasks = 0;
|
|
6173
|
+
let currentTaskName = '';
|
|
6174
|
+
// Check execution report for completed tasks
|
|
6175
|
+
if ((_a = cv === null || cv === void 0 ? void 0 : cv.executionReport) === null || _a === void 0 ? void 0 : _a.promptExecutions) {
|
|
6176
|
+
const executedTaskTitles = new Set(cv.executionReport.promptExecutions.map((execution) => execution.prompt.title));
|
|
6177
|
+
// Count completed tasks by matching titles
|
|
6178
|
+
const completedTasksByTitle = pipeline.tasks.filter(task => executedTaskTitles.has(task.title));
|
|
6179
|
+
completedTasks = completedTasksByTitle.length;
|
|
6180
|
+
// Find current task being executed (first task not yet completed)
|
|
6181
|
+
const remainingTasks = pipeline.tasks.filter(task => !executedTaskTitles.has(task.title));
|
|
6182
|
+
if (remainingTasks.length > 0) {
|
|
6183
|
+
currentTaskName = remainingTasks[0].name;
|
|
6184
|
+
}
|
|
6185
|
+
}
|
|
6186
|
+
// Calculate progress percentage
|
|
6187
|
+
let percent = totalTasks > 0 ? completedTasks / totalTasks : 0;
|
|
6188
|
+
// Add time-based progress for current task (assuming 5 minutes total)
|
|
6189
|
+
if (completedTasks < totalTasks) {
|
|
6190
|
+
const elapsedMs = new Date().getTime() - createdAt.getTime();
|
|
6191
|
+
const totalMs = 5 * 60 * 1000; // 5 minutes
|
|
6192
|
+
const timeProgress = Math.min(elapsedMs / totalMs, 1);
|
|
6193
|
+
// Add partial progress for current task
|
|
6194
|
+
percent += (1 / totalTasks) * timeProgress;
|
|
6195
|
+
}
|
|
6196
|
+
// Clamp to [0,1]
|
|
6197
|
+
percent = Math.min(Math.max(percent, 0), 1);
|
|
6198
|
+
// Generate message
|
|
6199
|
+
let message = '';
|
|
6200
|
+
if (currentTaskName) {
|
|
6201
|
+
// Find the task to get its title
|
|
6202
|
+
const currentTask = pipeline.tasks.find(task => task.name === currentTaskName);
|
|
6203
|
+
const taskTitle = (currentTask === null || currentTask === void 0 ? void 0 : currentTask.title) || currentTaskName;
|
|
6204
|
+
message = `Working on task ${taskTitle}`;
|
|
6205
|
+
}
|
|
6206
|
+
else if (completedTasks === 0) {
|
|
6207
|
+
message = 'Starting pipeline execution';
|
|
6208
|
+
}
|
|
6209
|
+
else {
|
|
6210
|
+
message = `Processing pipeline (${completedTasks}/${totalTasks} tasks completed)`;
|
|
6211
|
+
}
|
|
6212
|
+
return {
|
|
6213
|
+
percent,
|
|
6214
|
+
message,
|
|
6215
|
+
};
|
|
6216
|
+
},
|
|
6148
6217
|
});
|
|
6149
6218
|
// <- TODO: Make types such as there is no need to do `as` for `createTask`
|
|
6150
6219
|
return pipelineExecutor;
|