@promptbook/remote-client 0.112.0-13 → 0.112.0-15

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.
Files changed (31) hide show
  1. package/esm/index.es.js +42 -42
  2. package/esm/index.es.js.map +1 -1
  3. package/esm/src/cli/cli-commands/coder/{find-fresh-emoji-tag.d.ts → find-fresh-emoji-tags.d.ts} +1 -1
  4. package/esm/src/cli/cli-commands/coder.d.ts +1 -1
  5. package/esm/src/execution/createPipelineExecutor/30-executeFormatSubvalues.d.ts +1 -1
  6. package/esm/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +1 -1
  7. package/esm/src/llm-providers/deepseek/deepseek-models.d.ts +1 -1
  8. package/esm/src/llm-providers/google/google-models.d.ts +1 -1
  9. package/esm/src/llm-providers/openai/openai-models.d.ts +1 -1
  10. package/esm/src/scrapers/_boilerplate/BoilerplateScraper.d.ts +1 -2
  11. package/esm/src/scrapers/document/DocumentScraper.d.ts +1 -2
  12. package/esm/src/scrapers/document-legacy/LegacyDocumentScraper.d.ts +1 -2
  13. package/esm/src/scripting/javascript/postprocessing-functions.d.ts +1 -1
  14. package/esm/src/utils/parameters/mapAvailableToExpectedParameters.d.ts +1 -2
  15. package/esm/src/version.d.ts +1 -1
  16. package/package.json +2 -2
  17. package/umd/index.umd.js +69 -70
  18. package/umd/index.umd.js.map +1 -1
  19. package/umd/src/cli/cli-commands/coder/{find-fresh-emoji-tag.d.ts → find-fresh-emoji-tags.d.ts} +1 -1
  20. package/umd/src/cli/cli-commands/coder.d.ts +1 -1
  21. package/umd/src/execution/createPipelineExecutor/30-executeFormatSubvalues.d.ts +1 -1
  22. package/umd/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +1 -1
  23. package/umd/src/llm-providers/deepseek/deepseek-models.d.ts +1 -1
  24. package/umd/src/llm-providers/google/google-models.d.ts +1 -1
  25. package/umd/src/llm-providers/openai/openai-models.d.ts +1 -1
  26. package/umd/src/scrapers/_boilerplate/BoilerplateScraper.d.ts +1 -2
  27. package/umd/src/scrapers/document/DocumentScraper.d.ts +1 -2
  28. package/umd/src/scrapers/document-legacy/LegacyDocumentScraper.d.ts +1 -2
  29. package/umd/src/scripting/javascript/postprocessing-functions.d.ts +1 -1
  30. package/umd/src/utils/parameters/mapAvailableToExpectedParameters.d.ts +1 -2
  31. package/umd/src/version.d.ts +1 -1
package/esm/index.es.js CHANGED
@@ -1,4 +1,4 @@
1
- import spaceTrim$2, { spaceTrim as spaceTrim$1 } from 'spacetrim';
1
+ import { spaceTrim as spaceTrim$1 } from 'spacetrim';
2
2
  import { randomBytes } from 'crypto';
3
3
  import { io } from 'socket.io-client';
4
4
  import { SHA256 } from 'crypto-js';
@@ -20,7 +20,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
20
20
  * @generated
21
21
  * @see https://github.com/webgptorg/promptbook
22
22
  */
