@promptbook/cli 0.88.0-1 → 0.88.0-9

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.
@@ -40,6 +40,7 @@ import type { ExecutionReportString } from '../execution/execution-report/Execut
40
40
  import type { ExecutionReportStringOptions } from '../execution/execution-report/ExecutionReportStringOptions';
41
41
  import type { ExecutionTask } from '../execution/ExecutionTask';
42
42
  import type { PreparationTask } from '../execution/ExecutionTask';
43
+ import type { task_status } from '../execution/ExecutionTask';
43
44
  import type { AbstractTask } from '../execution/ExecutionTask';
44
45
  import type { Task } from '../execution/ExecutionTask';
45
46
  import type { ExecutionTools } from '../execution/ExecutionTools';
@@ -322,6 +323,7 @@ export type { ExecutionReportString };
322
323
  export type { ExecutionReportStringOptions };
323
324
  export type { ExecutionTask };
324
325
  export type { PreparationTask };
326
+ export type { task_status };
325
327
  export type { AbstractTask };
326
328
  export type { Task };
327
329
  export type { ExecutionTools };
@@ -62,6 +62,7 @@ import { clonePipeline } from '../utils/serialization/clonePipeline';
62
62
  import { deepClone } from '../utils/serialization/deepClone';
63
63
  import { exportJson } from '../utils/serialization/exportJson';
64
64
  import { isSerializableAsJson } from '../utils/serialization/isSerializableAsJson';
65
+ import { jsonStringsToJsons } from '../utils/serialization/jsonStringsToJsons';
65
66
  import { difference } from '../utils/sets/difference';
66
67
  import { intersection } from '../utils/sets/intersection';
67
68
  import { union } from '../utils/sets/union';
@@ -143,6 +144,7 @@ export { clonePipeline };
143
144
  export { deepClone };
144
145
  export { exportJson };
145
146
  export { isSerializableAsJson };
147
+ export { jsonStringsToJsons };
146
148
  export { difference };
147
149
  export { intersection };
148
150
  export { union };
@@ -0,0 +1,11 @@
1
+ import type { Command as Program } from 'commander';
2
+ type actionCallbackFunction = Parameters<Program['action']>[0];
3
+ /**
4
+ * Wraps action to handle error console logging and exit process with error code
5
+ *
6
+ * @param action Action to be wrapped in error handling
7
+ * @returns Wrapped action
8
+ * @private internal helper function for CLI commands
9
+ */
10
+ export declare function handleActionErrors(action: actionCallbackFunction): actionCallbackFunction;
11
+ export {};
@@ -40,6 +40,10 @@ export type PreparationTask = AbstractTask<PipelineExecutorResult> & {
40
40
  readonly taskType: 'PREPARATION';
41
41
  readonly taskId: `prep-${task_id}`;
42
42
  };
43
+ /**
44
+ * Status of a task
45
+ */
46
+ export type task_status = 'RUNNING' | 'FINISHED' | 'ERROR';
43
47
  /**
44
48
  * Base interface for all task types
45
49
  */
