@promptbook/core 0.103.0-43 → 0.103.0-45
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 +6 -18
- package/esm/index.es.js +186 -27
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/types.index.d.ts +8 -0
- package/esm/typings/src/book-components/AvatarProfile/AvatarProfile/AvatarProfile.d.ts +5 -0
- package/esm/typings/src/collection/agent-collection/AgentCollection.d.ts +2 -28
- package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.d.ts +61 -9
- package/esm/typings/src/errors/DatabaseError.d.ts +3 -0
- package/esm/typings/src/llm-providers/_multiple/getSingleLlmExecutionTools.d.ts +1 -0
- package/esm/typings/src/llm-providers/_multiple/joinLlmExecutionTools.d.ts +1 -0
- package/esm/typings/src/llm-providers/agent/CreateAgentLlmExecutionToolsOptions.d.ts +2 -1
- package/esm/typings/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +1 -1
- package/esm/typings/src/llm-providers/google/google-models.d.ts +1 -1
- package/esm/typings/src/llm-providers/openai/openai-models.d.ts +1 -1
- package/esm/typings/src/remote-server/startAgentServer.d.ts +3 -0
- package/esm/typings/src/remote-server/startRemoteServer.d.ts +1 -0
- package/esm/typings/src/types/typeAliases.d.ts +19 -1
- package/esm/typings/src/utils/color/$randomColor.d.ts +1 -0
- package/esm/typings/src/utils/random/$generateBookBoilerplate.d.ts +5 -2
- package/esm/typings/src/utils/random/$randomAgentPersona.d.ts +9 -0
- package/esm/typings/src/utils/random/$randomFullnameWithColor.d.ts +13 -0
- package/esm/typings/src/utils/random/$randomItem.d.ts +9 -0
- package/esm/typings/src/utils/random/$randomSeed.d.ts +3 -0
- package/esm/typings/src/utils/random/$randomToken.d.ts +1 -0
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +1 -1
- package/umd/index.umd.js +190 -31
- package/umd/index.umd.js.map +1 -1
- package/esm/typings/src/commands/_common/parseCommand.test.d.ts +0 -1
package/umd/index.umd.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('spacetrim'), require('crypto'), require('rxjs'), require('waitasecond'), require('crypto-js/enc-hex'), require('crypto-js/sha256'), require('path'), require('crypto-js'), require('mime-types'), require('papaparse'), require('
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', 'spacetrim', 'crypto', 'rxjs', 'waitasecond', 'crypto-js/enc-hex', 'crypto-js/sha256', 'path', 'crypto-js', 'mime-types', 'papaparse', '
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-core"] = {}, global.spaceTrim$1, global.crypto, global.rxjs, global.waitasecond, global.hexEncoder, global.sha256, global.path, global.cryptoJs, global.mimeTypes, global.papaparse, global.
|
|
5
|
-
})(this, (function (exports, spaceTrim$1, crypto, rxjs, waitasecond, hexEncoder, sha256, path, cryptoJs, mimeTypes, papaparse,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('spacetrim'), require('crypto'), require('rxjs'), require('waitasecond'), require('crypto-js/enc-hex'), require('crypto-js/sha256'), require('path'), require('crypto-js'), require('mime-types'), require('papaparse'), require('moment'), require('colors'), require('bottleneck'), require('openai')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', 'spacetrim', 'crypto', 'rxjs', 'waitasecond', 'crypto-js/enc-hex', 'crypto-js/sha256', 'path', 'crypto-js', 'mime-types', 'papaparse', 'moment', 'colors', 'bottleneck', 'openai'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-core"] = {}, global.spaceTrim$1, global.crypto, global.rxjs, global.waitasecond, global.hexEncoder, global.sha256, global.path, global.cryptoJs, global.mimeTypes, global.papaparse, global.moment, global.colors, global.Bottleneck, global.OpenAI));
|
|
5
|
+
})(this, (function (exports, spaceTrim$1, crypto, rxjs, waitasecond, hexEncoder, sha256, path, cryptoJs, mimeTypes, papaparse, moment, colors, Bottleneck, OpenAI) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
9
9
|
var spaceTrim__default = /*#__PURE__*/_interopDefaultLegacy(spaceTrim$1);
|
|
10
10
|
var hexEncoder__default = /*#__PURE__*/_interopDefaultLegacy(hexEncoder);
|
|
11
11
|
var sha256__default = /*#__PURE__*/_interopDefaultLegacy(sha256);
|
|
12
|
-
var colors__default = /*#__PURE__*/_interopDefaultLegacy(colors);
|
|
13
12
|
var moment__default = /*#__PURE__*/_interopDefaultLegacy(moment);
|
|
13
|
+
var colors__default = /*#__PURE__*/_interopDefaultLegacy(colors);
|
|
14
14
|
var Bottleneck__default = /*#__PURE__*/_interopDefaultLegacy(Bottleneck);
|
|
15
15
|
var OpenAI__default = /*#__PURE__*/_interopDefaultLegacy(OpenAI);
|
|
16
16
|
|
|
@@ -21,14 +21,14 @@
|
|
|
21
21
|
* @generated
|
|
22
22
|
* @see https://github.com/webgptorg/book
|
|
23
23
|
*/
|
|
24
|
-
const BOOK_LANGUAGE_VERSION = '
|
|
24
|
+
const BOOK_LANGUAGE_VERSION = '2.0.0';
|
|
25
25
|
/**
|
|
26
26
|
* The version of the Promptbook engine
|
|
27
27
|
*
|
|
28
28
|
* @generated
|
|
29
29
|
* @see https://github.com/webgptorg/promptbook
|
|
30
30
|
*/
|
|
31
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.103.0-
|
|
31
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.103.0-45';
|
|
32
32
|
/**
|
|
33
33
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
34
34
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -2777,6 +2777,9 @@
|
|
|
2777
2777
|
Object.setPrototypeOf(this, DatabaseError.prototype);
|
|
2778
2778
|
}
|
|
2779
2779
|
}
|
|
2780
|
+
/**
|
|
2781
|
+
* TODO: !!!! Explain that NotFoundError (!!! and other specific errors) has priority over DatabaseError in some contexts
|
|
2782
|
+
*/
|
|
2780
2783
|
|
|
2781
2784
|
/**
|
|
2782
2785
|
* This error type indicates that you try to use a feature that is not available in the current environment
|
|
@@ -2882,6 +2885,7 @@
|
|
|
2882
2885
|
return crypto.randomBytes(randomness).toString('hex');
|
|
2883
2886
|
}
|
|
2884
2887
|
/**
|
|
2888
|
+
* TODO: [🤶] Maybe export through `@promptbook/utils` or `@promptbook/random` package
|
|
2885
2889
|
* TODO: Maybe use nanoid instead https://github.com/ai/nanoid
|
|
2886
2890
|
*/
|
|
2887
2891
|
|
|
@@ -3779,6 +3783,7 @@
|
|
|
3779
3783
|
return new MultipleLlmExecutionTools(title || 'Multiple LLM Providers joined by `joinLlmExecutionTools`', ...llmExecutionTools);
|
|
3780
3784
|
}
|
|
3781
3785
|
/**
|
|
3786
|
+
* TODO: [🙆] `getSingleLlmExecutionTools` vs `joinLlmExecutionTools` - explain difference or pick one
|
|
3782
3787
|
* TODO: [👷♂️] @@@ Manual about construction of llmTools
|
|
3783
3788
|
*/
|
|
3784
3789
|
|
|
@@ -3795,6 +3800,7 @@
|
|
|
3795
3800
|
return llmTools;
|
|
3796
3801
|
}
|
|
3797
3802
|
/**
|
|
3803
|
+
* TODO: [🙆] `getSingleLlmExecutionTools` vs `joinLlmExecutionTools` - explain difference or pick one
|
|
3798
3804
|
* TODO: [👷♂️] @@@ Manual about construction of llmTools
|
|
3799
3805
|
*/
|
|
3800
3806
|
|
|
@@ -9905,25 +9911,26 @@
|
|
|
9905
9911
|
* @public exported from `@promptbook/core`
|
|
9906
9912
|
* <- TODO: !!! Move to `@promptbook/supabase` package
|
|
9907
9913
|
*/
|
|
9908
|
-
class AgentCollectionInSupabase {
|
|
9914
|
+
class AgentCollectionInSupabase /* TODO: !!!! implements AgentCollection */ {
|
|
9909
9915
|
/**
|
|
9910
9916
|
* @param rootPath - path to the directory with agents
|
|
9911
|
-
* @param tools - Execution tools to be used in `Agent` itself and listing the agents
|
|
9917
|
+
* @param tools - Execution tools to be used in !!! `Agent` itself and listing the agents
|
|
9912
9918
|
* @param options - Options for the collection creation
|
|
9913
9919
|
*/
|
|
9914
|
-
constructor(supabaseClient,
|
|
9920
|
+
constructor(supabaseClient,
|
|
9921
|
+
/// TODO: !!! Remove> private readonly tools?: Pick<ExecutionTools, 'llm' | 'fs' | 'scrapers'>,
|
|
9922
|
+
options) {
|
|
9915
9923
|
this.supabaseClient = supabaseClient;
|
|
9916
|
-
this.tools = tools;
|
|
9917
9924
|
this.options = options;
|
|
9918
|
-
/**
|
|
9919
|
-
* Cached defined execution tools
|
|
9920
|
-
*/
|
|
9921
|
-
this._definedTools = null;
|
|
9922
9925
|
const { isVerbose = exports.DEFAULT_IS_VERBOSE } = options || {};
|
|
9923
9926
|
if (isVerbose) {
|
|
9924
|
-
console.info(
|
|
9927
|
+
console.info(`Creating pipeline collection from supabase...`);
|
|
9925
9928
|
}
|
|
9926
9929
|
}
|
|
9930
|
+
/**
|
|
9931
|
+
* Cached defined execution tools
|
|
9932
|
+
*/
|
|
9933
|
+
// !!! private _definedTools: ExecutionTools | null = null;
|
|
9927
9934
|
/*
|
|
9928
9935
|
TODO: !!! Use or remove
|
|
9929
9936
|
/**
|
|
@@ -9965,10 +9972,9 @@
|
|
|
9965
9972
|
}
|
|
9966
9973
|
/**
|
|
9967
9974
|
* !!!
|
|
9968
|
-
|
|
9969
|
-
async spawnAgent(agentName) {
|
|
9970
|
-
|
|
9971
|
-
/*
|
|
9975
|
+
* /
|
|
9976
|
+
public async spawnAgent(agentName: string_agent_name): Promise<Agent> {
|
|
9977
|
+
|
|
9972
9978
|
// <- TODO: !!! ENOENT: no such file or directory, open 'C:\Users\me\work\ai\promptbook\agents\examples\Asistent pro LŠVP.book
|
|
9973
9979
|
const { isVerbose = DEFAULT_IS_VERBOSE } = this.options || {};
|
|
9974
9980
|
const tools = await this.getTools();
|
|
@@ -10016,7 +10022,30 @@
|
|
|
10016
10022
|
}
|
|
10017
10023
|
|
|
10018
10024
|
return agent;
|
|
10019
|
-
|
|
10025
|
+
* /
|
|
10026
|
+
}
|
|
10027
|
+
*/
|
|
10028
|
+
/**
|
|
10029
|
+
* !!!@@@
|
|
10030
|
+
*/
|
|
10031
|
+
async getAgentSource(agentName) {
|
|
10032
|
+
const result = await this.supabaseClient
|
|
10033
|
+
.from('AgentCollection' /* <- TODO: !!!! Change to `Agent` */)
|
|
10034
|
+
.select('agentSource')
|
|
10035
|
+
.eq('agentName', agentName)
|
|
10036
|
+
.single();
|
|
10037
|
+
if (result.error) {
|
|
10038
|
+
throw new DatabaseError(spaceTrim((block) => `
|
|
10039
|
+
|
|
10040
|
+
Error fetching agent "${agentName}" from Supabase:
|
|
10041
|
+
|
|
10042
|
+
${block(result.error.message)}
|
|
10043
|
+
`));
|
|
10044
|
+
// <- TODO: !!! First check if the error is "not found" and throw `NotFoundError` instead then throw `DatabaseError`
|
|
10045
|
+
}
|
|
10046
|
+
const agentSource = new rxjs.BehaviorSubject(result.data.agentSource);
|
|
10047
|
+
// <- TODO: !!!! Dynamic updates
|
|
10048
|
+
return agentSource;
|
|
10020
10049
|
}
|
|
10021
10050
|
/**
|
|
10022
10051
|
* Creates a new agent in the collection
|
|
@@ -10053,6 +10082,7 @@
|
|
|
10053
10082
|
}
|
|
10054
10083
|
}
|
|
10055
10084
|
/**
|
|
10085
|
+
* TODO: !!!! Implement it here correctly and update JSDoc comments here, and on interface + other implementations
|
|
10056
10086
|
* TODO: Write unit test
|
|
10057
10087
|
* TODO: [🧠][🚙] `AgentXxx` vs `AgentsXxx` naming convention
|
|
10058
10088
|
*/
|
|
@@ -15100,7 +15130,7 @@
|
|
|
15100
15130
|
/**
|
|
15101
15131
|
* List of available OpenAI models with pricing
|
|
15102
15132
|
*
|
|
15103
|
-
* Note: Synced with official API docs at 2025-
|
|
15133
|
+
* Note: Synced with official API docs at 2025-11-19
|
|
15104
15134
|
*
|
|
15105
15135
|
* @see https://platform.openai.com/docs/models/
|
|
15106
15136
|
* @see https://openai.com/api/pricing/
|
|
@@ -15110,11 +15140,21 @@
|
|
|
15110
15140
|
name: 'OPENAI_MODELS',
|
|
15111
15141
|
value: [
|
|
15112
15142
|
/**/
|
|
15143
|
+
{
|
|
15144
|
+
modelVariant: 'CHAT',
|
|
15145
|
+
modelTitle: 'gpt-5.1',
|
|
15146
|
+
modelName: 'gpt-5.1',
|
|
15147
|
+
modelDescription: 'The best model for coding and agentic tasks with configurable reasoning effort.',
|
|
15148
|
+
pricing: {
|
|
15149
|
+
prompt: pricing(`$1.25 / 1M tokens`),
|
|
15150
|
+
output: pricing(`$10.00 / 1M tokens`),
|
|
15151
|
+
},
|
|
15152
|
+
},
|
|
15113
15153
|
{
|
|
15114
15154
|
modelVariant: 'CHAT',
|
|
15115
15155
|
modelTitle: 'gpt-5',
|
|
15116
15156
|
modelName: 'gpt-5',
|
|
15117
|
-
modelDescription: "OpenAI's most advanced language model with unprecedented reasoning capabilities and 200K context window. Features revolutionary improvements in complex problem-solving, scientific reasoning, and creative tasks. Demonstrates human-level performance across diverse domains with enhanced safety measures and alignment. Represents the next generation of AI with superior understanding, nuanced responses, and advanced multimodal capabilities.",
|
|
15157
|
+
modelDescription: "OpenAI's most advanced language model with unprecedented reasoning capabilities and 200K context window. Features revolutionary improvements in complex problem-solving, scientific reasoning, and creative tasks. Demonstrates human-level performance across diverse domains with enhanced safety measures and alignment. Represents the next generation of AI with superior understanding, nuanced responses, and advanced multimodal capabilities. DEPRECATED: Use gpt-5.1 instead.",
|
|
15118
15158
|
pricing: {
|
|
15119
15159
|
prompt: pricing(`$1.25 / 1M tokens`),
|
|
15120
15160
|
output: pricing(`$10.00 / 1M tokens`),
|
|
@@ -16675,11 +16715,11 @@
|
|
|
16675
16715
|
if (!this.isCreatingNewAssistantsAllowed) {
|
|
16676
16716
|
throw new NotAllowed(`Creating new assistants is not allowed. Set \`isCreatingNewAssistantsAllowed: true\` in options to enable this feature.`);
|
|
16677
16717
|
}
|
|
16678
|
-
await this.playground();
|
|
16718
|
+
// await this.playground();
|
|
16679
16719
|
const { name, instructions } = options;
|
|
16680
16720
|
const client = await this.getClient();
|
|
16681
|
-
|
|
16682
|
-
TODO: !!!
|
|
16721
|
+
/*/
|
|
16722
|
+
//TODO: !!!
|
|
16683
16723
|
async function downloadFile(url: string, folder = './tmp'): Promise<string> {
|
|
16684
16724
|
const filename = path.basename(url.split('?')[0]);
|
|
16685
16725
|
const filepath = path.join(folder, filename);
|
|
@@ -16723,8 +16763,8 @@
|
|
|
16723
16763
|
const file = await uploadFileToOpenAI(filepath);
|
|
16724
16764
|
uploadedFiles.push(file.id);
|
|
16725
16765
|
}
|
|
16726
|
-
|
|
16727
|
-
alert('!!!! Creating new OpenAI assistant');
|
|
16766
|
+
/**/
|
|
16767
|
+
// alert('!!!! Creating new OpenAI assistant');
|
|
16728
16768
|
// 3️⃣ Create assistant with uploaded files
|
|
16729
16769
|
const assistant = await client.beta.assistants.create({
|
|
16730
16770
|
name,
|
|
@@ -16885,15 +16925,27 @@
|
|
|
16885
16925
|
const chatPrompt = prompt;
|
|
16886
16926
|
let underlyingLlmResult;
|
|
16887
16927
|
if (OpenAiAssistantExecutionTools.isOpenAiAssistantExecutionTools(this.options.llmTools)) {
|
|
16928
|
+
if (this.options.isVerbose) {
|
|
16929
|
+
console.log(`Creating new OpenAI Assistant for agent ${this.title}...`);
|
|
16930
|
+
}
|
|
16888
16931
|
// <- TODO: !!! Check also `isCreatingNewAssistantsAllowed` and warn about it
|
|
16889
16932
|
const assistant = await this.options.llmTools.createNewAssistant({
|
|
16890
16933
|
name: this.title,
|
|
16891
16934
|
instructions: modelRequirements.systemMessage,
|
|
16935
|
+
/*
|
|
16936
|
+
!!!
|
|
16937
|
+
metadata: {
|
|
16938
|
+
agentModelName: this.modelName,
|
|
16939
|
+
}
|
|
16940
|
+
*/
|
|
16892
16941
|
});
|
|
16893
16942
|
// <- TODO: !!! Cache the assistant in prepareCache
|
|
16894
16943
|
underlyingLlmResult = await assistant.callChatModel(chatPrompt);
|
|
16895
16944
|
}
|
|
16896
16945
|
else {
|
|
16946
|
+
if (this.options.isVerbose) {
|
|
16947
|
+
console.log(`Creating Assistant ${this.title} on generic LLM execution tools...`);
|
|
16948
|
+
}
|
|
16897
16949
|
// Create modified chat prompt with agent system message
|
|
16898
16950
|
const modifiedChatPrompt = {
|
|
16899
16951
|
...chatPrompt,
|
|
@@ -16974,6 +17026,7 @@
|
|
|
16974
17026
|
*/
|
|
16975
17027
|
getLlmExecutionTools() {
|
|
16976
17028
|
const llmTools = new AgentLlmExecutionTools({
|
|
17029
|
+
isVerbose: this.options.isVerbose,
|
|
16977
17030
|
llmTools: getSingleLlmExecutionTools(this.options.executionTools.llm),
|
|
16978
17031
|
agentSource: this.agentSource.value, // <- TODO: !!!! Allow to pass BehaviorSubject<string_book> OR refresh llmExecutionTools.callChat on agentSource change
|
|
16979
17032
|
});
|
|
@@ -18294,6 +18347,105 @@
|
|
|
18294
18347
|
* TODO: [🗽] Unite branding and make single place for it
|
|
18295
18348
|
*/
|
|
18296
18349
|
|
|
18350
|
+
/**
|
|
18351
|
+
* Pick random item from the received array
|
|
18352
|
+
*
|
|
18353
|
+
* @private internal helper function
|
|
18354
|
+
*/
|
|
18355
|
+
function $randomItem(...items) {
|
|
18356
|
+
if (items.length === 0) {
|
|
18357
|
+
throw new Error(`Not enough items`);
|
|
18358
|
+
}
|
|
18359
|
+
return items[Math.floor(Math.random( /* <- TODO: [🐉] Probably use seed random */) * items.length)];
|
|
18360
|
+
}
|
|
18361
|
+
/**
|
|
18362
|
+
* TODO: [🤶] Maybe export through `@promptbook/utils` or `@promptbook/random` package
|
|
18363
|
+
*/
|
|
18364
|
+
|
|
18365
|
+
const FIRSTNAMES = [
|
|
18366
|
+
'Paul',
|
|
18367
|
+
'George',
|
|
18368
|
+
'Adam',
|
|
18369
|
+
'Lucy',
|
|
18370
|
+
'Sophia',
|
|
18371
|
+
'Emma',
|
|
18372
|
+
'Olivia',
|
|
18373
|
+
'Noah',
|
|
18374
|
+
'Liam',
|
|
18375
|
+
'Ethan',
|
|
18376
|
+
'Ava',
|
|
18377
|
+
'Mia',
|
|
18378
|
+
'Isabella',
|
|
18379
|
+
'James',
|
|
18380
|
+
'Benjamin',
|
|
18381
|
+
'Elijah',
|
|
18382
|
+
'Sophia',
|
|
18383
|
+
'Charlotte',
|
|
18384
|
+
'Amelia',
|
|
18385
|
+
'Harper',
|
|
18386
|
+
'Alexander',
|
|
18387
|
+
'William',
|
|
18388
|
+
'Michael',
|
|
18389
|
+
'Daniel',
|
|
18390
|
+
'Matthew',
|
|
18391
|
+
'Joseph',
|
|
18392
|
+
'David',
|
|
18393
|
+
'Samuel',
|
|
18394
|
+
'Henry',
|
|
18395
|
+
'Jack',
|
|
18396
|
+
'Sebastian',
|
|
18397
|
+
'Gabriel',
|
|
18398
|
+
'Anthony',
|
|
18399
|
+
'Christopher',
|
|
18400
|
+
];
|
|
18401
|
+
const LASTNAMES_WITH_COLORS = [
|
|
18402
|
+
{ lastname: 'Green', color: '#008000' },
|
|
18403
|
+
{ lastname: 'Brown', color: '#A52A2A' },
|
|
18404
|
+
{ lastname: 'Black', color: '#000000' },
|
|
18405
|
+
{ lastname: 'White', color: '#FFFFFF' },
|
|
18406
|
+
{ lastname: 'Gray', color: '#808080' },
|
|
18407
|
+
{ lastname: 'Blue', color: '#0000FF' },
|
|
18408
|
+
];
|
|
18409
|
+
/**
|
|
18410
|
+
*
|
|
18411
|
+
* @private internal helper function
|
|
18412
|
+
*/
|
|
18413
|
+
function $randomFullnameWithColor() {
|
|
18414
|
+
const firstname = $randomItem(...FIRSTNAMES);
|
|
18415
|
+
const { lastname, color } = $randomItem(...LASTNAMES_WITH_COLORS);
|
|
18416
|
+
return {
|
|
18417
|
+
fullname: `${firstname} ${lastname}`,
|
|
18418
|
+
color,
|
|
18419
|
+
};
|
|
18420
|
+
}
|
|
18421
|
+
/**
|
|
18422
|
+
* TODO: [🤶] Maybe export through `@promptbook/utils` or `@promptbook/random` package
|
|
18423
|
+
*/
|
|
18424
|
+
|
|
18425
|
+
const PERSONALITIES = [
|
|
18426
|
+
'Friendly and helpful AI agent.',
|
|
18427
|
+
'Professional and efficient virtual assistant.',
|
|
18428
|
+
'Creative and imaginative digital companion.',
|
|
18429
|
+
'Knowledgeable and informative AI guide.',
|
|
18430
|
+
'Empathetic and understanding support bot.',
|
|
18431
|
+
'Energetic and enthusiastic conversational partner.',
|
|
18432
|
+
'Calm and patient virtual helper.',
|
|
18433
|
+
'Curious and inquisitive AI explorer.',
|
|
18434
|
+
'Witty and humorous digital friend.',
|
|
18435
|
+
'Serious and focused AI consultant.',
|
|
18436
|
+
];
|
|
18437
|
+
/**
|
|
18438
|
+
* @@@@
|
|
18439
|
+
*
|
|
18440
|
+
* @private internal helper function
|
|
18441
|
+
*/
|
|
18442
|
+
function $randomAgentPersona() {
|
|
18443
|
+
return $randomItem(...PERSONALITIES);
|
|
18444
|
+
}
|
|
18445
|
+
/**
|
|
18446
|
+
* TODO: [🤶] Maybe export through `@promptbook/utils` or `@promptbook/random` package
|
|
18447
|
+
*/
|
|
18448
|
+
|
|
18297
18449
|
/**
|
|
18298
18450
|
* Generates boilerplate for a new agent book
|
|
18299
18451
|
*
|
|
@@ -18305,20 +18457,27 @@
|
|
|
18305
18457
|
function $generateBookBoilerplate(options) {
|
|
18306
18458
|
// eslint-disable-next-line prefer-const
|
|
18307
18459
|
let { agentName, parentAgentName = 'Adam', personaDescription, meta } = options || {};
|
|
18460
|
+
// eslint-disable-next-line prefer-const
|
|
18461
|
+
let { image, color, ...restMeta } = meta || {};
|
|
18308
18462
|
if (!agentName) {
|
|
18309
|
-
|
|
18310
|
-
|
|
18463
|
+
const randomFullnameWithColor = $randomFullnameWithColor();
|
|
18464
|
+
agentName = randomFullnameWithColor.fullname;
|
|
18465
|
+
color = color || randomFullnameWithColor.color;
|
|
18311
18466
|
}
|
|
18312
18467
|
if (!personaDescription) {
|
|
18313
|
-
personaDescription =
|
|
18468
|
+
personaDescription = $randomAgentPersona();
|
|
18314
18469
|
}
|
|
18315
18470
|
const agentSource = validateBook(spaceTrim__default["default"]((block) => `
|
|
18316
18471
|
${agentName}
|
|
18317
18472
|
|
|
18473
|
+
META COLOR ${color || '#3498db' /* <- TODO: !!!! Best default color */}
|
|
18318
18474
|
PERSONA ${block(personaDescription)}
|
|
18319
18475
|
`));
|
|
18320
18476
|
return agentSource;
|
|
18321
18477
|
}
|
|
18478
|
+
/**
|
|
18479
|
+
* TODO: [🤶] Maybe export through `@promptbook/utils` or `@promptbook/random` package
|
|
18480
|
+
*/
|
|
18322
18481
|
|
|
18323
18482
|
exports.$bookTranspilersRegister = $bookTranspilersRegister;
|
|
18324
18483
|
exports.$generateBookBoilerplate = $generateBookBoilerplate;
|