@workser/engine 0.1.12 → 0.1.13

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.
@@ -67,8 +67,14 @@ export const readTool = {
67
67
  if (!kind)
68
68
  throw new Error(`File not found: ${filepath}`);
69
69
  const bytes = await ctx.place.readFile(filepath);
70
- if (isBinary(bytes))
71
- throw new Error(`Cannot read binary file: ${filepath}`);
70
+ // Said so the model stops trying: on 9 Nov a job spent four turns resizing and re-reading photos it could never see.
71
+ if (isBinary(bytes)) {
72
+ if (/\.(png|jpe?g|gif|webp|avif|bmp|ico|svgz|tiff?)$/i.test(filepath)) {
73
+ throw new Error(`${filepath} is an image, and read only shows text: converting or resizing it will not change that. ` +
74
+ `Check an image with a command instead (identify for its size and format), or look at the page that shows it in the browser.`);
75
+ }
76
+ throw new Error(`Cannot read binary file: ${filepath}. read only shows text files; inspect this one with a command instead.`);
77
+ }
72
78
  const all = new TextDecoder().decode(bytes).split('\n');
73
79
  if (all.length > 0 && all[all.length - 1] === '')
74
80
  all.pop();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workser/engine",
3
- "version": "0.1.12",
3
+ "version": "0.1.13",
4
4
  "description": "Workser's coding engine for the 'loop in our service' mode: OpenCode's agent contract (its prompts, tool schemas and edit semantics, vendored from v1.18.23) running on Node, with every file and shell action going through a Place — so the machine can be a remote sandbox and no model key is ever on it.",
5
5
  "license": "MIT",
6
6
  "type": "module",