@promptbook/cli 0.75.0-0 → 0.75.0-1

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.
@@ -59,9 +59,12 @@ import { CsvFormatDefinition } from '../formats/csv/CsvFormatDefinition';
59
59
  import { CsvFormatError } from '../formats/csv/CsvFormatError';
60
60
  import { MANDATORY_CSV_SETTINGS } from '../formats/csv/CsvSettings';
61
61
  import { TextFormatDefinition } from '../formats/text/TextFormatDefinition';
62
+ import { BoilerplateFormfactorDefinition } from '../formfactors/_boilerplate/BoilerplateFormfactorDefinition';
62
63
  import { ChatFormfactorDefinition } from '../formfactors/chat/ChatFormfactorDefinition';
63
64
  import { GenericFormfactorDefinition } from '../formfactors/generic/GenericFormfactorDefinition';
64
65
  import { FORMFACTOR_DEFINITIONS } from '../formfactors/index';
66
+ import { SheetsFormfactorDefinition } from '../formfactors/sheets/SheetsFormfactorDefinition';
67
+ import { TranslatorFormfactorDefinition } from '../formfactors/translator/TranslatorFormfactorDefinition';
65
68
  import { $llmToolsMetadataRegister } from '../llm-providers/_common/register/$llmToolsMetadataRegister';
66
69
  import { $llmToolsRegister } from '../llm-providers/_common/register/$llmToolsRegister';
67
70
  import { createLlmToolsFromConfiguration } from '../llm-providers/_common/register/createLlmToolsFromConfiguration';
@@ -75,6 +78,7 @@ import { MultipleLlmExecutionTools } from '../llm-providers/multiple/MultipleLlm
75
78
  import { _OpenAiMetadataRegistration } from '../llm-providers/openai/register-configuration';
76
79
  import { _OpenAiAssistantMetadataRegistration } from '../llm-providers/openai/register-configuration';
77
80
  import { preparePersona } from '../personas/preparePersona';
81
+ import { GENERIC_PIPELINE_INTERFACE } from '../pipeline/pipeline-interface/constants';
78
82
  import { getPipelineInterface } from '../pipeline/pipeline-interface/getPipelineInterface';
79
83
  import { isPipelineImplementingInterface } from '../pipeline/pipeline-interface/isPipelineImplementingInterface';
80
84
  import { isPipelineInterfacesEqual } from '../pipeline/pipeline-interface/isPipelineInterfacesEqual';
@@ -160,9 +164,12 @@ export { CsvFormatDefinition };
160
164
  export { CsvFormatError };
161
165
  export { MANDATORY_CSV_SETTINGS };
162
166
  export { TextFormatDefinition };
167
+ export { BoilerplateFormfactorDefinition };
163
168
  export { ChatFormfactorDefinition };
164
169
  export { GenericFormfactorDefinition };
165
170
  export { FORMFACTOR_DEFINITIONS };
171
+ export { SheetsFormfactorDefinition };
172
+ export { TranslatorFormfactorDefinition };
166
173
  export { $llmToolsMetadataRegister };
167
174
  export { $llmToolsRegister };
168
175
  export { createLlmToolsFromConfiguration };
@@ -176,6 +183,7 @@ export { MultipleLlmExecutionTools };
176
183
  export { _OpenAiMetadataRegistration };
177
184
  export { _OpenAiAssistantMetadataRegistration };
178
185
  export { preparePersona };
186
+ export { GENERIC_PIPELINE_INTERFACE };
179
187
  export { getPipelineInterface };
180
188
  export { isPipelineImplementingInterface };
181
189
  export { isPipelineInterfacesEqual };
@@ -12,8 +12,8 @@ import { $currentDate } from '../utils/$currentDate';
12
12
  import { $isRunningInBrowser } from '../utils/environment/$isRunningInBrowser';
13
13
  import { $isRunningInNode } from '../utils/environment/$isRunningInNode';
14
14
  import { $isRunningInWebWorker } from '../utils/environment/$isRunningInWebWorker';
15
- import { CHARACTERS_PER_STANDARD_LINE } from '../utils/expectation-counters/config';
16
- import { LINES_PER_STANDARD_PAGE } from '../utils/expectation-counters/config';
15
+ import { CHARACTERS_PER_STANDARD_LINE } from '../utils/expectation-counters/constants';
16
+ import { LINES_PER_STANDARD_PAGE } from '../utils/expectation-counters/constants';
17
17
  import { countCharacters } from '../utils/expectation-counters/countCharacters';
18
18
  import { countLines } from '../utils/expectation-counters/countLines';
19
19
  import { countPages } from '../utils/expectation-counters/countPages';
@@ -192,5 +192,6 @@ export declare const IS_PIPELINE_LOGIC_VALIDATED: boolean;
192
192
  */
193
193
  export declare const IS_COST_PREVENTED: boolean;