@@ -52,6 +56,18 @@ export type AbstractTask<TTaskResult extends AbstractTaskResult> = {
52
56
  * Unique identifier for the task
53
57
  */
54
58
  readonly taskId: task_id;
59
+ /**
60
+ * Status of the task
61
+ */
62
+ readonly status: task_status;
63
+ /**
64
+ * Date when the task was created
65
+ */
66
+ readonly createdAt: Date;
67
+ /**
68
+ * Date when the task was last updated
69
+ */
70
+ readonly updatedAt: Date;
55
71
  /**
56
72
  * Gets a promise that resolves with the task result
57
73
  */
@@ -66,6 +82,14 @@ export type AbstractTask<TTaskResult extends AbstractTaskResult> = {
66
82
  * Gets just the current value which is mutated during the task processing
67
83
  */
68
84
  currentValue: PartialDeep<TTaskResult>;
85
+ /**
86
+ * List of errors that occurred during the task processing
87
+ */
88
+ readonly errors: Array<Error>;
89
+ /**
90
+ * List of warnings that occurred during the task processing
91
+ */
92
+ readonly warnings: Array<Error>;
69
93
  };
70
94
  export type Task = ExecutionTask | PreparationTask;
71
95
  export {};
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Recursively converts JSON strings to JSON objects
3
+
4
+ * @public exported from `@promptbook/utils`
5
+ */
6
+ export declare function jsonStringsToJsons<T>(object: T): T;
7
+ /**
8
+ * TODO: Type the return type correctly
9
+ */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/cli",
3
- "version": "0.88.0-1",
3
+ "version": "0.88.0-9",
4
4
  "description": "It's time for a paradigm shift. The future of software in plain English, French or Latin",
5
5
  "private": false,
6
6
  "sideEffects": false,
package/umd/index.umd.js CHANGED
@@ -54,7 +54,7 @@
54
54
  * @generated
55
55
  * @see https://github.com/webgptorg/promptbook
56
56
  */
57
- const PROMPTBOOK_ENGINE_VERSION = '0.88.0-1';
57
+ const PROMPTBOOK_ENGINE_VERSION = '0.88.0-9';
58
58
  /**
59
59
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
60
60
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -407,6 +407,30 @@
407
407
  * TODO: [🎺]
408
408
  */
409
409
 
410
+ /**
411
+ * Wraps action to handle error console logging and exit process with error code
412
+ *
413
+ * @param action Action to be wrapped in error handling
414
+ * @returns Wrapped action
415
+ * @private internal helper function for CLI commands
416
+ */
417
+ function handleActionErrors(action) {
418
+ return async (...args) => {
419
+ try {
420
+ await action(...args);
421
+ return process.exit(0);
422
+ }
423
+ catch (error) {
424
+ if (!(error instanceof Error)) {
425
+ throw error;
426
+ }
427
+ // console.error(colors.bgRed(error.name));
428
+ console.error(colors__default["default"].red(/* error.stack || */ error.message));
429
+ return process.exit(1);
430
+ }
431
+ };
432
+ }
433
+
410
434
  /**
411
435
  * Initializes `about` command for Promptbook CLI utilities
412
436
  *
@@ -419,7 +443,7 @@
419
443
  makeCommand.description(spaceTrim__default["default"](`
420
444
  Tells about Promptbook CLI and its abilities
421
445
  `));
422
- makeCommand.action(async () => {
446
+ makeCommand.action(handleActionErrors(async () => {
423
447
  console.info(colors__default["default"].bold(colors__default["default"].blue(`Promptbook: ${CLAIM}`)));
424
448
  console.info(colors__default["default"].cyan(`Book language version: ${BOOK_LANGUAGE_VERSION}`));
425
449
  console.info(colors__default["default"].cyan(`Promptbook engine version: ${PROMPTBOOK_ENGINE_VERSION}`));
@@ -446,7 +470,7 @@
446
470
  console.info(colors__default["default"].gray(`https://github.com/webgptorg/promptbook`));
447
471
  console.info(colors__default["default"].gray(`https://ptbk.io`));
448
472
  return process.exit(0);
449
- });
473
+ }));
450
474
  }
451
475
  /**
452
476
  * TODO: [🗽] Unite branding and make single place for it
@@ -469,12 +493,12 @@
469
493
  helloCommand.alias('hi');
470
494
  helloCommand.argument('[name]', 'Your name', 'Paul');
471
495
  helloCommand.option('-g, --greeting <greeting>', `Greeting`, 'Hello');
472
- helloCommand.action(async (name, { greeting }) => {
496
+ helloCommand.action(handleActionErrors(async (name, { greeting }) => {
473
497
  console.info(colors__default["default"].cyan(`${greeting} ${name}`));
474
498
  await waitasecond.forTime(1000);
475
499
  console.info(colors__default["default"].rainbow(`Nice to meet you!`));
476
500
  return process.exit(0);
477
- });
501
+ }));
478
502
  }
479
503
  /**
480
504
  * TODO: [🧠][🐣] Make here some easter egg with generated hello greeting via LLM models
@@ -2563,13 +2587,13 @@
2563
2587
  `));
2564
2588
  listModelsCommand.alias('models');
2565
2589
  listModelsCommand.alias('llm');
2566
- listModelsCommand.action(async () => {
2590
+ listModelsCommand.action(handleActionErrors(async () => {
2567
2591
  const llm = await $provideLlmToolsForWizzardOrCli({});
2568
2592
  $sideEffect(llm);
2569
2593
  // <- Note: Providing LLM tools will make a side effect of registering all available LLM tools to show the message
2570
2594
  console.info($registeredLlmToolsMessage());
2571
2595
  return process.exit(0);
2572
- });
2596
+ }));
2573
2597
  }
2574
2598
  /**
2575
2599
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -3095,7 +3119,7 @@
3095
3119
  List all available and configured scrapers and executables
3096
3120
  `));
3097
3121
  listModelsCommand.alias('scrapers');
3098
- listModelsCommand.action(async () => {
3122
+ listModelsCommand.action(handleActionErrors(async () => {
3099
3123
  const scrapers = await $provideScrapersForNode({});
3100
3124
  const executables = await $provideExecutablesForNode();
3101
3125
  console.info(spaceTrim__default["default"]((block) => `
@@ -3112,7 +3136,7 @@
3112
3136
  .join('\n'))}
3113
3137
  `));
3114
3138
  return process.exit(0);
3115
- });
3139
+ }));
3116
3140
  }
3117
3141
  /**
3118
3142
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -4074,6 +4098,36 @@
4074
4098
  * TODO: Maybe use nanoid instead https://github.com/ai/nanoid
4075
4099
  */
4076
4100
 
4101
+ /**
4102
+ * Recursively converts JSON strings to JSON objects
4103
+
4104
+ * @public exported from `@promptbook/utils`
4105
+ */
4106
+ function jsonStringsToJsons(object) {
4107
+ if (object === null) {
4108
+ return object;
4109
+ }
4110
+ if (Array.isArray(object)) {
4111
+ return object.map(jsonStringsToJsons);
4112
+ }
4113
+ if (typeof object !== 'object') {
4114
+ return object;
4115
+ }
4116
+ const newObject = { ...object };
4117
+ for (const [key, value] of Object.entries(object)) {
4118
+ if (typeof value === 'string' && isValidJsonString(value)) {
4119
+ newObject[key] = JSON.parse(value);
4120
+ }
4121
+ else {
4122
+ newObject[key] = jsonStringsToJsons(value);
4123
+ }
4124
+ }
4125
+ return newObject;
4126
+ }
4127
+ /**
4128
+ * TODO: Type the return type correctly
4129
+ */
4130
+
4077
4131
  /**
4078
4132
  * This error indicates problems parsing the format value
4079
4133
  *
@@ -4290,21 +4344,43 @@
4290
4344
  function createTask(options) {
4291
4345
  const { taskType, taskProcessCallback } = options;
4292
4346
  const taskId = `${taskType.toLowerCase().substring(0, 4)}-${$randomToken(8 /* <- TODO: To global config + Use Base58 to avoid simmilar char conflicts */)}`;
4293
- const partialResultSubject = new rxjs.BehaviorSubject({});
4347
+ let status = 'RUNNING';
4348
+ const createdAt = new Date();
4349
+ let updatedAt = createdAt;
4350
+ const errors = [];
4351
+ const warnings = [];
4352
+ let currentValue = {};
4353
+ const partialResultSubject = new rxjs.Subject();
4354
+ // <- Note: Not using `BehaviorSubject` because on error we can't access the last value
4294
4355
  const finalResultPromise = /* not await */ taskProcessCallback((newOngoingResult) => {
4356
+ Object.assign(currentValue, newOngoingResult);
4357
+ // <- TODO: assign deep
4295
4358
  partialResultSubject.next(newOngoingResult);
4296
4359
  });
4297
4360
  finalResultPromise
4298
4361
  .catch((error) => {
4362
+ errors.push(error);
4299
4363
  partialResultSubject.error(error);
4300
4364
  })
4301
- .then((value) => {
4302
- if (value) {
4365
+ .then((executionResult) => {
4366
+ if (executionResult) {
4303
4367
  try {
4304
- assertsTaskSuccessful(value);
4305
- partialResultSubject.next(value);
4368
+ updatedAt = new Date();
4369
+ errors.push(...executionResult.errors);
4370
+ warnings.push(...executionResult.warnings);
4371
+ // <- TODO: !!! Only unique errors and warnings should be added (or filtered)
4372
+ // TODO: [🧠] !!! errors, warning, isSuccessful are redundant both in `ExecutionTask` and `ExecutionTask.currentValue`
4373
+ // Also maybe move `ExecutionTask.currentValue.usage` -> `ExecutionTask.usage`
4374
+ // And delete `ExecutionTask.currentValue.preparedPipeline`
4375
+ assertsTaskSuccessful(executionResult);
4376
+ status = 'FINISHED';
4377
+ currentValue = jsonStringsToJsons(executionResult);
4378
+ // <- TODO: Convert JSON values in string to JSON objects
4379
+ partialResultSubject.next(executionResult);
4306
4380
  }
4307
4381
  catch (error) {
4382
+ status = 'ERROR';
4383
+ errors.push(error);
4308
4384
  partialResultSubject.error(error);
4309
4385
  }
4310
4386
  }
@@ -4321,12 +4397,33 @@
4321
4397
  return {
4322
4398
  taskType,
4323
4399
  taskId,
4400
+ get status() {
4401
+ return status;
4402
+ // <- Note: [1] Theese must be getters to allow changing the value in the future
4403
+ },
4404
+ get createdAt() {
4405
+ return createdAt;
4406
+ // <- Note: [1]
4407
+ },
4408
+ get updatedAt() {
4409
+ return updatedAt;
4410
+ // <- Note: [1]
4411
+ },
4324
4412
  asPromise,
4325
4413
  asObservable() {
4326
4414
  return partialResultSubject.asObservable();
4327
4415
  },
4416
+ get errors() {
4417
+ return errors;
4418
+ // <- Note: [1]
4419
+ },
4420
+ get warnings() {
4421
+ return warnings;
4422
+ // <- Note: [1]
4423
+ },
4328
4424
  get currentValue() {
4329
- return partialResultSubject.value;
4425
+ return currentValue;
4426
+ // <- Note: [1]
4330
4427
  },
4331
4428
  };
4332
4429
  }
@@ -5522,7 +5619,7 @@
5522
5619
  Last result:
5523
5620
  ${block($ongoingTaskResult.$resultString === null
5524
5621
  ? 'null'
5525
- : $ongoingTaskResult.$resultString
5622
+ : spaceTrim.spaceTrim($ongoingTaskResult.$resultString)
5526
5623
  .split('\n')
5527
5624
  .map((line) => `> ${line}`)
5528
5625
  .join('\n'))}
@@ -11239,7 +11336,7 @@
11239
11336
  Note: This can be used only with "javascript" or "typescript" format
11240
11337
 
11241
11338
  `), DEFAULT_GET_PIPELINE_COLLECTION_FUNCTION_NAME);
