claude-opencode-viewer 2.6.2 → 2.6.4
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/index.html +9 -0
- package/package.json +1 -1
- package/server.js +17 -1
package/index.html
CHANGED
|
@@ -1010,6 +1010,15 @@
|
|
|
1010
1010
|
|
|
1011
1011
|
term.open(document.getElementById('terminal'));
|
|
1012
1012
|
|
|
1013
|
+
// PC端复制:用 xterm.js selection API 获取纯文本,避免复制出乱码
|
|
1014
|
+
document.getElementById('terminal').addEventListener('copy', function(e) {
|
|
1015
|
+
var sel = term.getSelection();
|
|
1016
|
+
if (sel) {
|
|
1017
|
+
e.preventDefault();
|
|
1018
|
+
e.clipboardData.setData('text/plain', sel);
|
|
1019
|
+
}
|
|
1020
|
+
});
|
|
1021
|
+
|
|
1013
1022
|
// OSC 52 剪贴板支持:拦截应用发送的剪贴板设置请求
|
|
1014
1023
|
term.parser.registerOscHandler(52, function(data) {
|
|
1015
1024
|
var idx = data.indexOf(';');
|
package/package.json
CHANGED
package/server.js
CHANGED
|
@@ -130,11 +130,27 @@ async function spawnProcess(mode, sessionId = null) {
|
|
|
130
130
|
spawnEnv.XDG_DATA_HOME = '/halo/.local/share';
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
+
// 恢复会话时,使用会话记录的工作目录
|
|
134
|
+
let spawnCwd = process.cwd();
|
|
135
|
+
if (sessionId) {
|
|
136
|
+
try {
|
|
137
|
+
const db = new Database(OPENCODE_DB_PATH, { readonly: true });
|
|
138
|
+
const session = db.prepare('SELECT directory FROM session WHERE id = ?').get(sessionId);
|
|
139
|
+
db.close();
|
|
140
|
+
if (session && session.directory && existsSync(session.directory)) {
|
|
141
|
+
spawnCwd = session.directory;
|
|
142
|
+
console.log(`[opencode] 使用会话目录: ${spawnCwd}`);
|
|
143
|
+
}
|
|
144
|
+
} catch (e) {
|
|
145
|
+
console.log('[opencode] 查询会话目录失败:', e.message);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
133
149
|
const proc = pty.spawn(command, args, {
|
|
134
150
|
name: 'xterm-256color',
|
|
135
151
|
cols: lastPtyCols,
|
|
136
152
|
rows: lastPtyRows,
|
|
137
|
-
cwd:
|
|
153
|
+
cwd: spawnCwd,
|
|
138
154
|
env: spawnEnv,
|
|
139
155
|
});
|
|
140
156
|
|