tokenmaxxing 1.99.0 → 1.100.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/package.json +1 -1
- package/src/lib/compact.ts +1 -2
- package/src/lib/lock.ts +1 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tokenmaxxing",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.100.0",
|
|
4
4
|
"description": "Automatic Claude Code account switching: pool multiple accounts, start each session on its own account, and resume a session on a fresher account when quota fills.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
package/src/lib/compact.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { statSync } from "node:fs";
|
|
2
2
|
import type { Subprocess } from "bun";
|
|
3
|
-
import { delay } from "es-toolkit";
|
|
4
3
|
import { z } from "zod";
|
|
5
4
|
import pkg from "../../package.json" with { type: "json" };
|
|
6
5
|
import { errorMessage, log } from "./log.ts";
|
|
@@ -26,7 +25,7 @@ export async function compactClaudeSession(input: { real: string; sid: string; t
|
|
|
26
25
|
});
|
|
27
26
|
input.onSpawn(p);
|
|
28
27
|
const reads = Promise.all([p.stdout.text(), p.stderr.text()]);
|
|
29
|
-
const settled = await Promise.race([reads, p.exited.then(() =>
|
|
28
|
+
const settled = await Promise.race([reads, p.exited.then(() => Bun.sleep(PIPE_GRACE_MS)).then(() => null)]);
|
|
30
29
|
await p.exited;
|
|
31
30
|
const appended = await Bun.file(input.transcript).slice(offset).text();
|
|
32
31
|
if (appended.split("\n").some((line) => CompactBoundarySchema.safeParse(JsonTextSchema.safeParse(line).data).success)) return { ok: true };
|
package/src/lib/lock.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { closeSync, mkdirSync, openSync } from "node:fs";
|
|
2
2
|
import { dirname } from "node:path";
|
|
3
3
|
import { dlopen, FFIType, read } from "bun:ffi";
|
|
4
|
-
import { delay } from "es-toolkit";
|
|
5
4
|
|
|
6
5
|
const LOCK_EX = 2;
|
|
7
6
|
const LOCK_NB = 4;
|
|
@@ -43,7 +42,7 @@ export async function acquireLock(lockPath: string): Promise<{ release: () => vo
|
|
|
43
42
|
if (errno !== EAGAIN && errno !== EINTR) {
|
|
44
43
|
throw new Error(`flock LOCK_EX|LOCK_NB failed on ${lockPath} (errno ${errno})`);
|
|
45
44
|
}
|
|
46
|
-
await
|
|
45
|
+
await Bun.sleep(RETRY_MS);
|
|
47
46
|
}
|
|
48
47
|
} catch (e) {
|
|
49
48
|
closeSync(fd);
|