11242
- makeCommand.action(async (path$1, { projectName, rootUrl, format, functionName, validation, reload: isCacheReloaded, verbose: isVerbose, output, }) => {
11339
+ makeCommand.action(handleActionErrors(async (path$1, { projectName, rootUrl, format, functionName, validation, reload: isCacheReloaded, verbose: isVerbose, output, }) => {
11243
11340
  if (!isValidJavascriptName(functionName)) {
11244
11341
  console.error(colors__default["default"].red(`Function name "${functionName}" is not valid javascript name`));
11245
11342
  return process.exit(1);
@@ -11266,9 +11363,9 @@
11266
11363
  isVerbose,
11267
11364
  isCacheReloaded,
11268
11365
  }; /* <- TODO: ` satisfies PrepareAndScrapeOptions` */
11269
- const fs = $provideFilesystemForNode();
11366
+ const fs = $provideFilesystemForNode(prepareAndScrapeOptions);
11270
11367
  const llm = await $provideLlmToolsForWizzardOrCli(prepareAndScrapeOptions);
11271
- const executables = await $provideExecutablesForNode();
11368
+ const executables = await $provideExecutablesForNode(prepareAndScrapeOptions);
11272
11369
  const tools = {
11273
11370
  llm,
11274
11371
  fs,
@@ -11426,7 +11523,7 @@
11426
11523
  console.info(colors__default["default"].cyan(usageToHuman(llm.getTotalUsage())));
11427
11524
  }
11428
11525
  return process.exit(0);
11429
- });
11526
+ }));
11430
11527
  }