194
194
  /**
195
+ * TODO: Extract `constants.ts` from `config.ts`
195
196
  * TODO: [🧠][🧜‍♂️] Maybe join remoteUrl and path into single value
196
197
  */
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Boilerplate is form of app that @@@
3
+ *
4
+ * @public exported from `@promptbook/core`
5
+ */
6
+ export declare const BoilerplateFormfactorDefinition: {
7
+ readonly name: "BOILERPLATE";
8
+ readonly description: "@@@";
9
+ readonly documentationUrl: "https://github.com/webgptorg/promptbook/discussions/@@";
10
+ readonly pipelineInterface: {
11
+ readonly inputParameterNames: readonly [];
12
+ readonly outputParameterNames: readonly [];
13
+ };
14
+ };
@@ -1,7 +1,8 @@
1
- import type { string_SCREAMING_CASE } from '../../utils/normalization/normalizeTo_SCREAMING_CASE';
1
+ import type { PipelineInterface } from '../../pipeline/pipeline-interface/PipelineInterface';
2
2
  import type { string_markdown_text } from '../../types/typeAliases';
3
3
  import type { string_name } from '../../types/typeAliases';
4
4
  import type { string_promptbook_documentation_url } from '../../types/typeAliases';
5
+ import type { string_SCREAMING_CASE } from '../../utils/normalization/normalizeTo_SCREAMING_CASE';
5
6
  /**
6
7
  * @@@
7
8
  */
@@ -26,4 +27,8 @@ export type AbstractFormfactorDefinition = {
26
27
  * @@@
27
28
  */
28
29
  readonly documentationUrl: string_promptbook_documentation_url;
30
+ /**
31
+ * @@@
32
+ */
33
+ readonly pipelineInterface: PipelineInterface;
29
34
  };
@@ -1,4 +1,4 @@
1
- import type { FORMFACTOR_DEFINITIONS } from '../index';
1
+ import { FORMFACTOR_DEFINITIONS } from '../index';
2
2
  /**
3
3
  * @@@
4
4
  */
@@ -4,7 +4,12 @@
4
4
  * @public exported from `@promptbook/core`
5
5
  */
6
6
  export declare const ChatFormfactorDefinition: {
7
- readonly name: "CHAT";
7
+ readonly name: "CHATBOT";
8
+ readonly aliasNames: readonly ["CHAT"];
8
9
  readonly description: "@@@";
9
10
  readonly documentationUrl: "https://github.com/webgptorg/promptbook/discussions/@@";
11
+ readonly pipelineInterface: {
12
+ readonly inputParameterNames: readonly ["previousTitle", "previousConversationSummary", "userMessage"];
13
+ readonly outputParameterNames: readonly ["title", "conversationSummary", "chatbotResponse"];
14
+ };
10
15
  };
@@ -7,4 +7,8 @@ export declare const GenericFormfactorDefinition: {
7
7
  readonly name: "GENERIC";
8
8
  readonly description: "@@@";
9
9
  readonly documentationUrl: "https://github.com/webgptorg/promptbook/discussions/@@";
10
+ readonly pipelineInterface: {
11
+ readonly inputParameterNames: readonly [];
12
+ readonly outputParameterNames: readonly [];
13
+ };
10
14
  };
@@ -7,8 +7,33 @@ export declare const FORMFACTOR_DEFINITIONS: readonly [{
7
7
  readonly name: "GENERIC";
8
8
  readonly description: "@@@";
9
9
  readonly documentationUrl: "https://github.com/webgptorg/promptbook/discussions/@@";
10
+ readonly pipelineInterface: {
11
+ readonly inputParameterNames: readonly [];
12
+ readonly outputParameterNames: readonly [];
13
+ };
10
14
  }, {
11
- readonly name: "CHAT";
15
+ readonly name: "CHATBOT";
16
+ readonly aliasNames: readonly ["CHAT"];
12
17
  readonly description: "@@@";
13
18
  readonly documentationUrl: "https://github.com/webgptorg/promptbook/discussions/@@";
19
+ readonly pipelineInterface: {
20
+ readonly inputParameterNames: readonly ["previousTitle", "previousConversationSummary", "userMessage"];
21
+ readonly outputParameterNames: readonly ["title", "conversationSummary", "chatbotResponse"];
22
+ };
23
+ }, {
24
+ readonly name: "TRANSLATOR";
25
+ readonly description: "@@@";
26
+ readonly documentationUrl: "https://github.com/webgptorg/promptbook/discussions/@@";
27
+ readonly pipelineInterface: {
28
+ readonly inputParameterNames: readonly ["inputMessage"];
29
+ readonly outputParameterNames: readonly ["outputMessage"];
30
+ };
31
+ }, {
32
+ readonly name: "SHEETS";
33
+ readonly description: "@@@";
34
+ readonly documentationUrl: "https://github.com/webgptorg/promptbook/discussions/@@";
35
+ readonly pipelineInterface: {
36
+ readonly inputParameterNames: readonly ["inputSheet"];
37
+ readonly outputParameterNames: readonly ["outputSheet"];
38
+ };
14
39
  }];
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Sheets is form of app that @@@
3
+ *
4
+ * @public exported from `@promptbook/core`
5
+ */
6
+ export declare const SheetsFormfactorDefinition: {
7
+ readonly name: "SHEETS";
8
+ readonly description: "@@@";
9
+ readonly documentationUrl: "https://github.com/webgptorg/promptbook/discussions/@@";
10
+ readonly pipelineInterface: {
11
+ readonly inputParameterNames: readonly ["inputSheet"];
12
+ readonly outputParameterNames: readonly ["outputSheet"];
13
+ };
14
+ };
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Translator is form of app that @@@
3
+ *
4
+ * @public exported from `@promptbook/core`
5
+ */
6
+ export declare const TranslatorFormfactorDefinition: {
7
+ readonly name: "TRANSLATOR";
8
+ readonly description: "@@@";
9
+ readonly documentationUrl: "https://github.com/webgptorg/promptbook/discussions/@@";
10
+ readonly pipelineInterface: {
11
+ readonly inputParameterNames: readonly ["inputMessage"];
12
+ readonly outputParameterNames: readonly ["outputMessage"];
13
+ };
14
+ };
@@ -8,13 +8,13 @@ export type PipelineInterface = {
8
8
  *
9
9
  * Note: Sorted alphabetically
10
10
  */
11
- inputParameterNames: Array<string_parameter_name>;
11
+ readonly inputParameterNames: ReadonlyArray<string_parameter_name>;
12
12
  /**
13
13
  * @@@
14
14
  *
15
15
  * Note: Sorted alphabetically
16
16
  */
17
- outputParameterNames: Array<string_parameter_name>;
17
+ readonly outputParameterNames: ReadonlyArray<string_parameter_name>;
18
18
  };