23
- const PROMPTBOOK_ENGINE_VERSION = '0.112.0-13';
23
+ const PROMPTBOOK_ENGINE_VERSION = '0.112.0-15';
24
24
  /**
25
25
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
26
26
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -1361,7 +1361,7 @@ parseInt(process.env.API_REQUEST_TIMEOUT || '90000');
1361
1361
  function getErrorReportUrl(error) {
1362
1362
  const report = {
1363
1363
  title: `🐜 Error report from ${NAME}`,
1364
- body: spaceTrim$2((block) => `
1364
+ body: spaceTrim$1((block) => `
1365
1365
 
1366
1366
 
1367
1367
  \`${error.name || 'Error'}\` has occurred in the [${NAME}], please look into it @${ADMIN_GITHUB_NAME}.
@@ -1520,7 +1520,7 @@ function deserializeError(error, isStackAddedToMessage = true) {
1520
1520
  message = `${name}: ${message}`;
1521
1521
  }
1522
1522
  if (isStackAddedToMessage && stack !== undefined && stack !== '') {
1523
- message = spaceTrim$2((block) => `
1523
+ message = spaceTrim$1((block) => `
1524
1524
  ${block(message)}
1525
1525
 
1526
1526
  Original stack trace:
@@ -1578,7 +1578,7 @@ async function createRemoteClient(options) {
1578
1578
  const remoteServerUrlParsed = new URL(remoteServerUrl);
1579
1579
  if (remoteServerUrlParsed.pathname !== '/' && remoteServerUrlParsed.pathname !== '') {
1580
1580
  remoteServerUrlParsed.pathname = '/';
1581
- throw new Error(spaceTrim$2((block) => `
1581
+ throw new Error(spaceTrim$1((block) => `
1582
1582
  Remote server requires root url \`/\`
1583
1583
 
1584
1584
  You have provided \`remoteServerUrl\`:
@@ -2114,7 +2114,7 @@ const knowledgeCommandParser = {
2114
2114
  */
