ccdeck 3.81.4 → 3.82.0

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.
@@ -1 +1 @@
1
- import"./app-0jqgYDft.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const e of document.querySelectorAll('link[rel="modulepreload"]'))i(e);new MutationObserver(e=>{for(const r of e)if(r.type==="childList")for(const o of r.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&i(o)}).observe(document,{childList:!0,subtree:!0});function s(e){const r={};return e.integrity&&(r.integrity=e.integrity),e.referrerPolicy&&(r.referrerPolicy=e.referrerPolicy),e.crossOrigin==="use-credentials"?r.credentials="include":e.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function i(e){if(e.ep)return;e.ep=!0;const r=s(e);fetch(e.href,r)}})();
1
+ import"./app-BK08kq7X.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const e of document.querySelectorAll('link[rel="modulepreload"]'))i(e);new MutationObserver(e=>{for(const r of e)if(r.type==="childList")for(const o of r.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&i(o)}).observe(document,{childList:!0,subtree:!0});function s(e){const r={};return e.integrity&&(r.integrity=e.integrity),e.referrerPolicy&&(r.referrerPolicy=e.referrerPolicy),e.crossOrigin==="use-credentials"?r.credentials="include":e.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function i(e){if(e.ep)return;e.ep=!0;const r=s(e);fetch(e.href,r)}})();
@@ -77,8 +77,8 @@
77
77
  document.documentElement.setAttribute("data-density", density === "tightest" || density === "tighter" || density === "compact" || density === "comfortable" ? density : "default");
78
78
  })();
79
79
  </script>
80
- <script type="module" crossorigin src="/assets/index-K55Tw-ZZ.js"></script>
81
- <link rel="modulepreload" crossorigin href="/assets/app-0jqgYDft.js">
80
+ <script type="module" crossorigin src="/assets/index-B3icWRJZ.js"></script>
81
+ <link rel="modulepreload" crossorigin href="/assets/app-BK08kq7X.js">
82
82
  <link rel="stylesheet" crossorigin href="/assets/app-BIrh5Q0W.css">
83
83
  </head>
84
84
  <body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccdeck",
3
- "version": "3.81.4",
3
+ "version": "3.82.0",
4
4
  "description": "Local dashboard for Claude Code and Codex CLI sessions: which Claude Code session needs input, every tool call and Claude Code subagent live, token cost and quota, several Claude accounts. Run npx ccdeck.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -84,6 +84,7 @@
84
84
  "without one."
85
85
  ],
86
86
  "//summaries": {
87
+ "3.82.0": "Steadier Codex switching, and uninstall cleans up Codex's terminal selection",
87
88
  "3.81.4": "Codex account switching works with Windows sandbox logins",
88
89
  "3.81.3": "More reliable Codex switching and quieter account rows",
89
90
  "3.81.2": "Codex account switches wait through activity changes",
@@ -140,6 +141,38 @@
140
141
  "3.53.1",
141
142
  "3.53.3"
142
143
  ],
