pi-image-preview 0.1.0 → 0.1.1
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.
- package/package.json +1 -1
- package/src/extension-runtime.ts +4 -17
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-image-preview",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Image preview extension for pi coding agent — renders inline image thumbnails above the editor using kitty graphics protocol with tmux support",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pi-package",
|
package/src/extension-runtime.ts
CHANGED
|
@@ -292,15 +292,12 @@ export function registerImagePreviewExtension(
|
|
|
292
292
|
return { action: "continue" };
|
|
293
293
|
}
|
|
294
294
|
|
|
295
|
-
//
|
|
295
|
+
// Collect images for all tracked paths in the submitted text
|
|
296
296
|
const usedImages: ImageContent[] = [];
|
|
297
|
-
let strippedText = fullText;
|
|
298
297
|
|
|
299
298
|
for (const [trackedPath, entry] of tracked) {
|
|
300
299
|
if (fullText.includes(trackedPath)) {
|
|
301
300
|
usedImages.push(entry.image);
|
|
302
|
-
// Strip the path from the text
|
|
303
|
-
strippedText = strippedText.split(trackedPath).join("");
|
|
304
301
|
}
|
|
305
302
|
}
|
|
306
303
|
|
|
@@ -308,24 +305,14 @@ export function registerImagePreviewExtension(
|
|
|
308
305
|
return { action: "continue" };
|
|
309
306
|
}
|
|
310
307
|
|
|
311
|
-
// Clean up whitespace after stripping paths
|
|
312
|
-
strippedText = strippedText.replace(/\s+/g, " ").trim();
|
|
313
|
-
|
|
314
308
|
// Clear state
|
|
315
309
|
resetDraft(ctx);
|
|
316
310
|
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
pi.sendUserMessage(
|
|
320
|
-
usedImages,
|
|
321
|
-
ctx.isIdle() ? undefined : { deliverAs: "steer" },
|
|
322
|
-
);
|
|
323
|
-
return { action: "handled" };
|
|
324
|
-
}
|
|
325
|
-
|
|
311
|
+
// Keep the original text as-is (paths stay visible in chat),
|
|
312
|
+
// just attach the actual image data alongside
|
|
326
313
|
return {
|
|
327
314
|
action: "transform",
|
|
328
|
-
text:
|
|
315
|
+
text: fullText,
|
|
329
316
|
images: [...(event.images ?? []), ...usedImages],
|
|
330
317
|
};
|
|
331
318
|
});
|