@promptbook/components 0.104.0-7 โ 0.104.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 +56 -3
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/book-2.0/agent-source/createAgentModelRequirementsWithCommitments.closed.test.d.ts +1 -0
- package/esm/typings/src/book-2.0/utils/generatePlaceholderAgentProfileImageUrl.d.ts +2 -2
- package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.d.ts +10 -6
- package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentsDatabaseSchema.d.ts +6 -3
- package/esm/typings/src/utils/color/utils/colorToDataUrl.d.ts +2 -1
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +1 -1
- package/umd/index.umd.js +56 -3
- package/umd/index.umd.js.map +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { string_agent_name, string_agent_permanent_id, string_url_image } from '../../types/typeAliases';
|
|
1
|
+
import type { string_agent_name, string_agent_permanent_id, string_url, string_url_image } from '../../types/typeAliases';
|
|
2
2
|
/**
|
|
3
3
|
* Generates an image for the agent to use as profile image
|
|
4
4
|
*
|
|
@@ -7,7 +7,7 @@ import type { string_agent_name, string_agent_permanent_id, string_url_image } f
|
|
|
7
7
|
*
|
|
8
8
|
* @public exported from `@promptbook/core`
|
|
9
9
|
*/
|
|
10
|
-
export declare function generatePlaceholderAgentProfileImageUrl(agentIdOrName: string_agent_permanent_id | string_agent_name, agentsServerUrl?: URL): string_url_image;
|
|
10
|
+
export declare function generatePlaceholderAgentProfileImageUrl(agentIdOrName: string_agent_permanent_id | string_agent_name, agentsServerUrl?: URL | string_url): string_url_image;
|
|
11
11
|
/**
|
|
12
12
|
* TODO: [๐คน] Figure out best placeholder image generator https://i.pravatar.cc/1000?u=568
|
|
13
13
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { SupabaseClient } from '@supabase/supabase-js';
|
|
2
2
|
import type { AgentBasicInformation } from '../../../../book-2.0/agent-source/AgentBasicInformation';
|
|
3
3
|
import type { string_book } from '../../../../book-2.0/agent-source/string_book';
|
|
4
|
-
import type { string_agent_name } from '../../../../types/typeAliases';
|
|
4
|
+
import type { string_agent_name, string_agent_permanent_id } from '../../../../types/typeAliases';
|
|
5
5
|
import { AgentCollectionInSupabaseOptions } from './AgentCollectionInSupabaseOptions';
|
|
6
6
|
import type { AgentsDatabaseSchema } from './AgentsDatabaseSchema';
|
|
7
7
|
/**
|
|
@@ -28,7 +28,11 @@ export declare class AgentCollectionInSupabase {
|
|
|
28
28
|
/**
|
|
29
29
|
* [๐ฑโ๐]@@@
|
|
30
30
|
*/
|
|
31
|
-
|
|
31
|
+
getAgentPermanentId(agentNameOrPermanentId: string_agent_name | string_agent_permanent_id): Promise<string_agent_permanent_id>;
|
|
32
|
+
/**
|
|
33
|
+
* [๐ฑโ๐]@@@
|
|
34
|
+
*/
|
|
35
|
+
getAgentSource(agentNameOrPermanentId: string_agent_name | string_agent_permanent_id): Promise<string_book>;
|
|
32
36
|
/**
|
|
33
37
|
* Creates a new agent in the collection
|
|
34
38
|
*
|
|
@@ -38,7 +42,7 @@ export declare class AgentCollectionInSupabase {
|
|
|
38
42
|
/**
|
|
39
43
|
* Updates an existing agent in the collection
|
|
40
44
|
*/
|
|
41
|
-
updateAgentSource(
|
|
45
|
+
updateAgentSource(permanentId: string_agent_permanent_id, agentSource: string_book): Promise<void>;
|
|
42
46
|
/**
|
|
43
47
|
* List agents that are soft deleted (deletedAt IS NOT NULL)
|
|
44
48
|
*/
|
|
@@ -46,7 +50,7 @@ export declare class AgentCollectionInSupabase {
|
|
|
46
50
|
/**
|
|
47
51
|
* List history of an agent
|
|
48
52
|
*/
|
|
49
|
-
listAgentHistory(
|
|
53
|
+
listAgentHistory(permanentId: string_agent_permanent_id): Promise<ReadonlyArray<{
|
|
50
54
|
id: number;
|
|
51
55
|
createdAt: string;
|
|
52
56
|
agentHash: string;
|
|
@@ -55,7 +59,7 @@ export declare class AgentCollectionInSupabase {
|
|
|
55
59
|
/**
|
|
56
60
|
* Restore a soft-deleted agent by setting deletedAt to NULL
|
|
57
61
|
*/
|
|
58
|
-
restoreAgent(
|
|
62
|
+
restoreAgent(permanentId: string_agent_permanent_id): Promise<void>;
|
|
59
63
|
/**
|
|
60
64
|
* Restore an agent from a specific history entry
|
|
61
65
|
*
|
|
@@ -65,7 +69,7 @@ export declare class AgentCollectionInSupabase {
|
|
|
65
69
|
/**
|
|
66
70
|
* Soft delete an agent by setting deletedAt to current timestamp
|
|
67
71
|
*/
|
|
68
|
-
deleteAgent(
|
|
72
|
+
deleteAgent(permanentId: string_agent_permanent_id): Promise<void>;
|
|
69
73
|
/**
|
|
70
74
|
* Get the Supabase table name with prefix
|
|
71
75
|
*
|
|
@@ -73,6 +73,7 @@ export type AgentsDatabaseSchema = {
|
|
|
73
73
|
id: number;
|
|
74
74
|
createdAt: string;
|
|
75
75
|
agentName: string;
|
|
76
|
+
permanentId: string;
|
|
76
77
|
agentHash: string;
|
|
77
78
|
previousAgentHash: string | null;
|
|
78
79
|
agentSource: string;
|
|
@@ -82,6 +83,7 @@ export type AgentsDatabaseSchema = {
|
|
|
82
83
|
id?: number;
|
|
83
84
|
createdAt: string;
|
|
84
85
|
agentName: string;
|
|
86
|
+
permanentId: string;
|
|
85
87
|
agentHash: string;
|
|
86
88
|
previousAgentHash?: string | null;
|
|
87
89
|
agentSource: string;
|
|
@@ -91,6 +93,7 @@ export type AgentsDatabaseSchema = {
|
|
|
91
93
|
id?: number;
|
|
92
94
|
createdAt?: string;
|
|
93
95
|
agentName?: string;
|
|
96
|
+
permanentId?: string;
|
|
94
97
|
agentHash?: string;
|
|
95
98
|
previousAgentHash?: string | null;
|
|
96
99
|
agentSource?: string;
|
|
@@ -98,10 +101,10 @@ export type AgentsDatabaseSchema = {
|
|
|
98
101
|
};
|
|
99
102
|
Relationships: [
|
|
100
103
|
{
|
|
101
|
-
foreignKeyName: '
|
|
102
|
-
columns: ['
|
|
104
|
+
foreignKeyName: 'AgentHistory_permanentId_fkey';
|
|
105
|
+
columns: ['permanentId'];
|
|
103
106
|
referencedRelation: 'Agent';
|
|
104
|
-
referencedColumns: ['
|
|
107
|
+
referencedColumns: ['permanentId'];
|
|
105
108
|
}
|
|
106
109
|
];
|
|
107
110
|
};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { string_color, string_data_url, string_url_image } from '../../../types/typeAliases';
|
|
1
2
|
import { Color } from '../Color';
|
|
2
3
|
/**
|
|
3
4
|
* Makes data url from color
|
|
4
5
|
*
|
|
5
6
|
* @public exported from `@promptbook/color`
|
|
6
7
|
*/
|
|
7
|
-
export declare function colorToDataUrl(color: Color):
|
|
8
|
+
export declare function colorToDataUrl(color: Color | string_color): string_data_url & string_url_image;
|
|
8
9
|
/**
|
|
9
10
|
* TODO: Make as functions NOT const
|
|
10
11
|
*/
|
|
@@ -15,7 +15,7 @@ export declare const BOOK_LANGUAGE_VERSION: string_semantic_version;
|
|
|
15
15
|
export declare const PROMPTBOOK_ENGINE_VERSION: string_promptbook_version;
|
|
16
16
|
/**
|
|
17
17
|
* Represents the version string of the Promptbook engine.
|
|
18
|
-
* It follows semantic versioning (e.g., `0.104.0-
|
|
18
|
+
* It follows semantic versioning (e.g., `0.104.0-8`).
|
|
19
19
|
*
|
|
20
20
|
* @generated
|
|
21
21
|
*/
|
package/package.json
CHANGED
package/umd/index.umd.js
CHANGED
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
* @generated
|
|
31
31
|
* @see https://github.com/webgptorg/promptbook
|
|
32
32
|
*/
|
|
33
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.104.0-
|
|
33
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.104.0-9';
|
|
34
34
|
/**
|
|
35
35
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
36
36
|
* Note: [๐] Ignore a discrepancy between file name and entity name
|
|
@@ -8781,6 +8781,52 @@
|
|
|
8781
8781
|
*/
|
|
8782
8782
|
const textColor = furthest(Color.get('white'), Color.from('black'));
|
|
8783
8783
|
|
|
8784
|
+
/**
|
|
8785
|
+
* Makes data url from color
|
|
8786
|
+
*
|
|
8787
|
+
* @public exported from `@promptbook/color`
|
|
8788
|
+
*/
|
|
8789
|
+
function colorToDataUrl(color) {
|
|
8790
|
+
if (typeof color === 'string') {
|
|
8791
|
+
color = Color.fromHex(color);
|
|
8792
|
+
}
|
|
8793
|
+
return rgbDataURL(color.red, color.green, color.blue);
|
|
8794
|
+
}
|
|
8795
|
+
/**
|
|
8796
|
+
* Pixel GIF code adapted from https://stackoverflow.com/a/33919020/266535
|
|
8797
|
+
*
|
|
8798
|
+
* @private util of `colorToDataUrl`
|
|
8799
|
+
*/
|
|
8800
|
+
const keyStr = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
|
8801
|
+
/**
|
|
8802
|
+
* Generates a base64-encoded triplet string
|
|
8803
|
+
*
|
|
8804
|
+
* @param e1 - The first element in the triplet.
|
|
8805
|
+
* @param e2 - The second element in the triplet.
|
|
8806
|
+
* @param e3 - The third element in the triplet.
|
|
8807
|
+
* @returns The base64-encoded triplet string.
|
|
8808
|
+
*
|
|
8809
|
+
* @private util of `colorToDataUrl`
|
|
8810
|
+
*/
|
|
8811
|
+
const triplet = (e1, e2, e3) => keyStr.charAt(e1 >> 2) +
|
|
8812
|
+
keyStr.charAt(((e1 & 3) << 4) | (e2 >> 4)) +
|
|
8813
|
+
keyStr.charAt(((e2 & 15) << 2) | (e3 >> 6)) +
|
|
8814
|
+
keyStr.charAt(e3 & 63);
|
|
8815
|
+
/**
|
|
8816
|
+
* Converts RGB values to a data URL string
|
|
8817
|
+
*
|
|
8818
|
+
* @param r - The red channel value.
|
|
8819
|
+
* @param g - The green channel value.
|
|
8820
|
+
* @param b - The blue channel value.
|
|
8821
|
+
* @returns The RGB data URL string.
|
|
8822
|
+
*
|
|
8823
|
+
* @private util of `colorToDataUrl`
|
|
8824
|
+
*/
|
|
8825
|
+
const rgbDataURL = (r, g, b) => `data:image/gif;base64,R0lGODlhAQABAPAA${triplet(0, r, g) + triplet(b, 255, 255)}/yH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==`;
|
|
8826
|
+
/**
|
|
8827
|
+
* TODO: Make as functions NOT const
|
|
8828
|
+
*/
|
|
8829
|
+
|
|
8784
8830
|
/**
|
|
8785
8831
|
* Restricts an Updatable to a (2) BehaviorSubject variant
|
|
8786
8832
|
*
|
|
@@ -9508,7 +9554,7 @@
|
|
|
9508
9554
|
* @private internal subcomponent of `<Chat>` component
|
|
9509
9555
|
*/
|
|
9510
9556
|
const ChatMessageItem = react.memo(({ message, participant, participants, isLastMessage, onMessage, setExpandedMessageId, isExpanded, currentRating, handleRating, mode, isCopyButtonEnabled, isFeedbackEnabled, onCopy, onCreateAgent, }) => {
|
|
9511
|
-
const avatarSrc = (participant === null || participant === void 0 ? void 0 : participant.avatarSrc) ||
|
|
9557
|
+
const avatarSrc = (participant === null || participant === void 0 ? void 0 : participant.avatarSrc) || null;
|
|
9512
9558
|
const [isAvatarTooltipVisible, setIsAvatarTooltipVisible] = react.useState(false);
|
|
9513
9559
|
const [avatarTooltipPosition, setAvatarTooltipPosition] = react.useState(null);
|
|
9514
9560
|
const hoverTimeoutRef = react.useRef(null);
|
|
@@ -9602,9 +9648,11 @@
|
|
|
9602
9648
|
}, children: [avatarSrc && (jsxRuntime.jsxs("div", { ref: avatarRef, className: chatStyles.avatar, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, onClick: showTooltip, children: [jsxRuntime.jsx("img", { width: AVATAR_SIZE, src: avatarSrc, alt: `Avatar of ${message.sender.toString().toLocaleLowerCase()}`, style: {
|
|
9603
9649
|
'--avatar-bg-color': color.toHex(),
|
|
9604
9650
|
objectFit: 'cover',
|
|
9651
|
+
objectPosition: '50% 20%',
|
|
9605
9652
|
width: AVATAR_SIZE,
|
|
9606
9653
|
height: AVATAR_SIZE,
|
|
9607
9654
|
aspectRatio: '1 / 1',
|
|
9655
|
+
backgroundImage: `url(${colorToDataUrl(color)})`,
|
|
9608
9656
|
} }), isAvatarTooltipVisible && (participant === null || participant === void 0 ? void 0 : participant.agentSource) && avatarTooltipPosition && (jsxRuntime.jsx(AvatarProfileTooltip, { ref: tooltipRef, agentSource: participant.agentSource, position: avatarTooltipPosition }))] })), jsxRuntime.jsxs("div", { className: chatStyles.messageText, style: {
|
|
9609
9657
|
'--message-bg-color': color.toHex(),
|
|
9610
9658
|
'--message-text-color': colorOfText.toHex(),
|
|
@@ -15276,7 +15324,12 @@
|
|
|
15276
15324
|
};
|
|
15277
15325
|
}
|
|
15278
15326
|
// Apply each commitment in order using reduce-like pattern
|
|
15279
|
-
for (
|
|
15327
|
+
for (let i = 0; i < filteredCommitments.length; i++) {
|
|
15328
|
+
const commitment = filteredCommitments[i];
|
|
15329
|
+
// CLOSED commitment should work only if its the last commitment in the book
|
|
15330
|
+
if (commitment.type === 'CLOSED' && i !== filteredCommitments.length - 1) {
|
|
15331
|
+
continue;
|
|
15332
|
+
}
|
|
15280
15333
|
const definition = getCommitmentDefinition(commitment.type);
|
|
15281
15334
|
if (definition) {
|
|
15282
15335
|
try {
|