@promptbook/cli 0.74.0-3 → 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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptbook/cli",
|
|
3
|
-
"version": "0.74.0-
|
|
3
|
+
"version": "0.74.0-5",
|
|
4
4
|
"description": "Supercharge your use of large language models",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
@@ -66,6 +66,7 @@
|
|
|
66
66
|
"showdown": "2.1.0",
|
|
67
67
|
"socket.io-client": "4.7.2",
|
|
68
68
|
"spacetrim": "0.11.59",
|
|
69
|
+
"userhome": "1.0.1",
|
|
69
70
|
"waitasecond": "1.11.83"
|
|
70
71
|
},
|
|
71
72
|
"bin": {
|
package/umd/index.umd.js
CHANGED
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
*
|
|
49
49
|
* @see https://github.com/webgptorg/promptbook
|
|
50
50
|
*/
|
|
51
|
-
var PROMPTBOOK_ENGINE_VERSION = '0.74.0-
|
|
51
|
+
var PROMPTBOOK_ENGINE_VERSION = '0.74.0-4';
|
|
52
52
|
/**
|
|
53
53
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
54
54
|
*/
|
|
@@ -1722,7 +1722,7 @@
|
|
|
1722
1722
|
if (!url.startsWith('https://')) {
|
|
1723
1723
|
return false;
|
|
1724
1724
|
}
|
|
1725
|
-
if (!url.endsWith('.ptbk.md')) {
|
|
1725
|
+
if (!(url.endsWith('.book.md') || url.endsWith('.book') || url.endsWith('.ptbk.md') || url.endsWith('.ptbk'))) {
|
|
1726
1726
|
return false;
|
|
1727
1727
|
}
|
|
1728
1728
|
if (url.includes('#')) {
|
|
@@ -10650,10 +10650,10 @@
|
|
|
10650
10650
|
runCommand.action(function (path, _a) {
|
|
10651
10651
|
var isCacheReloaded = _a.reload, isVerbose = _a.verbose;
|
|
10652
10652
|
return __awaiter(_this, void 0, void 0, function () {
|
|
10653
|
-
var options, fs, llm, executables, tools, pipelineString, pipeline, questions, response, inputParameters, pipelineExecutor, result, isSuccessful, errors, outputParameters, executionReport, _b, _c, key, value, separator;
|
|
10654
|
-
var
|
|
10655
|
-
return __generator(this, function (
|
|
10656
|
-
switch (
|
|
10653
|
+
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;
|
|
10654
|
+
var _f, e_1, _g, e_2, _h;
|
|
10655
|
+
return __generator(this, function (_j) {
|
|
10656
|
+
switch (_j.label) {
|
|
10657
10657
|
case 0:
|
|
10658
10658
|
options = {
|
|
10659
10659
|
isVerbose: isVerbose,
|
|
@@ -10675,30 +10675,30 @@
|
|
|
10675
10675
|
}
|
|
10676
10676
|
return [4 /*yield*/, $provideExecutablesForNode(options)];
|
|
10677
10677
|
case 1:
|
|
10678
|
-
executables =
|
|
10679
|
-
|
|
10678
|
+
executables = _j.sent();
|
|
10679
|
+
_f = {
|
|
10680
10680
|
llm: llm,
|
|
10681
10681
|
fs: fs
|
|
10682
10682
|
};
|
|
10683
10683
|
return [4 /*yield*/, $provideScrapersForNode({ fs: fs, llm: llm, executables: executables }, options)];
|
|
10684
10684
|
case 2:
|
|
10685
|
-
tools = (
|
|
10686
|
-
|
|
10685
|
+
tools = (_f.scrapers = _j.sent(),
|
|
10686
|
+
_f.script = [
|
|
10687
10687
|
/*new JavascriptExecutionTools(options)*/
|
|
10688
10688
|
],
|
|
10689
|
-
|
|
10689
|
+
_f);
|
|
10690
10690
|
return [4 /*yield*/, isFileExisting(path, fs)];
|
|
10691
10691
|
case 3:
|
|
10692
|
-
if (!(
|
|
10692
|
+
if (!(_j.sent())) {
|
|
10693
10693
|
console.error(colors__default["default"].red("File \"".concat(path, "\" does not exist")));
|
|
10694
10694
|
return [2 /*return*/, process.exit(1)];
|
|
10695
10695
|
}
|
|
10696
10696
|
return [4 /*yield*/, fs.readFile(path, 'utf-8')];
|
|
10697
10697
|
case 4:
|
|
10698
|
-
pipelineString = (
|
|
10698
|
+
pipelineString = (_j.sent());
|
|
10699
10699
|
return [4 /*yield*/, pipelineStringToJson(pipelineString, tools)];
|
|
10700
10700
|
case 5:
|
|
10701
|
-
pipeline =
|
|
10701
|
+
pipeline = _j.sent();
|
|
10702
10702
|
validatePipeline(pipeline);
|
|
10703
10703
|
questions = pipeline.parameters
|
|
10704
10704
|
.filter(function (_a) {
|
|
@@ -10716,14 +10716,21 @@
|
|
|
10716
10716
|
});
|
|
10717
10717
|
return [4 /*yield*/, prompts__default["default"](questions)];
|
|
10718
10718
|
case 6:
|
|
10719
|
-
response =
|
|
10719
|
+
response = _j.sent();
|
|
10720
10720
|
inputParameters = response;
|
|
10721
10721
|
// console.log(response);
|
|
10722
10722
|
return [4 /*yield*/, waitasecond.forTime(100)];
|
|
10723
10723
|
case 7:
|
|
10724
10724
|
// console.log(response);
|
|
10725
|
-
|
|
10726
|
-
pipelineExecutor = createPipelineExecutor({
|
|
10725
|
+
_j.sent();
|
|
10726
|
+
pipelineExecutor = createPipelineExecutor({
|
|
10727
|
+
pipeline: pipeline,
|
|
10728
|
+
tools: tools,
|
|
10729
|
+
isNotPreparedWarningSupressed: true,
|
|
10730
|
+
maxExecutionAttempts: 3,
|
|
10731
|
+
// <- TODO: !!!!!! Why "LLM execution failed undefinedx"
|
|
10732
|
+
maxParallelCount: 1, // <- TODO: !!!!!! Pass
|
|
10733
|
+
});
|
|
10727
10734
|
return [4 /*yield*/, pipelineExecutor(inputParameters, function (taskProgress) {
|
|
10728
10735
|
if (isVerbose) {
|
|
10729
10736
|
// TODO: !!!!!!! Pretty print taskProgress
|
|
@@ -10731,28 +10738,41 @@
|
|
|
10731
10738
|
}
|
|
10732
10739
|
})];
|
|
10733
10740
|
case 8:
|
|
10734
|
-
result =
|
|
10741
|
+
result = _j.sent();
|
|
10735
10742
|
isSuccessful = result.isSuccessful, errors = result.errors, outputParameters = result.outputParameters, executionReport = result.executionReport;
|
|
10736
10743
|
if (isVerbose) {
|
|
10737
10744
|
// TODO: !!!!!!! Pretty print
|
|
10738
|
-
console.log({ isSuccessful: isSuccessful, errors: errors, outputParameters: outputParameters, executionReport: executionReport });
|
|
10745
|
+
console.log({ isSuccessful: isSuccessful, errors: errors, /*!!! warnings,*/ outputParameters: outputParameters, executionReport: executionReport });
|
|
10739
10746
|
console.log(outputParameters);
|
|
10740
10747
|
}
|
|
10741
10748
|
console.info(colors__default["default"].gray('--- Result: ---'));
|
|
10742
10749
|
try {
|
|
10743
|
-
for (_b = __values(
|
|
10744
|
-
|
|
10750
|
+
for (_b = __values(errors || []), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
10751
|
+
error = _c.value;
|
|
10752
|
+
console.error(colors__default["default"].red(colors__default["default"].bold(error.name) + ': ' + error.message));
|
|
10753
|
+
}
|
|
10754
|
+
}
|
|
10755
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
10756
|
+
finally {
|
|
10757
|
+
try {
|
|
10758
|
+
if (_c && !_c.done && (_g = _b.return)) _g.call(_b);
|
|
10759
|
+
}
|
|
10760
|
+
finally { if (e_1) throw e_1.error; }
|
|
10761
|
+
}
|
|
10762
|
+
try {
|
|
10763
|
+
for (_d = __values(Object.keys(outputParameters)), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
10764
|
+
key = _e.value;
|
|
10745
10765
|
value = outputParameters[key] || colors__default["default"].grey(colors__default["default"].italic('(nothing)'));
|
|
10746
10766
|
separator = countLines(value) > 1 || countWords(value) > 100 ? ':\n' : ': ';
|
|
10747
10767
|
console.info(colors__default["default"].green(colors__default["default"].bold(key) + separator + value));
|
|
10748
10768
|
}
|
|
10749
10769
|
}
|
|
10750
|
-
catch (
|
|
10770
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
10751
10771
|
finally {
|
|
10752
10772
|
try {
|
|
10753
|
-
if (
|
|
10773
|
+
if (_e && !_e.done && (_h = _d.return)) _h.call(_d);
|
|
10754
10774
|
}
|
|
10755
|
-
finally { if (
|
|
10775
|
+
finally { if (e_2) throw e_2.error; }
|
|
10756
10776
|
}
|
|
10757
10777
|
return [2 /*return*/, process.exit(0)];
|
|
10758
10778
|
}
|