@promptbook/remote-server 0.112.0-31 → 0.112.0-32
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 +103 -39
- package/esm/index.es.js.map +1 -1
- package/esm/src/_packages/components.index.d.ts +6 -0
- package/esm/src/_packages/types.index.d.ts +6 -0
- package/esm/src/book-2.0/agent-source/AgentReferenceResolver.d.ts +11 -0
- package/esm/src/book-2.0/agent-source/CreateAgentModelRequirementsOptions.d.ts +8 -0
- package/esm/src/book-2.0/agent-source/TeammateProfileResolver.d.ts +33 -0
- package/esm/src/book-2.0/agent-source/createTeamToolName.d.ts +7 -7
- package/esm/src/book-components/Chat/Chat/ChatActionsBar.d.ts +5 -0
- package/esm/src/book-components/Chat/Chat/ChatMessageItem.d.ts +17 -1
- package/esm/src/book-components/Chat/Chat/ChatMessageItem.test.d.ts +1 -1
- package/esm/src/book-components/Chat/Chat/ChatMessageList.d.ts +14 -0
- package/esm/src/book-components/Chat/Chat/ChatProps.d.ts +290 -0
- package/esm/src/book-components/Chat/Chat/ChatToolCallModal.d.ts +16 -0
- package/esm/src/book-components/Chat/Chat/renderAdvancedToolCallDetails.d.ts +4 -0
- package/esm/src/book-components/Chat/Chat/renderToolCallDetails.d.ts +9 -0
- package/esm/src/book-components/Chat/MarkdownContent/MarkdownContent.d.ts +2 -1
- package/esm/src/book-components/Chat/MarkdownContent/MarkdownContent.test.d.ts +2 -0
- package/esm/src/book-components/Chat/hooks/useChatCompleteNotification.d.ts +18 -0
- package/esm/src/book-components/Chat/hooks/useChatCompleteNotification.test.d.ts +2 -0
- package/esm/src/book-components/Chat/types/ChatMessage.d.ts +77 -1
- package/esm/src/book-components/Chat/utils/formatToolCallDateTime.d.ts +37 -0
- package/esm/src/book-components/Chat/utils/formatToolCallLocalTime.d.ts +11 -0
- package/esm/src/book-components/Chat/utils/formatToolCallTranslationTemplate.d.ts +10 -0
- package/esm/src/book-components/Chat/utils/getChatMessageTimingDisplay.d.ts +5 -1
- package/esm/src/book-components/Chat/utils/getToolCallChipletInfo.d.ts +26 -1
- package/esm/src/book-components/Chat/utils/timeoutToolCallPresentation.d.ts +26 -3
- package/esm/src/utils/toolCalls/mergeToolCalls.d.ts +1 -1
- package/esm/src/version.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +103 -39
- package/umd/index.umd.js.map +1 -1
- package/umd/src/_packages/components.index.d.ts +6 -0
- package/umd/src/_packages/types.index.d.ts +6 -0
- package/umd/src/book-2.0/agent-source/AgentReferenceResolver.d.ts +11 -0
- package/umd/src/book-2.0/agent-source/CreateAgentModelRequirementsOptions.d.ts +8 -0
- package/umd/src/book-2.0/agent-source/TeammateProfileResolver.d.ts +33 -0
- package/umd/src/book-2.0/agent-source/createTeamToolName.d.ts +7 -7
- package/umd/src/book-components/Chat/Chat/ChatActionsBar.d.ts +5 -0
- package/umd/src/book-components/Chat/Chat/ChatMessageItem.d.ts +17 -1
- package/umd/src/book-components/Chat/Chat/ChatMessageItem.test.d.ts +1 -1
- package/umd/src/book-components/Chat/Chat/ChatMessageList.d.ts +14 -0
- package/umd/src/book-components/Chat/Chat/ChatProps.d.ts +290 -0
- package/umd/src/book-components/Chat/Chat/ChatToolCallModal.d.ts +16 -0
- package/umd/src/book-components/Chat/Chat/renderAdvancedToolCallDetails.d.ts +4 -0
- package/umd/src/book-components/Chat/Chat/renderToolCallDetails.d.ts +9 -0
- package/umd/src/book-components/Chat/MarkdownContent/MarkdownContent.d.ts +2 -1
- package/umd/src/book-components/Chat/MarkdownContent/MarkdownContent.test.d.ts +2 -0
- package/umd/src/book-components/Chat/hooks/useChatCompleteNotification.d.ts +18 -0
- package/umd/src/book-components/Chat/hooks/useChatCompleteNotification.test.d.ts +2 -0
- package/umd/src/book-components/Chat/types/ChatMessage.d.ts +77 -1
- package/umd/src/book-components/Chat/utils/formatToolCallDateTime.d.ts +37 -0
- package/umd/src/book-components/Chat/utils/formatToolCallLocalTime.d.ts +11 -0
- package/umd/src/book-components/Chat/utils/formatToolCallTranslationTemplate.d.ts +10 -0
- package/umd/src/book-components/Chat/utils/getChatMessageTimingDisplay.d.ts +5 -1
- package/umd/src/book-components/Chat/utils/getToolCallChipletInfo.d.ts +26 -1
- package/umd/src/book-components/Chat/utils/timeoutToolCallPresentation.d.ts +26 -3
- package/umd/src/utils/toolCalls/mergeToolCalls.d.ts +1 -1
- package/umd/src/version.d.ts +1 -1
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { Message } from '../../../types/Message';
|
|
2
|
+
import type { LlmToolDefinition } from '../../../types/LlmToolDefinition';
|
|
3
|
+
import type { ChatModelRequirements } from '../../../types/ModelRequirements';
|
|
2
4
|
import type { ToolCall } from '../../../types/ToolCall';
|
|
3
|
-
import type {
|
|
5
|
+
import type { TODO_object } from '../../../utils/organization/TODO_object';
|
|
6
|
+
import type { id, Parameters, string_date_iso8601, string_markdown, string_prompt, string_title } from '../../../types/typeAliases';
|
|
4
7
|
export type ChatToolCall = ToolCall;
|
|
5
8
|
/**
|
|
6
9
|
* One item in a user-facing progress card shown while assistant response is still running.
|
|
@@ -52,6 +55,63 @@ export type ChatProgressCard = {
|
|
|
52
55
|
*/
|
|
53
56
|
readonly isVisible?: boolean;
|
|
54
57
|
};
|
|
58
|
+
/**
|
|
59
|
+
* Serializable prompt snapshot stored alongside one assistant message for debugging and inspection.
|
|
60
|
+
*/
|
|
61
|
+
type ChatMessagePrompt = {
|
|
62
|
+
/**
|
|
63
|
+
* Human-readable label used for the prompt execution.
|
|
64
|
+
*/
|
|
65
|
+
readonly title: string_title;
|
|
66
|
+
/**
|
|
67
|
+
* User-facing chat content submitted into the prompt pipeline.
|
|
68
|
+
*/
|
|
69
|
+
readonly content: string_prompt;
|
|
70
|
+
/**
|
|
71
|
+
* Resolved prompt parameters passed into the agent turn.
|
|
72
|
+
*/
|
|
73
|
+
readonly parameters: Parameters;
|
|
74
|
+
/**
|
|
75
|
+
* Chat-model requirements used when the turn was executed.
|
|
76
|
+
*/
|
|
77
|
+
readonly modelRequirements: ChatModelRequirements;
|
|
78
|
+
/**
|
|
79
|
+
* Prior thread history provided to the prompt.
|
|
80
|
+
*/
|
|
81
|
+
readonly thread?: ReadonlyArray<ChatMessage>;
|
|
82
|
+
/**
|
|
83
|
+
* Attachments submitted with the user turn.
|
|
84
|
+
*/
|
|
85
|
+
readonly attachments?: ReadonlyArray<{
|
|
86
|
+
name: string;
|
|
87
|
+
type: string;
|
|
88
|
+
url: string;
|
|
89
|
+
}>;
|
|
90
|
+
/**
|
|
91
|
+
* Runtime tools explicitly passed on the chat prompt object.
|
|
92
|
+
*/
|
|
93
|
+
readonly tools?: ReadonlyArray<LlmToolDefinition>;
|
|
94
|
+
/**
|
|
95
|
+
* Full list of tools available to the model for this turn.
|
|
96
|
+
*/
|
|
97
|
+
readonly availableTools?: ReadonlyArray<LlmToolDefinition>;
|
|
98
|
+
/**
|
|
99
|
+
* Tool calls associated with the generated message, duplicated here for raw prompt inspection.
|
|
100
|
+
*/
|
|
101
|
+
readonly toolCalls?: ReadonlyArray<ChatToolCall>;
|
|
102
|
+
/**
|
|
103
|
+
* Completed tool calls associated with the generated message, duplicated here for raw prompt inspection.
|
|
104
|
+
*/
|
|
105
|
+
readonly completedToolCalls?: ReadonlyArray<ChatToolCall>;
|
|
106
|
+
/**
|
|
107
|
+
* Provider-facing prompt text after agent/runtime preparation, when available.
|
|
108
|
+
*/
|
|
109
|
+
readonly rawPromptContent?: string_prompt;
|
|
110
|
+
/**
|
|
111
|
+
* Provider-facing raw request payload, when available.
|
|
112
|
+
*/
|
|
113
|
+
readonly rawRequest?: TODO_object | null;
|
|
114
|
+
};
|
|
55
115
|
/**
|
|
56
116
|
* Represents a single message within a chat interface.
|
|
57
117
|
*
|
|
@@ -165,7 +225,23 @@ export type ChatMessage = Omit<Message<id>, 'direction' | 'recipients' | 'thread
|
|
|
165
225
|
* Optional structured progress-card payload shown while a response is still in progress.
|
|
166
226
|
*/
|
|
167
227
|
readonly progressCard?: ChatProgressCard;
|
|
228
|
+
/**
|
|
229
|
+
* Optional list of tools that were available to the model when generating this message.
|
|
230
|
+
*
|
|
231
|
+
* This field is populated by the server from the exact tool definitions passed to the LLM
|
|
232
|
+
* request so developers can inspect what capabilities the model had access to during
|
|
233
|
+
* each conversation turn.
|
|
234
|
+
*/
|
|
235
|
+
readonly availableTools?: ReadonlyArray<LlmToolDefinition>;
|
|
236
|
+
/**
|
|
237
|
+
* Optional prompt snapshot from which this message was generated.
|
|
238
|
+
*
|
|
239
|
+
* Intended for advanced/raw inspection so developers can see the exact chat prompt,
|
|
240
|
+
* resolved parameters, tool availability, and provider payload associated with one turn.
|
|
241
|
+
*/
|
|
242
|
+
readonly prompt?: ChatMessagePrompt;
|
|
168
243
|
};
|
|
244
|
+
export {};
|
|
169
245
|
/**
|
|
170
246
|
* TODO: Make all fields readonly
|
|
171
247
|
* TODO: Delete `expectedAnswer` from ChatMessage
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Locale-aware date/time labels derived from one tool-call timestamp.
|
|
3
|
+
*
|
|
4
|
+
* @private utility of `<Chat/>`
|
|
5
|
+
*/
|
|
6
|
+
type ToolCallDateTimeLabels = {
|
|
7
|
+
/**
|
|
8
|
+
* Primary local time label shown in chips and clock panels.
|
|
9
|
+
*/
|
|
10
|
+
readonly localTimeLabel: string;
|
|
11
|
+
/**
|
|
12
|
+
* Local calendar date label shown under the primary time.
|
|
13
|
+
*/
|
|
14
|
+
readonly localDateLabel: string;
|
|
15
|
+
/**
|
|
16
|
+
* Exact local timestamp label used in detail sections.
|
|
17
|
+
*/
|
|
18
|
+
readonly localDateTimeLabel: string;
|
|
19
|
+
/**
|
|
20
|
+
* Relative label such as `in 5 minutes` or `2 minutes ago`.
|
|
21
|
+
*/
|
|
22
|
+
readonly relativeTimeLabel: string | null;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Formats one tool-call timestamp into shared locale-aware labels.
|
|
26
|
+
*
|
|
27
|
+
* @param date - Timestamp to format.
|
|
28
|
+
* @param options - Optional locale and relative-time reference point.
|
|
29
|
+
* @returns Shared labels consumed by tool-call chips and modals.
|
|
30
|
+
*
|
|
31
|
+
* @private utility of `<Chat/>`
|
|
32
|
+
*/
|
|
33
|
+
export declare function formatToolCallDateTime(date: Date, options?: {
|
|
34
|
+
locale?: string;
|
|
35
|
+
currentDate?: Date;
|
|
36
|
+
}): ToolCallDateTimeLabels;
|
|
37
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Formats a Date as a locale-aware short time string (e.g. "5:30 PM" or "17:30").
|
|
3
|
+
*
|
|
4
|
+
* @param date - Date to format.
|
|
5
|
+
* @param locale - Optional BCP-47 locale string (e.g. `"en"`, `"cs"`).
|
|
6
|
+
* When omitted the browser/OS default locale is used.
|
|
7
|
+
* @returns Formatted time string such as `"5:30 PM"` or `"17:30"`.
|
|
8
|
+
*
|
|
9
|
+
* @private utility of `<Chat/>`
|
|
10
|
+
*/
|
|
11
|
+
export declare function formatToolCallLocalTime(date: Date, locale?: string): string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Applies `{placeholder}` values to one tool-call translation template.
|
|
3
|
+
*
|
|
4
|
+
* @param template - Template from the host application or fallback copy.
|
|
5
|
+
* @param variables - Placeholder values keyed by variable name.
|
|
6
|
+
* @returns Formatted string ready for rendering.
|
|
7
|
+
*
|
|
8
|
+
* @private utility of `<Chat/>`
|
|
9
|
+
*/
|
|
10
|
+
export declare function formatToolCallTranslationTemplate(template: string, variables: Record<string, string | number>): string;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import 'moment/locale/cs';
|
|
1
2
|
import type { ChatMessage } from '../types/ChatMessage';
|
|
2
3
|
/**
|
|
3
4
|
* Display-ready timestamp values for a chat message.
|
|
@@ -21,6 +22,9 @@ export type ChatMessageTimingDisplay = {
|
|
|
21
22
|
/**
|
|
22
23
|
* Builds display-ready timestamp and duration labels for a chat message.
|
|
23
24
|
*
|
|
25
|
+
* @param message - Message with optional timestamp metadata.
|
|
26
|
+
* @param locale - Optional moment locale used for formatting.
|
|
27
|
+
*
|
|
24
28
|
* @private utility of `<Chat/>` component
|
|
25
29
|
*/
|
|
26
|
-
export declare function getChatMessageTimingDisplay(message: ChatMessage): ChatMessageTimingDisplay | null;
|
|
30
|
+
export declare function getChatMessageTimingDisplay(message: ChatMessage, locale?: string): ChatMessageTimingDisplay | null;
|
|
@@ -15,6 +15,25 @@ export type ToolCallChipletInfo = {
|
|
|
15
15
|
*/
|
|
16
16
|
agentData?: AgentChipData;
|
|
17
17
|
};
|
|
18
|
+
/**
|
|
19
|
+
* Optional user-facing title overrides for technical tool names.
|
|
20
|
+
*
|
|
21
|
+
* @private utility of `<Chat/>`
|
|
22
|
+
*/
|
|
23
|
+
type ToolCallTitleOverrides = Readonly<Record<string, string>>;
|
|
24
|
+
/**
|
|
25
|
+
* Optional localized labels used for user-facing chip text.
|
|
26
|
+
*
|
|
27
|
+
* @private utility of `<Chat/>`
|
|
28
|
+
*/
|
|
29
|
+
type ToolCallChipTranslations = {
|
|
30
|
+
readonly toolCallTimeChipLabel?: string;
|
|
31
|
+
readonly toolCallTimeoutChipLabel?: string;
|
|
32
|
+
readonly toolCallTimeoutChipCancelledLabel?: string;
|
|
33
|
+
readonly toolCallTimeoutChipInactiveLabel?: string;
|
|
34
|
+
readonly toolCallTimeoutChipUpdatedLabel?: string;
|
|
35
|
+
readonly toolCallTimeoutChipFallbackLabel?: string;
|
|
36
|
+
};
|
|
18
37
|
/**
|
|
19
38
|
* Builds display text for a tool call chiplet.
|
|
20
39
|
*
|
|
@@ -35,6 +54,12 @@ export declare const TOOL_TITLES: Record<string, {
|
|
|
35
54
|
/**
|
|
36
55
|
* Gets the chiplet information including text and agent data (for team tools).
|
|
37
56
|
*
|
|
57
|
+
* @param toolCall - Tool call to build chiplet info for.
|
|
58
|
+
* @param locale - Optional BCP-47 locale string used to format time labels.
|
|
59
|
+
* @param titleOverrides - Optional localized titles keyed by tool name.
|
|
60
|
+
* @param chipTranslations - Optional localized chip templates for time-related tools.
|
|
61
|
+
*
|
|
38
62
|
* @private [🧠] Maybe public?
|
|
39
63
|
*/
|
|
40
|
-
export declare function getToolCallChipletInfo(toolCall: ToolCall): ToolCallChipletInfo;
|
|
64
|
+
export declare function getToolCallChipletInfo(toolCall: ToolCall, locale?: string, titleOverrides?: ToolCallTitleOverrides, chipTranslations?: ToolCallChipTranslations): ToolCallChipletInfo;
|
|
65
|
+
export {};
|
|
@@ -64,6 +64,24 @@ export type TimeoutToolCallPresentation = {
|
|
|
64
64
|
*/
|
|
65
65
|
readonly localDueDateLabel: string | null;
|
|
66
66
|
};
|
|
67
|
+
/**
|
|
68
|
+
* Optional localized labels used by timeout chips and friendly modal copy.
|
|
69
|
+
*
|
|
70
|
+
* @private internal utility of `<Chat/>`
|
|
71
|
+
*/
|
|
72
|
+
type TimeoutToolCallTranslations = {
|
|
73
|
+
readonly toolCallTimeoutChipLabel?: string;
|
|
74
|
+
readonly toolCallTimeoutChipCancelledLabel?: string;
|
|
75
|
+
readonly toolCallTimeoutChipInactiveLabel?: string;
|
|
76
|
+
readonly toolCallTimeoutChipUpdatedLabel?: string;
|
|
77
|
+
readonly toolCallTimeoutChipFallbackLabel?: string;
|
|
78
|
+
readonly toolCallTimeoutPrimaryScheduledLabel?: string;
|
|
79
|
+
readonly toolCallTimeoutSecondaryDurationLabel?: string;
|
|
80
|
+
readonly toolCallTimeoutPrimaryCancelledLabel?: string;
|
|
81
|
+
readonly toolCallTimeoutPrimaryInactiveLabel?: string;
|
|
82
|
+
readonly toolCallTimeoutPrimaryUpdatedLabel?: string;
|
|
83
|
+
readonly toolCallTimeoutPrimaryFallbackLabel?: string;
|
|
84
|
+
};
|
|
67
85
|
/**
|
|
68
86
|
* Inputs required to derive timeout presentation metadata.
|
|
69
87
|
*
|
|
@@ -86,6 +104,11 @@ type ResolveTimeoutToolCallPresentationOptions = {
|
|
|
86
104
|
* Current date used to calculate relative labels.
|
|
87
105
|
*/
|
|
88
106
|
readonly currentDate?: Date;
|
|
107
|
+
/**
|
|
108
|
+
* Optional BCP-47 locale string used to format local-time labels.
|
|
109
|
+
* When omitted the browser/OS default locale is used.
|
|
110
|
+
*/
|
|
111
|
+
readonly locale?: string;
|
|
89
112
|
};
|
|
90
113
|
/**
|
|
91
114
|
* Determines whether a tool name belongs to the timeout commitment.
|
|
@@ -104,19 +127,19 @@ export declare function resolveTimeoutToolCallPresentation(options: ResolveTimeo
|
|
|
104
127
|
*
|
|
105
128
|
* @private internal utility of `<Chat/>`
|
|
106
129
|
*/
|
|
107
|
-
export declare function buildTimeoutToolCallChipLabel(presentation: TimeoutToolCallPresentation): string;
|
|
130
|
+
export declare function buildTimeoutToolCallChipLabel(presentation: TimeoutToolCallPresentation, translations?: TimeoutToolCallTranslations): string;
|
|
108
131
|
/**
|
|
109
132
|
* Builds the primary timeout sentence shown in default modal view.
|
|
110
133
|
*
|
|
111
134
|
* @private internal utility of `<Chat/>`
|
|
112
135
|
*/
|
|
113
|
-
export declare function buildTimeoutToolPrimarySentence(presentation: TimeoutToolCallPresentation): string;
|
|
136
|
+
export declare function buildTimeoutToolPrimarySentence(presentation: TimeoutToolCallPresentation, translations?: TimeoutToolCallTranslations): string;
|
|
114
137
|
/**
|
|
115
138
|
* Builds one default-view scheduling sentence with local-time and relative context.
|
|
116
139
|
*
|
|
117
140
|
* @private internal utility of `<Chat/>`
|
|
118
141
|
*/
|
|
119
|
-
export declare function buildTimeoutToolScheduleSentence(presentation: TimeoutToolCallPresentation): string | null;
|
|
142
|
+
export declare function buildTimeoutToolScheduleSentence(presentation: TimeoutToolCallPresentation, translations?: TimeoutToolCallTranslations): string | null;
|
|
120
143
|
export {};
|
|
121
144
|
/**
|
|
122
145
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
package/esm/src/version.d.ts
CHANGED
|
@@ -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.112.0-
|
|
18
|
+
* It follows semantic versioning (e.g., `0.112.0-31`).
|
|
19
19
|
*
|
|
20
20
|
* @generated
|
|
21
21
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptbook/remote-server",
|
|
3
|
-
"version": "0.112.0-
|
|
3
|
+
"version": "0.112.0-32",
|
|
4
4
|
"description": "Promptbook: Turn your company's scattered knowledge into AI ready books",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
"module": "./esm/index.es.js",
|
|
99
99
|
"typings": "./esm/typings/src/_packages/remote-server.index.d.ts",
|
|
100
100
|
"peerDependencies": {
|
|
101
|
-
"@promptbook/core": "0.112.0-
|
|
101
|
+
"@promptbook/core": "0.112.0-32"
|
|
102
102
|
},
|
|
103
103
|
"dependencies": {
|
|
104
104
|
"@mozilla/readability": "0.6.0",
|
package/umd/index.umd.js
CHANGED
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
* @generated
|
|
51
51
|
* @see https://github.com/webgptorg/promptbook
|
|
52
52
|
*/
|
|
53
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-
|
|
53
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-32';
|
|
54
54
|
/**
|
|
55
55
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
56
56
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -15472,10 +15472,6 @@
|
|
|
15472
15472
|
* Prefix used for TEAM tool names.
|
|
15473
15473
|
*/
|
|
15474
15474
|
const TEAM_TOOL_PREFIX = 'team_chat_';
|
|
15475
|
-
/**
|
|
15476
|
-
* Length of URL hash suffix appended to TEAM tool names.
|
|
15477
|
-
*/
|
|
15478
|
-
const TEAM_TOOL_HASH_LENGTH = 10;
|
|
15479
15475
|
/**
|
|
15480
15476
|
* Fallback normalized name when teammate label is empty.
|
|
15481
15477
|
*/
|
|
@@ -15492,20 +15488,19 @@
|
|
|
15492
15488
|
return normalized || TEAM_TOOL_FALLBACK_NAME;
|
|
15493
15489
|
}
|
|
15494
15490
|
/**
|
|
15495
|
-
* Builds a deterministic TEAM tool name from teammate
|
|
15491
|
+
* Builds a deterministic TEAM tool name from the teammate label.
|
|
15496
15492
|
*
|
|
15497
|
-
* The
|
|
15498
|
-
*
|
|
15493
|
+
* The tool name is derived solely from the human-readable label so that it
|
|
15494
|
+
* remains stable and predictable regardless of internal technical identifiers.
|
|
15499
15495
|
*
|
|
15500
|
-
* @param
|
|
15501
|
-
* @param teammateLabel - Human-readable teammate label.
|
|
15502
|
-
* @returns
|
|
15496
|
+
* @param _teammateUrl - Canonical teammate URL (kept for API compatibility, not used).
|
|
15497
|
+
* @param teammateLabel - Human-readable teammate label used as the basis for the name.
|
|
15498
|
+
* @returns TEAM tool name derived from the label.
|
|
15503
15499
|
* @private internal utility of TEAM commitments and chat UI mapping
|
|
15504
15500
|
*/
|
|
15505
|
-
function createTeamToolName(
|
|
15501
|
+
function createTeamToolName(_teammateUrl, teammateLabel) {
|
|
15506
15502
|
const normalizedLabel = normalizeTeammateToolNamePart(teammateLabel);
|
|
15507
|
-
|
|
15508
|
-
return `${TEAM_TOOL_PREFIX}${normalizedLabel}_${hash}`;
|
|
15503
|
+
return `${TEAM_TOOL_PREFIX}${normalizedLabel}`;
|
|
15509
15504
|
}
|
|
15510
15505
|
|
|
15511
15506
|
const urlRegex = /https?:\/\/[^\s]+/gi;
|
|
@@ -15710,7 +15705,7 @@
|
|
|
15710
15705
|
`);
|
|
15711
15706
|
}
|
|
15712
15707
|
applyToAgentModelRequirements(requirements, content) {
|
|
15713
|
-
var _a, _b;
|
|
15708
|
+
var _a, _b, _c;
|
|
15714
15709
|
const trimmedContent = content.trim();
|
|
15715
15710
|
if (!trimmedContent) {
|
|
15716
15711
|
return requirements;
|
|
@@ -15722,14 +15717,18 @@
|
|
|
15722
15717
|
}
|
|
15723
15718
|
const agentName = ((_a = requirements._metadata) === null || _a === void 0 ? void 0 : _a.agentName) || 'Agent';
|
|
15724
15719
|
const existingTeammates = ((_b = requirements._metadata) === null || _b === void 0 ? void 0 : _b.teammates) || [];
|
|
15720
|
+
const preResolvedProfiles = (((_c = requirements._metadata) === null || _c === void 0 ? void 0 : _c.preResolvedTeammateProfiles) || {});
|
|
15725
15721
|
const resolvedTeammates = resolveTeamTeammateLabels(trimmedContent, teammates);
|
|
15726
15722
|
const teamEntries = resolvedTeammates.map((teammate) => {
|
|
15723
|
+
const profile = preResolvedProfiles[teammate.url];
|
|
15724
|
+
const resolvedLabel = (profile === null || profile === void 0 ? void 0 : profile.agentName) || teammate.label;
|
|
15727
15725
|
const existingTeammate = existingTeammates.find((entry) => entry.url === teammate.url);
|
|
15728
15726
|
return {
|
|
15729
15727
|
toolName: ((existingTeammate === null || existingTeammate === void 0 ? void 0 : existingTeammate.toolName) ||
|
|
15730
|
-
createTeamToolName(teammate.url,
|
|
15731
|
-
teammate,
|
|
15728
|
+
createTeamToolName(teammate.url, resolvedLabel)),
|
|
15729
|
+
teammate: { ...teammate, label: resolvedLabel },
|
|
15732
15730
|
agentName,
|
|
15731
|
+
description: (profile === null || profile === void 0 ? void 0 : profile.personaDescription) || null,
|
|
15733
15732
|
};
|
|
15734
15733
|
});
|
|
15735
15734
|
for (const entry of teamEntries) {
|
|
@@ -15741,9 +15740,12 @@
|
|
|
15741
15740
|
if (updatedTools.some((tool) => tool.name === entry.toolName)) {
|
|
15742
15741
|
continue;
|
|
15743
15742
|
}
|
|
15743
|
+
const toolDescription = entry.description
|
|
15744
|
+
? `Consult teammate ${entry.teammate.label}\n${entry.description}`
|
|
15745
|
+
: `Consult teammate ${entry.teammate.label}`;
|
|
15744
15746
|
updatedTools.push({
|
|
15745
15747
|
name: entry.toolName,
|
|
15746
|
-
description:
|
|
15748
|
+
description: toolDescription,
|
|
15747
15749
|
parameters: {
|
|
15748
15750
|
type: 'object',
|
|
15749
15751
|
properties: {
|
|
@@ -15772,8 +15774,7 @@
|
|
|
15772
15774
|
toolName: entry.toolName,
|
|
15773
15775
|
});
|
|
15774
15776
|
}
|
|
15775
|
-
const
|
|
15776
|
-
const teamSystemMessage = this.createSystemMessageSection('Teammates:', buildTeamSystemMessageBody(teamOverviewText, teamEntries));
|
|
15777
|
+
const teamSystemMessage = this.createSystemMessageSection('Teammates:', buildTeamSystemMessageBody(teamEntries));
|
|
15777
15778
|
return this.appendToSystemMessage({
|
|
15778
15779
|
...requirements,
|
|
15779
15780
|
tools: updatedTools,
|
|
@@ -15810,25 +15811,24 @@
|
|
|
15810
15811
|
};
|
|
15811
15812
|
});
|
|
15812
15813
|
}
|
|
15813
|
-
/**
|
|
15814
|
-
* Rewrites TEAM commitment content into a URL-free teammate overview text.
|
|
15815
|
-
*/
|
|
15816
|
-
function createTeamOverviewText(teamContent, teamEntries) {
|
|
15817
|
-
let overviewText = teamContent;
|
|
15818
|
-
for (const entry of teamEntries) {
|
|
15819
|
-
overviewText = overviewText.split(entry.teammate.url).join(entry.teammate.label);
|
|
15820
|
-
}
|
|
15821
|
-
return overviewText.trim();
|
|
15822
|
-
}
|
|
15823
15814
|
/**
|
|
15824
15815
|
* Builds the textual TEAM section body for the final system message.
|
|
15816
|
+
*
|
|
15817
|
+
* Each teammate is listed with its tool name and, when available, a one-line description.
|
|
15818
|
+
* Uses `spaceTrim` to ensure consistent whitespace and indentation.
|
|
15825
15819
|
*/
|
|
15826
|
-
function buildTeamSystemMessageBody(
|
|
15827
|
-
const
|
|
15828
|
-
|
|
15829
|
-
|
|
15830
|
-
|
|
15831
|
-
|
|
15820
|
+
function buildTeamSystemMessageBody(teamEntries) {
|
|
15821
|
+
const lines = teamEntries.map((entry, index) => {
|
|
15822
|
+
const toolLine = `${index + 1}) ${entry.teammate.label} tool \`${entry.toolName}\``;
|
|
15823
|
+
if (!entry.description) {
|
|
15824
|
+
return toolLine;
|
|
15825
|
+
}
|
|
15826
|
+
return _spaceTrim.spaceTrim(`
|
|
15827
|
+
${toolLine}
|
|
15828
|
+
${entry.description}
|
|
15829
|
+
`);
|
|
15830
|
+
});
|
|
15831
|
+
return lines.join('\n');
|
|
15832
15832
|
}
|
|
15833
15833
|
/**
|
|
15834
15834
|
* Registers tool function and title for a teammate tool.
|
|
@@ -24171,13 +24171,23 @@
|
|
|
24171
24171
|
*/
|
|
24172
24172
|
function mergeToolCalls(existingToolCalls, incomingToolCalls) {
|
|
24173
24173
|
if (!existingToolCalls || existingToolCalls.length === 0) {
|
|
24174
|
-
return incomingToolCalls ? [...incomingToolCalls] : [];
|
|
24174
|
+
return incomingToolCalls ? deduplicatePreparationToolCalls([...incomingToolCalls]) : [];
|
|
24175
24175
|
}
|
|
24176
24176
|
if (!incomingToolCalls || incomingToolCalls.length === 0) {
|
|
24177
24177
|
return [...existingToolCalls];
|
|
24178
24178
|
}
|
|
24179
24179
|
const mergedToolCalls = [...existingToolCalls];
|
|
24180
24180
|
for (const incomingToolCall of incomingToolCalls) {
|
|
24181
|
+
if (isAssistantPreparationToolCall(incomingToolCall)) {
|
|
24182
|
+
// A new preparation phase always replaces any previous assistant_preparation tool
|
|
24183
|
+
// call, regardless of phase argument, so only one chip is ever shown at a time.
|
|
24184
|
+
const existingPreparationIndex = mergedToolCalls.findIndex(isAssistantPreparationToolCall);
|
|
24185
|
+
if (existingPreparationIndex !== -1) {
|
|
24186
|
+
mergedToolCalls.splice(existingPreparationIndex, 1);
|
|
24187
|
+
}
|
|
24188
|
+
mergedToolCalls.push(incomingToolCall);
|
|
24189
|
+
continue;
|
|
24190
|
+
}
|
|
24181
24191
|
const incomingIdentity = getToolCallIdentity(incomingToolCall);
|
|
24182
24192
|
const existingIndex = mergedToolCalls.findIndex((existingToolCall) => getToolCallIdentity(existingToolCall) === incomingIdentity);
|
|
24183
24193
|
if (existingIndex === -1) {
|
|
@@ -24289,6 +24299,30 @@
|
|
|
24289
24299
|
return String(value);
|
|
24290
24300
|
}
|
|
24291
24301
|
}
|
|
24302
|
+
/**
|
|
24303
|
+
* Ensures at most one `assistant_preparation` tool call survives in the list,
|
|
24304
|
+
* keeping the last occurrence so the most recent preparation phase is shown.
|
|
24305
|
+
*
|
|
24306
|
+
* @param toolCalls - Mutable list to deduplicate in-place.
|
|
24307
|
+
* @returns The same array after removing redundant preparation entries.
|
|
24308
|
+
* @private helper of `mergeToolCalls`
|
|
24309
|
+
*/
|
|
24310
|
+
function deduplicatePreparationToolCalls(toolCalls) {
|
|
24311
|
+
let lastPreparationIndex = -1;
|
|
24312
|
+
for (let index = toolCalls.length - 1; index >= 0; index--) {
|
|
24313
|
+
if (!isAssistantPreparationToolCall(toolCalls[index])) {
|
|
24314
|
+
continue;
|
|
24315
|
+
}
|
|
24316
|
+
if (lastPreparationIndex === -1) {
|
|
24317
|
+
lastPreparationIndex = index;
|
|
24318
|
+
}
|
|
24319
|
+
else {
|
|
24320
|
+
// Remove earlier duplicate — keep only the last (most recent) one.
|
|
24321
|
+
toolCalls.splice(index, 1);
|
|
24322
|
+
}
|
|
24323
|
+
}
|
|
24324
|
+
return toolCalls;
|
|
24325
|
+
}
|
|
24292
24326
|
|
|
24293
24327
|
/**
|
|
24294
24328
|
* Computes SHA-256 hash of the agent source
|
|
@@ -25221,7 +25255,7 @@
|
|
|
25221
25255
|
* @private @@@
|
|
25222
25256
|
*/
|
|
25223
25257
|
async function createAgentModelRequirementsWithCommitments(agentSource, modelName, options) {
|
|
25224
|
-
var _a;
|
|
25258
|
+
var _a, _b, _c;
|
|
25225
25259
|
const agentReferenceResolver = options === null || options === void 0 ? void 0 : options.agentReferenceResolver;
|
|
25226
25260
|
// Parse the agent source to extract commitments
|
|
25227
25261
|
const parseResult = parseAgentSourceWithCommitments(agentSource);
|
|
@@ -25289,6 +25323,36 @@
|
|
|
25289
25323
|
if (commitment.type === 'CLOSED' && i !== filteredCommitments.length - 1) {
|
|
25290
25324
|
continue;
|
|
25291
25325
|
}
|
|
25326
|
+
// For TEAM commitments, pre-resolve teammate profiles if a resolver is provided
|
|
25327
|
+
// and store them in metadata before the commitment is applied.
|
|
25328
|
+
const profileResolver = (_a = options === null || options === void 0 ? void 0 : options.teammateProfileResolver) !== null && _a !== void 0 ? _a : options === null || options === void 0 ? void 0 : options.agentReferenceResolver;
|
|
25329
|
+
if (commitment.type === 'TEAM' && (profileResolver === null || profileResolver === void 0 ? void 0 : profileResolver.resolveTeammateProfile)) {
|
|
25330
|
+
try {
|
|
25331
|
+
const parsedTeammates = parseTeamCommitmentContent(commitmentContent, { strict: false });
|
|
25332
|
+
const preResolved = {
|
|
25333
|
+
...(_b = requirements._metadata) === null || _b === void 0 ? void 0 : _b.preResolvedTeammateProfiles,
|
|
25334
|
+
};
|
|
25335
|
+
for (const teammate of parsedTeammates) {
|
|
25336
|
+
if (preResolved[teammate.url]) {
|
|
25337
|
+
continue;
|
|
25338
|
+
}
|
|
25339
|
+
const profile = await profileResolver.resolveTeammateProfile(teammate.url);
|
|
25340
|
+
if (profile) {
|
|
25341
|
+
preResolved[teammate.url] = profile;
|
|
25342
|
+
}
|
|
25343
|
+
}
|
|
25344
|
+
requirements = {
|
|
25345
|
+
...requirements,
|
|
25346
|
+
_metadata: {
|
|
25347
|
+
...requirements._metadata,
|
|
25348
|
+
preResolvedTeammateProfiles: preResolved,
|
|
25349
|
+
},
|
|
25350
|
+
};
|
|
25351
|
+
}
|
|
25352
|
+
catch (error) {
|
|
25353
|
+
console.warn('Failed to pre-resolve teammate profiles for TEAM commitment:', error);
|
|
25354
|
+
}
|
|
25355
|
+
}
|
|
25292
25356
|
const definition = getCommitmentDefinition(commitment.type);
|
|
25293
25357
|
if (definition) {
|
|
25294
25358
|
try {
|
|
@@ -25384,7 +25448,7 @@
|
|
|
25384
25448
|
// Add example interactions to the system message
|
|
25385
25449
|
const examples = [];
|
|
25386
25450
|
// 1. Initial message as an example agent response
|
|
25387
|
-
const initialMessage = (
|
|
25451
|
+
const initialMessage = (_c = parseResult.commitments.find((c) => c.type === 'INITIAL MESSAGE')) === null || _c === void 0 ? void 0 : _c.content;
|
|
25388
25452
|
if (initialMessage) {
|
|
25389
25453
|
examples.push(`Agent: ${initialMessage}`);
|
|
25390
25454
|
}
|