@kody-ade/kody-engine 0.4.158 → 0.4.159

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.
Files changed (2) hide show
  1. package/dist/bin/kody.js +11 -16
  2. package/package.json +1 -1
package/dist/bin/kody.js CHANGED
@@ -1061,7 +1061,7 @@ var init_loadPriorArt = __esm({
1061
1061
  // package.json
1062
1062
  var package_default = {
1063
1063
  name: "@kody-ade/kody-engine",
1064
- version: "0.4.158",
1064
+ version: "0.4.159",
1065
1065
  description: "kody \u2014 autonomous development engine. Single-session Claude Code agent behind a generic executor + declarative executable profiles.",
1066
1066
  license: "MIT",
1067
1067
  type: "module",
@@ -2177,33 +2177,28 @@ function attachmentsDir(cwd, sessionId) {
2177
2177
  return path10.join(cwd, ".kody", "tmp", "attachments", sessionId);
2178
2178
  }
2179
2179
  function prepareAttachments(turns, cwd, sessionId) {
2180
- const lastUserIdx = (() => {
2181
- for (let i = turns.length - 1; i >= 0; i--) {
2182
- if (turns[i].role === "user") return i;
2183
- }
2184
- return -1;
2185
- })();
2186
2180
  const imagePaths = [];
2187
2181
  let imageCounter = 0;
2188
- const rewritten = turns.map((turn, idx) => {
2189
- if (!turn.content.includes("base64,")) return turn;
2190
- const isLastUser = idx === lastUserIdx;
2182
+ let dirEnsured = false;
2183
+ const dir = attachmentsDir(cwd, sessionId);
2184
+ const rewritten = turns.map((turn) => {
2185
+ if (turn.role !== "user" || !turn.content.includes("base64,")) return turn;
2191
2186
  const newContent = turn.content.replace(
2192
2187
  INLINE_ATTACHMENT_RE,
2193
2188
  (_match, label, mime, data) => {
2194
2189
  const name = (label ?? "").trim() || "attachment";
2195
2190
  const isImage = mime.toLowerCase().startsWith("image/");
2196
- if (!isLastUser || !isImage) {
2197
- return `[${isImage ? "Image" : "File"}: ${name}${isLastUser ? "" : " \u2014 omitted from history"}]`;
2198
- }
2191
+ if (!isImage) return `[File: ${name}]`;
2199
2192
  try {
2200
- const dir = attachmentsDir(cwd, sessionId);
2201
- fs10.mkdirSync(dir, { recursive: true });
2193
+ if (!dirEnsured) {
2194
+ fs10.mkdirSync(dir, { recursive: true });
2195
+ dirEnsured = true;
2196
+ }
2202
2197
  const filePath = path10.join(dir, `${imageCounter}.${extFor(mime)}`);
2203
2198
  fs10.writeFileSync(filePath, Buffer.from(data, "base64"));
2204
2199
  imageCounter += 1;
2205
2200
  imagePaths.push(filePath);
2206
- return `[Image "${name}" is attached \u2014 saved to ${filePath}. Use the Read tool on that exact path to view it before answering.]`;
2201
+ return `[Image "${name}" is attached \u2014 saved to ${filePath}. Use the Read tool on that exact path to view it.]`;
2207
2202
  } catch {
2208
2203
  return `[Image: ${name} (could not be materialised)]`;
2209
2204
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kody-ade/kody-engine",
3
- "version": "0.4.158",
3
+ "version": "0.4.159",
4
4
  "description": "kody — autonomous development engine. Single-session Claude Code agent behind a generic executor + declarative executable profiles.",
5
5
  "license": "MIT",
6
6
  "type": "module",