@promptbook/fake-llm 0.105.0-14 → 0.105.0-15

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.
@@ -75,6 +75,11 @@ import { MODEL_TRUST_LEVELS } from '../constants';
75
75
  import { MODEL_ORDERS } from '../constants';
76
76
  import { ORDER_OF_PIPELINE_JSON } from '../constants';
77
77
  import { RESERVED_PARAMETER_NAMES } from '../constants';
78
+ import { LIMITS } from '../constants';
79
+ import { TIME_INTERVALS } from '../constants';
80
+ import { NETWORK_LIMITS } from '../constants';
81
+ import { COLOR_CONSTANTS } from '../constants';
82
+ import { HTTP_STATUS_CODES } from '../constants';
78
83
  import { compilePipeline } from '../conversion/compilePipeline';
79
84
  import { parsePipeline } from '../conversion/parsePipeline';
80
85
  import { pipelineJsonToString } from '../conversion/pipelineJsonToString';
@@ -275,6 +280,11 @@ export { MODEL_TRUST_LEVELS };
275
280
  export { MODEL_ORDERS };
276
281
  export { ORDER_OF_PIPELINE_JSON };
277
282
  export { RESERVED_PARAMETER_NAMES };
283
+ export { LIMITS };
284
+ export { TIME_INTERVALS };
285
+ export { NETWORK_LIMITS };
286
+ export { COLOR_CONSTANTS };
287
+ export { HTTP_STATUS_CODES };
278
288
  export { compilePipeline };
279
289
  export { parsePipeline };
280
290
  export { pipelineJsonToString };
@@ -17,6 +17,7 @@ import type { MockedChatDelayConfig } from '../book-components/Chat/MockedChat/M
17
17
  import type { MockedChatProps } from '../book-components/Chat/MockedChat/MockedChat';
18
18
  import type { ChatSaveFormatDefinition } from '../book-components/Chat/save/_common/ChatSaveFormatDefinition';
19
19
  import type { string_chat_format_name } from '../book-components/Chat/save/_common/string_chat_format_name';
20
+ import type { ChatToolCall } from '../book-components/Chat/types/ChatMessage';
20
21
  import type { ChatMessage } from '../book-components/Chat/types/ChatMessage';
21
22
  import type { ChatParticipant } from '../book-components/Chat/types/ChatParticipant';
22
23
  import type { MessageButton } from '../book-components/Chat/utils/parseMessageButtons';
@@ -213,6 +214,7 @@ import type { SpeechRecognitionStartOptions } from '../types/SpeechRecognition';
213
214
  import type { SpeechRecognitionState } from '../types/SpeechRecognition';
214
215
  import type { SpeechRecognitionEvent } from '../types/SpeechRecognition';
215
216
  import type { TaskType } from '../types/TaskType';
217
+ import type { ToolCall } from '../types/ToolCall';
216
218
  import type { string_char_emoji } from '../types/typeAliasEmoji';
217
219
  import type { string_business_category_name } from '../types/typeAliases';
218
220
  import type { string_model_name } from '../types/typeAliases';
@@ -397,6 +399,7 @@ export type { MockedChatDelayConfig };
397
399
  export type { MockedChatProps };
398
400
  export type { ChatSaveFormatDefinition };
399
401
  export type { string_chat_format_name };
402
+ export type { ChatToolCall };
400
403
  export type { ChatMessage };
401
404
  export type { ChatParticipant };
402
405
  export type { MessageButton };
@@ -593,6 +596,7 @@ export type { SpeechRecognitionStartOptions };
593
596
  export type { SpeechRecognitionState };
594
597
  export type { SpeechRecognitionEvent };
595
598
  export type { TaskType };
599
+ export type { ToolCall };
596
600
  export type { string_char_emoji };
597
601
  export type { string_business_category_name };
598
602
  export type { string_model_name };
@@ -1,6 +1,5 @@
1
1
  /// <reference types="react" />
2
2
  import type { id } from '../../../types/typeAliases';
3
- import type { TODO_any } from '../../../utils/organization/TODO_any';
4
3
  import type { ChatMessage } from '../types/ChatMessage';
