@promptbook/wizard 0.112.0-115 → 0.112.0-117
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 +16 -17
- package/esm/index.es.js.map +1 -1
- package/esm/src/_packages/components.index.d.ts +2 -0
- package/esm/src/_packages/node.index.d.ts +10 -0
- package/esm/src/book-3.0/CliAgent.d.ts +8 -15
- package/esm/src/book-3.0/agentFolderPaths.d.ts +30 -0
- package/esm/src/book-components/BookEditor/BookEditorBrowserConfig.d.ts +2 -0
- package/esm/src/book-components/BookEditor/BookEditorForClient.d.ts +7 -0
- package/esm/src/book-components/BookEditor/createDeprecatedCommitmentDiagnostics.browser.d.ts +9 -0
- package/esm/src/cli/cli-commands/agent-folder/agentProjectPaths.d.ts +2 -30
- package/esm/src/scrapers/website/utils/createShowdownConverter.d.ts +2 -2
- package/esm/src/version.d.ts +1 -1
- package/package.json +2 -3
- package/umd/index.umd.js +20 -17
- package/umd/index.umd.js.map +1 -1
- package/umd/src/_packages/components.index.d.ts +2 -0
- package/umd/src/_packages/node.index.d.ts +10 -0
- package/umd/src/book-3.0/CliAgent.d.ts +8 -15
- package/umd/src/book-3.0/agentFolderPaths.d.ts +30 -0
- package/umd/src/book-components/BookEditor/BookEditorBrowserConfig.d.ts +2 -0
- package/umd/src/book-components/BookEditor/BookEditorForClient.d.ts +7 -0
- package/umd/src/book-components/BookEditor/createDeprecatedCommitmentDiagnostics.browser.d.ts +9 -0
- package/umd/src/cli/cli-commands/agent-folder/agentProjectPaths.d.ts +2 -30
- package/umd/src/scrapers/website/utils/createShowdownConverter.d.ts +2 -2
- package/umd/src/version.d.ts +1 -1
package/esm/index.es.js
CHANGED
|
@@ -7,20 +7,19 @@ import { OpenAIClient, AzureKeyCredential } from '@azure/openai';
|
|
|
7
7
|
import { mkdir, rm, readFile, readdir, rename, rmdir, stat, access, constants, writeFile, watch, unlink } from 'fs/promises';
|
|
8
8
|
import { spawn } from 'child_process';
|
|
9
9
|
import { forTime } from 'waitasecond';
|
|
10
|
-
import
|
|
10
|
+
import CryptoJS from 'crypto-js';
|
|
11
11
|
import hexEncoder from 'crypto-js/enc-hex';
|
|
12
12
|
import { basename, join, dirname, isAbsolute, relative } from 'path';
|
|
13
13
|
import { Readability } from '@mozilla/readability';
|
|
14
14
|
import { JSDOM } from 'jsdom';
|
|
15
|
-
import
|
|
15
|
+
import showdown from 'showdown';
|
|
16
16
|
import * as dotenv from 'dotenv';
|
|
17
17
|
import sha256 from 'crypto-js/sha256';
|
|
18
18
|
import JSZip from 'jszip';
|
|
19
19
|
import { Subject, BehaviorSubject } from 'rxjs';
|
|
20
|
-
import { randomBytes } from 'crypto';
|
|
21
20
|
import moment from 'moment';
|
|
22
21
|
import { lookup, extension } from 'mime-types';
|
|
23
|
-
import
|
|
22
|
+
import papaparse from 'papaparse';
|
|
24
23
|
import { fileSearchTool, tool, Agent as Agent$1, webSearchTool, run, setDefaultOpenAIClient, setDefaultOpenAIKey } from '@openai/agents';
|
|
25
24
|
import OpenAI from 'openai';
|
|
26
25
|
|
|
@@ -38,7 +37,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
|
|
|
38
37
|
* @generated
|
|
39
38
|
* @see https://github.com/webgptorg/promptbook
|
|
40
39
|
*/
|
|
41
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-
|
|
40
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-117';
|
|
42
41
|
/**
|
|
43
42
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
44
43
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -2346,7 +2345,7 @@ class ParseError extends Error {
|
|
|
2346
2345
|
* @private internal helper function
|
|
2347
2346
|
*/
|
|
2348
2347
|
function $randomToken(randomness) {
|
|
2349
|
-
return
|
|
2348
|
+
return CryptoJS.lib.WordArray.random(randomness).toString(CryptoJS.enc.Hex);
|
|
2350
2349
|
}
|
|
2351
2350
|
// TODO: [🤶] Maybe export through `@promptbook/utils` or `@promptbook/random` package
|
|
2352
2351
|
// TODO: Maybe use nanoid instead https://github.com/ai/nanoid
|
|
@@ -13301,7 +13300,7 @@ function $registeredScrapersMessage(availableScrapers) {
|
|
|
13301
13300
|
* @public exported from `@promptbook/editable`
|
|
13302
13301
|
*/
|
|
13303
13302
|
function knowledgeSourceContentToName(knowledgeSourceContent) {
|
|
13304
|
-
const hash = SHA256(hexEncoder.parse(JSON.stringify(knowledgeSourceContent)))
|
|
13303
|
+
const hash = CryptoJS.SHA256(hexEncoder.parse(JSON.stringify(knowledgeSourceContent)))
|
|
13305
13304
|
// <- TODO: [🥬] Encapsulate sha256 to some private utility function
|
|
13306
13305
|
.toString( /* hex */)
|
|
13307
13306
|
.substring(0, 20);
|
|
@@ -14181,7 +14180,7 @@ function csvParse(value /* <- TODO: string_csv */, settings, schema /* <- TODO:
|
|
|
14181
14180
|
console.warn('CSV string contains carriage return characters, but in the CSV settings the `newline` setting does not include them. Autohealing the CSV string.');
|
|
14182
14181
|
value = value.replace(/\r\n/g, '\n').replace(/\r/g, '\n');
|
|
14183
14182
|
}
|
|
14184
|
-
const csv = parse(value, settings);
|
|
14183
|
+
const csv = papaparse.parse(value, settings);
|
|
14185
14184
|
return csv;
|
|
14186
14185
|
}
|
|
14187
14186
|
|
|
@@ -14266,10 +14265,10 @@ const CsvFormatParser = {
|
|
|
14266
14265
|
i > index ? { ...row, [outputParameterName]: PENDING_VALUE_PLACEHOLDER } : row,
|
|
14267
14266
|
);
|
|
14268
14267
|
*/
|
|
14269
|
-
await onProgress(unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS }));
|
|
14268
|
+
await onProgress(papaparse.unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS }));
|
|
14270
14269
|
}
|
|
14271
14270
|
}
|
|
14272
|
-
return unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS });
|
|
14271
|
+
return papaparse.unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS });
|
|
14273
14272
|
},
|
|
14274
14273
|
},
|
|
14275
14274
|
{
|
|
@@ -14297,7 +14296,7 @@ const CsvFormatParser = {
|
|
|
14297
14296
|
return /* not await */ mapCallback({ [key]: value }, index, array.length);
|
|
14298
14297
|
}));
|
|
14299
14298
|
}));
|
|
14300
|
-
return unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS });
|
|
14299
|
+
return papaparse.unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS });
|
|
14301
14300
|
},
|
|
14302
14301
|
},
|
|
14303
14302
|
],
|
|
@@ -16313,7 +16312,7 @@ async function getScraperIntermediateSource(source, options) {
|
|
|
16313
16312
|
const { filename: sourceFilename, url } = source;
|
|
16314
16313
|
const { rootDirname, cacheDirname, intermediateFilesStrategy, extension, isVerbose } = options;
|
|
16315
16314
|
// TODO: [👬] DRY
|
|
16316
|
-
const hash = SHA256(
|
|
16315
|
+
const hash = CryptoJS.SHA256(
|
|
16317
16316
|
// <- TODO: [🥬] Encapsulate sha256 to some private utility function
|
|
16318
16317
|
hexEncoder.parse(sourceFilename || url || 'untitled'))
|
|
16319
16318
|
.toString( /* hex */)
|
|
@@ -17216,7 +17215,7 @@ const _WebsiteScraperMetadataRegistration = $scrapersMetadataRegister.register(w
|
|
|
17216
17215
|
* @private utility of `WebsiteScraper`
|
|
17217
17216
|
*/
|
|
17218
17217
|
function createShowdownConverter() {
|
|
17219
|
-
return new Converter({
|
|
17218
|
+
return new showdown.Converter({
|
|
17220
17219
|
flavor: 'github',
|
|
17221
17220
|
/*
|
|
17222
17221
|
> import showdownHighlight from 'showdown-highlight';
|
|
@@ -17400,7 +17399,7 @@ function normalizeWhitespaces(sentence) {
|
|
|
17400
17399
|
* @public exported from `@promptbook/utils`
|
|
17401
17400
|
*/
|
|
17402
17401
|
function computeHash(value) {
|
|
17403
|
-
return SHA256(hexEncoder.parse(spaceTrim$1(valueToString(value)))).toString( /* hex */);
|
|
17402
|
+
return CryptoJS.SHA256(hexEncoder.parse(spaceTrim$1(valueToString(value)))).toString( /* hex */);
|
|
17404
17403
|
}
|
|
17405
17404
|
// TODO: [🥬][🥬] Use this ACRY
|
|
17406
17405
|
|
|
@@ -49799,7 +49798,7 @@ function emitAgentLlmExecutionToolsAssistantPreparationProgress(options) {
|
|
|
49799
49798
|
* Computes one stable hash from a JSON-serializable value.
|
|
49800
49799
|
*/
|
|
49801
49800
|
function computeJsonHash$1(value) {
|
|
49802
|
-
return SHA256(JSON.stringify(value)).toString();
|
|
49801
|
+
return CryptoJS.SHA256(JSON.stringify(value)).toString();
|
|
49803
49802
|
}
|
|
49804
49803
|
/**
|
|
49805
49804
|
* Handles OpenAI AgentKit-backed executions for `AgentLlmExecutionTools`.
|
|
@@ -49957,7 +49956,7 @@ AgentLlmExecutionToolsAgentKitRunner.vectorStoreCache = new Map();
|
|
|
49957
49956
|
* Computes one stable hash from a JSON-serializable value.
|
|
49958
49957
|
*/
|
|
49959
49958
|
function computeJsonHash(value) {
|
|
49960
|
-
return SHA256(JSON.stringify(value)).toString();
|
|
49959
|
+
return CryptoJS.SHA256(JSON.stringify(value)).toString();
|
|
49961
49960
|
}
|
|
49962
49961
|
/**
|
|
49963
49962
|
* Removes assistant-managed requirements before the prompt is executed via OpenAI Assistants.
|
|
@@ -50759,7 +50758,7 @@ class AgentLlmExecutionTools {
|
|
|
50759
50758
|
* Returns a virtual model name representing the agent behavior.
|
|
50760
50759
|
*/
|
|
50761
50760
|
get modelName() {
|
|
50762
|
-
const hash = SHA256(hexEncoder.parse(this.options.agentSource)).toString( /* hex */);
|
|
50761
|
+
const hash = CryptoJS.SHA256(hexEncoder.parse(this.options.agentSource)).toString( /* hex */);
|
|
50763
50762
|
const agentId = hash.substring(0, 10);
|
|
50764
50763
|
return (normalizeToKebabCase(this.title) + '-' + agentId);
|
|
50765
50764
|
}
|