@promptbook/node 0.110.0-2 → 0.110.0-4
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 +90 -12
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/types.index.d.ts +0 -2
- package/esm/typings/src/book-components/Chat/Chat/ChatActionsBar.d.ts +4 -0
- package/esm/typings/src/book-components/Chat/SourceChip/SourceChip.d.ts +5 -1
- package/esm/typings/src/book-components/Chat/utils/collectTeamToolCallSummary.d.ts +69 -0
- package/esm/typings/src/book-components/Chat/utils/getToolCallChipletInfo.d.ts +12 -4
- package/esm/typings/src/book-components/Chat/utils/parseCitationsFromContent.d.ts +9 -0
- package/esm/typings/src/book-components/Chat/utils/toolCallParsing.d.ts +4 -0
- package/esm/typings/src/llm-providers/agent/AgentOptions.d.ts +9 -0
- package/esm/typings/src/llm-providers/agent/CreateAgentLlmExecutionToolsOptions.d.ts +9 -0
- package/esm/typings/src/utils/agents/resolveAgentAvatarImageUrl.d.ts +29 -0
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +90 -12
- package/umd/index.umd.js.map +1 -1
|
@@ -33,7 +33,6 @@ import type { SourceChipProps } from '../book-components/Chat/SourceChip/SourceC
|
|
|
33
33
|
import type { ChatToolCall } from '../book-components/Chat/types/ChatMessage';
|
|
34
34
|
import type { ChatMessage } from '../book-components/Chat/types/ChatMessage';
|
|
35
35
|
import type { ChatParticipant } from '../book-components/Chat/types/ChatParticipant';
|
|
36
|
-
import type { ToolCallChipletInfo } from '../book-components/Chat/utils/getToolCallChipletInfo';
|
|
37
36
|
import type { ParsedCitation } from '../book-components/Chat/utils/parseCitationsFromContent';
|
|
38
37
|
import type { MessageButton } from '../book-components/Chat/utils/parseMessageButtons';
|
|
39
38
|
import type { TeamToolResult } from '../book-components/Chat/utils/toolCallParsing';
|
|
@@ -436,7 +435,6 @@ export type { SourceChipProps };
|
|
|
436
435
|
export type { ChatToolCall };
|
|
437
436
|
export type { ChatMessage };
|
|
438
437
|
export type { ChatParticipant };
|
|
439
|
-
export type { ToolCallChipletInfo };
|
|
440
438
|
export type { ParsedCitation };
|
|
441
439
|
export type { MessageButton };
|
|
442
440
|
export type { TeamToolResult };
|
|
@@ -21,6 +21,10 @@ export type ChatActionsBarProps = {
|
|
|
21
21
|
saveFormats?: Array<string_chat_format_name>;
|
|
22
22
|
isSaveButtonEnabled: boolean;
|
|
23
23
|
shouldFadeActions: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Disables action interactions while scroll is active.
|
|
26
|
+
*/
|
|
27
|
+
shouldDisableActions: boolean;
|
|
24
28
|
onButtonClick: (handler?: (event: MouseEvent<HTMLButtonElement>) => void) => (event: MouseEvent<HTMLButtonElement>) => void;
|
|
25
29
|
soundSystem?: ChatSoundSystem;
|
|
26
30
|
};
|
|
@@ -15,6 +15,10 @@ export type SourceChipProps = {
|
|
|
15
15
|
* Additional CSS class name
|
|
16
16
|
*/
|
|
17
17
|
className?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Optional suffix text to display after the citation label.
|
|
20
|
+
*/
|
|
21
|
+
suffix?: string;
|
|
18
22
|
};
|
|
19
23
|
/**
|
|
20
24
|
* SourceChip component - displays a chip with source document information
|
|
@@ -32,4 +36,4 @@ export type SourceChipProps = {
|
|
|
32
36
|
*
|
|
33
37
|
* @private utility of `ChatMessageItem` component
|
|
34
38
|
*/
|
|
35
|
-
export declare function SourceChip({ citation, onClick, className }: SourceChipProps): import("react/jsx-runtime").JSX.Element;
|
|
39
|
+
export declare function SourceChip({ citation, onClick, className, suffix }: SourceChipProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { type ToolCall } from '../../../types/ToolCall';
|
|
2
|
+
import type { ParsedCitation } from './parseCitationsFromContent';
|
|
3
|
+
/**
|
|
4
|
+
* Origin metadata for a tool call or citation executed by a teammate.
|
|
5
|
+
*
|
|
6
|
+
* @private utility of `<Chat/>`
|
|
7
|
+
*/
|
|
8
|
+
export type ToolCallOrigin = {
|
|
9
|
+
/**
|
|
10
|
+
* Human-readable label for the teammate.
|
|
11
|
+
*/
|
|
12
|
+
label: string;
|
|
13
|
+
/**
|
|
14
|
+
* Optional teammate URL.
|
|
15
|
+
*/
|
|
16
|
+
url?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Optional tool name for the teammate.
|
|
19
|
+
*/
|
|
20
|
+
toolName?: string;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Tool call data enriched with its teammate origin.
|
|
24
|
+
*
|
|
25
|
+
* @private utility of `<Chat/>`
|
|
26
|
+
*/
|
|
27
|
+
export type TransitiveToolCall = {
|
|
28
|
+
/**
|
|
29
|
+
* Tool call executed by the teammate.
|
|
30
|
+
*/
|
|
31
|
+
toolCall: ToolCall;
|
|
32
|
+
/**
|
|
33
|
+
* Teammate origin metadata for the tool call.
|
|
34
|
+
*/
|
|
35
|
+
origin: ToolCallOrigin;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Citation data enriched with its teammate origin.
|
|
39
|
+
*
|
|
40
|
+
* @private utility of `<Chat/>`
|
|
41
|
+
*/
|
|
42
|
+
export type TransitiveCitation = ParsedCitation & {
|
|
43
|
+
/**
|
|
44
|
+
* Teammate origin metadata for the citation.
|
|
45
|
+
*/
|
|
46
|
+
origin: ToolCallOrigin;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Aggregated teammate tool calls and citations derived from TEAM tool results.
|
|
50
|
+
*
|
|
51
|
+
* @private utility of `<Chat/>`
|
|
52
|
+
*/
|
|
53
|
+
export type TeamToolCallSummary = {
|
|
54
|
+
/**
|
|
55
|
+
* Tool calls executed by teammates, flattened transitively.
|
|
56
|
+
*/
|
|
57
|
+
toolCalls: TransitiveToolCall[];
|
|
58
|
+
/**
|
|
59
|
+
* Citations referenced by teammates, flattened transitively.
|
|
60
|
+
*/
|
|
61
|
+
citations: TransitiveCitation[];
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* Collects tool calls and citations from TEAM tool call results, resolving nested teammate chains.
|
|
65
|
+
*
|
|
66
|
+
* @param toolCalls - Tool calls from the top-level agent message.
|
|
67
|
+
* @private utility of `<Chat/>`
|
|
68
|
+
*/
|
|
69
|
+
export declare function collectTeamToolCallSummary(toolCalls: ReadonlyArray<ToolCall> | undefined): TeamToolCallSummary;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { type ToolCall } from '../../../types/ToolCall';
|
|
2
2
|
import type { AgentChipData } from '../AgentChip';
|
|
3
|
-
/**
|
|
4
|
-
* Utility to format tool call information for user-friendly display.
|
|
5
|
-
*/
|
|
6
3
|
/**
|
|
7
4
|
* Tool call chiplet information including agent data for team tools
|
|
5
|
+
*
|
|
6
|
+
* @private utility of `<Chat/>`
|
|
8
7
|
*/
|
|
9
8
|
export type ToolCallChipletInfo = {
|
|
10
9
|
/**
|
|
@@ -22,10 +21,19 @@ export type ToolCallChipletInfo = {
|
|
|
22
21
|
*/
|
|
23
22
|
wrapInBrackets?: boolean;
|
|
24
23
|
};
|
|
24
|
+
/**
|
|
25
|
+
* Builds display text for a tool call chiplet.
|
|
26
|
+
*
|
|
27
|
+
* @param chipletInfo - Chiplet metadata for the tool call.
|
|
28
|
+
*
|
|
29
|
+
* @private utility of `<Chat/>`
|
|
30
|
+
*/
|
|
31
|
+
export declare function buildToolCallChipText(chipletInfo: ToolCallChipletInfo): string;
|
|
25
32
|
/**
|
|
26
33
|
* Technical to user-friendly tool names and emojis
|
|
27
34
|
*
|
|
28
|
-
* @private [🧠] Maybe public?
|
|
35
|
+
* @private utility of `<Chat/>` [🧠] Maybe public?
|
|
36
|
+
*
|
|
29
37
|
*/
|
|
30
38
|
export declare const TOOL_TITLES: Record<string, {
|
|
31
39
|
title: string;
|
|
@@ -39,6 +39,15 @@ export declare function parseCitationsFromContent(content: string): ParsedCitati
|
|
|
39
39
|
* @private utility for internal use
|
|
40
40
|
*/
|
|
41
41
|
export declare function stripCitationsFromContent(content: string): string;
|
|
42
|
+
/**
|
|
43
|
+
* Deduplicates citations by source while preserving the first-seen order.
|
|
44
|
+
*
|
|
45
|
+
* @param citations - Parsed citations to deduplicate.
|
|
46
|
+
* @returns Deduplicated citations in original order.
|
|
47
|
+
*
|
|
48
|
+
* @private utility for internal use
|
|
49
|
+
*/
|
|
50
|
+
export declare function dedupeCitationsBySource(citations: ReadonlyArray<ParsedCitation>): ParsedCitation[];
|
|
42
51
|
/**
|
|
43
52
|
* Extracts citations from a chat message if not already present
|
|
44
53
|
*
|
|
@@ -25,6 +25,10 @@ export type TeamToolResult = {
|
|
|
25
25
|
};
|
|
26
26
|
request?: string;
|
|
27
27
|
response?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Tool calls executed by the teammate while answering.
|
|
30
|
+
*/
|
|
31
|
+
toolCalls?: ReadonlyArray<ToolCall>;
|
|
28
32
|
error?: string | null;
|
|
29
33
|
conversation?: Array<{
|
|
30
34
|
sender?: string;
|
|
@@ -13,6 +13,15 @@ export type AgentOptions = CommonToolsOptions & {
|
|
|
13
13
|
* Here the agent has access to various LLM models, browser, scrapers, LibreOffice, tools, etc.
|
|
14
14
|
*/
|
|
15
15
|
executionTools: ExecutionTools;
|
|
16
|
+
/**
|
|
17
|
+
* How to manage OpenAI assistant preparation when using OpenAiAssistantExecutionTools.
|
|
18
|
+
*
|
|
19
|
+
* Use `external` when an external cache manager already created the assistant and
|
|
20
|
+
* the agent should use it as-is.
|
|
21
|
+
*
|
|
22
|
+
* @default internal
|
|
23
|
+
*/
|
|
24
|
+
assistantPreparationMode?: 'internal' | 'external';
|
|
16
25
|
/**
|
|
17
26
|
* The source of the agent
|
|
18
27
|
*/
|
|
@@ -10,6 +10,15 @@ export type CreateAgentLlmExecutionToolsOptions = CommonToolsOptions & {
|
|
|
10
10
|
* The underlying LLM execution tools to wrap
|
|
11
11
|
*/
|
|
12
12
|
llmTools: LlmExecutionTools | OpenAiAssistantExecutionTools;
|
|
13
|
+
/**
|
|
14
|
+
* How to manage OpenAI assistant preparation when using OpenAiAssistantExecutionTools.
|
|
15
|
+
*
|
|
16
|
+
* Use `external` when an external cache manager already created the assistant and
|
|
17
|
+
* the agent should use it as-is.
|
|
18
|
+
*
|
|
19
|
+
* @default internal
|
|
20
|
+
*/
|
|
21
|
+
assistantPreparationMode?: 'internal' | 'external';
|
|
13
22
|
/**
|
|
14
23
|
* The agent source string that defines the agent's behavior
|
|
15
24
|
*/
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { AgentBasicInformation } from '../../book-2.0/agent-source/AgentBasicInformation';
|
|
2
|
+
import type { string_url, string_url_image } from '../../types/typeAliases';
|
|
3
|
+
/**
|
|
4
|
+
* Options for resolving agent avatar URLs.
|
|
5
|
+
*
|
|
6
|
+
* @private utility of `<Chat/>`
|
|
7
|
+
*/
|
|
8
|
+
export type ResolveAgentAvatarImageUrlOptions = {
|
|
9
|
+
/**
|
|
10
|
+
* Agent metadata used for avatar resolution.
|
|
11
|
+
*/
|
|
12
|
+
readonly agent: Pick<AgentBasicInformation, 'agentName' | 'permanentId' | 'meta'>;
|
|
13
|
+
/**
|
|
14
|
+
* Optional base URL used to resolve relative meta images and placeholders.
|
|
15
|
+
*/
|
|
16
|
+
readonly baseUrl?: string_url;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Resolve the fallback avatar URL for an agent.
|
|
20
|
+
*
|
|
21
|
+
* @private utility of `<Chat/>`
|
|
22
|
+
*/
|
|
23
|
+
export declare function resolveAgentAvatarFallbackUrl(options: ResolveAgentAvatarImageUrlOptions): string_url_image | null;
|
|
24
|
+
/**
|
|
25
|
+
* Resolve the best avatar URL for an agent, preferring META IMAGE and falling back to placeholders.
|
|
26
|
+
*
|
|
27
|
+
* @private utility of `<Chat/>`
|
|
28
|
+
*/
|
|
29
|
+
export declare function resolveAgentAvatarImageUrl(options: ResolveAgentAvatarImageUrlOptions): string_url_image | null;
|
|
@@ -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.110.0-
|
|
18
|
+
* It follows semantic versioning (e.g., `0.110.0-2`).
|
|
19
19
|
*
|
|
20
20
|
* @generated
|
|
21
21
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptbook/node",
|
|
3
|
-
"version": "0.110.0-
|
|
3
|
+
"version": "0.110.0-4",
|
|
4
4
|
"description": "Promptbook: Turn your company's scattered knowledge into AI ready books",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
"module": "./esm/index.es.js",
|
|
94
94
|
"typings": "./esm/typings/src/_packages/node.index.d.ts",
|
|
95
95
|
"peerDependencies": {
|
|
96
|
-
"@promptbook/core": "0.110.0-
|
|
96
|
+
"@promptbook/core": "0.110.0-4"
|
|
97
97
|
},
|
|
98
98
|
"dependencies": {
|
|
99
99
|
"@mozilla/readability": "0.6.0",
|
package/umd/index.umd.js
CHANGED
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
* @generated
|
|
49
49
|
* @see https://github.com/webgptorg/promptbook
|
|
50
50
|
*/
|
|
51
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.110.0-
|
|
51
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.110.0-4';
|
|
52
52
|
/**
|
|
53
53
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
54
54
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -16988,11 +16988,16 @@
|
|
|
16988
16988
|
const request = buildTeammateRequest(message, args.context);
|
|
16989
16989
|
let response = '';
|
|
16990
16990
|
let error = null;
|
|
16991
|
+
let toolCalls;
|
|
16991
16992
|
try {
|
|
16992
16993
|
const remoteAgent = await getRemoteTeammateAgent(entry.teammate.url);
|
|
16993
16994
|
const prompt = buildTeammatePrompt(request);
|
|
16994
16995
|
const teammateResult = await remoteAgent.callChatModel(prompt);
|
|
16995
16996
|
response = teammateResult.content || '';
|
|
16997
|
+
toolCalls =
|
|
16998
|
+
'toolCalls' in teammateResult && Array.isArray(teammateResult.toolCalls)
|
|
16999
|
+
? teammateResult.toolCalls
|
|
17000
|
+
: undefined;
|
|
16996
17001
|
}
|
|
16997
17002
|
catch (err) {
|
|
16998
17003
|
error = err instanceof Error ? err.message : String(err);
|
|
@@ -17002,6 +17007,7 @@
|
|
|
17002
17007
|
teammate: teammateMetadata,
|
|
17003
17008
|
request,
|
|
17004
17009
|
response: teammateReply,
|
|
17010
|
+
toolCalls: toolCalls && toolCalls.length > 0 ? toolCalls : undefined,
|
|
17005
17011
|
error,
|
|
17006
17012
|
conversation: [
|
|
17007
17013
|
{
|
|
@@ -24566,7 +24572,20 @@
|
|
|
24566
24572
|
const requirementsHash = cryptoJs.SHA256(JSON.stringify(modelRequirements)).toString();
|
|
24567
24573
|
const cached = AgentLlmExecutionTools.assistantCache.get(this.title);
|
|
24568
24574
|
let assistant;
|
|
24569
|
-
if (
|
|
24575
|
+
if (this.options.assistantPreparationMode === 'external') {
|
|
24576
|
+
assistant = this.options.llmTools;
|
|
24577
|
+
if (this.options.isVerbose) {
|
|
24578
|
+
console.info('[🤰]', 'Using externally managed OpenAI Assistant', {
|
|
24579
|
+
agent: this.title,
|
|
24580
|
+
assistantId: assistant.assistantId,
|
|
24581
|
+
});
|
|
24582
|
+
}
|
|
24583
|
+
AgentLlmExecutionTools.assistantCache.set(this.title, {
|
|
24584
|
+
assistantId: assistant.assistantId,
|
|
24585
|
+
requirementsHash,
|
|
24586
|
+
});
|
|
24587
|
+
}
|
|
24588
|
+
else if (cached) {
|
|
24570
24589
|
if (cached.requirementsHash === requirementsHash) {
|
|
24571
24590
|
if (this.options.isVerbose) {
|
|
24572
24591
|
console.info('[🤰]', 'Using cached OpenAI Assistant', {
|
|
@@ -24785,6 +24804,7 @@
|
|
|
24785
24804
|
super({
|
|
24786
24805
|
isVerbose: options.isVerbose,
|
|
24787
24806
|
llmTools: getSingleLlmExecutionTools(options.executionTools.llm),
|
|
24807
|
+
assistantPreparationMode: options.assistantPreparationMode,
|
|
24788
24808
|
agentSource: agentSource.value, // <- TODO: [🐱🚀] Allow to pass BehaviorSubject<string_book> OR refresh llmExecutionTools.callChat on agentSource change
|
|
24789
24809
|
});
|
|
24790
24810
|
_Agent_instances.add(this);
|
|
@@ -25060,6 +25080,63 @@
|
|
|
25060
25080
|
* TODO: [🧠][😰]Agent is not working with the parameters, should it be?
|
|
25061
25081
|
*/
|
|
25062
25082
|
|
|
25083
|
+
/**
|
|
25084
|
+
* Resolve a remote META IMAGE value into an absolute URL when possible.
|
|
25085
|
+
*/
|
|
25086
|
+
function resolveRemoteImageUrl(imageUrl, agentUrl) {
|
|
25087
|
+
if (!imageUrl) {
|
|
25088
|
+
return undefined;
|
|
25089
|
+
}
|
|
25090
|
+
if (imageUrl.startsWith('http://') ||
|
|
25091
|
+
imageUrl.startsWith('https://') ||
|
|
25092
|
+
imageUrl.startsWith('data:') ||
|
|
25093
|
+
imageUrl.startsWith('blob:')) {
|
|
25094
|
+
return imageUrl;
|
|
25095
|
+
}
|
|
25096
|
+
try {
|
|
25097
|
+
return new URL(imageUrl, agentUrl).href;
|
|
25098
|
+
}
|
|
25099
|
+
catch (_a) {
|
|
25100
|
+
return imageUrl;
|
|
25101
|
+
}
|
|
25102
|
+
}
|
|
25103
|
+
/**
|
|
25104
|
+
* Format a META commitment line when the value is provided.
|
|
25105
|
+
*/
|
|
25106
|
+
function formatMetaLine(label, value) {
|
|
25107
|
+
if (!value) {
|
|
25108
|
+
return null;
|
|
25109
|
+
}
|
|
25110
|
+
return `META ${label} ${value}`;
|
|
25111
|
+
}
|
|
25112
|
+
/**
|
|
25113
|
+
* Build a minimal agent source snapshot for remote agents.
|
|
25114
|
+
*/
|
|
25115
|
+
function buildRemoteAgentSource(profile, meta) {
|
|
25116
|
+
const metaLines = [
|
|
25117
|
+
formatMetaLine('FULLNAME', meta === null || meta === void 0 ? void 0 : meta.fullname),
|
|
25118
|
+
formatMetaLine('IMAGE', meta === null || meta === void 0 ? void 0 : meta.image),
|
|
25119
|
+
formatMetaLine('DESCRIPTION', meta === null || meta === void 0 ? void 0 : meta.description),
|
|
25120
|
+
formatMetaLine('COLOR', meta === null || meta === void 0 ? void 0 : meta.color),
|
|
25121
|
+
formatMetaLine('FONT', meta === null || meta === void 0 ? void 0 : meta.font),
|
|
25122
|
+
formatMetaLine('LINK', meta === null || meta === void 0 ? void 0 : meta.link),
|
|
25123
|
+
]
|
|
25124
|
+
.filter((line) => Boolean(line))
|
|
25125
|
+
.join('\n');
|
|
25126
|
+
const personaBlock = profile.personaDescription
|
|
25127
|
+
? spaceTrim__default["default"]((block) => `
|
|
25128
|
+
PERSONA
|
|
25129
|
+
${block(profile.personaDescription || '')}
|
|
25130
|
+
`)
|
|
25131
|
+
: '';
|
|
25132
|
+
return book `
|
|
25133
|
+
${profile.agentName}
|
|
25134
|
+
|
|
25135
|
+
${metaLines}
|
|
25136
|
+
|
|
25137
|
+
${personaBlock}
|
|
25138
|
+
`;
|
|
25139
|
+
}
|
|
25063
25140
|
/**
|
|
25064
25141
|
* Represents one AI Agent
|
|
25065
25142
|
*
|
|
@@ -25074,6 +25151,7 @@
|
|
|
25074
25151
|
*/
|
|
25075
25152
|
class RemoteAgent extends Agent {
|
|
25076
25153
|
static async connect(options) {
|
|
25154
|
+
var _a, _b, _c;
|
|
25077
25155
|
const agentProfileUrl = `${options.agentUrl}/api/profile`;
|
|
25078
25156
|
const profileResponse = await fetch(agentProfileUrl);
|
|
25079
25157
|
// <- TODO: [🐱🚀] What about closed-source agents?
|
|
@@ -25093,14 +25171,14 @@
|
|
|
25093
25171
|
|
|
25094
25172
|
`));
|
|
25095
25173
|
}
|
|
25096
|
-
const profile = await profileResponse.json();
|
|
25174
|
+
const profile = (await profileResponse.json());
|
|
25175
|
+
const resolvedMeta = {
|
|
25176
|
+
...(profile.meta || {}),
|
|
25177
|
+
image: resolveRemoteImageUrl((_a = profile.meta) === null || _a === void 0 ? void 0 : _a.image, options.agentUrl),
|
|
25178
|
+
};
|
|
25097
25179
|
// Note: We are creating dummy agent source because we don't have the source from the remote agent
|
|
25098
25180
|
// But we populate the metadata from the profile
|
|
25099
|
-
const agentSource = new rxjs.BehaviorSubject(
|
|
25100
|
-
${profile.agentName}
|
|
25101
|
-
|
|
25102
|
-
${profile.personaDescription}
|
|
25103
|
-
`);
|
|
25181
|
+
const agentSource = new rxjs.BehaviorSubject(buildRemoteAgentSource(profile, resolvedMeta));
|
|
25104
25182
|
// <- TODO: [🐱🚀] createBookFromProfile
|
|
25105
25183
|
// <- TODO: [🐱🚀] Support updating and self-updating
|
|
25106
25184
|
const remoteAgent = new RemoteAgent({
|
|
@@ -25123,10 +25201,10 @@
|
|
|
25123
25201
|
});
|
|
25124
25202
|
remoteAgent._remoteAgentName = profile.agentName;
|
|
25125
25203
|
remoteAgent._remoteAgentHash = profile.agentHash;
|
|
25126
|
-
remoteAgent.personaDescription = profile.personaDescription;
|
|
25127
|
-
remoteAgent.initialMessage = profile.initialMessage;
|
|
25128
|
-
remoteAgent.links = profile.links;
|
|
25129
|
-
remoteAgent.meta =
|
|
25204
|
+
remoteAgent.personaDescription = (_b = profile.personaDescription) !== null && _b !== void 0 ? _b : null;
|
|
25205
|
+
remoteAgent.initialMessage = (_c = profile.initialMessage) !== null && _c !== void 0 ? _c : null;
|
|
25206
|
+
remoteAgent.links = profile.links || [];
|
|
25207
|
+
remoteAgent.meta = resolvedMeta;
|
|
25130
25208
|
remoteAgent.capabilities = profile.capabilities || [];
|
|
25131
25209
|
remoteAgent.samples = profile.samples || [];
|
|
25132
25210
|
remoteAgent.toolTitles = profile.toolTitles || {};
|