2115
2115
  parse(input) {
2116
2116
  const { args } = input;
2117
- const knowledgeSourceContent = spaceTrim$2(args[0] || '');
2117
+ const knowledgeSourceContent = spaceTrim$1(args[0] || '');
2118
2118
  if (knowledgeSourceContent === '') {
2119
2119
  throw new ParseError(`Source is not defined`);
2120
2120
  }
@@ -2258,7 +2258,7 @@ const sectionCommandParser = {
2258
2258
  normalized = normalized.split('DIALOGUE').join('DIALOG');
2259
2259
  const taskTypes = SectionTypes.filter((sectionType) => normalized.includes(sectionType.split('_TASK').join('')));
2260
2260
  if (taskTypes.length !== 1) {
2261
- throw new ParseError(spaceTrim$2((block) => `
2261
+ throw new ParseError(spaceTrim$1((block) => `
2262
2262
  Unknown section type "${normalized}"
2263
2263
 
2264
2264
  Supported section types are:
@@ -2278,7 +2278,7 @@ const sectionCommandParser = {
2278
2278
  */
2279
2279
  $applyToTaskJson(command, $taskJson, $pipelineJson) {
2280
2280
  if ($taskJson.isSectionTypeSet === true) {
2281
- throw new ParseError(spaceTrim$2(`
2281
+ throw new ParseError(spaceTrim$1(`
2282
2282
  Section type is already defined in the section.
2283
2283
  It can be defined only once.
2284
2284
  `));
@@ -2700,7 +2700,7 @@ const expectCommandParser = {
2700
2700
  /**
2701
2701
  * Description of the FORMAT command
2702
2702
  */
2703
- description: spaceTrim$2(`
2703
+ description: spaceTrim$1(`
2704
2704
  Expect command describes the desired output of the task *(after post-processing)*
2705
2705
  It can set limits for the maximum/minimum length of the output, measured in characters, words, sentences, paragraphs or some other shape of the output.
2706
2706
  `),
@@ -2774,7 +2774,7 @@ const expectCommandParser = {
2774
2774
  }
2775
2775
  catch (error) {
2776
2776
  assertsError(error);
2777
- throw new ParseError(spaceTrim$2((block) => `
2777
+ throw new ParseError(spaceTrim$1((block) => `
2778
2778
  Invalid FORMAT command
2779
2779
  ${block(error.message)}:
2780
2780
  `));
@@ -2896,7 +2896,7 @@ const CsvFormatParser = {
2896
2896
  const { value, outputParameterName, settings, mapCallback, onProgress } = options;
2897
2897
  const csv = csvParse(value, settings);
2898
2898
  if (csv.errors.length !== 0) {
2899
- throw new CsvFormatError(spaceTrim$2((block) => `
2899
+ throw new CsvFormatError(spaceTrim$1((block) => `
2900
2900
  CSV parsing error
2901
2901
 
2902
2902
  Error(s) from CSV parsing:
@@ -2941,7 +2941,7 @@ const CsvFormatParser = {
2941
2941
  const { value, settings, mapCallback, onProgress } = options;
2942
2942
  const csv = csvParse(value, settings);
2943
2943
  if (csv.errors.length !== 0) {
2944
- throw new CsvFormatError(spaceTrim$2((block) => `
2944
+ throw new CsvFormatError(spaceTrim$1((block) => `
2945
2945
  CSV parsing error
2946
2946
 
2947
2947
  Error(s) from CSV parsing:
@@ -3286,7 +3286,7 @@ function checkSerializableAsJson(options) {
3286
3286
  }
3287
3287
  else if (typeof value === 'object') {
3288
3288
  if (value instanceof Date) {
3289
- throw new UnexpectedError(spaceTrim$2((block) => `
3289
+ throw new UnexpectedError(spaceTrim$1((block) => `
3290
3290
  \`${name}\` is Date
3291
3291
 
3292
3292
  Use \`string_date_iso8601\` instead
@@ -3305,7 +3305,7 @@ function checkSerializableAsJson(options) {
3305
3305
  throw new UnexpectedError(`${name} is RegExp`);
3306
3306
  }
3307
3307
  else if (value instanceof Error) {
3308
- throw new UnexpectedError(spaceTrim$2((block) => `
3308
+ throw new UnexpectedError(spaceTrim$1((block) => `
3309
3309
  \`${name}\` is unserialized Error
3310
3310
 
3311
3311
  Use function \`serializeError\`
@@ -3328,7 +3328,7 @@ function checkSerializableAsJson(options) {
3328
3328
  }
3329
3329
  catch (error) {
3330
3330
  assertsError(error);
3331
- throw new UnexpectedError(spaceTrim$2((block) => `
3331
+ throw new UnexpectedError(spaceTrim$1((block) => `
3332
3332
  \`${name}\` is not serializable
3333
3333
 
3334
3334
  ${block(error.stack || error.message)}
@@ -3360,7 +3360,7 @@ function checkSerializableAsJson(options) {
3360
3360
  }
3361
3361
  }
3362
3362
  else {
3363
- throw new UnexpectedError(spaceTrim$2((block) => `
3363
+ throw new UnexpectedError(spaceTrim$1((block) => `
3364
3364
  \`${name}\` is unknown type
3365
3365
 
3366
3366
  Additional message for \`${name}\`:
@@ -3641,7 +3641,7 @@ function validateParameterName(parameterName) {
3641
3641
  if (!(error instanceof ParseError)) {
3642
3642
  throw error;
3643
3643
  }
3644
- throw new ParseError(spaceTrim$2((block) => `
3644
+ throw new ParseError(spaceTrim$1((block) => `
3645
3645
  ${block(error.message)}
3646
3646
 
3647
3647
  Tried to validate parameter name:
@@ -3700,7 +3700,7 @@ const foreachCommandParser = {
3700
3700
  const assignSign = args[3];
3701
3701
  const formatDefinition = FORMAT_DEFINITIONS.find((formatDefinition) => [formatDefinition.formatName, ...(formatDefinition.aliases || [])].includes(formatName));
3702
3702
  if (formatDefinition === undefined) {
3703
- throw new ParseError(spaceTrim$2((block) => `
3703
+ throw new ParseError(spaceTrim$1((block) => `
3704
3704
  Unsupported format "${formatName}"
3705
3705
 
3706
3706
  Available formats:
@@ -3712,7 +3712,7 @@ const foreachCommandParser = {
3712
3712
  }
3713
3713
  const subvalueParser = formatDefinition.subvalueParsers.find((subvalueParser) => [subvalueParser.subvalueName, ...(subvalueParser.aliases || [])].includes(subformatName));
3714
3714
  if (subvalueParser === undefined) {
3715
- throw new ParseError(spaceTrim$2((block) => `
3715
+ throw new ParseError(spaceTrim$1((block) => `
3716
3716
  Unsupported subformat name "${subformatName}" for format "${formatName}"
3717
3717
 
3718
3718
  Available subformat names for format "${formatDefinition.formatName}":
@@ -3760,7 +3760,7 @@ const foreachCommandParser = {
3760
3760
  outputSubparameterName = 'newLine';
3761
3761
  }
3762
3762
  else {
3763
- throw new ParseError(spaceTrim$2(`
3763
+ throw new ParseError(spaceTrim$1(`
3764
3764
  FOREACH ${formatName} ${subformatName} must specify output subparameter
3765
3765
 
3766
3766
  Correct example:
@@ -3836,7 +3836,7 @@ const formatCommandParser = {
3836
3836
  /**
3837
3837
  * Description of the FORMAT command
3838
3838
  */
3839
- description: spaceTrim$2(`
3839
+ description: spaceTrim$1(`
3840
3840
  Format command describes the desired output of the task (after post-processing)
3841
3841
  It can set limits for the maximum/minimum length of the output, measured in characters, words, sentences, paragraphs or some other shape of the output.
3842
3842
  `),
@@ -4208,7 +4208,7 @@ const formfactorCommandParser = {
4208
4208
  const formfactorNameCandidate = args[0].toUpperCase();
4209
4209
  const formfactor = FORMFACTOR_DEFINITIONS.find((definition) => [definition.name, ...{ aliasNames: [], ...definition }.aliasNames].includes(formfactorNameCandidate));
4210
4210
  if (formfactor === undefined) {
4211
- throw new ParseError(spaceTrim$2((block) => `
4211
+ throw new ParseError(spaceTrim$1((block) => `
4212
4212
  Unknown formfactor name "${formfactorNameCandidate}"
4213
4213
 
4214
4214
  Available formfactors:
@@ -4227,7 +4227,7 @@ const formfactorCommandParser = {
4227
4227
  */
4228
4228
  $applyToPipelineJson(command, $pipelineJson) {
4229
4229
  if ($pipelineJson.formfactorName !== undefined && $pipelineJson.formfactorName !== command.formfactorName) {
4230
- throw new ParseError(spaceTrim$2(`
4230
+ throw new ParseError(spaceTrim$1(`
4231
4231
  Redefinition of \`FORMFACTOR\` in the pipeline head
4232
4232
 
4233
4233
  You have used:
@@ -4375,7 +4375,7 @@ const modelCommandParser = {
4375
4375
  */
4376
4376
  parse(input) {
4377
4377
  const { args, normalized } = input;
4378
- const availableVariantsMessage = spaceTrim$2((block) => `
4378
+ const availableVariantsMessage = spaceTrim$1((block) => `
4379
4379
  Available variants are:
4380
4380
  ${block(MODEL_VARIANTS.map((variantName) => `- ${variantName}${variantName !== 'EMBEDDING' ? '' : ' (Not available in pipeline)'}`).join('\n'))}
4381
4381
  `);
@@ -4397,14 +4397,14 @@ const modelCommandParser = {
4397
4397
  // <- Note: [🤖]
4398
4398
  }
4399
4399
  else if (normalized.startsWith('MODEL_VARIANT_EMBED')) {
4400
- spaceTrim$2((block) => `
4400
+ spaceTrim$1((block) => `
4401
4401
  Embedding model can not be used in pipeline
4402
4402
 
4403
4403
  ${block(availableVariantsMessage)}
4404
4404
  `);
4405
4405
  }
4406
4406
  else {
4407
- throw new ParseError(spaceTrim$2((block) => `
4407
+ throw new ParseError(spaceTrim$1((block) => `
4408
4408
  Unknown model variant in command:
4409
4409
 
4410
4410
  ${block(availableVariantsMessage)}
@@ -4419,7 +4419,7 @@ const modelCommandParser = {
4419
4419
  };
4420
4420
  }
4421
4421
  else {
4422
- throw new ParseError(spaceTrim$2((block) => `
4422
+ throw new ParseError(spaceTrim$1((block) => `
4423
4423
  Unknown model key in command.
4424
4424
 
4425
4425
  Supported model keys are:
@@ -4446,7 +4446,7 @@ const modelCommandParser = {
4446
4446
  // <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
4447
4447
  }
4448
4448
  else {
4449
- throw new ParseError(spaceTrim$2(`
4449
+ throw new ParseError(spaceTrim$1(`
4450
4450
  Redefinition of \`MODEL ${command.key}\` in the pipeline head
4451
4451
 
4452
4452
  You have used:
@@ -4474,7 +4474,7 @@ const modelCommandParser = {
4474
4474
  // <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
4475
4475
  }
4476
4476
  else {
4477
- throw new ParseError(spaceTrim$2(`
4477
+ throw new ParseError(spaceTrim$1(`
4478
4478
  Redefinition of MODEL \`${command.key}\` in the task "${$taskJson.title || $taskJson.name}"
4479
4479
 
4480
4480
  You have used:
@@ -4484,7 +4484,7 @@ const modelCommandParser = {
4484
4484
  }
4485
4485
  }
4486
4486
  if (command.value === ($pipelineJson.defaultModelRequirements || {})[command.key]) {
4487
- console.log(spaceTrim$2(`
4487
+ console.log(spaceTrim$1(`
4488
4488
  Setting MODEL \`${command.key}\` in the task "${$taskJson.title || $taskJson.name}" to the same value as in the pipeline head
4489
4489
 
4490
4490
  In pipeline head:
@@ -4567,7 +4567,7 @@ const parameterCommandParser = {
4567
4567
  // <- TODO: When [🥶] fixed, change to:
4568
4568
  // > const parameterDescriptionRaw = rawArgs.split(parameterNameRaw).join('').trim();
4569
4569
  if (parameterDescriptionRaw && parameterDescriptionRaw.match(/\{(?<embeddedParameterName>[a-z0-9_]+)\}/im)) {
4570
- throw new ParseError(spaceTrim$2((block) => `
4570
+ throw new ParseError(spaceTrim$1((block) => `
4571
4571
  Parameter \`{${parameterNameRaw}}\` can not contain another parameter in description
4572
4572
 
4573
4573
  The description:
@@ -4749,7 +4749,7 @@ function $applyToTaskJson(command, $taskJson, $pipelineJson) {
4749
4749
  persona.description = personaDescription;
4750
4750
  return;
4751
4751
  }
4752
- console.warn(spaceTrim$2(`
4752
+ console.warn(spaceTrim$1(`
4753
4753
 
4754
4754
  Persona "${personaName}" is defined multiple times with different description:
4755
4755
 
@@ -4760,7 +4760,7 @@ function $applyToTaskJson(command, $taskJson, $pipelineJson) {
4760
4760
  ${personaDescription}
4761
4761
 
4762
4762
  `));
4763
- persona.description += spaceTrim$2('\n\n' + personaDescription);
4763
+ persona.description += spaceTrim$1('\n\n' + personaDescription);
4764
4764
  }
4765
4765
 
4766
4766
  /**
@@ -5694,7 +5694,7 @@ function removeMarkdownComments(content) {
5694
5694
  */
5695
5695
  function isFlatPipeline(pipelineString) {
5696
5696
  pipelineString = removeMarkdownComments(pipelineString);
5697
- pipelineString = spaceTrim$2(pipelineString);
5697
+ pipelineString = spaceTrim$1(pipelineString);
5698
5698
  const isMarkdownBeginningWithHeadline = pipelineString.startsWith('# ');
5699
5699
  //const isLastLineReturnStatement = pipelineString.split(/\r?\n/).pop()!.split('`').join('').startsWith('->');
5700
5700
  const isBacktickBlockUsed = pipelineString.includes('```');
@@ -5720,7 +5720,7 @@ function deflatePipeline(pipelineString) {
5720
5720
  if (!isFlatPipeline(pipelineString)) {
5721
5721
  return pipelineString;
5722
5722
  }
5723
- pipelineString = spaceTrim$2(pipelineString);
5723
+ pipelineString = spaceTrim$1(pipelineString);
5724
5724
  const pipelineStringLines = pipelineString.split(/\r?\n/);
5725
5725
  const potentialReturnStatement = pipelineStringLines.pop();
5726
5726
  let returnStatement;
@@ -5733,19 +5733,19 @@ function deflatePipeline(pipelineString) {
5733
5733
  returnStatement = `-> {${DEFAULT_BOOK_OUTPUT_PARAMETER_NAME}}`;
5734
5734
  pipelineStringLines.push(potentialReturnStatement);
5735
5735
  }
5736
- const prompt = spaceTrim$2(pipelineStringLines.join('\n'));
5736
+ const prompt = spaceTrim$1(pipelineStringLines.join('\n'));
5737
5737
  let quotedPrompt;
5738
5738
  if (prompt.split(/\r?\n/).length <= 1) {
5739
5739
  quotedPrompt = `> ${prompt}`;
5740
5740
  }
5741
5741
  else {
5742
- quotedPrompt = spaceTrim$2((block) => `
5742
+ quotedPrompt = spaceTrim$1((block) => `
5743
5743
  \`\`\`
5744
5744
  ${block(prompt.split('`').join('\\`'))}
5745
5745
  \`\`\`
5746
5746
  `);
5747
5747
  }
5748
- pipelineString = validatePipelineString(spaceTrim$2((block) => `
5748
+ pipelineString = validatePipelineString(spaceTrim$1((block) => `
5749
5749
  # ${DEFAULT_BOOK_TITLE}
5750
5750
 
5751
5751
  ## Prompt
@@ -5886,7 +5886,7 @@ function extractAllBlocksFromMarkdown(markdown) {
5886
5886
  function extractOneBlockFromMarkdown(markdown) {
5887
5887
  const codeBlocks = extractAllBlocksFromMarkdown(markdown);
5888
5888
  if (codeBlocks.length !== 1) {
5889
- throw new ParseError(spaceTrim$2((block) => `
5889
+ throw new ParseError(spaceTrim$1((block) => `
5890
5890
  There should be exactly 1 code block in task section, found ${codeBlocks.length} code blocks
5891
5891
 
5892
5892
  ${block(codeBlocks.map((block, i) => `Block ${i + 1}:\n${block.content}`).join('\n\n\n'))}
@@ -5911,7 +5911,7 @@ function parseMarkdownSection(value) {
5911
5911
  }
5912
5912
  const title = lines[0].replace(/^#+\s*/, '');
5913
5913
  const level = (_b = (_a = lines[0].match(/^#+/)) === null || _a === void 0 ? void 0 : _a[0].length) !== null && _b !== void 0 ? _b : 0;
5914
- const content = spaceTrim$2(lines.slice(1).join('\n'));
5914
+ const content = spaceTrim$1(lines.slice(1).join('\n'));
5915
5915
  if (level < 1 || level > 6) {
5916
5916
  throw new ParseError('Markdown section must have heading level between 1 and 6');
5917
5917
  }
@@ -5939,7 +5939,7 @@ function splitMarkdownIntoSections(markdown) {
5939
5939
  if (buffer.length === 0) {
5940
5940
  return;
5941
5941
  }
5942
- let section = spaceTrim$2(buffer.join('\n'));
5942
+ let section = spaceTrim$1(buffer.join('\n'));
5943
5943
  if (section === '') {
5944
5944
  return;
5945
5945
  }
@@ -6014,7 +6014,7 @@ function flattenMarkdown(markdown) {
6014
6014
  flattenedMarkdown += `## ${title}` + `\n\n`;
6015
6015
  flattenedMarkdown += content + `\n\n`; // <- [🧠] Maybe 3 new lines?
6016
6016
  }
6017
- return spaceTrim$2(flattenedMarkdown);
6017
+ return spaceTrim$1(flattenedMarkdown);
6018
6018
  }
6019
6019
  /**
6020
6020
  * TODO: [🏛] This can be part of markdown builder