@promptbook/node 0.84.0-9 → 0.84.0
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/README.md +21 -9
- package/esm/index.es.js +446 -255
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/cli.index.d.ts +4 -0
- package/esm/typings/src/_packages/core.index.d.ts +12 -2
- package/esm/typings/src/_packages/deepseek.index.d.ts +8 -0
- package/esm/typings/src/_packages/types.index.d.ts +2 -0
- package/esm/typings/src/_packages/utils.index.d.ts +2 -0
- package/esm/typings/src/_packages/wizzard.index.d.ts +4 -0
- package/esm/typings/src/cli/cli-commands/about.d.ts +4 -1
- package/esm/typings/src/cli/cli-commands/hello.d.ts +3 -1
- package/esm/typings/src/cli/cli-commands/list-models.d.ts +3 -1
- package/esm/typings/src/cli/cli-commands/list-scrapers.d.ts +13 -0
- package/esm/typings/src/cli/cli-commands/make.d.ts +3 -1
- package/esm/typings/src/cli/cli-commands/prettify.d.ts +3 -1
- package/esm/typings/src/cli/cli-commands/run.d.ts +3 -1
- package/esm/typings/src/cli/cli-commands/runInteractiveChatbot.d.ts +1 -1
- package/esm/typings/src/cli/cli-commands/test-command.d.ts +3 -1
- package/esm/typings/src/config.d.ts +27 -1
- package/esm/typings/src/conversion/compilePipelineOnRemoteServer.d.ts +1 -1
- package/esm/typings/src/execution/FilesystemTools.d.ts +1 -1
- package/esm/typings/src/execution/assertsExecutionSuccessful.d.ts +3 -1
- package/esm/typings/src/llm-providers/_common/register/$registeredLlmToolsMessage.d.ts +9 -0
- package/esm/typings/src/llm-providers/deepseek/DeepseekExecutionToolsOptions.d.ts +9 -0
- package/esm/typings/src/llm-providers/deepseek/createDeepseekExecutionTools.d.ts +14 -0
- package/esm/typings/src/llm-providers/deepseek/register-configuration.d.ts +14 -0
- package/esm/typings/src/llm-providers/deepseek/register-constructor.d.ts +15 -0
- package/esm/typings/src/pipeline/book-notation.d.ts +3 -2
- package/esm/typings/src/pipeline/prompt-notation.d.ts +18 -5
- package/esm/typings/src/prepare/preparePipelineOnRemoteServer.d.ts +1 -1
- package/esm/typings/src/remote-server/socket-types/_subtypes/PromptbookServer_Identification.d.ts +5 -2
- package/esm/typings/src/utils/editable/edit-pipeline-string/deflatePipeline.test.d.ts +1 -0
- package/esm/typings/src/utils/editable/utils/isFlatPipeline.test.d.ts +1 -0
- package/esm/typings/src/utils/environment/$isRunningInBrowser.d.ts +3 -0
- package/esm/typings/src/utils/environment/$isRunningInJest.d.ts +3 -0
- package/esm/typings/src/utils/environment/$isRunningInNode.d.ts +3 -0
- package/esm/typings/src/utils/environment/$isRunningInWebWorker.d.ts +3 -0
- package/esm/typings/src/utils/files/mimeTypeToExtension.d.ts +10 -0
- package/esm/typings/src/utils/files/mimeTypeToExtension.test.d.ts +1 -0
- package/esm/typings/src/wizzard/wizzard.d.ts +7 -1
- package/package.json +9 -16
- package/umd/index.umd.js +447 -256
- package/umd/index.umd.js.map +1 -1
package/umd/index.umd.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('colors'), require('fs/promises'), require('path'), require('spacetrim'), require('prettier'), require('prettier/parser-html'), require('waitasecond'), require('papaparse'), require('crypto-js'), require('crypto-js/
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', 'colors', 'fs/promises', 'path', 'spacetrim', 'prettier', 'prettier/parser-html', 'waitasecond', 'papaparse', 'crypto-js', 'crypto-js/
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-node"] = {}, global.colors, global.promises, global.path, global.spaceTrim, global.prettier, global.parserHtml, global.waitasecond, global.papaparse, global.
|
|
5
|
-
})(this, (function (exports, colors, promises, path, spaceTrim, prettier, parserHtml, waitasecond, papaparse,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('colors'), require('fs/promises'), require('path'), require('spacetrim'), require('prettier'), require('prettier/parser-html'), require('waitasecond'), require('papaparse'), require('crypto-js/enc-hex'), require('crypto-js/sha256'), require('crypto-js'), require('mime-types'), require('child_process'), require('dotenv')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', 'colors', 'fs/promises', 'path', 'spacetrim', 'prettier', 'prettier/parser-html', 'waitasecond', 'papaparse', 'crypto-js/enc-hex', 'crypto-js/sha256', 'crypto-js', 'mime-types', 'child_process', 'dotenv'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-node"] = {}, global.colors, global.promises, global.path, global.spaceTrim, global.prettier, global.parserHtml, global.waitasecond, global.papaparse, global.hexEncoder, global.sha256, global.cryptoJs, global.mimeTypes, global.child_process, global.dotenv));
|
|
5
|
+
})(this, (function (exports, colors, promises, path, spaceTrim, prettier, parserHtml, waitasecond, papaparse, hexEncoder, sha256, cryptoJs, mimeTypes, child_process, dotenv) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
var spaceTrim__default = /*#__PURE__*/_interopDefaultLegacy(spaceTrim);
|
|
29
29
|
var parserHtml__default = /*#__PURE__*/_interopDefaultLegacy(parserHtml);
|
|
30
30
|
var hexEncoder__default = /*#__PURE__*/_interopDefaultLegacy(hexEncoder);
|
|
31
|
-
var dotenv__namespace = /*#__PURE__*/_interopNamespace(dotenv);
|
|
32
31
|
var sha256__default = /*#__PURE__*/_interopDefaultLegacy(sha256);
|
|
32
|
+
var dotenv__namespace = /*#__PURE__*/_interopNamespace(dotenv);
|
|
33
33
|
|
|
34
34
|
// ⚠️ WARNING: This code has been generated so that any manual changes will be overwritten
|
|
35
35
|
/**
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
* @generated
|
|
46
46
|
* @see https://github.com/webgptorg/promptbook
|
|
47
47
|
*/
|
|
48
|
-
var PROMPTBOOK_ENGINE_VERSION = '0.84.0-
|
|
48
|
+
var PROMPTBOOK_ENGINE_VERSION = '0.84.0-21';
|
|
49
49
|
/**
|
|
50
50
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
51
51
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -222,6 +222,18 @@
|
|
|
222
222
|
* @public exported from `@promptbook/core`
|
|
223
223
|
*/
|
|
224
224
|
var DEFAULT_TASK_TITLE = "Task";
|
|
225
|
+
/**
|
|
226
|
+
* When the pipeline is flat and no name of return parameter is provided, this name is used
|
|
227
|
+
*
|
|
228
|
+
* @public exported from `@promptbook/core`
|
|
229
|
+
*/
|
|
230
|
+
var DEFAULT_BOOK_OUTPUT_PARAMETER_NAME = 'result';
|
|
231
|
+
/**
|
|
232
|
+
* Maximum file size limit
|
|
233
|
+
*
|
|
234
|
+
* @public exported from `@promptbook/core`
|
|
235
|
+
*/
|
|
236
|
+
var DEFAULT_MAX_FILE_SIZE = 100 * 1024 * 1024; // 100MB
|
|
225
237
|
// <- TODO: [🧠] Better system for generator warnings - not always "code" and "by `@promptbook/cli`"
|
|
226
238
|
/**
|
|
227
239
|
* The maximum number of iterations for a loops
|
|
@@ -280,6 +292,15 @@
|
|
|
280
292
|
* @public exported from `@promptbook/core`
|
|
281
293
|
*/
|
|
282
294
|
var DEFAULT_MAX_EXECUTION_ATTEMPTS = 3; // <- TODO: [🤹♂️]
|
|
295
|
+
// <- TODO: [🕝] Make also `BOOKS_DIRNAME_ALTERNATIVES`
|
|
296
|
+
/**
|
|
297
|
+
* Where to store the temporary downloads
|
|
298
|
+
*
|
|
299
|
+
* Note: When the folder does not exist, it is created recursively
|
|
300
|
+
*
|
|
301
|
+
* @public exported from `@promptbook/core`
|
|
302
|
+
*/
|
|
303
|
+
var DEFAULT_DOWNLOAD_CACHE_DIRNAME = './.promptbook/download-cache';
|
|
283
304
|
/**
|
|
284
305
|
* Where to store the scrape cache
|
|
285
306
|
*
|
|
@@ -335,22 +356,94 @@
|
|
|
335
356
|
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book.md",formfactorName:"GENERIC",parameters:[{name:"knowledgeContent",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledgePieces",description:"The knowledge JSON object",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced data researcher, extract the important knowledge from the document.\n\n# Rules\n\n- Make pieces of information concise, clear, and easy to understand\n- One piece of information should be approximately 1 paragraph\n- Divide the paragraphs by markdown horizontal lines ---\n- Omit irrelevant information\n- Group redundant information\n- Write just extracted information, nothing else\n\n# The document\n\nTake information from this document:\n\n> {knowledgeContent}",resultingParameterName:"knowledgePieces",dependentParameterNames:["knowledgeContent"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Knowledge from Markdown\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book.md`\n- INPUT PARAMETER `{knowledgeContent}` Markdown document content\n- OUTPUT PARAMETER `{knowledgePieces}` The knowledge JSON object\n\n## Knowledge\n\n<!-- TODO: [🍆] -FORMAT JSON -->\n\n```markdown\nYou are experienced data researcher, extract the important knowledge from the document.\n\n# Rules\n\n- Make pieces of information concise, clear, and easy to understand\n- One piece of information should be approximately 1 paragraph\n- Divide the paragraphs by markdown horizontal lines ---\n- Omit irrelevant information\n- Group redundant information\n- Write just extracted information, nothing else\n\n# The document\n\nTake information from this document:\n\n> {knowledgeContent}\n```\n\n`-> {knowledgePieces}`\n"}],sourceFile:"./books/prepare-knowledge-from-markdown.book.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-keywords.book.md",formfactorName:"GENERIC",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"keywords",description:"Keywords separated by comma",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced data researcher, detect the important keywords in the document.\n\n# Rules\n\n- Write just keywords separated by comma\n\n# The document\n\nTake information from this document:\n\n> {knowledgePieceContent}",resultingParameterName:"keywords",dependentParameterNames:["knowledgePieceContent"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Keywords\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-knowledge-keywords.book.md`\n- INPUT PARAMETER `{knowledgePieceContent}` The content\n- OUTPUT PARAMETER `{keywords}` Keywords separated by comma\n\n## Knowledge\n\n<!-- TODO: [🍆] -FORMAT JSON -->\n\n```markdown\nYou are experienced data researcher, detect the important keywords in the document.\n\n# Rules\n\n- Write just keywords separated by comma\n\n# The document\n\nTake information from this document:\n\n> {knowledgePieceContent}\n```\n\n`-> {keywords}`\n"}],sourceFile:"./books/prepare-knowledge-keywords.book.md"},{title:"Prepare Knowledge-piece Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-title.book.md",formfactorName:"GENERIC",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"title",description:"The title of the document",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced content creator, write best title for the document.\n\n# Rules\n\n- Write just title, nothing else\n- Write maximum 5 words for the title\n\n# The document\n\n> {knowledgePieceContent}",resultingParameterName:"title",expectations:{words:{min:1,max:8}},dependentParameterNames:["knowledgePieceContent"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Knowledge-piece Title\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-knowledge-title.book.md`\n- INPUT PARAMETER `{knowledgePieceContent}` The content\n- OUTPUT PARAMETER `{title}` The title of the document\n\n## Knowledge\n\n- EXPECT MIN 1 WORD\n- EXPECT MAX 8 WORDS\n\n```markdown\nYou are experienced content creator, write best title for the document.\n\n# Rules\n\n- Write just title, nothing else\n- Write maximum 5 words for the title\n\n# The document\n\n> {knowledgePieceContent}\n```\n\n`-> {title}`\n"}],sourceFile:"./books/prepare-knowledge-title.book.md"},{title:"Prepare Persona",pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.book.md",formfactorName:"GENERIC",parameters:[{name:"availableModelNames",description:"List of available model names separated by comma (,)",isInput:true,isOutput:false},{name:"personaDescription",description:"Description of the persona",isInput:true,isOutput:false},{name:"modelRequirements",description:"Specific requirements for the model",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"make-model-requirements",title:"Make modelRequirements",content:"You are experienced AI engineer, you need to create virtual assistant.\nWrite\n\n## Example\n\n```json\n{\n\"modelName\": \"gpt-4o\",\n\"systemMessage\": \"You are experienced AI engineer and helpfull assistant.\",\n\"temperature\": 0.7\n}\n```\n\n## Instructions\n\n- Your output format is JSON object\n- Write just the JSON object, no other text should be present\n- It contains the following keys:\n - `modelName`: The name of the model to use\n - `systemMessage`: The system message to provide context to the model\n - `temperature`: The sampling temperature to use\n\n### Key `modelName`\n\nPick from the following models:\n\n- {availableModelNames}\n\n### Key `systemMessage`\n\nThe system message is used to communicate instructions or provide context to the model at the beginning of a conversation. It is displayed in a different format compared to user messages, helping the model understand its role in the conversation. The system message typically guides the model's behavior, sets the tone, or specifies desired output from the model. By utilizing the system message effectively, users can steer the model towards generating more accurate and relevant responses.\n\nFor example:\n\n> You are an experienced AI engineer and helpful assistant.\n\n> You are a friendly and knowledgeable chatbot.\n\n### Key `temperature`\n\nThe sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit.\n\nYou can pick a value between 0 and 2. For example:\n\n- `0.1`: Low temperature, extremely conservative and deterministic\n- `0.5`: Medium temperature, balanced between conservative and creative\n- `1.0`: High temperature, creative and bit random\n- `1.5`: Very high temperature, extremely creative and often chaotic and unpredictable\n- `2.0`: Maximum temperature, completely random and unpredictable, for some extreme creative use cases\n\n# The assistant\n\nTake this description of the persona:\n\n> {personaDescription}",resultingParameterName:"modelRequirements",format:"JSON",dependentParameterNames:["availableModelNames","personaDescription"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Persona\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-persona.book.md`\n- INPUT PARAMETER `{availableModelNames}` List of available model names separated by comma (,)\n- INPUT PARAMETER `{personaDescription}` Description of the persona\n- OUTPUT PARAMETER `{modelRequirements}` Specific requirements for the model\n\n## Make modelRequirements\n\n- FORMAT JSON\n\n```markdown\nYou are experienced AI engineer, you need to create virtual assistant.\nWrite\n\n## Example\n\n\\`\\`\\`json\n{\n\"modelName\": \"gpt-4o\",\n\"systemMessage\": \"You are experienced AI engineer and helpfull assistant.\",\n\"temperature\": 0.7\n}\n\\`\\`\\`\n\n## Instructions\n\n- Your output format is JSON object\n- Write just the JSON object, no other text should be present\n- It contains the following keys:\n - `modelName`: The name of the model to use\n - `systemMessage`: The system message to provide context to the model\n - `temperature`: The sampling temperature to use\n\n### Key `modelName`\n\nPick from the following models:\n\n- {availableModelNames}\n\n### Key `systemMessage`\n\nThe system message is used to communicate instructions or provide context to the model at the beginning of a conversation. It is displayed in a different format compared to user messages, helping the model understand its role in the conversation. The system message typically guides the model's behavior, sets the tone, or specifies desired output from the model. By utilizing the system message effectively, users can steer the model towards generating more accurate and relevant responses.\n\nFor example:\n\n> You are an experienced AI engineer and helpful assistant.\n\n> You are a friendly and knowledgeable chatbot.\n\n### Key `temperature`\n\nThe sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit.\n\nYou can pick a value between 0 and 2. For example:\n\n- `0.1`: Low temperature, extremely conservative and deterministic\n- `0.5`: Medium temperature, balanced between conservative and creative\n- `1.0`: High temperature, creative and bit random\n- `1.5`: Very high temperature, extremely creative and often chaotic and unpredictable\n- `2.0`: Maximum temperature, completely random and unpredictable, for some extreme creative use cases\n\n# The assistant\n\nTake this description of the persona:\n\n> {personaDescription}\n```\n\n`-> {modelRequirements}`\n"}],sourceFile:"./books/prepare-persona.book.md"},{title:"Prepare Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-title.book.md",formfactorName:"GENERIC",parameters:[{name:"book",description:"The book to prepare the title for",isInput:true,isOutput:false},{name:"title",description:"Best title for the book",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"make-title",title:"Make title",content:"Make best title for given text which describes the workflow:\n\n## Rules\n\n- Write just title, nothing else\n- Title should be concise and clear - Write maximum ideally 2 words, maximum 5 words\n- Title starts with emoticon\n- Title should not mention the input and output of the workflow but the main purpose of the workflow\n _For example, not \"✍ Convert Knowledge-piece to title\" but \"✍ Title\"_\n\n## The workflow\n\n> {book}",resultingParameterName:"title",expectations:{words:{min:1,max:8},lines:{min:1,max:1}},dependentParameterNames:["book"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Title\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-title.book.md`\n- INPUT PARAMETER `{book}` The book to prepare the title for\n- OUTPUT PARAMETER `{title}` Best title for the book\n\n## Make title\n\n- EXPECT MIN 1 Word\n- EXPECT MAX 8 Words\n- EXPECT EXACTLY 1 Line\n\n```markdown\nMake best title for given text which describes the workflow:\n\n## Rules\n\n- Write just title, nothing else\n- Title should be concise and clear - Write maximum ideally 2 words, maximum 5 words\n- Title starts with emoticon\n- Title should not mention the input and output of the workflow but the main purpose of the workflow\n _For example, not \"✍ Convert Knowledge-piece to title\" but \"✍ Title\"_\n\n## The workflow\n\n> {book}\n```\n\n`-> {title}`\n"}],sourceFile:"./books/prepare-title.book.md"}];
|
|
336
357
|
|
|
337
358
|
/**
|
|
338
|
-
*
|
|
359
|
+
* Checks if value is valid email
|
|
339
360
|
*
|
|
340
361
|
* @public exported from `@promptbook/utils`
|
|
341
362
|
*/
|
|
342
|
-
function
|
|
343
|
-
|
|
344
|
-
|
|
363
|
+
function isValidEmail(email) {
|
|
364
|
+
if (typeof email !== 'string') {
|
|
365
|
+
return false;
|
|
366
|
+
}
|
|
367
|
+
if (email.split('\n').length > 1) {
|
|
368
|
+
return false;
|
|
369
|
+
}
|
|
370
|
+
return /^.+@.+\..+$/.test(email);
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
/**
|
|
374
|
+
* Tests if given string is valid URL.
|
|
375
|
+
*
|
|
376
|
+
* Note: This does not check if the file exists only if the path is valid
|
|
377
|
+
* @public exported from `@promptbook/utils`
|
|
378
|
+
*/
|
|
379
|
+
function isValidFilePath(filename) {
|
|
380
|
+
if (typeof filename !== 'string') {
|
|
381
|
+
return false;
|
|
382
|
+
}
|
|
383
|
+
if (filename.split('\n').length > 1) {
|
|
384
|
+
return false;
|
|
385
|
+
}
|
|
386
|
+
if (filename.split(' ').length >
|
|
387
|
+
5 /* <- TODO: [🧠][🈷] Make some better non-arbitrary way how to distinct filenames from informational texts */) {
|
|
388
|
+
return false;
|
|
389
|
+
}
|
|
390
|
+
var filenameSlashes = filename.split('\\').join('/');
|
|
391
|
+
// Absolute Unix path: /hello.txt
|
|
392
|
+
if (/^(\/)/i.test(filenameSlashes)) {
|
|
393
|
+
// console.log(filename, 'Absolute Unix path: /hello.txt');
|
|
345
394
|
return true;
|
|
346
395
|
}
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
396
|
+
// Absolute Windows path: /hello.txt
|
|
397
|
+
if (/^([A-Z]{1,2}:\/?)\//i.test(filenameSlashes)) {
|
|
398
|
+
// console.log(filename, 'Absolute Windows path: /hello.txt');
|
|
399
|
+
return true;
|
|
400
|
+
}
|
|
401
|
+
// Relative path: ./hello.txt
|
|
402
|
+
if (/^(\.\.?\/)+/i.test(filenameSlashes)) {
|
|
403
|
+
// console.log(filename, 'Relative path: ./hello.txt');
|
|
404
|
+
return true;
|
|
405
|
+
}
|
|
406
|
+
// Allow paths like foo/hello
|
|
407
|
+
if (/^[^/]+\/[^/]+/i.test(filenameSlashes)) {
|
|
408
|
+
// console.log(filename, 'Allow paths like foo/hello');
|
|
409
|
+
return true;
|
|
410
|
+
}
|
|
411
|
+
// Allow paths like hello.book
|
|
412
|
+
if (/^[^/]+\.[^/]+$/i.test(filenameSlashes)) {
|
|
413
|
+
// console.log(filename, 'Allow paths like hello.book');
|
|
414
|
+
return true;
|
|
415
|
+
}
|
|
416
|
+
return false;
|
|
417
|
+
}
|
|
418
|
+
/**
|
|
419
|
+
* TODO: [🍏] Implement for MacOs
|
|
420
|
+
*/
|
|
421
|
+
|
|
422
|
+
/**
|
|
423
|
+
* Tests if given string is valid URL.
|
|
424
|
+
*
|
|
425
|
+
* Note: Dataurl are considered perfectly valid.
|
|
426
|
+
* Note: There are two simmilar functions:
|
|
427
|
+
* - `isValidUrl` which tests any URL
|
|
428
|
+
* - `isValidPipelineUrl` *(this one)* which tests just promptbook URL
|
|
429
|
+
*
|
|
430
|
+
* @public exported from `@promptbook/utils`
|
|
431
|
+
*/
|
|
432
|
+
function isValidUrl(url) {
|
|
433
|
+
if (typeof url !== 'string') {
|
|
434
|
+
return false;
|
|
435
|
+
}
|
|
436
|
+
try {
|
|
437
|
+
if (url.startsWith('blob:')) {
|
|
438
|
+
url = url.replace(/^blob:/, '');
|
|
350
439
|
}
|
|
351
|
-
|
|
440
|
+
var urlObject = new URL(url /* because fail is handled */);
|
|
441
|
+
if (!['http:', 'https:', 'data:'].includes(urlObject.protocol)) {
|
|
352
442
|
return false;
|
|
353
443
|
}
|
|
444
|
+
return true;
|
|
445
|
+
}
|
|
446
|
+
catch (error) {
|
|
354
447
|
return false;
|
|
355
448
|
}
|
|
356
449
|
}
|
|
@@ -374,6 +467,27 @@
|
|
|
374
467
|
* TODO: Maybe split `ParseError` and `ApplyError`
|
|
375
468
|
*/
|
|
376
469
|
|
|
470
|
+
/**
|
|
471
|
+
* Function isValidJsonString will tell you if the string is valid JSON or not
|
|
472
|
+
*
|
|
473
|
+
* @public exported from `@promptbook/utils`
|
|
474
|
+
*/
|
|
475
|
+
function isValidJsonString(value /* <- [👨⚖️] */) {
|
|
476
|
+
try {
|
|
477
|
+
JSON.parse(value);
|
|
478
|
+
return true;
|
|
479
|
+
}
|
|
480
|
+
catch (error) {
|
|
481
|
+
if (!(error instanceof Error)) {
|
|
482
|
+
throw error;
|
|
483
|
+
}
|
|
484
|
+
if (error.message.includes('Unexpected token')) {
|
|
485
|
+
return false;
|
|
486
|
+
}
|
|
487
|
+
return false;
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
|
|
377
491
|
/**
|
|
378
492
|
* Function `validatePipelineString` will validate the if the string is a valid pipeline string
|
|
379
493
|
* It does not check if the string is fully logically correct, but if it is a string that can be a pipeline string or the string looks completely different.
|
|
@@ -387,6 +501,15 @@
|
|
|
387
501
|
if (isValidJsonString(pipelineString)) {
|
|
388
502
|
throw new ParseError('Expected a book, but got a JSON string');
|
|
389
503
|
}
|
|
504
|
+
else if (isValidUrl(pipelineString)) {
|
|
505
|
+
throw new ParseError("Expected a book, but got just the URL \"".concat(pipelineString, "\""));
|
|
506
|
+
}
|
|
507
|
+
else if (isValidFilePath(pipelineString)) {
|
|
508
|
+
throw new ParseError("Expected a book, but got just the file path \"".concat(pipelineString, "\""));
|
|
509
|
+
}
|
|
510
|
+
else if (isValidEmail(pipelineString)) {
|
|
511
|
+
throw new ParseError("Expected a book, but got just the email \"".concat(pipelineString, "\""));
|
|
512
|
+
}
|
|
390
513
|
// <- TODO: Implement the validation + add tests when the pipeline logic considered as invalid
|
|
391
514
|
return pipelineString;
|
|
392
515
|
}
|
|
@@ -1080,35 +1203,6 @@
|
|
|
1080
1203
|
return isHostnameOnPrivateNetwork(url.hostname);
|
|
1081
1204
|
}
|
|
1082
1205
|
|
|
1083
|
-
/**
|
|
1084
|
-
* Tests if given string is valid URL.
|
|
1085
|
-
*
|
|
1086
|
-
* Note: Dataurl are considered perfectly valid.
|
|
1087
|
-
* Note: There are two simmilar functions:
|
|
1088
|
-
* - `isValidUrl` which tests any URL
|
|
1089
|
-
* - `isValidPipelineUrl` *(this one)* which tests just promptbook URL
|
|
1090
|
-
*
|
|
1091
|
-
* @public exported from `@promptbook/utils`
|
|
1092
|
-
*/
|
|
1093
|
-
function isValidUrl(url) {
|
|
1094
|
-
if (typeof url !== 'string') {
|
|
1095
|
-
return false;
|
|
1096
|
-
}
|
|
1097
|
-
try {
|
|
1098
|
-
if (url.startsWith('blob:')) {
|
|
1099
|
-
url = url.replace(/^blob:/, '');
|
|
1100
|
-
}
|
|
1101
|
-
var urlObject = new URL(url /* because fail is handled */);
|
|
1102
|
-
if (!['http:', 'https:', 'data:'].includes(urlObject.protocol)) {
|
|
1103
|
-
return false;
|
|
1104
|
-
}
|
|
1105
|
-
return true;
|
|
1106
|
-
}
|
|
1107
|
-
catch (error) {
|
|
1108
|
-
return false;
|
|
1109
|
-
}
|
|
1110
|
-
}
|
|
1111
|
-
|
|
1112
1206
|
/**
|
|
1113
1207
|
* Tests if given string is valid pipeline URL URL.
|
|
1114
1208
|
*
|
|
@@ -1863,12 +1957,28 @@
|
|
|
1863
1957
|
/**
|
|
1864
1958
|
* Asserts that the execution of a Promptbook is successful
|
|
1865
1959
|
*
|
|
1960
|
+
* Note: If there are only warnings, the execution is still successful but the warnings are logged in the console
|
|
1961
|
+
*
|
|
1866
1962
|
* @param executionResult - The partial result of the Promptbook execution
|
|
1867
1963
|
* @throws {PipelineExecutionError} If the execution is not successful or if multiple errors occurred
|
|
1868
1964
|
* @public exported from `@promptbook/core`
|
|
1869
1965
|
*/
|
|
1870
1966
|
function assertsExecutionSuccessful(executionResult) {
|
|
1871
|
-
var
|
|
1967
|
+
var e_1, _a;
|
|
1968
|
+
var isSuccessful = executionResult.isSuccessful, errors = executionResult.errors, warnings = executionResult.warnings;
|
|
1969
|
+
try {
|
|
1970
|
+
for (var warnings_1 = __values(warnings), warnings_1_1 = warnings_1.next(); !warnings_1_1.done; warnings_1_1 = warnings_1.next()) {
|
|
1971
|
+
var warning = warnings_1_1.value;
|
|
1972
|
+
console.warn(warning.message);
|
|
1973
|
+
}
|
|
1974
|
+
}
|
|
1975
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
1976
|
+
finally {
|
|
1977
|
+
try {
|
|
1978
|
+
if (warnings_1_1 && !warnings_1_1.done && (_a = warnings_1.return)) _a.call(warnings_1);
|
|
1979
|
+
}
|
|
1980
|
+
finally { if (e_1) throw e_1.error; }
|
|
1981
|
+
}
|
|
1872
1982
|
if (isSuccessful === true) {
|
|
1873
1983
|
return;
|
|
1874
1984
|
}
|
|
@@ -2878,7 +2988,7 @@
|
|
|
2878
2988
|
if (!(error_1 instanceof Error) || error_1 instanceof UnexpectedError) {
|
|
2879
2989
|
throw error_1;
|
|
2880
2990
|
}
|
|
2881
|
-
errors.push(error_1);
|
|
2991
|
+
errors.push({ llmExecutionTools: llmExecutionTools, error: error_1 });
|
|
2882
2992
|
return [3 /*break*/, 13];
|
|
2883
2993
|
case 13:
|
|
2884
2994
|
_b = _a.next();
|
|
@@ -2905,7 +3015,10 @@
|
|
|
2905
3015
|
// 2) AnthropicClaude throw PipelineExecutionError: Parameter `{knowledge}` is not defined
|
|
2906
3016
|
// 3) ...
|
|
2907
3017
|
spaceTrim__default["default"](function (block) { return "\n All execution tools failed:\n\n ".concat(block(errors
|
|
2908
|
-
.map(function (
|
|
3018
|
+
.map(function (_a, i) {
|
|
3019
|
+
var error = _a.error, llmExecutionTools = _a.llmExecutionTools;
|
|
3020
|
+
return "".concat(i + 1, ") **").concat(llmExecutionTools.title, "** thrown **").concat(error.name || 'Error', ":** ").concat(error.message);
|
|
3021
|
+
})
|
|
2909
3022
|
.join('\n')), "\n\n "); }));
|
|
2910
3023
|
}
|
|
2911
3024
|
else if (this.llmExecutionTools.length === 0) {
|
|
@@ -5325,6 +5438,15 @@
|
|
|
5325
5438
|
* TODO: [🐱🐉][🧠] Make some smart crop NOT source-i-m-pavol-a-develop-... BUT source-i-m-pavol-a-developer-...
|
|
5326
5439
|
*/
|
|
5327
5440
|
|
|
5441
|
+
/**
|
|
5442
|
+
* @@@
|
|
5443
|
+
*
|
|
5444
|
+
* @private for `FileCacheStorage`
|
|
5445
|
+
*/
|
|
5446
|
+
function nameToSubfolderPath(name) {
|
|
5447
|
+
return [name.substr(0, 1).toLowerCase(), name.substr(1, 1).toLowerCase()];
|
|
5448
|
+
}
|
|
5449
|
+
|
|
5328
5450
|
/**
|
|
5329
5451
|
* Convert file extension to mime type
|
|
5330
5452
|
*
|
|
@@ -5381,53 +5503,55 @@
|
|
|
5381
5503
|
*/
|
|
5382
5504
|
|
|
5383
5505
|
/**
|
|
5384
|
-
*
|
|
5506
|
+
* Convert mime type to file extension
|
|
5385
5507
|
*
|
|
5386
|
-
* Note:
|
|
5508
|
+
* Note: If the mime type is invalid, `null` is returned
|
|
5509
|
+
*
|
|
5510
|
+
* @private within the repository
|
|
5511
|
+
*/
|
|
5512
|
+
function mimeTypeToExtension(value) {
|
|
5513
|
+
return mimeTypes.extension(value) || null;
|
|
5514
|
+
}
|
|
5515
|
+
|
|
5516
|
+
/**
|
|
5517
|
+
* Removes emojis from a string and fix whitespaces
|
|
5518
|
+
*
|
|
5519
|
+
* @param text with emojis
|
|
5520
|
+
* @returns text without emojis
|
|
5387
5521
|
* @public exported from `@promptbook/utils`
|
|
5388
5522
|
*/
|
|
5389
|
-
function
|
|
5390
|
-
|
|
5391
|
-
|
|
5392
|
-
}
|
|
5393
|
-
|
|
5394
|
-
|
|
5395
|
-
|
|
5396
|
-
if (filename.split(' ').length >
|
|
5397
|
-
5 /* <- TODO: [🧠][🈷] Make some better non-arbitrary way how to distinct filenames from informational texts */) {
|
|
5398
|
-
return false;
|
|
5399
|
-
}
|
|
5400
|
-
var filenameSlashes = filename.split('\\').join('/');
|
|
5401
|
-
// Absolute Unix path: /hello.txt
|
|
5402
|
-
if (/^(\/)/i.test(filenameSlashes)) {
|
|
5403
|
-
// console.log(filename, 'Absolute Unix path: /hello.txt');
|
|
5404
|
-
return true;
|
|
5405
|
-
}
|
|
5406
|
-
// Absolute Windows path: /hello.txt
|
|
5407
|
-
if (/^([A-Z]{1,2}:\/?)\//i.test(filenameSlashes)) {
|
|
5408
|
-
// console.log(filename, 'Absolute Windows path: /hello.txt');
|
|
5409
|
-
return true;
|
|
5410
|
-
}
|
|
5411
|
-
// Relative path: ./hello.txt
|
|
5412
|
-
if (/^(\.\.?\/)+/i.test(filenameSlashes)) {
|
|
5413
|
-
// console.log(filename, 'Relative path: ./hello.txt');
|
|
5414
|
-
return true;
|
|
5415
|
-
}
|
|
5416
|
-
// Allow paths like foo/hello
|
|
5417
|
-
if (/^[^/]+\/[^/]+/i.test(filenameSlashes)) {
|
|
5418
|
-
// console.log(filename, 'Allow paths like foo/hello');
|
|
5419
|
-
return true;
|
|
5420
|
-
}
|
|
5421
|
-
// Allow paths like hello.book
|
|
5422
|
-
if (/^[^/]+\.[^/]+$/i.test(filenameSlashes)) {
|
|
5423
|
-
// console.log(filename, 'Allow paths like hello.book');
|
|
5424
|
-
return true;
|
|
5425
|
-
}
|
|
5426
|
-
return false;
|
|
5523
|
+
function removeEmojis(text) {
|
|
5524
|
+
// Replace emojis (and also ZWJ sequence) with hyphens
|
|
5525
|
+
text = text.replace(/(\p{Extended_Pictographic})\p{Modifier_Symbol}/gu, '$1');
|
|
5526
|
+
text = text.replace(/(\p{Extended_Pictographic})[\u{FE00}-\u{FE0F}]/gu, '$1');
|
|
5527
|
+
text = text.replace(/(\p{Extended_Pictographic})(\u{200D}\p{Extended_Pictographic})*/gu, '$1');
|
|
5528
|
+
text = text.replace(/\p{Extended_Pictographic}/gu, '');
|
|
5529
|
+
return text;
|
|
5427
5530
|
}
|
|
5531
|
+
|
|
5428
5532
|
/**
|
|
5429
|
-
*
|
|
5533
|
+
* @@@
|
|
5534
|
+
*
|
|
5535
|
+
* @param value @@@
|
|
5536
|
+
* @returns @@@
|
|
5537
|
+
* @example @@@
|
|
5538
|
+
* @public exported from `@promptbook/utils`
|
|
5430
5539
|
*/
|
|
5540
|
+
function titleToName(value) {
|
|
5541
|
+
if (isValidUrl(value)) {
|
|
5542
|
+
value = value.replace(/^https?:\/\//, '');
|
|
5543
|
+
value = value.replace(/\.html$/, '');
|
|
5544
|
+
}
|
|
5545
|
+
else if (isValidFilePath(value)) {
|
|
5546
|
+
value = path.basename(value);
|
|
5547
|
+
// Note: Keeping extension in the name
|
|
5548
|
+
}
|
|
5549
|
+
value = value.split('/').join('-');
|
|
5550
|
+
value = removeEmojis(value);
|
|
5551
|
+
value = normalizeToKebabCase(value);
|
|
5552
|
+
// TODO: [🧠] Maybe warn or add some padding to short name which are not good identifiers
|
|
5553
|
+
return value;
|
|
5554
|
+
}
|
|
5431
5555
|
|
|
5432
5556
|
/**
|
|
5433
5557
|
* The built-in `fetch' function with a lightweight error handling wrapper as default fetch function used in Promptbook scrapers
|
|
@@ -5464,9 +5588,9 @@
|
|
|
5464
5588
|
function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
|
|
5465
5589
|
var _a;
|
|
5466
5590
|
return __awaiter(this, void 0, void 0, function () {
|
|
5467
|
-
var _b, fetch, knowledgeSourceContent, name, _c, _d, rootDirname, url, response_1, mimeType, filename_1, fileExtension, mimeType;
|
|
5468
|
-
return __generator(this, function (
|
|
5469
|
-
switch (
|
|
5591
|
+
var _b, fetch, knowledgeSourceContent, name, _c, _d, rootDirname, url, response_1, mimeType, basename, hash, rootDirname_1, filepath, fileContent, _f, _g, filename_1, fileExtension, mimeType;
|
|
5592
|
+
return __generator(this, function (_h) {
|
|
5593
|
+
switch (_h.label) {
|
|
5470
5594
|
case 0:
|
|
5471
5595
|
_b = tools.fetch, fetch = _b === void 0 ? scraperFetch : _b;
|
|
5472
5596
|
knowledgeSourceContent = knowledgeSource.knowledgeSourceContent;
|
|
@@ -5475,54 +5599,76 @@
|
|
|
5475
5599
|
if (!name) {
|
|
5476
5600
|
name = knowledgeSourceContentToName(knowledgeSourceContent);
|
|
5477
5601
|
}
|
|
5478
|
-
if (!isValidUrl(knowledgeSourceContent)) return [3 /*break*/,
|
|
5602
|
+
if (!isValidUrl(knowledgeSourceContent)) return [3 /*break*/, 5];
|
|
5479
5603
|
url = knowledgeSourceContent;
|
|
5480
5604
|
return [4 /*yield*/, fetch(url)];
|
|
5481
5605
|
case 1:
|
|
5482
|
-
response_1 =
|
|
5606
|
+
response_1 = _h.sent();
|
|
5483
5607
|
mimeType = ((_a = response_1.headers.get('content-type')) === null || _a === void 0 ? void 0 : _a.split(';')[0]) || 'text/html';
|
|
5484
|
-
|
|
5485
|
-
|
|
5486
|
-
|
|
5487
|
-
|
|
5488
|
-
|
|
5489
|
-
|
|
5490
|
-
|
|
5491
|
-
|
|
5492
|
-
|
|
5493
|
-
|
|
5494
|
-
|
|
5495
|
-
|
|
5496
|
-
|
|
5497
|
-
|
|
5498
|
-
|
|
5499
|
-
|
|
5500
|
-
|
|
5501
|
-
|
|
5502
|
-
|
|
5503
|
-
|
|
5504
|
-
|
|
5505
|
-
|
|
5506
|
-
|
|
5608
|
+
if (tools.fs === undefined || !url.endsWith('.pdf' /* <- TODO: [💵] */)) {
|
|
5609
|
+
return [2 /*return*/, {
|
|
5610
|
+
source: name,
|
|
5611
|
+
filename: null,
|
|
5612
|
+
url: url,
|
|
5613
|
+
mimeType: mimeType,
|
|
5614
|
+
/*
|
|
5615
|
+
TODO: [🥽]
|
|
5616
|
+
> async asBlob() {
|
|
5617
|
+
> // TODO: [👨🏻🤝👨🏻] This can be called multiple times BUT when called second time, response in already consumed
|
|
5618
|
+
> const content = await response.blob();
|
|
5619
|
+
> return content;
|
|
5620
|
+
> },
|
|
5621
|
+
*/
|
|
5622
|
+
asJson: function () {
|
|
5623
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
5624
|
+
var content;
|
|
5625
|
+
return __generator(this, function (_a) {
|
|
5626
|
+
switch (_a.label) {
|
|
5627
|
+
case 0: return [4 /*yield*/, response_1.json()];
|
|
5628
|
+
case 1:
|
|
5629
|
+
content = _a.sent();
|
|
5630
|
+
return [2 /*return*/, content];
|
|
5631
|
+
}
|
|
5632
|
+
});
|
|
5507
5633
|
});
|
|
5508
|
-
}
|
|
5509
|
-
|
|
5510
|
-
|
|
5511
|
-
|
|
5512
|
-
|
|
5513
|
-
|
|
5514
|
-
|
|
5515
|
-
|
|
5516
|
-
|
|
5517
|
-
|
|
5518
|
-
|
|
5519
|
-
}
|
|
5634
|
+
},
|
|
5635
|
+
asText: function () {
|
|
5636
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
5637
|
+
var content;
|
|
5638
|
+
return __generator(this, function (_a) {
|
|
5639
|
+
switch (_a.label) {
|
|
5640
|
+
case 0: return [4 /*yield*/, response_1.text()];
|
|
5641
|
+
case 1:
|
|
5642
|
+
content = _a.sent();
|
|
5643
|
+
return [2 /*return*/, content];
|
|
5644
|
+
}
|
|
5645
|
+
});
|
|
5520
5646
|
});
|
|
5521
|
-
}
|
|
5522
|
-
}
|
|
5523
|
-
|
|
5647
|
+
},
|
|
5648
|
+
}];
|
|
5649
|
+
}
|
|
5650
|
+
basename = url.split('/').pop() || titleToName(url);
|
|
5651
|
+
hash = sha256__default["default"](hexEncoder__default["default"].parse(url)).toString( /* hex */);
|
|
5652
|
+
rootDirname_1 = path.join(process.cwd(), DEFAULT_DOWNLOAD_CACHE_DIRNAME);
|
|
5653
|
+
filepath = path.join.apply(void 0, __spreadArray(__spreadArray([], __read(nameToSubfolderPath(hash /* <- TODO: [🎎] Maybe add some SHA256 prefix */)), false), ["".concat(basename.substring(0, MAX_FILENAME_LENGTH), ".").concat(mimeTypeToExtension(mimeType))], false));
|
|
5654
|
+
return [4 /*yield*/, tools.fs.mkdir(path.dirname(path.join(rootDirname_1, filepath)), { recursive: true })];
|
|
5524
5655
|
case 2:
|
|
5525
|
-
|
|
5656
|
+
_h.sent();
|
|
5657
|
+
_g = (_f = Buffer).from;
|
|
5658
|
+
return [4 /*yield*/, response_1.arrayBuffer()];
|
|
5659
|
+
case 3:
|
|
5660
|
+
fileContent = _g.apply(_f, [_h.sent()]);
|
|
5661
|
+
if (fileContent.length > DEFAULT_MAX_FILE_SIZE /* <- TODO: Allow to pass different value to remote server */) {
|
|
5662
|
+
throw new LimitReachedError("File is too large (".concat(Math.round(fileContent.length / 1024 / 1024), "MB). Maximum allowed size is ").concat(Math.round(DEFAULT_MAX_FILE_SIZE / 1024 / 1024), "MB."));
|
|
5663
|
+
}
|
|
5664
|
+
return [4 /*yield*/, tools.fs.writeFile(path.join(rootDirname_1, filepath), fileContent)];
|
|
5665
|
+
case 4:
|
|
5666
|
+
_h.sent();
|
|
5667
|
+
// TODO: [💵] Check the file security
|
|
5668
|
+
// TODO: [🧹][🧠] Delete the file after the scraping is done
|
|
5669
|
+
return [2 /*return*/, makeKnowledgeSourceHandler({ name: name, knowledgeSourceContent: filepath }, tools, __assign(__assign({}, options), { rootDirname: rootDirname_1 }))];
|
|
5670
|
+
case 5:
|
|
5671
|
+
if (!isValidFilePath(knowledgeSourceContent)) return [3 /*break*/, 7];
|
|
5526
5672
|
if (tools.fs === undefined) {
|
|
5527
5673
|
throw new EnvironmentMismatchError('Can not import file knowledge without filesystem tools');
|
|
5528
5674
|
// <- TODO: [🧠] What is the best error type here`
|
|
@@ -5535,8 +5681,8 @@
|
|
|
5535
5681
|
fileExtension = getFileExtension(filename_1);
|
|
5536
5682
|
mimeType = extensionToMimeType(fileExtension || '');
|
|
5537
5683
|
return [4 /*yield*/, isFileExisting(filename_1, tools.fs)];
|
|
5538
|
-
case
|
|
5539
|
-
if (!(
|
|
5684
|
+
case 6:
|
|
5685
|
+
if (!(_h.sent())) {
|
|
5540
5686
|
throw new NotFoundError(spaceTrim__default["default"](function (block) { return "\n Can not make source handler for file which does not exist:\n\n File:\n ".concat(block(knowledgeSourceContent), "\n\n Full file path:\n ").concat(block(filename_1), "\n "); }));
|
|
5541
5687
|
}
|
|
5542
5688
|
// TODO: [🧠][😿] Test security file - file is scoped to the project (BUT maybe do this in `filesystemTools`)
|
|
@@ -5582,7 +5728,7 @@
|
|
|
5582
5728
|
});
|
|
5583
5729
|
},
|
|
5584
5730
|
}];
|
|
5585
|
-
case
|
|
5731
|
+
case 7: return [2 /*return*/, {
|
|
5586
5732
|
source: name,
|
|
5587
5733
|
filename: null,
|
|
5588
5734
|
url: null,
|
|
@@ -6693,22 +6839,6 @@
|
|
|
6693
6839
|
* TODO: [🌺] Use some intermediate util splitWords
|
|
6694
6840
|
*/
|
|
6695
6841
|
|
|
6696
|
-
/**
|
|
6697
|
-
* Removes emojis from a string and fix whitespaces
|
|
6698
|
-
*
|
|
6699
|
-
* @param text with emojis
|
|
6700
|
-
* @returns text without emojis
|
|
6701
|
-
* @public exported from `@promptbook/utils`
|
|
6702
|
-
*/
|
|
6703
|
-
function removeEmojis(text) {
|
|
6704
|
-
// Replace emojis (and also ZWJ sequence) with hyphens
|
|
6705
|
-
text = text.replace(/(\p{Extended_Pictographic})\p{Modifier_Symbol}/gu, '$1');
|
|
6706
|
-
text = text.replace(/(\p{Extended_Pictographic})[\u{FE00}-\u{FE0F}]/gu, '$1');
|
|
6707
|
-
text = text.replace(/(\p{Extended_Pictographic})(\u{200D}\p{Extended_Pictographic})*/gu, '$1');
|
|
6708
|
-
text = text.replace(/\p{Extended_Pictographic}/gu, '');
|
|
6709
|
-
return text;
|
|
6710
|
-
}
|
|
6711
|
-
|
|
6712
6842
|
/**
|
|
6713
6843
|
* Removes quotes from a string
|
|
6714
6844
|
*
|
|
@@ -8568,7 +8698,10 @@
|
|
|
8568
8698
|
description: 'Chatbot response',
|
|
8569
8699
|
isInput: false,
|
|
8570
8700
|
isOutput: true,
|
|
8571
|
-
exampleValues: [
|
|
8701
|
+
exampleValues: [
|
|
8702
|
+
'Hello, how can I help you?',
|
|
8703
|
+
// <- TODO: [🧠] Make this dynamic, async, prepare-phase HLAs
|
|
8704
|
+
],
|
|
8572
8705
|
});
|
|
8573
8706
|
// TODO: Use spaceTrim in multiline strings
|
|
8574
8707
|
$pipelineJson.tasks.push({
|
|
@@ -8656,12 +8789,15 @@
|
|
|
8656
8789
|
pipelineString = removeMarkdownComments(pipelineString);
|
|
8657
8790
|
pipelineString = spaceTrim__default["default"](pipelineString);
|
|
8658
8791
|
var isMarkdownBeginningWithHeadline = pipelineString.startsWith('# ');
|
|
8659
|
-
|
|
8660
|
-
|
|
8792
|
+
//const isLastLineReturnStatement = pipelineString.split('\n').pop()!.split('`').join('').startsWith('->');
|
|
8793
|
+
var isBacktickBlockUsed = pipelineString.includes('```');
|
|
8794
|
+
var isQuoteBlocksUsed = /^>\s+/m.test(pipelineString);
|
|
8795
|
+
var isBlocksUsed = isBacktickBlockUsed || isQuoteBlocksUsed;
|
|
8796
|
+
// TODO: [🧉] Also (double)check
|
|
8661
8797
|
// > const usedCommands
|
|
8662
8798
|
// > const isBlocksUsed
|
|
8663
8799
|
// > const returnStatementCount
|
|
8664
|
-
var isFlat = !isMarkdownBeginningWithHeadline && isLastLineReturnStatement
|
|
8800
|
+
var isFlat = !isMarkdownBeginningWithHeadline && !isBlocksUsed; /* && isLastLineReturnStatement */
|
|
8665
8801
|
return isFlat;
|
|
8666
8802
|
}
|
|
8667
8803
|
|
|
@@ -8675,9 +8811,26 @@
|
|
|
8675
8811
|
return pipelineString;
|
|
8676
8812
|
}
|
|
8677
8813
|
var pipelineStringLines = pipelineString.split('\n');
|
|
8678
|
-
var
|
|
8814
|
+
var potentialReturnStatement = pipelineStringLines.pop();
|
|
8815
|
+
var returnStatement;
|
|
8816
|
+
if (/(-|=)>\s*\{.*\}/.test(potentialReturnStatement)) {
|
|
8817
|
+
// Note: Last line is return statement
|
|
8818
|
+
returnStatement = potentialReturnStatement;
|
|
8819
|
+
}
|
|
8820
|
+
else {
|
|
8821
|
+
// Note: Last line is not a return statement
|
|
8822
|
+
returnStatement = "-> {".concat(DEFAULT_BOOK_OUTPUT_PARAMETER_NAME, "}");
|
|
8823
|
+
pipelineStringLines.push(potentialReturnStatement);
|
|
8824
|
+
}
|
|
8679
8825
|
var prompt = spaceTrim__default["default"](pipelineStringLines.join('\n'));
|
|
8680
|
-
|
|
8826
|
+
var quotedPrompt;
|
|
8827
|
+
if (prompt.split('\n').length <= 1) {
|
|
8828
|
+
quotedPrompt = "> ".concat(prompt);
|
|
8829
|
+
}
|
|
8830
|
+
else {
|
|
8831
|
+
quotedPrompt = spaceTrim__default["default"](function (block) { return "\n ```\n ".concat(block(prompt.split('`').join('\\`')), "\n ```\n "); });
|
|
8832
|
+
}
|
|
8833
|
+
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 "); }));
|
|
8681
8834
|
// <- TODO: Maybe use book` notation
|
|
8682
8835
|
return pipelineString;
|
|
8683
8836
|
}
|
|
@@ -8900,30 +9053,6 @@
|
|
|
8900
9053
|
* NOW we are working just with markdown string and its good enough
|
|
8901
9054
|
*/
|
|
8902
9055
|
|
|
8903
|
-
/**
|
|
8904
|
-
* @@@
|
|
8905
|
-
*
|
|
8906
|
-
* @param value @@@
|
|
8907
|
-
* @returns @@@
|
|
8908
|
-
* @example @@@
|
|
8909
|
-
* @public exported from `@promptbook/utils`
|
|
8910
|
-
*/
|
|
8911
|
-
function titleToName(value) {
|
|
8912
|
-
if (isValidUrl(value)) {
|
|
8913
|
-
value = value.replace(/^https?:\/\//, '');
|
|
8914
|
-
value = value.replace(/\.html$/, '');
|
|
8915
|
-
}
|
|
8916
|
-
else if (isValidFilePath(value)) {
|
|
8917
|
-
value = path.basename(value);
|
|
8918
|
-
// Note: Keeping extension in the name
|
|
8919
|
-
}
|
|
8920
|
-
value = value.split('/').join('-');
|
|
8921
|
-
value = removeEmojis(value);
|
|
8922
|
-
value = normalizeToKebabCase(value);
|
|
8923
|
-
// TODO: [🧠] Maybe warn or add some padding to short name which are not good identifiers
|
|
8924
|
-
return value;
|
|
8925
|
-
}
|
|
8926
|
-
|
|
8927
9056
|
/**
|
|
8928
9057
|
* Compile pipeline from string (markdown) format to JSON format synchronously
|
|
8929
9058
|
*
|
|
@@ -9443,6 +9572,9 @@
|
|
|
9443
9572
|
* @public exported from `@promptbook/utils`
|
|
9444
9573
|
*/
|
|
9445
9574
|
var $isRunningInNode = new Function("\n try {\n return this === global;\n } catch (e) {\n return false;\n }\n");
|
|
9575
|
+
/**
|
|
9576
|
+
* TODO: [☑]
|
|
9577
|
+
*/
|
|
9446
9578
|
|
|
9447
9579
|
/**
|
|
9448
9580
|
* Normalize options for `execCommand` and `execCommands`
|
|
@@ -9656,6 +9788,7 @@
|
|
|
9656
9788
|
readFile: promises.readFile,
|
|
9657
9789
|
writeFile: promises.writeFile,
|
|
9658
9790
|
readdir: promises.readdir,
|
|
9791
|
+
mkdir: promises.mkdir,
|
|
9659
9792
|
};
|
|
9660
9793
|
}
|
|
9661
9794
|
/**
|
|
@@ -9948,71 +10081,6 @@
|
|
|
9948
10081
|
* TODO: [🍏] Make for MacOS paths
|
|
9949
10082
|
*/
|
|
9950
10083
|
|
|
9951
|
-
/**
|
|
9952
|
-
* @@@
|
|
9953
|
-
*
|
|
9954
|
-
* @@@ .env
|
|
9955
|
-
*
|
|
9956
|
-
* It looks for environment variables:
|
|
9957
|
-
* - `process.env.OPENAI_API_KEY`
|
|
9958
|
-
* - `process.env.ANTHROPIC_CLAUDE_API_KEY`
|
|
9959
|
-
* - ...
|
|
9960
|
-
*
|
|
9961
|
-
* @returns @@@
|
|
9962
|
-
* @public exported from `@promptbook/node`
|
|
9963
|
-
*/
|
|
9964
|
-
function $provideLlmToolsConfigurationFromEnv() {
|
|
9965
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
9966
|
-
var rootDirname, i, envFilename, llmToolsConfiguration;
|
|
9967
|
-
return __generator(this, function (_a) {
|
|
9968
|
-
switch (_a.label) {
|
|
9969
|
-
case 0:
|
|
9970
|
-
if (!$isRunningInNode()) {
|
|
9971
|
-
throw new EnvironmentMismatchError('Function `$provideLlmToolsFromEnv` works only in Node.js environment');
|
|
9972
|
-
}
|
|
9973
|
-
rootDirname = process.cwd();
|
|
9974
|
-
i = 0;
|
|
9975
|
-
_a.label = 1;
|
|
9976
|
-
case 1:
|
|
9977
|
-
if (!(i < LOOP_LIMIT)) return [3 /*break*/, 4];
|
|
9978
|
-
envFilename = path.join(rootDirname, '.env' /* <- TODO: [🕝] Make here more candidates */);
|
|
9979
|
-
return [4 /*yield*/, isFileExisting(envFilename, $provideFilesystemForNode())];
|
|
9980
|
-
case 2:
|
|
9981
|
-
// console.log({ rootDirname, envFilename });
|
|
9982
|
-
if (_a.sent()) {
|
|
9983
|
-
dotenv__namespace.config({ path: envFilename });
|
|
9984
|
-
return [3 /*break*/, 4];
|
|
9985
|
-
}
|
|
9986
|
-
if (isRootPath(rootDirname)) {
|
|
9987
|
-
return [3 /*break*/, 4];
|
|
9988
|
-
}
|
|
9989
|
-
// Note: If the directory does not exist, try the parent directory
|
|
9990
|
-
rootDirname = path.join(rootDirname, '..');
|
|
9991
|
-
_a.label = 3;
|
|
9992
|
-
case 3:
|
|
9993
|
-
i++;
|
|
9994
|
-
return [3 /*break*/, 1];
|
|
9995
|
-
case 4:
|
|
9996
|
-
llmToolsConfiguration = $llmToolsMetadataRegister
|
|
9997
|
-
.list()
|
|
9998
|
-
.map(function (metadata) { return metadata.createConfigurationFromEnv(process.env); })
|
|
9999
|
-
.filter(function (configuration) { return configuration !== null; });
|
|
10000
|
-
return [2 /*return*/, llmToolsConfiguration];
|
|
10001
|
-
}
|
|
10002
|
-
});
|
|
10003
|
-
});
|
|
10004
|
-
}
|
|
10005
|
-
/**
|
|
10006
|
-
* TODO: [🧠][🪁] Maybe do allow to do auto-install if package not registered and not found
|
|
10007
|
-
* TODO: Add Azure OpenAI
|
|
10008
|
-
* TODO: [🧠][🍛]
|
|
10009
|
-
* TODO: [🧠] Is there some meaningfull way how to test this util
|
|
10010
|
-
* Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
|
|
10011
|
-
* TODO: [👷♂️] @@@ Manual about construction of llmTools
|
|
10012
|
-
* TODO: This should be maybe not under `_common` but under `utils`
|
|
10013
|
-
* TODO: [🧠][⚛] Maybe pass env as argument
|
|
10014
|
-
* TODO: [®] DRY Register logic */
|
|
10015
|
-
|
|
10016
10084
|
/**
|
|
10017
10085
|
* @@@
|
|
10018
10086
|
*
|
|
@@ -10025,6 +10093,22 @@
|
|
|
10025
10093
|
* TODO: [®] DRY Register logic
|
|
10026
10094
|
*/
|
|
10027
10095
|
|
|
10096
|
+
/**
|
|
10097
|
+
* Path to the `.env` file which was used to configure LLM tools
|
|
10098
|
+
*
|
|
10099
|
+
* Note: `$` is used to indicate that this variable is changed by side effect in `$provideLlmToolsConfigurationFromEnv` through `$setUsedEnvFilename`
|
|
10100
|
+
*/
|
|
10101
|
+
var $usedEnvFilename = null;
|
|
10102
|
+
/**
|
|
10103
|
+
* Pass the `.env` file which was used to configure LLM tools
|
|
10104
|
+
*
|
|
10105
|
+
* Note: `$` is used to indicate that this variable is making side effect
|
|
10106
|
+
*
|
|
10107
|
+
* @private internal log of `$provideLlmToolsConfigurationFromEnv` and `$registeredLlmToolsMessage`
|
|
10108
|
+
*/
|
|
10109
|
+
function $setUsedEnvFilename(filepath) {
|
|
10110
|
+
$usedEnvFilename = filepath;
|
|
10111
|
+
}
|
|
10028
10112
|
/**
|
|
10029
10113
|
* Creates a message with all registered LLM tools
|
|
10030
10114
|
*
|
|
@@ -10103,10 +10187,11 @@
|
|
|
10103
10187
|
// <- Note: [🗨]
|
|
10104
10188
|
return __assign(__assign({}, metadata), { isMetadataAviailable: isMetadataAviailable, isInstalled: isInstalled, isFullyConfigured: isFullyConfigured, isPartiallyConfigured: isPartiallyConfigured });
|
|
10105
10189
|
});
|
|
10190
|
+
var usedEnvMessage = $usedEnvFilename === null ? "Unknown `.env` file" : "Used `.env` file:\n".concat($usedEnvFilename);
|
|
10106
10191
|
if (metadata.length === 0) {
|
|
10107
|
-
return "No LLM providers are available.";
|
|
10192
|
+
return spaceTrim__default["default"](function (block) { return "\n No LLM providers are available.\n\n ".concat(block(usedEnvMessage), "\n "); });
|
|
10108
10193
|
}
|
|
10109
|
-
return spaceTrim__default["default"](function (block) { return "\n Relevant environment variables:\n ".concat(block(Object.keys(env)
|
|
10194
|
+
return spaceTrim__default["default"](function (block) { return "\n\n ".concat(block(usedEnvMessage), "\n\n Relevant environment variables:\n ").concat(block(Object.keys(env)
|
|
10110
10195
|
.filter(function (envVariableName) {
|
|
10111
10196
|
return metadata.some(function (_a) {
|
|
10112
10197
|
var envVariables = _a.envVariables;
|
|
@@ -10171,6 +10256,108 @@
|
|
|
10171
10256
|
* TODO: [🧠][⚛] Maybe pass env as argument
|
|
10172
10257
|
*/
|
|
10173
10258
|
|
|
10259
|
+
/**
|
|
10260
|
+
* @@@
|
|
10261
|
+
*
|
|
10262
|
+
* @@@ .env
|
|
10263
|
+
*
|
|
10264
|
+
* It looks for environment variables:
|
|
10265
|
+
* - `process.env.OPENAI_API_KEY`
|
|
10266
|
+
* - `process.env.ANTHROPIC_CLAUDE_API_KEY`
|
|
10267
|
+
* - ...
|
|
10268
|
+
*
|
|
10269
|
+
* @returns @@@
|
|
10270
|
+
* @public exported from `@promptbook/node`
|
|
10271
|
+
*/
|
|
10272
|
+
function $provideLlmToolsConfigurationFromEnv() {
|
|
10273
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
10274
|
+
var envFilePatterns, rootDirname, i, envFilePatterns_1, envFilePatterns_1_1, pattern, envFilename, e_1_1, llmToolsConfiguration;
|
|
10275
|
+
var e_1, _a;
|
|
10276
|
+
return __generator(this, function (_b) {
|
|
10277
|
+
switch (_b.label) {
|
|
10278
|
+
case 0:
|
|
10279
|
+
if (!$isRunningInNode()) {
|
|
10280
|
+
throw new EnvironmentMismatchError('Function `$provideLlmToolsFromEnv` works only in Node.js environment');
|
|
10281
|
+
}
|
|
10282
|
+
envFilePatterns = [
|
|
10283
|
+
'.env',
|
|
10284
|
+
'.env.test',
|
|
10285
|
+
'.env.local',
|
|
10286
|
+
'.env.development.local',
|
|
10287
|
+
'.env.development',
|
|
10288
|
+
'.env.production.local',
|
|
10289
|
+
'.env.production',
|
|
10290
|
+
'.env.prod.local',
|
|
10291
|
+
'.env.prod',
|
|
10292
|
+
// <- TODO: Maybe add more patterns
|
|
10293
|
+
];
|
|
10294
|
+
rootDirname = process.cwd();
|
|
10295
|
+
i = 0;
|
|
10296
|
+
_b.label = 1;
|
|
10297
|
+
case 1:
|
|
10298
|
+
if (!(i < LOOP_LIMIT)) return [3 /*break*/, 11];
|
|
10299
|
+
_b.label = 2;
|
|
10300
|
+
case 2:
|
|
10301
|
+
_b.trys.push([2, 7, 8, 9]);
|
|
10302
|
+
envFilePatterns_1 = (e_1 = void 0, __values(envFilePatterns)), envFilePatterns_1_1 = envFilePatterns_1.next();
|
|
10303
|
+
_b.label = 3;
|
|
10304
|
+
case 3:
|
|
10305
|
+
if (!!envFilePatterns_1_1.done) return [3 /*break*/, 6];
|
|
10306
|
+
pattern = envFilePatterns_1_1.value;
|
|
10307
|
+
envFilename = path.join(rootDirname, pattern);
|
|
10308
|
+
return [4 /*yield*/, isFileExisting(envFilename, $provideFilesystemForNode())];
|
|
10309
|
+
case 4:
|
|
10310
|
+
if (_b.sent()) {
|
|
10311
|
+
$setUsedEnvFilename(envFilename);
|
|
10312
|
+
dotenv__namespace.config({ path: envFilename });
|
|
10313
|
+
return [3 /*break*/, 11];
|
|
10314
|
+
}
|
|
10315
|
+
_b.label = 5;
|
|
10316
|
+
case 5:
|
|
10317
|
+
envFilePatterns_1_1 = envFilePatterns_1.next();
|
|
10318
|
+
return [3 /*break*/, 3];
|
|
10319
|
+
case 6: return [3 /*break*/, 9];
|
|
10320
|
+
case 7:
|
|
10321
|
+
e_1_1 = _b.sent();
|
|
10322
|
+
e_1 = { error: e_1_1 };
|
|
10323
|
+
return [3 /*break*/, 9];
|
|
10324
|
+
case 8:
|
|
10325
|
+
try {
|
|
10326
|
+
if (envFilePatterns_1_1 && !envFilePatterns_1_1.done && (_a = envFilePatterns_1.return)) _a.call(envFilePatterns_1);
|
|
10327
|
+
}
|
|
10328
|
+
finally { if (e_1) throw e_1.error; }
|
|
10329
|
+
return [7 /*endfinally*/];
|
|
10330
|
+
case 9:
|
|
10331
|
+
if (isRootPath(rootDirname)) {
|
|
10332
|
+
return [3 /*break*/, 11];
|
|
10333
|
+
}
|
|
10334
|
+
// Note: If the directory does not exist, try the parent directory
|
|
10335
|
+
rootDirname = path.join(rootDirname, '..');
|
|
10336
|
+
_b.label = 10;
|
|
10337
|
+
case 10:
|
|
10338
|
+
i++;
|
|
10339
|
+
return [3 /*break*/, 1];
|
|
10340
|
+
case 11:
|
|
10341
|
+
llmToolsConfiguration = $llmToolsMetadataRegister
|
|
10342
|
+
.list()
|
|
10343
|
+
.map(function (metadata) { return metadata.createConfigurationFromEnv(process.env); })
|
|
10344
|
+
.filter(function (configuration) { return configuration !== null; });
|
|
10345
|
+
return [2 /*return*/, llmToolsConfiguration];
|
|
10346
|
+
}
|
|
10347
|
+
});
|
|
10348
|
+
});
|
|
10349
|
+
}
|
|
10350
|
+
/**
|
|
10351
|
+
* TODO: [🧠][🪁] Maybe do allow to do auto-install if package not registered and not found
|
|
10352
|
+
* TODO: Add Azure OpenAI
|
|
10353
|
+
* TODO: [🧠][🍛]
|
|
10354
|
+
* TODO: [🧠] Is there some meaningfull way how to test this util
|
|
10355
|
+
* Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
|
|
10356
|
+
* TODO: [👷♂️] @@@ Manual about construction of llmTools
|
|
10357
|
+
* TODO: This should be maybe not under `_common` but under `utils`
|
|
10358
|
+
* TODO: [🧠][⚛] Maybe pass env as argument
|
|
10359
|
+
* TODO: [®] DRY Register logic */
|
|
10360
|
+
|
|
10174
10361
|
/**
|
|
10175
10362
|
* @@@
|
|
10176
10363
|
*
|
|
@@ -10287,6 +10474,10 @@
|
|
|
10287
10474
|
return [4 /*yield*/, scraperFactory(tools, options || {})];
|
|
10288
10475
|
case 3:
|
|
10289
10476
|
scraper = _g.sent();
|
|
10477
|
+
if (scraper.metadata.packageName === '@promptbook/boilerplate' ||
|
|
10478
|
+
scraper.metadata.mimeTypes.some(function (mimeType) { return mimeType.includes('DISABLED'); })) {
|
|
10479
|
+
return [3 /*break*/, 4];
|
|
10480
|
+
}
|
|
10290
10481
|
scrapers.push(scraper);
|
|
10291
10482
|
_g.label = 4;
|
|
10292
10483
|
case 4:
|
|
@@ -10320,6 +10511,9 @@
|
|
|
10320
10511
|
* @public exported from `@promptbook/utils`
|
|
10321
10512
|
*/
|
|
10322
10513
|
new Function("\n try {\n return this === window;\n } catch (e) {\n return false;\n }\n");
|
|
10514
|
+
/**
|
|
10515
|
+
* TODO: [☑]
|
|
10516
|
+
*/
|
|
10323
10517
|
|
|
10324
10518
|
/**
|
|
10325
10519
|
* Detects if the code is running in jest environment
|
|
@@ -10329,6 +10523,9 @@
|
|
|
10329
10523
|
* @public exported from `@promptbook/utils`
|
|
10330
10524
|
*/
|
|
10331
10525
|
new Function("\n try {\n return process.env.JEST_WORKER_ID !== undefined;\n } catch (e) {\n return false;\n }\n");
|
|
10526
|
+
/**
|
|
10527
|
+
* TODO: [☑]
|
|
10528
|
+
*/
|
|
10332
10529
|
|
|
10333
10530
|
/**
|
|
10334
10531
|
* Detects if the code is running in a web worker
|
|
@@ -10338,6 +10535,9 @@
|
|
|
10338
10535
|
* @public exported from `@promptbook/utils`
|
|
10339
10536
|
*/
|
|
10340
10537
|
new Function("\n try {\n if (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope) {\n return true;\n } else {\n return false;\n }\n } catch (e) {\n return false;\n }\n");
|
|
10538
|
+
/**
|
|
10539
|
+
* TODO: [☑]
|
|
10540
|
+
*/
|
|
10341
10541
|
|
|
10342
10542
|
/**
|
|
10343
10543
|
* Makes first letter of a string uppercase
|
|
@@ -11274,15 +11474,6 @@
|
|
|
11274
11474
|
* TODO: [🍙] Make some standard order of json properties
|
|
11275
11475
|
*/
|
|
11276
11476
|
|
|
11277
|
-
/**
|
|
11278
|
-
* @@@
|
|
11279
|
-
*
|
|
11280
|
-
* @private for `FileCacheStorage`
|
|
11281
|
-
*/
|
|
11282
|
-
function nameToSubfolderPath(name) {
|
|
11283
|
-
return [name.substr(0, 1).toLowerCase(), name.substr(1, 1).toLowerCase()];
|
|
11284
|
-
}
|
|
11285
|
-
|
|
11286
11477
|
/**
|
|
11287
11478
|
* @@@
|
|
11288
11479
|
*
|