ccdeck 3.81.2 → 3.81.3
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/README.md +4 -4
- package/bin/cli/tui.js +1 -1
- package/dist/web/assets/{BrowserWatchModal-BahEbWu-.js → BrowserWatchModal-CtzXOp5j.js} +1 -1
- package/dist/web/assets/{IntegrationModal-DzIizEQd.js → IntegrationModal-DxRO6C3V.js} +1 -1
- package/dist/web/assets/{RadioPanel-DKmUHqxX.js → RadioPanel-BXXsKLiL.js} +1 -1
- package/dist/web/assets/{TrafficRadar-B2G1nwSK.js → TrafficRadar-CcCdZ-Tp.js} +1 -1
- package/dist/web/assets/{UsageHistoryModal-M0A1co-v.js → UsageHistoryModal-DOZTQtT2.js} +1 -1
- package/dist/web/assets/{app-uL65pD1B.js → app-BWU-3pHs.js} +86 -86
- package/dist/web/assets/{index-4-WbGg1k.js → index-A7xHctiv.js} +1 -1
- package/dist/web/index.html +2 -2
- package/package.json +1 -1
- package/release-notes.json +17 -0
- package/src/server/codex-live-rpc.mjs +23 -6
- package/src/server/deck-home.mjs +3 -2
- package/src/server/depth-facts.mjs +93 -1
- package/src/server/reports.mjs +53 -2
- package/src/server/tui-view.mjs +10 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./app-
|
|
1
|
+
import"./app-BWU-3pHs.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)}})();
|
package/dist/web/index.html
CHANGED
|
@@ -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-
|
|
81
|
-
<link rel="modulepreload" crossorigin href="/assets/app-
|
|
80
|
+
<script type="module" crossorigin src="/assets/index-A7xHctiv.js"></script>
|
|
81
|
+
<link rel="modulepreload" crossorigin href="/assets/app-BWU-3pHs.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.
|
|
3
|
+
"version": "3.81.3",
|
|
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": {
|
package/release-notes.json
CHANGED
|
@@ -84,6 +84,7 @@
|
|
|
84
84
|
"without one."
|
|
85
85
|
],
|
|
86
86
|
"//summaries": {
|
|
87
|
+
"3.81.3": "More reliable Codex switching and quieter account rows",
|
|
87
88
|
"3.81.2": "Codex account switches wait through activity changes",
|
|
88
89
|
"3.81.1": "Codex reconnection and Windows fixes",
|
|
89
90
|
"3.81.0": "Codex accounts on a par with Claude's, Codex over Local network, and ccdeck tui for the whole deck",
|
|
@@ -138,6 +139,22 @@
|
|
|
138
139
|
"3.53.1",
|
|
139
140
|
"3.53.3"
|
|
140
141
|
],
|
|
142
|
+
"3.81.3": [
|
|
143
|
+
{
|
|
144
|
+
"title": "More reliable Codex account switching",
|
|
145
|
+
"body": "ccdeck retries temporary connection failures before switching the open Codex app.",
|
|
146
|
+
"priority": "highlight",
|
|
147
|
+
"icon": "accounts"
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
"title": "Quieter account switching",
|
|
151
|
+
"body": "Successful switches no longer leave an extra message under the account row."
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
"title": "Arrow-key navigation in ccdeck tui",
|
|
155
|
+
"body": "The footer and help now show the left and right arrow keys for moving between tabs."
|
|
156
|
+
}
|
|
157
|
+
],
|
|
141
158
|
"3.81.2": [
|
|
142
159
|
{
|
|
143
160
|
"title": "Codex account switches wait through activity changes",
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// that daemon or takes ownership of its conversations.
|
|
3
3
|
import { execFile } from 'node:child_process';
|
|
4
4
|
import { promisify } from 'node:util';
|
|
5
|
+
import { setTimeout as delay } from 'node:timers/promises';
|
|
5
6
|
import { lstat, realpath } from 'node:fs/promises';
|
|
6
7
|
import { dirname, isAbsolute, join, resolve, win32 } from 'node:path';
|
|
7
8
|
import { randomUUID } from 'node:crypto';
|
|
@@ -13,6 +14,27 @@ import { RUNNING_VERSION } from './running-version.mjs';
|
|
|
13
14
|
|
|
14
15
|
export const liveError = code => Object.assign(new Error(code), { code });
|
|
15
16
|
const runFile = promisify(execFile);
|
|
17
|
+
|
|
18
|
+
// Only this read-only probe is safe to replay. In particular, never retry a
|
|
19
|
+
// login or an interrupted turn whose outcome may already have committed.
|
|
20
|
+
export async function probeCodexLiveDaemon(executable, env, options = {}) {
|
|
21
|
+
const spec = spawnSpec(executable, ['app-server', 'daemon', 'version'], options.platform ?? process.platform);
|
|
22
|
+
for (let attempt = 0; attempt < 3; attempt++) {
|
|
23
|
+
try {
|
|
24
|
+
const output = await (options.execFile ?? runFile)(spec.file, spec.args,
|
|
25
|
+
{ ...spec.opts, env, timeout: 5000, maxBuffer: 256 * 1024, windowsHide: true });
|
|
26
|
+
return JSON.parse(output.stdout);
|
|
27
|
+
} catch (error) {
|
|
28
|
+
// Keep diagnostics fixed and credential-free, including native stderr.
|
|
29
|
+
const failure = liveError('native_unavailable');
|
|
30
|
+
failure.cause = liveError(error instanceof SyntaxError ? 'native_probe_invalid_response'
|
|
31
|
+
: error.killed || error.code === 'ETIMEDOUT' ? 'native_probe_timeout' : 'native_probe_command_failed');
|
|
32
|
+
// A missing executable cannot recover by waiting.
|
|
33
|
+
if (attempt === 2 || ['ENOENT', 'EACCES', 'EPERM'].includes(error.code)) throw failure;
|
|
34
|
+
await delay(500);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
16
38
|
const unmaterializedHistory = /^thread [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} is not materialized yet; thread\/turns\/list is unavailable before first user message$/i;
|
|
17
39
|
function rejection(method, error) {
|
|
18
40
|
if (method === 'thread/turns/list' && error?.code === -32600 && unmaterializedHistory.test(error.message ?? '')) return liveError('native_thread_not_materialized');
|
|
@@ -56,12 +78,7 @@ export async function resolveCodexLiveEndpoint(home, options = {}) {
|
|
|
56
78
|
if (!executable) throw liveError('cli_unavailable');
|
|
57
79
|
const env = { ...(options.env ?? process.env), CODEX_HOME: canonical };
|
|
58
80
|
for (const key of Object.keys(env)) if (/^(OPENAI_API_KEY|CODEX_API_KEY)$/i.test(key)) delete env[key];
|
|
59
|
-
|
|
60
|
-
try {
|
|
61
|
-
const spec = spawnSpec(executable, ['app-server', 'daemon', 'version'], platform);
|
|
62
|
-
const output = await (options.execFile ?? runFile)(spec.file, spec.args, { ...spec.opts, env, timeout: 5000, maxBuffer: 256 * 1024, windowsHide: true });
|
|
63
|
-
result = JSON.parse(output.stdout);
|
|
64
|
-
} catch { throw liveError('native_unavailable'); }
|
|
81
|
+
const result = await probeCodexLiveDaemon(executable, env, { ...options, platform });
|
|
65
82
|
const equalPath = windows ? (a, b) => win32.toNamespacedPath(a).toLowerCase() === win32.toNamespacedPath(b).toLowerCase() : (a, b) => resolve(a) === b;
|
|
66
83
|
if (result.status !== 'running' || !(windows ? win32.isAbsolute : isAbsolute)(result.socketPath ?? '') || !equalPath(result.socketPath, advertised)) throw liveError('native_not_running');
|
|
67
84
|
const version = String(result.appServerVersion ?? result.managedCodexVersion ?? '');
|
package/src/server/deck-home.mjs
CHANGED
|
@@ -114,8 +114,9 @@ export function deckLogDir(platform = process.platform, env = process.env, home
|
|
|
114
114
|
/** %LOCALAPPDATA%, or the path it points at on every Windows since Vista. The
|
|
115
115
|
* fallback is not decoration: a service account or a stripped environment can
|
|
116
116
|
* reach this code with the variable unset, and a deck that throws there is a
|
|
117
|
-
* deck that will not start.
|
|
118
|
-
|
|
117
|
+
* deck that will not start. Also where ccdeck.dev's Windows install leaves its
|
|
118
|
+
* mark (depth-facts.mjs installMarkPath). */
|
|
119
|
+
export function localAppData(env = process.env, home = homedir(), platform = process.platform) {
|
|
119
120
|
const { join } = platform === "win32" ? winPath : posixPath;
|
|
120
121
|
return env.LOCALAPPDATA?.trim() || join(home, "AppData", "Local");
|
|
121
122
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// How the deck holds up and who runs it, for the daily "active" report
|
|
2
|
-
// (reports.mjs),
|
|
2
|
+
// (reports.mjs), how an update arrived, for the "update" one, and how a new
|
|
3
|
+
// install arrived, for the "install" one.
|
|
3
4
|
//
|
|
4
5
|
// EVERY VALUE HERE IS A BUCKET, A CATEGORY OR A SMALL COUNT. How long this run
|
|
5
6
|
// took to start, the usage day's peak memory and how many events the deck took
|
|
@@ -13,6 +14,11 @@
|
|
|
13
14
|
// Each bucket is named by its upper edge: "2s" is over one second and up to
|
|
14
15
|
// two, "512m" over 256 MB and up to 512 MB, "1k" a day of 100 to 999 events.
|
|
15
16
|
|
|
17
|
+
import { readFile, stat, unlink } from "node:fs/promises";
|
|
18
|
+
import { homedir } from "node:os";
|
|
19
|
+
import { posix as posixPath, win32 as winPath } from "node:path";
|
|
20
|
+
import { localAppData } from "./deck-home.mjs";
|
|
21
|
+
|
|
16
22
|
export const LAUNCH_BUCKETS = Object.freeze(["1s", "2s", "5s", "10s", "30s", "later"]);
|
|
17
23
|
const LAUNCH_EDGES_MS = [1000, 2000, 5000, 10_000, 30_000];
|
|
18
24
|
|
|
@@ -30,6 +36,22 @@ export const CODEX_PLANS = Object.freeze(["free", "go", "plus", "pro", "pro-lite
|
|
|
30
36
|
* latest, npm run by hand, or a source checkout pulled. */
|
|
31
37
|
export const UPDATE_VIAS = Object.freeze(["self-update", "desktop-updater", "npx", "npm", "checkout"]);
|
|
32
38
|
|
|
39
|
+
/** How a new install arrived: ccdeck.dev's one-line install on macOS (`curl`)
|
|
40
|
+
* or on Windows (PowerShell's `irm`), an installer downloaded by hand, npx, or
|
|
41
|
+
* npm. A source checkout is not an install anybody chose a way for, and says
|
|
42
|
+
* nothing. */
|
|
43
|
+
export const INSTALL_VIAS = Object.freeze(["curl", "irm", "download", "npx", "npm"]);
|
|
44
|
+
|
|
45
|
+
/** How long the one-line installs' mark stays the answer: a script run a week
|
|
46
|
+
* ago is not how an app first opened today arrived. */
|
|
47
|
+
export const INSTALL_MARK_FRESH_MS = 7 * 24 * 60 * 60 * 1000;
|
|
48
|
+
|
|
49
|
+
/** The words the install scripts write in the mark: install.sh's, install.ps1's. */
|
|
50
|
+
const INSTALL_MARK_WORDS = Object.freeze(["curl", "irm"]);
|
|
51
|
+
|
|
52
|
+
/** Past this many bytes the mark is not one word, and is not read. */
|
|
53
|
+
const INSTALL_MARK_MAX_BYTES = 64;
|
|
54
|
+
|
|
33
55
|
/** The most accounts or paired machines a report says; past it, it says this. */
|
|
34
56
|
export const COUNT_CAP = 50;
|
|
35
57
|
|
|
@@ -108,6 +130,76 @@ export function updateVia({ marker, lastVersion, channel, npx = false, now = new
|
|
|
108
130
|
return undefined;
|
|
109
131
|
}
|
|
110
132
|
|
|
133
|
+
/**
|
|
134
|
+
* How this install arrived, for the "install" that says it.
|
|
135
|
+
*
|
|
136
|
+
* An npm install says it by where this copy runs from: npx's cache, or an
|
|
137
|
+
* install somebody ran npm for. The desktop app is a download unless one of
|
|
138
|
+
* ccdeck.dev's one-line installs says otherwise: its script writes one word in a
|
|
139
|
+
* file (installMarkPath) just before it opens the app, and `mark` is that file
|
|
140
|
+
* as read — `{ content, mtimeMs }`, or null. The word counts only when it is
|
|
141
|
+
* one the scripts write and the file is at most INSTALL_MARK_FRESH_MS old. A
|
|
142
|
+
* source checkout says nothing.
|
|
143
|
+
*/
|
|
144
|
+
export function installVia({ channel, npx = false, mark = null, now = new Date() } = {}) {
|
|
145
|
+
if (channel === "npm") return npx ? "npx" : "npm";
|
|
146
|
+
if (channel !== "desktop") return undefined;
|
|
147
|
+
const word = typeof mark?.content === "string" ? mark.content.trim() : "";
|
|
148
|
+
const age = now.getTime() - Number(mark?.mtimeMs);
|
|
149
|
+
return INSTALL_MARK_WORDS.includes(word) && age <= INSTALL_MARK_FRESH_MS ? word : "download";
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Where ccdeck.dev's one-line installs leave their mark: `install-via`, in
|
|
154
|
+
* ccdeck's folder under Application Support on macOS and under %LOCALAPPDATA%
|
|
155
|
+
* on Windows. Linux has none — the desktop app there is always a download — and
|
|
156
|
+
* gets null.
|
|
157
|
+
*
|
|
158
|
+
* A FIXED PATH, NOT THE DECK'S HOME. The scripts cannot know a CCDECK_HOME or a
|
|
159
|
+
* CLAUDE_CONFIG_DIR, and an app opened by an installer or from Finder does not
|
|
160
|
+
* have the shell's environment anyway, so neither moves it. Joined with the
|
|
161
|
+
* target platform's separator, as deck-home.mjs does, so the Windows answer can
|
|
162
|
+
* be checked from any machine.
|
|
163
|
+
*/
|
|
164
|
+
export function installMarkPath(platform = process.platform, env = process.env, home = homedir()) {
|
|
165
|
+
if (platform === "darwin") return posixPath.join(home, "Library", "Application Support", "ccdeck", "install-via");
|
|
166
|
+
if (platform === "win32") return winPath.join(localAppData(env, home, platform), "ccdeck", "install-via");
|
|
167
|
+
return null;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* The mark, read and taken away, with the file system handed in so a test
|
|
172
|
+
* needs no file outside its own folder. `read()` answers `{ content, mtimeMs }`,
|
|
173
|
+
* or null for no mark, no place for one on this platform, or one that is not a
|
|
174
|
+
* word (too big, unreadable); `remove()` deletes it. Neither throws: a mark is a
|
|
175
|
+
* nicety on one report, and no report waits on it.
|
|
176
|
+
*/
|
|
177
|
+
export function installMarkFile({
|
|
178
|
+
platform = process.platform, env = process.env, home = homedir(), fs = { readFile, stat, unlink },
|
|
179
|
+
} = {}) {
|
|
180
|
+
return {
|
|
181
|
+
async read() {
|
|
182
|
+
try {
|
|
183
|
+
const path = installMarkPath(platform, env, home);
|
|
184
|
+
if (!path) return null;
|
|
185
|
+
const st = await fs.stat(path);
|
|
186
|
+
if (!(st.size <= INSTALL_MARK_MAX_BYTES)) return null;
|
|
187
|
+
return { content: String(await fs.readFile(path, "utf8")), mtimeMs: st.mtimeMs };
|
|
188
|
+
} catch {
|
|
189
|
+
return null;
|
|
190
|
+
}
|
|
191
|
+
},
|
|
192
|
+
async remove() {
|
|
193
|
+
try {
|
|
194
|
+
const path = installMarkPath(platform, env, home);
|
|
195
|
+
if (path) await fs.unlink(path);
|
|
196
|
+
} catch {
|
|
197
|
+
// Gone already, or not this deck's to delete: past a week it is ignored anyway.
|
|
198
|
+
}
|
|
199
|
+
},
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
|
|
111
203
|
// ── the deck's own readings ──────────────────────────────────────────────────
|
|
112
204
|
//
|
|
113
205
|
// Read only when an "active" is about to go, never on a hot path, and each by
|
package/src/server/reports.mjs
CHANGED
|
@@ -9,7 +9,11 @@
|
|
|
9
9
|
//
|
|
10
10
|
// - an "install" event the first time, with the ccdeck.dev page its command
|
|
11
11
|
// was copied from when the command said (`--ref`, install-ref.mjs) — a
|
|
12
|
-
// page name, never anything about the person
|
|
12
|
+
// page name, never anything about the person — and how it was installed:
|
|
13
|
+
// ccdeck.dev's one-line install on macOS (curl) or Windows (irm), a
|
|
14
|
+
// downloaded installer, npx or npm (depth-facts.mjs installVia; the
|
|
15
|
+
// one-line installs leave a one-word file, `install-via`, that the first
|
|
16
|
+
// report reads and then deletes),
|
|
13
17
|
// - an "update" event, with the version it came from, when the version moves,
|
|
14
18
|
// and how the new one arrived: the deck's own update, the desktop app's
|
|
15
19
|
// updater, npx, npm, or a source checkout,
|
|
@@ -109,7 +113,8 @@ import { setupFacts, sinceInstallBucket, whenSetupKnown } from "./activation.mjs
|
|
|
109
113
|
import { notedRef, refSlug } from "./install-ref.mjs";
|
|
110
114
|
import { UI_LANGUAGE_MAX, uiLanguageCode } from "./ui-language.mjs";
|
|
111
115
|
import {
|
|
112
|
-
CLAUDE_PLANS, CODEX_PLANS, cappedCount, deckDepth, eventsBucket,
|
|
116
|
+
CLAUDE_PLANS, CODEX_PLANS, cappedCount, deckDepth, eventsBucket, installMarkFile, installVia, launchBucket,
|
|
117
|
+
memoryBucket, updateVia,
|
|
113
118
|
} from "./depth-facts.mjs";
|
|
114
119
|
import { daysUsedBucket, normaliseRating, ratingDue, ratingStage, scoreOf } from "./rating.mjs";
|
|
115
120
|
|
|
@@ -551,6 +556,12 @@ export function scrub(text, home = homedir(), root = PKG_ROOT) {
|
|
|
551
556
|
* where the question's outcome is kept a second time, out of reach of an
|
|
552
557
|
* older deck's write of prefs.json (ratingFile). Default: none — the deck's
|
|
553
558
|
* own reporter passes ratingFile(), so no test writes beside a real prefs.json.
|
|
559
|
+
* @param {{ read: () => Promise<{ content: string, mtimeMs: number } | null>, remove: () => Promise<void> } | null} [deps.installMark]
|
|
560
|
+
* the mark ccdeck.dev's one-line installs leave (depth-facts.mjs
|
|
561
|
+
* installMarkFile): read for the desktop app's install event, and deleted
|
|
562
|
+
* once that event is settled, or at once when this install has reported
|
|
563
|
+
* before. Default: none — the deck's own reporter passes installMarkFile(),
|
|
564
|
+
* so no test reads or deletes a file in a real home.
|
|
554
565
|
*/
|
|
555
566
|
export function createReporter({
|
|
556
567
|
fetchImpl = globalThis.fetch,
|
|
@@ -575,6 +586,7 @@ export function createReporter({
|
|
|
575
586
|
uptime = () => process.uptime() * 1000,
|
|
576
587
|
firstRun = bootFoundNoPrefs,
|
|
577
588
|
ratingKept = null,
|
|
589
|
+
installMark = null,
|
|
578
590
|
} = {}) {
|
|
579
591
|
const errorsSent = [];
|
|
580
592
|
const lastSentAt = new Map();
|
|
@@ -704,6 +716,36 @@ export function createReporter({
|
|
|
704
716
|
}
|
|
705
717
|
}
|
|
706
718
|
|
|
719
|
+
/** The one-line installs' mark, for the install event. Only the desktop app
|
|
720
|
+
* reads it or deletes it: the app is what those scripts install, and an npm
|
|
721
|
+
* deck beside it, on settings of its own, is not the install the mark is
|
|
722
|
+
* about. */
|
|
723
|
+
const markHere = () => facts.channel === "desktop" && installMark != null;
|
|
724
|
+
/** Whether this run has already taken the mark away. */
|
|
725
|
+
let markGone = false;
|
|
726
|
+
|
|
727
|
+
/** The mark as read, or null. Never throws. */
|
|
728
|
+
async function markNow() {
|
|
729
|
+
if (!markHere()) return null;
|
|
730
|
+
try {
|
|
731
|
+
return (await installMark.read()) ?? null;
|
|
732
|
+
} catch {
|
|
733
|
+
return null;
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
/** Take the mark away, best effort, once a run. Never throws: a mark that
|
|
738
|
+
* will not go is ignored once it is a week old. */
|
|
739
|
+
async function dropMark() {
|
|
740
|
+
if (!markHere() || markGone) return;
|
|
741
|
+
markGone = true;
|
|
742
|
+
try {
|
|
743
|
+
await installMark.remove();
|
|
744
|
+
} catch {
|
|
745
|
+
// Left where it is.
|
|
746
|
+
}
|
|
747
|
+
}
|
|
748
|
+
|
|
707
749
|
/** The coarse usage the "active" report carries: the last finished day before
|
|
708
750
|
* `today`, its date as `usageDay` and its counts beside it. Nothing at all
|
|
709
751
|
* when there is no such day yet — a first launch has no yesterday — and only
|
|
@@ -987,9 +1029,14 @@ export function createReporter({
|
|
|
987
1029
|
const ref = refSlug(prefs.current().report.ref) ?? refNow();
|
|
988
1030
|
const body = { installId, kind: "install", ...factsNow(), ...setupNow() };
|
|
989
1031
|
addIf(body, "ref", ref);
|
|
1032
|
+
// How it arrived: npx or npm, or for the desktop app the one-line install
|
|
1033
|
+
// whose script left a fresh mark, else a download (depth-facts.mjs).
|
|
1034
|
+
addIf(body, "via", installVia({ channel: facts.channel, npx, mark: await markNow(), now: now() }));
|
|
990
1035
|
// Refused by the API is as done as sent: the same body would be refused again.
|
|
991
1036
|
if (settled(await call("POST", "/v1/app/events", body))) {
|
|
992
1037
|
await remember(installId, { lastVersion: facts.version, ref: "" });
|
|
1038
|
+
// Said once, and only a new install has a way it arrived.
|
|
1039
|
+
await dropMark();
|
|
993
1040
|
} else if (ref) {
|
|
994
1041
|
await remember(installId, { ref });
|
|
995
1042
|
}
|
|
@@ -1004,6 +1051,9 @@ export function createReporter({
|
|
|
1004
1051
|
await remember(installId, { lastVersion: facts.version, selfUpdate: null });
|
|
1005
1052
|
}
|
|
1006
1053
|
}
|
|
1054
|
+
// This install has reported before: a mark beside it was left by a
|
|
1055
|
+
// reinstall over it, which is not a new install.
|
|
1056
|
+
if (lastVersion) await dropMark();
|
|
1007
1057
|
|
|
1008
1058
|
if (lastActiveDay !== today) {
|
|
1009
1059
|
// Usage rides on the "active" event alone, and is read only here — the one
|
|
@@ -1383,4 +1433,5 @@ export const reporter = createReporter({
|
|
|
1383
1433
|
return integrationsStore.connectedKinds();
|
|
1384
1434
|
},
|
|
1385
1435
|
ratingKept: ratingFile(),
|
|
1436
|
+
installMark: installMarkFile(),
|
|
1386
1437
|
});
|
package/src/server/tui-view.mjs
CHANGED
|
@@ -205,8 +205,9 @@ export function tuiKey(state, str, key = {}, { now = 0, g } = {}) {
|
|
|
205
205
|
if (str === "q" || name === "escape") return { state, effect: { type: "quit" } };
|
|
206
206
|
if (str === "?") return { state: { ...state, help: true }, effect: null };
|
|
207
207
|
|
|
208
|
-
// The
|
|
209
|
-
//
|
|
208
|
+
// The tabs: the arrows walk along them, as a tab bar anywhere else does —
|
|
209
|
+
// the way the footer offers. c (Codex's list, and back) and l (the Local
|
|
210
|
+
// network, and back) stay as shortcuts for whoever learnt them.
|
|
210
211
|
if (str === "c") return sideKey({ ...state, notice: null }, null, { now, g });
|
|
211
212
|
if (str === "l") return lanSideKey({ ...state, notice: null }, { now, g });
|
|
212
213
|
if (name === "left" || name === "right") return stepSide({ ...state, notice: null }, name === "right" ? 1 : -1);
|
|
@@ -782,18 +783,20 @@ function noticeLine(state, { tone, g, unicode, now }) {
|
|
|
782
783
|
* Each key is a cap where the terminal can draw one. */
|
|
783
784
|
function footerLine(state, width, look) {
|
|
784
785
|
const { tone, unicode, skin } = look;
|
|
786
|
+
// The tabs are walked with the arrows, offered once there is more than one.
|
|
787
|
+
const tabsKey = unicode ? "←→" : "left/right";
|
|
788
|
+
const tabs = sidesOf(state).length > 1 ? [[tabsKey, "tabs"]] : [];
|
|
785
789
|
const keys = state.signin ? signinKeys(state.signin) : state.codexSignin ? codexSigninKeys(state.codexSignin)
|
|
786
790
|
: lanInvitePage(state) ? lanInviteKeys() : onLan(state) ? [
|
|
787
791
|
...lanFooterKeys(state, { now: look.now, unicode }),
|
|
788
|
-
|
|
792
|
+
...tabs,
|
|
789
793
|
["?", "keys"],
|
|
790
794
|
["q", "quit"],
|
|
791
795
|
] : [
|
|
792
796
|
[unicode ? "↑↓" : "up/down", "move"],
|
|
793
797
|
["enter", "switch"],
|
|
794
798
|
["m", "actions"],
|
|
795
|
-
...
|
|
796
|
-
...(hasLan(state) ? [["l", "network"]] : []),
|
|
799
|
+
...tabs,
|
|
797
800
|
["b", "best"],
|
|
798
801
|
state.deck ? ["a", "auto-switch"] : ["d", "start the deck"],
|
|
799
802
|
["+", "add"],
|
|
@@ -806,7 +809,7 @@ function footerLine(state, width, look) {
|
|
|
806
809
|
const list = keys.slice();
|
|
807
810
|
// r goes first, then the moves, then b: the screen says what they do, and ?
|
|
808
811
|
// and q are how to find out and how to leave.
|
|
809
|
-
for (const drop of ["r", unicode ? "↑↓" : "up/down", "b", "+", "a", "d", "m",
|
|
812
|
+
for (const drop of ["r", unicode ? "↑↓" : "up/down", "b", "+", "a", "d", "m", tabsKey, "n", "x", "space", "enter"]) {
|
|
810
813
|
if (textWidth(draw(list)) <= width) break;
|
|
811
814
|
const i = list.findIndex(([k]) => k === drop);
|
|
812
815
|
if (i !== -1) list.splice(i, 1);
|
|
@@ -1620,7 +1623,7 @@ function withHelp(base, width, look) {
|
|
|
1620
1623
|
["a", "turn Auto-switch on or off"],
|
|
1621
1624
|
["+", "add an account, signed in from any browser"],
|
|
1622
1625
|
["r", "read the usage again"],
|
|
1623
|
-
[unicode ? "
|
|
1626
|
+
[unicode ? "← →" : "left right", `the tabs ${g.bullet} c Codex ${g.bullet} l Local network`],
|
|
1624
1627
|
["t", "the machine: live, or the last hours"],
|
|
1625
1628
|
["d", "start the deck, when none is running"],
|
|
1626
1629
|
["ctrl+l", "draw the screen again"],
|