@promptbook/browser 0.105.0-3 → 0.105.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/umd/index.umd.js CHANGED
@@ -23,7 +23,7 @@
23
23
  * @generated
24
24
  * @see https://github.com/webgptorg/promptbook
25
25
  */
26
- const PROMPTBOOK_ENGINE_VERSION = '0.105.0-3';
26
+ const PROMPTBOOK_ENGINE_VERSION = '0.105.0-4';
27
27
  /**
28
28
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
29
29
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -6152,7 +6152,12 @@
6152
6152
  description: 'Get the current date and time in ISO 8601 format.',
6153
6153
  parameters: {
6154
6154
  type: 'object',
6155
- properties: {},
6155
+ properties: {
6156
+ timezone: {
6157
+ type: 'string',
6158
+ description: 'Optional timezone name (e.g. "Europe/Prague", "UTC", "America/New_York").',
6159
+ },
6160
+ },
6156
6161
  required: [],
6157
6162
  },
6158
6163
  },
@@ -6172,9 +6177,36 @@
6172
6177
  */
6173
6178
  getToolFunctions() {
6174
6179
  return {
6175
- async get_current_time() {
6176
- console.log('!!!! [Tool] get_current_time called');
6177
- return new Date().toISOString();
6180
+ async get_current_time(args) {
6181
+ var _a;
6182
+ console.log('!!!! [Tool] get_current_time called', { args });
6183
+ const { timezone } = args;
6184
+ if (!timezone) {
6185
+ return new Date().toISOString();
6186
+ }
6187
+ try {
6188
+ // Note: Returning ISO 8601 string but in the requested timezone
6189
+ const formatter = new Intl.DateTimeFormat('en-CA', {
6190
+ timeZone: timezone,
6191
+ year: 'numeric',
6192
+ month: '2-digit',
6193
+ day: '2-digit',
6194
+ hour: '2-digit',
6195
+ minute: '2-digit',
6196
+ second: '2-digit',
6197
+ hour12: false,
6198
+ timeZoneName: 'shortOffset',
6199
+ });
6200
+ const parts = formatter.formatToParts(new Date());
6201
+ const part = (type) => { var _a; return (_a = parts.find((p) => p.type === type)) === null || _a === void 0 ? void 0 : _a.value; };
6202
+ // en-CA format is YYYY-MM-DD
6203
+ const isoString = `${part('year')}-${part('month')}-${part('day')}T${part('hour')}:${part('minute')}:${part('second')}${(_a = part('timeZoneName')) === null || _a === void 0 ? void 0 : _a.replace('GMT', '')}`;
6204
+ return isoString;
6205
+ }
6206
+ catch (error) {
6207
+ // Fallback to UTC if timezone is invalid
6208
+ return new Date().toISOString();
6209
+ }
6178
6210
  },
6179
6211
  };
6180
6212
  }