@lazehq/cli 0.1.19 → 0.1.20

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.
Files changed (2) hide show
  1. package/dist/laze.mjs +65 -2
  2. 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.19";
35623
+ var STAMPED = "0.1.20";
35624
35624
  function cliVersionOf({ stamped = STAMPED } = {}) {
35625
35625
  return stamped.startsWith("__") ? "dev" : stamped;
35626
35626
  }
@@ -67480,8 +67480,23 @@ function channelLabelIn(channel) {
67480
67480
  // src/services/claude-wait.service.ts
67481
67481
  import { readFile as readFile6, rm as rm2, writeFile as writeFile5, mkdir as mkdir5 } from "node:fs/promises";
67482
67482
  import { dirname as dirname5 } from "node:path";
67483
+
67484
+ // src/rules/rush-host.rules.ts
67485
+ function rushSessionOf({ parentArgs }) {
67486
+ if (!parentArgs) return void 0;
67487
+ const [program = "", verb, action, id] = parentArgs;
67488
+ const isRush = program === "rush" || program.endsWith("/rush");
67489
+ if (!isRush || verb !== "host" || action !== "run" || !id) return void 0;
67490
+ return { id, program };
67491
+ }
67492
+ function rushSendCommand({ program, id }) {
67493
+ return ["sh", "-c", 'printf "%s\\n" "$LAZE_WAKE_TEXT" | "$0" session send "$1"', program, id];
67494
+ }
67495
+
67496
+ // src/services/claude-wait.service.ts
67483
67497
  var ROUND_SECONDS = 50;
67484
67498
  var WATCH_MS = 2e3;
67499
+ var RUSH_RETRY_MS = 3e4;
67485
67500
  var CHANNEL_CHECK_MS = 5e3;
67486
67501
  async function holderOf({ path }) {
67487
67502
  return readFile6(path, "utf8").then(
@@ -67617,10 +67632,24 @@ async function waitForMessages({ context, args }) {
67617
67632
  if (!await takeLock({ context, path: lock, sessionId: input2.session_id, claudePid })) return 0;
67618
67633
  const seen = () => input2.transcript_path ? readFile6(input2.transcript_path, "utf8") : Promise.resolve("");
67619
67634
  const deadline = context.nowMs() + (WAIT_HOOK_TIMEOUT_SECONDS - 60) * 1e3;
67635
+ const rush = rushSessionOf({
67636
+ parentArgs: await context.processes.argsOf(await context.processes.parentOf(claudePid) ?? 0)
67637
+ });
67620
67638
  try {
67621
67639
  while (context.nowMs() < deadline) {
67622
67640
  const code = await settleRound({ context, client, name: name2, lock, claudePid, session, seen });
67623
- if (code !== "again") return code;
67641
+ if (code === "again") continue;
67642
+ if (code !== 0 || !rush || context.processes.alive(claudePid)) return code;
67643
+ return await wakeThroughRush({
67644
+ context,
67645
+ client,
67646
+ name: name2,
67647
+ lock,
67648
+ claudePid,
67649
+ session,
67650
+ rush,
67651
+ deadline
67652
+ });
67624
67653
  }
67625
67654
  return 0;
67626
67655
  } finally {
@@ -67628,6 +67657,40 @@ async function waitForMessages({ context, args }) {
67628
67657
  await rm2(lock, { force: true });
67629
67658
  }
67630
67659
  }
67660
+ async function rushRound({
67661
+ context,
67662
+ client,
67663
+ name: name2,
67664
+ lock,
67665
+ claudePid,
67666
+ session,
67667
+ rush
67668
+ }) {
67669
+ if ((await holderOf({ path: lock }))?.pid !== context.processes.pid) return true;
67670
+ const key = session ? sessionKeyOf({ session }) : void 0;
67671
+ if (key && await liveElsewhere({ context, key, claudePid })) return true;
67672
+ const due = await dueFromSpool({ context, profile: name2, seen: async () => "", pushedToo: true });
67673
+ const messages = due.length > 0 ? due : await takeRound({ context, client, claudePid: 0, session });
67674
+ if (messages.length === 0) return false;
67675
+ await keepTaken({ context, profile: name2, messages });
67676
+ const self2 = await currentNameOf({ context, client, profile: name2 });
67677
+ const command = rushSendCommand(rush);
67678
+ const env = { LAZE_WAKE_TEXT: hookContextOf({ messages, self: self2 }) };
67679
+ const quiet = { write: () => true };
67680
+ const sent = await context.runCommand({ command, env, stdout: quiet, stderr: quiet });
67681
+ if (sent !== 0) return false;
67682
+ await turnStarted({ context, client, agent: name2, messages }).catch(() => void 0);
67683
+ await dropFromSpool({ context, profile: name2, messageIds: messages.map((m) => m.messageId) });
67684
+ return true;
67685
+ }
67686
+ async function wakeThroughRush(round) {
67687
+ while (round.context.nowMs() < round.deadline) {
67688
+ const done = await rushRound(round).catch(() => "failed");
67689
+ if (done === true) return 0;
67690
+ await round.context.sleep(done === "failed" ? RUSH_RETRY_MS : 1e3);
67691
+ }
67692
+ return 0;
67693
+ }
67631
67694
  async function waitHook({ context, args }) {
67632
67695
  try {
67633
67696
  return await waitForMessages({ context, args });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lazehq/cli",
3
- "version": "0.1.19",
3
+ "version": "0.1.20",
4
4
  "description": "The Laze command line: sign in, read and post in chat, and connect your own Claude Code or Codex session as an agent.",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",