144
+ "3.82.0": [
145
+ {
146
+ "title": "🔄 Codex switching recovers instead of staying stuck",
147
+ "body": "A failed reconnect or manual switch no longer leaves Codex account control disconnected, and turning Auto-switch off stops a switch it had already queued.",
148
+ "priority": "highlight",
149
+ "icon": "accounts",
150
+ "details": "On Windows, a Codex connection that never answers now fails after 30 seconds instead of waiting forever."
151
+ },
152
+ {
153
+ "title": "⏱️ Slow Codex logins get more time and a Retry button",
154
+ "body": "ccdeck now gives Codex more time to read a login during a switch, and if it still runs out, the panel says why and offers Retry selected account.",
155
+ "priority": "highlight",
156
+ "icon": "accounts"
157
+ },
158
+ {
159
+ "title": "🧹 Uninstall also removes Codex's terminal selection",
160
+ "body": "ccdeck --uninstall now takes the codex block that Enable terminal selection added out of your shell profiles, and names any file it could not clean.",
161
+ "priority": "highlight"
162
+ },
163
+ {
164
+ "title": "⌨️ A opens Codex accounts on a Codex-only deck",
165
+ "body": "With Codex alone, the Codex accounts door now shows its A key, and its name follows your interface language."
166
+ },
167
+ {
168
+ "title": "🔑 Jira token help names the permission for comments and statuses",
169
+ "body": "A scoped Jira Cloud token needs write:jira-work to add comments and change statuses, and the token help and Settings › Integrations now say so."
170
+ },
171
+ {
172
+ "title": "🌍 Codex messages read correctly in every language",
173
+ "body": "The message about a Codex login folder that is not private enough had lost its accented and non-Latin letters; it is whole again, and the new timeout message is translated."
174
+ }
175
+ ],
143
176
  "3.81.4": [
144
177
  {
145
178
  "title": "🔄 Switch Codex accounts without another sign-in",
@@ -12,10 +12,10 @@ import { pathLookup } from './exec-spec.mjs';
12
12
  import { holdWindowsPrivatePath, snapshotWindowsCodexLogin } from './codex-windows-private.mjs';
13
13
 
14
14
  const MAX_AUTH_BYTES = 1024 * 1024;
15
- // A loaded Windows host can exceed twelve seconds starting a cold CLI while
16
- // native agents work. Bound initialization/reads together at thirty seconds,
15
+ // A cold CLI or workspace routing discovery can exceed three seconds on any
16
+ // platform. Bound initialization/reads together at thirty seconds,
17
17
  // plus the owned process's four-second shutdown; never retry a native request.
18
- const NATIVE_DEADLINE_MS = process.platform === 'win32' ? 34000 : 7000;
18
+ const NATIVE_DEADLINE_MS = 34000;
19
19
  // startEngineRpc.stop() closes stdin, then escalates at 2s and 4s. Reserve its
20
20
  // full shutdown window rather than giving each request another seven seconds.
21
21
  const STOP_RESERVE_MS = 4000;
@@ -210,8 +210,12 @@ export function createCodexLiveAccountController(input = {}) {
210
210
  } finally { clearTimeout(timeout); }
211
211
  account = await rpc.request('account/read', { refreshToken: false });
212
212
  }
213
- }
214
- finally { readingInitialAccount = false; }
213
+ } catch (error) {
214
+ // Manual switches and renewals can also create this connection while
215
+ // retaining a previous login. Never retain an unattested bootstrap.
216
+ await disconnect();
217
+ throw error;
218
+ } finally { readingInitialAccount = false; }
215
219
  if (account.account && account.account.type !== 'chatgpt') { rpc.close(); rpc = null; owned = false; throw liveError('unsupported_auth_mode'); }
216
220
  }
