@xbbg/langgraph 1.2.6

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/dist/index.js ADDED
@@ -0,0 +1,2543 @@
1
+ 'use strict';
2
+
3
+ var tools = require('@langchain/core/tools');
4
+ var z2 = require('zod');
5
+
6
+ function _interopNamespace(e) {
7
+ if (e && e.__esModule) return e;
8
+ var n = Object.create(null);
9
+ if (e) {
10
+ Object.keys(e).forEach(function (k) {
11
+ if (k !== 'default') {
12
+ var d = Object.getOwnPropertyDescriptor(e, k);
13
+ Object.defineProperty(n, k, d.get ? d : {
14
+ enumerable: true,
15
+ get: function () { return e[k]; }
16
+ });
17
+ }
18
+ });
19
+ }
20
+ n.default = e;
21
+ return Object.freeze(n);
22
+ }
23
+
24
+ var z2__namespace = /*#__PURE__*/_interopNamespace(z2);
25
+
26
+ // src/options.ts
27
+ var BLOOMBERG_TOOL_NAMES = [
28
+ "xbbg_bdp",
29
+ "xbbg_bdh",
30
+ "xbbg_bds",
31
+ "xbbg_bdib",
32
+ "xbbg_bdtick",
33
+ "xbbg_bql",
34
+ "xbbg_bsrch",
35
+ "xbbg_bqr",
36
+ "xbbg_bflds",
37
+ "xbbg_beqs",
38
+ "xbbg_yas",
39
+ "xbbg_preferreds",
40
+ "xbbg_corporate_bonds",
41
+ "xbbg_index_members",
42
+ "xbbg_resolve_isins",
43
+ "xbbg_issuer_isins",
44
+ "xbbg_etf_holdings",
45
+ "xbbg_stream_snapshot",
46
+ "xbbg_mktbar_snapshot",
47
+ "xbbg_depth_snapshot",
48
+ "xbbg_ext_ticker",
49
+ "xbbg_ext_futures",
50
+ "xbbg_ext_cdx",
51
+ "xbbg_ext_currency",
52
+ "xbbg_ext_bql_builder",
53
+ "xbbg_ext_market_session",
54
+ "xbbg_ext_yas_overrides",
55
+ "xbbg_ext_constants",
56
+ "xbbg_ext_columns",
57
+ "xbbg_ext_calculate"
58
+ ];
59
+ var DEFAULT_MAX_SECURITIES = 25;
60
+ var DEFAULT_MAX_FIELDS = 25;
61
+ var DEFAULT_MAX_ROWS = 500;
62
+ var DEFAULT_MAX_STRING_CHARS = 2e3;
63
+ var DEFAULT_MAX_BQL_QUERY_CHARS = 4e3;
64
+ var DEFAULT_MAX_SEARCH_SPEC_CHARS = 1e3;
65
+ var DEFAULT_MAX_STREAM_UPDATES = 10;
66
+ var DEFAULT_MAX_STREAM_WAIT_MS = 15e3;
67
+ function positiveInteger(value, fallback, name) {
68
+ if (value === void 0) {
69
+ return fallback;
70
+ }
71
+ if (!Number.isInteger(value) || value <= 0) {
72
+ throw new RangeError(`${name} must be a positive integer; got ${String(value)}`);
73
+ }
74
+ return value;
75
+ }
76
+ function disabledToolSet(tools) {
77
+ return new Set(tools ?? []);
78
+ }
79
+ function normalizeBloombergToolsOptions(options = {}) {
80
+ return {
81
+ core: options.core,
82
+ disabledTools: disabledToolSet(options.disabledTools),
83
+ engine: options.engine,
84
+ engineConfig: options.engineConfig,
85
+ maxBqlQueryChars: positiveInteger(
86
+ options.maxBqlQueryChars,
87
+ DEFAULT_MAX_BQL_QUERY_CHARS,
88
+ "maxBqlQueryChars"
89
+ ),
90
+ maxFields: positiveInteger(options.maxFields, DEFAULT_MAX_FIELDS, "maxFields"),
91
+ maxRows: positiveInteger(options.maxRows, DEFAULT_MAX_ROWS, "maxRows"),
92
+ maxSearchSpecChars: positiveInteger(
93
+ options.maxSearchSpecChars,
94
+ DEFAULT_MAX_SEARCH_SPEC_CHARS,
95
+ "maxSearchSpecChars"
96
+ ),
97
+ maxStreamUpdates: positiveInteger(
98
+ options.maxStreamUpdates,
99
+ DEFAULT_MAX_STREAM_UPDATES,
100
+ "maxStreamUpdates"
101
+ ),
102
+ maxStreamWaitMs: positiveInteger(
103
+ options.maxStreamWaitMs,
104
+ DEFAULT_MAX_STREAM_WAIT_MS,
105
+ "maxStreamWaitMs"
106
+ ),
107
+ maxSecurities: positiveInteger(options.maxSecurities, DEFAULT_MAX_SECURITIES, "maxSecurities"),
108
+ maxStringChars: positiveInteger(
109
+ options.maxStringChars,
110
+ DEFAULT_MAX_STRING_CHARS,
111
+ "maxStringChars"
112
+ ),
113
+ validateFields: options.validateFields
114
+ };
115
+ }
116
+ function isToolDisabled(options, name) {
117
+ return options.disabledTools.has(name);
118
+ }
119
+
120
+ // src/core-loader.ts
121
+ async function importCore() {
122
+ return await import('@xbbg/core');
123
+ }
124
+ function createCoreResolver(options = {}) {
125
+ const normalized = normalizeBloombergToolsOptions(options);
126
+ let corePromise;
127
+ let enginePromise;
128
+ async function getCore() {
129
+ if (normalized.core !== void 0) {
130
+ return normalized.core;
131
+ }
132
+ corePromise ??= importCore();
133
+ return await corePromise;
134
+ }
135
+ async function getEngine() {
136
+ if (normalized.engine !== void 0) {
137
+ return normalized.engine;
138
+ }
139
+ enginePromise ??= (async () => {
140
+ const core = await getCore();
141
+ return await core.connect(normalized.engineConfig);
142
+ })();
143
+ return await enginePromise;
144
+ }
145
+ return {
146
+ getCore,
147
+ getEngine,
148
+ options: normalized
149
+ };
150
+ }
151
+
152
+ // src/cdx-fields.ts
153
+ var CDX_INFO_FIELDS = Object.freeze([
154
+ "ROLLING_SERIES",
155
+ "VERSION",
156
+ "ON_THE_RUN_CURRENT_BD_INDICATOR",
157
+ "CDS_FIRST_ACCRUAL_START_DATE",
158
+ "NAME",
159
+ "NUM_CURRENT_COMPANIES_CCY_TKR",
160
+ "NUM_ORIG_COMPANIES_CRNCY_TKR",
161
+ "PX_LAST"
162
+ ]);
163
+ var CDX_PRICING_FIELDS = Object.freeze([
164
+ "PX_LAST",
165
+ "PX_BID",
166
+ "PX_ASK",
167
+ "UPFRONT_LAST",
168
+ "UPFRONT_BID",
169
+ "UPFRONT_ASK",
170
+ "CDS_FLAT_SPREAD",
171
+ "UPFRONT_FEE",
172
+ "PV_CDS_PREMIUM_LEG",
173
+ "PV_CDS_DEFAULT_LEG"
174
+ ]);
175
+ var CDX_RISK_FIELDS = Object.freeze([
176
+ "SW_CNV_BPV",
177
+ "SW_EQV_BPV",
178
+ "CDS_SPREAD_MID_MODIFIED_DURATION",
179
+ "CDS_SPREAD_MID_CONVEXITY",
180
+ "RECOVERY_RATE_SEN",
181
+ "CDS_RECOVERY_RT"
182
+ ]);
183
+
184
+ // src/descriptions.ts
185
+ var REQUIRED_TOOL_INSTRUCTIONS = [
186
+ "# Bloomberg tool usage",
187
+ "- Use these tools only for server-side Bloomberg data access through @xbbg/core. Never imply Bloomberg data was retrieved unless a tool call actually returned it.",
188
+ "- Ask a clarifying question before calling a tool when any security identity, field mnemonic, date range, currency, periodicity, intraday interval, timezone, override, or universe is ambiguous.",
189
+ "- Do not invent Bloomberg tickers, field mnemonics, overrides, or BQL functions. If the user gives a field description rather than a confident mnemonic, call xbbg_bflds first.",
190
+ "",
191
+ "## Security identifiers",
192
+ "- Prefer fully qualified Bloomberg securities such as AAPL US Equity, SPX Index, or CDX IG CDSI GEN 5Y Corp when the user provides them.",
193
+ "- For raw security identifiers, request or pass Bloomberg identifier syntax directly: /isin/{isin} for ISINs, for example /isin/US0378331005; /cusip/{cusip} for CUSIPs, for example /cusip/037833100.",
194
+ "- Do not pass raw ISIN or CUSIP strings when the request is meant to identify a security. Do not use xbbg_bsrch as a replacement for a known ticker, ISIN, or CUSIP.",
195
+ "- For dealer quote / BQR workflows, use xbbg_bqr with a fixed-income identifier plus a dealer quote source such as /isin/US037833FB15@MSG1 Corp. For raw intraday ticks, use xbbg_bdtick.",
196
+ "",
197
+ "## Core request tools",
198
+ "- xbbg_bdp: current or reference point-in-time fields, e.g. PX_LAST, NAME, CUR_MKT_CAP. Use a small explicit securities list and a small explicit fields list. Use includeSecurityErrors only when the caller wants Bloomberg security errors in the response.",
199
+ "- xbbg_bdh: historical daily or periodic time series. Always provide explicit start and end dates in YYYY-MM-DD or YYYYMMDD form. Ask before choosing periodicity, currency, fill behavior, adjustment overrides, or a wide output table.",
200
+ "- xbbg_bds: Bloomberg bulk/table fields such as index members. Provide exactly one bulk field; do not use bds for ordinary multi-field reference data.",
201
+ "- xbbg_bdib: intraday bars only. Provide one ticker, explicit ISO start/end datetimes, a positive interval in minutes, and timezone context when datetimes are naive. TRADE is the usual event type unless the user asks otherwise.",
202
+ "- xbbg_bdtick: intraday tick data. Provide one ticker, explicit ISO start/end datetimes, and explicit eventTypes when not asking for TRADE ticks. Use includeBrokerCodes or includeConditionCodes only when those columns are needed.",
203
+ "- xbbg_bql: BQL expressions only when the user asks for BQL or the request is naturally expressed as a bounded BQL query. Keep queries short, explicit, and scoped to the requested universe.",
204
+ "- xbbg_bsrch: Bloomberg search-grid or saved-search workflows only, such as ExcelGetGrid-style searches. Do not use it for ordinary security lookup.",
205
+ "- xbbg_bqr: Bloomberg Quote Request / dealer quotes. Prefer fixed-income ISIN inputs with a dealer quote source such as /isin/US037833FB15@MSG1 Corp, explicit start/end datetimes, and BID/ASK event types. includeBrokerCodes defaults to true.",
206
+ "- xbbg_bflds: Bloomberg field metadata/search. Provide exactly one of fields or searchSpec; use searchSpec for natural-language field names and fields for known mnemonics.",
207
+ "- xbbg_beqs: Bloomberg equity screening by named BEQS screen. Prefer this over hand-written BQL when the user names an existing Bloomberg screen.",
208
+ "- xbbg_yas: fixed-income YAS recipe fields such as YAS_BOND_YLD, YAS_MOD_DUR, YAS_ZSPREAD, or YAS_BOND_PX. Prefer this over manual YAS_BOND_* BDP requests when the user asks for YAS yield, duration, spread, or price analytics.",
209
+ "- xbbg_preferreds: preferred stock discovery from an equity ticker. Prefer this over xbbg_ext_bql_builder plus xbbg_bql when the user wants the actual preferreds result.",
210
+ "- xbbg_corporate_bonds: bounded corporate bond universe query for a company ticker. Prefer this over generic BQL for company debt discovery.",
211
+ "- xbbg_index_members: index constituents through the core index recipe. Prefer this over generic BDS/BQL members when the user asks for constituents.",
212
+ "- xbbg_resolve_isins: resolves supplied ISIN strings to Bloomberg securities. Pass raw ISIN strings only for this recipe; otherwise use /isin/{isin} syntax with data tools.",
213
+ "- xbbg_issuer_isins: issuer/bond ISIN workflow for supplied bond ISIN strings.",
214
+ "- xbbg_etf_holdings: ETF holdings recipe for a single ETF ticker. Prefer this over generic BQL holdings when the user asks for ETF constituents.",
215
+ "- xbbg_stream_snapshot: bounded live market-data observation from //blp/mktdata. Requires explicit maxUpdates and always terminates/unsubscribes.",
216
+ "- xbbg_mktbar_snapshot: bounded live market-bar observation from //blp/mktbar for one ticker. Requires explicit maxUpdates and always terminates/unsubscribes.",
217
+ "- xbbg_depth_snapshot: bounded market-depth observation from //blp/mktdepthdata for one ticker. Requires explicit maxUpdates and always terminates/unsubscribes.",
218
+ "",
219
+ "## BQL guidance",
220
+ "- BQL is a complete Bloomberg Query Language expression sent as one query string; the tool does not assemble get/for/with clauses for you.",
221
+ "- Basic shape: get(field1, field2) for(universe). Examples: get(px_last) for('AAPL US Equity') and get(px_last, volume) for(['IBM US Equity', 'AAPL US Equity']).",
222
+ "- Use BQL for universe-oriented analytics and screens such as holdings('SPY US Equity'), members('SPX Index'), debt universes, filters with with(...), and date ranges such as with(dates=range(-5d, 0d)).",
223
+ "- Prefer xbbg_ext_bql_builder instead of hand-writing BQL for supported workflows: preferred stocks, corporate bonds, and ETF holdings.",
224
+ "- Do not use BQL just because the user asks for normal reference data; xbbg_bdp is simpler for current fields and xbbg_bdh is simpler for historical time series.",
225
+ "",
226
+ "## Output handling",
227
+ "- Tool results use LangChain content_and_artifact output: content is a compact summary, artifact is a bounded envelope with tool, rowCount, truncated, and data. Inspect the artifact before summarizing.",
228
+ "- If a response is empty, truncated, or contains Bloomberg/security errors, say that directly. Do not fill gaps from memory or assumptions."
229
+ ];
230
+ var OPTIONAL_EXTENSION_INSTRUCTIONS = [
231
+ "",
232
+ "## Extension helper tools",
233
+ "- xbbg_ext_ticker: ticker hygiene before live calls. parse_ticker splits a Bloomberg ticker, normalize_tickers trims/canonicalizes lists, filter_equity_tickers keeps equity-like tickers, is_specific_contract checks futures specificity, and validate_generic_ticker rejects malformed generic futures tickers.",
234
+ "- xbbg_ext_futures: futures contract construction and selection. Use build_futures_ticker for root/month/year/asset assembly, get_futures_months for month-code lookup, generate_candidates for generic-to-specific candidates, contract_index for generic contract rank, filter_candidates_by_cycle for HMUZ/quarterly cycles, and filter_valid_contracts to keep contracts valid for a date.",
235
+ "- xbbg_ext_cdx: CDX ticker workflow support. Use parse_cdx_ticker to understand a CDX ticker, previous_cdx_series to roll back a series, cdx_gen_to_specific to resolve a generic CDX to a target series, and cdx_info/cdx_pricing/cdx_risk for predefined BDP field bundles. cdx_pricing and cdx_risk accept recoveryRate, which becomes the CDS_RR override.",
236
+ "- xbbg_ext_currency: currency-planning helpers. build_fx_pair constructs the Bloomberg FX pair and conversion factor, same_currency avoids unnecessary conversion, and currencies_needing_conversion identifies which currencies differ from a target before requesting converted values.",
237
+ "- xbbg_ext_bql_builder: safe BQL generators for common xbbg workflows. Use build_preferreds_query for preferred-stock discovery from an equity, build_corporate_bonds_query for company bond universes with optional currency/active filters, and build_etf_holdings_query for ETF constituents. Prefer these builders over hand-writing those BQL shapes.",
238
+ "- xbbg_ext_market_session: exchange calendar/timezone support. derive_sessions turns day session times into session blocks, infer_timezone maps country codes to timezones, session_times_to_utc converts local sessions to UTC, get_market_rule gets MIC/exchange rules, default_turnover_dates and default_bqr_datetimes provide bounded defaults, and get/list_exchange_override inspect configured exchange metadata.",
239
+ "- xbbg_ext_yas_overrides: builds flat YAS override maps for fixed-income BDP requests when the lower-level BDP workflow is required. Prefer xbbg_yas for actual YAS recipe fields.",
240
+ "- xbbg_ext_constants: static lookup/format helpers for date parsing/formatting, futures month code/name mappings, dividend type mappings, and known dividend/ETF output columns.",
241
+ "- xbbg_ext_columns: post-processing helpers for Bloomberg-shaped tables. Use rename_dividend_columns, rename_etf_columns, or build_earning_header_rename when explaining or normalizing response column names after a request.",
242
+ "- xbbg_ext_calculate: small numeric helper for Bloomberg workflows. calculate_level_percentages pairs observed values with levels; values and levels must have the same length."
243
+ ];
244
+ var OPTIONAL_LIMIT_INSTRUCTIONS = [
245
+ "",
246
+ "## Request limits and inputs",
247
+ "- Keep Bloomberg requests bounded: explicit securities, explicit fields, explicit dates, limited rows, and no broad exploratory pulls unless the user narrows the universe.",
248
+ "- Respect configured tool limits for securities, fields, rows, string size, BQL length, and search spec length. Ask the user to narrow the request rather than exceeding them.",
249
+ "- Use flat primitive overrides and kwargs only: string, number, or boolean values. Do not send nested objects, arrays, or inferred defaults as overrides."
250
+ ];
251
+ var BLOOMBERG_TOOL_INSTRUCTIONS = [
252
+ ...REQUIRED_TOOL_INSTRUCTIONS,
253
+ ...OPTIONAL_EXTENSION_INSTRUCTIONS,
254
+ ...OPTIONAL_LIMIT_INSTRUCTIONS
255
+ ].join("\n");
256
+ function getBloombergToolInstructions(options = {}) {
257
+ const includeExtensionGuidance = options.includeExtensionGuidance ?? true;
258
+ const includeLimitReminder = options.includeLimitReminder ?? true;
259
+ const lines = [...REQUIRED_TOOL_INSTRUCTIONS];
260
+ if (includeExtensionGuidance) {
261
+ lines.push(...OPTIONAL_EXTENSION_INSTRUCTIONS);
262
+ }
263
+ if (includeLimitReminder) {
264
+ lines.push(...OPTIONAL_LIMIT_INSTRUCTIONS);
265
+ }
266
+ return lines.join("\n");
267
+ }
268
+ var BDP_DESCRIPTION = 'Bloomberg reference data for current or point-in-time fields such as PX_LAST, NAME, or CUR_MKT_CAP. Use for a small bounded list of fully qualified securities. Use /isin/{isin} for ISINs and /cusip/{cusip} for CUSIPs. Example: securities ["AAPL US Equity"], fields ["PX_LAST"].';
269
+ var BDH_DESCRIPTION = 'Bloomberg historical time series. Requires explicit start and end dates; ask before using if the date range or periodicity is ambiguous. Use /isin/{isin} for ISINs and /cusip/{cusip} for CUSIPs. Example: securities ["AAPL US Equity"], fields ["PX_LAST"], start "2024-01-01", end "2024-01-31".';
270
+ var BDS_DESCRIPTION = 'Bloomberg bulk/table reference data such as index members. Requires exactly one bulk field, not a field list. Use /isin/{isin} for ISINs and /cusip/{cusip} for CUSIPs. Example: securities ["SPX Index"], field "INDX_MEMBERS".';
271
+ var BDIB_DESCRIPTION = 'Bloomberg intraday bars. Requires one ticker plus explicit ISO start/end datetimes and a positive interval in minutes. Use /isin/{isin} for ISINs and /cusip/{cusip} for CUSIPs. Example: ticker "AAPL US Equity", start "2024-01-31T09:30:00-05:00", end "2024-01-31T16:00:00-05:00", interval 5.';
272
+ var BDTICK_DESCRIPTION = 'Bloomberg intraday tick data. Requires one ticker plus explicit ISO start/end datetimes. Defaults eventTypes to ["TRADE"]; use ["BID", "ASK"] for quote ticks and includeBrokerCodes/includeConditionCodes only when needed.';
273
+ var BQL_DESCRIPTION = "Bloomberg Query Language expression sent as one complete query string. Use for bounded universe analytics such as get(px_last) for('AAPL US Equity'), get(px_last, volume) for(['IBM US Equity', 'AAPL US Equity']), holdings('SPY US Equity'), members('SPX Index'), filters with with(...), or dates=range(...). Prefer xbbg_bdp/xbbg_bdh for simple reference or historical requests.";
274
+ var BSRCH_DESCRIPTION = 'Bloomberg search/grid request. Use for saved-search or ExcelGetGrid-style Bloomberg searches, not ordinary security lookup. Example searchSpec "COMDTY:NG".';
275
+ var BQR_DESCRIPTION = 'Bloomberg Quote Request / dealer quotes. Use for fixed-income dealer quote ticks, preferably with an ISIN plus dealer source such as "/isin/US037833FB15@MSG1 Corp"; requires explicit ISO start/end datetimes. Defaults eventTypes to ["BID", "ASK"] and includeBrokerCodes to true.';
276
+ var BFLDS_DESCRIPTION = 'Bloomberg field metadata and field search. Use first when a field mnemonic is uncertain. Provide exactly one of fields or searchSpec. Example: fields ["PX_LAST"] or searchSpec "last price".';
277
+ var BEQS_DESCRIPTION = "Bloomberg equity screening by named BEQS screen. Use when the user names an existing Bloomberg screen and wants its bounded result set. Prefer this over hand-written BQL for saved Bloomberg screens.";
278
+ var YAS_DESCRIPTION = "Bloomberg fixed-income YAS recipe fields for one or more bonds. Use for YAS yield, duration, spread, benchmark, or price analytics; provide explicit fields and optional settlement/yield/price inputs.";
279
+ var PREFERREDS_DESCRIPTION = "Preferred stock discovery for one equity ticker. Use when the user asks for preferred shares or preferred stock securities related to an issuer.";
280
+ var CORPORATE_BONDS_DESCRIPTION = "Corporate bond universe query for one issuer/company ticker, with optional currency, active-only filter, and result fields. Prefer this over generic BQL for company debt discovery.";
281
+ var INDEX_MEMBERS_DESCRIPTION = "Index constituent recipe for one Bloomberg index. Use for bounded member lists and optional historical/as-of constituent membership.";
282
+ var RESOLVE_ISINS_DESCRIPTION = "Resolve raw ISIN strings to Bloomberg securities through the core ISIN recipe. Do not add /isin/ prefixes in this tool; pass the exact ISIN strings supplied by the user.";
283
+ var ISSUER_ISINS_DESCRIPTION = "Issuer/bond ISIN workflow for supplied bond ISIN strings. Use for issuer-level ISIN discovery starting from known bond ISINs.";
284
+ var ETF_HOLDINGS_DESCRIPTION = "ETF holdings recipe for one ETF ticker. Use when the user asks for ETF constituents or holdings and wants the bounded holdings result.";
285
+ var STREAM_SNAPSHOT_DESCRIPTION = "Bounded live market-data snapshot from //blp/mktdata. Collects at most maxUpdates updates until timeout/done, then always unsubscribes; use for finite observations, not open subscriptions.";
286
+ var MKTBAR_SNAPSHOT_DESCRIPTION = "Bounded live market-bar snapshot from //blp/mktbar for one ticker. Collects at most maxUpdates updates until timeout/done, then always unsubscribes.";
287
+ var DEPTH_SNAPSHOT_DESCRIPTION = "Bounded live market-depth snapshot from //blp/mktdepthdata for one ticker. Collects at most maxUpdates updates until timeout/done, then always unsubscribes.";
288
+ var EXT_TICKER_DESCRIPTION = "Ticker hygiene helpers: parse_ticker, normalize_tickers, filter_equity_tickers, is_specific_contract, and validate_generic_ticker.";
289
+ var EXT_FUTURES_DESCRIPTION = "Futures helpers for contract construction and selection: build_futures_ticker, generate_candidates, contract_index, filter_candidates_by_cycle, filter_valid_contracts, and get_futures_months.";
290
+ var EXT_CDX_DESCRIPTION = "CDX helpers for parsing, series rolling/resolution, and predefined info/pricing/risk BDP field bundles.";
291
+ var EXT_CURRENCY_DESCRIPTION = "Currency planning helpers: build FX pairs, test same-currency requests, and find currencies needing conversion.";
292
+ var EXT_BQL_BUILDER_DESCRIPTION = "BQL builders for preferred stocks, corporate bonds, and ETF holdings. Prefer to construct those bounded BQL shapes before xbbg_bql.";
293
+ var EXT_MARKET_SESSION_DESCRIPTION = "Market session and timezone helpers for deriving sessions, UTC windows, market rules, exchange metadata, turnover defaults, and BQR datetime defaults.";
294
+ var EXT_YAS_OVERRIDES_DESCRIPTION = "Build flat Bloomberg YAS override maps for fixed income fields such as YAS_BOND_YLD, YAS_MOD_DUR, YAS_ZSPREAD, or YAS_BOND_PX.";
295
+ var EXT_CONSTANTS_DESCRIPTION = "Static Bloomberg helper constants for date parsing/formatting, futures months, dividend types, and ETF/dividend columns.";
296
+ var EXT_COLUMNS_DESCRIPTION = "Column rename helpers for dividend, ETF, and earnings-shaped Bloomberg responses.";
297
+ var EXT_CALCULATE_DESCRIPTION = "Small numeric helper operations for Bloomberg workflows, including level percentage calculations.";
298
+
299
+ // src/result-limits.ts
300
+ var MAX_RESULT_DEPTH = 32;
301
+ function isPlainObject(value) {
302
+ const prototype = Object.getPrototypeOf(value);
303
+ return prototype === Object.prototype || prototype === null;
304
+ }
305
+ function truncateString(value, maxStringChars, state) {
306
+ if (value.length <= maxStringChars) {
307
+ return value;
308
+ }
309
+ state.truncated = true;
310
+ return `${value.slice(0, maxStringChars)}\u2026[truncated ${value.length - maxStringChars} chars]`;
311
+ }
312
+ function limitValue(value, maxRows, maxStringChars, state, depth = 0, seen = /* @__PURE__ */ new WeakSet()) {
313
+ if (typeof value === "string") {
314
+ return truncateString(value, maxStringChars, state);
315
+ }
316
+ if (value instanceof Date) {
317
+ return value.toISOString();
318
+ }
319
+ if (depth > MAX_RESULT_DEPTH) {
320
+ state.truncated = true;
321
+ return "[Max result depth exceeded]";
322
+ }
323
+ if (Array.isArray(value)) {
324
+ if (seen.has(value)) {
325
+ state.truncated = true;
326
+ return "[Circular]";
327
+ }
328
+ seen.add(value);
329
+ const capped = value.length > maxRows ? value.slice(0, maxRows) : value;
330
+ if (capped.length !== value.length) {
331
+ state.truncated = true;
332
+ }
333
+ return capped.map((item) => limitValue(item, maxRows, maxStringChars, state, depth + 1, seen));
334
+ }
335
+ if (typeof value === "object" && value !== null) {
336
+ if (seen.has(value)) {
337
+ state.truncated = true;
338
+ return "[Circular]";
339
+ }
340
+ if (!isPlainObject(value)) {
341
+ return value;
342
+ }
343
+ seen.add(value);
344
+ const output = {};
345
+ for (const [key, entry] of Object.entries(value)) {
346
+ output[key] = limitValue(entry, maxRows, maxStringChars, state, depth + 1, seen);
347
+ }
348
+ return output;
349
+ }
350
+ return value;
351
+ }
352
+ function rowCountOf(value) {
353
+ if (Array.isArray(value)) {
354
+ return value.length;
355
+ }
356
+ if (typeof value !== "object" || value === null) {
357
+ return null;
358
+ }
359
+ const record2 = value;
360
+ const rowCount = record2.rowCount;
361
+ if (typeof rowCount === "number" && Number.isInteger(rowCount) && rowCount >= 0) {
362
+ return rowCount;
363
+ }
364
+ const updateCount = record2.updateCount;
365
+ if (typeof updateCount === "number" && Number.isInteger(updateCount) && updateCount >= 0) {
366
+ return updateCount;
367
+ }
368
+ return null;
369
+ }
370
+ function hasErrorShape(value) {
371
+ if (typeof value !== "object" || value === null) {
372
+ return false;
373
+ }
374
+ const record2 = value;
375
+ return record2.error !== void 0 || record2.errors !== void 0 || record2.securityError !== void 0;
376
+ }
377
+ function limitResult(value, maxRows, maxStringChars) {
378
+ const state = { truncated: false };
379
+ const rowCount = rowCountOf(value);
380
+ const limitedValue = limitValue(value, maxRows, maxStringChars, state);
381
+ return {
382
+ rowCount,
383
+ truncated: state.truncated,
384
+ value: limitedValue
385
+ };
386
+ }
387
+ function summarizeEnvelope(envelope) {
388
+ const rowText = envelope.rowCount === null ? "row count unknown" : `${envelope.rowCount} row${envelope.rowCount === 1 ? "" : "s"}`;
389
+ const notes = [];
390
+ if (envelope.rowCount === 0) {
391
+ notes.push("empty result");
392
+ }
393
+ if (envelope.truncated) {
394
+ notes.push("artifact truncated to configured limits");
395
+ }
396
+ if (hasErrorShape(envelope.data)) {
397
+ notes.push("inspect artifact for Bloomberg error details");
398
+ }
399
+ const noteText = notes.length === 0 ? "" : `; ${notes.join("; ")}`;
400
+ return `${envelope.tool}: ${rowText}; truncated=${String(envelope.truncated)}${noteText}`;
401
+ }
402
+ function createToolResult(tool3, value, maxRows, maxStringChars) {
403
+ const limited = limitResult(value, maxRows, maxStringChars);
404
+ const envelope = {
405
+ tool: tool3,
406
+ rowCount: limited.rowCount,
407
+ truncated: limited.truncated,
408
+ data: limited.value
409
+ };
410
+ return [summarizeEnvelope(envelope), envelope];
411
+ }
412
+ function throwWithToolContext(tool3, error) {
413
+ const prefix = `${tool3} failed`;
414
+ if (error instanceof Error) {
415
+ if (!error.message.startsWith(prefix)) {
416
+ Object.defineProperty(error, "message", {
417
+ configurable: true,
418
+ value: `${prefix}: ${error.message}`
419
+ });
420
+ }
421
+ throw error;
422
+ }
423
+ throw new Error(`${prefix}: ${String(error)}`);
424
+ }
425
+ var stringPairSchema = z2__namespace.object({
426
+ key: z2__namespace.string().trim().min(1).describe("String pair key."),
427
+ value: z2__namespace.string().trim().min(1).describe("String pair value.")
428
+ });
429
+ var futuresCandidateSchema = z2__namespace.object({
430
+ month: z2__namespace.number().int().min(1).max(12).describe("Contract month number, 1-12."),
431
+ ticker: z2__namespace.string().trim().min(1).describe("Specific Bloomberg futures ticker."),
432
+ year: z2__namespace.number().int().min(1900).describe("Contract year.")
433
+ });
434
+ function nonEmptyString(options, description) {
435
+ return z2__namespace.string().trim().pipe(z2__namespace.string().min(1).max(options.maxStringChars).describe(description));
436
+ }
437
+ function stringArray(options, description, maxItems = options.maxFields) {
438
+ return z2__namespace.array(nonEmptyString(options, description)).min(1).max(maxItems).describe(description);
439
+ }
440
+ function optionalString(options, description) {
441
+ return nonEmptyString(options, description).optional();
442
+ }
443
+ function tickerSchema(options) {
444
+ return z2__namespace.object({
445
+ operation: z2__namespace.enum([
446
+ "parse_ticker",
447
+ "normalize_tickers",
448
+ "filter_equity_tickers",
449
+ "is_specific_contract",
450
+ "validate_generic_ticker"
451
+ ]).describe("Ticker helper operation to run."),
452
+ ticker: optionalString(
453
+ options,
454
+ "One Bloomberg ticker for parse/contract validation operations."
455
+ ),
456
+ tickers: stringArray(
457
+ options,
458
+ "Bloomberg tickers to normalize or filter.",
459
+ options.maxSecurities
460
+ ).optional()
461
+ });
462
+ }
463
+ function futuresSchema(options) {
464
+ return z2__namespace.object({
465
+ asset: optionalString(options, "Bloomberg asset class suffix, for example Comdty."),
466
+ candidates: z2__namespace.array(futuresCandidateSchema).min(1).max(options.maxFields).optional().describe("Candidate futures contracts."),
467
+ contracts: z2__namespace.array(stringPairSchema).min(1).max(options.maxFields).optional().describe("Contract pairs for validity filtering."),
468
+ count: z2__namespace.number().int().positive().optional().describe("Maximum number of futures candidates to generate."),
469
+ cycle: optionalString(options, "Futures cycle code to filter candidates by."),
470
+ day: z2__namespace.number().int().min(1).max(31).optional().describe("Day number for contract filtering."),
471
+ freq: optionalString(options, "Futures frequency/cycle hint."),
472
+ genTicker: optionalString(options, "Generic Bloomberg futures ticker."),
473
+ month: z2__namespace.number().int().min(1).max(12).optional().describe("Month number, 1-12."),
474
+ monthCode: optionalString(options, "Bloomberg futures month code, for example H."),
475
+ operation: z2__namespace.enum([
476
+ "build_futures_ticker",
477
+ "generate_candidates",
478
+ "contract_index",
479
+ "filter_candidates_by_cycle",
480
+ "filter_valid_contracts",
481
+ "get_futures_months"
482
+ ]).describe("Futures helper operation to run."),
483
+ prefix: optionalString(options, "Futures ticker root prefix."),
484
+ year: z2__namespace.union([z2__namespace.string().trim().min(1), z2__namespace.number().int()]).optional().describe("Contract year.")
485
+ });
486
+ }
487
+ function cdxSchema(options) {
488
+ return z2__namespace.object({
489
+ genTicker: optionalString(options, "Generic CDX ticker."),
490
+ operation: z2__namespace.enum([
491
+ "parse_cdx_ticker",
492
+ "previous_cdx_series",
493
+ "cdx_gen_to_specific",
494
+ "cdx_info",
495
+ "cdx_pricing",
496
+ "cdx_risk"
497
+ ]).describe("CDX helper operation to run."),
498
+ recoveryRate: z2__namespace.number().optional().describe("Optional recovery rate override for pricing/risk lookups."),
499
+ series: z2__namespace.number().int().positive().optional().describe("Specific CDX series number."),
500
+ ticker: optionalString(options, "CDX ticker.")
501
+ });
502
+ }
503
+ function currencySchema(options) {
504
+ return z2__namespace.object({
505
+ ccy1: optionalString(options, "First ISO currency code."),
506
+ ccy2: optionalString(options, "Second ISO currency code."),
507
+ currencies: stringArray(options, "ISO currency codes.").optional(),
508
+ fromCcy: optionalString(options, "Source ISO currency code."),
509
+ operation: z2__namespace.enum(["build_fx_pair", "same_currency", "currencies_needing_conversion"]).describe("Currency helper operation to run."),
510
+ target: optionalString(options, "Target ISO currency code."),
511
+ toCcy: optionalString(options, "Destination ISO currency code.")
512
+ });
513
+ }
514
+ function bqlBuilderSchema(options) {
515
+ return z2__namespace.object({
516
+ activeOnly: z2__namespace.boolean().optional().describe("Restrict corporate bond query to active bonds."),
517
+ ccy: optionalString(options, "Currency filter for corporate bond query."),
518
+ equityTicker: optionalString(options, "Equity ticker for preferreds query."),
519
+ etfTicker: optionalString(options, "ETF ticker for holdings query."),
520
+ extraFields: stringArray(options, "Extra BQL fields to include.").optional(),
521
+ operation: z2__namespace.enum(["build_preferreds_query", "build_corporate_bonds_query", "build_etf_holdings_query"]).describe("BQL builder operation to run."),
522
+ ticker: optionalString(options, "Ticker for corporate bond query.")
523
+ });
524
+ }
525
+ function marketSessionSchema(options) {
526
+ return z2__namespace.object({
527
+ countryIso: optionalString(options, "ISO country code for timezone inference."),
528
+ date: optionalString(options, "Date for UTC session conversion, YYYY-MM-DD or YYYYMMDD."),
529
+ dayEnd: optionalString(options, "Exchange day end time, for example 16:00."),
530
+ dayStart: optionalString(options, "Exchange day start time, for example 09:30."),
531
+ endDate: optionalString(options, "Optional end date."),
532
+ endDatetime: optionalString(options, "Optional end datetime."),
533
+ endTime: optionalString(options, "Session end time, for example 16:00."),
534
+ exchCode: optionalString(options, "Bloomberg exchange code."),
535
+ exchangeTz: optionalString(options, "IANA exchange timezone."),
536
+ mic: optionalString(options, "Market Identifier Code."),
537
+ operation: z2__namespace.enum([
538
+ "derive_sessions",
539
+ "get_market_rule",
540
+ "infer_timezone",
541
+ "session_times_to_utc",
542
+ "default_turnover_dates",
543
+ "default_bqr_datetimes",
544
+ "get_exchange_override",
545
+ "list_exchange_overrides"
546
+ ]).describe("Market session helper operation to run."),
547
+ startDate: optionalString(options, "Optional start date."),
548
+ startDatetime: optionalString(options, "Optional start datetime."),
549
+ startTime: optionalString(options, "Session start time, for example 09:30."),
550
+ ticker: optionalString(options, "Ticker for exchange override lookup.")
551
+ });
552
+ }
553
+ function yasOverridesSchema(options) {
554
+ return z2__namespace.object({
555
+ benchmark: optionalString(options, "Optional YAS benchmark."),
556
+ price: z2__namespace.number().optional().describe("YAS price override."),
557
+ settleDt: optionalString(options, "YAS settlement date."),
558
+ spread: z2__namespace.number().optional().describe("YAS spread override."),
559
+ yieldType: z2__namespace.number().int().optional().describe("YAS yield type override."),
560
+ yieldVal: z2__namespace.number().optional().describe("YAS yield value override.")
561
+ });
562
+ }
563
+ function constantsSchema(options) {
564
+ return z2__namespace.object({
565
+ code: optionalString(options, "Month code."),
566
+ dateStr: optionalString(options, "Date string to parse."),
567
+ day: z2__namespace.number().int().min(1).max(31).optional().describe("Day number."),
568
+ dvdType: optionalString(options, "Dividend type code or label."),
569
+ fmt: optionalString(options, "Date output format."),
570
+ month: z2__namespace.number().int().min(1).max(12).optional().describe("Month number."),
571
+ monthName: optionalString(options, "Month name."),
572
+ operation: z2__namespace.enum([
573
+ "parse_date",
574
+ "fmt_date",
575
+ "get_month_code",
576
+ "get_month_name",
577
+ "get_futures_months",
578
+ "get_dvd_type",
579
+ "get_dvd_types",
580
+ "get_dvd_cols",
581
+ "get_etf_cols"
582
+ ]).describe("Constants helper operation to run."),
583
+ year: z2__namespace.number().int().min(1).optional().describe("Year number.")
584
+ });
585
+ }
586
+ function columnsSchema(options) {
587
+ return z2__namespace.object({
588
+ columns: stringArray(options, "Column names to rename.").optional(),
589
+ dataColumns: stringArray(options, "Earnings data column names.").optional(),
590
+ headerRow: z2__namespace.array(stringPairSchema).min(1).max(options.maxFields).optional().describe("Earnings header row key/value pairs."),
591
+ operation: z2__namespace.enum(["rename_dividend_columns", "rename_etf_columns", "build_earning_header_rename"]).describe("Column helper operation to run.")
592
+ });
593
+ }
594
+ function calculateSchema(options) {
595
+ return z2__namespace.object({
596
+ levels: z2__namespace.array(z2__namespace.number().nullable()).min(1).max(options.maxFields).describe("Reference level values."),
597
+ operation: z2__namespace.literal("calculate_level_percentages").describe("Numeric helper operation to run."),
598
+ values: z2__namespace.array(z2__namespace.number().nullable()).min(1).max(options.maxFields).describe("Observed values.")
599
+ });
600
+ }
601
+
602
+ // src/ext-tools.ts
603
+ function asRecord(value) {
604
+ return value;
605
+ }
606
+ function requireString(toolName, input, field) {
607
+ const value = input[field];
608
+ if (typeof value !== "string" || value.trim().length === 0) {
609
+ throw new TypeError(`${toolName}: ${field} is required and must be a non-empty string`);
610
+ }
611
+ return value.trim();
612
+ }
613
+ function requireNumber(toolName, input, field) {
614
+ const value = input[field];
615
+ if (typeof value !== "number" || !Number.isFinite(value)) {
616
+ throw new TypeError(`${toolName}: ${field} is required and must be a finite number`);
617
+ }
618
+ return value;
619
+ }
620
+ function requireInteger(toolName, input, field) {
621
+ const value = requireNumber(toolName, input, field);
622
+ if (!Number.isInteger(value)) {
623
+ throw new TypeError(`${toolName}: ${field} must be an integer`);
624
+ }
625
+ return value;
626
+ }
627
+ function requireYearString(toolName, input, field) {
628
+ const value = input[field];
629
+ if (typeof value === "number" && Number.isInteger(value)) {
630
+ return String(value);
631
+ }
632
+ if (typeof value === "string" && value.trim().length > 0) {
633
+ return value.trim();
634
+ }
635
+ throw new TypeError(`${toolName}: ${field} is required and must be a year string or integer`);
636
+ }
637
+ function requireStringArray(toolName, input, field) {
638
+ const value = input[field];
639
+ if (!Array.isArray(value) || value.length === 0) {
640
+ throw new TypeError(`${toolName}: ${field} is required and must be a non-empty string array`);
641
+ }
642
+ return value.map((entry) => {
643
+ if (typeof entry !== "string" || entry.trim().length === 0) {
644
+ throw new TypeError(`${toolName}: ${field} entries must be non-empty strings`);
645
+ }
646
+ return entry.trim();
647
+ });
648
+ }
649
+ function resultString(resolver, name, value) {
650
+ return createToolResult(name, value, resolver.options.maxRows, resolver.options.maxStringChars);
651
+ }
652
+ function recoveryOverrides(recoveryRate) {
653
+ return recoveryRate === void 0 ? void 0 : { CDS_RR: recoveryRate };
654
+ }
655
+ var EXT_TOOL_DEFINITIONS = Object.freeze([
656
+ { create: extTickerWithResolver, name: "xbbg_ext_ticker" },
657
+ { create: extFuturesWithResolver, name: "xbbg_ext_futures" },
658
+ { create: extCdxWithResolver, name: "xbbg_ext_cdx" },
659
+ { create: extCurrencyWithResolver, name: "xbbg_ext_currency" },
660
+ { create: extBqlBuilderWithResolver, name: "xbbg_ext_bql_builder" },
661
+ { create: extMarketSessionWithResolver, name: "xbbg_ext_market_session" },
662
+ { create: extYasOverridesWithResolver, name: "xbbg_ext_yas_overrides" },
663
+ { create: extConstantsWithResolver, name: "xbbg_ext_constants" },
664
+ { create: extColumnsWithResolver, name: "xbbg_ext_columns" },
665
+ { create: extCalculateWithResolver, name: "xbbg_ext_calculate" }
666
+ ]);
667
+ var BLOOMBERG_EXT_TOOL_NAMES = Object.freeze(
668
+ EXT_TOOL_DEFINITIONS.map((definition) => definition.name)
669
+ );
670
+ function extTickerWithResolver(resolver) {
671
+ const name = "xbbg_ext_ticker";
672
+ return tools.tool(
673
+ async (input) => {
674
+ try {
675
+ const core = await resolver.getCore();
676
+ const args = asRecord(input);
677
+ switch (input.operation) {
678
+ case "parse_ticker":
679
+ return resultString(
680
+ resolver,
681
+ name,
682
+ core.ext.parseTicker(requireString(name, args, "ticker"))
683
+ );
684
+ case "normalize_tickers":
685
+ return resultString(
686
+ resolver,
687
+ name,
688
+ core.ext.normalizeTickers(requireStringArray(name, args, "tickers"))
689
+ );
690
+ case "filter_equity_tickers":
691
+ return resultString(
692
+ resolver,
693
+ name,
694
+ core.ext.filterEquityTickers(requireStringArray(name, args, "tickers"))
695
+ );
696
+ case "is_specific_contract":
697
+ return resultString(
698
+ resolver,
699
+ name,
700
+ core.ext.isSpecificContract(requireString(name, args, "ticker"))
701
+ );
702
+ case "validate_generic_ticker": {
703
+ const ticker = requireString(name, args, "ticker");
704
+ core.ext.validateGenericTicker(ticker);
705
+ return resultString(resolver, name, { ticker, valid: true });
706
+ }
707
+ }
708
+ } catch (error) {
709
+ throwWithToolContext(name, error);
710
+ }
711
+ },
712
+ {
713
+ responseFormat: "content_and_artifact",
714
+ description: EXT_TICKER_DESCRIPTION,
715
+ name,
716
+ schema: tickerSchema(resolver.options)
717
+ }
718
+ );
719
+ }
720
+ function extFuturesWithResolver(resolver) {
721
+ const name = "xbbg_ext_futures";
722
+ return tools.tool(
723
+ async (input) => {
724
+ try {
725
+ const core = await resolver.getCore();
726
+ const args = asRecord(input);
727
+ switch (input.operation) {
728
+ case "build_futures_ticker":
729
+ return resultString(
730
+ resolver,
731
+ name,
732
+ core.ext.buildFuturesTicker(
733
+ requireString(name, args, "prefix"),
734
+ requireString(name, args, "monthCode"),
735
+ requireYearString(name, args, "year"),
736
+ requireString(name, args, "asset")
737
+ )
738
+ );
739
+ case "generate_candidates":
740
+ return resultString(
741
+ resolver,
742
+ name,
743
+ core.ext.generateFuturesCandidates(
744
+ requireString(name, args, "genTicker"),
745
+ requireInteger(name, args, "year"),
746
+ requireInteger(name, args, "month"),
747
+ requireInteger(name, args, "day"),
748
+ input.freq,
749
+ input.count
750
+ )
751
+ );
752
+ case "contract_index":
753
+ return resultString(
754
+ resolver,
755
+ name,
756
+ core.ext.contractIndex(requireString(name, args, "genTicker"))
757
+ );
758
+ case "filter_candidates_by_cycle":
759
+ if (input.candidates === void 0) {
760
+ throw new TypeError(`${name}: candidates is required`);
761
+ }
762
+ return resultString(
763
+ resolver,
764
+ name,
765
+ core.ext.filterCandidatesByCycle(
766
+ input.candidates,
767
+ requireString(name, args, "cycle")
768
+ )
769
+ );
770
+ case "filter_valid_contracts":
771
+ if (input.contracts === void 0) {
772
+ throw new TypeError(`${name}: contracts is required`);
773
+ }
774
+ return resultString(
775
+ resolver,
776
+ name,
777
+ core.ext.filterValidContracts(
778
+ input.contracts,
779
+ requireInteger(name, args, "year"),
780
+ requireInteger(name, args, "month"),
781
+ requireInteger(name, args, "day")
782
+ )
783
+ );
784
+ case "get_futures_months":
785
+ return resultString(resolver, name, core.ext.getFuturesMonths());
786
+ }
787
+ } catch (error) {
788
+ throwWithToolContext(name, error);
789
+ }
790
+ },
791
+ {
792
+ responseFormat: "content_and_artifact",
793
+ description: EXT_FUTURES_DESCRIPTION,
794
+ name,
795
+ schema: futuresSchema(resolver.options)
796
+ }
797
+ );
798
+ }
799
+ function extCdxWithResolver(resolver) {
800
+ const name = "xbbg_ext_cdx";
801
+ return tools.tool(
802
+ async (input) => {
803
+ try {
804
+ const args = asRecord(input);
805
+ if (input.operation === "cdx_info" || input.operation === "cdx_pricing" || input.operation === "cdx_risk") {
806
+ const engine = await resolver.getEngine();
807
+ const ticker = requireString(name, args, "ticker");
808
+ const fields = input.operation === "cdx_info" ? CDX_INFO_FIELDS : input.operation === "cdx_pricing" ? CDX_PRICING_FIELDS : CDX_RISK_FIELDS;
809
+ const result = await engine.bdp([ticker], fields, {
810
+ backend: "json",
811
+ overrides: recoveryOverrides(input.recoveryRate)
812
+ });
813
+ return resultString(resolver, name, result);
814
+ }
815
+ const core = await resolver.getCore();
816
+ switch (input.operation) {
817
+ case "parse_cdx_ticker":
818
+ return resultString(
819
+ resolver,
820
+ name,
821
+ core.ext.parseCdxTicker(requireString(name, args, "ticker"))
822
+ );
823
+ case "previous_cdx_series":
824
+ return resultString(
825
+ resolver,
826
+ name,
827
+ core.ext.previousCdxSeries(requireString(name, args, "ticker"))
828
+ );
829
+ case "cdx_gen_to_specific":
830
+ return resultString(
831
+ resolver,
832
+ name,
833
+ core.ext.cdxGenToSpecific(
834
+ requireString(name, args, "genTicker"),
835
+ requireInteger(name, args, "series")
836
+ )
837
+ );
838
+ }
839
+ } catch (error) {
840
+ throwWithToolContext(name, error);
841
+ }
842
+ },
843
+ {
844
+ responseFormat: "content_and_artifact",
845
+ description: EXT_CDX_DESCRIPTION,
846
+ name,
847
+ schema: cdxSchema(resolver.options)
848
+ }
849
+ );
850
+ }
851
+ function extCurrencyWithResolver(resolver) {
852
+ const name = "xbbg_ext_currency";
853
+ return tools.tool(
854
+ async (input) => {
855
+ try {
856
+ const core = await resolver.getCore();
857
+ const args = asRecord(input);
858
+ switch (input.operation) {
859
+ case "build_fx_pair":
860
+ return resultString(
861
+ resolver,
862
+ name,
863
+ core.ext.buildFxPair(
864
+ requireString(name, args, "fromCcy"),
865
+ requireString(name, args, "toCcy")
866
+ )
867
+ );
868
+ case "same_currency":
869
+ return resultString(
870
+ resolver,
871
+ name,
872
+ core.ext.sameCurrency(
873
+ requireString(name, args, "ccy1"),
874
+ requireString(name, args, "ccy2")
875
+ )
876
+ );
877
+ case "currencies_needing_conversion":
878
+ return resultString(
879
+ resolver,
880
+ name,
881
+ core.ext.currenciesNeedingConversion(
882
+ requireStringArray(name, args, "currencies"),
883
+ requireString(name, args, "target")
884
+ )
885
+ );
886
+ }
887
+ } catch (error) {
888
+ throwWithToolContext(name, error);
889
+ }
890
+ },
891
+ {
892
+ responseFormat: "content_and_artifact",
893
+ description: EXT_CURRENCY_DESCRIPTION,
894
+ name,
895
+ schema: currencySchema(resolver.options)
896
+ }
897
+ );
898
+ }
899
+ function extBqlBuilderWithResolver(resolver) {
900
+ const name = "xbbg_ext_bql_builder";
901
+ return tools.tool(
902
+ async (input) => {
903
+ try {
904
+ const core = await resolver.getCore();
905
+ const args = asRecord(input);
906
+ switch (input.operation) {
907
+ case "build_preferreds_query":
908
+ return resultString(
909
+ resolver,
910
+ name,
911
+ core.ext.buildPreferredsQuery(
912
+ requireString(name, args, "equityTicker"),
913
+ input.extraFields
914
+ )
915
+ );
916
+ case "build_corporate_bonds_query":
917
+ return resultString(
918
+ resolver,
919
+ name,
920
+ core.ext.buildCorporateBondsQuery(
921
+ requireString(name, args, "ticker"),
922
+ input.ccy,
923
+ input.extraFields,
924
+ input.activeOnly
925
+ )
926
+ );
927
+ case "build_etf_holdings_query":
928
+ return resultString(
929
+ resolver,
930
+ name,
931
+ core.ext.buildEtfHoldingsQuery(
932
+ requireString(name, args, "etfTicker"),
933
+ input.extraFields
934
+ )
935
+ );
936
+ }
937
+ } catch (error) {
938
+ throwWithToolContext(name, error);
939
+ }
940
+ },
941
+ {
942
+ responseFormat: "content_and_artifact",
943
+ description: EXT_BQL_BUILDER_DESCRIPTION,
944
+ name,
945
+ schema: bqlBuilderSchema(resolver.options)
946
+ }
947
+ );
948
+ }
949
+ function extMarketSessionWithResolver(resolver) {
950
+ const name = "xbbg_ext_market_session";
951
+ return tools.tool(
952
+ async (input) => {
953
+ try {
954
+ const core = await resolver.getCore();
955
+ const args = asRecord(input);
956
+ switch (input.operation) {
957
+ case "derive_sessions":
958
+ return resultString(
959
+ resolver,
960
+ name,
961
+ core.ext.deriveSessions(
962
+ requireString(name, args, "dayStart"),
963
+ requireString(name, args, "dayEnd"),
964
+ input.mic,
965
+ input.exchCode
966
+ )
967
+ );
968
+ case "get_market_rule":
969
+ return resultString(resolver, name, core.ext.getMarketRule(input.mic, input.exchCode));
970
+ case "infer_timezone":
971
+ return resultString(
972
+ resolver,
973
+ name,
974
+ core.ext.inferTimezone(requireString(name, args, "countryIso"))
975
+ );
976
+ case "session_times_to_utc":
977
+ return resultString(
978
+ resolver,
979
+ name,
980
+ core.ext.sessionTimesToUtc(
981
+ requireString(name, args, "startTime"),
982
+ requireString(name, args, "endTime"),
983
+ requireString(name, args, "exchangeTz"),
984
+ requireString(name, args, "date")
985
+ )
986
+ );
987
+ case "default_turnover_dates":
988
+ return resultString(
989
+ resolver,
990
+ name,
991
+ core.ext.defaultTurnoverDates(input.startDate, input.endDate)
992
+ );
993
+ case "default_bqr_datetimes":
994
+ return resultString(
995
+ resolver,
996
+ name,
997
+ core.ext.defaultBqrDatetimes(input.startDatetime, input.endDatetime)
998
+ );
999
+ case "get_exchange_override":
1000
+ return resultString(
1001
+ resolver,
1002
+ name,
1003
+ core.ext.getExchangeOverride(requireString(name, args, "ticker"))
1004
+ );
1005
+ case "list_exchange_overrides":
1006
+ return resultString(resolver, name, core.ext.listExchangeOverrides());
1007
+ }
1008
+ } catch (error) {
1009
+ throwWithToolContext(name, error);
1010
+ }
1011
+ },
1012
+ {
1013
+ responseFormat: "content_and_artifact",
1014
+ description: EXT_MARKET_SESSION_DESCRIPTION,
1015
+ name,
1016
+ schema: marketSessionSchema(resolver.options)
1017
+ }
1018
+ );
1019
+ }
1020
+ function extYasOverridesWithResolver(resolver) {
1021
+ const name = "xbbg_ext_yas_overrides";
1022
+ return tools.tool(
1023
+ async (input) => {
1024
+ try {
1025
+ const core = await resolver.getCore();
1026
+ return resultString(
1027
+ resolver,
1028
+ name,
1029
+ core.ext.buildYasOverrides(
1030
+ input.settleDt,
1031
+ input.yieldType,
1032
+ input.spread,
1033
+ input.yieldVal,
1034
+ input.price,
1035
+ input.benchmark
1036
+ )
1037
+ );
1038
+ } catch (error) {
1039
+ throwWithToolContext(name, error);
1040
+ }
1041
+ },
1042
+ {
1043
+ responseFormat: "content_and_artifact",
1044
+ description: EXT_YAS_OVERRIDES_DESCRIPTION,
1045
+ name,
1046
+ schema: yasOverridesSchema(resolver.options)
1047
+ }
1048
+ );
1049
+ }
1050
+ function extConstantsWithResolver(resolver) {
1051
+ const name = "xbbg_ext_constants";
1052
+ return tools.tool(
1053
+ async (input) => {
1054
+ try {
1055
+ const core = await resolver.getCore();
1056
+ const args = asRecord(input);
1057
+ switch (input.operation) {
1058
+ case "parse_date":
1059
+ return resultString(
1060
+ resolver,
1061
+ name,
1062
+ core.ext.parseDate(requireString(name, args, "dateStr"))
1063
+ );
1064
+ case "fmt_date":
1065
+ return resultString(
1066
+ resolver,
1067
+ name,
1068
+ core.ext.fmtDate(
1069
+ requireInteger(name, args, "year"),
1070
+ requireInteger(name, args, "month"),
1071
+ requireInteger(name, args, "day"),
1072
+ input.fmt
1073
+ )
1074
+ );
1075
+ case "get_month_code":
1076
+ return resultString(
1077
+ resolver,
1078
+ name,
1079
+ core.ext.getMonthCode(requireString(name, args, "monthName"))
1080
+ );
1081
+ case "get_month_name":
1082
+ return resultString(
1083
+ resolver,
1084
+ name,
1085
+ core.ext.getMonthName(requireString(name, args, "code"))
1086
+ );
1087
+ case "get_futures_months":
1088
+ return resultString(resolver, name, core.ext.getFuturesMonths());
1089
+ case "get_dvd_type":
1090
+ return resultString(
1091
+ resolver,
1092
+ name,
1093
+ core.ext.getDvdType(requireString(name, args, "dvdType"))
1094
+ );
1095
+ case "get_dvd_types":
1096
+ return resultString(resolver, name, core.ext.getDvdTypes());
1097
+ case "get_dvd_cols":
1098
+ return resultString(resolver, name, core.ext.getDvdCols());
1099
+ case "get_etf_cols":
1100
+ return resultString(resolver, name, core.ext.getEtfCols());
1101
+ }
1102
+ } catch (error) {
1103
+ throwWithToolContext(name, error);
1104
+ }
1105
+ },
1106
+ {
1107
+ responseFormat: "content_and_artifact",
1108
+ description: EXT_CONSTANTS_DESCRIPTION,
1109
+ name,
1110
+ schema: constantsSchema(resolver.options)
1111
+ }
1112
+ );
1113
+ }
1114
+ function extColumnsWithResolver(resolver) {
1115
+ const name = "xbbg_ext_columns";
1116
+ return tools.tool(
1117
+ async (input) => {
1118
+ try {
1119
+ const core = await resolver.getCore();
1120
+ const args = asRecord(input);
1121
+ switch (input.operation) {
1122
+ case "rename_dividend_columns":
1123
+ return resultString(
1124
+ resolver,
1125
+ name,
1126
+ core.ext.renameDividendColumns(requireStringArray(name, args, "columns"))
1127
+ );
1128
+ case "rename_etf_columns":
1129
+ return resultString(
1130
+ resolver,
1131
+ name,
1132
+ core.ext.renameEtfColumns(requireStringArray(name, args, "columns"))
1133
+ );
1134
+ case "build_earning_header_rename":
1135
+ if (input.headerRow === void 0) {
1136
+ throw new TypeError(`${name}: headerRow is required`);
1137
+ }
1138
+ return resultString(
1139
+ resolver,
1140
+ name,
1141
+ core.ext.buildEarningHeaderRename(
1142
+ input.headerRow,
1143
+ requireStringArray(name, args, "dataColumns")
1144
+ )
1145
+ );
1146
+ }
1147
+ } catch (error) {
1148
+ throwWithToolContext(name, error);
1149
+ }
1150
+ },
1151
+ {
1152
+ responseFormat: "content_and_artifact",
1153
+ description: EXT_COLUMNS_DESCRIPTION,
1154
+ name,
1155
+ schema: columnsSchema(resolver.options)
1156
+ }
1157
+ );
1158
+ }
1159
+ function extCalculateWithResolver(resolver) {
1160
+ const name = "xbbg_ext_calculate";
1161
+ return tools.tool(
1162
+ async (input) => {
1163
+ try {
1164
+ if (input.values.length !== input.levels.length) {
1165
+ throw new TypeError(`${name}: values and levels must have the same length`);
1166
+ }
1167
+ const core = await resolver.getCore();
1168
+ return resultString(
1169
+ resolver,
1170
+ name,
1171
+ core.ext.calculateLevelPercentages(input.values, input.levels)
1172
+ );
1173
+ } catch (error) {
1174
+ throwWithToolContext(name, error);
1175
+ }
1176
+ },
1177
+ {
1178
+ responseFormat: "content_and_artifact",
1179
+ description: EXT_CALCULATE_DESCRIPTION,
1180
+ name,
1181
+ schema: calculateSchema(resolver.options)
1182
+ }
1183
+ );
1184
+ }
1185
+ function createExtTickerTool(options = {}) {
1186
+ return extTickerWithResolver(createCoreResolver(options));
1187
+ }
1188
+ function createExtFuturesTool(options = {}) {
1189
+ return extFuturesWithResolver(createCoreResolver(options));
1190
+ }
1191
+ function createExtCdxTool(options = {}) {
1192
+ return extCdxWithResolver(createCoreResolver(options));
1193
+ }
1194
+ function createExtCurrencyTool(options = {}) {
1195
+ return extCurrencyWithResolver(createCoreResolver(options));
1196
+ }
1197
+ function createExtBqlBuilderTool(options = {}) {
1198
+ return extBqlBuilderWithResolver(createCoreResolver(options));
1199
+ }
1200
+ function createExtMarketSessionTool(options = {}) {
1201
+ return extMarketSessionWithResolver(createCoreResolver(options));
1202
+ }
1203
+ function createExtYasOverridesTool(options = {}) {
1204
+ return extYasOverridesWithResolver(createCoreResolver(options));
1205
+ }
1206
+ function createExtConstantsTool(options = {}) {
1207
+ return extConstantsWithResolver(createCoreResolver(options));
1208
+ }
1209
+ function createExtColumnsTool(options = {}) {
1210
+ return extColumnsWithResolver(createCoreResolver(options));
1211
+ }
1212
+ function createExtCalculateTool(options = {}) {
1213
+ return extCalculateWithResolver(createCoreResolver(options));
1214
+ }
1215
+ function createBloombergExtToolsForResolver(resolver) {
1216
+ return EXT_TOOL_DEFINITIONS.filter(
1217
+ (definition) => !isToolDisabled(resolver.options, definition.name)
1218
+ ).map((definition) => definition.create(resolver));
1219
+ }
1220
+ function createBloombergExtTools(options = {}) {
1221
+ return createBloombergExtToolsForResolver(createCoreResolver(options));
1222
+ }
1223
+ var REFERENCE_FORMATS = ["long", "long_typed", "long_metadata"];
1224
+ var HISTORICAL_FORMATS = [
1225
+ "long",
1226
+ "long_typed",
1227
+ "long_metadata",
1228
+ "semi_long",
1229
+ "wide"
1230
+ ];
1231
+ var ISO_DATE_RE = /^\d{4}-\d{2}-\d{2}$/u;
1232
+ var BBG_DATE_RE = /^\d{8}$/u;
1233
+ var AMBIGUOUS_DATE_RE = /^\d{1,2}[-/]\d{1,2}[-/]\d{2,4}([T \D]|$)/u;
1234
+ var ISO_DATE_TIME_RE = /^\d{4}-\d{2}-\d{2}(?:[T ]\d{2}:\d{2}(?::\d{2}(?:\.\d+)?)?(?:Z|[+-]\d{2}:?\d{2})?)?$/u;
1235
+ var primitiveSchema = z2__namespace.union([
1236
+ z2__namespace.string().transform((value) => value.trim()),
1237
+ z2__namespace.number(),
1238
+ z2__namespace.boolean()
1239
+ ]);
1240
+ function dateFromParts(year, month, day) {
1241
+ const formatted = `${year}${month}${day}`;
1242
+ const parsed = new Date(Date.UTC(Number(year), Number(month) - 1, Number(day)));
1243
+ if (Number.isNaN(parsed.getTime()) || parsed.getUTCFullYear() !== Number(year) || parsed.getUTCMonth() + 1 !== Number(month) || parsed.getUTCDate() !== Number(day)) {
1244
+ throw new TypeError(`Invalid date ${formatted}; expected a real calendar date like 2024-01-31`);
1245
+ }
1246
+ return formatted;
1247
+ }
1248
+ function dateToBbg(value) {
1249
+ const date2 = value instanceof Date ? value : new Date(value);
1250
+ if (Number.isNaN(date2.getTime())) {
1251
+ throw new TypeError("Invalid date value; expected YYYY-MM-DD, YYYYMMDD, Date, or epoch ms");
1252
+ }
1253
+ const year = String(date2.getUTCFullYear()).padStart(4, "0");
1254
+ const month = String(date2.getUTCMonth() + 1).padStart(2, "0");
1255
+ const day = String(date2.getUTCDate()).padStart(2, "0");
1256
+ return `${year}${month}${day}`;
1257
+ }
1258
+ function normalizeDate(value) {
1259
+ if (value instanceof Date || typeof value === "number") {
1260
+ return dateToBbg(value);
1261
+ }
1262
+ const text = value.trim();
1263
+ if (text.length === 0) {
1264
+ throw new TypeError("Date must be non-empty; use YYYY-MM-DD or YYYYMMDD");
1265
+ }
1266
+ if (AMBIGUOUS_DATE_RE.test(text)) {
1267
+ throw new TypeError(`Ambiguous date ${JSON.stringify(text)}; use YYYY-MM-DD or YYYYMMDD`);
1268
+ }
1269
+ if (BBG_DATE_RE.test(text)) {
1270
+ return dateFromParts(text.slice(0, 4), text.slice(4, 6), text.slice(6, 8));
1271
+ }
1272
+ if (ISO_DATE_RE.test(text)) {
1273
+ return dateFromParts(text.slice(0, 4), text.slice(5, 7), text.slice(8, 10));
1274
+ }
1275
+ throw new TypeError(`Invalid date ${JSON.stringify(text)}; use YYYY-MM-DD or YYYYMMDD`);
1276
+ }
1277
+ function normalizeDateTime(value) {
1278
+ if (value instanceof Date || typeof value === "number") {
1279
+ const date2 = value instanceof Date ? value : new Date(value);
1280
+ if (Number.isNaN(date2.getTime())) {
1281
+ throw new TypeError("Invalid datetime value; expected ISO 8601 datetime, Date, or epoch ms");
1282
+ }
1283
+ return date2.toISOString();
1284
+ }
1285
+ const text = value.trim();
1286
+ if (text.length === 0) {
1287
+ throw new TypeError("Datetime must be non-empty; use an ISO 8601 datetime");
1288
+ }
1289
+ if (AMBIGUOUS_DATE_RE.test(text)) {
1290
+ throw new TypeError(`Ambiguous datetime ${JSON.stringify(text)}; use ISO 8601`);
1291
+ }
1292
+ if (BBG_DATE_RE.test(text)) {
1293
+ return `${text.slice(0, 4)}-${text.slice(4, 6)}-${text.slice(6, 8)}T00:00:00`;
1294
+ }
1295
+ if (!ISO_DATE_TIME_RE.test(text)) {
1296
+ throw new TypeError(`Invalid datetime ${JSON.stringify(text)}; use ISO 8601`);
1297
+ }
1298
+ return text.replace(" ", "T");
1299
+ }
1300
+ function nonEmptyString2(tool3, field, maxChars, example) {
1301
+ return z2__namespace.string().transform((value) => value.trim()).pipe(
1302
+ z2__namespace.string().min(1, `${tool3}: ${field} must be a non-empty string. Example: ${example}`).max(
1303
+ maxChars,
1304
+ `${tool3}: ${field} is too long; expected at most ${maxChars} characters. Example: ${example}`
1305
+ )
1306
+ );
1307
+ }
1308
+ function stringArray2(tool3, field, maxItems, maxChars, example) {
1309
+ return z2__namespace.array(nonEmptyString2(tool3, field, maxChars, example)).min(1, `${tool3}: ${field} must contain at least one non-empty string. Example: ${example}`).max(maxItems, `${tool3}: ${field} can contain at most ${maxItems} values`);
1310
+ }
1311
+ function primitiveMap(tool3, field) {
1312
+ return z2__namespace.record(z2__namespace.string().min(1), primitiveSchema).optional().transform((value) => {
1313
+ if (value === void 0) {
1314
+ return void 0;
1315
+ }
1316
+ const normalized = {};
1317
+ for (const [key, entry] of Object.entries(value)) {
1318
+ const normalizedKey = key.trim();
1319
+ if (normalizedKey.length === 0) {
1320
+ throw new TypeError(`${tool3}: ${field} contains an empty key`);
1321
+ }
1322
+ if (typeof entry === "string" && entry.length === 0) {
1323
+ throw new TypeError(`${tool3}: ${field}.${normalizedKey} must not be an empty string`);
1324
+ }
1325
+ normalized[normalizedKey] = entry;
1326
+ }
1327
+ return normalized;
1328
+ });
1329
+ }
1330
+ function dateField(tool3, field) {
1331
+ return z2__namespace.union([z2__namespace.string(), z2__namespace.date(), z2__namespace.number()]).transform((value) => normalizeDate(value)).describe(
1332
+ `${field} date. Use YYYY-MM-DD or Bloomberg-native YYYYMMDD, never ambiguous MM/DD/YYYY.`
1333
+ );
1334
+ }
1335
+ function dateTimeField(tool3, field) {
1336
+ return z2__namespace.union([z2__namespace.string(), z2__namespace.date(), z2__namespace.number()]).transform((value) => normalizeDateTime(value)).describe(`${field} datetime. Use ISO 8601, for example 2024-01-31T09:30:00-05:00.`);
1337
+ }
1338
+ function referenceFormat(tool3) {
1339
+ return z2__namespace.enum(REFERENCE_FORMATS, {
1340
+ error: `${tool3}: format must be one of ${REFERENCE_FORMATS.join(", ")}`
1341
+ }).optional();
1342
+ }
1343
+ function historicalFormat(tool3) {
1344
+ return z2__namespace.enum(HISTORICAL_FORMATS, {
1345
+ error: `${tool3}: format must be one of ${HISTORICAL_FORMATS.join(", ")}`
1346
+ }).optional();
1347
+ }
1348
+ function createBdpSchema(options) {
1349
+ const tool3 = "xbbg_bdp";
1350
+ return z2__namespace.object({
1351
+ fields: stringArray2(
1352
+ tool3,
1353
+ "fields",
1354
+ options.maxFields,
1355
+ options.maxStringChars,
1356
+ '["PX_LAST"]'
1357
+ ).describe(
1358
+ 'Bloomberg field mnemonics to retrieve, for example ["PX_LAST", "NAME"]. Use xbbg_bflds first if uncertain.'
1359
+ ),
1360
+ format: referenceFormat(tool3).describe(
1361
+ "JSON output shape. Usually omit; use long_typed if downstream needs Bloomberg value types."
1362
+ ),
1363
+ includeSecurityErrors: z2__namespace.boolean().optional().describe("Include Bloomberg security errors in the response when supported."),
1364
+ kwargs: primitiveMap(tool3, "kwargs").describe(
1365
+ "Advanced Bloomberg request kwargs as flat string/number/boolean values only."
1366
+ ),
1367
+ overrides: primitiveMap(tool3, "overrides").describe(
1368
+ "Bloomberg field overrides as flat string/number/boolean values only."
1369
+ ),
1370
+ securities: stringArray2(
1371
+ tool3,
1372
+ "securities",
1373
+ options.maxSecurities,
1374
+ options.maxStringChars,
1375
+ '["AAPL US Equity"]'
1376
+ ).describe(
1377
+ 'Fully qualified Bloomberg securities, for example ["AAPL US Equity"]; use /isin/{isin} for ISINs and /cusip/{cusip} for CUSIPs. Do not invent tickers.'
1378
+ ),
1379
+ validateFields: z2__namespace.boolean().optional().describe("Override field validation for this request.")
1380
+ });
1381
+ }
1382
+ function createBdhSchema(options) {
1383
+ const tool3 = "xbbg_bdh";
1384
+ return z2__namespace.object({
1385
+ end: dateField(tool3, "end").describe("Required end date. Use YYYY-MM-DD or YYYYMMDD."),
1386
+ fields: stringArray2(
1387
+ tool3,
1388
+ "fields",
1389
+ options.maxFields,
1390
+ options.maxStringChars,
1391
+ '["PX_LAST"]'
1392
+ ).describe('Bloomberg historical field mnemonics, for example ["PX_LAST"].'),
1393
+ format: historicalFormat(tool3).describe(
1394
+ "Historical JSON output shape. Use wide only when the user asks for a table by date."
1395
+ ),
1396
+ kwargs: primitiveMap(tool3, "kwargs").describe(
1397
+ "Advanced Bloomberg request kwargs as flat string/number/boolean values only."
1398
+ ),
1399
+ overrides: primitiveMap(tool3, "overrides").describe(
1400
+ "Bloomberg overrides as flat string/number/boolean values only."
1401
+ ),
1402
+ securities: stringArray2(
1403
+ tool3,
1404
+ "securities",
1405
+ options.maxSecurities,
1406
+ options.maxStringChars,
1407
+ '["AAPL US Equity"]'
1408
+ ).describe(
1409
+ 'Fully qualified Bloomberg securities, for example ["AAPL US Equity"]; use /isin/{isin} for ISINs and /cusip/{cusip} for CUSIPs.'
1410
+ ),
1411
+ start: dateField(tool3, "start").describe("Required start date. Use YYYY-MM-DD or YYYYMMDD."),
1412
+ validateFields: z2__namespace.boolean().optional().describe("Override field validation for this request.")
1413
+ }).superRefine((value, ctx) => {
1414
+ if (value.start > value.end) {
1415
+ ctx.addIssue({
1416
+ code: "custom",
1417
+ message: `${tool3}: start must be on or before end. Example: start "2024-01-01", end "2024-01-31"`,
1418
+ path: ["start"]
1419
+ });
1420
+ }
1421
+ });
1422
+ }
1423
+ function createBdsSchema(options) {
1424
+ const tool3 = "xbbg_bds";
1425
+ return z2__namespace.object({
1426
+ field: nonEmptyString2(tool3, "field", options.maxStringChars, "INDX_MEMBERS").describe(
1427
+ "Exactly one Bloomberg bulk/table field, for example INDX_MEMBERS."
1428
+ ),
1429
+ format: referenceFormat(tool3).describe("JSON output shape. Usually omit."),
1430
+ kwargs: primitiveMap(tool3, "kwargs").describe(
1431
+ "Advanced Bloomberg request kwargs as flat string/number/boolean values only."
1432
+ ),
1433
+ overrides: primitiveMap(tool3, "overrides").describe(
1434
+ "Bloomberg overrides as flat string/number/boolean values only."
1435
+ ),
1436
+ securities: stringArray2(
1437
+ tool3,
1438
+ "securities",
1439
+ options.maxSecurities,
1440
+ options.maxStringChars,
1441
+ '["SPX Index"]'
1442
+ ).describe(
1443
+ 'Fully qualified Bloomberg securities, for example ["SPX Index"]; use /isin/{isin} for ISINs and /cusip/{cusip} for CUSIPs.'
1444
+ ),
1445
+ validateFields: z2__namespace.boolean().optional().describe("Override field validation for this request.")
1446
+ });
1447
+ }
1448
+ function createBdibSchema(options) {
1449
+ const tool3 = "xbbg_bdib";
1450
+ return z2__namespace.object({
1451
+ end: dateTimeField(tool3, "end").describe(
1452
+ "Required intraday end datetime. Use ISO 8601 with timezone when possible."
1453
+ ),
1454
+ eventType: nonEmptyString2(tool3, "eventType", options.maxStringChars, "TRADE").optional().describe("Bloomberg event type. Usually TRADE."),
1455
+ interval: z2__namespace.number().int(`${tool3}: interval must be a positive integer number of minutes. Example: 5`).positive(`${tool3}: interval must be greater than zero. Example: 5`).describe("Bar interval in minutes. Must be a positive integer."),
1456
+ kwargs: primitiveMap(tool3, "kwargs").describe(
1457
+ "Advanced Bloomberg request kwargs as flat string/number/boolean values only."
1458
+ ),
1459
+ outputTz: nonEmptyString2(tool3, "outputTz", options.maxStringChars, "America/New_York").optional().describe("Optional output timezone, for example America/New_York."),
1460
+ requestTz: nonEmptyString2(tool3, "requestTz", options.maxStringChars, "America/New_York").optional().describe("Timezone for naive start/end datetimes, for example America/New_York."),
1461
+ start: dateTimeField(tool3, "start").describe(
1462
+ "Required intraday start datetime. Use ISO 8601 with timezone when possible."
1463
+ ),
1464
+ ticker: nonEmptyString2(tool3, "ticker", options.maxStringChars, "AAPL US Equity").describe(
1465
+ "One fully qualified Bloomberg security, for example AAPL US Equity; use /isin/{isin} for ISINs and /cusip/{cusip} for CUSIPs."
1466
+ )
1467
+ });
1468
+ }
1469
+ function createBdtickSchema(options) {
1470
+ const tool3 = "xbbg_bdtick";
1471
+ const includeFlag = z2__namespace.boolean().optional().describe("Optional IntradayTickRequest include flag.");
1472
+ return z2__namespace.object({
1473
+ end: dateTimeField(tool3, "end").describe(
1474
+ "Required intraday tick end datetime. Use ISO 8601 with timezone when possible."
1475
+ ),
1476
+ eventTypes: stringArray2(
1477
+ tool3,
1478
+ "eventTypes",
1479
+ options.maxFields,
1480
+ options.maxStringChars,
1481
+ '["TRADE"]'
1482
+ ).optional().describe('Bloomberg tick event types, for example ["TRADE"] or ["BID", "ASK"].'),
1483
+ includeBicMicCodes: includeFlag,
1484
+ includeBloombergStandardConditionCodes: includeFlag,
1485
+ includeBrokerCodes: includeFlag,
1486
+ includeConditionCodes: includeFlag,
1487
+ includeExchangeCodes: includeFlag,
1488
+ includeNonPlottableEvents: includeFlag,
1489
+ includeRpsCodes: includeFlag,
1490
+ kwargs: primitiveMap(tool3, "kwargs").describe(
1491
+ "Advanced IntradayTickRequest kwargs as flat string/number/boolean values only."
1492
+ ),
1493
+ outputTz: nonEmptyString2(tool3, "outputTz", options.maxStringChars, "America/New_York").optional().describe("Optional output timezone, for example America/New_York."),
1494
+ requestTz: nonEmptyString2(tool3, "requestTz", options.maxStringChars, "America/New_York").optional().describe("Timezone for naive start/end datetimes, for example America/New_York."),
1495
+ start: dateTimeField(tool3, "start").describe(
1496
+ "Required intraday tick start datetime. Use ISO 8601 with timezone when possible."
1497
+ ),
1498
+ ticker: nonEmptyString2(tool3, "ticker", options.maxStringChars, "AAPL US Equity").describe(
1499
+ "One fully qualified Bloomberg security, for example AAPL US Equity; use /isin/{isin} for ISINs and /cusip/{cusip} for CUSIPs."
1500
+ )
1501
+ });
1502
+ }
1503
+ function createBqlSchema(options) {
1504
+ const tool3 = "xbbg_bql";
1505
+ return z2__namespace.object({
1506
+ format: referenceFormat(tool3).describe("JSON output shape. Usually omit."),
1507
+ kwargs: primitiveMap(tool3, "kwargs").describe(
1508
+ "Advanced Bloomberg request kwargs as flat string/number/boolean values only."
1509
+ ),
1510
+ query: nonEmptyString2(
1511
+ tool3,
1512
+ "query",
1513
+ options.maxBqlQueryChars,
1514
+ "get(px_last) for('AAPL US Equity')"
1515
+ ).describe(
1516
+ "Complete BQL expression string. Use get(...) for(...) with an explicit bounded universe; prefer BDP/BDH for simple reference or historical requests."
1517
+ )
1518
+ });
1519
+ }
1520
+ function createBqrSchema(options) {
1521
+ const tool3 = "xbbg_bqr";
1522
+ return z2__namespace.object({
1523
+ end: dateTimeField(tool3, "end").describe(
1524
+ "Required BQR end datetime. Use ISO 8601 with timezone when possible."
1525
+ ),
1526
+ eventTypes: stringArray2(
1527
+ tool3,
1528
+ "eventTypes",
1529
+ options.maxFields,
1530
+ options.maxStringChars,
1531
+ '["BID", "ASK"]'
1532
+ ).optional().describe('BQR event types. Usually ["BID", "ASK"].'),
1533
+ includeBrokerCodes: z2__namespace.boolean().optional().describe("Include broker/dealer attribution columns. Defaults to true in @xbbg/core."),
1534
+ start: dateTimeField(tool3, "start").describe(
1535
+ "Required BQR start datetime. Use ISO 8601 with timezone when possible."
1536
+ ),
1537
+ ticker: nonEmptyString2(
1538
+ tool3,
1539
+ "ticker",
1540
+ options.maxStringChars,
1541
+ "/isin/US037833FB15@MSG1 Corp"
1542
+ ).describe(
1543
+ "Fixed-income ticker or identifier with dealer quote source, for example /isin/US037833FB15@MSG1 Corp."
1544
+ )
1545
+ });
1546
+ }
1547
+ function createBsrchSchema(options) {
1548
+ const tool3 = "xbbg_bsrch";
1549
+ return z2__namespace.object({
1550
+ format: referenceFormat(tool3).describe("JSON output shape. Usually omit."),
1551
+ kwargs: primitiveMap(tool3, "kwargs").describe(
1552
+ "Search-grid kwargs as flat string/number/boolean values only."
1553
+ ),
1554
+ overrides: primitiveMap(tool3, "overrides").describe(
1555
+ "Search-grid overrides as flat string/number/boolean values only."
1556
+ ),
1557
+ searchSpec: nonEmptyString2(
1558
+ tool3,
1559
+ "searchSpec",
1560
+ options.maxSearchSpecChars,
1561
+ "COMDTY:NG"
1562
+ ).describe(
1563
+ "Bloomberg search/grid domain or saved-search spec. Not for normal security lookup."
1564
+ )
1565
+ });
1566
+ }
1567
+ function createBfldsSchema(options) {
1568
+ const tool3 = "xbbg_bflds";
1569
+ return z2__namespace.object({
1570
+ fields: stringArray2(tool3, "fields", options.maxFields, options.maxStringChars, '["PX_LAST"]').optional().describe(
1571
+ 'Specific field mnemonics to inspect, for example ["PX_LAST"]. Provide either fields or searchSpec, not both.'
1572
+ ),
1573
+ format: referenceFormat(tool3).describe("JSON output shape. Usually omit."),
1574
+ kwargs: primitiveMap(tool3, "kwargs").describe(
1575
+ "Advanced Bloomberg request kwargs as flat string/number/boolean values only."
1576
+ ),
1577
+ searchSpec: nonEmptyString2(tool3, "searchSpec", options.maxSearchSpecChars, "last price").optional().describe(
1578
+ "Field search text when the field mnemonic is unknown. Provide either searchSpec or fields, not both."
1579
+ )
1580
+ }).superRefine((value, ctx) => {
1581
+ const hasFields = value.fields !== void 0;
1582
+ const hasSearchSpec = value.searchSpec !== void 0;
1583
+ if (hasFields === hasSearchSpec) {
1584
+ ctx.addIssue({
1585
+ code: "custom",
1586
+ message: `${tool3}: provide exactly one of fields or searchSpec. Example: {"fields":["PX_LAST"]}`,
1587
+ path: ["fields"]
1588
+ });
1589
+ }
1590
+ });
1591
+ }
1592
+ function createBeqsSchema(options) {
1593
+ const tool3 = "xbbg_beqs";
1594
+ return z2__namespace.object({
1595
+ asof: dateField(tool3, "asof").optional().describe("Optional as-of date for the screen."),
1596
+ format: referenceFormat(tool3).describe("JSON output shape. Usually omit."),
1597
+ group: nonEmptyString2(tool3, "group", options.maxStringChars, "General").optional().describe("Bloomberg BEQS group. Defaults to General in @xbbg/core."),
1598
+ kwargs: primitiveMap(tool3, "kwargs").describe(
1599
+ "Advanced BEQS request kwargs as flat string/number/boolean values only."
1600
+ ),
1601
+ overrides: primitiveMap(tool3, "overrides").describe(
1602
+ "BEQS overrides as flat string/number/boolean values only."
1603
+ ),
1604
+ screen: nonEmptyString2(
1605
+ tool3,
1606
+ "screen",
1607
+ options.maxStringChars,
1608
+ "Core Capital Goods Makers"
1609
+ ).describe("Existing Bloomberg BEQS screen name."),
1610
+ screenType: nonEmptyString2(tool3, "screenType", options.maxStringChars, "PRIVATE").optional().describe("Bloomberg BEQS screen type. Defaults to PRIVATE in @xbbg/core.")
1611
+ });
1612
+ }
1613
+ function createYasSchema(options) {
1614
+ const tool3 = "xbbg_yas";
1615
+ return z2__namespace.object({
1616
+ benchmark: nonEmptyString2(tool3, "benchmark", options.maxStringChars, "USGG10YR Index").optional().describe("Optional YAS benchmark."),
1617
+ fields: stringArray2(
1618
+ tool3,
1619
+ "fields",
1620
+ options.maxFields,
1621
+ options.maxStringChars,
1622
+ '["YAS_BOND_YLD"]'
1623
+ ).describe('YAS field mnemonics, for example ["YAS_BOND_YLD", "YAS_MOD_DUR"].'),
1624
+ price: z2__namespace.number().optional().describe("Optional YAS price input."),
1625
+ settleDt: dateField(tool3, "settleDt").optional().describe("Optional YAS settlement date."),
1626
+ spread: z2__namespace.number().optional().describe("Optional YAS spread input."),
1627
+ tickers: stringArray2(
1628
+ tool3,
1629
+ "tickers",
1630
+ options.maxSecurities,
1631
+ options.maxStringChars,
1632
+ '["/isin/US037833FB15 Corp"]'
1633
+ ).describe(
1634
+ 'Fully qualified fixed-income Bloomberg securities, for example ["/isin/US037833FB15 Corp"].'
1635
+ ),
1636
+ yieldType: z2__namespace.number().int().optional().describe("Optional YAS yield type."),
1637
+ yieldVal: z2__namespace.number().optional().describe("Optional YAS yield value input.")
1638
+ });
1639
+ }
1640
+ function createPreferredsSchema(options) {
1641
+ const tool3 = "xbbg_preferreds";
1642
+ return z2__namespace.object({
1643
+ equityTicker: nonEmptyString2(
1644
+ tool3,
1645
+ "equityTicker",
1646
+ options.maxStringChars,
1647
+ "AAPL US Equity"
1648
+ ).describe("One fully qualified issuer equity ticker."),
1649
+ fields: stringArray2(tool3, "fields", options.maxFields, options.maxStringChars, '["id"]').optional().describe("Optional fields to include in the preferreds recipe result.")
1650
+ });
1651
+ }
1652
+ function createCorporateBondsSchema(options) {
1653
+ const tool3 = "xbbg_corporate_bonds";
1654
+ return z2__namespace.object({
1655
+ activeOnly: z2__namespace.boolean().optional().describe("Restrict to active bonds. Defaults to true in @xbbg/core."),
1656
+ ccy: nonEmptyString2(tool3, "ccy", options.maxStringChars, "USD").optional().describe("Optional currency filter."),
1657
+ fields: stringArray2(tool3, "fields", options.maxFields, options.maxStringChars, '["id"]').optional().describe("Optional fields to include in the corporate bond result."),
1658
+ ticker: nonEmptyString2(tool3, "ticker", options.maxStringChars, "AAPL US Equity").describe(
1659
+ "One fully qualified issuer/company ticker."
1660
+ )
1661
+ });
1662
+ }
1663
+ function createIndexMembersSchema(options) {
1664
+ const tool3 = "xbbg_index_members";
1665
+ return z2__namespace.object({
1666
+ asof: dateField(tool3, "asof").optional().describe("Optional index membership as-of date."),
1667
+ field: z2__namespace.enum(["INDX_MWEIGHT", "INDX_MEMBERS", "INDX_MEMBERS3"]).optional().describe("Bloomberg index members field. Omit for @xbbg/core default."),
1668
+ index: nonEmptyString2(tool3, "index", options.maxStringChars, "SPX Index").describe(
1669
+ "One fully qualified Bloomberg index ticker."
1670
+ )
1671
+ });
1672
+ }
1673
+ function createResolveIsinsSchema(options) {
1674
+ const tool3 = "xbbg_resolve_isins";
1675
+ return z2__namespace.object({
1676
+ isins: stringArray2(
1677
+ tool3,
1678
+ "isins",
1679
+ options.maxSecurities,
1680
+ options.maxStringChars,
1681
+ '["US0378331005"]'
1682
+ ).describe("Raw ISIN strings to resolve. Do not add /isin/ prefixes for this recipe.")
1683
+ });
1684
+ }
1685
+ function createIssuerIsinsSchema(options) {
1686
+ const tool3 = "xbbg_issuer_isins";
1687
+ return z2__namespace.object({
1688
+ bondIsins: stringArray2(
1689
+ tool3,
1690
+ "bondIsins",
1691
+ options.maxSecurities,
1692
+ options.maxStringChars,
1693
+ '["US037833FB15"]'
1694
+ ).describe("Raw bond ISIN strings for issuer-level ISIN discovery.")
1695
+ });
1696
+ }
1697
+ function createEtfHoldingsSchema(options) {
1698
+ const tool3 = "xbbg_etf_holdings";
1699
+ return z2__namespace.object({
1700
+ etfTicker: nonEmptyString2(tool3, "etfTicker", options.maxStringChars, "SPY US Equity").describe(
1701
+ "One fully qualified Bloomberg ETF ticker."
1702
+ ),
1703
+ fields: stringArray2(tool3, "fields", options.maxFields, options.maxStringChars, '["id"]').optional().describe("Optional fields to include in the ETF holdings recipe result.")
1704
+ });
1705
+ }
1706
+ function snapshotControlFields(tool3, options) {
1707
+ return {
1708
+ allFields: z2__namespace.boolean().optional().describe("Request all Bloomberg fields when supported."),
1709
+ conflate: z2__namespace.boolean().optional().describe("Enable Bloomberg conflated streaming when supported."),
1710
+ drain: z2__namespace.boolean().optional().describe(
1711
+ "Pass drain=true to unsubscribe. Defaults to false; collected output remains bounded."
1712
+ ),
1713
+ flushThreshold: z2__namespace.number().int().positive().optional().describe("Optional stream flush threshold."),
1714
+ maxUpdates: z2__namespace.number().int(`${tool3}: maxUpdates must be a positive integer.`).positive(`${tool3}: maxUpdates must be greater than zero.`).max(
1715
+ options.maxStreamUpdates,
1716
+ `${tool3}: maxUpdates can be at most ${options.maxStreamUpdates}.`
1717
+ ).describe("Required maximum number of updates to collect before unsubscribing."),
1718
+ options: stringArray2(
1719
+ tool3,
1720
+ "options",
1721
+ options.maxFields,
1722
+ options.maxStringChars,
1723
+ '["interval=5"]'
1724
+ ).optional().describe("Advanced Bloomberg subscription options."),
1725
+ overflowPolicy: nonEmptyString2(tool3, "overflowPolicy", options.maxStringChars, "drop_oldest").optional().describe("Optional stream overflow policy."),
1726
+ streamCapacity: z2__namespace.number().int().positive().optional().describe("Optional stream capacity."),
1727
+ timeoutMs: z2__namespace.number().int().positive().max(options.maxStreamWaitMs, `${tool3}: timeoutMs can be at most ${options.maxStreamWaitMs}.`).optional().default(options.maxStreamWaitMs).describe("Maximum total wait in milliseconds before unsubscribing.")
1728
+ };
1729
+ }
1730
+ function createStreamSnapshotSchema(options) {
1731
+ const tool3 = "xbbg_stream_snapshot";
1732
+ return z2__namespace.object({
1733
+ fields: stringArray2(
1734
+ tool3,
1735
+ "fields",
1736
+ options.maxFields,
1737
+ options.maxStringChars,
1738
+ '["LAST_PRICE"]'
1739
+ ).describe("Bloomberg market-data fields to observe."),
1740
+ tickers: stringArray2(
1741
+ tool3,
1742
+ "tickers",
1743
+ options.maxSecurities,
1744
+ options.maxStringChars,
1745
+ '["AAPL US Equity"]'
1746
+ ).describe("Fully qualified Bloomberg securities to observe."),
1747
+ ...snapshotControlFields(tool3, options)
1748
+ });
1749
+ }
1750
+ function createMktbarSnapshotSchema(options) {
1751
+ const tool3 = "xbbg_mktbar_snapshot";
1752
+ return z2__namespace.object({
1753
+ fields: stringArray2(tool3, "fields", options.maxFields, options.maxStringChars, '["LAST_PRICE"]').optional().describe("Optional market-bar fields. Omit for Bloomberg defaults."),
1754
+ ticker: nonEmptyString2(tool3, "ticker", options.maxStringChars, "AAPL US Equity").describe(
1755
+ "One fully qualified Bloomberg security to observe."
1756
+ ),
1757
+ ...snapshotControlFields(tool3, options)
1758
+ });
1759
+ }
1760
+ function createDepthSnapshotSchema(options) {
1761
+ const tool3 = "xbbg_depth_snapshot";
1762
+ return z2__namespace.object({
1763
+ fields: stringArray2(tool3, "fields", options.maxFields, options.maxStringChars, '["BID"]').optional().describe("Optional market-depth fields. Omit for Bloomberg defaults."),
1764
+ ticker: nonEmptyString2(tool3, "ticker", options.maxStringChars, "AAPL US Equity").describe(
1765
+ "One fully qualified Bloomberg security to observe."
1766
+ ),
1767
+ ...snapshotControlFields(tool3, options)
1768
+ });
1769
+ }
1770
+
1771
+ // src/tools.ts
1772
+ function resultString2(resolver, name, value) {
1773
+ return createToolResult(name, value, resolver.options.maxRows, resolver.options.maxStringChars);
1774
+ }
1775
+ var STREAM_TIMEOUT = /* @__PURE__ */ Symbol("stream_timeout");
1776
+ function streamOptions(input) {
1777
+ return {
1778
+ allFields: input.allFields,
1779
+ conflate: input.conflate,
1780
+ fields: input.fields,
1781
+ flushThreshold: input.flushThreshold,
1782
+ options: input.options,
1783
+ overflowPolicy: input.overflowPolicy,
1784
+ streamCapacity: input.streamCapacity
1785
+ };
1786
+ }
1787
+ function isRecord(value) {
1788
+ return typeof value === "object" && value !== null;
1789
+ }
1790
+ function rowsFromArrowTable(value) {
1791
+ if (!isRecord(value)) {
1792
+ return void 0;
1793
+ }
1794
+ const toArray = value.toArray;
1795
+ if (typeof toArray === "function") {
1796
+ return Array.from(toArray.call(value));
1797
+ }
1798
+ const numRows = value.numRows;
1799
+ const get = value.get;
1800
+ if (typeof numRows === "number" && Number.isInteger(numRows) && typeof get === "function") {
1801
+ const rows = [];
1802
+ for (let index = 0; index < numRows; index += 1) {
1803
+ rows.push(get.call(value, index));
1804
+ }
1805
+ return rows;
1806
+ }
1807
+ return void 0;
1808
+ }
1809
+ function jsonCompatible(value) {
1810
+ if (typeof value === "bigint") {
1811
+ return value.toString();
1812
+ }
1813
+ if (value instanceof Date) {
1814
+ return value.toISOString();
1815
+ }
1816
+ if (Array.isArray(value)) {
1817
+ return value.map(jsonCompatible);
1818
+ }
1819
+ if (!isRecord(value)) {
1820
+ return value;
1821
+ }
1822
+ const toJSON = value.toJSON;
1823
+ if (typeof toJSON === "function") {
1824
+ return jsonCompatible(toJSON.call(value));
1825
+ }
1826
+ const output = {};
1827
+ for (const [key, entry] of Object.entries(value)) {
1828
+ output[key] = jsonCompatible(entry);
1829
+ }
1830
+ return output;
1831
+ }
1832
+ function normalizeStreamUpdate(value) {
1833
+ if (isRecord(value)) {
1834
+ const toObject = value.toObject;
1835
+ if (typeof toObject === "function") {
1836
+ return jsonCompatible(toObject.call(value));
1837
+ }
1838
+ }
1839
+ const rows = rowsFromArrowTable(value);
1840
+ return rows === void 0 ? jsonCompatible(value) : rows.map(jsonCompatible);
1841
+ }
1842
+ async function nextWithinTimeout(iterator, deadlineMs) {
1843
+ const remainingMs = deadlineMs - Date.now();
1844
+ if (remainingMs <= 0) {
1845
+ return STREAM_TIMEOUT;
1846
+ }
1847
+ const nextPromise = iterator.next();
1848
+ let timer;
1849
+ const timeoutPromise = new Promise((resolve) => {
1850
+ timer = setTimeout(() => resolve(STREAM_TIMEOUT), remainingMs);
1851
+ });
1852
+ const result = await Promise.race([nextPromise, timeoutPromise]);
1853
+ if (timer !== void 0) {
1854
+ clearTimeout(timer);
1855
+ }
1856
+ if (result === STREAM_TIMEOUT) {
1857
+ void nextPromise.catch(() => void 0);
1858
+ }
1859
+ return result;
1860
+ }
1861
+ async function unsubscribeSnapshot(subscription, drain, priorError) {
1862
+ try {
1863
+ await subscription.unsubscribe(drain);
1864
+ } catch (error) {
1865
+ if (priorError === void 0) {
1866
+ throw error;
1867
+ }
1868
+ }
1869
+ }
1870
+ async function collectSnapshot(subscription, input) {
1871
+ const updates = [];
1872
+ const deadlineMs = Date.now() + input.timeoutMs;
1873
+ let reason = "max_updates";
1874
+ let caught;
1875
+ try {
1876
+ while (updates.length < input.maxUpdates) {
1877
+ const next = await nextWithinTimeout(subscription, deadlineMs);
1878
+ if (next === STREAM_TIMEOUT) {
1879
+ reason = "timeout";
1880
+ break;
1881
+ }
1882
+ if (next.done === true) {
1883
+ reason = "done";
1884
+ break;
1885
+ }
1886
+ updates.push(normalizeStreamUpdate(next.value));
1887
+ }
1888
+ return {
1889
+ maxUpdates: input.maxUpdates,
1890
+ reason,
1891
+ timeoutMs: input.timeoutMs,
1892
+ updateCount: updates.length,
1893
+ updates
1894
+ };
1895
+ } catch (error) {
1896
+ caught = error;
1897
+ throw error;
1898
+ } finally {
1899
+ await unsubscribeSnapshot(subscription, input.drain === true, caught);
1900
+ }
1901
+ }
1902
+ function validationSetting(resolver, value) {
1903
+ return value ?? resolver.options.validateFields;
1904
+ }
1905
+ function enabledTool(resolver, name, creator) {
1906
+ return isToolDisabled(resolver.options, name) ? [] : [creator(resolver)];
1907
+ }
1908
+ function bdpWithResolver(resolver) {
1909
+ const name = "xbbg_bdp";
1910
+ return tools.tool(
1911
+ async (input) => {
1912
+ try {
1913
+ const engine = await resolver.getEngine();
1914
+ const result = await engine.bdp(input.securities, input.fields, {
1915
+ backend: "json",
1916
+ format: input.format,
1917
+ includeSecurityErrors: input.includeSecurityErrors,
1918
+ kwargs: input.kwargs,
1919
+ overrides: input.overrides,
1920
+ validateFields: validationSetting(resolver, input.validateFields)
1921
+ });
1922
+ return resultString2(resolver, name, result);
1923
+ } catch (error) {
1924
+ throwWithToolContext(name, error);
1925
+ }
1926
+ },
1927
+ {
1928
+ description: BDP_DESCRIPTION,
1929
+ name,
1930
+ responseFormat: "content_and_artifact",
1931
+ schema: createBdpSchema(resolver.options)
1932
+ }
1933
+ );
1934
+ }
1935
+ function bdhWithResolver(resolver) {
1936
+ const name = "xbbg_bdh";
1937
+ return tools.tool(
1938
+ async (input) => {
1939
+ try {
1940
+ const engine = await resolver.getEngine();
1941
+ const result = await engine.bdh(input.securities, input.fields, {
1942
+ backend: "json",
1943
+ end: input.end,
1944
+ format: input.format,
1945
+ kwargs: input.kwargs,
1946
+ overrides: input.overrides,
1947
+ start: input.start,
1948
+ validateFields: validationSetting(resolver, input.validateFields)
1949
+ });
1950
+ return resultString2(resolver, name, result);
1951
+ } catch (error) {
1952
+ throwWithToolContext(name, error);
1953
+ }
1954
+ },
1955
+ {
1956
+ description: BDH_DESCRIPTION,
1957
+ name,
1958
+ responseFormat: "content_and_artifact",
1959
+ schema: createBdhSchema(resolver.options)
1960
+ }
1961
+ );
1962
+ }
1963
+ function bdsWithResolver(resolver) {
1964
+ const name = "xbbg_bds";
1965
+ return tools.tool(
1966
+ async (input) => {
1967
+ try {
1968
+ const engine = await resolver.getEngine();
1969
+ const result = await engine.bds(input.securities, [input.field], {
1970
+ backend: "json",
1971
+ format: input.format,
1972
+ kwargs: input.kwargs,
1973
+ overrides: input.overrides,
1974
+ validateFields: validationSetting(resolver, input.validateFields)
1975
+ });
1976
+ return resultString2(resolver, name, result);
1977
+ } catch (error) {
1978
+ throwWithToolContext(name, error);
1979
+ }
1980
+ },
1981
+ {
1982
+ description: BDS_DESCRIPTION,
1983
+ name,
1984
+ responseFormat: "content_and_artifact",
1985
+ schema: createBdsSchema(resolver.options)
1986
+ }
1987
+ );
1988
+ }
1989
+ function bdibWithResolver(resolver) {
1990
+ const name = "xbbg_bdib";
1991
+ return tools.tool(
1992
+ async (input) => {
1993
+ try {
1994
+ const engine = await resolver.getEngine();
1995
+ const result = await engine.bdib(input.ticker, {
1996
+ backend: "json",
1997
+ end: input.end,
1998
+ eventType: input.eventType,
1999
+ interval: input.interval,
2000
+ kwargs: input.kwargs,
2001
+ outputTz: input.outputTz,
2002
+ requestTz: input.requestTz,
2003
+ start: input.start
2004
+ });
2005
+ return resultString2(resolver, name, result);
2006
+ } catch (error) {
2007
+ throwWithToolContext(name, error);
2008
+ }
2009
+ },
2010
+ {
2011
+ description: BDIB_DESCRIPTION,
2012
+ name,
2013
+ responseFormat: "content_and_artifact",
2014
+ schema: createBdibSchema(resolver.options)
2015
+ }
2016
+ );
2017
+ }
2018
+ function bdtickWithResolver(resolver) {
2019
+ const name = "xbbg_bdtick";
2020
+ return tools.tool(
2021
+ async (input) => {
2022
+ try {
2023
+ const engine = await resolver.getEngine();
2024
+ const result = await engine.bdtick(input.ticker, {
2025
+ backend: "json",
2026
+ end: input.end,
2027
+ eventTypes: input.eventTypes,
2028
+ includeBicMicCodes: input.includeBicMicCodes,
2029
+ includeBloombergStandardConditionCodes: input.includeBloombergStandardConditionCodes,
2030
+ includeBrokerCodes: input.includeBrokerCodes,
2031
+ includeConditionCodes: input.includeConditionCodes,
2032
+ includeExchangeCodes: input.includeExchangeCodes,
2033
+ includeNonPlottableEvents: input.includeNonPlottableEvents,
2034
+ includeRpsCodes: input.includeRpsCodes,
2035
+ kwargs: input.kwargs,
2036
+ outputTz: input.outputTz,
2037
+ requestTz: input.requestTz,
2038
+ start: input.start
2039
+ });
2040
+ return resultString2(resolver, name, result);
2041
+ } catch (error) {
2042
+ throwWithToolContext(name, error);
2043
+ }
2044
+ },
2045
+ {
2046
+ description: BDTICK_DESCRIPTION,
2047
+ name,
2048
+ responseFormat: "content_and_artifact",
2049
+ schema: createBdtickSchema(resolver.options)
2050
+ }
2051
+ );
2052
+ }
2053
+ function bqlWithResolver(resolver) {
2054
+ const name = "xbbg_bql";
2055
+ return tools.tool(
2056
+ async (input) => {
2057
+ try {
2058
+ const engine = await resolver.getEngine();
2059
+ const result = await engine.bql(input.query, {
2060
+ backend: "json",
2061
+ format: input.format,
2062
+ kwargs: input.kwargs
2063
+ });
2064
+ return resultString2(resolver, name, result);
2065
+ } catch (error) {
2066
+ throwWithToolContext(name, error);
2067
+ }
2068
+ },
2069
+ {
2070
+ description: BQL_DESCRIPTION,
2071
+ name,
2072
+ responseFormat: "content_and_artifact",
2073
+ schema: createBqlSchema(resolver.options)
2074
+ }
2075
+ );
2076
+ }
2077
+ function bsrchWithResolver(resolver) {
2078
+ const name = "xbbg_bsrch";
2079
+ return tools.tool(
2080
+ async (input) => {
2081
+ try {
2082
+ const engine = await resolver.getEngine();
2083
+ const result = await engine.bsrch(input.searchSpec, {
2084
+ backend: "json",
2085
+ format: input.format,
2086
+ kwargs: input.kwargs,
2087
+ overrides: input.overrides
2088
+ });
2089
+ return resultString2(resolver, name, result);
2090
+ } catch (error) {
2091
+ throwWithToolContext(name, error);
2092
+ }
2093
+ },
2094
+ {
2095
+ description: BSRCH_DESCRIPTION,
2096
+ name,
2097
+ responseFormat: "content_and_artifact",
2098
+ schema: createBsrchSchema(resolver.options)
2099
+ }
2100
+ );
2101
+ }
2102
+ function bqrWithResolver(resolver) {
2103
+ const name = "xbbg_bqr";
2104
+ return tools.tool(
2105
+ async (input) => {
2106
+ try {
2107
+ const engine = await resolver.getEngine();
2108
+ const result = await engine.bqr(input.ticker, {
2109
+ backend: "json",
2110
+ endDatetime: input.end,
2111
+ eventTypes: input.eventTypes,
2112
+ includeBrokerCodes: input.includeBrokerCodes,
2113
+ startDatetime: input.start
2114
+ });
2115
+ return resultString2(resolver, name, result);
2116
+ } catch (error) {
2117
+ throwWithToolContext(name, error);
2118
+ }
2119
+ },
2120
+ {
2121
+ description: BQR_DESCRIPTION,
2122
+ name,
2123
+ responseFormat: "content_and_artifact",
2124
+ schema: createBqrSchema(resolver.options)
2125
+ }
2126
+ );
2127
+ }
2128
+ function bfldsWithResolver(resolver) {
2129
+ const name = "xbbg_bflds";
2130
+ return tools.tool(
2131
+ async (input) => {
2132
+ try {
2133
+ const engine = await resolver.getEngine();
2134
+ const result = await engine.bflds({
2135
+ backend: "json",
2136
+ fields: input.fields,
2137
+ format: input.format,
2138
+ kwargs: input.kwargs,
2139
+ searchSpec: input.searchSpec
2140
+ });
2141
+ return resultString2(resolver, name, result);
2142
+ } catch (error) {
2143
+ throwWithToolContext(name, error);
2144
+ }
2145
+ },
2146
+ {
2147
+ description: BFLDS_DESCRIPTION,
2148
+ name,
2149
+ responseFormat: "content_and_artifact",
2150
+ schema: createBfldsSchema(resolver.options)
2151
+ }
2152
+ );
2153
+ }
2154
+ function beqsWithResolver(resolver) {
2155
+ const name = "xbbg_beqs";
2156
+ return tools.tool(
2157
+ async (input) => {
2158
+ try {
2159
+ const engine = await resolver.getEngine();
2160
+ const result = await engine.beqs(input.screen, {
2161
+ asof: input.asof,
2162
+ backend: "json",
2163
+ format: input.format,
2164
+ group: input.group,
2165
+ kwargs: input.kwargs,
2166
+ overrides: input.overrides,
2167
+ screenType: input.screenType
2168
+ });
2169
+ return resultString2(resolver, name, result);
2170
+ } catch (error) {
2171
+ throwWithToolContext(name, error);
2172
+ }
2173
+ },
2174
+ {
2175
+ description: BEQS_DESCRIPTION,
2176
+ name,
2177
+ responseFormat: "content_and_artifact",
2178
+ schema: createBeqsSchema(resolver.options)
2179
+ }
2180
+ );
2181
+ }
2182
+ function yasWithResolver(resolver) {
2183
+ const name = "xbbg_yas";
2184
+ return tools.tool(
2185
+ async (input) => {
2186
+ try {
2187
+ const engine = await resolver.getEngine();
2188
+ const result = await engine.yas(input.tickers, input.fields, {
2189
+ backend: "json",
2190
+ benchmark: input.benchmark,
2191
+ price: input.price,
2192
+ settleDt: input.settleDt,
2193
+ spread: input.spread,
2194
+ yieldType: input.yieldType,
2195
+ yieldVal: input.yieldVal
2196
+ });
2197
+ return resultString2(resolver, name, result);
2198
+ } catch (error) {
2199
+ throwWithToolContext(name, error);
2200
+ }
2201
+ },
2202
+ {
2203
+ description: YAS_DESCRIPTION,
2204
+ name,
2205
+ responseFormat: "content_and_artifact",
2206
+ schema: createYasSchema(resolver.options)
2207
+ }
2208
+ );
2209
+ }
2210
+ function preferredsWithResolver(resolver) {
2211
+ const name = "xbbg_preferreds";
2212
+ return tools.tool(
2213
+ async (input) => {
2214
+ try {
2215
+ const engine = await resolver.getEngine();
2216
+ const result = await engine.preferreds(input.equityTicker, {
2217
+ backend: "json",
2218
+ fields: input.fields
2219
+ });
2220
+ return resultString2(resolver, name, result);
2221
+ } catch (error) {
2222
+ throwWithToolContext(name, error);
2223
+ }
2224
+ },
2225
+ {
2226
+ description: PREFERREDS_DESCRIPTION,
2227
+ name,
2228
+ responseFormat: "content_and_artifact",
2229
+ schema: createPreferredsSchema(resolver.options)
2230
+ }
2231
+ );
2232
+ }
2233
+ function corporateBondsWithResolver(resolver) {
2234
+ const name = "xbbg_corporate_bonds";
2235
+ return tools.tool(
2236
+ async (input) => {
2237
+ try {
2238
+ const engine = await resolver.getEngine();
2239
+ const result = await engine.corporateBonds(input.ticker, {
2240
+ activeOnly: input.activeOnly,
2241
+ backend: "json",
2242
+ ccy: input.ccy,
2243
+ fields: input.fields
2244
+ });
2245
+ return resultString2(resolver, name, result);
2246
+ } catch (error) {
2247
+ throwWithToolContext(name, error);
2248
+ }
2249
+ },
2250
+ {
2251
+ description: CORPORATE_BONDS_DESCRIPTION,
2252
+ name,
2253
+ responseFormat: "content_and_artifact",
2254
+ schema: createCorporateBondsSchema(resolver.options)
2255
+ }
2256
+ );
2257
+ }
2258
+ function indexMembersWithResolver(resolver) {
2259
+ const name = "xbbg_index_members";
2260
+ return tools.tool(
2261
+ async (input) => {
2262
+ try {
2263
+ const engine = await resolver.getEngine();
2264
+ const result = await engine.indexMembers(input.index, {
2265
+ asof: input.asof,
2266
+ backend: "json",
2267
+ field: input.field
2268
+ });
2269
+ return resultString2(resolver, name, result);
2270
+ } catch (error) {
2271
+ throwWithToolContext(name, error);
2272
+ }
2273
+ },
2274
+ {
2275
+ description: INDEX_MEMBERS_DESCRIPTION,
2276
+ name,
2277
+ responseFormat: "content_and_artifact",
2278
+ schema: createIndexMembersSchema(resolver.options)
2279
+ }
2280
+ );
2281
+ }
2282
+ function resolveIsinsWithResolver(resolver) {
2283
+ const name = "xbbg_resolve_isins";
2284
+ return tools.tool(
2285
+ async (input) => {
2286
+ try {
2287
+ const engine = await resolver.getEngine();
2288
+ const result = await engine.resolveIsins(input.isins, { backend: "json" });
2289
+ return resultString2(resolver, name, result);
2290
+ } catch (error) {
2291
+ throwWithToolContext(name, error);
2292
+ }
2293
+ },
2294
+ {
2295
+ description: RESOLVE_ISINS_DESCRIPTION,
2296
+ name,
2297
+ responseFormat: "content_and_artifact",
2298
+ schema: createResolveIsinsSchema(resolver.options)
2299
+ }
2300
+ );
2301
+ }
2302
+ function issuerIsinsWithResolver(resolver) {
2303
+ const name = "xbbg_issuer_isins";
2304
+ return tools.tool(
2305
+ async (input) => {
2306
+ try {
2307
+ const engine = await resolver.getEngine();
2308
+ const result = await engine.issuerIsins(input.bondIsins, { backend: "json" });
2309
+ return resultString2(resolver, name, result);
2310
+ } catch (error) {
2311
+ throwWithToolContext(name, error);
2312
+ }
2313
+ },
2314
+ {
2315
+ description: ISSUER_ISINS_DESCRIPTION,
2316
+ name,
2317
+ responseFormat: "content_and_artifact",
2318
+ schema: createIssuerIsinsSchema(resolver.options)
2319
+ }
2320
+ );
2321
+ }
2322
+ function etfHoldingsWithResolver(resolver) {
2323
+ const name = "xbbg_etf_holdings";
2324
+ return tools.tool(
2325
+ async (input) => {
2326
+ try {
2327
+ const engine = await resolver.getEngine();
2328
+ const result = await engine.etfHoldings(input.etfTicker, {
2329
+ backend: "json",
2330
+ fields: input.fields
2331
+ });
2332
+ return resultString2(resolver, name, result);
2333
+ } catch (error) {
2334
+ throwWithToolContext(name, error);
2335
+ }
2336
+ },
2337
+ {
2338
+ description: ETF_HOLDINGS_DESCRIPTION,
2339
+ name,
2340
+ responseFormat: "content_and_artifact",
2341
+ schema: createEtfHoldingsSchema(resolver.options)
2342
+ }
2343
+ );
2344
+ }
2345
+ function streamSnapshotWithResolver(resolver) {
2346
+ const name = "xbbg_stream_snapshot";
2347
+ return tools.tool(
2348
+ async (input) => {
2349
+ try {
2350
+ const engine = await resolver.getEngine();
2351
+ const subscription = await engine.stream(input.tickers, input.fields, streamOptions(input));
2352
+ const result = await collectSnapshot(subscription, input);
2353
+ return resultString2(resolver, name, result);
2354
+ } catch (error) {
2355
+ throwWithToolContext(name, error);
2356
+ }
2357
+ },
2358
+ {
2359
+ description: STREAM_SNAPSHOT_DESCRIPTION,
2360
+ name,
2361
+ responseFormat: "content_and_artifact",
2362
+ schema: createStreamSnapshotSchema(resolver.options)
2363
+ }
2364
+ );
2365
+ }
2366
+ function mktbarSnapshotWithResolver(resolver) {
2367
+ const name = "xbbg_mktbar_snapshot";
2368
+ return tools.tool(
2369
+ async (input) => {
2370
+ try {
2371
+ const engine = await resolver.getEngine();
2372
+ const subscription = await engine.mktbar(input.ticker, streamOptions(input));
2373
+ const result = await collectSnapshot(subscription, input);
2374
+ return resultString2(resolver, name, result);
2375
+ } catch (error) {
2376
+ throwWithToolContext(name, error);
2377
+ }
2378
+ },
2379
+ {
2380
+ description: MKTBAR_SNAPSHOT_DESCRIPTION,
2381
+ name,
2382
+ responseFormat: "content_and_artifact",
2383
+ schema: createMktbarSnapshotSchema(resolver.options)
2384
+ }
2385
+ );
2386
+ }
2387
+ function depthSnapshotWithResolver(resolver) {
2388
+ const name = "xbbg_depth_snapshot";
2389
+ return tools.tool(
2390
+ async (input) => {
2391
+ try {
2392
+ const engine = await resolver.getEngine();
2393
+ const subscription = await engine.depth(input.ticker, streamOptions(input));
2394
+ const result = await collectSnapshot(subscription, input);
2395
+ return resultString2(resolver, name, result);
2396
+ } catch (error) {
2397
+ throwWithToolContext(name, error);
2398
+ }
2399
+ },
2400
+ {
2401
+ description: DEPTH_SNAPSHOT_DESCRIPTION,
2402
+ name,
2403
+ responseFormat: "content_and_artifact",
2404
+ schema: createDepthSnapshotSchema(resolver.options)
2405
+ }
2406
+ );
2407
+ }
2408
+ function createBdpTool(options = {}) {
2409
+ return bdpWithResolver(createCoreResolver(options));
2410
+ }
2411
+ function createBdhTool(options = {}) {
2412
+ return bdhWithResolver(createCoreResolver(options));
2413
+ }
2414
+ function createBdsTool(options = {}) {
2415
+ return bdsWithResolver(createCoreResolver(options));
2416
+ }
2417
+ function createBdibTool(options = {}) {
2418
+ return bdibWithResolver(createCoreResolver(options));
2419
+ }
2420
+ function createBdtickTool(options = {}) {
2421
+ return bdtickWithResolver(createCoreResolver(options));
2422
+ }
2423
+ function createBqlTool(options = {}) {
2424
+ return bqlWithResolver(createCoreResolver(options));
2425
+ }
2426
+ function createBsrchTool(options = {}) {
2427
+ return bsrchWithResolver(createCoreResolver(options));
2428
+ }
2429
+ function createBqrTool(options = {}) {
2430
+ return bqrWithResolver(createCoreResolver(options));
2431
+ }
2432
+ function createBfldsTool(options = {}) {
2433
+ return bfldsWithResolver(createCoreResolver(options));
2434
+ }
2435
+ function createBeqsTool(options = {}) {
2436
+ return beqsWithResolver(createCoreResolver(options));
2437
+ }
2438
+ function createYasTool(options = {}) {
2439
+ return yasWithResolver(createCoreResolver(options));
2440
+ }
2441
+ function createPreferredsTool(options = {}) {
2442
+ return preferredsWithResolver(createCoreResolver(options));
2443
+ }
2444
+ function createCorporateBondsTool(options = {}) {
2445
+ return corporateBondsWithResolver(createCoreResolver(options));
2446
+ }
2447
+ function createIndexMembersTool(options = {}) {
2448
+ return indexMembersWithResolver(createCoreResolver(options));
2449
+ }
2450
+ function createResolveIsinsTool(options = {}) {
2451
+ return resolveIsinsWithResolver(createCoreResolver(options));
2452
+ }
2453
+ function createIssuerIsinsTool(options = {}) {
2454
+ return issuerIsinsWithResolver(createCoreResolver(options));
2455
+ }
2456
+ function createEtfHoldingsTool(options = {}) {
2457
+ return etfHoldingsWithResolver(createCoreResolver(options));
2458
+ }
2459
+ function createStreamSnapshotTool(options = {}) {
2460
+ return streamSnapshotWithResolver(createCoreResolver(options));
2461
+ }
2462
+ function createMktbarSnapshotTool(options = {}) {
2463
+ return mktbarSnapshotWithResolver(createCoreResolver(options));
2464
+ }
2465
+ function createDepthSnapshotTool(options = {}) {
2466
+ return depthSnapshotWithResolver(createCoreResolver(options));
2467
+ }
2468
+ function createBloombergToolsForResolver(resolver) {
2469
+ return [
2470
+ ...enabledTool(resolver, "xbbg_bdp", bdpWithResolver),
2471
+ ...enabledTool(resolver, "xbbg_bdh", bdhWithResolver),
2472
+ ...enabledTool(resolver, "xbbg_bds", bdsWithResolver),
2473
+ ...enabledTool(resolver, "xbbg_bdib", bdibWithResolver),
2474
+ ...enabledTool(resolver, "xbbg_bdtick", bdtickWithResolver),
2475
+ ...enabledTool(resolver, "xbbg_bql", bqlWithResolver),
2476
+ ...enabledTool(resolver, "xbbg_bsrch", bsrchWithResolver),
2477
+ ...enabledTool(resolver, "xbbg_bqr", bqrWithResolver),
2478
+ ...enabledTool(resolver, "xbbg_bflds", bfldsWithResolver),
2479
+ ...enabledTool(resolver, "xbbg_beqs", beqsWithResolver),
2480
+ ...enabledTool(resolver, "xbbg_yas", yasWithResolver),
2481
+ ...enabledTool(resolver, "xbbg_preferreds", preferredsWithResolver),
2482
+ ...enabledTool(resolver, "xbbg_corporate_bonds", corporateBondsWithResolver),
2483
+ ...enabledTool(resolver, "xbbg_index_members", indexMembersWithResolver),
2484
+ ...enabledTool(resolver, "xbbg_resolve_isins", resolveIsinsWithResolver),
2485
+ ...enabledTool(resolver, "xbbg_issuer_isins", issuerIsinsWithResolver),
2486
+ ...enabledTool(resolver, "xbbg_etf_holdings", etfHoldingsWithResolver),
2487
+ ...enabledTool(resolver, "xbbg_stream_snapshot", streamSnapshotWithResolver),
2488
+ ...enabledTool(resolver, "xbbg_mktbar_snapshot", mktbarSnapshotWithResolver),
2489
+ ...enabledTool(resolver, "xbbg_depth_snapshot", depthSnapshotWithResolver)
2490
+ ];
2491
+ }
2492
+ function createBloombergTools(options = {}) {
2493
+ return createBloombergToolsForResolver(createCoreResolver(options));
2494
+ }
2495
+
2496
+ // src/index.ts
2497
+ function createAllBloombergTools(options = {}) {
2498
+ const resolver = createCoreResolver(options);
2499
+ return [
2500
+ ...createBloombergToolsForResolver(resolver),
2501
+ ...createBloombergExtToolsForResolver(resolver)
2502
+ ];
2503
+ }
2504
+
2505
+ exports.BLOOMBERG_EXT_TOOL_NAMES = BLOOMBERG_EXT_TOOL_NAMES;
2506
+ exports.BLOOMBERG_TOOL_INSTRUCTIONS = BLOOMBERG_TOOL_INSTRUCTIONS;
2507
+ exports.BLOOMBERG_TOOL_NAMES = BLOOMBERG_TOOL_NAMES;
2508
+ exports.createAllBloombergTools = createAllBloombergTools;
2509
+ exports.createBdhTool = createBdhTool;
2510
+ exports.createBdibTool = createBdibTool;
2511
+ exports.createBdpTool = createBdpTool;
2512
+ exports.createBdsTool = createBdsTool;
2513
+ exports.createBdtickTool = createBdtickTool;
2514
+ exports.createBeqsTool = createBeqsTool;
2515
+ exports.createBfldsTool = createBfldsTool;
2516
+ exports.createBloombergExtTools = createBloombergExtTools;
2517
+ exports.createBloombergTools = createBloombergTools;
2518
+ exports.createBqlTool = createBqlTool;
2519
+ exports.createBqrTool = createBqrTool;
2520
+ exports.createBsrchTool = createBsrchTool;
2521
+ exports.createCorporateBondsTool = createCorporateBondsTool;
2522
+ exports.createDepthSnapshotTool = createDepthSnapshotTool;
2523
+ exports.createEtfHoldingsTool = createEtfHoldingsTool;
2524
+ exports.createExtBqlBuilderTool = createExtBqlBuilderTool;
2525
+ exports.createExtCalculateTool = createExtCalculateTool;
2526
+ exports.createExtCdxTool = createExtCdxTool;
2527
+ exports.createExtColumnsTool = createExtColumnsTool;
2528
+ exports.createExtConstantsTool = createExtConstantsTool;
2529
+ exports.createExtCurrencyTool = createExtCurrencyTool;
2530
+ exports.createExtFuturesTool = createExtFuturesTool;
2531
+ exports.createExtMarketSessionTool = createExtMarketSessionTool;
2532
+ exports.createExtTickerTool = createExtTickerTool;
2533
+ exports.createExtYasOverridesTool = createExtYasOverridesTool;
2534
+ exports.createIndexMembersTool = createIndexMembersTool;
2535
+ exports.createIssuerIsinsTool = createIssuerIsinsTool;
2536
+ exports.createMktbarSnapshotTool = createMktbarSnapshotTool;
2537
+ exports.createPreferredsTool = createPreferredsTool;
2538
+ exports.createResolveIsinsTool = createResolveIsinsTool;
2539
+ exports.createStreamSnapshotTool = createStreamSnapshotTool;
2540
+ exports.createYasTool = createYasTool;
2541
+ exports.getBloombergToolInstructions = getBloombergToolInstructions;
2542
+ //# sourceMappingURL=index.js.map
2543
+ //# sourceMappingURL=index.js.map