hopdeck 1.5.0 → 1.5.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/CHANGELOG.md +12 -1
- package/README.en.md +2 -0
- package/README.md +2 -0
- package/bin/hopdeck.js +15 -1
- package/lib/codex-history.js +29 -7
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
# Cambios
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## 1.5.2
|
|
4
|
+
|
|
5
|
+
### Arreglado
|
|
6
|
+
- En Windows, al salir de Hopdeck se detienen los chats abiertos en el terminal integrado, evitando que procesos de Codex queden ejecutándose.
|
|
7
|
+
|
|
8
|
+
## 1.5.1
|
|
9
|
+
|
|
10
|
+
### Arreglado
|
|
11
|
+
- El historial de Codex se filtra por cliente de origen: solo Codex CLI, la aplicación de Codex y su extensión. Se excluyen las sesiones de Work y los orígenes desconocidos antes de agrupar proyectos, contar conversaciones o buscar.
|
|
12
|
+
- En Windows, al cerrar Hopdeck también se detiene el servidor de historial que inicia el lanzador npm de Codex, evitando que su proceso auxiliar mantenga abierto el terminal.
|
|
13
|
+
|
|
14
|
+
## 1.5.0
|
|
4
15
|
|
|
5
16
|
### Nuevo
|
|
6
17
|
- Primer soporte para Codex CLI: `hopdeck --provider codex`, proyectos y conversaciones mediante `codex app-server`, vistas previas, chats nuevos y reanudados con `codex resume`, y varios chats abiertos en el panel integrado.
|
package/README.en.md
CHANGED
|
@@ -23,6 +23,8 @@ The project list stays on the left and the conversation on the right.
|
|
|
23
23
|
|
|
24
24
|
With shortcuts installed, `claude` opens Hopdeck for Claude Code and `codex` opens it for Codex CLI. Each mode has its own history and preferences. Commands with arguments (`claude -p ...`, `codex exec ...`, `codex resume ...`) still run the original CLI directly.
|
|
25
25
|
|
|
26
|
+
Codex mode shows only conversations identified as originating from Codex CLI, the Codex app or its extension. Work sessions (`codex_work_desktop`) and unknown origins are excluded, including when they share a project directory with Codex sessions. Directory names are not used to determine origin.
|
|
27
|
+
|
|
26
28
|
```bash
|
|
27
29
|
hopdeck --provider claude
|
|
28
30
|
hopdeck --provider codex
|
package/README.md
CHANGED
|
@@ -23,6 +23,8 @@ La lista de proyectos queda a la izquierda y la conversación a la derecha.
|
|
|
23
23
|
|
|
24
24
|
Con los atajos instalados, `claude` abre Hopdeck con Claude Code y `codex` lo abre con Codex CLI. Cada modo muestra su propio historial y recuerda sus propias preferencias. Los comandos con argumentos (`claude -p ...`, `codex exec ...`, `codex resume ...`) siguen ejecutando directamente su CLI.
|
|
25
25
|
|
|
26
|
+
El modo Codex muestra exclusivamente conversaciones identificadas como creadas con Codex CLI, la aplicación de Codex o su extensión. Excluye las sesiones de Work (`codex_work_desktop`) y las de origen desconocido, aunque compartan carpeta con un proyecto de Codex. Los nombres de las carpetas no se usan para decidir el origen.
|
|
27
|
+
|
|
26
28
|
```bash
|
|
27
29
|
hopdeck --provider claude
|
|
28
30
|
hopdeck --provider codex
|
package/bin/hopdeck.js
CHANGED
|
@@ -1867,7 +1867,21 @@ function embedResize() {
|
|
|
1867
1867
|
render();
|
|
1868
1868
|
}
|
|
1869
1869
|
|
|
1870
|
-
function embedKillAll() {
|
|
1870
|
+
function embedKillAll() {
|
|
1871
|
+
if (WIN) {
|
|
1872
|
+
// node-pty enumerates console processes asynchronously before killing them. quit()
|
|
1873
|
+
// exits immediately, so that enumeration may never finish and leave ConPTY open.
|
|
1874
|
+
// Stop all owned process trees before releasing the PTYs and exiting the hub.
|
|
1875
|
+
const pids = [...E.sessions.values()].map((sess) => sess.p.pid).filter((pid) => Number.isInteger(pid) && pid > 0);
|
|
1876
|
+
if (pids.length) {
|
|
1877
|
+
try {
|
|
1878
|
+
cp.spawnSync('taskkill.exe', [...pids.flatMap((pid) => ['/PID', String(pid)]), '/T', '/F'],
|
|
1879
|
+
{ stdio: 'ignore', windowsHide: true, timeout: 5000 });
|
|
1880
|
+
} catch { /* still release the PTYs below */ }
|
|
1881
|
+
}
|
|
1882
|
+
}
|
|
1883
|
+
for (const sess of E.sessions.values()) { try { sess.p.kill(); } catch { /* */ } }
|
|
1884
|
+
}
|
|
1871
1885
|
|
|
1872
1886
|
// Redibujado diferencial: solo se reescriben las filas que cambiaron desde el último cuadro.
|
|
1873
1887
|
let lastRows = [], forceFull = true;
|
package/lib/codex-history.js
CHANGED
|
@@ -10,7 +10,7 @@ const { baseName, tidy } = require('./text');
|
|
|
10
10
|
class CodexClient {
|
|
11
11
|
constructor({ bin, args = ['app-server'], timeout = 30000 } = {}) {
|
|
12
12
|
this.bin = bin; this.args = args; this.timeout = timeout; this.next = 1;
|
|
13
|
-
this.pending = new Map(); this.proc = null; this.ready = null;
|
|
13
|
+
this.pending = new Map(); this.proc = null; this.ready = null; this.batch = false;
|
|
14
14
|
}
|
|
15
15
|
start() {
|
|
16
16
|
if (this.ready) return this.ready;
|
|
@@ -18,6 +18,7 @@ class CodexClient {
|
|
|
18
18
|
const bin = this.bin || findExecutable('codex');
|
|
19
19
|
if (!bin) throw new Error('Codex CLI not found in PATH');
|
|
20
20
|
const batch = process.platform === 'win32' && /\.(cmd|bat)$/i.test(bin);
|
|
21
|
+
this.batch = batch;
|
|
21
22
|
// Only the trusted executable and fixed app-server argument enter cmd.exe; RPC data uses stdin.
|
|
22
23
|
const p = this.proc = cp.spawn(batch ? process.env.ComSpec || 'cmd.exe' : bin,
|
|
23
24
|
batch ? ['/d', '/s', '/c', `""${bin}" app-server"`] : this.args,
|
|
@@ -45,7 +46,7 @@ class CodexClient {
|
|
|
45
46
|
p.stdin.write(JSON.stringify({ id: msg.id, error: { code: -32601, message: 'Unsupported request' } }) + '\n');
|
|
46
47
|
}
|
|
47
48
|
});
|
|
48
|
-
await this.send('initialize', { clientInfo: { name: 'hopdeck', title: 'Hopdeck', version: '
|
|
49
|
+
await this.send('initialize', { clientInfo: { name: 'hopdeck', title: 'Hopdeck', version: require('../package.json').version } });
|
|
49
50
|
p.stdin.write(JSON.stringify({ method: 'initialized', params: {} }) + '\n');
|
|
50
51
|
})().catch((err) => { this.close(); throw err; });
|
|
51
52
|
return this.ready;
|
|
@@ -65,21 +66,42 @@ class CodexClient {
|
|
|
65
66
|
for (const request of this.pending.values()) { clearTimeout(request.timer); request.reject(err); }
|
|
66
67
|
this.pending.clear();
|
|
67
68
|
if (this.lines) this.lines.close();
|
|
68
|
-
if (p) {
|
|
69
|
+
if (p) {
|
|
70
|
+
try {
|
|
71
|
+
if (this.batch && p.pid) {
|
|
72
|
+
// npm's Windows shim leaves the server in a grandchild. Killing only cmd.exe can keep
|
|
73
|
+
// the parent ConPTY open after Hopdeck exits. Stop this owned process tree together.
|
|
74
|
+
const result = cp.spawnSync('taskkill.exe', ['/PID', String(p.pid), '/T', '/F'], { stdio: 'ignore', windowsHide: true, timeout: 5000 });
|
|
75
|
+
if (result.status !== 0) p.kill();
|
|
76
|
+
} else p.kill();
|
|
77
|
+
} catch { try { p.kill(); } catch { /* closed */ } }
|
|
78
|
+
p.stdin.destroy();
|
|
79
|
+
}
|
|
69
80
|
}
|
|
70
81
|
}
|
|
71
82
|
|
|
83
|
+
// The store is shared with Work clients. A directory or a "vscode" source alone does not prove
|
|
84
|
+
// that the user created the conversation in Codex. Keep only known Codex clients, with a
|
|
85
|
+
// source-only fallback for legacy CLI sessions whose protocol predates originator metadata.
|
|
86
|
+
const CODEX_SOURCES = new Set(['cli', 'vscode', 'appServer']);
|
|
87
|
+
const CODEX_ORIGINATORS = new Set(['codex_cli_rs', 'codex_vscode', 'codex desktop']);
|
|
88
|
+
function isCodexThread(thread) {
|
|
89
|
+
if (!thread || !CODEX_SOURCES.has(thread.source)) return false;
|
|
90
|
+
const origin = typeof thread.originator === 'string' ? thread.originator.trim().toLowerCase() : '';
|
|
91
|
+
return origin ? CODEX_ORIGINATORS.has(origin) : thread.source === 'cli';
|
|
92
|
+
}
|
|
93
|
+
|
|
72
94
|
function groupThreads(threads) {
|
|
73
95
|
const groups = new Map(), seen = new Set();
|
|
74
96
|
for (const t of threads) {
|
|
75
|
-
if (!t || !t.id || !t.cwd || seen.has(t.id)) continue;
|
|
97
|
+
if (!isCodexThread(t) || !t.id || !t.cwd || seen.has(t.id)) continue;
|
|
76
98
|
seen.add(t.id);
|
|
77
99
|
const cwd = t.cwd;
|
|
78
100
|
let p = groups.get(cwd);
|
|
79
101
|
if (!p) { p = { key: 'codex:' + cwd, cwd, name: baseName(cwd), sessions: [], mtime: 0 }; groups.set(cwd, p); }
|
|
80
102
|
const mtime = Number(t.updatedAt || t.createdAt || 0) * 1000;
|
|
81
103
|
const first = tidy(typeof t.preview === 'string' ? t.preview : '').slice(0, 300);
|
|
82
|
-
p.sessions.push({ id: t.id, title: tidy(t.name || first || t.id), first, cwd, mtime, last: mtime, provider: 'codex' });
|
|
104
|
+
p.sessions.push({ id: t.id, title: tidy(t.name || first || t.id), first, cwd, mtime, last: mtime, provider: 'codex', source: t.source, originator: t.originator || null });
|
|
83
105
|
p.mtime = Math.max(p.mtime, mtime);
|
|
84
106
|
}
|
|
85
107
|
for (const p of groups.values()) p.sessions.sort((a, b) => b.mtime - a.mtime);
|
|
@@ -89,7 +111,7 @@ function groupThreads(threads) {
|
|
|
89
111
|
async function listProjects(client, onProgress) {
|
|
90
112
|
const threads = [], cursors = new Set(); let cursor = null;
|
|
91
113
|
do {
|
|
92
|
-
const page = await client.request('thread/list', { limit: 100, sortKey: 'updated_at', archived: false, cursor });
|
|
114
|
+
const page = await client.request('thread/list', { limit: 100, sortKey: 'updated_at', archived: false, sourceKinds: [...CODEX_SOURCES], cursor });
|
|
93
115
|
threads.push(...(page.data || []));
|
|
94
116
|
if (onProgress) onProgress(threads.length, threads.length);
|
|
95
117
|
cursor = page.nextCursor;
|
|
@@ -139,7 +161,7 @@ function scanSync() {
|
|
|
139
161
|
return JSON.parse(result.stdout);
|
|
140
162
|
}
|
|
141
163
|
module.exports = {
|
|
142
|
-
CodexClient, groupThreads, listProjects, messagesFromItems, preview, scanSync, close,
|
|
164
|
+
CodexClient, isCodexThread, groupThreads, listProjects, messagesFromItems, preview, scanSync, close,
|
|
143
165
|
scanProjectsAsync: (progress) => listProjects(getClient(), progress),
|
|
144
166
|
previewSession: (session, limit) => preview(getClient(), session, limit),
|
|
145
167
|
CONFIG_DIR: process.env.CODEX_HOME || path.join(os.homedir(), '.codex'),
|
package/package.json
CHANGED