11431
11528
  /**
11432
11529
  * TODO: [🥃][main] !!3 Allow `ptbk make` without configuring any llm tools
@@ -11533,7 +11630,7 @@
11533
11630
  'Pipelines to prettify as glob pattern');
11534
11631
  prettifyCommand.option('-i, --ignore <glob>', `Ignore as glob pattern`);
11535
11632
  prettifyCommand.option('-v, --verbose', `Is output verbose`, false);
11536
- prettifyCommand.action(async (filesGlob, { ignore, verbose: isVerbose }) => {
11633
+ prettifyCommand.action(handleActionErrors(async (filesGlob, { ignore, verbose: isVerbose }) => {
11537
11634
  const filenames = await glob__default["default"](filesGlob, { ignore });
11538
11635
  // <- TODO: [😶]
11539
11636
  for (const filename of filenames) {
@@ -11565,7 +11662,7 @@
11565
11662
  }
11566
11663
  console.info(colors__default["default"].green(`All pipelines are prettified`));
11567
11664
  return process.exit(0);
11568
- });
11665
+ }));
11569
11666
  }
11570
11667
  /**
11571
11668
  * TODO: [😶] Unite floder listing
@@ -12139,7 +12236,7 @@
12139
12236
  runCommand.option('--no-formfactor', `When set, behavior of the interactive mode is not changed by the formfactor of the pipeline`);
12140
12237
  runCommand.option('-j, --json <json>', `Pass all or some input parameters as JSON record, if used the output is also returned as JSON`);
12141
12238
  runCommand.option('-s, --save-report <path>', `Save report to file`);
12142
- runCommand.action(async (pipelineSource, options) => {
12239
+ runCommand.action(handleActionErrors(async (pipelineSource, options) => {
12143
12240
  const { reload: isCacheReloaded, interactive: isInteractive, formfactor: isFormfactorUsed, json, verbose: isVerbose, saveReport, } = options;
12144
12241
  if (pipelineSource.includes('-') && normalizeToKebabCase(pipelineSource) === pipelineSource) {
12145
12242
  console.error(colors__default["default"].red(`""${pipelineSource}" is not a valid command or book. See 'ptbk --help'.`));
@@ -12162,7 +12259,7 @@
12162
12259
  if (isVerbose) {
12163
12260
  console.info(colors__default["default"].gray('--- Preparing tools ---'));
12164
12261
  }
12165
- const fs = $provideFilesystemForNode();
12262
+ const fs = $provideFilesystemForNode(prepareAndScrapeOptions);
12166
12263
  let llm;
12167
12264
  try {
12168
12265
  llm = await $provideLlmToolsForWizzardOrCli(prepareAndScrapeOptions);
@@ -12216,7 +12313,7 @@
12216
12313
  if (isVerbose) {
12217
12314
  console.info(colors__default["default"].gray('--- Getting the tools ---'));
12218
12315
  }
12219
- const executables = await $provideExecutablesForNode();
12316
+ const executables = await $provideExecutablesForNode(prepareAndScrapeOptions);
12220
12317
  const tools = {
12221
12318
  llm,
12222
12319
  fs,
@@ -12365,7 +12462,7 @@
12365
12462
  console.info(JSON.stringify(outputParameters, null, 4));
12366
12463
  }
12367
12464
  return process.exit(0);
12368
- });
12465
+ }));
12369
12466
  }
12370
12467
  /**
12371
12468
  * TODO: !!5 Catch and wrap all errors from CLI
@@ -12553,8 +12650,35 @@
12553
12650
  .send({ error: serializeError(error) });
12554
12651
  }
12555
12652
  });
12653
+ function exportExecutionTask(executionTask, isFull) {
12654
+ // <- TODO: [🧠] This should be maybe method of `ExecutionTask` itself
12655
+ const { taskType, taskId, status, errors, warnings, createdAt, updatedAt, currentValue } = executionTask;
12656
+ if (isFull) {
12657
+ return {
12658
+ nonce: '✨',
12659
+ taskId,
12660
+ taskType,
12661
+ status,
12662
+ errors: errors.map(serializeError),
12663
+ warnings: warnings.map(serializeError),
12664
+ createdAt,
12665
+ updatedAt,
12666
+ currentValue,
12667
+ };
12668
+ }
12669
+ else {
12670
+ return {
12671
+ nonce: '✨',
12672
+ taskId,
12673
+ taskType,
12674
+ status,
12675
+ createdAt,
12676
+ updatedAt,
12677
+ };
12678
+ }
12679
+ }
12556
12680
  app.get(`${rootPath}/executions`, async (request, response) => {
12557
- response.send(runningExecutionTasks);
12681
+ response.send(runningExecutionTasks.map((runningExecutionTask) => exportExecutionTask(runningExecutionTask, false)));
12558
12682
  });
12559
12683
  app.get(`${rootPath}/executions/last`, async (request, response) => {
12560
12684
  // TODO: [🤬] Filter only for user
@@ -12562,20 +12686,20 @@
12562
12686
  response.status(404).send('No execution tasks found');
12563
12687
  return;
12564
12688
  }
12565
- const lastExecution = runningExecutionTasks[runningExecutionTasks.length - 1];
12566
- response.send(lastExecution);
12689
+ const lastExecutionTask = runningExecutionTasks[runningExecutionTasks.length - 1];
12690
+ response.send(exportExecutionTask(lastExecutionTask, true));
12567
12691
  });
12568
12692
  app.get(`${rootPath}/executions/:taskId`, async (request, response) => {
12569
12693
  const { taskId } = request.params;
12570
12694
  // TODO: [🤬] Filter only for user
12571
- const execution = runningExecutionTasks.find((executionTask) => executionTask.taskId === taskId);
12572
- if (execution === undefined) {
12695
+ const executionTask = runningExecutionTasks.find((executionTask) => executionTask.taskId === taskId);
12696
+ if (executionTask === undefined) {
12573
12697
  response
12574
12698
  .status(404)
12575
12699
  .send(`Execution "${taskId}" not found`);
12576
12700
  return;
12577
12701
  }
12578
- response.send(execution.currentValue);
12702
+ response.send(exportExecutionTask(executionTask, true));
12579
12703
  });
12580
12704
  app.post(`${rootPath}/executions/new`, async (request, response) => {
12581
12705
  try {
@@ -12809,7 +12933,7 @@
12809
12933
  Starts a remote server to execute books
12810
12934
  `));
12811
12935
  startServerCommand.alias('server');
12812
- startServerCommand.action(async (path, { port: portRaw, url: rawUrl, allowAnonymous: isAnonymousModeAllowed, reload: isCacheReloaded, verbose: isVerbose, }) => {
12936
+ startServerCommand.action(handleActionErrors(async (path, { port: portRaw, url: rawUrl, allowAnonymous: isAnonymousModeAllowed, reload: isCacheReloaded, verbose: isVerbose, }) => {
12813
12937
  if (rawUrl && !isValidUrl(rawUrl)) {
12814
12938
  console.error(colors__default["default"].red(`Invalid URL: ${rawUrl}`));
12815
12939
  return process.exit(1);
@@ -12836,9 +12960,9 @@
12836
12960
  isVerbose,
12837
12961
  isCacheReloaded,
12838
12962
  }; /* <- TODO: ` satisfies PrepareAndScrapeOptions` */
