ethagent 3.1.1 → 3.1.2
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/ethagent.js +4 -0
- package/package.json +1 -1
- package/src/chat/commands.ts +2 -1
- package/src/utils/clipboard.ts +1 -1
package/bin/ethagent.js
CHANGED
|
@@ -6,6 +6,10 @@ import { dirname, join } from 'node:path'
|
|
|
6
6
|
const __dirname = dirname(fileURLToPath(import.meta.url))
|
|
7
7
|
const cli = join(__dirname, '..', 'src', 'cli', 'main.tsx')
|
|
8
8
|
|
|
9
|
+
if (process.platform === 'win32') {
|
|
10
|
+
try { execFileSync('cmd', ['/c', 'chcp', '65001'], { stdio: 'ignore' }) } catch {}
|
|
11
|
+
}
|
|
12
|
+
|
|
9
13
|
try {
|
|
10
14
|
const tsxPath = import.meta.resolve('tsx/esm')
|
|
11
15
|
execFileSync('node', ['--import', tsxPath, cli, ...process.argv.slice(2)], { stdio: 'inherit' })
|
package/package.json
CHANGED
package/src/chat/commands.ts
CHANGED
|
@@ -293,7 +293,8 @@ const COMMANDS: CommandSpec[] = [
|
|
|
293
293
|
const text = assistant[index] ?? ''
|
|
294
294
|
const label = offset === 1 ? 'Latest reply' : `Reply #${offset} back`
|
|
295
295
|
const segments = parseSegments(text)
|
|
296
|
-
|
|
296
|
+
const hasCode = segments.some(segment => segment.kind === 'code')
|
|
297
|
+
if (!hasCode) {
|
|
297
298
|
const result = await copyToClipboard(text)
|
|
298
299
|
if (!result.ok) {
|
|
299
300
|
return { kind: 'note', variant: 'error', text: `Copy failed: ${result.error}` }
|
package/src/utils/clipboard.ts
CHANGED
|
@@ -96,7 +96,7 @@ async function tryReadNative(): Promise<ReadResult> {
|
|
|
96
96
|
return readFrom('pbpaste', [], 'pbpaste')
|
|
97
97
|
}
|
|
98
98
|
if (process.platform === 'win32') {
|
|
99
|
-
return readFrom('powershell', ['-NoProfile', '-Command', 'Get-Clipboard -Raw'], 'powershell Get-Clipboard')
|
|
99
|
+
return readFrom('powershell', ['-NoProfile', '-Command', '[Console]::OutputEncoding=[Text.Encoding]::UTF8; Get-Clipboard -Raw'], 'powershell Get-Clipboard')
|
|
100
100
|
}
|
|
101
101
|
if (process.env['WAYLAND_DISPLAY']) {
|
|
102
102
|
const wl = await probe('wl-paste', ['--version'])
|