prior-cli 1.3.10 → 1.3.11
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/bin/prior.js +17 -12
- package/package.json +1 -1
package/bin/prior.js
CHANGED
|
@@ -653,7 +653,7 @@ async function startChat(opts = {}) {
|
|
|
653
653
|
|
|
654
654
|
// Image indicator — always first, persists across backspace/typing
|
|
655
655
|
if (_pendingImageBase64) {
|
|
656
|
-
process.stdout.write(`\x1b[B\r\x1b[2K ${c.brand('◈')} ${c.dim('[Image] attached · alt+v to
|
|
656
|
+
process.stdout.write(`\x1b[B\r\x1b[2K ${c.brand('◈')} ${c.dim('[Image] attached · alt+v to remove')}`);
|
|
657
657
|
rows++;
|
|
658
658
|
}
|
|
659
659
|
|
|
@@ -690,19 +690,24 @@ async function startChat(opts = {}) {
|
|
|
690
690
|
return;
|
|
691
691
|
}
|
|
692
692
|
|
|
693
|
-
// Alt+V — grab image from
|
|
693
|
+
// Alt+V — grab image from clipboard, or remove if already attached
|
|
694
694
|
if (key.meta && key.name === 'v') {
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
695
|
+
if (_pendingImageBase64) {
|
|
696
|
+
_pendingImageBase64 = null;
|
|
697
|
+
renderSubRows(rl.line || '');
|
|
698
|
+
} else {
|
|
699
|
+
try {
|
|
700
|
+
const ps = `Add-Type -AssemblyName System.Windows.Forms; $img = [System.Windows.Forms.Clipboard]::GetImage(); if ($img) { $ms = New-Object System.IO.MemoryStream; $img.Save($ms, [System.Drawing.Imaging.ImageFormat]::Png); [Convert]::ToBase64String($ms.ToArray()) } else { '' }`;
|
|
701
|
+
const b64 = execSync(`powershell -NoProfile -Command "${ps}"`, { timeout: 5000 }).toString().trim();
|
|
702
|
+
if (b64) {
|
|
703
|
+
_pendingImageBase64 = b64;
|
|
704
|
+
renderSubRows(rl.line || '');
|
|
705
|
+
} else {
|
|
706
|
+
flashSubRow(c.muted('✗ No image found in clipboard'));
|
|
707
|
+
}
|
|
708
|
+
} catch {
|
|
709
|
+
flashSubRow(c.muted('✗ Could not read clipboard'));
|
|
703
710
|
}
|
|
704
|
-
} catch {
|
|
705
|
-
flashSubRow(c.muted('✗ Could not read clipboard'));
|
|
706
711
|
}
|
|
707
712
|
return;
|
|
708
713
|
}
|