@xbbg/langgraph 1.3.1 → 1.4.1

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 CHANGED
@@ -888,7 +888,7 @@ var OPTIONAL_LIMIT_INSTRUCTIONS = [
888
888
  "## Request limits and inputs",
889
889
  "- Keep Bloomberg requests bounded: explicit securities, explicit fields, explicit dates, limited rows, and no broad exploratory pulls unless the user narrows the universe.",
890
890
  "- 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.",
891
- "- Use flat primitive overrides and kwargs only: string, number, or boolean values. Do not send nested objects, arrays, or inferred defaults as overrides."
891
+ "- Use primitive kwargs only: string, number, or boolean values. For overrides on xbbg_bdp/xbbg_bdh/xbbg_bds, use primitive values for global overrides and nested primitive maps keyed by exact security for per-security overrides. Do not send other nested objects, arrays, or inferred defaults."
892
892
  ];
893
893
  var BLOOMBERG_TOOL_INSTRUCTIONS = [
894
894
  ...REQUIRED_TOOL_INSTRUCTIONS,
@@ -1820,6 +1820,60 @@ function primitiveMap(tool2, field) {
1820
1820
  return normalized;
1821
1821
  });
1822
1822
  }
1823
+ function overridesMap(tool2, field) {
1824
+ return z__namespace.record(
1825
+ z__namespace.string().min(1),
1826
+ z__namespace.union([primitiveSchema, z__namespace.record(z__namespace.string().min(1), primitiveSchema)])
1827
+ ).optional().transform((value, context) => {
1828
+ if (value === void 0) {
1829
+ return void 0;
1830
+ }
1831
+ const normalized = {};
1832
+ for (const [key, entry] of Object.entries(value)) {
1833
+ const normalizedKey = key.trim();
1834
+ if (normalizedKey.length === 0) {
1835
+ return normalizationIssue(context, tool2, field, new TypeError("contains an empty key"));
1836
+ }
1837
+ if (typeof entry !== "object") {
1838
+ if (typeof entry === "string" && entry.length === 0) {
1839
+ return normalizationIssue(
1840
+ context,
1841
+ tool2,
1842
+ field,
1843
+ new TypeError(`${normalizedKey} must not be an empty string`)
1844
+ );
1845
+ }
1846
+ normalized[normalizedKey] = entry;
1847
+ continue;
1848
+ }
1849
+ const normalizedOverrides = {};
1850
+ for (const [overrideKey, overrideValue] of Object.entries(entry)) {
1851
+ const normalizedOverrideKey = overrideKey.trim();
1852
+ if (normalizedOverrideKey.length === 0) {
1853
+ return normalizationIssue(
1854
+ context,
1855
+ tool2,
1856
+ field,
1857
+ new TypeError(`${normalizedKey} contains an empty override key`)
1858
+ );
1859
+ }
1860
+ if (typeof overrideValue === "string" && overrideValue.length === 0) {
1861
+ return normalizationIssue(
1862
+ context,
1863
+ tool2,
1864
+ field,
1865
+ new TypeError(
1866
+ `${normalizedKey}.${normalizedOverrideKey} must not be an empty string`
1867
+ )
1868
+ );
1869
+ }
1870
+ normalizedOverrides[normalizedOverrideKey] = overrideValue;
1871
+ }
1872
+ normalized[normalizedKey] = normalizedOverrides;
1873
+ }
1874
+ return normalized;
1875
+ });
1876
+ }
1823
1877
  function dateField(tool2, field) {
1824
1878
  return z__namespace.union([z__namespace.string(), z__namespace.number()]).transform((value, context) => {
1825
1879
  try {
@@ -1882,8 +1936,8 @@ function createBdpSchema(options) {
1882
1936
  kwargs: primitiveMap(tool2, "kwargs").describe(
1883
1937
  "Advanced Bloomberg request kwargs as flat string/number/boolean values only."
1884
1938
  ),
1885
- overrides: primitiveMap(tool2, "overrides").describe(
1886
- "Bloomberg field overrides as flat string/number/boolean values only."
1939
+ overrides: overridesMap(tool2, "overrides").describe(
1940
+ "Bloomberg field overrides. Use primitive values for global overrides and nested primitive maps keyed by exact security for per-security overrides."
1887
1941
  ),
1888
1942
  securities: stringArray2(
1889
1943
  tool2,
@@ -1914,8 +1968,8 @@ function createBdhSchema(options) {
1914
1968
  kwargs: primitiveMap(tool2, "kwargs").describe(
1915
1969
  "Advanced Bloomberg request kwargs as flat string/number/boolean values only."
1916
1970
  ),
1917
- overrides: primitiveMap(tool2, "overrides").describe(
1918
- "Bloomberg overrides as flat string/number/boolean values only."
1971
+ overrides: overridesMap(tool2, "overrides").describe(
1972
+ "Bloomberg overrides. Use primitive values for global overrides and nested primitive maps keyed by exact security for per-security overrides."
1919
1973
  ),
1920
1974
  securities: stringArray2(
1921
1975
  tool2,
@@ -1947,8 +2001,8 @@ function createBdsSchema(options) {
1947
2001
  kwargs: primitiveMap(tool2, "kwargs").describe(
1948
2002
  "Advanced Bloomberg request kwargs as flat string/number/boolean values only."
1949
2003
  ),
1950
- overrides: primitiveMap(tool2, "overrides").describe(
1951
- "Bloomberg overrides as flat string/number/boolean values only."
2004
+ overrides: overridesMap(tool2, "overrides").describe(
2005
+ "Bloomberg overrides. Use primitive values for global overrides and nested primitive maps keyed by exact security for per-security overrides."
1952
2006
  ),
1953
2007
  securities: stringArray2(
1954
2008
  tool2,
@@ -2488,14 +2542,15 @@ function bdpWithResolver(resolver) {
2488
2542
  async (input) => {
2489
2543
  try {
2490
2544
  const engine = await resolver.getEngine();
2491
- const result = await engine.bdp(input.securities, input.fields, {
2545
+ const options = {
2492
2546
  backend: "json",
2493
2547
  format: input.format,
2494
2548
  includeSecurityErrors: input.includeSecurityErrors,
2495
2549
  kwargs: input.kwargs,
2496
2550
  overrides: input.overrides,
2497
2551
  validateFields: validationSetting(resolver, input.validateFields)
2498
- });
2552
+ };
2553
+ const result = await engine.bdp(input.securities, input.fields, options);
2499
2554
  return resultString2(resolver, name, result);
2500
2555
  } catch (error) {
2501
2556
  throwWithToolContext(name, error);
@@ -2515,7 +2570,7 @@ function bdhWithResolver(resolver) {
2515
2570
  async (input) => {
2516
2571
  try {
2517
2572
  const engine = await resolver.getEngine();
2518
- const result = await engine.bdh(input.securities, input.fields, {
2573
+ const options = {
2519
2574
  backend: "json",
2520
2575
  end: input.end,
2521
2576
  format: input.format,
@@ -2523,7 +2578,8 @@ function bdhWithResolver(resolver) {
2523
2578
  overrides: input.overrides,
2524
2579
  start: input.start,
2525
2580
  validateFields: validationSetting(resolver, input.validateFields)
2526
- });
2581
+ };
2582
+ const result = await engine.bdh(input.securities, input.fields, options);
2527
2583
  return resultString2(resolver, name, result);
2528
2584
  } catch (error) {
2529
2585
  throwWithToolContext(name, error);
@@ -2543,12 +2599,13 @@ function bdsWithResolver(resolver) {
2543
2599
  async (input) => {
2544
2600
  try {
2545
2601
  const engine = await resolver.getEngine();
2546
- const result = await engine.bds(input.securities, [input.field], {
2602
+ const options = {
2547
2603
  backend: "json",
2548
2604
  kwargs: input.kwargs,
2549
2605
  overrides: input.overrides,
2550
2606
  validateFields: validationSetting(resolver, input.validateFields)
2551
- });
2607
+ };
2608
+ const result = await engine.bds(input.securities, [input.field], options);
2552
2609
  return resultString2(resolver, name, result);
2553
2610
  } catch (error) {
2554
2611
  throwWithToolContext(name, error);