ccdeck 3.82.4 → 4.0.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.
- package/LICENSING.md +42 -4
- package/README.md +183 -72
- package/THIRD_PARTY_NOTICES.md +243 -17
- package/bin/cli/tui.js +58 -4
- package/bin/deck.js +27 -1
- package/dist/web/assets/AccountBridge-OQHT5qmS.js +1 -0
- package/dist/web/assets/AccountSection-BpIHPhF3.js +1 -0
- package/dist/web/assets/BrowserWatchModal-DBdt52v7.js +1 -0
- package/dist/web/assets/FeedbackConversations-BJjgXI0-.js +1 -0
- package/dist/web/assets/IntegrationModal-DQ0vEz4X.js +7 -0
- package/dist/web/assets/IntegrationSkeleton-JCPbqp96.js +1 -0
- package/dist/web/assets/RadioPanel-Be6AkrKl.js +1 -0
- package/dist/web/assets/StageShell-Dq0JOQhd.js +4 -0
- package/dist/web/assets/TrafficRadar-7jqJbhaK.js +8 -0
- package/dist/web/assets/UsageHistoryModal-ckawZGoe.js +1 -0
- package/dist/web/assets/addon-unicode-graphemes-DW3WJwyh.js +18 -0
- package/dist/web/assets/addon-web-links-BWjmmSgS.js +12 -0
- package/dist/web/assets/addon-webgl-CLK4R-_u.js +75 -0
- package/dist/web/assets/app-40gNTTfq.js +361 -0
- package/dist/web/assets/app-BRjYF6oD.css +1 -0
- package/dist/web/assets/{index-B-l-VxLm.js → index-XIY3yFiN.js} +1 -1
- package/dist/web/assets/inspector-status-pane-BV_m7eBv.js +1 -0
- package/dist/web/assets/screens-9_ivqfcF.js +12 -0
- package/dist/web/assets/screens-DUniTTbC.css +1 -0
- package/dist/web/assets/stage-board-NF_wgGRA.js +2 -0
- package/dist/web/assets/use-account-BUmI-A8e.js +1 -0
- package/dist/web/assets/xterm-4jYizCpg.js +27 -0
- package/dist/web/assets/xterm-sheet-6GBZ9nXN.css +32 -0
- package/dist/web/index.html +16 -6
- package/package.json +13 -1
- package/release-notes.json +67 -0
- package/src/server/account-client.mjs +196 -0
- package/src/server/account-connect.mjs +238 -0
- package/src/server/account-flag.mjs +106 -0
- package/src/server/account-projects.mjs +1 -1
- package/src/server/account-service.mjs +532 -0
- package/src/server/account-status.mjs +293 -0
- package/src/server/account-store.mjs +137 -0
- package/src/server/account-sync.mjs +473 -0
- package/src/server/account-token-store.mjs +216 -0
- package/src/server/account-ui-fields.mjs +126 -0
- package/src/server/account-watch.mjs +1 -1
- package/src/server/browser-watch-log.mjs +1 -1
- package/src/server/browser-watch-store.mjs +1 -1
- package/src/server/ccdeck-account-routes.mjs +252 -0
- package/src/server/ccusage-install.mjs +2 -2
- package/src/server/ccusage-registry.mjs +4 -4
- package/src/server/ccusage-session.mjs +11 -0
- package/src/server/claude-accounts.mjs +1 -1
- package/src/server/claude-recovery.mjs +9 -4
- package/src/server/claude-settings-catalog.mjs +6 -6
- package/src/server/claude-settings.mjs +1 -1
- package/src/server/codex-auto.mjs +1 -1
- package/src/server/codex-cost-usage.mjs +7 -2
- package/src/server/codex-live-checkpoint.mjs +24 -9
- package/src/server/codex-live-engine.mjs +14 -4
- package/src/server/codex-live-handoff.mjs +53 -9
- package/src/server/codex-names.mjs +49 -0
- package/src/server/codex-translate.mjs +1 -1
- package/src/server/codex-ultrafast.d.mts +3 -0
- package/src/server/codex-ultrafast.mjs +5 -0
- package/src/server/codex-watch.mjs +25 -0
- package/src/server/command-panel-engine.mjs +300 -0
- package/src/server/command-panel-platform.mjs +99 -0
- package/src/server/cswap-auto-choice.mjs +1 -1
- package/src/server/cswap-auto-loop.mjs +1 -1
- package/src/server/cswap-install.mjs +21 -40
- package/src/server/deck-home.mjs +6 -0
- package/src/server/deck-prefs.mjs +53 -1
- package/src/server/detach.mjs +1 -1
- package/src/server/engine-download.mjs +277 -0
- package/src/server/engine-install.mjs +378 -0
- package/src/server/engine-package.mjs +267 -0
- package/src/server/event-log.mjs +7 -1
- package/src/server/event-pipeline.mjs +29 -1
- package/src/server/ghostty-handoff.mjs +81 -0
- package/src/server/index.mjs +143 -5
- package/src/server/installer.mjs +4 -1
- package/src/server/integrations/jira-write-guard.mjs +14 -208
- package/src/server/integrations/store.mjs +37 -19
- package/src/server/integrations/write-guard.mjs +223 -0
- package/src/server/intel-cpu-temperature.mjs +26 -0
- package/src/server/lifecycle.mjs +69 -6
- package/src/server/log-replay.mjs +4 -0
- package/src/server/login-service.mjs +7 -1
- package/src/server/macmon.mjs +1 -1
- package/src/server/npm-latest.mjs +1 -1
- package/src/server/org-telemetry.mjs +1 -1
- package/src/server/output-watch.mjs +4 -1
- package/src/server/panel-provenance.mjs +390 -0
- package/src/server/pinned-build.mjs +14 -0
- package/src/server/prefs-refusal.mjs +8 -1
- package/src/server/prefs-routes.mjs +60 -11
- package/src/server/pro-engine-client.mjs +339 -0
- package/src/server/pro-engine-install.mjs +294 -0
- package/src/server/pro-engine-terminal.mjs +308 -0
- package/src/server/project-discovery.mjs +139 -0
- package/src/server/provider-session-name.mjs +58 -0
- package/src/server/quota-closes.mjs +1 -1
- package/src/server/quota-history.mjs +1 -1
- package/src/server/reports.mjs +86 -21
- package/src/server/request-gates.mjs +34 -5
- package/src/server/restart-note.mjs +1 -1
- package/src/server/seed-boundary.mjs +489 -0
- package/src/server/session-counts.mjs +244 -0
- package/src/server/session-deck-names.mjs +143 -0
- package/src/server/session-enrichment.mjs +43 -6
- package/src/server/session-name-route.mjs +73 -0
- package/src/server/session-summary.mjs +12 -1
- package/src/server/session-transcript-routes.mjs +167 -0
- package/src/server/swap-log.mjs +1 -1
- package/src/server/system-metrics.mjs +57 -0
- package/src/server/terminal-bridge.mjs +485 -0
- package/src/server/terminal-folder.mjs +61 -0
- package/src/server/terminal-js-routes.mjs +752 -0
- package/src/server/terminal-routes.mjs +553 -0
- package/src/server/terminal-sessions.mjs +759 -0
- package/src/server/terminal-socket.mjs +403 -0
- package/src/server/terminal-target.mjs +928 -0
- package/src/server/thermal-metrics.mjs +13 -9
- package/src/server/tmux-control.mjs +1319 -0
- package/src/server/tmux-download.mjs +220 -0
- package/src/server/tmux.mjs +542 -0
- package/src/server/token-redact.mjs +42 -3
- package/src/server/tool-audit-report.mjs +44 -6
- package/src/server/tool-audit-routes.mjs +12 -1
- package/src/server/tool-audit.mjs +42 -8
- package/src/server/traffic-radar-monitor.mjs +1 -1
- package/src/server/traffic-radar-permission.mjs +1 -1
- package/src/server/transcript-gate.mjs +1 -1
- package/src/server/transcript-scan.mjs +15 -7
- package/src/server/transcript-turns.mjs +154 -0
- package/src/server/tui-network.mjs +1 -0
- package/src/server/tui-view.mjs +28 -0
- package/src/server/utf8-carry.mjs +159 -0
- package/src/server/uv-bootstrap.mjs +2 -2
- package/src/server/windows-acl.mjs +158 -0
- package/src/server/ws-frames.mjs +690 -0
- package/dist/web/assets/BrowserWatchModal-CWVooKxD.js +0 -1
- package/dist/web/assets/IntegrationModal-DLX43RIK.js +0 -7
- package/dist/web/assets/RadioPanel-Cj6PjrvQ.js +0 -1
- package/dist/web/assets/TrafficRadar-Bq1YcuHB.js +0 -8
- package/dist/web/assets/UsageHistoryModal-CMSCca5_.js +0 -1
- package/dist/web/assets/app-BHxsMz3-.js +0 -358
- package/dist/web/assets/app-CbXmr9rC.css +0 -1
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
// ccdeck's own tmux, fetched for a machine that has no usable one.
|
|
2
|
+
//
|
|
3
|
+
// The terminal panel runs every session inside tmux 3.2 or newer, and most of
|
|
4
|
+
// the people who run ccdeck have never installed tmux. Installing it for them
|
|
5
|
+
// system-wide needs sudo, which a deck that installs nothing outside its own
|
|
6
|
+
// folder will not ask for. So ccdeck builds tmux itself — scripts/tmux/build.sh,
|
|
7
|
+
// compiled by the `tmux` workflow — and publishes it as a prerelease of its own
|
|
8
|
+
// repository. This file fetches the build for this machine into the deck's
|
|
9
|
+
// data folder.
|
|
10
|
+
//
|
|
11
|
+
// THE TRUST IS IN THIS FILE, NOT IN THE RELEASE PAGE. uv-bootstrap.mjs checks
|
|
12
|
+
// uv against the SHA-256 that Astral publishes beside it, because Astral is the
|
|
13
|
+
// publisher and the deck is not. Here the deck is the publisher, so the hashes
|
|
14
|
+
// are written below, in the package the user already chose to run: a release
|
|
15
|
+
// asset that was swapped after publication does not match, and is never run.
|
|
16
|
+
// Nothing is executed before it matches, nothing lands outside
|
|
17
|
+
// <data>/tools/tmux, and deleting that folder undoes all of it.
|
|
18
|
+
//
|
|
19
|
+
// AGENTS_DECK_NO_INSTALL=1 turns this off with every other managed install, and
|
|
20
|
+
// AGENTS_DECK_NO_DOWNLOAD=1 turns off executable downloads alone, as for uv.
|
|
21
|
+
import { createHash } from "node:crypto";
|
|
22
|
+
import { chmod, mkdir, mkdtemp, rename, rm, writeFile } from "node:fs/promises";
|
|
23
|
+
import { existsSync } from "node:fs";
|
|
24
|
+
import { join } from "node:path";
|
|
25
|
+
import { execFile } from "node:child_process";
|
|
26
|
+
import { deckDataDir } from "./deck-home.mjs";
|
|
27
|
+
|
|
28
|
+
/** The build the deck fetches. A new build is a new tag and four new hashes,
|
|
29
|
+
* taken from the tag's own workflow run (builds are not byte-for-byte
|
|
30
|
+
* reproducible, so a branch run's hashes never match a release) and checked
|
|
31
|
+
* against the downloaded assets; tmux-download.test.ts holds the shape.
|
|
32
|
+
* Never upload over a published tag: decks in the field pin these bytes. */
|
|
33
|
+
export const TMUX_BUILD = Object.freeze({
|
|
34
|
+
tag: "tmux-3.8-1",
|
|
35
|
+
version: "3.8",
|
|
36
|
+
sha256: Object.freeze({
|
|
37
|
+
"linux-x64": "9484cab5aab2ebe12ca830e54a0f9569d6261e178cf18f1ad1a22246295b54e1",
|
|
38
|
+
"linux-arm64": "29a92f47a95d4fc680bc623f10545b3b424dd6c88bf242e79954fda42a90045f",
|
|
39
|
+
"darwin-x64": "7a7774db99fe2a22015a737db6eeaa1c063b36e5e45c6965ed3ea7fa9e615888",
|
|
40
|
+
"darwin-arm64": "cd298aefcf669ae084e2d5361b7621f12c9a65d18983f47c5dfcd0740c44f9c5",
|
|
41
|
+
}),
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
const RELEASES = "https://github.com/BarganConstantin/ccdeck/releases/download";
|
|
45
|
+
/** A build is about 1 MB; anything near this is not one. */
|
|
46
|
+
const MAX_BYTES = 32 << 20;
|
|
47
|
+
const DOWNLOAD_TIMEOUT_MS = 120_000;
|
|
48
|
+
|
|
49
|
+
/** Which build this machine runs, or null where ccdeck publishes none.
|
|
50
|
+
* Rosetta is not special-cased: an x64 Node on Apple silicon gets the x64
|
|
51
|
+
* build, which runs. Windows has no tmux at all. */
|
|
52
|
+
export function tmuxBuildKey(platform = process.platform, arch = process.arch) {
|
|
53
|
+
if (platform !== "linux" && platform !== "darwin") return null;
|
|
54
|
+
if (arch !== "x64" && arch !== "arm64") return null;
|
|
55
|
+
return `${platform}-${arch}`;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** The archive's name in the release, matching build.sh's output. */
|
|
59
|
+
export function tmuxAssetName(key, build = TMUX_BUILD) {
|
|
60
|
+
return `tmux-${build.version}-${key}.tar.gz`;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** Where the fetched tmux lives. One folder per build, so a newer build never
|
|
64
|
+
* replaces a binary a running tmux server was started from. */
|
|
65
|
+
export function managedTmuxDir(dataDir = deckDataDir(), build = TMUX_BUILD) {
|
|
66
|
+
return join(dataDir, "tools", "tmux", build.tag);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** The fetched binary's path, whether or not it has been fetched. */
|
|
70
|
+
export function managedTmuxPath(dataDir = deckDataDir(), build = TMUX_BUILD) {
|
|
71
|
+
return join(managedTmuxDir(dataDir, build), "tmux");
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** Why a download cannot be offered here, or null when it can. */
|
|
75
|
+
export function tmuxDownloadBlocked({
|
|
76
|
+
env = process.env, platform = process.platform, arch = process.arch, build = TMUX_BUILD,
|
|
77
|
+
} = {}) {
|
|
78
|
+
if (env.AGENTS_DECK_NO_INSTALL === "1") return "install_disabled";
|
|
79
|
+
if (env.AGENTS_DECK_NO_DOWNLOAD === "1") return "download_disabled";
|
|
80
|
+
const key = tmuxBuildKey(platform, arch);
|
|
81
|
+
if (!key) return "unsupported_platform";
|
|
82
|
+
if (!/^[0-9a-f]{64}$/.test(build.sha256[key] ?? "")) return "not_published";
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const sha256 = (buf) => createHash("sha256").update(buf).digest("hex");
|
|
87
|
+
|
|
88
|
+
/** execFile, resolved rather than thrown: `{ code, stdout }`. */
|
|
89
|
+
function exec(file, args, timeout = 15_000) {
|
|
90
|
+
return new Promise((resolve) => {
|
|
91
|
+
execFile(file, args, { timeout, maxBuffer: 1 << 20 }, (err, stdout) => {
|
|
92
|
+
resolve({ code: err ? (typeof err.code === "number" ? err.code : 1) : 0, stdout: String(stdout ?? "") });
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Fetch, verify and unpack this machine's build into managedTmuxDir.
|
|
99
|
+
*
|
|
100
|
+
* Resolves `{ ok: true, path }` or `{ ok: false, reason }` and never rejects:
|
|
101
|
+
* a deck without tmux is an expected state, and the panel says why. Reasons:
|
|
102
|
+
* install_disabled, download_disabled, unsupported_platform, not_published,
|
|
103
|
+
* download_failed, too_large, checksum_mismatch, extract_failed, does_not_run.
|
|
104
|
+
*
|
|
105
|
+
* `onProgress` hears how far it is, for the panel's bar: `{ stage:
|
|
106
|
+
* "downloading", received, total }` as the bytes arrive (`total` null when
|
|
107
|
+
* the server did not say), then `{ stage: "checking" }` while the build is
|
|
108
|
+
* verified, unpacked and run once.
|
|
109
|
+
*/
|
|
110
|
+
export async function downloadTmux({
|
|
111
|
+
dataDir = deckDataDir(), env = process.env, platform = process.platform, arch = process.arch,
|
|
112
|
+
build = TMUX_BUILD, fetchImpl = globalThis.fetch, execImpl = exec, onProgress = () => {},
|
|
113
|
+
} = {}) {
|
|
114
|
+
const blocked = tmuxDownloadBlocked({ env, platform, arch, build });
|
|
115
|
+
if (blocked) return { ok: false, reason: blocked };
|
|
116
|
+
const key = tmuxBuildKey(platform, arch);
|
|
117
|
+
const dest = managedTmuxDir(dataDir, build);
|
|
118
|
+
|
|
119
|
+
let archive;
|
|
120
|
+
try {
|
|
121
|
+
const res = await fetchImpl(`${RELEASES}/${build.tag}/${tmuxAssetName(key, build)}`, {
|
|
122
|
+
redirect: "follow", signal: AbortSignal.timeout(DOWNLOAD_TIMEOUT_MS),
|
|
123
|
+
});
|
|
124
|
+
if (!res.ok) return { ok: false, reason: "download_failed" };
|
|
125
|
+
const length = Number(res.headers?.get?.("content-length") ?? 0);
|
|
126
|
+
if (length > MAX_BYTES) return { ok: false, reason: "too_large" };
|
|
127
|
+
const total = length > 0 ? length : null;
|
|
128
|
+
onProgress({ stage: "downloading", received: 0, total });
|
|
129
|
+
archive = await readCapped(res, MAX_BYTES, (received) => onProgress({ stage: "downloading", received, total }));
|
|
130
|
+
if (!archive) return { ok: false, reason: "too_large" };
|
|
131
|
+
} catch {
|
|
132
|
+
return { ok: false, reason: "download_failed" };
|
|
133
|
+
}
|
|
134
|
+
onProgress({ stage: "checking" });
|
|
135
|
+
if (sha256(archive) !== build.sha256[key]) return { ok: false, reason: "checksum_mismatch" };
|
|
136
|
+
|
|
137
|
+
// Unpacked inside the tools folder, under a name nobody can predict — the
|
|
138
|
+
// lesson uv-bootstrap.mjs records about a staging directory in /tmp — and
|
|
139
|
+
// moved into place only after the binary has run.
|
|
140
|
+
const parent = join(dataDir, "tools", "tmux");
|
|
141
|
+
let staging = null;
|
|
142
|
+
try {
|
|
143
|
+
await mkdir(parent, { recursive: true, mode: 0o700 });
|
|
144
|
+
staging = await mkdtemp(join(parent, ".staging-"));
|
|
145
|
+
const file = join(staging, "build.tar.gz");
|
|
146
|
+
await writeFile(file, archive);
|
|
147
|
+
const untar = await execImpl("tar", ["-xzf", file, "-C", staging]);
|
|
148
|
+
await rm(file, { force: true });
|
|
149
|
+
const bin = join(staging, "tmux");
|
|
150
|
+
if (untar.code !== 0 || !existsSync(bin)) return { ok: false, reason: "extract_failed" };
|
|
151
|
+
await chmod(bin, 0o755);
|
|
152
|
+
const v = await execImpl(bin, ["-V"]);
|
|
153
|
+
if (v.code !== 0 || !v.stdout.trim().startsWith(`tmux ${build.version}`)) return { ok: false, reason: "does_not_run" };
|
|
154
|
+
await rm(dest, { recursive: true, force: true });
|
|
155
|
+
await rename(staging, dest);
|
|
156
|
+
staging = null;
|
|
157
|
+
return { ok: true, path: join(dest, "tmux") };
|
|
158
|
+
} catch {
|
|
159
|
+
return { ok: false, reason: "extract_failed" };
|
|
160
|
+
} finally {
|
|
161
|
+
if (staging) await rm(staging, { recursive: true, force: true }).catch(() => {});
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/** The body, chunk by chunk as it arrives, telling `progress` the bytes so far;
|
|
166
|
+
* null once it passes `cap`. A response with no stream is read whole. */
|
|
167
|
+
async function readCapped(res, cap, progress) {
|
|
168
|
+
const reader = res.body?.getReader?.();
|
|
169
|
+
if (!reader) {
|
|
170
|
+
const whole = Buffer.from(await res.arrayBuffer());
|
|
171
|
+
progress(whole.length);
|
|
172
|
+
return whole.length > cap ? null : whole;
|
|
173
|
+
}
|
|
174
|
+
const chunks = [];
|
|
175
|
+
let received = 0;
|
|
176
|
+
for (;;) {
|
|
177
|
+
const { done, value } = await reader.read();
|
|
178
|
+
if (done) break;
|
|
179
|
+
received += value.byteLength;
|
|
180
|
+
if (received > cap) { await reader.cancel().catch(() => {}); return null; }
|
|
181
|
+
chunks.push(Buffer.from(value));
|
|
182
|
+
progress(received);
|
|
183
|
+
}
|
|
184
|
+
return Buffer.concat(chunks, received);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
let flight = null;
|
|
188
|
+
let progress = null;
|
|
189
|
+
let lastFailure = null;
|
|
190
|
+
/** How long a failed download is believed before the next status asks again:
|
|
191
|
+
* long enough that a panel polling while offline does not hammer GitHub,
|
|
192
|
+
* short enough that a reconnect is noticed without a deck restart. */
|
|
193
|
+
export const RETRY_AFTER_MS = 5 * 60_000;
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* downloadTmux, once at a time: every caller while a download is out shares
|
|
197
|
+
* it, and a finished one — good or bad — lets the next caller try again.
|
|
198
|
+
*/
|
|
199
|
+
export function ensureManagedTmux(options, now = Date.now) {
|
|
200
|
+
flight ??= downloadTmux({ ...options, onProgress: (p) => { progress = p; } }).then((r) => {
|
|
201
|
+
lastFailure = r.ok ? null : { reason: r.reason, at: now() };
|
|
202
|
+
return r;
|
|
203
|
+
}).finally(() => { flight = null; progress = null; });
|
|
204
|
+
return flight;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/** Whether a download is out right now, for the panel's "setting up" line. */
|
|
208
|
+
export const tmuxDownloading = () => flight !== null;
|
|
209
|
+
|
|
210
|
+
/** How far the download that is out has got (downloadTmux's onProgress), or
|
|
211
|
+
* null when none is out or it has not heard back yet. */
|
|
212
|
+
export const tmuxDownloadProgress = () => (flight ? progress : null);
|
|
213
|
+
|
|
214
|
+
/** The last download's failure while it is still believed, else null. */
|
|
215
|
+
export function recentTmuxFailure(now = Date.now) {
|
|
216
|
+
return lastFailure && now() - lastFailure.at < RETRY_AFTER_MS ? lastFailure : null;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/** For tests: forget the last failure. */
|
|
220
|
+
export function resetTmuxDownload() { lastFailure = null; progress = null; }
|