@promptbook/core 0.89.0-14 → 0.89.0-16
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/esm/index.es.js +64 -39
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/core.index.d.ts +6 -4
- package/esm/typings/src/_packages/types.index.d.ts +4 -0
- package/esm/typings/src/cli/cli-commands/login.d.ts +0 -1
- package/esm/typings/src/cli/common/$provideLlmToolsForCli.d.ts +16 -3
- package/esm/typings/src/config.d.ts +15 -19
- package/esm/typings/src/errors/PipelineExecutionError.d.ts +1 -1
- package/esm/typings/src/errors/assertsError.d.ts +4 -3
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForWizzardOrCli.d.ts +10 -1
- package/esm/typings/src/remote-server/socket-types/_subtypes/identificationToPromptbookToken.d.ts +11 -0
- package/esm/typings/src/remote-server/socket-types/_subtypes/promptbookTokenToIdentification.d.ts +10 -0
- package/esm/typings/src/storage/env-storage/$EnvStorage.d.ts +4 -1
- package/esm/typings/src/types/typeAliases.d.ts +12 -0
- package/package.json +7 -3
- package/umd/index.umd.js +66 -40
- package/umd/index.umd.js.map +1 -1
package/esm/index.es.js
CHANGED
|
@@ -27,7 +27,7 @@ const BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
|
27
27
|
* @generated
|
|
28
28
|
* @see https://github.com/webgptorg/promptbook
|
|
29
29
|
*/
|
|
30
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.89.0-
|
|
30
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.89.0-16';
|
|
31
31
|
/**
|
|
32
32
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
33
33
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -213,22 +213,6 @@ const ADMIN_GITHUB_NAME = 'hejny';
|
|
|
213
213
|
*/
|
|
214
214
|
const CLAIM = `It's time for a paradigm shift. The future of software in plain English, French or Latin`;
|
|
215
215
|
// <- TODO: [🐊] Pick the best claim
|
|
216
|
-
/**
|
|
217
|
-
* Logo for the light theme
|
|
218
|
-
*
|
|
219
|
-
* TODO: [🗽] Unite branding and make single place for it
|
|
220
|
-
*
|
|
221
|
-
* @public exported from `@promptbook/core`
|
|
222
|
-
*/
|
|
223
|
-
const LOGO_LIGHT_SRC = `https://promptbook.studio/_next/static/media/promptbook-logo.b21f0c70.png`; // <- TODO: !!! Auto-update or remove
|
|
224
|
-
/**
|
|
225
|
-
* Logo for the dark theme
|
|
226
|
-
*
|
|
227
|
-
* TODO: [🗽] Unite branding and make single place for it
|
|
228
|
-
*
|
|
229
|
-
* @public exported from `@promptbook/core`
|
|
230
|
-
*/
|
|
231
|
-
const LOGO_DARK_SRC = `https://promptbook.studio/_next/static/media/promptbook-logo-white.09887cbc.png`; // <- TODO: !!! Auto-update or remove
|
|
232
216
|
/**
|
|
233
217
|
* When the title is not provided, the default title is used
|
|
234
218
|
*
|
|
@@ -340,7 +324,7 @@ const DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_TOTAL = 200;
|
|
|
340
324
|
*/
|
|
341
325
|
const DEFAULT_BOOKS_DIRNAME = './books';
|
|
342
326
|
// <- TODO: [🕝] Make also `BOOKS_DIRNAME_ALTERNATIVES`
|
|
343
|
-
// TODO:
|
|
327
|
+
// TODO: Just `.promptbook` in config, hardcode subfolders like `download-cache` or `execution-cache`
|
|
344
328
|
/**
|
|
345
329
|
* Where to store the temporary downloads
|
|
346
330
|
*
|
|
@@ -402,11 +386,20 @@ const MOMENT_ARG_THRESHOLDS = {
|
|
|
402
386
|
ss: 3, // <- least number of seconds to be counted in seconds, minus 1. Must be set after setting the `s` unit or without setting the `s` unit.
|
|
403
387
|
};
|
|
404
388
|
/**
|
|
405
|
-
*
|
|
389
|
+
* Available remote servers for the Promptbook
|
|
390
|
+
*
|
|
391
|
+
* @public exported from `@promptbook/core`
|
|
392
|
+
*/
|
|
393
|
+
const REMOTE_SERVER_URLS = [
|
|
394
|
+
'https://s1.ptbk.io/promptbook',
|
|
395
|
+
'https://api.pavolhejny.com/promptbook',
|
|
396
|
+
];
|
|
397
|
+
/**
|
|
398
|
+
* Default remote server URL for the Promptbook
|
|
406
399
|
*
|
|
407
400
|
* @public exported from `@promptbook/core`
|
|
408
401
|
*/
|
|
409
|
-
const DEFAULT_REMOTE_SERVER_URL =
|
|
402
|
+
const DEFAULT_REMOTE_SERVER_URL = REMOTE_SERVER_URLS[0];
|
|
410
403
|
// <- TODO: [🧜♂️]
|
|
411
404
|
/**
|
|
412
405
|
* @@@
|
|
@@ -538,44 +531,42 @@ class WrappedError extends Error {
|
|
|
538
531
|
constructor(whatWasThrown) {
|
|
539
532
|
const tag = `[🤮]`;
|
|
540
533
|
console.error(tag, whatWasThrown);
|
|
541
|
-
super(spaceTrim$1(
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
Note: Look for ${tag} in the console for more details
|
|
545
|
-
!!! Note: \`WrappedError\` indicates that somewhere in the code non-Error object was thrown and it was wrapped
|
|
534
|
+
super(spaceTrim$1(`
|
|
535
|
+
Non-Error object was thrown
|
|
546
536
|
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
537
|
+
Note: Look for ${tag} in the console for more details
|
|
538
|
+
Please report issue on ${ADMIN_EMAIL}
|
|
539
|
+
`));
|
|
550
540
|
this.name = 'WrappedError';
|
|
551
541
|
Object.setPrototypeOf(this, WrappedError.prototype);
|
|
552
542
|
}
|
|
553
543
|
}
|
|
554
544
|
|
|
555
545
|
/**
|
|
556
|
-
*
|
|
546
|
+
* Helper used in catch blocks to assert that the error is an instance of `Error`
|
|
557
547
|
*
|
|
558
|
-
* @param whatWasThrown
|
|
559
|
-
* @returns
|
|
548
|
+
* @param whatWasThrown Any object that was thrown
|
|
549
|
+
* @returns Nothing if the error is an instance of `Error`
|
|
550
|
+
* @throws `WrappedError` or `UnexpectedError` if the error is not standard
|
|
560
551
|
*
|
|
561
552
|
* @private within the repository
|
|
562
553
|
*/
|
|
563
554
|
function assertsError(whatWasThrown) {
|
|
564
|
-
// Case 1:
|
|
555
|
+
// Case 1: Handle error which was rethrown as `WrappedError`
|
|
565
556
|
if (whatWasThrown instanceof WrappedError) {
|
|
566
557
|
const wrappedError = whatWasThrown;
|
|
567
558
|
throw wrappedError;
|
|
568
559
|
}
|
|
569
|
-
// Case 2:
|
|
560
|
+
// Case 2: Handle unexpected errors
|
|
570
561
|
if (whatWasThrown instanceof UnexpectedError) {
|
|
571
562
|
const unexpectedError = whatWasThrown;
|
|
572
563
|
throw unexpectedError;
|
|
573
564
|
}
|
|
574
|
-
// Case 3:
|
|
565
|
+
// Case 3: Handle standard errors - keep them up to consumer
|
|
575
566
|
if (whatWasThrown instanceof Error) {
|
|
576
567
|
return;
|
|
577
568
|
}
|
|
578
|
-
// Case 4:
|
|
569
|
+
// Case 4: Handle non-standard errors - wrap them into `WrappedError` and throw
|
|
579
570
|
throw new WrappedError(whatWasThrown);
|
|
580
571
|
}
|
|
581
572
|
|
|
@@ -1923,7 +1914,7 @@ class PipelineExecutionError extends Error {
|
|
|
1923
1914
|
}
|
|
1924
1915
|
}
|
|
1925
1916
|
/**
|
|
1926
|
-
* TODO:
|
|
1917
|
+
* TODO: [🧠][🌂] Add id to all errors
|
|
1927
1918
|
*/
|
|
1928
1919
|
|
|
1929
1920
|
/**
|
|
@@ -2235,8 +2226,8 @@ function createTask(options) {
|
|
|
2235
2226
|
updatedAt = new Date();
|
|
2236
2227
|
errors.push(...executionResult.errors);
|
|
2237
2228
|
warnings.push(...executionResult.warnings);
|
|
2238
|
-
// <- TODO:
|
|
2239
|
-
// TODO: [🧠]
|
|
2229
|
+
// <- TODO: [🌂] Only unique errors and warnings should be added (or filtered)
|
|
2230
|
+
// TODO: [🧠] !! errors, warning, isSuccessful are redundant both in `ExecutionTask` and `ExecutionTask.currentValue`
|
|
2240
2231
|
// Also maybe move `ExecutionTask.currentValue.usage` -> `ExecutionTask.usage`
|
|
2241
2232
|
// And delete `ExecutionTask.currentValue.preparedPipeline`
|
|
2242
2233
|
assertsTaskSuccessful(executionResult);
|
|
@@ -10670,6 +10661,40 @@ function book(strings, ...values) {
|
|
|
10670
10661
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
10671
10662
|
*/
|
|
10672
10663
|
|
|
10664
|
+
/**
|
|
10665
|
+
* Convert identification to Promptbook token
|
|
10666
|
+
*
|
|
10667
|
+
* @param identification
|
|
10668
|
+
*
|
|
10669
|
+
* @public exported from `@promptbook/core`
|
|
10670
|
+
*/
|
|
10671
|
+
function identificationToPromptbookToken(identification) {
|
|
10672
|
+
const { appId, userId, userToken } = identification;
|
|
10673
|
+
const promptbookToken = `${appId}-${userId}-${userToken}`;
|
|
10674
|
+
return promptbookToken;
|
|
10675
|
+
}
|
|
10676
|
+
|
|
10677
|
+
/**
|
|
10678
|
+
* Convert Promptbook token to identification
|
|
10679
|
+
*
|
|
10680
|
+
* @param promptbookToken
|
|
10681
|
+
*
|
|
10682
|
+
* @public exported from `@promptbook/core`
|
|
10683
|
+
*/
|
|
10684
|
+
function promptbookTokenToIdentification(promptbookToken) {
|
|
10685
|
+
const [appId, userId, userToken] = promptbookToken.split('-');
|
|
10686
|
+
if (!appId || !userId || !userToken) {
|
|
10687
|
+
throw new Error(`Invalid promptbook token: ${promptbookToken}`);
|
|
10688
|
+
}
|
|
10689
|
+
const identification = {
|
|
10690
|
+
appId,
|
|
10691
|
+
userId,
|
|
10692
|
+
userToken,
|
|
10693
|
+
isAnonymous: false,
|
|
10694
|
+
};
|
|
10695
|
+
return identification;
|
|
10696
|
+
}
|
|
10697
|
+
|
|
10673
10698
|
/**
|
|
10674
10699
|
* Metadata of the scraper
|
|
10675
10700
|
*
|
|
@@ -10959,5 +10984,5 @@ class PrefixStorage {
|
|
|
10959
10984
|
}
|
|
10960
10985
|
}
|
|
10961
10986
|
|
|
10962
|
-
export { $llmToolsMetadataRegister, $llmToolsRegister, $scrapersMetadataRegister, $scrapersRegister, ADMIN_EMAIL, ADMIN_GITHUB_NAME, AbstractFormatError, AuthenticationError, BOOK_LANGUAGE_VERSION, BlackholeStorage, BoilerplateError, BoilerplateFormfactorDefinition, CLAIM, CLI_APP_ID, CallbackInterfaceTools, ChatbotFormfactorDefinition, CollectionError, CsvFormatDefinition, CsvFormatError, DEFAULT_BOOKS_DIRNAME, DEFAULT_BOOK_OUTPUT_PARAMETER_NAME, DEFAULT_BOOK_TITLE, DEFAULT_CSV_SETTINGS, DEFAULT_DOWNLOAD_CACHE_DIRNAME, DEFAULT_EXECUTION_CACHE_DIRNAME, DEFAULT_GET_PIPELINE_COLLECTION_FUNCTION_NAME, DEFAULT_INTERMEDIATE_FILES_STRATEGY, DEFAULT_IS_AUTO_INSTALLED, DEFAULT_IS_VERBOSE, DEFAULT_MAX_EXECUTION_ATTEMPTS, DEFAULT_MAX_FILE_SIZE, DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_DEPTH, DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_TOTAL, DEFAULT_MAX_PARALLEL_COUNT, DEFAULT_PIPELINE_COLLECTION_BASE_FILENAME, DEFAULT_PROMPT_TASK_TITLE, DEFAULT_REMOTE_SERVER_URL, DEFAULT_SCRAPE_CACHE_DIRNAME, DEFAULT_TASK_TITLE, EXPECTATION_UNITS, EnvironmentMismatchError, ExecutionReportStringOptionsDefaults, ExpectError, FORMFACTOR_DEFINITIONS, GENERIC_PIPELINE_INTERFACE, GeneratorFormfactorDefinition, GenericFormfactorDefinition, ImageGeneratorFormfactorDefinition, KnowledgeScrapeError,
|
|
10987
|
+
export { $llmToolsMetadataRegister, $llmToolsRegister, $scrapersMetadataRegister, $scrapersRegister, ADMIN_EMAIL, ADMIN_GITHUB_NAME, AbstractFormatError, AuthenticationError, BOOK_LANGUAGE_VERSION, BlackholeStorage, BoilerplateError, BoilerplateFormfactorDefinition, CLAIM, CLI_APP_ID, CallbackInterfaceTools, ChatbotFormfactorDefinition, CollectionError, CsvFormatDefinition, CsvFormatError, DEFAULT_BOOKS_DIRNAME, DEFAULT_BOOK_OUTPUT_PARAMETER_NAME, DEFAULT_BOOK_TITLE, DEFAULT_CSV_SETTINGS, DEFAULT_DOWNLOAD_CACHE_DIRNAME, DEFAULT_EXECUTION_CACHE_DIRNAME, DEFAULT_GET_PIPELINE_COLLECTION_FUNCTION_NAME, DEFAULT_INTERMEDIATE_FILES_STRATEGY, DEFAULT_IS_AUTO_INSTALLED, DEFAULT_IS_VERBOSE, DEFAULT_MAX_EXECUTION_ATTEMPTS, DEFAULT_MAX_FILE_SIZE, DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_DEPTH, DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_TOTAL, DEFAULT_MAX_PARALLEL_COUNT, DEFAULT_PIPELINE_COLLECTION_BASE_FILENAME, DEFAULT_PROMPT_TASK_TITLE, DEFAULT_REMOTE_SERVER_URL, DEFAULT_SCRAPE_CACHE_DIRNAME, DEFAULT_TASK_TITLE, EXPECTATION_UNITS, EnvironmentMismatchError, ExecutionReportStringOptionsDefaults, ExpectError, FORMFACTOR_DEFINITIONS, GENERIC_PIPELINE_INTERFACE, GeneratorFormfactorDefinition, GenericFormfactorDefinition, ImageGeneratorFormfactorDefinition, KnowledgeScrapeError, LimitReachedError, MANDATORY_CSV_SETTINGS, MAX_FILENAME_LENGTH, MODEL_VARIANTS, MatcherFormfactorDefinition, MemoryStorage, MissingToolsError, MultipleLlmExecutionTools, NAME, NonTaskSectionTypes, NotFoundError, NotYetImplementedError, ORDER_OF_PIPELINE_JSON, PLAYGROUND_APP_ID, PROMPTBOOK_ENGINE_VERSION, PROMPTBOOK_ERRORS, ParseError, PipelineExecutionError, PipelineLogicError, PipelineUrlError, PrefixStorage, PromptbookFetchError, REMOTE_SERVER_URLS, RESERVED_PARAMETER_NAMES, SET_IS_VERBOSE, SectionTypes, SheetsFormfactorDefinition, TaskTypes, TextFormatDefinition, TranslatorFormfactorDefinition, UNCERTAIN_USAGE, UNCERTAIN_ZERO_VALUE, UnexpectedError, WrappedError, ZERO_USAGE, ZERO_VALUE, _AnthropicClaudeMetadataRegistration, _AzureOpenAiMetadataRegistration, _BoilerplateScraperMetadataRegistration, _DeepseekMetadataRegistration, _DocumentScraperMetadataRegistration, _GoogleMetadataRegistration, _LegacyDocumentScraperMetadataRegistration, _MarkdownScraperMetadataRegistration, _MarkitdownScraperMetadataRegistration, _OpenAiAssistantMetadataRegistration, _OpenAiMetadataRegistration, _PdfScraperMetadataRegistration, _WebsiteScraperMetadataRegistration, addUsage, book, cacheLlmTools, collectionToJson, compilePipeline, countUsage, createCollectionFromJson, createCollectionFromPromise, createCollectionFromUrl, createLlmToolsFromConfiguration, createPipelineExecutor, createSubcollection, embeddingVectorToString, executionReportJsonToString, extractParameterNamesFromTask, getPipelineInterface, identificationToPromptbookToken, isPassingExpectations, isPipelineImplementingInterface, isPipelineInterfacesEqual, isPipelinePrepared, isValidPipelineString, joinLlmExecutionTools, limitTotalUsage, makeKnowledgeSourceHandler, parsePipeline, pipelineJsonToString, prepareKnowledgePieces, preparePersona, preparePipeline, prepareTasks, prettifyPipelineString, promptbookFetch, promptbookTokenToIdentification, unpreparePipeline, usageToHuman, usageToWorktime, validatePipeline, validatePipelineString };
|
|
10963
10988
|
//# sourceMappingURL=index.es.js.map
|