5
4
  import type { ChatParticipant } from '../types/ChatParticipant';
6
5
  import type { ChatProps } from './ChatProps';
@@ -42,16 +41,12 @@ type ChatMessageItemProps = Pick<ChatProps, 'onMessage' | 'participants'> & {
42
41
  /**
43
42
  * Called when a tool call chiplet is clicked.
44
43
  */
45
- onToolCallClick?: (toolCall: {
46
- name: string;
47
- arguments?: TODO_any;
48
- result?: TODO_any;
49
- }) => void;
44
+ onToolCallClick?: (toolCall: NonNullable<ChatMessage['toolCalls']>[number]) => void;
50
45
  };
51
46
  /**
52
47
  * Renders a single chat message item with avatar, content, buttons, and rating.
53
48
  *
54
49
  * @private internal subcomponent of `<Chat>` component
55
50
  */
56
- export declare const ChatMessageItem: import("react").MemoExoticComponent<({ message, participant, participants, isLastMessage, onMessage, setExpandedMessageId, isExpanded, currentRating, handleRating, mode, isCopyButtonEnabled, isFeedbackEnabled, onCopy, onCreateAgent, toolTitles, onToolCallClick, }: ChatMessageItemProps) => import("react/jsx-runtime").JSX.Element>;
51
+ export declare const ChatMessageItem: import("react").MemoExoticComponent<(props: ChatMessageItemProps) => import("react/jsx-runtime").JSX.Element>;
57
52
  export {};
@@ -3,7 +3,6 @@ import type { Promisable } from 'type-fest';
3
3
  import { Color } from '../../../_packages/color.index';
4
4
  import { SpeechRecognition } from '../../../types/SpeechRecognition';
5
5
  import { string_color } from '../../../types/typeAliases';
6
- import type { TODO_any } from '../../../utils/organization/TODO_any';
7
6
  import type { string_chat_format_name } from '../save/_common/string_chat_format_name';
8
7
  import type { ChatMessage } from '../types/ChatMessage';
9
8
  import type { ChatParticipant } from '../types/ChatParticipant';
