llmist 0.6.0 → 0.6.2

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.
@@ -629,7 +629,9 @@ This content can contain:
629
629
  - Multiple paragraphs
630
630
  EOF
631
631
 
632
- The delimiter (EOF) can be any identifier. The closing delimiter must be on its own line.`);
632
+ The delimiter (EOF) can be any identifier. The closing delimiter must be on its own line.
633
+ IMPORTANT: Content inside heredoc is LITERAL - do NOT escape backticks, dollar signs, or any characters.
634
+ NEVER use TOML triple-quote strings ("""). ALWAYS use heredoc syntax (<<<EOF...EOF) for multiline content.`);
633
635
  }
634
636
  return parts.join("");
635
637
  }
@@ -677,9 +679,9 @@ ${this.endPrefix}`
677
679
  if (format === "toml") {
678
680
  return Object.entries(parameters).map(([key, value]) => {
679
681
  if (typeof value === "string" && value.includes("\n")) {
680
- return `${key} = """
682
+ return `${key} = <<<EOF
681
683
  ${value}
682
- """`;
684
+ EOF`;
683
685
  }
684
686
  return `${key} = ${JSON.stringify(value)}`;
685
687
  }).join("\n");
@@ -1499,7 +1501,8 @@ var init_executor = __esm({
1499
1501
  if (call.parseError || !call.parameters) {
1500
1502
  this.logger.error("Gadget parameter parse error", {
1501
1503
  gadgetName: call.gadgetName,
1502
- parseError: call.parseError
1504
+ parseError: call.parseError,
1505
+ rawParameters: call.parametersYaml
1503
1506
  });
1504
1507
  return {
1505
1508
  gadgetName: call.gadgetName,
@@ -1780,6 +1783,9 @@ function preprocessYaml(yamlStr) {
1780
1783
  }
1781
1784
  return result.join("\n");
1782
1785
  }
1786
+ function unescapeHeredocContent(content) {
1787
+ return content.replace(/\\`/g, "`").replace(/\\\$/g, "$").replace(/\\{/g, "{").replace(/\\}/g, "}");
1788
+ }
1783
1789
  function preprocessTomlHeredoc(tomlStr) {
1784
1790
  const lines = tomlStr.split("\n");
1785
1791
  const result = [];
@@ -1805,13 +1811,13 @@ function preprocessTomlHeredoc(tomlStr) {
1805
1811
  i++;
1806
1812
  }
1807
1813
  if (bodyLines.length === 0) {
1808
- result.push(`${indent}${key} = """"""`);
1814
+ result.push(`${indent}${key} = ''''''`);
1809
1815
  } else {
1810
- result.push(`${indent}${key} = """`);
1816
+ result.push(`${indent}${key} = '''`);
1811
1817
  for (let j = 0; j < bodyLines.length - 1; j++) {
1812
- result.push(bodyLines[j]);
1818
+ result.push(unescapeHeredocContent(bodyLines[j]));
1813
1819
  }
1814
- result.push(`${bodyLines[bodyLines.length - 1]}"""`);
1820
+ result.push(`${unescapeHeredocContent(bodyLines[bodyLines.length - 1])}'''`);
1815
1821
  }
1816
1822
  if (!foundClosing) {
1817
1823
  }
@@ -1858,6 +1864,19 @@ var init_parser = __esm({
1858
1864
  }
1859
1865
  return { actualName: gadgetName, invocationId: `gadget_${++globalInvocationCounter}` };
1860
1866
  }
1867
+ /**
1868
+ * Truncate verbose parse errors to avoid context overflow.
1869
+ * Keeps first meaningful line and limits total length.
1870
+ */
1871
+ truncateParseError(error, format) {
1872
+ const message = error instanceof Error ? error.message : String(error);
1873
+ const firstLine = message.split("\n")[0];
1874
+ const maxLen = 200;
1875
+ if (firstLine.length <= maxLen) {
1876
+ return firstLine;
1877
+ }
1878
+ return `${firstLine.slice(0, maxLen)}... (${message.length} chars total)`;
1879
+ }
1861
1880
  /**
1862
1881
  * Parse parameter string according to configured format
1863
1882
  */
@@ -1866,21 +1885,21 @@ var init_parser = __esm({
1866
1885
  try {
1867
1886
  return { parameters: JSON.parse(raw) };
1868
1887
  } catch (error) {
1869
- return { parseError: error instanceof Error ? error.message : "Failed to parse JSON" };
1888
+ return { parseError: this.truncateParseError(error, "JSON") };
1870
1889
  }
1871
1890
  }
1872
1891
  if (this.parameterFormat === "yaml") {
1873
1892
  try {
1874
1893
  return { parameters: yaml2.load(preprocessYaml(raw)) };
1875
1894
  } catch (error) {
1876
- return { parseError: error instanceof Error ? error.message : "Failed to parse YAML" };
1895
+ return { parseError: this.truncateParseError(error, "YAML") };
1877
1896
  }
1878
1897
  }
1879
1898
  if (this.parameterFormat === "toml") {
1880
1899
  try {
1881
1900
  return { parameters: parseToml(preprocessTomlHeredoc(raw)) };
1882
1901
  } catch (error) {
1883
- return { parseError: error instanceof Error ? error.message : "Failed to parse TOML" };
1902
+ return { parseError: this.truncateParseError(error, "TOML") };
1884
1903
  }
1885
1904
  }
1886
1905
  try {
@@ -1892,9 +1911,7 @@ var init_parser = __esm({
1892
1911
  try {
1893
1912
  return { parameters: yaml2.load(preprocessYaml(raw)) };
1894
1913
  } catch (error) {
1895
- return {
1896
- parseError: error instanceof Error ? error.message : "Failed to parse as JSON, TOML, or YAML"
1897
- };
1914
+ return { parseError: this.truncateParseError(error, "auto") };
1898
1915
  }
1899
1916
  }
1900
1917
  }
@@ -2350,7 +2367,8 @@ var init_stream_processor = __esm({
2350
2367
  if (call.parseError) {
2351
2368
  this.logger.warn("Gadget has parse error", {
2352
2369
  gadgetName: call.gadgetName,
2353
- error: call.parseError
2370
+ error: call.parseError,
2371
+ rawParameters: call.parametersYaml
2354
2372
  });
2355
2373
  const shouldContinue = await this.checkContinueAfterError(
2356
2374
  call.parseError,
@@ -5326,4 +5344,4 @@ export {
5326
5344
  AgentBuilder,
5327
5345
  init_builder
5328
5346
  };
5329
- //# sourceMappingURL=chunk-KB7LMYC2.js.map
5347
+ //# sourceMappingURL=chunk-DVK6ZQOV.js.map