19
19
  /**
20
20
  * TODO: !!!!!! Change inputParameterNames to inputParameters<InputParameter>
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @@@
3
+ *
4
+ * @public exported from `@promptbook/core`
5
+ */
6
+ export declare const GENERIC_PIPELINE_INTERFACE: {
7
+ readonly inputParameterNames: readonly [];
8
+ readonly outputParameterNames: readonly [];
9
+ };
@@ -10,3 +10,6 @@ export declare const CHARACTERS_PER_STANDARD_LINE = 63;
10
10
  * @public exported from `@promptbook/utils`
11
11
  */
12
12
  export declare const LINES_PER_STANDARD_PAGE = 44;
13
+ /**
14
+ * TODO: [🧠] Should be this `constants.ts` or `config.ts`?
15
+ */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/cli",
3
- "version": "0.75.0-0",
3
+ "version": "0.75.0-1",
4
4
  "description": "Supercharge your use of large language models",
5
5
  "private": false,
6
6
  "sideEffects": false,
package/umd/index.umd.js CHANGED
@@ -49,7 +49,7 @@
49
49
  *
50
50
  * @see https://github.com/webgptorg/promptbook
51
51
  */
52
- var PROMPTBOOK_ENGINE_VERSION = '0.74.0-13';
52
+ var PROMPTBOOK_ENGINE_VERSION = '0.75.0-0';
53
53
  /**
54
54
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
55
55
  */
@@ -569,6 +569,7 @@
569
569
  // Note: In normal situations, we check the pipeline logic:
570
570
  true);
571
571
  /**
572
+ * TODO: Extract `constants.ts` from `config.ts`
572
573
  * TODO: [🧠][🧜‍♂️] Maybe join remoteUrl and path into single value
573
574
  */
574
575
 
