@promptbook/remote-client 0.84.0-13 → 0.84.0-14

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.
@@ -12,6 +12,8 @@ import { LOGO_LIGHT_SRC } from '../config';
12
12
  import { LOGO_DARK_SRC } from '../config';
13
13
  import { DEFAULT_BOOK_TITLE } from '../config';
14
14
  import { DEFAULT_TASK_TITLE } from '../config';
15
+ import { DEFAULT_PROMPT_TASK_TITLE } from '../config';
16
+ import { DEFAULT_BOOK_OUTPUT_PARAMETER_NAME } from '../config';
15
17
  import { MAX_FILENAME_LENGTH } from '../config';
16
18
  import { DEFAULT_INTERMEDIATE_FILES_STRATEGY } from '../config';
17
19
  import { DEFAULT_MAX_PARALLEL_COUNT } from '../config';
@@ -139,6 +141,8 @@ export { LOGO_LIGHT_SRC };
139
141
  export { LOGO_DARK_SRC };
140
142
  export { DEFAULT_BOOK_TITLE };
141
143
  export { DEFAULT_TASK_TITLE };
144
+ export { DEFAULT_PROMPT_TASK_TITLE };
145
+ export { DEFAULT_BOOK_OUTPUT_PARAMETER_NAME };
142
146
  export { MAX_FILENAME_LENGTH };
143
147
  export { DEFAULT_INTERMEDIATE_FILES_STRATEGY };
144
148
  export { DEFAULT_MAX_PARALLEL_COUNT };
@@ -65,6 +65,18 @@ export declare const DEFAULT_BOOK_TITLE = "\u2728 Untitled Book";
65
65
  * @public exported from `@promptbook/core`
66
66
  */
67
67
  export declare const DEFAULT_TASK_TITLE = "Task";
68
+ /**
69
+ * When the title of the prompt task is not provided, the default title is used
70
+ *
71
+ * @public exported from `@promptbook/core`
72
+ */
73
+ export declare const DEFAULT_PROMPT_TASK_TITLE = "Prompt";
74
+ /**
75
+ * When the pipeline is flat and no name of return parameter is provided, this name is used
76
+ *
77
+ * @public exported from `@promptbook/core`
78
+ */
79
+ export declare const DEFAULT_BOOK_OUTPUT_PARAMETER_NAME = "result";
68
80
  /**
69
81
  * Warning message for the generated sections and files files
70
82
  *
@@ -0,0 +1,10 @@
1
+ import type { string_file_extension } from '../../types/typeAliases';
2
+ import type { string_mime_type } from '../../types/typeAliases';
3
+ /**
4
+ * Convert mime type to file extension
5
+ *
6
+ * Note: If the mime type is invalid, `null` is returned
7
+ *
8
+ * @private within the repository
9
+ */
10
+ export declare function mimeTypeToExtension(value: string_mime_type): string_file_extension | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/remote-client",
3
- "version": "0.84.0-13",
3
+ "version": "0.84.0-14",
4
4
  "description": "It's time for a paradigm shift. The future of software in plain English, French or Latin",
5
5
  "--note-0": " <- [🐊]",
6
6
  "private": false,
@@ -54,7 +54,7 @@
54
54
  "module": "./esm/index.es.js",
55
55
  "typings": "./esm/typings/src/_packages/remote-client.index.d.ts",
56
56
  "peerDependencies": {
57
- "@promptbook/core": "0.84.0-13"
57
+ "@promptbook/core": "0.84.0-14"
58
58
  },
