@promptbook/wizard 0.100.0-33 → 0.100.0-34
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
CHANGED
@@ -38,7 +38,7 @@ const BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
38
38
|
* @generated
|
39
39
|
* @see https://github.com/webgptorg/promptbook
|
40
40
|
*/
|
41
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.100.0-
|
41
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.100.0-34';
|
42
42
|
/**
|
43
43
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
44
44
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
@@ -7238,6 +7238,55 @@ function createTask(options) {
|
|
7238
7238
|
return status;
|
7239
7239
|
// <- Note: [1] --||--
|
7240
7240
|
},
|
7241
|
+
get tldr() {
|
7242
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
7243
|
+
// Derive a short progress summary from currentValue, status and any errors/warnings.
|
7244
|
+
const cv = currentValue;
|
7245
|
+
// Try several common places where a percent might be stored on the partial result
|
7246
|
+
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;
|
7247
|
+
// If we didn't find a numeric percent, infer from status
|
7248
|
+
if (typeof percentRaw !== 'number') {
|
7249
|
+
if (status === 'FINISHED') {
|
7250
|
+
percentRaw = 1;
|
7251
|
+
}
|
7252
|
+
else if (status === 'ERROR') {
|
7253
|
+
percentRaw = 0;
|
7254
|
+
}
|
7255
|
+
else {
|
7256
|
+
percentRaw = 0;
|
7257
|
+
}
|
7258
|
+
}
|
7259
|
+
// Clamp to [0,1]
|
7260
|
+
let percent = Number(percentRaw) || 0;
|
7261
|
+
if (percent < 0)
|
7262
|
+
percent = 0;
|
7263
|
+
if (percent > 1)
|
7264
|
+
percent = 1;
|
7265
|
+
// Build a short message: prefer explicit tldr.message, then common summary/message fields, then errors/warnings, then status
|
7266
|
+
const messageFromResult = (_k = (_j = (_h = (_g = cv === null || cv === void 0 ? void 0 : cv.tldr) === null || _g === void 0 ? void 0 : _g.message) !== null && _h !== void 0 ? _h : cv === null || cv === void 0 ? void 0 : cv.message) !== null && _j !== void 0 ? _j : cv === null || cv === void 0 ? void 0 : cv.summary) !== null && _k !== void 0 ? _k : cv === null || cv === void 0 ? void 0 : cv.statusMessage;
|
7267
|
+
let message = messageFromResult;
|
7268
|
+
if (!message) {
|
7269
|
+
if (errors.length) {
|
7270
|
+
message = errors[errors.length - 1].message || 'Error';
|
7271
|
+
}
|
7272
|
+
else if (warnings.length) {
|
7273
|
+
message = warnings[warnings.length - 1].message || 'Warning';
|
7274
|
+
}
|
7275
|
+
else if (status === 'FINISHED') {
|
7276
|
+
message = 'Finished';
|
7277
|
+
}
|
7278
|
+
else if (status === 'ERROR') {
|
7279
|
+
message = 'Error';
|
7280
|
+
}
|
7281
|
+
else {
|
7282
|
+
message = 'Running';
|
7283
|
+
}
|
7284
|
+
}
|
7285
|
+
return {
|
7286
|
+
percent: percent,
|
7287
|
+
message,
|
7288
|
+
};
|
7289
|
+
},
|
7241
7290
|
get createdAt() {
|
7242
7291
|
return createdAt;
|
7243
7292
|
// <- Note: [1] --||--
|