@@ -198,11 +197,7 @@ export type ChatProps = {
198
197
  /**
199
198
  * Called when a tool call chiplet is clicked.
200
199
  */
201
- onToolCallClick?: (toolCall: {
202
- name: string;
203
- arguments?: TODO_any;
204
- result?: TODO_any;
205
- }) => void;
200
+ onToolCallClick?: (toolCall: NonNullable<ChatMessage['toolCalls']>[number]) => void;
206
201
  /**
207
202
  * Visual style of the chat component
208
203
  */
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Renders a nice clock icon with a specific time.
3
+ *
4
+ * @private internal subcomponent of `<Chat>` component
5
+ */
6
+ export declare function ClockIcon({ date, size }: {
7
+ date: Date;
8
+ size?: number;
9
+ }): import("react/jsx-runtime").JSX.Element;
@@ -1,6 +1,7 @@
1
1
  import { Message } from '../../../types/Message';
2
+ import type { ToolCall } from '../../../types/ToolCall';
2
3
  import type { id, string_markdown } from '../../../types/typeAliases';
3
- import type { TODO_any } from '../../../utils/organization/TODO_any';
4
+ export type ChatToolCall = ToolCall;
4
5
  /**
5
6
  * Represents a single message within a chat interface.
6
7
  *
@@ -37,45 +38,17 @@ export type ChatMessage = Omit<Message<id>, 'direction' | 'recipients' | 'thread
37
38
  /**
38
39
  * Optional tool calls made during the execution
39
40
  */
40
- readonly ongoingToolCalls?: ReadonlyArray<{
41
- /**
42
- * Name of the tool
43
- */
44
- readonly name: string;
45
- /**
46
- * Arguments for the tool call
47
- */
48
- readonly arguments?: string | Record<string, TODO_any>;
49
- /**
50
- * Result of the tool call
51
- */
52
- readonly result?: TODO_any;
53
- /**
54
- * Raw tool call from the model
55
- */
56
- readonly rawToolCall?: TODO_any;
57
- }>;
41
+ readonly ongoingToolCalls?: ReadonlyArray<ChatToolCall>;
42
+ /**
43
+ * Optional tool calls used to produce this message.
44
+ */
45
+ readonly toolCalls?: ReadonlyArray<ChatToolCall>;
58
46
  /**
59
47
  * Optional tool calls that have been completed
48
+ *
49
+ * @deprecated Use `toolCalls` instead.
60
50
  */
61
- readonly completedToolCalls?: ReadonlyArray<{
62
- /**
63
- * Name of the tool
64
- */
65
- readonly name: string;
66
- /**
67
- * Arguments for the tool call
68
- */
69
- readonly arguments?: string | Record<string, TODO_any>;
70
- /**
71
- * Result of the tool call
72
- */
73
- readonly result?: TODO_any;
74
- /**
75
- * Raw tool call from the model
76
- */
77
- readonly rawToolCall?: TODO_any;
78
- }>;
51
+ readonly completedToolCalls?: ReadonlyArray<ChatToolCall>;
79
52
  /**
80
53
  * Optional file attachments
81
54
  */
@@ -1,4 +1,4 @@
1
- import type { TODO_any } from '../../../utils/organization/TODO_any';
1
+ import type { ToolCall } from '../../../types/ToolCall';
2
2
  /**
3
3
  * Utility to format tool call information for user-friendly display.
4
4
  */
@@ -16,7 +16,4 @@ export declare const TOOL_TITLES: Record<string, {
16
16
  *
17
17
  * @private [🧠] Maybe public?
18
18
  */
19
- export declare function getToolCallChipletText(toolCall: {
20
- name: string;
21
- arguments?: string | Record<string, TODO_any>;
22
- }): string;
19
+ export declare function getToolCallChipletText(toolCall: ToolCall): string;
@@ -0,0 +1,41 @@
1
+ import type { ToolCall } from '../../../types/ToolCall';
2
+ import type { TODO_any } from '../../../utils/organization/TODO_any';
3
+ /**
4
+ * @@@
5
+ *
6
+ * @private utility of `<Chat/>` component
7
+ */
8
+ export declare function parseToolCallArguments(toolCall: Pick<ToolCall, 'arguments'>): Record<string, TODO_any>;
9
+ /**
10
+ * @@@
11
+ *
12
+ * @private utility of `<Chat/>` component
13
+ */
14
+ export declare function parseToolCallResult(result: ToolCall['result']): TODO_any;
15
+ type SearchResultsExtraction = {
16
+ results: Array<TODO_any>;
17
+ rawText: string | null;
18
+ };
19
+ /**
20
+ * @@@
21
+ *
22
+ * @private utility of `<Chat/>` component
23
+ */
24
+ export declare function extractSearchResults(resultRaw: TODO_any): SearchResultsExtraction;
25
+ /**
26
+ * @@@
27
+ *
28
+ * @private utility of `<Chat/>` component
29
+ */
30
+ export declare function getToolCallTimestamp(toolCall: Pick<ToolCall, 'createdAt'>): Date | null;
31
+ /**
32
+ * @@@
33
+ *
34
+ * @private utility of `<Chat/>` component
35
+ */
36
+ export declare function getToolCallResultDate(result: ToolCall['result']): Date | null;
37
+ export {};
38
+ /**
39
+ * Note: [💞] Ignore a discrepancy between file name and entity name
40
+ * <- TODO: But maybe split into multiple files later?
41
+ */
@@ -21,6 +21,7 @@ import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
21
21
  */
22
22
  export declare class UseSearchEngineCommitmentDefinition extends BaseCommitmentDefinition<'USE SEARCH ENGINE'> {
23
23
  constructor();
24
+ get requiresContent(): boolean;
24
25
  /**
25
26
  * Short one-line description of USE SEARCH ENGINE.
26
27
  */
@@ -11,12 +11,14 @@ import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
11
11
  *
12
12
  * ```book
13
13
  * USE TIME
14
+ * USE TIME Prefer the user's local timezone.
14
15
  * ```
15
16
  *
16
17
  * @private [🪔] Maybe export the commitments through some package
17
18
  */
18
19
  export declare class UseTimeCommitmentDefinition extends BaseCommitmentDefinition<'USE TIME'> {
19
20
  constructor();
21
+ get requiresContent(): boolean;
20
22
  /**
21
23
  * Short one-line description of USE TIME.
22
24
  */
@@ -0,0 +1,6 @@
1
+ /**
2
+ * @@@
3
+ *
4
+ * @private utility for commitments
5
+ */
6
+ export declare function formatOptionalInstructionBlock(label: string, content: string): string;
@@ -71,6 +71,131 @@ export declare const RESERVED_PARAMETER_RESTRICTED: string;
71
71
  * @public exported from `@promptbook/core`
72
72
  */
73
73
  export declare const RESERVED_PARAMETER_NAMES: readonly ["content", "context", "knowledge", "examples", "modelName", "currentDate"];
74
+ /**
75
+ * Limits for IDs, names, and other strings
76
+ *
77
+ * @public exported from `@promptbook/core`
78
+ */
79
+ export declare const LIMITS: {
80
+ /**
81
+ * Minimum length of a name (e.g. agent name, persona name)
82
+ */
83
+ readonly NAME_MIN_LENGTH: 3;
84
+ /**
85
+ * Recommended maximum length of a name
86
+ */
87
+ readonly NAME_MAX_LENGTH: 20;
88
+ /**
89
+ * Maximum length of a short description or a hash
90
+ */
91
+ readonly SHORT_TEXT_MAX_LENGTH: 30;
92
+ /**
93
+ * Gone
94
+ */
95
+ readonly GONE: 410;
96
+ /**
97
+ * Gateway timeout
98
+ */
99
+ readonly GATEWAY_TIMEOUT: 504;
100
+ /**
101
+ * Too many requests
102
+ */
103
+ readonly TOO_MANY_REQUESTS: 429;
104
+ /**
105
+ * Maximum length of a file path segment
106
+ */
107
+ readonly FILE_PATH_SEGMENT_MAX_LENGTH: 8;
108
+ /**
109
+ * Default length of a short name (e.g. for default agent names)
110
+ */
111
+ readonly SHORT_NAME_LENGTH: 6;
112
+ };
113
+ /**
114
+ * Common time intervals in milliseconds
115
+ *
116
+ * @public exported from `@promptbook/core`
117
+ */
118
+ export declare const TIME_INTERVALS: {
119
+ /**
120
+ * One second in milliseconds
121
+ */
122
+ readonly SECOND: 1000;
123
+ /**
124
+ * Two seconds in milliseconds
125
+ */
126
+ readonly TWO_SECONDS: 2000;
127
+ /**
128
+ * One minute in milliseconds
129
+ */
130
+ readonly MINUTE: 60000;
131
+ /**
132
+ * Thirty seconds in milliseconds
133
+ */
134
+ readonly THIRTY_SECONDS: 30000;
135
+ /**
136
+ * Five seconds in milliseconds
137
+ */
138
+ readonly FIVE_SECONDS: 5000;
139
+ };
140
+ /**
141
+ * Common ports and network limits
142
+ *
143
+ * @public exported from `@promptbook/core`
144
+ */
145
+ export declare const NETWORK_LIMITS: {
146
+ /**
147
+ * Maximum valid port number
148
+ */
149
+ readonly MAX_PORT: 65535;
150
+ };
151
+ /**
152
+ * Common color and image constants
153
+ *
154
+ * @public exported from `@promptbook/core`
155
+ */
156
+ export declare const COLOR_CONSTANTS: {
157
+ /**
158
+ * Maximum value for a color channel (0-255)
159
+ */
160
+ readonly MAX_CHANNEL_VALUE: 255;
161
+ /**
162
+ * Number of possible colors in 24-bit color (0xFFFFFF)
163
+ */
164
+ readonly MAX_24BIT_COLOR: 16777215;
165
+ /**
166
+ * Base for hexadecimal strings
167
+ */
168
+ readonly HEX_BASE: 16;
169
+ /**
170
+ * Length of a hex color without alpha (e.g. "FF0000")
171
+ */
172
+ readonly HEX_COLOR_LENGTH: 6;
173
+ /**
174
+ * Full circle in degrees
175
+ */
176
+ readonly FULL_CIRCLE_DEGREES: 360;
177
+ /**
178
+ * Half circle in degrees
179
+ */
180
+ readonly HALF_CIRCLE_DEGREES: 180;
181
+ };
182
+ /**
183
+ * HTTP Status Codes
184
+ *
185
+ * @public exported from `@promptbook/core`
186
+ */
187
+ export declare const HTTP_STATUS_CODES: {
188
+ readonly OK: 200;
189
+ readonly CREATED: 201;
190
+ readonly BAD_REQUEST: 400;
191
+ readonly UNAUTHORIZED: 401;
192
+ readonly NOT_FOUND: 404;
193
+ readonly INTERNAL_SERVER_ERROR: 500;
194
+ readonly BAD_GATEWAY: 502;
195
+ readonly SERVICE_UNAVAILABLE: 503;
196
+ readonly GATEWAY_TIMEOUT: 504;
197
+ readonly TOO_MANY_REQUESTS: 429;
198
+ };
74
199
  /**
75
200
  * Note: [💞] Ignore a discrepancy between file name and entity name
76
201
  */
@@ -1,5 +1,5 @@
1
+ import type { ToolCall } from '../types/ToolCall';
1
2
  import type { string_date_iso8601, string_model_name, string_prompt } from '../types/typeAliases';
2
- import type { TODO_any } from '../utils/organization/TODO_any';
3
3
  import type { TODO_object } from '../utils/organization/TODO_object';
4
4
  import type { EmbeddingVector } from './EmbeddingVector';
5
5
  import type { Usage } from './Usage';
@@ -26,24 +26,7 @@ export type ChatPromptResult = CommonPromptResult & {
26
26
  /**
27
27
  * Optional tool calls made during the execution
28
28
  */
29
- readonly toolCalls?: ReadonlyArray<{
30
- /**
31
- * Name of the tool
32
- */
33
- readonly name: string;
34
- /**
35
- * Arguments of the tool call
36
- */
37
- readonly arguments: string;
38
- /**
39
- * Result of the tool call
40
- */
41
- readonly result: string;
42
- /**
43
- * Raw tool call from the model
44
- */
45
- readonly rawToolCall: TODO_any;
46
- }>;
29
+ readonly toolCalls?: ReadonlyArray<ToolCall>;
47
30
  };
48
31
  /**
49
32
  * Image prompt result
@@ -0,0 +1,37 @@
1
+ import type { string_date_iso8601 } from './typeAliases';
2
+ import type { TODO_any } from '../utils/organization/TODO_any';
3
+ /**
4
+ * Represents a single tool call with its inputs, outputs, and timing.
5
+ *
6
+ * Note: This is fully serializable as JSON.
7
+ */
8
+ export type ToolCall = {
9
+ /**
10
+ * Name of the tool.
11
+ */
12
+ readonly name: string;
13
+ /**
14
+ * Arguments for the tool call.
15
+ */
16
+ readonly arguments?: string | Record<string, TODO_any>;
17
+ /**
18
+ * Result of the tool call.
19
+ */
20
+ readonly result?: TODO_any;
21
+ /**
22
+ * Raw tool call payload from the model.
23
+ */
24
+ readonly rawToolCall?: TODO_any;
25
+ /**
26
+ * Timestamp when the tool call was initiated.
27
+ */
28
+ readonly createdAt?: string_date_iso8601;
29
+ /**
30
+ * Errors thrown during tool execution.
31
+ */
32
+ readonly errors?: ReadonlyArray<TODO_any>;
33
+ /**
34
+ * Warnings reported during tool execution.
35
+ */
36
+ readonly warnings?: ReadonlyArray<TODO_any>;
37
+ };
@@ -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.105.0-13`).
18
+ * It follows semantic versioning (e.g., `0.105.0-14`).
19
19
  *
20
20
  * @generated
21
21
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/fake-llm",
3
- "version": "0.105.0-14",
3
+ "version": "0.105.0-15",
4
4
  "description": "Promptbook: Turn your company's scattered knowledge into AI ready books",
5
5
  "private": false,
6
6
  "sideEffects": false,
@@ -96,11 +96,12 @@
96
96
  "module": "./esm/index.es.js",
97
97
  "typings": "./esm/typings/src/_packages/fake-llm.index.d.ts",
98
98
  "peerDependencies": {
99
- "@promptbook/core": "0.105.0-14"
99
+ "@promptbook/core": "0.105.0-15"
100
100
  },
101
101
  "dependencies": {
102
102
  "crypto": "1.0.1",
103
103
  "lorem-ipsum": "2.0.8",
104
+ "moment": "2.30.1",
104
105
  "spacetrim": "0.11.60",
105
106
  "waitasecond": "1.11.160"
106
107
  }
package/umd/index.umd.js CHANGED
@@ -1,12 +1,13 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('spacetrim'), require('waitasecond'), require('crypto'), require('lorem-ipsum'), require('path'), require('crypto-js'), require('crypto-js/enc-hex')) :
3
- typeof define === 'function' && define.amd ? define(['exports', 'spacetrim', 'waitasecond', 'crypto', 'lorem-ipsum', 'path', 'crypto-js', 'crypto-js/enc-hex'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-fake-llm"] = {}, global.spaceTrim$1, global.waitasecond, global.crypto, global.loremIpsum));
5
- })(this, (function (exports, spaceTrim$1, waitasecond, crypto, loremIpsum) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('spacetrim'), require('waitasecond'), require('crypto'), require('lorem-ipsum'), require('path'), require('crypto-js'), require('crypto-js/enc-hex'), require('moment')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'spacetrim', 'waitasecond', 'crypto', 'lorem-ipsum', 'path', 'crypto-js', 'crypto-js/enc-hex', 'moment'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-fake-llm"] = {}, global.spaceTrim$1, global.waitasecond, global.crypto, global.loremIpsum, null, null, null, global.moment));
5
+ })(this, (function (exports, spaceTrim$1, waitasecond, crypto, loremIpsum, path, cryptoJs, hexEncoder, moment) { '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
+ var moment__default = /*#__PURE__*/_interopDefaultLegacy(moment);
10
11
 
11
12
  // ⚠️ WARNING: This code has been generated so that any manual changes will be overwritten
12
13
  /**
@@ -22,7 +23,7 @@
22
23
  * @generated
23
24
  * @see https://github.com/webgptorg/promptbook
24
25
  */
25
- const PROMPTBOOK_ENGINE_VERSION = '0.105.0-14';
26
+ const PROMPTBOOK_ENGINE_VERSION = '0.105.0-15';
26
27
  /**
27
28
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
28
29
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -6371,6 +6372,25 @@
6371
6372
  }
6372
6373
  }
6373
6374
 
6375
+ /**
6376
+ * @@@
6377
+ *
6378
+ * @private utility for commitments
6379
+ */
6380
+ function formatOptionalInstructionBlock(label, content) {
6381
+ const trimmedContent = spaceTrim$1.spaceTrim(content);
6382
+ if (!trimmedContent) {
6383
+ return '';
6384
+ }
6385
+ return spaceTrim$1.spaceTrim((block) => `
6386
+ - ${label}:
6387
+ ${block(trimmedContent
6388
+ .split('\n')
6389
+ .map((line) => `- ${line}`)
6390
+ .join('\n'))}
6391
+ `);
6392
+ }
6393
+
6374
6394
  /**
6375
6395
  * USE SEARCH ENGINE commitment definition
6376
6396
  *
@@ -6392,6 +6412,9 @@
6392
6412
  constructor() {
6393
6413
  super('USE SEARCH ENGINE', ['USE SEARCH']);
6394
6414
  }
6415
+ get requiresContent() {
6416
+ return false;
6417
+ }
6395
6418
  /**
6396
6419
  * Short one-line description of USE SEARCH ENGINE.
6397
6420
  */
@@ -6440,6 +6463,7 @@
6440
6463
  `);
6441
6464
  }
6442
6465
  applyToAgentModelRequirements(requirements, content) {
6466
+ const extraInstructions = formatOptionalInstructionBlock('Search instructions', content);
6443
6467
  // Get existing tools array or create new one
6444
6468
  const existingTools = requirements.tools || [];
6445
6469
  // Add 'web_search' to tools if not already present
@@ -6498,13 +6522,14 @@
6498
6522
  ...requirements.metadata,
6499
6523
  useSearchEngine: content || true,
6500
6524
  },
6501
- }, spaceTrim$1.spaceTrim(`
6502
- Tools:
6503
- You have access to the web search engine via the tool "web_search".
6504
- Use it to find up-to-date information or facts that you don't know.
6505
- When you need to know some information from the internet, use the tool provided to you.
6506
- Do not make up information when you can search for it.
6507
- Do not tell the user you cannot search for information, YOU CAN.
6525
+ }, spaceTrim$1.spaceTrim((block) => `
6526
+ Tool:
6527
+ - You have access to the web search engine via the tool "web_search".
6528
+ - Use it to find up-to-date information or facts that you don't know.
6529
+ - When you need to know some information from the internet, use the tool provided to you.
6530
+ - Do not make up information when you can search for it.
6531
+ - Do not tell the user you cannot search for information, YOU CAN.
6532
+ ${block(extraInstructions)}
6508
6533
  `));
6509
6534
  }
6510
6535
  /**
@@ -6556,6 +6581,7 @@
6556
6581
  *
6557
6582
  * ```book
6558
6583
  * USE TIME
6584
+ * USE TIME Prefer the user's local timezone.
6559
6585
  * ```
6560
6586
  *
6561
6587
  * @private [🪔] Maybe export the commitments through some package
@@ -6564,6 +6590,9 @@
6564
6590
  constructor() {
6565
6591
  super('USE TIME', ['CURRENT TIME', 'TIME', 'DATE']);
6566
6592
  }
6593
+ get requiresContent() {
6594
+ return false;
6595
+ }
6567
6596
  /**
6568
6597
  * Short one-line description of USE TIME.
6569
6598
  */
@@ -6590,6 +6619,7 @@
6590
6619
  - This tool won't receive any input.
6591
6620
  - It outputs the current date and time as an ISO 8601 string.
6592
6621
  - Allows the agent to answer questions about the current time or date.
6622
+ - The content following \`USE TIME\` is an arbitrary text that the agent should know (e.g. timezone preference).
6593
6623
 
6594
6624
  ## Examples
6595
6625
 
@@ -6599,9 +6629,17 @@
6599
6629
  PERSONA You are a helpful assistant who knows the current time.
6600
6630
  USE TIME
6601
6631
  \`\`\`
6632
+
6633
+ \`\`\`book
6634
+ Travel Assistant
6635
+
6636
+ PERSONA You help travelers with planning.
6637
+ USE TIME Prefer the user's local timezone.
6638
+ \`\`\`
6602
6639
  `);
6603
6640
  }
6604
6641
  applyToAgentModelRequirements(requirements, content) {
6642
+ const extraInstructions = formatOptionalInstructionBlock('Time instructions', content);
6605
6643
  // Get existing tools array or create new one
6606
6644
  const existingTools = requirements.tools || [];
6607
6645
  // Add 'get_current_time' to tools if not already present
@@ -6632,13 +6670,12 @@
6632
6670
  metadata: {
6633
6671
  ...requirements.metadata,
6634
6672
  },
6635
- }, spaceTrim$1.spaceTrim(`
6636
- Tool:
6637
- You have access to the current date and time via the tool "get_current_time".
6638
- Use it to answer questions about the current date and time.
6639
- When you need to know the current date or time, use the tool provided to you.
6640
- Do not make up the current date or time; always use the tool to get accurate information.
6641
- `));
6673
+ }, spaceTrim$1.spaceTrim((block) => `
6674
+ Time and date context:
6675
+ - It is ${moment__default["default"]().format('MMMM YYYY')} now.
6676
+ - If you need more precise current time information, use the tool "get_current_time".
6677
+ ${block(extraInstructions)}
6678
+ `));
6642
6679
  }
6643
6680
  /**
6644
6681
  * Gets human-readable titles for tool functions provided by this commitment.