claude-code-infinite 1.0.34 → 1.0.36
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 +56 -0
- package/dist/body-shape.d.ts +49 -0
- package/dist/body-shape.d.ts.map +1 -0
- package/dist/body-shape.js +232 -0
- package/dist/body-shape.js.map +1 -0
- package/dist/cli-main.js +19 -2
- package/dist/cli-main.js.map +1 -1
- package/dist/cli.js +23 -10
- package/dist/cli.js.map +1 -1
- package/dist/count-tokens.d.ts +15 -2
- package/dist/count-tokens.d.ts.map +1 -1
- package/dist/count-tokens.js +13 -4
- package/dist/count-tokens.js.map +1 -1
- package/dist/financial-redaction.d.ts +12 -0
- package/dist/financial-redaction.d.ts.map +1 -0
- package/dist/financial-redaction.js +509 -0
- package/dist/financial-redaction.js.map +1 -0
- package/dist/hooks.d.ts +2 -0
- package/dist/hooks.d.ts.map +1 -1
- package/dist/hooks.js +4 -0
- package/dist/hooks.js.map +1 -1
- package/dist/image-tokens.d.ts +6 -1
- package/dist/image-tokens.d.ts.map +1 -1
- package/dist/image-tokens.js +75 -14
- package/dist/image-tokens.js.map +1 -1
- package/dist/lane-activity.d.ts +42 -0
- package/dist/lane-activity.d.ts.map +1 -0
- package/dist/lane-activity.js +79 -0
- package/dist/lane-activity.js.map +1 -0
- package/dist/memtree-newest.d.ts +11 -3
- package/dist/memtree-newest.d.ts.map +1 -1
- package/dist/memtree-newest.js +24 -4
- package/dist/memtree-newest.js.map +1 -1
- package/dist/memtree.d.ts +10 -0
- package/dist/memtree.d.ts.map +1 -1
- package/dist/memtree.js +14 -0
- package/dist/memtree.js.map +1 -1
- package/dist/proxy.d.ts +21 -0
- package/dist/proxy.d.ts.map +1 -1
- package/dist/proxy.js +153 -12
- package/dist/proxy.js.map +1 -1
- package/dist/refusal-reason.d.ts +70 -0
- package/dist/refusal-reason.d.ts.map +1 -0
- package/dist/refusal-reason.js +132 -0
- package/dist/refusal-reason.js.map +1 -0
- package/dist/reqlog.d.ts +25 -2
- package/dist/reqlog.d.ts.map +1 -1
- package/dist/reqlog.js +1 -1
- package/dist/reqlog.js.map +1 -1
- package/dist/request-sizing.d.ts +38 -2
- package/dist/request-sizing.d.ts.map +1 -1
- package/dist/request-sizing.js +72 -6
- package/dist/request-sizing.js.map +1 -1
- package/dist/route-fallback.d.ts +2 -0
- package/dist/route-fallback.d.ts.map +1 -1
- package/dist/route-fallback.js +8 -8
- package/dist/route-fallback.js.map +1 -1
- package/dist/secret-redaction.d.ts +25 -0
- package/dist/secret-redaction.d.ts.map +1 -0
- package/dist/secret-redaction.js +492 -0
- package/dist/secret-redaction.js.map +1 -0
- package/dist/slow-upload.d.ts +40 -0
- package/dist/slow-upload.d.ts.map +1 -0
- package/dist/slow-upload.js +69 -0
- package/dist/slow-upload.js.map +1 -0
- package/dist/status-link.d.ts +18 -0
- package/dist/status-link.d.ts.map +1 -0
- package/dist/status-link.js +103 -0
- package/dist/status-link.js.map +1 -0
- package/dist/statusline-auto.d.ts +15 -0
- package/dist/statusline-auto.d.ts.map +1 -0
- package/dist/statusline-auto.js +125 -0
- package/dist/statusline-auto.js.map +1 -0
- package/dist/statusline.d.ts +51 -0
- package/dist/statusline.d.ts.map +1 -0
- package/dist/statusline.js +380 -0
- package/dist/statusline.js.map +1 -0
- package/dist/utf8-bytes.d.ts +10 -0
- package/dist/utf8-bytes.d.ts.map +1 -0
- package/dist/utf8-bytes.js +107 -0
- package/dist/utf8-bytes.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,380 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `ccc statusline`: this session's MemTree link in Claude Code's status line.
|
|
3
|
+
*
|
|
4
|
+
* - `ccc statusline` is a status-line command: it reads Claude Code's JSON from stdin,
|
|
5
|
+
* runs the user's own status-line command (if `install` wrapped one) with the same
|
|
6
|
+
* input, and appends ` | 🌿 tree` (an OSC 8 link to the session's newest MemTree page;
|
|
7
|
+
* the bare URL where the terminal has no hyperlinks). It only reads the cached link the
|
|
8
|
+
* proxy writes (status-link.ts): never a server call, so the status line stays fast.
|
|
9
|
+
* - `ccc statusline install` points Claude Code's `statusLine` at it, keeping the existing
|
|
10
|
+
* command, which it wraps rather than replaces; settings.json is backed up first. The
|
|
11
|
+
* first interactive run does it once by default (statusline-auto.ts).
|
|
12
|
+
* - `ccc statusline uninstall` puts the original back.
|
|
13
|
+
*
|
|
14
|
+
* Loaded straight from cli.ts (no proxy, no update check): Claude Code runs a status line
|
|
15
|
+
* after every message.
|
|
16
|
+
*/
|
|
17
|
+
import { spawn, spawnSync } from "node:child_process";
|
|
18
|
+
import { createHash } from "node:crypto";
|
|
19
|
+
import fs from "node:fs";
|
|
20
|
+
import os from "node:os";
|
|
21
|
+
import path from "node:path";
|
|
22
|
+
import { getConfigDir } from "./config.js";
|
|
23
|
+
import { terminalSupportsHyperlinks } from "./hooks.js";
|
|
24
|
+
import { readStatusLink } from "./status-link.js";
|
|
25
|
+
/** What `install` puts in settings.json. */
|
|
26
|
+
export const STATUSLINE_COMMAND = "ccc statusline";
|
|
27
|
+
/** The link's text where the terminal shows OSC 8 hyperlinks. */
|
|
28
|
+
export const STATUSLINE_LABEL = "🌿 tree";
|
|
29
|
+
export const STATUSLINE_SEPARATOR = " | ";
|
|
30
|
+
/** The wrapped command gets this long; Claude Code drops a slow status line anyway. */
|
|
31
|
+
const WRAPPED_TIMEOUT_MS = 5_000;
|
|
32
|
+
/** After SIGTERM, how long the wrapped command's group gets before SIGKILL. */
|
|
33
|
+
const KILL_GRACE_MS = 500;
|
|
34
|
+
/**
|
|
35
|
+
* Set for the wrapped command: a `ccc statusline` inside it (a wrapped command that itself
|
|
36
|
+
* calls ccc's, under another spelling) prints nothing instead of recursing.
|
|
37
|
+
*/
|
|
38
|
+
export const WRAPPED_ENV = "CCC_STATUSLINE_WRAPPED";
|
|
39
|
+
/** A command that runs ccc's status line, however ccc is spelled (path, npx, a shell). */
|
|
40
|
+
const CCC_STATUSLINE = /(^|[\s/\\'"])(ccc|claude-code-infinite)(\.cmd|\.js)?['"]?\s+statusline\b/;
|
|
41
|
+
export function statuslinePaths(env = process.env) {
|
|
42
|
+
const dir = env.CLAUDE_CONFIG_DIR?.trim() || path.join(os.homedir(), ".claude");
|
|
43
|
+
const settings = path.join(dir, "settings.json");
|
|
44
|
+
// One saved original per settings file, however it is reached (aliases, symlinks).
|
|
45
|
+
const resolved = resolvedPath(settings);
|
|
46
|
+
const key = createHash("sha256").update(resolved).digest("hex").slice(0, 12);
|
|
47
|
+
return { settings, saved: path.join(getConfigDir(), `statusline-${key}.json`) };
|
|
48
|
+
}
|
|
49
|
+
/** `ccc statusline [install|uninstall]`; returns the exit code. */
|
|
50
|
+
export async function statuslineMain(args, paths = statuslinePaths(), out = (text) => process.stdout.write(text)) {
|
|
51
|
+
const command = args[0];
|
|
52
|
+
if (command === "install")
|
|
53
|
+
return report(installStatusline(paths), out);
|
|
54
|
+
if (command === "uninstall")
|
|
55
|
+
return report(uninstallStatusline(paths), out);
|
|
56
|
+
if (command !== undefined) {
|
|
57
|
+
out("Usage: ccc statusline [install|uninstall]\n");
|
|
58
|
+
return 2;
|
|
59
|
+
}
|
|
60
|
+
out(await renderStatusline(await readStdin(), paths));
|
|
61
|
+
return 0;
|
|
62
|
+
}
|
|
63
|
+
/** The status line: the wrapped command's output, then the session's link. */
|
|
64
|
+
export async function renderStatusline(input, paths, env = process.env) {
|
|
65
|
+
if (env[WRAPPED_ENV])
|
|
66
|
+
return "";
|
|
67
|
+
const wrapped = savedStatusLine(savedFile(paths));
|
|
68
|
+
const base = wrapped ? await runWrapped(wrapped.command, input) : "";
|
|
69
|
+
const segment = linkSegment(sessionIdOf(input), env, paths.links);
|
|
70
|
+
if (!segment)
|
|
71
|
+
return base;
|
|
72
|
+
return base ? `${base}${STATUSLINE_SEPARATOR}${segment}` : segment;
|
|
73
|
+
}
|
|
74
|
+
/** ` 🌿 tree` linked to the session's page, or the URL; "" with no cached link. */
|
|
75
|
+
export function linkSegment(sessionId, env = process.env, dir) {
|
|
76
|
+
const url = readStatusLink(sessionId, dir);
|
|
77
|
+
if (!url)
|
|
78
|
+
return "";
|
|
79
|
+
const mode = env.CCC_STATUSLINE_LINK;
|
|
80
|
+
const osc8 = mode === "osc8" || (mode !== "url" && terminalSupportsHyperlinks(env, { isTTY: true }));
|
|
81
|
+
return osc8 ? `\x1b]8;;${url}\x1b\\${STATUSLINE_LABEL}\x1b]8;;\x1b\\` : url;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Point Claude Code's statusLine at `ccc statusline`, saving the current one to wrap.
|
|
85
|
+
* Re-running is harmless; a statusLine that is not a command is left alone.
|
|
86
|
+
*/
|
|
87
|
+
export function installStatusline(paths, platform = process.platform) {
|
|
88
|
+
// Claude Code runs a statusLine through Git Bash there; ccc would run it under cmd.exe.
|
|
89
|
+
if (platform === "win32") {
|
|
90
|
+
return { ok: false, message: "ccc statusline install is not supported on Windows yet. " +
|
|
91
|
+
"Add the link with the snippet in ccc's README instead." };
|
|
92
|
+
}
|
|
93
|
+
const settings = readSettings(paths.settings);
|
|
94
|
+
if (!settings.ok)
|
|
95
|
+
return { ok: false, message: settings.message };
|
|
96
|
+
const current = settings.value.statusLine;
|
|
97
|
+
if (isOurs(current)) {
|
|
98
|
+
return { ok: true, message: "ccc statusline is already installed. Restart Claude Code to see it." };
|
|
99
|
+
}
|
|
100
|
+
if (runsCccStatusline(current)) {
|
|
101
|
+
return { ok: false, message: `${paths.settings}: your statusLine already runs ccc statusline; ` +
|
|
102
|
+
"left unchanged." };
|
|
103
|
+
}
|
|
104
|
+
if (current !== undefined && (typeof current !== "object" || current.type !== "command" ||
|
|
105
|
+
typeof current.command !== "string")) {
|
|
106
|
+
return { ok: false, message: `${paths.settings}: statusLine is not a command; left unchanged.` };
|
|
107
|
+
}
|
|
108
|
+
const failed = attempt(() => {
|
|
109
|
+
writeJson(paths.saved, { settings: path.resolve(paths.settings),
|
|
110
|
+
resolved: resolvedPath(paths.settings),
|
|
111
|
+
statusLine: current ?? null });
|
|
112
|
+
backup(paths.settings);
|
|
113
|
+
// Its other options (padding, refreshInterval, hideVimModeIndicator, ...) stay.
|
|
114
|
+
settings.value.statusLine = { ...current, type: "command", command: STATUSLINE_COMMAND };
|
|
115
|
+
writeJson(paths.settings, settings.value);
|
|
116
|
+
});
|
|
117
|
+
if (failed)
|
|
118
|
+
return { ok: false, message: `Could not install: ${failed}` };
|
|
119
|
+
const kept = current ? " It runs your existing status line and adds the link." : "";
|
|
120
|
+
return { ok: true, message: `Installed: ${paths.settings} statusLine is now ` +
|
|
121
|
+
`"${STATUSLINE_COMMAND}".${kept} Undo: ccc statusline uninstall.` };
|
|
122
|
+
}
|
|
123
|
+
/** Put back the statusLine install replaced (or remove ours when there was none). */
|
|
124
|
+
export function uninstallStatusline(paths) {
|
|
125
|
+
const settings = readSettings(paths.settings);
|
|
126
|
+
if (!settings.ok)
|
|
127
|
+
return { ok: false, message: settings.message };
|
|
128
|
+
if (!isOurs(settings.value.statusLine)) {
|
|
129
|
+
return { ok: true, message: "ccc statusline is not installed; nothing changed." };
|
|
130
|
+
}
|
|
131
|
+
const file = savedFile(paths);
|
|
132
|
+
const saved = readJson(file);
|
|
133
|
+
// No record of what install replaced: guessing could delete the user's own status line.
|
|
134
|
+
if (!saved || !("statusLine" in saved)) {
|
|
135
|
+
return { ok: false, message: `No saved original for ${paths.settings} (${paths.saved}); ` +
|
|
136
|
+
"set statusLine yourself." };
|
|
137
|
+
}
|
|
138
|
+
const failed = attempt(() => {
|
|
139
|
+
backup(paths.settings);
|
|
140
|
+
if (saved.statusLine && typeof saved.statusLine === "object") {
|
|
141
|
+
// The original command back; options changed since install stay as they are now.
|
|
142
|
+
const original = saved.statusLine;
|
|
143
|
+
settings.value.statusLine = { ...settings.value.statusLine,
|
|
144
|
+
type: original.type, command: original.command };
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
147
|
+
delete settings.value.statusLine;
|
|
148
|
+
}
|
|
149
|
+
writeJson(paths.settings, settings.value);
|
|
150
|
+
fs.unlinkSync(file);
|
|
151
|
+
});
|
|
152
|
+
if (failed)
|
|
153
|
+
return { ok: false, message: `Could not uninstall: ${failed}` };
|
|
154
|
+
return { ok: true, message: `Restored ${paths.settings} statusLine.` };
|
|
155
|
+
}
|
|
156
|
+
/** Exactly what install writes: only this is ccc's to replace or remove. */
|
|
157
|
+
function isOurs(statusLine) {
|
|
158
|
+
const command = statusLine?.command;
|
|
159
|
+
return typeof command === "string" && command.trim() === STATUSLINE_COMMAND;
|
|
160
|
+
}
|
|
161
|
+
/** Any command that runs ccc's status line (never wrapped: it would recurse). */
|
|
162
|
+
function runsCccStatusline(statusLine) {
|
|
163
|
+
const command = statusLine?.command;
|
|
164
|
+
return typeof command === "string" && CCC_STATUSLINE.test(command.trim());
|
|
165
|
+
}
|
|
166
|
+
/** `run`'s error message, or undefined when it succeeded. */
|
|
167
|
+
function attempt(run) {
|
|
168
|
+
try {
|
|
169
|
+
run();
|
|
170
|
+
return undefined;
|
|
171
|
+
}
|
|
172
|
+
catch (error) {
|
|
173
|
+
return error instanceof Error ? error.message : String(error);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* The saved original for this settings file: under its key, else (the file was turned into
|
|
178
|
+
* a symlink, or replaced by a regular one, after install) the one that recorded its path.
|
|
179
|
+
*/
|
|
180
|
+
function savedFile(paths) {
|
|
181
|
+
if (fs.existsSync(paths.saved))
|
|
182
|
+
return paths.saved;
|
|
183
|
+
const dir = path.dirname(paths.saved);
|
|
184
|
+
const wanted = new Set([path.resolve(paths.settings), resolvedPath(paths.settings)]);
|
|
185
|
+
try {
|
|
186
|
+
for (const name of fs.readdirSync(dir)) {
|
|
187
|
+
if (!/^statusline-[0-9a-f]+\.json$/.test(name))
|
|
188
|
+
continue;
|
|
189
|
+
const saved = readJson(path.join(dir, name));
|
|
190
|
+
if ([saved?.settings, saved?.resolved].some((p) => typeof p === "string" && wanted.has(p))) {
|
|
191
|
+
return path.join(dir, name);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
catch {
|
|
196
|
+
// No config dir yet.
|
|
197
|
+
}
|
|
198
|
+
return paths.saved;
|
|
199
|
+
}
|
|
200
|
+
/** The statusLine install saved, when it was a command to wrap (never ccc's own). */
|
|
201
|
+
function savedStatusLine(file) {
|
|
202
|
+
const saved = readJson(file)?.statusLine;
|
|
203
|
+
return typeof saved?.command === "string" && !CCC_STATUSLINE.test(saved.command)
|
|
204
|
+
? { command: saved.command } : undefined;
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* The wrapped command's stdout, trailing newlines trimmed ("" if it fails). Run in its own
|
|
208
|
+
* process group, so a timeout kills everything it started (no pile-up across refreshes).
|
|
209
|
+
*/
|
|
210
|
+
export function runWrapped(command, input, timeoutMs = WRAPPED_TIMEOUT_MS) {
|
|
211
|
+
return new Promise((resolve) => {
|
|
212
|
+
// Not detached: a new session would lose the controlling terminal (`stty size </dev/tty`).
|
|
213
|
+
const child = spawn(command, { shell: true, stdio: ["pipe", "pipe", "ignore"],
|
|
214
|
+
env: { ...process.env, [WRAPPED_ENV]: "1" } });
|
|
215
|
+
const chunks = [];
|
|
216
|
+
let done = false;
|
|
217
|
+
const finish = (text) => {
|
|
218
|
+
if (done)
|
|
219
|
+
return;
|
|
220
|
+
done = true;
|
|
221
|
+
clearTimeout(timer);
|
|
222
|
+
resolve(text);
|
|
223
|
+
};
|
|
224
|
+
const timer = setTimeout(() => {
|
|
225
|
+
const tree = processTree(child.pid);
|
|
226
|
+
killAll(tree, "SIGTERM");
|
|
227
|
+
// Kept referenced: ccc waits the grace out so the forced kill is sent.
|
|
228
|
+
setTimeout(() => {
|
|
229
|
+
killAll(tree, "SIGKILL");
|
|
230
|
+
child.stdout.destroy();
|
|
231
|
+
child.unref();
|
|
232
|
+
}, KILL_GRACE_MS);
|
|
233
|
+
finish("");
|
|
234
|
+
}, timeoutMs);
|
|
235
|
+
child.stdout.on("data", (chunk) => chunks.push(chunk));
|
|
236
|
+
child.on("error", () => finish(""));
|
|
237
|
+
// As Claude Code does: a failed or killed command shows nothing (the link still shows).
|
|
238
|
+
child.on("close", (code, signal) => finish(code === 0 && !signal
|
|
239
|
+
? Buffer.concat(chunks).toString("utf-8").replace(/[\r\n]+$/, "") : ""));
|
|
240
|
+
child.stdin.on("error", () => { });
|
|
241
|
+
child.stdin.end(input);
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
/** `pid` and every descendant (from `ps`; just `pid` where there is none, e.g. Windows). */
|
|
245
|
+
export function processTree(pid) {
|
|
246
|
+
if (pid === undefined)
|
|
247
|
+
return [];
|
|
248
|
+
const children = new Map();
|
|
249
|
+
if (process.platform !== "win32") {
|
|
250
|
+
const listing = spawnSync("ps", ["-A", "-o", "pid=,ppid="], { encoding: "utf-8", timeout: 2_000 });
|
|
251
|
+
for (const line of (listing.stdout ?? "").split("\n")) {
|
|
252
|
+
const [child, parent] = line.trim().split(/\s+/).map(Number);
|
|
253
|
+
if (!Number.isFinite(child) || !Number.isFinite(parent))
|
|
254
|
+
continue;
|
|
255
|
+
children.set(parent, [...(children.get(parent) ?? []), child]);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
const tree = [];
|
|
259
|
+
const queue = [pid];
|
|
260
|
+
while (queue.length) {
|
|
261
|
+
const next = queue.shift();
|
|
262
|
+
if (tree.includes(next))
|
|
263
|
+
continue;
|
|
264
|
+
tree.push(next);
|
|
265
|
+
queue.push(...(children.get(next) ?? []));
|
|
266
|
+
}
|
|
267
|
+
return tree;
|
|
268
|
+
}
|
|
269
|
+
function killAll(pids, signal) {
|
|
270
|
+
for (const pid of pids) {
|
|
271
|
+
try {
|
|
272
|
+
process.kill(pid, signal);
|
|
273
|
+
}
|
|
274
|
+
catch {
|
|
275
|
+
// Already gone.
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
function sessionIdOf(input) {
|
|
280
|
+
try {
|
|
281
|
+
return JSON.parse(input)?.session_id;
|
|
282
|
+
}
|
|
283
|
+
catch {
|
|
284
|
+
return undefined;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
function readSettings(file) {
|
|
288
|
+
if (!fs.existsSync(file))
|
|
289
|
+
return { ok: true, value: {} };
|
|
290
|
+
const value = readJson(file);
|
|
291
|
+
return value && typeof value === "object" && !Array.isArray(value)
|
|
292
|
+
? { ok: true, value: value }
|
|
293
|
+
: { ok: false, message: `${file} is not valid JSON; left unchanged.` };
|
|
294
|
+
}
|
|
295
|
+
function readJson(file) {
|
|
296
|
+
try {
|
|
297
|
+
return JSON.parse(fs.readFileSync(file, "utf-8"));
|
|
298
|
+
}
|
|
299
|
+
catch {
|
|
300
|
+
return undefined;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* Write-then-rename, so Claude Code never reads a half-written settings file. A symlink
|
|
305
|
+
* (dotfile managers) is followed so the link stays, and the file keeps its mode (it can
|
|
306
|
+
* hold secrets in `env`); a new file is owner-only.
|
|
307
|
+
*/
|
|
308
|
+
function writeJson(file, value) {
|
|
309
|
+
const target = realTarget(file);
|
|
310
|
+
fs.mkdirSync(path.dirname(target), { recursive: true });
|
|
311
|
+
const mode = fileMode(target) ?? 0o600;
|
|
312
|
+
const tmp = `${target}.${process.pid}.tmp`;
|
|
313
|
+
fs.writeFileSync(tmp, `${JSON.stringify(value, null, 2)}\n`, { mode });
|
|
314
|
+
fs.chmodSync(tmp, mode);
|
|
315
|
+
fs.renameSync(tmp, target);
|
|
316
|
+
}
|
|
317
|
+
/** `file` with symlinks resolved, through its nearest existing ancestor if it is missing. */
|
|
318
|
+
function resolvedPath(file) {
|
|
319
|
+
const missing = [];
|
|
320
|
+
let current = path.resolve(file);
|
|
321
|
+
for (;;) {
|
|
322
|
+
try {
|
|
323
|
+
return path.join(fs.realpathSync(current), ...missing.reverse());
|
|
324
|
+
}
|
|
325
|
+
catch {
|
|
326
|
+
const parent = path.dirname(current);
|
|
327
|
+
if (parent === current)
|
|
328
|
+
return path.resolve(file);
|
|
329
|
+
missing.push(path.basename(current));
|
|
330
|
+
current = parent;
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
function realTarget(file) {
|
|
335
|
+
try {
|
|
336
|
+
return fs.realpathSync(file);
|
|
337
|
+
}
|
|
338
|
+
catch {
|
|
339
|
+
return file;
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
function fileMode(file) {
|
|
343
|
+
try {
|
|
344
|
+
return fs.statSync(file).mode & 0o777;
|
|
345
|
+
}
|
|
346
|
+
catch {
|
|
347
|
+
return undefined;
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
function backup(file) {
|
|
351
|
+
if (!fs.existsSync(file))
|
|
352
|
+
return;
|
|
353
|
+
const stamp = new Date().toISOString().replace(/[:.]/g, "-");
|
|
354
|
+
const copy = `${file}.ccc-backup-${stamp}`;
|
|
355
|
+
fs.copyFileSync(file, copy);
|
|
356
|
+
fs.chmodSync(copy, fileMode(realTarget(file)) ?? 0o600);
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* Whether Claude Code's status line reads ccc's link (installed, or the README snippet):
|
|
360
|
+
* only then does the proxy keep the link fresh in the background. Read at startup.
|
|
361
|
+
*/
|
|
362
|
+
export function statusLineWantsLink(settingsFile = statuslinePaths().settings) {
|
|
363
|
+
const command = (readJson(settingsFile)
|
|
364
|
+
?.statusLine)?.command;
|
|
365
|
+
return typeof command === "string" &&
|
|
366
|
+
(CCC_STATUSLINE.test(command) || command.includes(".claude-code-infinite/statusline"));
|
|
367
|
+
}
|
|
368
|
+
function report(result, out) {
|
|
369
|
+
out(`${result.message}\n`);
|
|
370
|
+
return result.ok ? 0 : 1;
|
|
371
|
+
}
|
|
372
|
+
async function readStdin() {
|
|
373
|
+
if (process.stdin.isTTY)
|
|
374
|
+
return "";
|
|
375
|
+
const chunks = [];
|
|
376
|
+
for await (const chunk of process.stdin)
|
|
377
|
+
chunks.push(chunk);
|
|
378
|
+
return Buffer.concat(chunks).toString("utf-8");
|
|
379
|
+
}
|
|
380
|
+
//# sourceMappingURL=statusline.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"statusline.js","sourceRoot":"","sources":["../src/statusline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,4CAA4C;AAC5C,MAAM,CAAC,MAAM,kBAAkB,GAAG,gBAAgB,CAAC;AACnD,iEAAiE;AACjE,MAAM,CAAC,MAAM,gBAAgB,GAAG,SAAS,CAAC;AAC1C,MAAM,CAAC,MAAM,oBAAoB,GAAG,KAAK,CAAC;AAC1C,uFAAuF;AACvF,MAAM,kBAAkB,GAAG,KAAK,CAAC;AACjC,+EAA+E;AAC/E,MAAM,aAAa,GAAG,GAAG,CAAC;AAC1B;;;GAGG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,wBAAwB,CAAC;AACpD,0FAA0F;AAC1F,MAAM,cAAc,GAAG,0EAA0E,CAAC;AAWlG,MAAM,UAAU,eAAe,CAAC,MAAyB,OAAO,CAAC,GAAG;IAClE,MAAM,GAAG,GAAG,GAAG,CAAC,iBAAiB,EAAE,IAAI,EAAE,IAAI,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,SAAS,CAAC,CAA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C,kCAAkC,CAAC,CAAC,CAAC;AAC3F,CAAC;AAED,SAAS,MAAM,CAAC,MAAwC,EAAE,GAA2B;IACnF,GAAG,CAAC,GAAG,MAAM,CAAC,OAAO,IAAI,CAAC,CAAC;IAC3B,OAAO,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC3B,CAAC;AAED,KAAK,UAAU,SAAS;IACtB,IAAI,OAAO,CAAC,KAAK,CAAC,KAAK;QAAE,OAAO,EAAE,CAAC;IACnC,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,IAAI,KAAK,EAAE,MAAM,KAAK,IAAI,OAAO,CAAC,KAAK;QAAE,MAAM,CAAC,IAAI,CAAC,KAAe,CAAC,CAAC;IACtE,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;AACjD,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** The UTF-8 bytes of text as a byte string (the same string when it is ASCII). */
|
|
2
|
+
export declare function toBytes(text: string): string;
|
|
3
|
+
/** The text of a byte string made by toBytes (markers inserted between characters). */
|
|
4
|
+
export declare function fromBytes(data: string): string;
|
|
5
|
+
/** ASCII-only lowercase (Python bytes.lower): other bytes keep their values and offsets. */
|
|
6
|
+
export declare function asciiLower(value: string): string;
|
|
7
|
+
/** The characters of a byte string decoded as UTF-8, skipping invalid bytes (Python's
|
|
8
|
+
* decode("utf-8", "ignore"): no surrogates, no overlong forms). */
|
|
9
|
+
export declare function decodeIgnore(data: string): string[];
|
|
10
|
+
//# sourceMappingURL=utf8-bytes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utf8-bytes.d.ts","sourceRoot":"","sources":["../src/utf8-bytes.ts"],"names":[],"mappings":"AASA,mFAAmF;AACnF,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAkB5C;AAED,uFAAuF;AACvF,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAa9C;AAED,4FAA4F;AAC5F,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED;mEACmE;AACnE,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAanD"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
// UTF-8 "byte strings" for the redaction twin: one JS char per UTF-8 byte (0x00-0xFF), so
|
|
2
|
+
// regexes, offsets and byte windows behave as in polychat's Python detector, which works on
|
|
3
|
+
// text.encode("utf-8", "surrogatepass"). A lone surrogate is encoded as its 3 bytes the way
|
|
4
|
+
// surrogatepass does, and decoded back, so the round trip never changes the text.
|
|
5
|
+
const NON_ASCII = /[^\x00-\x7f]/;
|
|
6
|
+
const LONE_SURROGATE = /[\ud800-\udbff](?![\udc00-\udfff])|(?<![\ud800-\udbff])[\udc00-\udfff]/;
|
|
7
|
+
const ENCODED_SURROGATE = /\xed[\xa0-\xbf]/;
|
|
8
|
+
/** The UTF-8 bytes of text as a byte string (the same string when it is ASCII). */
|
|
9
|
+
export function toBytes(text) {
|
|
10
|
+
if (!NON_ASCII.test(text))
|
|
11
|
+
return text;
|
|
12
|
+
if (!LONE_SURROGATE.test(text))
|
|
13
|
+
return Buffer.from(text, "utf8").toString("latin1");
|
|
14
|
+
let out = "";
|
|
15
|
+
for (let i = 0; i < text.length; i += 1) {
|
|
16
|
+
const unit = text.charCodeAt(i);
|
|
17
|
+
const next = text.charCodeAt(i + 1);
|
|
18
|
+
if (unit >= 0xd800 && unit < 0xdc00 && next >= 0xdc00 && next < 0xe000) {
|
|
19
|
+
out += Buffer.from(text.slice(i, i + 2), "utf8").toString("latin1");
|
|
20
|
+
i += 1;
|
|
21
|
+
}
|
|
22
|
+
else if (unit >= 0xd800 && unit < 0xe000) {
|
|
23
|
+
out += String.fromCharCode(0xe0 | (unit >> 12), 0x80 | ((unit >> 6) & 0x3f), 0x80 | (unit & 0x3f));
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
out += Buffer.from(text[i], "utf8").toString("latin1");
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return out;
|
|
30
|
+
}
|
|
31
|
+
/** The text of a byte string made by toBytes (markers inserted between characters). */
|
|
32
|
+
export function fromBytes(data) {
|
|
33
|
+
if (!NON_ASCII.test(data))
|
|
34
|
+
return data;
|
|
35
|
+
if (!ENCODED_SURROGATE.test(data))
|
|
36
|
+
return Buffer.from(data, "latin1").toString("utf8");
|
|
37
|
+
let out = "";
|
|
38
|
+
let pos = 0;
|
|
39
|
+
for (let at = data.search(ENCODED_SURROGATE); at !== -1; at = searchAfter(data, pos)) {
|
|
40
|
+
out += Buffer.from(data.slice(pos, at), "latin1").toString("utf8");
|
|
41
|
+
out += String.fromCharCode(((data.charCodeAt(at) & 0x0f) << 12)
|
|
42
|
+
| ((data.charCodeAt(at + 1) & 0x3f) << 6) | (data.charCodeAt(at + 2) & 0x3f));
|
|
43
|
+
pos = at + 3;
|
|
44
|
+
}
|
|
45
|
+
return out + Buffer.from(data.slice(pos), "latin1").toString("utf8");
|
|
46
|
+
}
|
|
47
|
+
/** ASCII-only lowercase (Python bytes.lower): other bytes keep their values and offsets. */
|
|
48
|
+
export function asciiLower(value) {
|
|
49
|
+
return value.replace(/[A-Z]+/g, (s) => s.toLowerCase());
|
|
50
|
+
}
|
|
51
|
+
/** The characters of a byte string decoded as UTF-8, skipping invalid bytes (Python's
|
|
52
|
+
* decode("utf-8", "ignore"): no surrogates, no overlong forms). */
|
|
53
|
+
export function decodeIgnore(data) {
|
|
54
|
+
const chars = [];
|
|
55
|
+
let i = 0;
|
|
56
|
+
while (i < data.length) {
|
|
57
|
+
const size = sequenceSize(data, i);
|
|
58
|
+
if (size === 0) {
|
|
59
|
+
i += 1;
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
chars.push(Buffer.from(data.slice(i, i + size), "latin1").toString("utf8"));
|
|
63
|
+
i += size;
|
|
64
|
+
}
|
|
65
|
+
return chars;
|
|
66
|
+
}
|
|
67
|
+
/** Bytes in the valid UTF-8 sequence at i (1-4), or 0 when it is not one. */
|
|
68
|
+
function sequenceSize(data, i) {
|
|
69
|
+
const b0 = data.charCodeAt(i);
|
|
70
|
+
if (b0 < 0x80)
|
|
71
|
+
return 1;
|
|
72
|
+
const [size, lo, hi] = leadByte(b0);
|
|
73
|
+
if (size === 0 || i + size > data.length)
|
|
74
|
+
return 0;
|
|
75
|
+
const b1 = data.charCodeAt(i + 1);
|
|
76
|
+
if (b1 < lo || b1 > hi)
|
|
77
|
+
return 0;
|
|
78
|
+
for (let k = 2; k < size; k += 1) {
|
|
79
|
+
const b = data.charCodeAt(i + k);
|
|
80
|
+
if (b < 0x80 || b > 0xbf)
|
|
81
|
+
return 0;
|
|
82
|
+
}
|
|
83
|
+
return size;
|
|
84
|
+
}
|
|
85
|
+
/** [sequence size, allowed range of the second byte] for a lead byte (size 0: invalid). */
|
|
86
|
+
function leadByte(b0) {
|
|
87
|
+
if (b0 >= 0xc2 && b0 <= 0xdf)
|
|
88
|
+
return [2, 0x80, 0xbf];
|
|
89
|
+
if (b0 === 0xe0)
|
|
90
|
+
return [3, 0xa0, 0xbf];
|
|
91
|
+
if (b0 === 0xed)
|
|
92
|
+
return [3, 0x80, 0x9f];
|
|
93
|
+
if (b0 >= 0xe1 && b0 <= 0xef)
|
|
94
|
+
return [3, 0x80, 0xbf];
|
|
95
|
+
if (b0 === 0xf0)
|
|
96
|
+
return [4, 0x90, 0xbf];
|
|
97
|
+
if (b0 >= 0xf1 && b0 <= 0xf3)
|
|
98
|
+
return [4, 0x80, 0xbf];
|
|
99
|
+
if (b0 === 0xf4)
|
|
100
|
+
return [4, 0x80, 0x8f];
|
|
101
|
+
return [0, 0, 0];
|
|
102
|
+
}
|
|
103
|
+
function searchAfter(data, pos) {
|
|
104
|
+
const at = data.slice(pos).search(ENCODED_SURRO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