@promptbook/core 0.104.0-4 โ 0.104.0-6
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 +18 -44
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/book-2.0/agent-source/createAgentModelRequirements.d.ts +6 -6
- package/esm/typings/src/book-2.0/utils/generatePlaceholderAgentProfileImageUrl.d.ts +3 -3
- package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentsDatabaseSchema.d.ts +18 -15
- package/esm/typings/src/types/typeAliases.d.ts +4 -0
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +1 -1
- package/umd/index.umd.js +18 -44
- package/umd/index.umd.js.map +1 -1
- package/esm/typings/src/book-2.0/utils/generateGravatarUrl.d.ts +0 -10
package/esm/index.es.js
CHANGED
|
@@ -27,7 +27,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
|
|
|
27
27
|
* @generated
|
|
28
28
|
* @see https://github.com/webgptorg/promptbook
|
|
29
29
|
*/
|
|
30
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.104.0-
|
|
30
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.104.0-6';
|
|
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
|
|
@@ -11437,44 +11437,6 @@ function normalizeTo_camelCase(text, _isFirstLetterCapital = false) {
|
|
|
11437
11437
|
* TODO: [๐บ] Use some intermediate util splitWords
|
|
11438
11438
|
*/
|
|
11439
11439
|
|
|
11440
|
-
/**
|
|
11441
|
-
* Generates a gravatar URL based on agent name for fallback avatar
|
|
11442
|
-
*
|
|
11443
|
-
* @param agentName The agent name to generate avatar for
|
|
11444
|
-
* @returns Gravatar URL
|
|
11445
|
-
*
|
|
11446
|
-
* @private - [๐คน] The fact that profile image is Gravatar is just implementation detail which should be hidden for consumer
|
|
11447
|
-
*/
|
|
11448
|
-
function generateGravatarUrl(agentName) {
|
|
11449
|
-
// Use a default name if none provided
|
|
11450
|
-
const safeName = agentName || 'Anonymous Agent';
|
|
11451
|
-
// Create a simple hash from the name for consistent avatar
|
|
11452
|
-
let hash = 0;
|
|
11453
|
-
for (let i = 0; i < safeName.length; i++) {
|
|
11454
|
-
const char = safeName.charCodeAt(i);
|
|
11455
|
-
hash = (hash << 5) - hash + char;
|
|
11456
|
-
hash = hash & hash; // Convert to 32bit integer
|
|
11457
|
-
}
|
|
11458
|
-
const avatarId = Math.abs(hash).toString();
|
|
11459
|
-
return `https://www.gravatar.com/avatar/${avatarId}?default=robohash&size=200&rating=x`;
|
|
11460
|
-
}
|
|
11461
|
-
|
|
11462
|
-
/**
|
|
11463
|
-
* Generates an image for the agent to use as profile image
|
|
11464
|
-
*
|
|
11465
|
-
* @param agentName The agent name to generate avatar for
|
|
11466
|
-
* @returns The placeholder profile image URL for the agent
|
|
11467
|
-
*
|
|
11468
|
-
* @public exported from `@promptbook/core`
|
|
11469
|
-
*/
|
|
11470
|
-
function generatePlaceholderAgentProfileImageUrl(agentName) {
|
|
11471
|
-
// Note: [๐คน] The fact that profile image is Gravatar is just implementation detail which should be hidden for consumer
|
|
11472
|
-
return generateGravatarUrl(agentName);
|
|
11473
|
-
}
|
|
11474
|
-
/**
|
|
11475
|
-
* TODO: [๐คน] Figure out best placeholder image generator https://i.pravatar.cc/1000?u=568
|
|
11476
|
-
*/
|
|
11477
|
-
|
|
11478
11440
|
/**
|
|
11479
11441
|
* Creates a Mermaid graph based on the promptbook
|
|
11480
11442
|
*
|
|
@@ -11956,10 +11918,6 @@ function parseAgentSource(agentSource) {
|
|
|
11956
11918
|
const metaType = normalizeTo_camelCase(metaTypeRaw);
|
|
11957
11919
|
meta[metaType] = spaceTrim$2(commitment.content.substring(metaTypeRaw.length));
|
|
11958
11920
|
}
|
|
11959
|
-
// Generate gravatar fallback if no meta image specified
|
|
11960
|
-
if (!meta.image) {
|
|
11961
|
-
meta.image = generatePlaceholderAgentProfileImageUrl(parseResult.agentName || '!!');
|
|
11962
|
-
}
|
|
11963
11921
|
// Generate fullname fallback if no meta fullname specified
|
|
11964
11922
|
if (!meta.fullname) {
|
|
11965
11923
|
meta.fullname = parseResult.agentName || createDefaultAgentName(agentSource);
|
|
@@ -12163,6 +12121,21 @@ const DEFAULT_BOOK = padBook(validateBook(spaceTrim$2(`
|
|
|
12163
12121
|
// <- [๐ฑโ๐] Buttons into genesis book
|
|
12164
12122
|
// <- TODO: [๐ฑโ๐] generateBookBoilerplate and deprecate `DEFAULT_BOOK`
|
|
12165
12123
|
|
|
12124
|
+
/**
|
|
12125
|
+
* Generates an image for the agent to use as profile image
|
|
12126
|
+
*
|
|
12127
|
+
* @param agentId - The permanent ID of the agent
|
|
12128
|
+
* @returns The placeholder profile image URL for the agent
|
|
12129
|
+
*
|
|
12130
|
+
* @public exported from `@promptbook/core`
|
|
12131
|
+
*/
|
|
12132
|
+
function generatePlaceholderAgentProfileImageUrl(agentIdOrName) {
|
|
12133
|
+
return `/agents/${agentIdOrName}/images/default-avatar.png`;
|
|
12134
|
+
}
|
|
12135
|
+
/**
|
|
12136
|
+
* TODO: [๐คน] Figure out best placeholder image generator https://i.pravatar.cc/1000?u=568
|
|
12137
|
+
*/
|
|
12138
|
+
|
|
12166
12139
|
/**
|
|
12167
12140
|
* Base58 characters
|
|
12168
12141
|
*/
|
|
@@ -16978,12 +16951,13 @@ function cacheLlmTools(llmTools, options = {}) {
|
|
|
16978
16951
|
}
|
|
16979
16952
|
}
|
|
16980
16953
|
catch (error) {
|
|
16954
|
+
assertsError(error);
|
|
16981
16955
|
// If validation throws an unexpected error, don't cache
|
|
16982
16956
|
shouldCache = false;
|
|
16983
16957
|
if (isVerbose) {
|
|
16984
16958
|
console.info('Not caching result due to validation error for key:', key, {
|
|
16985
16959
|
content: promptResult.content,
|
|
16986
|
-
validationError:
|
|
16960
|
+
validationError: serializeError(error),
|
|
16987
16961
|
});
|
|
16988
16962
|
}
|
|
16989
16963
|
}
|