@promptbook/cli 0.112.0-114 → 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 +35 -32
- 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 +1 -1
- package/src/_packages/components.index.ts +2 -0
- package/src/_packages/node.index.ts +10 -0
- package/src/book-3.0/CliAgent.ts +23 -85
- package/src/book-3.0/agentFolderPaths.ts +38 -0
- package/src/book-components/BookEditor/BookEditor.tsx +1 -1
- package/src/book-components/BookEditor/BookEditorAboutPromptbookInformation.tsx +2 -4
- package/src/book-components/BookEditor/BookEditorActionbar.tsx +32 -2
- package/src/book-components/BookEditor/BookEditorBrowserConfig.ts +11 -0
- package/src/book-components/BookEditor/BookEditorForClient.tsx +33 -0
- package/src/book-components/BookEditor/BookEditorMonaco.tsx +1 -1
- package/src/book-components/BookEditor/BookEditorMonacoTokenization.ts +83 -15
- package/src/book-components/BookEditor/createDeprecatedCommitmentDiagnostics.browser.ts +11 -0
- package/src/book-components/BookEditor/useBookEditorMonacoLanguage.ts +32 -46
- package/src/book-components/BookEditor/useBookEditorMonacoStyles.ts +1 -1
- package/src/book-components/BookEditor/useBookEditorMonacoUploads.ts +1 -1
- package/src/book-components/Chat/utils/renderMarkdown.ts +3 -2
- package/src/cli/cli-commands/agent-folder/agentProjectPaths.ts +15 -35
- package/src/commands/KNOWLEDGE/utils/knowledgeSourceContentToName.ts +2 -2
- package/src/commitments/_common/teamInternalAgentAccess.ts +2 -2
- package/src/formats/csv/CsvFormatParser.ts +4 -4
- package/src/formats/csv/utils/csvParse.ts +2 -2
- package/src/llm-providers/agent/AgentLlmExecutionTools.ts +2 -2
- package/src/llm-providers/agent/AgentLlmExecutionToolsAgentKitRunner.ts +2 -2
- package/src/llm-providers/agent/AgentLlmExecutionToolsOpenAiAssistantRunner.ts +2 -2
- package/src/other/templates/getTemplatesPipelineCollection.ts +719 -752
- package/src/scrapers/_common/utils/getScraperIntermediateSource.ts +2 -2
- package/src/scrapers/website/WebsiteScraper.ts +1 -1
- package/src/scrapers/website/utils/createShowdownConverter.ts +2 -2
- package/src/utils/misc/computeHash.ts +2 -2
- package/src/utils/random/$randomToken.ts +2 -2
- package/src/version.ts +2 -2
- package/src/versions.txt +3 -0
- package/umd/index.umd.js +37 -31
- 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
|
@@ -17,8 +17,8 @@ import { io } from 'socket.io-client';
|
|
|
17
17
|
import JSZip from 'jszip';
|
|
18
18
|
import { Readability } from '@mozilla/readability';
|
|
19
19
|
import { JSDOM } from 'jsdom';
|
|
20
|
-
import
|
|
21
|
-
import
|
|
20
|
+
import CryptoJS from 'crypto-js';
|
|
21
|
+
import showdown from 'showdown';
|
|
22
22
|
import glob from 'glob-promise';
|
|
23
23
|
import http from 'http';
|
|
24
24
|
import express from 'express';
|
|
@@ -32,7 +32,7 @@ import Bottleneck from 'bottleneck';
|
|
|
32
32
|
import { OpenAIClient, AzureKeyCredential } from '@azure/openai';
|
|
33
33
|
import { Subject, BehaviorSubject } from 'rxjs';
|
|
34
34
|
import { lookup, extension } from 'mime-types';
|
|
35
|
-
import
|
|
35
|
+
import papaparse from 'papaparse';
|
|
36
36
|
import { fileSearchTool, tool, Agent as Agent$1, webSearchTool, run, setDefaultOpenAIClient, setDefaultOpenAIKey } from '@openai/agents';
|
|
37
37
|
import OpenAI from 'openai';
|
|
38
38
|
import * as ts from 'typescript';
|
|
@@ -58,7 +58,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
|
|
|
58
58
|
* @generated
|
|
59
59
|
* @see https://github.com/webgptorg/promptbook
|
|
60
60
|
*/
|
|
61
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-
|
|
61
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-117';
|
|
62
62
|
/**
|
|
63
63
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
64
64
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -2054,42 +2054,44 @@ function $initializeAgentCommand(program) {
|
|
|
2054
2054
|
// Note: [🟡] Code for CLI command [agent](src/cli/cli-commands/agent.ts) should never be published outside of `@promptbook/cli`
|
|
2055
2055
|
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
2056
2056
|
|
|
2057
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
2057
2058
|
/**
|
|
2058
|
-
* Relative path to the local agent source
|
|
2059
|
+
* Relative path to the local agent source used by the agent folder convention.
|
|
2059
2060
|
*
|
|
2060
|
-
* @
|
|
2061
|
+
* @public exported from `@promptbook/node`
|
|
2061
2062
|
*/
|
|
2062
2063
|
const AGENT_BOOK_FILE_PATH = 'agent.book';
|
|
2063
2064
|
/**
|
|
2064
|
-
* Relative path to
|
|
2065
|
+
* Relative path to the message queue root used by the agent folder convention.
|
|
2065
2066
|
*
|
|
2066
|
-
* @
|
|
2067
|
-
*/
|
|
2068
|
-
const AGENT_KNOWLEDGE_DIRECTORY_PATH = 'knowledge';
|
|
2069
|
-
/**
|
|
2070
|
-
* Relative path to the message queue root initialized by `ptbk agent-folder init`.
|
|
2071
|
-
*
|
|
2072
|
-
* @private internal utility of `ptbk agent-folder`
|
|
2067
|
+
* @public exported from `@promptbook/node`
|
|
2073
2068
|
*/
|
|
2074
2069
|
const AGENT_MESSAGES_DIRECTORY_PATH = 'messages';
|
|
2075
2070
|
/**
|
|
2076
|
-
* Relative path to queued user messages consumed by
|
|
2071
|
+
* Relative path to queued user messages consumed by the agent runner.
|
|
2077
2072
|
*
|
|
2078
|
-
* @
|
|
2073
|
+
* @public exported from `@promptbook/node`
|
|
2079
2074
|
*/
|
|
2080
2075
|
const AGENT_QUEUED_MESSAGES_DIRECTORY_PATH = join(AGENT_MESSAGES_DIRECTORY_PATH, 'queued');
|
|
2081
2076
|
/**
|
|
2082
|
-
* Relative path to answered messages written by
|
|
2077
|
+
* Relative path to answered messages written by the agent runner.
|
|
2083
2078
|
*
|
|
2084
|
-
* @
|
|
2079
|
+
* @public exported from `@promptbook/node`
|
|
2085
2080
|
*/
|
|
2086
2081
|
const AGENT_FINISHED_MESSAGES_DIRECTORY_PATH = join(AGENT_MESSAGES_DIRECTORY_PATH, 'finished');
|
|
2087
2082
|
/**
|
|
2088
2083
|
* Relative path to messages that the agent runner stopped retrying.
|
|
2089
2084
|
*
|
|
2090
|
-
* @
|
|
2085
|
+
* @public exported from `@promptbook/node`
|
|
2091
2086
|
*/
|
|
2092
2087
|
const AGENT_FAILED_MESSAGES_DIRECTORY_PATH = join(AGENT_MESSAGES_DIRECTORY_PATH, 'failed');
|
|
2088
|
+
|
|
2089
|
+
/**
|
|
2090
|
+
* Relative path to local knowledge files initialized by `ptbk agent-folder init`.
|
|
2091
|
+
*
|
|
2092
|
+
* @private internal utility of `ptbk agent-folder`
|
|
2093
|
+
*/
|
|
2094
|
+
const AGENT_KNOWLEDGE_DIRECTORY_PATH = 'knowledge';
|
|
2093
2095
|
/**
|
|
2094
2096
|
* Relative path to generated local agent documentation initialized by `ptbk agent-folder init`.
|
|
2095
2097
|
*
|
|
@@ -6109,7 +6111,7 @@ function valueToString(value) {
|
|
|
6109
6111
|
* @public exported from `@promptbook/utils`
|
|
6110
6112
|
*/
|
|
6111
6113
|
function computeHash(value) {
|
|
6112
|
-
return SHA256(hexEncoder.parse(spaceTrim$1(valueToString(value)))).toString( /* hex */);
|
|
6114
|
+
return CryptoJS.SHA256(hexEncoder.parse(spaceTrim$1(valueToString(value)))).toString( /* hex */);
|
|
6113
6115
|
}
|
|
6114
6116
|
// TODO: [🥬][🥬] Use this ACRY
|
|
6115
6117
|
|
|
@@ -22115,7 +22117,7 @@ function getTimeoutToolRuntimeAdapterOrDisabledResult(action, runtimeContext) {
|
|
|
22115
22117
|
* @private internal helper function
|
|
22116
22118
|
*/
|
|
22117
22119
|
function $randomToken(randomness) {
|
|
22118
|
-
return
|
|
22120
|
+
return CryptoJS.lib.WordArray.random(randomness).toString(CryptoJS.enc.Hex);
|
|
22119
22121
|
}
|
|
22120
22122
|
// TODO: [🤶] Maybe export through `@promptbook/utils` or `@promptbook/random` package
|
|
22121
22123
|
// TODO: Maybe use nanoid instead https://github.com/ai/nanoid
|
|
@@ -28419,7 +28421,7 @@ function createOpenAiCodexRunnerResolution(options) {
|
|
|
28419
28421
|
askForApproval: 'never',
|
|
28420
28422
|
allowCredits: options.allowCredits,
|
|
28421
28423
|
});
|
|
28422
|
-
if (!options.allowCredits) {
|
|
28424
|
+
if (!options.allowCredits && options.isVerbose === true) {
|
|
28423
28425
|
console.info(colors.gray('OpenAI Codex credit spending is disabled. Use `--allow-credits` to explicitly opt in.'));
|
|
28424
28426
|
}
|
|
28425
28427
|
return createRunnerResolution(options, runner, actualRunnerModel);
|
|
@@ -31356,7 +31358,7 @@ function $registeredScrapersMessage(availableScrapers) {
|
|
|
31356
31358
|
* @public exported from `@promptbook/editable`
|
|
31357
31359
|
*/
|
|
31358
31360
|
function knowledgeSourceContentToName(knowledgeSourceContent) {
|
|
31359
|
-
const hash = SHA256(hexEncoder.parse(JSON.stringify(knowledgeSourceContent)))
|
|
31361
|
+
const hash = CryptoJS.SHA256(hexEncoder.parse(JSON.stringify(knowledgeSourceContent)))
|
|
31360
31362
|
// <- TODO: [🥬] Encapsulate sha256 to some private utility function
|
|
31361
31363
|
.toString( /* hex */)
|
|
31362
31364
|
.substring(0, 20);
|
|
@@ -32204,7 +32206,7 @@ function csvParse(value /* <- TODO: string_csv */, settings, schema /* <- TODO:
|
|
|
32204
32206
|
console.warn('CSV string contains carriage return characters, but in the CSV settings the `newline` setting does not include them. Autohealing the CSV string.');
|
|
32205
32207
|
value = value.replace(/\r\n/g, '\n').replace(/\r/g, '\n');
|
|
32206
32208
|
}
|
|
32207
|
-
const csv = parse(value, settings);
|
|
32209
|
+
const csv = papaparse.parse(value, settings);
|
|
32208
32210
|
return csv;
|
|
32209
32211
|
}
|
|
32210
32212
|
|
|
@@ -32289,10 +32291,10 @@ const CsvFormatParser = {
|
|
|
32289
32291
|
i > index ? { ...row, [outputParameterName]: PENDING_VALUE_PLACEHOLDER } : row,
|
|
32290
32292
|
);
|
|
32291
32293
|
*/
|
|
32292
|
-
await onProgress(unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS }));
|
|
32294
|
+
await onProgress(papaparse.unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS }));
|
|
32293
32295
|
}
|
|
32294
32296
|
}
|
|
32295
|
-
return unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS });
|
|
32297
|
+
return papaparse.unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS });
|
|
32296
32298
|
},
|
|
32297
32299
|
},
|
|
32298
32300
|
{
|
|
@@ -32320,7 +32322,7 @@ const CsvFormatParser = {
|
|
|
32320
32322
|
return /* not await */ mapCallback({ [key]: value }, index, array.length);
|
|
32321
32323
|
}));
|
|
32322
32324
|
}));
|
|
32323
|
-
return unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS });
|
|
32325
|
+
return papaparse.unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS });
|
|
32324
32326
|
},
|
|
32325
32327
|
},
|
|
32326
32328
|
],
|
|
@@ -45336,7 +45338,7 @@ async function getScraperIntermediateSource(source, options) {
|
|
|
45336
45338
|
const { filename: sourceFilename, url } = source;
|
|
45337
45339
|
const { rootDirname, cacheDirname, intermediateFilesStrategy, extension, isVerbose } = options;
|
|
45338
45340
|
// TODO: [👬] DRY
|
|
45339
|
-
const hash = SHA256(
|
|
45341
|
+
const hash = CryptoJS.SHA256(
|
|
45340
45342
|
// <- TODO: [🥬] Encapsulate sha256 to some private utility function
|
|
45341
45343
|
hexEncoder.parse(sourceFilename || url || 'untitled'))
|
|
45342
45344
|
.toString( /* hex */)
|
|
@@ -45427,7 +45429,7 @@ const _WebsiteScraperMetadataRegistration = $scrapersMetadataRegister.register(w
|
|
|
45427
45429
|
* @private utility of `WebsiteScraper`
|
|
45428
45430
|
*/
|
|
45429
45431
|
function createShowdownConverter() {
|
|
45430
|
-
return new Converter({
|
|
45432
|
+
return new showdown.Converter({
|
|
45431
45433
|
flavor: 'github',
|
|
45432
45434
|
/*
|
|
45433
45435
|
> import showdownHighlight from 'showdown-highlight';
|
|
@@ -62792,6 +62794,7 @@ function createPromptRunnerOptions(options) {
|
|
|
62792
62794
|
ignoreGitChanges: true,
|
|
62793
62795
|
normalizeLineEndings: false,
|
|
62794
62796
|
allowCredits: options.allowCredits,
|
|
62797
|
+
isVerbose: options.isVerbose,
|
|
62795
62798
|
autoMigrate: false,
|
|
62796
62799
|
allowDestructiveAutoMigrate: false,
|
|
62797
62800
|
autoPush: false,
|
|
@@ -64824,7 +64827,7 @@ function emitAgentLlmExecutionToolsAssistantPreparationProgress(options) {
|
|
|
64824
64827
|
* Computes one stable hash from a JSON-serializable value.
|
|
64825
64828
|
*/
|
|
64826
64829
|
function computeJsonHash$1(value) {
|
|
64827
|
-
return SHA256(JSON.stringify(value)).toString();
|
|
64830
|
+
return CryptoJS.SHA256(JSON.stringify(value)).toString();
|
|
64828
64831
|
}
|
|
64829
64832
|
/**
|
|
64830
64833
|
* Handles OpenAI AgentKit-backed executions for `AgentLlmExecutionTools`.
|
|
@@ -64982,7 +64985,7 @@ AgentLlmExecutionToolsAgentKitRunner.vectorStoreCache = new Map();
|
|
|
64982
64985
|
* Computes one stable hash from a JSON-serializable value.
|
|
64983
64986
|
*/
|
|
64984
64987
|
function computeJsonHash(value) {
|
|
64985
|
-
return SHA256(JSON.stringify(value)).toString();
|
|
64988
|
+
return CryptoJS.SHA256(JSON.stringify(value)).toString();
|
|
64986
64989
|
}
|
|
64987
64990
|
/**
|
|
64988
64991
|
* Removes assistant-managed requirements before the prompt is executed via OpenAI Assistants.
|
|
@@ -65784,7 +65787,7 @@ class AgentLlmExecutionTools {
|
|
|
65784
65787
|
* Returns a virtual model name representing the agent behavior.
|
|
65785
65788
|
*/
|
|
65786
65789
|
get modelName() {
|
|
65787
|
-
const hash = SHA256(hexEncoder.parse(this.options.agentSource)).toString( /* hex */);
|
|
65790
|
+
const hash = CryptoJS.SHA256(hexEncoder.parse(this.options.agentSource)).toString( /* hex */);
|
|
65788
65791
|
const agentId = hash.substring(0, 10);
|
|
65789
65792
|
return (normalizeToKebabCase(this.title) + '-' + agentId);
|
|
65790
65793
|
}
|