@promptbook/cli 0.74.0-4 → 0.74.0-5
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 +44 -24
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/cli/test/ptbk.d.ts +1 -1
- package/package.json +2 -1
- package/umd/index.umd.js +44 -24
- package/umd/index.umd.js.map +1 -1
package/esm/index.es.js
CHANGED
|
@@ -36,7 +36,7 @@ var BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
|
36
36
|
*
|
|
37
37
|
* @see https://github.com/webgptorg/promptbook
|
|
38
38
|
*/
|
|
39
|
-
var PROMPTBOOK_ENGINE_VERSION = '0.74.0-
|
|
39
|
+
var PROMPTBOOK_ENGINE_VERSION = '0.74.0-4';
|
|
40
40
|
/**
|
|
41
41
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
42
42
|
*/
|
|
@@ -1710,7 +1710,7 @@ function isValidPipelineUrl(url) {
|
|
|
1710
1710
|
if (!url.startsWith('https://')) {
|
|
1711
1711
|
return false;
|
|
1712
1712
|
}
|
|
1713
|
-
if (!url.endsWith('.ptbk.md')) {
|
|
1713
|
+
if (!(url.endsWith('.book.md') || url.endsWith('.book') || url.endsWith('.ptbk.md') || url.endsWith('.ptbk'))) {
|
|
1714
1714
|
return false;
|
|
1715
1715
|
}
|
|
1716
1716
|
if (url.includes('#')) {
|
|
@@ -10638,10 +10638,10 @@ function initializeRunCommand(program) {
|
|
|
10638
10638
|
runCommand.action(function (path, _a) {
|
|
10639
10639
|
var isCacheReloaded = _a.reload, isVerbose = _a.verbose;
|
|
10640
10640
|
return __awaiter(_this, void 0, void 0, function () {
|
|
10641
|
-
var options, fs, llm, executables, tools, pipelineString, pipeline, questions, response, inputParameters, pipelineExecutor, result, isSuccessful, errors, outputParameters, executionReport, _b, _c, key, value, separator;
|
|
10642
|
-
var
|
|
10643
|
-
return __generator(this, function (
|
|
10644
|
-
switch (
|
|
10641
|
+
var options, fs, llm, executables, tools, pipelineString, pipeline, questions, response, inputParameters, pipelineExecutor, result, isSuccessful, errors, outputParameters, executionReport, _b, _c, error, _d, _e, key, value, separator;
|
|
10642
|
+
var _f, e_1, _g, e_2, _h;
|
|
10643
|
+
return __generator(this, function (_j) {
|
|
10644
|
+
switch (_j.label) {
|
|
10645
10645
|
case 0:
|
|
10646
10646
|
options = {
|
|
10647
10647
|
isVerbose: isVerbose,
|
|
@@ -10663,30 +10663,30 @@ function initializeRunCommand(program) {
|
|
|
10663
10663
|
}
|
|
10664
10664
|
return [4 /*yield*/, $provideExecutablesForNode(options)];
|
|
10665
10665
|
case 1:
|
|
10666
|
-
executables =
|
|
10667
|
-
|
|
10666
|
+
executables = _j.sent();
|
|
10667
|
+
_f = {
|
|
10668
10668
|
llm: llm,
|
|
10669
10669
|
fs: fs
|
|
10670
10670
|
};
|
|
10671
10671
|
return [4 /*yield*/, $provideScrapersForNode({ fs: fs, llm: llm, executables: executables }, options)];
|
|
10672
10672
|
case 2:
|
|
10673
|
-
tools = (
|
|
10674
|
-
|
|
10673
|
+
tools = (_f.scrapers = _j.sent(),
|
|
10674
|
+
_f.script = [
|
|
10675
10675
|
/*new JavascriptExecutionTools(options)*/
|
|
10676
10676
|
],
|
|
10677
|
-
|
|
10677
|
+
_f);
|
|
10678
10678
|
return [4 /*yield*/, isFileExisting(path, fs)];
|
|
10679
10679
|
case 3:
|
|
10680
|
-
if (!(
|
|
10680
|
+
if (!(_j.sent())) {
|
|
10681
10681
|
console.error(colors.red("File \"".concat(path, "\" does not exist")));
|
|
10682
10682
|
return [2 /*return*/, process.exit(1)];
|
|
10683
10683
|
}
|
|
10684
10684
|
return [4 /*yield*/, fs.readFile(path, 'utf-8')];
|
|
10685
10685
|
case 4:
|
|
10686
|
-
pipelineString = (
|
|
10686
|
+
pipelineString = (_j.sent());
|
|
10687
10687
|
return [4 /*yield*/, pipelineStringToJson(pipelineString, tools)];
|
|
10688
10688
|
case 5:
|
|
10689
|
-
pipeline =
|
|
10689
|
+
pipeline = _j.sent();
|
|
10690
10690
|
validatePipeline(pipeline);
|
|
10691
10691
|
questions = pipeline.parameters
|
|
10692
10692
|
.filter(function (_a) {
|
|
@@ -10704,14 +10704,21 @@ function initializeRunCommand(program) {
|
|
|
10704
10704
|
});
|
|
10705
10705
|
return [4 /*yield*/, prompts(questions)];
|
|
10706
10706
|
case 6:
|
|
10707
|
-
response =
|
|
10707
|
+
response = _j.sent();
|
|
10708
10708
|
inputParameters = response;
|
|
10709
10709
|
// console.log(response);
|
|
10710
10710
|
return [4 /*yield*/, forTime(100)];
|
|
10711
10711
|
case 7:
|
|
10712
10712
|
// console.log(response);
|
|
10713
|
-
|
|
10714
|
-
pipelineExecutor = createPipelineExecutor({
|
|
10713
|
+
_j.sent();
|
|
10714
|
+
pipelineExecutor = createPipelineExecutor({
|
|
10715
|
+
pipeline: pipeline,
|
|
10716
|
+
tools: tools,
|
|
10717
|
+
isNotPreparedWarningSupressed: true,
|
|
10718
|
+
maxExecutionAttempts: 3,
|
|
10719
|
+
// <- TODO: !!!!!! Why "LLM execution failed undefinedx"
|
|
10720
|
+
maxParallelCount: 1, // <- TODO: !!!!!! Pass
|
|
10721
|
+
});
|
|
10715
10722
|
return [4 /*yield*/, pipelineExecutor(inputParameters, function (taskProgress) {
|
|
10716
10723
|
if (isVerbose) {
|
|
10717
10724
|
// TODO: !!!!!!! Pretty print taskProgress
|
|
@@ -10719,28 +10726,41 @@ function initializeRunCommand(program) {
|
|
|
10719
10726
|
}
|
|
10720
10727
|
})];
|
|
10721
10728
|
case 8:
|
|
10722
|
-
result =
|
|
10729
|
+
result = _j.sent();
|
|
10723
10730
|
isSuccessful = result.isSuccessful, errors = result.errors, outputParameters = result.outputParameters, executionReport = result.executionReport;
|
|
10724
10731
|
if (isVerbose) {
|
|
10725
10732
|
// TODO: !!!!!!! Pretty print
|
|
10726
|
-
console.log({ isSuccessful: isSuccessful, errors: errors, outputParameters: outputParameters, executionReport: executionReport });
|
|
10733
|
+
console.log({ isSuccessful: isSuccessful, errors: errors, /*!!! warnings,*/ outputParameters: outputParameters, executionReport: executionReport });
|
|
10727
10734
|
console.log(outputParameters);
|
|
10728
10735
|
}
|
|
10729
10736
|
console.info(colors.gray('--- Result: ---'));
|
|
10730
10737
|
try {
|
|
10731
|
-
for (_b = __values(
|
|
10732
|
-
|
|
10738
|
+
for (_b = __values(errors || []), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
10739
|
+
error = _c.value;
|
|
10740
|
+
console.error(colors.red(colors.bold(error.name) + ': ' + error.message));
|
|
10741
|
+
}
|
|
10742
|
+
}
|
|
10743
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
10744
|
+
finally {
|
|
10745
|
+
try {
|
|
10746
|
+
if (_c && !_c.done && (_g = _b.return)) _g.call(_b);
|
|
10747
|
+
}
|
|
10748
|
+
finally { if (e_1) throw e_1.error; }
|
|
10749
|
+
}
|
|
10750
|
+
try {
|
|
10751
|
+
for (_d = __values(Object.keys(outputParameters)), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
10752
|
+
key = _e.value;
|
|
10733
10753
|
value = outputParameters[key] || colors.grey(colors.italic('(nothing)'));
|
|
10734
10754
|
separator = countLines(value) > 1 || countWords(value) > 100 ? ':\n' : ': ';
|
|
10735
10755
|
console.info(colors.green(colors.bold(key) + separator + value));
|
|
10736
10756
|
}
|
|
10737
10757
|
}
|
|
10738
|
-
catch (
|
|
10758
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
10739
10759
|
finally {
|
|
10740
10760
|
try {
|
|
10741
|
-
if (
|
|
10761
|
+
if (_e && !_e.done && (_h = _d.return)) _h.call(_d);
|
|
10742
10762
|
}
|
|
10743
|
-
finally { if (
|
|
10763
|
+
finally { if (e_2) throw e_2.error; }
|
|
10744
10764
|
}
|
|
10745
10765
|
return [2 /*return*/, process.exit(0)];
|
|
10746
10766
|
}
|