@@ -1489,8 +1490,8 @@
1489
1490
  else if (errors.length > 1) {
1490
1491
  throw new PipelineExecutionError(
1491
1492
  // TODO: Tell which execution tools failed like
1492
- // 1) OpenAI throw PipelineExecutionError: Parameter {knowledge} is not defined
1493
- // 2) AnthropicClaude throw PipelineExecutionError: Parameter {knowledge} is not defined
1493
+ // 1) OpenAI throw PipelineExecutionError: Parameter `{knowledge}` is not defined
1494
+ // 2) AnthropicClaude throw PipelineExecutionError: Parameter `{knowledge}` is not defined
1494
1495
  // 3) ...
1495
1496
  spaceTrim__default["default"](function (block) { return "\n All execution tools failed:\n\n ".concat(block(errors
1496
1497
  .map(function (error, i) { return "".concat(i + 1, ") **").concat(error.name || 'Error', ":** ").concat(error.message); })
@@ -1825,18 +1826,18 @@
1825
1826
  }
1826
1827
  var _loop_1 = function (parameter) {
1827
1828
  if (parameter.isInput && parameter.isOutput) {
1828
- throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n\n Parameter {".concat(parameter.name, "} can not be both input and output\n\n ").concat(block(pipelineIdentification), "\n "); }));
1829
+ throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n\n Parameter `{".concat(parameter.name, "}` can not be both input and output\n\n ").concat(block(pipelineIdentification), "\n "); }));
1829
1830
  }
1830
1831
  // Note: Testing that parameter is either intermediate or output BUT not created and unused
1831
1832
  if (!parameter.isInput &&
1832
1833
  !parameter.isOutput &&
1833
1834
  !pipeline.templates.some(function (template) { return template.dependentParameterNames.includes(parameter.name); })) {
1834
- throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n Parameter {".concat(parameter.name, "} is created but not used\n\n You can declare {").concat(parameter.name, "} as output parameter by adding in the header:\n - OUTPUT PARAMETER `{").concat(parameter.name, "}` ").concat(parameter.description || '', "\n\n ").concat(block(pipelineIdentification), "\n\n "); }));
1835
+ throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n Parameter `{".concat(parameter.name, "}` is created but not used\n\n You can declare {").concat(parameter.name, "} as output parameter by adding in the header:\n - OUTPUT PARAMETER `{").concat(parameter.name, "}` ").concat(parameter.description || '', "\n\n ").concat(block(pipelineIdentification), "\n\n "); }));
1835
1836
  }
1836
1837
  // Note: Testing that parameter is either input or result of some template
1837
1838
  if (!parameter.isInput &&
1838
1839
  !pipeline.templates.some(function (template) { return template.resultingParameterName === parameter.name; })) {
1839
- throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n Parameter {".concat(parameter.name, "} is declared but not defined\n\n You can do one of these:\n 1) Remove declaration of {").concat(parameter.name, "}\n 2) Add template that results in -> {").concat(parameter.name, "}\n\n ").concat(block(pipelineIdentification), "\n "); }));
1840
+ throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n Parameter `{".concat(parameter.name, "}` is declared but not defined\n\n You can do one of these:\n 1) Remove declaration of `{").concat(parameter.name, "}`\n 2) Add template that results in `-> {").concat(parameter.name, "}`\n\n ").concat(block(pipelineIdentification), "\n "); }));
1840
1841
  }
1841
1842
  };
1842
1843
  try {
@@ -1864,7 +1865,7 @@
1864
1865
  var _loop_2 = function (template) {
1865
1866
  var e_4, _h, e_5, _j;
1866
1867
  if (definedParameters.has(template.resultingParameterName)) {
1867
- throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n Parameter {".concat(template.resultingParameterName, "} is defined multiple times\n\n ").concat(block(pipelineIdentification), "\n "); }));
1868
+ throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n Parameter `{".concat(template.resultingParameterName, "}` is defined multiple times\n\n ").concat(block(pipelineIdentification), "\n "); }));
1868
1869
  }
1869
1870
  if (RESERVED_PARAMETER_NAMES.includes(template.resultingParameterName)) {
1870
1871
  throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n Parameter name {".concat(template.resultingParameterName, "} is reserved, please use different name\n\n ").concat(block(pipelineIdentification), "\n "); }));
@@ -1877,7 +1878,7 @@
1877
1878
  }
1878
1879
  var _loop_4 = function (joker) {
1879
1880
  if (!template.dependentParameterNames.includes(joker)) {
1880
- throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n Parameter {".concat(joker, "} is used for {").concat(template.resultingParameterName, "} as joker but not in `dependentParameterNames`\n\n ").concat(block(pipelineIdentification), "\n "); }));
1881
+ throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n Parameter `{".concat(joker, "}` is used for {").concat(template.resultingParameterName, "} as joker but not in `dependentParameterNames`\n\n ").concat(block(pipelineIdentification), "\n "); }));
1881
1882
  }
1882
1883
  };
1883
1884
  try {
@@ -1972,14 +1973,24 @@
1972
1973
  if (currentlyResovedTemplates.length === 0) {
1973
1974
  throw new PipelineLogicError(
1974
1975
  // TODO: [🐎] DRY
1975
- spaceTrim.spaceTrim(function (block) { return "\n\n Can not resolve some parameters:\n Either you are using a parameter that is not defined, or there are some circular dependencies.\n\n ".concat(block(pipelineIdentification), "\n\n Can not resolve:\n ").concat(block(unresovedTemplates
1976
+ spaceTrim.spaceTrim(function (block) { return "\n\n Can not resolve some parameters:\n Either you are using a parameter that is not defined, or there are some circular dependencies.\n\n ".concat(block(pipelineIdentification), "\n\n **Can not resolve:**\n ").concat(block(unresovedTemplates
1976
1977
  .map(function (_a) {
1977
1978
  var resultingParameterName = _a.resultingParameterName, dependentParameterNames = _a.dependentParameterNames;
1978
- return "- Parameter {".concat(resultingParameterName, "} which depends on ").concat(dependentParameterNames
1979
- .map(function (dependentParameterName) { return "{".concat(dependentParameterName, "}"); })
1979
+ return "- Parameter `{".concat(resultingParameterName, "}` which depends on ").concat(dependentParameterNames
1980
+ .map(function (dependentParameterName) { return "`{".concat(dependentParameterName, "}`"); })
1980
1981
  .join(' and '));
1981
1982
  })
1982
- .join('\n')), "\n\n Resolved:\n ").concat(block(resovedParameters.map(function (name) { return "- Parameter {".concat(name, "}"); }).join('\n')), "\n\n\n "); }));
1983
+ .join('\n')), "\n\n **Resolved:**\n ").concat(block(resovedParameters
1984
+ .filter(function (name) {
1985
+ return !RESERVED_PARAMETER_NAMES.includes(name);
1986
+ })
1987
+ .map(function (name) { return "- Parameter `{".concat(name, "}`"); })
1988
+ .join('\n')), "\n\n\n **Reserved (which are available):**\n ").concat(block(resovedParameters
1989
+ .filter(function (name) {
1990
+ return RESERVED_PARAMETER_NAMES.includes(name);
1991
+ })
1992
+ .map(function (name) { return "- Parameter `{".concat(name, "}`"); })
1993
+ .join('\n')), "\n\n\n "); }));
1983
1994
  }
1984
1995
  resovedParameters = __spreadArray(__spreadArray([], __read(resovedParameters), false), __read(currentlyResovedTemplates.map(function (_a) {
1985
1996
  var resultingParameterName = _a.resultingParameterName;
@@ -1990,6 +2001,7 @@
1990
2001
  while (unresovedTemplates.length > 0) {
1991
2002
  _loop_3();
1992
2003
  }
2004
+ // TODO: !!!!!! Test that pipeline interface implements declared formfactor interface
1993
2005
  }
1994
2006
  /**
1995
2007
  * TODO: !! [🧞‍♀️] Do not allow joker + foreach
@@ -3122,11 +3134,11 @@
3122
3134
  for (var _b = __values(Object.entries(parameters)), _c = _b.next(); !_c.done; _c = _b.next()) {
3123
3135
  var _d = __read(_c.value, 2), parameterName = _d[0], parameterValue = _d[1];
3124
3136
  if (parameterValue === RESERVED_PARAMETER_MISSING_VALUE) {
3125
- throw new UnexpectedError("Parameter {".concat(parameterName, "} has missing value"));
3137
+ throw new UnexpectedError("Parameter `{".concat(parameterName, "}` has missing value"));
3126
3138
  }
3127
3139
  else if (parameterValue === RESERVED_PARAMETER_RESTRICTED) {
3128
3140
  // TODO: [🍵]
3129
- throw new UnexpectedError("Parameter {".concat(parameterName, "} is restricted to use"));
3141
+ throw new UnexpectedError("Parameter `{".concat(parameterName, "}` is restricted to use"));
3130
3142
  }
3131
3143
  }
3132
3144
  }
@@ -3153,11 +3165,11 @@
3153
3165
  throw new PipelineExecutionError('Parameter is already opened or not closed');
3154
3166
  }
3155
3167
  if (parameters[parameterName] === undefined) {
3156
- throw new PipelineExecutionError("Parameter {".concat(parameterName, "} is not defined"));
3168
+ throw new PipelineExecutionError("Parameter `{".concat(parameterName, "}` is not defined"));
3157
3169
  }
3158
3170
  var parameterValue = parameters[parameterName];
3159
3171
  if (parameterValue === undefined) {
3160
- throw new PipelineExecutionError("Parameter {".concat(parameterName, "} is not defined"));
3172
+ throw new PipelineExecutionError("Parameter `{".concat(parameterName, "}` is not defined"));
3161
3173
  }
3162
3174
  parameterValue = parameterValue.toString();
3163
3175
  if (parameterValue.includes('\n') && /^\s*\W{0,3}\s*$/.test(precol)) {
@@ -3213,6 +3225,9 @@
3213
3225
  * @public exported from `@promptbook/utils`
3214
3226
  */
3215
3227
  var LINES_PER_STANDARD_PAGE = 44;
3228
+ /**
3229
+ * TODO: [🧠] Should be this `constants.ts` or `config.ts`?
3230
+ */
3216
3231
 
3217
3232
  /**
3218
3233
  * Counts number of lines in the text
@@ -4205,7 +4220,7 @@
4205
4220
  else if (!definedParameterNames.has(parameterName) && usedParameterNames.has(parameterName)) {
4206
4221
  // Houston, we have a problem
4207
4222
  // Note: Checking part is also done in `validatePipeline`, but it’s good to doublecheck
4208
- throw new UnexpectedError(spaceTrim.spaceTrim(function (block) { return "\n Parameter {".concat(parameterName, "} is NOT defined\n BUT used in template \"").concat(currentTemplate.title || currentTemplate.name, "\"\n\n This should be catched in `validatePipeline`\n\n ").concat(block(pipelineIdentification), "\n\n "); }));
4223
+ throw new UnexpectedError(spaceTrim.spaceTrim(function (block) { return "\n Parameter `{".concat(parameterName, "}` is NOT defined\n BUT used in template \"").concat(currentTemplate.title || currentTemplate.name, "\"\n\n This should be catched in `validatePipeline`\n\n ").concat(block(pipelineIdentification), "\n\n "); }));
4209
4224
  }
4210
4225
  };
4211
4226
  try {
@@ -4284,7 +4299,7 @@
4284
4299
  var _loop_1 = function (parameter) {
4285
4300
  if (parametersToPass[parameter.name] === undefined) {
4286
4301
  // [4]
4287
- $warnings.push(new PipelineExecutionError(spaceTrim.spaceTrim(function (block) { return "\n Parameter {".concat(parameter.name, "} should be an output parameter, but it was not generated during pipeline execution\n\n ").concat(block(pipelineIdentification), "\n "); })));
4302
+ $warnings.push(new PipelineExecutionError(spaceTrim.spaceTrim(function (block) { return "\n Parameter `{".concat(parameter.name, "}` should be an output parameter, but it was not generated during pipeline execution\n\n ").concat(block(pipelineIdentification), "\n "); })));
4288
4303
  return "continue";
4289
4304
  }
4290
4305
  outputParameters[parameter.name] = parametersToPass[parameter.name] || '';
@@ -4371,7 +4386,7 @@
4371
4386
  case 6: return [2 /*return*/, $asDeeplyFrozenSerializableJson("Unuccessful PipelineExecutorResult (with missing parameter {".concat(parameter.name, "}) PipelineExecutorResult"), {
4372
4387
  isSuccessful: false,
4373
4388
  errors: __spreadArray([
4374
- new PipelineExecutionError("Parameter {".concat(parameter.name, "} is required as an input parameter"))
4389
+ new PipelineExecutionError("Parameter `{".concat(parameter.name, "}` is required as an input parameter"))
4375
4390
  ], __read(errors), false).map(serializeError),
4376
4391
  warnings: [],
4377
4392
  executionReport: executionReport,
@@ -4419,7 +4434,7 @@
4419
4434
  case 3: return [2 /*return*/, { value: $asDeeplyFrozenSerializableJson(spaceTrim.spaceTrim(function (block) { return "\n Unuccessful PipelineExecutorResult (with extra parameter {".concat(parameter.name, "}) PipelineExecutorResult\n\n ").concat(block(pipelineIdentification), "\n "); }), {
4420
4435
  isSuccessful: false,
4421
4436
  errors: __spreadArray([
4422
- new PipelineExecutionError(spaceTrim.spaceTrim(function (block) { return "\n Parameter {".concat(parameter.name, "} is passed as input parameter but it is not input\n\n ").concat(block(pipelineIdentification), "\n "); }))
4437
+ new PipelineExecutionError(spaceTrim.spaceTrim(function (block) { return "\n Parameter `{".concat(parameter.name, "}` is passed as input parameter but it is not input\n\n ").concat(block(pipelineIdentification), "\n "); }))
4423
4438
  ], __read(errors), false).map(serializeError),
4424
4439
  warnings: warnings.map(serializeError),
4425
4440
  executionReport: executionReport,
@@ -4493,14 +4508,24 @@
4493
4508
  if (!(!currentTemplate && resolving_1.length === 0)) return [3 /*break*/, 1];
4494
4509
  throw new UnexpectedError(
4495
4510
  // TODO: [🐎] DRY
4496
- spaceTrim.spaceTrim(function (block) { return "\n Can not resolve some parameters:\n\n ".concat(block(pipelineIdentification), "\n\n Can not resolve:\n ").concat(block(unresovedTemplates_1
4511
+ spaceTrim.spaceTrim(function (block) { return "\n Can not resolve some parameters:\n\n ".concat(block(pipelineIdentification), "\n\n **Can not resolve:**\n ").concat(block(unresovedTemplates_1
4497
4512
  .map(function (_a) {
4498
4513
  var resultingParameterName = _a.resultingParameterName, dependentParameterNames = _a.dependentParameterNames;
4499
- return "- Parameter {".concat(resultingParameterName, "} which depends on ").concat(dependentParameterNames
4500
- .map(function (dependentParameterName) { return "{".concat(dependentParameterName, "}"); })
4514
+ return "- Parameter `{".concat(resultingParameterName, "}` which depends on ").concat(dependentParameterNames
4515
+ .map(function (dependentParameterName) { return "`{".concat(dependentParameterName, "}`"); })
4501
4516
  .join(' and '));
4502
4517
  })
4503
- .join('\n')), "\n\n Resolved:\n ").concat(block(resovedParameterNames_1.map(function (name) { return "- Parameter {".concat(name, "}"); }).join('\n')), "\n\n Note: This should be catched in `validatePipeline`\n "); }));
4518
+ .join('\n')), "\n\n **Resolved:**\n ").concat(block(resovedParameterNames_1
4519
+ .filter(function (name) {
4520
+ return !RESERVED_PARAMETER_NAMES.includes(name);
4521
+ })
4522
+ .map(function (name) { return "- Parameter `{".concat(name, "}`"); })
4523
+ .join('\n')), "\n\n **Reserved (which are available):**\n ").concat(block(resovedParameterNames_1
4524
+ .filter(function (name) {
4525
+ return RESERVED_PARAMETER_NAMES.includes(name);
4526
+ })
4527
+ .map(function (name) { return "- Parameter `{".concat(name, "}`"); })
4528
+ .join('\n')), "\n\n *Note: This should be catched in `validatePipeline`*\n "); }));
4504
4529
  case 1:
4505
4530
  if (!!currentTemplate) return [3 /*break*/, 3];
4506
4531
  /* [🤹‍♂️] */ return [4 /*yield*/, Promise.race(resolving_1)];
@@ -6717,9 +6742,35 @@
6717
6742
  * @public exported from `@promptbook/core`
6718
6743
  */
6719
6744
  var ChatFormfactorDefinition = {
6720
- name: 'CHAT',
6745
+ name: 'CHATBOT',
6746
+ aliasNames: ['CHAT'],
6721
6747
  description: "@@@",
6722
6748
  documentationUrl: "https://github.com/webgptorg/promptbook/discussions/@@",
6749
+ pipelineInterface: {
6750
+ inputParameterNames: ['previousTitle', 'previousConversationSummary', 'userMessage'],
6751
+ outputParameterNames: ['title', 'conversationSummary', 'chatbotResponse'],
6752
+ /*
6753
+ <- TODO: !!!!!! Change to
6754
+
6755
+ - INPUT PARAMETER `{previousTitle}` Previous title of the conversation
6756
+ - INPUT PARAMETER `{previousConversationSummary}` Previous conversation summary
6757
+ - INPUT PARAMETER `{userMessage}` User message
6758
+ - OUTPUT PARAMETER `{title}` Title of the conversation
6759
+ - OUTPUT PARAMETER `{conversationSummary}` Summary of the conversation
6760
+ - OUTPUT PARAMETER `{chatbotResponse}` Chatbot response
6761
+
6762
+ */
6763
+ },
6764
+ };
6765
+
6766
+ /**
6767
+ * @@@
6768
+ *
6769
+ * @public exported from `@promptbook/core`
6770
+ */
6771
+ var GENERIC_PIPELINE_INTERFACE = {
6772
+ inputParameterNames: [],
6773
+ outputParameterNames: [],
6723
6774
  };
6724
6775
 
6725
6776
  /**
@@ -6731,6 +6782,37 @@
6731
6782
  name: 'GENERIC',
6732
6783
  description: "@@@",
6733
6784
  documentationUrl: "https://github.com/webgptorg/promptbook/discussions/@@",
6785
+ pipelineInterface: GENERIC_PIPELINE_INTERFACE,
6786
+ };
6787
+
6788
+ /**
6789
+ * Sheets is form of app that @@@
6790
+ *
6791
+ * @public exported from `@promptbook/core`
6792
+ */
6793
+ var SheetsFormfactorDefinition = {
6794
+ name: 'SHEETS',
6795
+ description: "@@@",
6796
+ documentationUrl: "https://github.com/webgptorg/promptbook/discussions/@@",
6797
+ pipelineInterface: {
6798
+ inputParameterNames: ['inputSheet'],
6799
+ outputParameterNames: ['outputSheet'],
6800
+ },
6801
+ };
6802
+
6803
+ /**
6804
+ * Translator is form of app that @@@
6805
+ *
6806
+ * @public exported from `@promptbook/core`
6807
+ */
6808
+ var TranslatorFormfactorDefinition = {
6809
+ name: 'TRANSLATOR',
6810
+ description: "@@@",
6811
+ documentationUrl: "https://github.com/webgptorg/promptbook/discussions/@@",
6812
+ pipelineInterface: {
6813
+ inputParameterNames: ['inputMessage'],
6814
+ outputParameterNames: ['outputMessage'],
6815
+ },
6734
6816
  };
6735
6817
 
6736
6818
  /**
@@ -6738,7 +6820,12 @@
6738
6820
  *
6739
6821
  * @public exported from `@promptbook/core`
6740
6822
  */
6741
- var FORMFACTOR_DEFINITIONS = [GenericFormfactorDefinition, ChatFormfactorDefinition];
6823
+ var FORMFACTOR_DEFINITIONS = [
6824
+ GenericFormfactorDefinition,
6825
+ ChatFormfactorDefinition,
6826
+ TranslatorFormfactorDefinition,
6827
+ SheetsFormfactorDefinition,
6828
+ ];
6742
6829
 
6743
6830
  /**
6744
6831
  * Parses the formfactor command
@@ -6773,7 +6860,7 @@
6773
6860
  /**
6774
6861
  * Example usages of the FORMFACTOR command
6775
6862
  */
6776
- examples: ['FORMFACTOR Chat', 'FORMFACTOR Generic'],
6863
+ examples: ['FORMFACTOR Chatbot', 'FF Chat'],
6777
6864
  /**
6778
6865
  * Parses the FORMFACTOR command
6779
6866
  */
@@ -6782,16 +6869,19 @@
6782
6869
  if (args.length !== 1) {
6783
6870
  throw new ParseError("FORMFACTOR command requires exactly one argument");
6784
6871
  }
6785
- var formfactorName = args[0].toUpperCase();
6786
- if (!FORMFACTOR_DEFINITIONS.some(function (definition) { return definition.name === formfactorName; })) {
6787
- throw new ParseError(spaceTrim__default["default"](function (block) { return "\n Unknown formfactor name \"".concat(formfactorName, "\"\n\n Available formfactors:\n ").concat(block(FORMFACTOR_DEFINITIONS.map(function (_a) {
6872
+ var formfactorNameCandidate = args[0].toUpperCase();
6873
+ var formfactor = FORMFACTOR_DEFINITIONS.find(function (definition) {
6874
+ return __spreadArray([definition.name], __read(__assign({ aliasNames: [] }, definition).aliasNames), false).includes(formfactorNameCandidate);
6875
+ });
6876
+ if (formfactor === undefined) {
6877
+ throw new ParseError(spaceTrim__default["default"](function (block) { return "\n Unknown formfactor name \"".concat(formfactorNameCandidate, "\"\n\n Available formfactors:\n ").concat(block(FORMFACTOR_DEFINITIONS.map(function (_a) {
6788
6878
  var name = _a.name;
6789
6879
  return "- ".concat(name);
6790
6880
  }).join('\n')), "\n "); }));
6791
6881
  }
6792
6882
  return {
6793
6883
  type: 'FORMFACTOR',
6794
- formfactorName: formfactorName,
6884
+ formfactorName: formfactor.name,
6795
6885
  };
6796
6886
  },
6797
6887
  /**
@@ -7091,7 +7181,7 @@
7091
7181
  // <- TODO: When [🥶] fixed, change to:
7092
7182
  // > const parameterDescriptionRaw = rawArgs.split(parameterNameRaw).join('').trim();
7093
7183
  if (parameterDescriptionRaw && parameterDescriptionRaw.match(/\{(?<embeddedParameterName>[a-z0-9_]+)\}/im)) {
7094
- throw new ParseError(spaceTrim__default["default"](function (block) { return "\n Parameter {".concat(parameterNameRaw, "} can not contain another parameter in description\n\n The description:\n ").concat(block(parameterDescriptionRaw), "\n "); }));
7184
+ throw new ParseError(spaceTrim__default["default"](function (block) { return "\n Parameter `{".concat(parameterNameRaw, "}` can not contain another parameter in description\n\n The description:\n ").concat(block(parameterDescriptionRaw), "\n "); }));
7095
7185
  }
7096
7186
  var isInput = normalized.startsWith('INPUT');
7097
7187
  var isOutput = normalized.startsWith('OUTPUT');
@@ -8137,7 +8227,7 @@
8137
8227
  existingParameter.description &&
8138
8228
  existingParameter.description !== parameterDescription &&
8139
8229
  parameterDescription) {
8140
- throw new ParseError(spaceTrim.spaceTrim(function (block) { return "\n Parameter {".concat(parameterName, "} is defined multiple times with different description:\n\n ").concat(block(getPipelineIdentification()), "\n\n First definition:\n ").concat(block(existingParameter.description || '[undefined]'), "\n\n Second definition:\n ").concat(block(parameterDescription || '[undefined]'), "\n "); }));
8230
+ throw new ParseError(spaceTrim.spaceTrim(function (block) { return "\n Parameter `{".concat(parameterName, "}` is defined multiple times with different description:\n\n ").concat(block(getPipelineIdentification()), "\n\n First definition:\n ").concat(block(existingParameter.description || '[undefined]'), "\n\n Second definition:\n ").concat(block(parameterDescription || '[undefined]'), "\n "); }));
8141
8231
  }
8142
8232
  if (existingParameter) {
8143
8233
  if (parameterDescription) {
@@ -9513,10 +9603,10 @@
9513
9603
  /*
9514
9604
  Note: Remapping error
9515
9605
  From: [PipelineUrlError: thing is not defined],
9516
- To: [PipelineExecutionError: Parameter {thing} is not defined],
9606
+ To: [PipelineExecutionError: Parameter `{thing}` is not defined],
9517
9607
  */
9518
9608
  if (!statementToEvaluate.includes(undefinedName_1 + '(')) {
9519
- throw new PipelineExecutionError(spaceTrim__default["default"](function (block) { return "\n\n Parameter {".concat(undefinedName_1, "} is not defined\n\n This happen during evaluation of the javascript, which has access to the following parameters as javascript variables:\n\n ").concat(block(Object.keys(parameters)
9609
+ throw new PipelineExecutionError(spaceTrim__default["default"](function (block) { return "\n\n Parameter `{".concat(undefinedName_1, "}` is not defined\n\n This happen during evaluation of the javascript, which has access to the following parameters as javascript variables:\n\n ").concat(block(Object.keys(parameters)
9520
9610
  .map(function (key) { return " - ".concat(key, "\n"); })
9521
9611
  .join('')), "\n\n The script is:\n ```javascript\n ").concat(block(script), "\n ```\n\n Original error message:\n ").concat(block(error_1.message), "\n\n\n "); }));
9522
9612
  }