59
59
  "dependencies": {
60
60
  "crypto-js": "4.2.0",
package/umd/index.umd.js CHANGED
@@ -23,7 +23,7 @@
23
23
  * @generated
24
24
  * @see https://github.com/webgptorg/promptbook
25
25
  */
26
- var PROMPTBOOK_ENGINE_VERSION = '0.84.0-12';
26
+ var PROMPTBOOK_ENGINE_VERSION = '0.84.0-13';
27
27
  /**
28
28
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
29
29
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -434,6 +434,12 @@
434
434
  * @public exported from `@promptbook/core`
435
435
  */
436
436
  var DEFAULT_TASK_TITLE = "Task";
437
+ /**
438
+ * When the pipeline is flat and no name of return parameter is provided, this name is used
439
+ *
440
+ * @public exported from `@promptbook/core`
441
+ */
442
+ var DEFAULT_BOOK_OUTPUT_PARAMETER_NAME = 'result';
437
443
  /**
438
444
  * Timeout for the connections in milliseconds
439
445
  *
@@ -4584,12 +4590,15 @@
4584
4590
  pipelineString = removeMarkdownComments(pipelineString);
4585
4591
  pipelineString = spaceTrim__default["default"](pipelineString);
4586
4592
  var isMarkdownBeginningWithHeadline = pipelineString.startsWith('# ');
4587
- var isLastLineReturnStatement = pipelineString.split('\n').pop().split('`').join('').startsWith('->');
4588
- // TODO: Also (double)check
4593
+ //const isLastLineReturnStatement = pipelineString.split('\n').pop()!.split('`').join('').startsWith('->');
4594
+ var isBacktickBlockUsed = pipelineString.includes('```');
4595
+ var isQuoteBlocksUsed = /^>\s+/m.test(pipelineString);
4596
+ var isBlocksUsed = isBacktickBlockUsed || isQuoteBlocksUsed;
4597
+ // TODO: [🧉] Also (double)check
4589
4598
  // > const usedCommands
4590
4599
  // > const isBlocksUsed
4591
4600
  // > const returnStatementCount
4592
- var isFlat = !isMarkdownBeginningWithHeadline && isLastLineReturnStatement;
4601
+ var isFlat = !isMarkdownBeginningWithHeadline && !isBlocksUsed; /* && isLastLineReturnStatement */
4593
4602
  return isFlat;
4594
4603
  }
4595
4604
 
@@ -4603,9 +4612,26 @@
4603
4612
  return pipelineString;
4604
4613
  }
4605
4614
  var pipelineStringLines = pipelineString.split('\n');
4606
- var returnStatement = pipelineStringLines.pop();
4615
+ var potentialReturnStatement = pipelineStringLines.pop();
4616
+ var returnStatement;
4617
+ if (/(-|=)>\s*\{.*\}/.test(potentialReturnStatement)) {
4618
+ // Note: Last line is return statement
4619
+ returnStatement = potentialReturnStatement;
4620
+ }
4621
+ else {
4622
+ // Note: Last line is not a return statement
4623
+ returnStatement = "-> {".concat(DEFAULT_BOOK_OUTPUT_PARAMETER_NAME, "}");
4624
+ pipelineStringLines.push(potentialReturnStatement);
4625
+ }
4607
4626
  var prompt = spaceTrim__default["default"](pipelineStringLines.join('\n'));
4608
- pipelineString = validatePipelineString(spaceTrim__default["default"](function (block) { return "\n # ".concat(DEFAULT_BOOK_TITLE, "\n\n ## Prompt\n\n ```\n ").concat(block(prompt), "\n ```\n\n ").concat(returnStatement, "\n "); }));
4627
+ var quotedPrompt;
4628
+ if (prompt.split('\n').length <= 1) {
4629
+ quotedPrompt = "> ".concat(prompt);
4630
+ }
4631
+ else {
4632
+ quotedPrompt = spaceTrim__default["default"](function (block) { return "\n ```\n ".concat(block(prompt.split('`').join('\\`')), "\n ```\n "); });
4633
+ }
4634
+ pipelineString = validatePipelineString(spaceTrim__default["default"](function (block) { return "\n # ".concat(DEFAULT_BOOK_TITLE, "\n\n ## Prompt\n\n ").concat(block(quotedPrompt), "\n\n ").concat(returnStatement, "\n "); }));
4609
4635
  // <- TODO: Maybe use book` notation
4610
4636
  return pipelineString;
4611
4637
  }