12839
- const fs = $provideFilesystemForNode();
12963
+ const fs = $provideFilesystemForNode(prepareAndScrapeOptions);
12840
12964
  const llm = await $provideLlmToolsForWizzardOrCli(prepareAndScrapeOptions);
12841
- const executables = await $provideExecutablesForNode();
12965
+ const executables = await $provideExecutablesForNode(prepareAndScrapeOptions);
12842
12966
  const tools = {
12843
12967
  llm,
12844
12968
  fs,
@@ -12855,20 +12979,23 @@
12855
12979
  // <- TODO: [🍖] Add `intermediateFilesStrategy`
12856
12980
  });
12857
12981
  // console.log(path, await collection.listPipelines());
12858
- startRemoteServer({
12982
+ const server = startRemoteServer({
12859
12983
  rootPath,
12860
12984
  port,
12861
12985
  isAnonymousModeAllowed,
12862
12986
  isApplicationModeAllowed: true,
12863
12987
  collection,
12864
12988
  createLlmExecutionTools(options) {
12989
+ const { appId, userId } = options;
12990
+ TODO_USE({ appId, userId });
12865
12991
  return llm;
12866
12992
  },
12867
12993
  });
12994
+ keepUnused(server);
12868
12995
  // Note: Already logged by `startRemoteServer`
12869
12996
  // console.error(colors.green(`Server started on port ${port}`));
12870
12997
  return await waitasecond.forEver();
12871
- });
12998
+ }));
12872
12999
  }
