@lazehq/cli 0.1.22 → 0.1.24
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/dist/laze.mjs +25 -11
- package/package.json +1 -1
package/dist/laze.mjs
CHANGED
|
@@ -35620,7 +35620,7 @@ function flagText({
|
|
|
35620
35620
|
}
|
|
35621
35621
|
|
|
35622
35622
|
// src/rules/cli-version.rules.ts
|
|
35623
|
-
var STAMPED = "0.1.
|
|
35623
|
+
var STAMPED = "0.1.24";
|
|
35624
35624
|
function cliVersionOf({ stamped = STAMPED } = {}) {
|
|
35625
35625
|
return stamped.startsWith("__") ? "dev" : stamped;
|
|
35626
35626
|
}
|
|
@@ -67520,17 +67520,30 @@ async function startRushGuard({
|
|
|
67520
67520
|
rush
|
|
67521
67521
|
}) {
|
|
67522
67522
|
const path = guardPathOf({ context, claudePid });
|
|
67523
|
-
const holder = await
|
|
67524
|
-
(text2) => JSON.parse(text2),
|
|
67525
|
-
() => void 0
|
|
67526
|
-
);
|
|
67523
|
+
const holder = await guardHolderOf({ path });
|
|
67527
67524
|
if (holder && context.processes.alive(holder.pid)) return;
|
|
67528
67525
|
const flags2 = ["--profile", profile, "--claude-pid", String(claudePid), "--rush-id", rush.id];
|
|
67529
67526
|
const argv = [...context.program, "hook", "rush-wake", ...flags2, "--rush-program", rush.program];
|
|
67530
67527
|
const logPath = join6(dirname5(context.environment.configPath), "rush-guards", "guard.log");
|
|
67531
|
-
|
|
67528
|
+
context.processes.spawnDetached({ argv: ["sh", "-c", '"$@" &', "sh", ...argv], logPath });
|
|
67529
|
+
}
|
|
67530
|
+
async function claimRushGuard({
|
|
67531
|
+
context,
|
|
67532
|
+
claudePid
|
|
67533
|
+
}) {
|
|
67534
|
+
const path = guardPathOf({ context, claudePid });
|
|
67535
|
+
const holder = await guardHolderOf({ path });
|
|
67536
|
+
const self2 = context.processes.pid;
|
|
67537
|
+
if (holder && holder.pid !== self2 && context.processes.alive(holder.pid)) return false;
|
|
67532
67538
|
await mkdir5(dirname5(path), { recursive: true, mode: 448 });
|
|
67533
|
-
await writeFile5(path, JSON.stringify({ pid, claudePid }), { mode: 384 });
|
|
67539
|
+
await writeFile5(path, JSON.stringify({ pid: self2, claudePid }), { mode: 384 });
|
|
67540
|
+
return true;
|
|
67541
|
+
}
|
|
67542
|
+
function guardHolderOf({ path }) {
|
|
67543
|
+
return readFile6(path, "utf8").then(
|
|
67544
|
+
(text2) => JSON.parse(text2),
|
|
67545
|
+
() => void 0
|
|
67546
|
+
);
|
|
67534
67547
|
}
|
|
67535
67548
|
|
|
67536
67549
|
// src/services/claude-wait.service.ts
|
|
@@ -67667,14 +67680,14 @@ async function waitForMessages({ context, args }) {
|
|
|
67667
67680
|
const named = await sessionProfileArgs({ context, args: asked, session });
|
|
67668
67681
|
const { client, name: name2 } = await signedIn({ context, args: named });
|
|
67669
67682
|
await rememberSession({ context, claudePid, session });
|
|
67670
|
-
const lock = statePathOf({ context, kind: "waiters", profile: name2 });
|
|
67671
|
-
if (!await takeLock({ context, path: lock, sessionId: input2.session_id, claudePid })) return 0;
|
|
67672
|
-
const seen = () => input2.transcript_path ? readFile7(input2.transcript_path, "utf8") : Promise.resolve("");
|
|
67673
|
-
const deadline = context.nowMs() + (WAIT_HOOK_TIMEOUT_SECONDS - 60) * 1e3;
|
|
67674
67683
|
const rush = rushSessionOf({
|
|
67675
67684
|
parentArgs: await context.processes.argsOf(await context.processes.parentOf(claudePid) ?? 0)
|
|
67676
67685
|
});
|
|
67677
67686
|
if (rush) await startRushGuard({ context, profile: name2, claudePid, rush });
|
|
67687
|
+
const lock = statePathOf({ context, kind: "waiters", profile: name2 });
|
|
67688
|
+
if (!await takeLock({ context, path: lock, sessionId: input2.session_id, claudePid })) return 0;
|
|
67689
|
+
const seen = () => input2.transcript_path ? readFile7(input2.transcript_path, "utf8") : Promise.resolve("");
|
|
67690
|
+
const deadline = context.nowMs() + (WAIT_HOOK_TIMEOUT_SECONDS - 60) * 1e3;
|
|
67678
67691
|
try {
|
|
67679
67692
|
while (context.nowMs() < deadline) {
|
|
67680
67693
|
const code = await settleRound({ context, client, name: name2, lock, claudePid, session, seen });
|
|
@@ -82404,6 +82417,7 @@ async function rushWakeHook({ context, args }) {
|
|
|
82404
82417
|
const id = flagText({ args, name: "rush-id" });
|
|
82405
82418
|
const program = flagText({ args, name: "rush-program" }) || "rush";
|
|
82406
82419
|
if (!claudePid || !id) return 1;
|
|
82420
|
+
if (!await claimRushGuard({ context, claudePid })) return 0;
|
|
82407
82421
|
const path = guardPathOf({ context, claudePid });
|
|
82408
82422
|
try {
|
|
82409
82423
|
while (context.processes.alive(claudePid)) await context.sleep(WATCH_MS3);
|
package/package.json
CHANGED