@molecule/api-ai-tools 1.5.9 → 1.5.10

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.
@@ -1 +1 @@
1
- {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AA8B9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAwCnE;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,gBAAgB,EAAE,MAAM,CAAC,EAAE,eAAe,GAAG,MAAM,EAAE,CA8/CxF"}
1
+ {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AA8B9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAwCnE;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,gBAAgB,EAAE,MAAM,CAAC,EAAE,eAAe,GAAG,MAAM,EAAE,CAyhDxF"}
package/dist/tools.js CHANGED
@@ -703,6 +703,29 @@ export function buildTools(backend, config) {
703
703
  error: `old_string not found in ${path}. The file's ACTUAL content near your target (copy the exact text from here):\n${snippet}`,
704
704
  };
705
705
  };
706
+ // An import block the model rebuilt in its own order: the linter's
707
+ // import sort owns that order, so name it and show the real block. X1
708
+ // flash-m42 sent the same block three times in three orders.
709
+ // Only when old_string is import statements and nothing else.
710
+ const imported = /^(?:\s*import\b[^;]*?\bfrom\s+(['"])([^'"]+)\1;?)+\s*$/.exec(oldString)?.[2];
711
+ if (imported) {
712
+ const at = fileLines.findIndex((l) => l.includes(`'${imported}'`) || l.includes(`"${imported}"`));
713
+ if (at >= 0) {
714
+ let start = at;
715
+ while (start > 0 && !/^\s*import\b/.test(fileLines[start]))
716
+ start--;
717
+ const block = fileLines
718
+ .slice(start, at + 1)
719
+ .map((l, i) => `${start + i + 1}: ${l}`)
720
+ .join('\n');
721
+ return {
722
+ error: `old_string not found in ${path}: it is an import block, and the linter's import ` +
723
+ `sort decides its order, so do not rebuild it. The file's import from ` +
724
+ `'${imported}' reads:\n${block}\nEdit one line of it, or add your import as a ` +
725
+ 'new line and let the linter sort it.',
726
+ };
727
+ }
728
+ }
706
729
  const distinctiveLines = [
707
730
  ...new Set(oldString
708
731
  .split('\n')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@molecule/api-ai-tools",
3
- "version": "1.5.9",
3
+ "version": "1.5.10",
4
4
  "description": "Shared AI agent tools with backend abstraction for sandbox and local execution",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",