@promptbook/cli 0.85.0-2 → 0.85.0-4
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 +38 -21
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/execution/ExecutionTask.d.ts +7 -3
- package/package.json +1 -1
- package/umd/index.umd.js +38 -21
- package/umd/index.umd.js.map +1 -1
package/esm/index.es.js
CHANGED
|
@@ -43,7 +43,7 @@ var BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
|
43
43
|
* @generated
|
|
44
44
|
* @see https://github.com/webgptorg/promptbook
|
|
45
45
|
*/
|
|
46
|
-
var PROMPTBOOK_ENGINE_VERSION = '0.85.0-
|
|
46
|
+
var PROMPTBOOK_ENGINE_VERSION = '0.85.0-3';
|
|
47
47
|
/**
|
|
48
48
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
49
49
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -4920,7 +4920,7 @@ function assertsTaskSuccessful(executionResult) {
|
|
|
4920
4920
|
*/
|
|
4921
4921
|
function createTask(options) {
|
|
4922
4922
|
var taskType = options.taskType, taskProcessCallback = options.taskProcessCallback;
|
|
4923
|
-
var taskId = "".concat(taskType.toLowerCase(), "-").concat($randomToken(
|
|
4923
|
+
var taskId = "".concat(taskType.toLowerCase().substring(0, 4), "-").concat($randomToken(8 /* <- TODO: !!! To global config + Use Base58 to avoid simmilar char conflicts */));
|
|
4924
4924
|
var partialResultSubject = new BehaviorSubject({});
|
|
4925
4925
|
var finalResultPromise = /* not await */ taskProcessCallback(function (newOngoingResult) {
|
|
4926
4926
|
partialResultSubject.next(newOngoingResult);
|
|
@@ -4952,6 +4952,9 @@ function createTask(options) {
|
|
|
4952
4952
|
isCrashedOnError: true,
|
|
4953
4953
|
})));
|
|
4954
4954
|
},
|
|
4955
|
+
get currentValue() {
|
|
4956
|
+
return partialResultSubject.value;
|
|
4957
|
+
},
|
|
4955
4958
|
};
|
|
4956
4959
|
}
|
|
4957
4960
|
/**
|
|
@@ -13858,27 +13861,29 @@ function startRemoteServer(options) {
|
|
|
13858
13861
|
app.get("".concat(rootPath, "/executions/:taskId"), function (request, response) { return __awaiter(_this, void 0, void 0, function () {
|
|
13859
13862
|
var taskId, execution;
|
|
13860
13863
|
return __generator(this, function (_a) {
|
|
13861
|
-
taskId = request.
|
|
13864
|
+
taskId = request.params.taskId;
|
|
13862
13865
|
execution = runningExecutionTasks.find(function (executionTask) { return executionTask.taskId === taskId; });
|
|
13863
13866
|
if (execution === undefined) {
|
|
13864
13867
|
response.status(404).send("Execution \"".concat(taskId, "\" not found"));
|
|
13865
13868
|
return [2 /*return*/];
|
|
13866
13869
|
}
|
|
13867
|
-
response.send(execution);
|
|
13870
|
+
response.send(execution.currentValue);
|
|
13868
13871
|
return [2 /*return*/];
|
|
13869
13872
|
});
|
|
13870
13873
|
}); });
|
|
13871
13874
|
app.post("".concat(rootPath, "/executions/new"), function (request, response) { return __awaiter(_this, void 0, void 0, function () {
|
|
13872
|
-
var inputParameters, pipelineUrl, pipeline, llm, fs, executables, tools, pipelineExecutor, executionTask;
|
|
13875
|
+
var inputParameters, pipelineUrl, pipeline, llm, fs, executables, tools, pipelineExecutor, executionTask, error_1;
|
|
13873
13876
|
var _a;
|
|
13874
13877
|
return __generator(this, function (_b) {
|
|
13875
13878
|
switch (_b.label) {
|
|
13876
13879
|
case 0:
|
|
13880
|
+
_b.trys.push([0, 5, , 6]);
|
|
13877
13881
|
inputParameters = request.body.inputParameters;
|
|
13878
13882
|
pipelineUrl = request.body.pipelineUrl || request.body.book;
|
|
13879
13883
|
return [4 /*yield*/, (collection === null || collection === void 0 ? void 0 : collection.getPipelineByUrl(pipelineUrl))];
|
|
13880
13884
|
case 1:
|
|
13881
13885
|
pipeline = _b.sent();
|
|
13886
|
+
// <- TODO: !!!!!! NotFoundError
|
|
13882
13887
|
if (pipeline === undefined) {
|
|
13883
13888
|
response.status(404).send("Pipeline \"".concat(pipelineUrl, "\" not found"));
|
|
13884
13889
|
return [2 /*return*/];
|
|
@@ -13906,7 +13911,19 @@ function startRemoteServer(options) {
|
|
|
13906
13911
|
executionTask = pipelineExecutor(inputParameters);
|
|
13907
13912
|
runningExecutionTasks.push(executionTask);
|
|
13908
13913
|
response.send(executionTask);
|
|
13909
|
-
|
|
13914
|
+
// TODO: !!!!!! Remove this:
|
|
13915
|
+
executionTask.asObservable().subscribe(function (_) {
|
|
13916
|
+
console.log('!!!', _);
|
|
13917
|
+
});
|
|
13918
|
+
return [3 /*break*/, 6];
|
|
13919
|
+
case 5:
|
|
13920
|
+
error_1 = _b.sent();
|
|
13921
|
+
if (!(error_1 instanceof Error)) {
|
|
13922
|
+
throw error_1;
|
|
13923
|
+
}
|
|
13924
|
+
response.status(400).send({ error: serializeError(error_1) });
|
|
13925
|
+
return [3 /*break*/, 6];
|
|
13926
|
+
case 6: return [2 /*return*/];
|
|
13910
13927
|
}
|
|
13911
13928
|
});
|
|
13912
13929
|
}); });
|
|
@@ -13971,7 +13988,7 @@ function startRemoteServer(options) {
|
|
|
13971
13988
|
}); };
|
|
13972
13989
|
// -----------
|
|
13973
13990
|
socket.on('prompt-request', function (request) { return __awaiter(_this, void 0, void 0, function () {
|
|
13974
|
-
var identification, prompt, executionTools, llm, _a, promptResult, _b,
|
|
13991
|
+
var identification, prompt, executionTools, llm, _a, promptResult, _b, error_2;
|
|
13975
13992
|
return __generator(this, function (_c) {
|
|
13976
13993
|
switch (_c.label) {
|
|
13977
13994
|
case 0:
|
|
@@ -14040,11 +14057,11 @@ function startRemoteServer(options) {
|
|
|
14040
14057
|
socket.emit('prompt-response', { promptResult: promptResult } /* <- Note: [🤛] */);
|
|
14041
14058
|
return [3 /*break*/, 15];
|
|
14042
14059
|
case 13:
|
|
14043
|
-
|
|
14044
|
-
if (!(
|
|
14045
|
-
throw
|
|
14060
|
+
error_2 = _c.sent();
|
|
14061
|
+
if (!(error_2 instanceof Error)) {
|
|
14062
|
+
throw error_2;
|
|
14046
14063
|
}
|
|
14047
|
-
socket.emit('error', serializeError(
|
|
14064
|
+
socket.emit('error', serializeError(error_2) /* <- Note: [🤛] */);
|
|
14048
14065
|
return [3 /*break*/, 15];
|
|
14049
14066
|
case 14:
|
|
14050
14067
|
socket.disconnect();
|
|
@@ -14056,7 +14073,7 @@ function startRemoteServer(options) {
|
|
|
14056
14073
|
// -----------
|
|
14057
14074
|
// TODO: [👒] Listing models (and checking configuration) probbably should go through REST API not Socket.io
|
|
14058
14075
|
socket.on('listModels-request', function (request) { return __awaiter(_this, void 0, void 0, function () {
|
|
14059
|
-
var identification, executionTools, llm, models,
|
|
14076
|
+
var identification, executionTools, llm, models, error_3;
|
|
14060
14077
|
return __generator(this, function (_a) {
|
|
14061
14078
|
switch (_a.label) {
|
|
14062
14079
|
case 0:
|
|
@@ -14077,11 +14094,11 @@ function startRemoteServer(options) {
|
|
|
14077
14094
|
socket.emit('listModels-response', { models: models } /* <- Note: [🤛] */);
|
|
14078
14095
|
return [3 /*break*/, 6];
|
|
14079
14096
|
case 4:
|
|
14080
|
-
|
|
14081
|
-
if (!(
|
|
14082
|
-
throw
|
|
14097
|
+
error_3 = _a.sent();
|
|
14098
|
+
if (!(error_3 instanceof Error)) {
|
|
14099
|
+
throw error_3;
|
|
14083
14100
|
}
|
|
14084
|
-
socket.emit('error', serializeError(
|
|
14101
|
+
socket.emit('error', serializeError(error_3));
|
|
14085
14102
|
return [3 /*break*/, 6];
|
|
14086
14103
|
case 5:
|
|
14087
14104
|
socket.disconnect();
|
|
@@ -14093,7 +14110,7 @@ function startRemoteServer(options) {
|
|
|
14093
14110
|
// -----------
|
|
14094
14111
|
// TODO: [👒] Listing models (and checking configuration) probbably should go through REST API not Socket.io
|
|
14095
14112
|
socket.on('preparePipeline-request', function (request) { return __awaiter(_this, void 0, void 0, function () {
|
|
14096
|
-
var identification, pipeline, executionTools, preparedPipeline,
|
|
14113
|
+
var identification, pipeline, executionTools, preparedPipeline, error_4;
|
|
14097
14114
|
return __generator(this, function (_a) {
|
|
14098
14115
|
switch (_a.label) {
|
|
14099
14116
|
case 0:
|
|
@@ -14113,11 +14130,11 @@ function startRemoteServer(options) {
|
|
|
14113
14130
|
socket.emit('preparePipeline-response', { preparedPipeline: preparedPipeline } /* <- Note: [🤛] */);
|
|
14114
14131
|
return [3 /*break*/, 6];
|
|
14115
14132
|
case 4:
|
|
14116
|
-
|
|
14117
|
-
if (!(
|
|
14118
|
-
throw
|
|
14133
|
+
error_4 = _a.sent();
|
|
14134
|
+
if (!(error_4 instanceof Error)) {
|
|
14135
|
+
throw error_4;
|
|
14119
14136
|
}
|
|
14120
|
-
socket.emit('error', serializeError(
|
|
14137
|
+
socket.emit('error', serializeError(error_4));
|
|
14121
14138
|
return [3 /*break*/, 6];
|
|
14122
14139
|
case 5:
|
|
14123
14140
|
socket.disconnect();
|