217
221
  async function loginCredential(id, refresh = false) {
@@ -252,6 +256,11 @@ export function createCodexLiveAccountController(input = {}) {
252
256
  journal.phase = journal.entries.every(e => ['continued', 'skipped'].includes(e.phase)) ? 'finished' : 'pending';
253
257
  await saveHandoff(journal);
254
258
  };
259
+ const assertAutoEnabled = async () => {
260
+ if (automatic && !(await (options.readAuto ?? (() => readCodexAuto({ ...options, store })))()).enabled) {
261
+ throw liveError('auto_switch_disabled');
262
+ }
263
+ };
255
264
  const authCurrent = () => !closed && !ownershipPaused && epoch === ownershipEpoch;
256
265
  const owner = () => authCurrent() && currentIntent()?.revision === intent.revision && currentIntent()?.id === intent.id;
257
266
  const verifyOwnership = async () => {
@@ -277,12 +286,15 @@ export function createCodexLiveAccountController(input = {}) {
277
286
  if (!s.profiles?.some(p => p.id === intent.id && p.available !== false)) throw liveError('profile_unavailable');
278
287
  await ensureRpc(s.originalHome);
279
288
  const next = await loginCredential(intent.id, refresh);
289
+ await assertAutoEnabled();
280
290
  if (!owner()) throw liveError('account_changed_outside_deck');
281
291
  if (!await lease.valid()) throw liveError('native_control_lost');
282
292
  const before = await rpc.request('account/read', { refreshToken: false });
283
293
  resumeIdentity = before;
284
294
  handoff = await prepareCodexLiveHandoff(rpc, { isCurrent: owner,
285
295
  beforeInterrupt: async entry => {
296
+ await assertAutoEnabled();
297
+ if (!owner()) throw liveError('account_changed_outside_deck');
286
298
  await record(entry, 'interrupt_sent');
287
299
  if (!owner()) throw liveError('account_changed_outside_deck');
288
300
  }, afterInterrupt: (entry, phase) => record(entry, phase) });
@@ -312,6 +324,8 @@ export function createCodexLiveAccountController(input = {}) {
312
324
  const current = await rpc.request('account/read', { refreshToken: false });
313
325
  if (!owner() || !sameNativeAccount(current, before)) throw liveError('account_changed_outside_deck');
314
326
  if (!await lease.valid()) throw liveError('native_control_lost');
327
+ await assertAutoEnabled();
328
+ if (!owner()) throw liveError('account_changed_outside_deck');
315
329
  // Authentication crosses only this owner-validated local socket. Codex
316
330
  // stores external tokens in memory, not either profile's credential file.
317
331
  maybeApplied = true;
@@ -365,7 +379,8 @@ export function createCodexLiveAccountController(input = {}) {
365
379
  if (journal.entries.length && journal.phase !== 'finished') update({ continuation: 'manual_required' });
366
380
  if (maybeApplied) { credential = null; owned = false; }
367
381
  const reason = publicReason(error);
368
- update({ state: ['native_not_running', 'cli_unavailable'].includes(reason) ? 'unavailable' : 'failed',
382
+ update({ state: reason === 'auto_switch_disabled' && !maybeApplied ? (owned ? 'applied' : 'idle')
383
+ : ['native_not_running', 'cli_unavailable'].includes(reason) ? 'unavailable' : 'failed',
369
384
  ...(maybeApplied ? { profileId: null } : {}), reason });
370
385
  if (!owned) await disconnect();
371
386
  } finally {
@@ -553,14 +568,21 @@ export function createCodexLiveAccountController(input = {}) {
553
568
  } catch { /* Keep the durable recovery intent until its outcome is known. */ }
554
569
  }
555
570
  async function reconnect() {
556
- const s = await selection(); await ensureRpc(s.originalHome);
557
- const actual = await rpc.request('account/read', { refreshToken: false });
558
- // Notifications were unobservable during the gap. Email/workspace labels
559
- // cannot restore authority; require a native ID or a fresh manual selection.
560
- if (!accountIds(actual).length) await externalChange('native_identity_unattested');
561
- else if (!ownershipPaused && sameAccount(actual, credential, true)) {
562
- lastCheck = Date.now(); update({ state: 'applied', profileId: credential.profileId, reason: null });
563
- } else await externalChange();
571
+ try {
572
+ const s = await selection(); await ensureRpc(s.originalHome);
573
+ const actual = await rpc.request('account/read', { refreshToken: false });
574
+ // Notifications were unobservable during the gap. Email/workspace labels
575
+ // cannot restore authority; require a native ID or a fresh manual selection.
576
+ if (!accountIds(actual).length) await externalChange('native_identity_unattested');
577
+ else if (!ownershipPaused && sameAccount(actual, credential, true)) {
578
+ lastCheck = Date.now(); update({ state: 'applied', profileId: credential.profileId, reason: null });
579
+ } else await externalChange();
580
+ } catch (error) {
581
+ // A partially initialized connection cannot attest ownership. Drop only
582
+ // our control connection so the next poll can reconnect and read IDs.
583
+ await disconnect();
584
+ throw error;
585
+ }
564
586
  }
565
587
  async function tick() {
566
588
  if (closed || ticking) return;
@@ -113,7 +113,7 @@ export async function connectCodexLiveRpc(endpoint, options = {}) {
113
113
  let ws;
114
114
  try {
115
115
  ws = new WebSocket(windows ? 'ws://localhost/' : `ws+unix://${endpoint.socketPath}:/`, {
116
- handshakeTimeout: 5000, maxPayload: 64 * 1024 * 1024, perMessageDeflate: false,
116
+ handshakeTimeout: windows ? 30000 : 5000, maxPayload: 64 * 1024 * 1024, perMessageDeflate: false,
117
117
  ...(windows ? { createConnection: () => { proxy = createCodexWindowsProxy(endpoint, options); return proxy; } } : {}),
118
118
  });
119
119
  } catch { await guard?.release(); proxy?.destroy(); throw liveError('native_connection_failed'); }
@@ -161,7 +161,18 @@ export async function connectCodexLiveRpc(endpoint, options = {}) {
161
161
  close() { closing = true; rejectPending(); ws.close(); const timer = setTimeout(() => { ws.terminate(); proxy?.destroy(); }, 500); timer.unref(); },
162
162
  };
163
163
  try {
164
- await new Promise((ready, reject) => { ws.once('open', ready); ws.once('error', () => reject(liveError('native_connection_failed'))); });
164
+ await new Promise((ready, reject) => {
165
+ // The Windows stdio Duplex does not emit a net.Socket connect event, so
166
+ // the HTTP client's socket timeout alone cannot bound its handshake.
167
+ const finish = error => {
168
+ clearTimeout(timer);
169
+ ws.off('open', opened); ws.off('error', failed); ws.off('close', failed);
170
+ if (error) reject(liveError('native_connection_failed')); else ready();
171
+ };
172
+ const opened = () => finish(false), failed = () => finish(true);
173
+ const timer = setTimeout(failed, windows ? 30000 : 5000);
174
+ ws.once('open', opened); ws.once('error', failed); ws.once('close', failed);
175
+ });
165
176
  const after = windows ? await inspectWindowsPrivateSocket(endpoint.socketPath, options.windowsPrivate) : await inspectPosixSocket(endpoint.socketPath);
166
177
  if (after.generation !== endpoint.generation) throw liveError('native_endpoint_changed');
167
178
  if (guard && !guard.valid()) throw liveError('untrusted_native_socket');
@@ -1,7 +1,7 @@
1
1
  import { createRequire } from 'node:module';
2
- import { readFile, mkdir, chmod, access, stat, cp } from 'node:fs/promises';
2
+ import { readFile, mkdir, chmod, access, stat, cp, rm } from 'node:fs/promises';
3
3
  import { constants } from 'node:fs';
4
- import { basename, dirname, join, isAbsolute } from 'node:path';
4
+ import { basename, dirname, join, isAbsolute, relative } from 'node:path';
5
5
  import { homedir } from 'node:os';
6
6
  import { execFile } from 'node:child_process';
7
7
  import { promisify } from 'node:util';
@@ -48,6 +48,10 @@ async function rcFor(shell, home, env, platform) {
48
48
  }
49
49
  return join(home, '.bashrc');
50
50
  }
51
+ return powershellProfile(shell);
52
+ }
53
+
54
+ async function powershellProfile(shell) {
51
55
  const executable = shell === 'powershell5' ? 'powershell.exe' : 'pwsh.exe';
52
56
  const { stdout } = await promisify(execFile)(executable, ['-NoProfile', '-Command', '$PROFILE.CurrentUserAllHosts'], { encoding: 'utf8', timeout: 5000, maxBuffer: 4096 });
53
57
  const rc = stdout.trim();
@@ -119,3 +123,72 @@ export async function configureCodexTerminal(action, options = {}) {
119
123
  if (action === 'install') await chmod(join(options.store ?? deckDataDir(undefined, env, home), 'codex-terminal'), 0o700);
120
124
  return { shell, rc, action };
121
125
  }
126
+
127
+ /**
128
+ * For `--uninstall`: take the block Enable terminal selection wrote out of every
129
+ * shell profile it may be in, and the helper it calls with it.
130
+ *
131
+ * Nothing records which shell the person set it up in (they ran the command
132
+ * themselves), so every profile `rcFor` can pick is read: zsh's in ZDOTDIR and
133
+ * in the home folder, bash's on Linux and the three macOS picks the first of
134
+ * (an earlier setup may have picked another), and on Windows both PowerShells'
135
+ * CurrentUserAllHosts profile in Documents, and in OneDrive's Documents when
136
+ * OneDrive keeps that folder. Left behind, the block outlives ccdeck: `codex`
137
+ * runs through a helper that the desktop app's removal takes away, and it no
138
+ * longer starts.
139
+ *
140
+ * The PowerShell profiles are found from the home folder, not by asking
141
+ * PowerShell: `$PROFILE` follows the Documents folder Windows has on record,
142
+ * whatever HOME or USERPROFILE say, so asking would reach past an isolated
143
+ * home into the real one. A OneDrive folder outside the home is skipped for
144
+ * the same reason.
145
+ *
146
+ * A file whose markers are incomplete is not touched and is named. The helper
147
+ * goes only when no profile still holds a block, since a block left anywhere
148
+ * still calls it. Answers { removed, refused, kept, helper, directory }.
149
+ */
150
+ export async function removeCodexTerminalEverywhere(options = {}) {
151
+ const env = options.env ?? process.env;
152
+ const platform = options.platform ?? process.platform;
153
+ const home = options.home ?? homedir();
154
+ const store = options.store ?? deckDataDir(undefined, env, home);
155
+ const candidates = [];
156
+ const zdot = env.ZDOTDIR?.trim();
157
+ if (zdot) candidates.push(join(zdot, '.zshrc'));
158
+ candidates.push(...['.zshrc', '.bashrc', '.bash_profile', '.bash_login', '.profile'].map(name => join(home, name)));
159
+ if (platform === 'win32') {
160
+ const inHome = dir => { const r = relative(home, dir); return r !== '' && !r.startsWith('..') && !isAbsolute(r); };
161
+ const documents = [join(home, 'Documents'),
162
+ ...[env.OneDrive, env.OneDriveConsumer, env.OneDriveCommercial].filter(dir => dir?.trim() && inHome(dir)).map(dir => join(dir, 'Documents'))];
163
+ for (const dir of documents) candidates.push(join(dir, 'PowerShell', 'profile.ps1'), join(dir, 'WindowsPowerShell', 'profile.ps1'));
164
+ }
165
+ const removed = [], refused = [];
166
+ for (const rc of new Set(candidates)) {
167
+ let text;
168
+ try { text = await readFile(rc, 'utf8'); }
169
+ catch (error) {
170
+ if (error.code !== 'ENOENT' && error.code !== 'ENOTDIR') refused.push({ path: rc, why: error.message });
171
+ continue;
172
+ }
173
+ if (!text.includes(BEGIN) && !text.includes(END)) continue;
174
+ try {
175
+ await writeFileAtomic(await resolveWriteTarget(rc), stripIntegration(text));
176
+ removed.push(rc);
177
+ } catch (error) {
178
+ refused.push({ path: rc, why: error.message });
179
+ }
180
+ }
181
+ const directory = join(store, 'codex-terminal');
182
+ let helper = false;
183
+ const kept = refused.length > 0;
184
+ if (!kept) {
185
+ try {
186
+ await stat(directory);
187
+ await rm(directory, { recursive: true, force: true });
188
+ helper = true;
189
+ } catch (error) {
190
+ if (error.code !== 'ENOENT') refused.push({ path: directory, why: error.message });
191
+ }
192
+ }
193
+ return { removed, refused, kept, helper, directory };
194
+ }