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.
@@ -8,7 +8,7 @@ import {
8
8
  init_constants,
9
9
  init_gadget,
10
10
  init_logger
11
- } from "./chunk-KB7LMYC2.js";
11
+ } from "./chunk-DVK6ZQOV.js";
12
12
 
13
13
  // src/gadgets/validation.ts
14
14
  function validateAndApplyDefaults(schema, params) {
@@ -900,4 +900,4 @@ export {
900
900
  MockGadgetBuilder,
901
901
  mockGadget
902
902
  };
903
- //# sourceMappingURL=chunk-YWJSGEYT.js.map
903
+ //# sourceMappingURL=chunk-TSR25DAY.js.map
package/dist/cli.cjs CHANGED
@@ -625,7 +625,9 @@ This content can contain:
625
625
  - Multiple paragraphs
626
626
  EOF
627
627
 
628
- The delimiter (EOF) can be any identifier. The closing delimiter must be on its own line.`);
628
+ The delimiter (EOF) can be any identifier. The closing delimiter must be on its own line.
629
+ IMPORTANT: Content inside heredoc is LITERAL - do NOT escape backticks, dollar signs, or any characters.
630
+ NEVER use TOML triple-quote strings ("""). ALWAYS use heredoc syntax (<<<EOF...EOF) for multiline content.`);
629
631
  }
630
632
  return parts.join("");
631
633
  }
@@ -673,9 +675,9 @@ ${this.endPrefix}`
673
675
  if (format === "toml") {
674
676
  return Object.entries(parameters).map(([key, value]) => {
675
677
  if (typeof value === "string" && value.includes("\n")) {
676
- return `${key} = """
678
+ return `${key} = <<<EOF
677
679
  ${value}
678
- """`;
680
+ EOF`;
679
681
  }
680
682
  return `${key} = ${JSON.stringify(value)}`;
681
683
  }).join("\n");
@@ -1632,7 +1634,8 @@ var init_executor = __esm({
1632
1634
  if (call.parseError || !call.parameters) {
1633
1635
  this.logger.error("Gadget parameter parse error", {
1634
1636
  gadgetName: call.gadgetName,
1635
- parseError: call.parseError
1637
+ parseError: call.parseError,
1638
+ rawParameters: call.parametersYaml
1636
1639
  });
1637
1640
  return {
1638
1641
  gadgetName: call.gadgetName,
@@ -1911,6 +1914,9 @@ function preprocessYaml(yamlStr) {
1911
1914
  }
1912
1915
  return result.join("\n");
1913
1916
  }
1917
+ function unescapeHeredocContent(content) {
1918
+ return content.replace(/\\`/g, "`").replace(/\\\$/g, "$").replace(/\\{/g, "{").replace(/\\}/g, "}");
1919
+ }
1914
1920
  function preprocessTomlHeredoc(tomlStr) {
1915
1921
  const lines = tomlStr.split("\n");
1916
1922
  const result = [];
@@ -1936,13 +1942,13 @@ function preprocessTomlHeredoc(tomlStr) {
1936
1942
  i++;
1937
1943
  }
1938
1944
  if (bodyLines.length === 0) {
1939
- result.push(`${indent}${key} = """"""`);
1945
+ result.push(`${indent}${key} = ''''''`);
1940
1946
  } else {
1941
- result.push(`${indent}${key} = """`);
1947
+ result.push(`${indent}${key} = '''`);
1942
1948
  for (let j = 0; j < bodyLines.length - 1; j++) {
1943
- result.push(bodyLines[j]);
1949
+ result.push(unescapeHeredocContent(bodyLines[j]));
1944
1950
  }
1945
- result.push(`${bodyLines[bodyLines.length - 1]}"""`);
1951
+ result.push(`${unescapeHeredocContent(bodyLines[bodyLines.length - 1])}'''`);
1946
1952
  }
1947
1953
  if (!foundClosing) {
1948
1954
  }
@@ -1991,6 +1997,19 @@ var init_parser = __esm({
1991
1997
  }
1992
1998
  return { actualName: gadgetName, invocationId: `gadget_${++globalInvocationCounter}` };
1993
1999
  }
2000
+ /**
2001
+ * Truncate verbose parse errors to avoid context overflow.
2002
+ * Keeps first meaningful line and limits total length.
2003
+ */
2004
+ truncateParseError(error, format) {
2005
+ const message = error instanceof Error ? error.message : String(error);
2006
+ const firstLine = message.split("\n")[0];
2007
+ const maxLen = 200;
2008
+ if (firstLine.length <= maxLen) {
2009
+ return firstLine;
2010
+ }
2011
+ return `${firstLine.slice(0, maxLen)}... (${message.length} chars total)`;
2012
+ }
1994
2013
  /**
1995
2014
  * Parse parameter string according to configured format
1996
2015
  */
@@ -1999,21 +2018,21 @@ var init_parser = __esm({
1999
2018
  try {
2000
2019
  return { parameters: JSON.parse(raw) };
2001
2020
  } catch (error) {
2002
- return { parseError: error instanceof Error ? error.message : "Failed to parse JSON" };
2021
+ return { parseError: this.truncateParseError(error, "JSON") };
2003
2022
  }
2004
2023
  }
2005
2024
  if (this.parameterFormat === "yaml") {
2006
2025
  try {
2007
2026
  return { parameters: yaml2.load(preprocessYaml(raw)) };
2008
2027
  } catch (error) {
2009
- return { parseError: error instanceof Error ? error.message : "Failed to parse YAML" };
2028
+ return { parseError: this.truncateParseError(error, "YAML") };
2010
2029
  }
2011
2030
  }
2012
2031
  if (this.parameterFormat === "toml") {
2013
2032
  try {
2014
2033
  return { parameters: (0, import_js_toml.load)(preprocessTomlHeredoc(raw)) };
2015
2034
  } catch (error) {
2016
- return { parseError: error instanceof Error ? error.message : "Failed to parse TOML" };
2035
+ return { parseError: this.truncateParseError(error, "TOML") };
2017
2036
  }
2018
2037
  }
2019
2038
  try {
@@ -2025,9 +2044,7 @@ var init_parser = __esm({
2025
2044
  try {
2026
2045
  return { parameters: yaml2.load(preprocessYaml(raw)) };
2027
2046
  } catch (error) {
2028
- return {
2029
- parseError: error instanceof Error ? error.message : "Failed to parse as JSON, TOML, or YAML"
2030
- };
2047
+ return { parseError: this.truncateParseError(error, "auto") };
2031
2048
  }
2032
2049
  }
2033
2050
  }
@@ -2329,7 +2346,8 @@ var init_stream_processor = __esm({
2329
2346
  if (call.parseError) {
2330
2347
  this.logger.warn("Gadget has parse error", {
2331
2348
  gadgetName: call.gadgetName,
2332
- error: call.parseError
2349
+ error: call.parseError,
2350
+ rawParameters: call.parametersYaml
2333
2351
  });
2334
2352
  const shouldContinue = await this.checkContinueAfterError(
2335
2353
  call.parseError,
@@ -5271,7 +5289,7 @@ var import_commander3 = require("commander");
5271
5289
  // package.json
5272
5290
  var package_default = {
5273
5291
  name: "llmist",
5274
- version: "0.5.1",
5292
+ version: "0.6.1",
5275
5293
  description: "Universal TypeScript LLM client with streaming-first agent framework. Works with any model - no structured outputs or native tool calling required. Implements its own flexible grammar for function calling.",
5276
5294
  type: "module",
5277
5295
  main: "dist/index.cjs",