@promptbook/markdown-utils 0.89.0-8 → 0.89.0-9
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 +27 -6
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/core.index.d.ts +4 -0
- package/esm/typings/src/_packages/remote-client.index.d.ts +6 -6
- package/esm/typings/src/_packages/remote-server.index.d.ts +6 -6
- package/esm/typings/src/_packages/types.index.d.ts +10 -18
- package/esm/typings/src/errors/0-index.d.ts +3 -0
- package/esm/typings/src/errors/PromptbookFetchError.d.ts +9 -0
- package/esm/typings/src/llm-providers/_common/register/$provideEnvFilepath.d.ts +12 -0
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsConfigurationFromEnv.d.ts +2 -8
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForTestingAndScriptsAndPlayground.d.ts +2 -0
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForWizzardOrCli.d.ts +5 -3
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsFromEnv.d.ts +1 -0
- package/esm/typings/src/remote-server/socket-types/_subtypes/{PromptbookServer_Identification.d.ts → Identification.d.ts} +3 -3
- package/esm/typings/src/remote-server/socket-types/listModels/PromptbookServer_ListModels_Request.d.ts +2 -2
- package/esm/typings/src/remote-server/socket-types/prepare/PromptbookServer_PreparePipeline_Request.d.ts +2 -2
- package/esm/typings/src/remote-server/socket-types/prompt/PromptbookServer_Prompt_Request.d.ts +2 -2
- package/esm/typings/src/remote-server/types/RemoteClientOptions.d.ts +2 -2
- package/esm/typings/src/remote-server/types/RemoteServerOptions.d.ts +43 -30
- package/esm/typings/src/scrapers/_common/utils/{scraperFetch.d.ts → promptbookFetch.d.ts} +2 -2
- package/package.json +1 -1
- package/umd/index.umd.js +27 -6
- package/umd/index.umd.js.map +1 -1
- package/esm/typings/src/playground/BrjappConnector.d.ts +0 -67
- package/esm/typings/src/playground/brjapp-api-schema.d.ts +0 -12879
package/esm/index.es.js
CHANGED
|
@@ -25,7 +25,7 @@ const BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
|
25
25
|
* @generated
|
|
26
26
|
* @see https://github.com/webgptorg/promptbook
|
|
27
27
|
*/
|
|
28
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.89.0-
|
|
28
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.89.0-9';
|
|
29
29
|
/**
|
|
30
30
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
31
31
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -1912,6 +1912,19 @@ class NotYetImplementedError extends Error {
|
|
|
1912
1912
|
}
|
|
1913
1913
|
}
|
|
1914
1914
|
|
|
1915
|
+
/**
|
|
1916
|
+
* Error thrown when a fetch request fails
|
|
1917
|
+
*
|
|
1918
|
+
* @public exported from `@promptbook/core`
|
|
1919
|
+
*/
|
|
1920
|
+
class PromptbookFetchError extends Error {
|
|
1921
|
+
constructor(message) {
|
|
1922
|
+
super(message);
|
|
1923
|
+
this.name = 'PromptbookFetchError';
|
|
1924
|
+
Object.setPrototypeOf(this, PromptbookFetchError.prototype);
|
|
1925
|
+
}
|
|
1926
|
+
}
|
|
1927
|
+
|
|
1915
1928
|
/**
|
|
1916
1929
|
* Index of all custom errors
|
|
1917
1930
|
*
|
|
@@ -1950,6 +1963,7 @@ const COMMON_JAVASCRIPT_ERRORS = {
|
|
|
1950
1963
|
URIError,
|
|
1951
1964
|
AggregateError,
|
|
1952
1965
|
AuthenticationError,
|
|
1966
|
+
PromptbookFetchError,
|
|
1953
1967
|
/*
|
|
1954
1968
|
Note: Not widely supported
|
|
1955
1969
|
> InternalError,
|
|
@@ -3315,17 +3329,24 @@ function titleToName(value) {
|
|
|
3315
3329
|
/**
|
|
3316
3330
|
* The built-in `fetch' function with a lightweight error handling wrapper as default fetch function used in Promptbook scrapers
|
|
3317
3331
|
*
|
|
3318
|
-
* @
|
|
3332
|
+
* @public exported from `@promptbook/core`
|
|
3319
3333
|
*/
|
|
3320
|
-
const
|
|
3334
|
+
const promptbookFetch = async (urlOrRequest, init) => {
|
|
3321
3335
|
try {
|
|
3322
|
-
return await fetch(
|
|
3336
|
+
return await fetch(urlOrRequest, init);
|
|
3323
3337
|
}
|
|
3324
3338
|
catch (error) {
|
|
3325
3339
|
if (!(error instanceof Error)) {
|
|
3326
3340
|
throw error;
|
|
3327
3341
|
}
|
|
3328
|
-
|
|
3342
|
+
let url;
|
|
3343
|
+
if (typeof urlOrRequest === 'string') {
|
|
3344
|
+
url = urlOrRequest;
|
|
3345
|
+
}
|
|
3346
|
+
else if (urlOrRequest instanceof Request) {
|
|
3347
|
+
url = urlOrRequest.url;
|
|
3348
|
+
}
|
|
3349
|
+
throw new PromptbookFetchError(spaceTrim((block) => `
|
|
3329
3350
|
Can not fetch "${url}"
|
|
3330
3351
|
|
|
3331
3352
|
Fetch error:
|
|
@@ -3346,7 +3367,7 @@ const scraperFetch = async (url, init) => {
|
|
|
3346
3367
|
async function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
|
|
3347
3368
|
// console.log('!! makeKnowledgeSourceHandler', knowledgeSource);
|
|
3348
3369
|
var _a;
|
|
3349
|
-
const { fetch =
|
|
3370
|
+
const { fetch = promptbookFetch } = tools;
|
|
3350
3371
|
const { knowledgeSourceContent } = knowledgeSource;
|
|
3351
3372
|
let { name } = knowledgeSource;
|
|
3352
3373
|
const { rootDirname = null,
|