12873
13000
  /**
12874
13001
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -12895,7 +13022,7 @@
12895
13022
  testCommand.option('--no-prepare', `Do not prepare the pipelines, ideal when no LLM tools or scrapers available`, true);
12896
13023
  testCommand.option('-r, --reload', `Call LLM models even if same prompt with result is in the cache `, false);
12897
13024
  testCommand.option('-v, --verbose', `Is output verbose`, false);
12898
- testCommand.action(async (filesGlob, { ignore: ignoreRaw = '', validation: isValidated, prepare: isPrepared, reload: isCacheReloaded, verbose: isVerbose, }) => {
13025
+ testCommand.action(handleActionErrors(async (filesGlob, { ignore: ignoreRaw = '', validation: isValidated, prepare: isPrepared, reload: isCacheReloaded, verbose: isVerbose, }) => {
12899
13026
  let tools = undefined;
12900
13027
  if (isPrepared) {
12901
13028
  // TODO: DRY [◽]
@@ -12903,9 +13030,9 @@
12903
13030
  isVerbose,
12904
13031
  isCacheReloaded,
12905
13032
  }; /* <- TODO: ` satisfies PrepareAndScrapeOptions` */
12906
- const fs = $provideFilesystemForNode();
13033
+ const fs = $provideFilesystemForNode(prepareAndScrapeOptions);
12907
13034
  const llm = await $provideLlmToolsForWizzardOrCli(prepareAndScrapeOptions);
12908
- const executables = await $provideExecutablesForNode();
13035
+ const executables = await $provideExecutablesForNode(prepareAndScrapeOptions);
12909
13036
  tools = {
12910
13037
  llm,
12911
13038
  fs,
@@ -12954,7 +13081,7 @@
12954
13081
  }
12955
13082
  console.info(colors__default["default"].green(`All pipelines are valid`));
12956
13083
  return process.exit(0);
12957
- });
13084
+ }));
12958
13085
  }
12959
13086
  /**
12960
13087
  * TODO: [😶] Unite floder listing