@lazehq/cli 0.1.19 → 0.1.21
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 +88 -5
- 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.21";
|
|
35624
35624
|
function cliVersionOf({ stamped = STAMPED } = {}) {
|
|
35625
35625
|
return stamped.startsWith("__") ? "dev" : stamped;
|
|
35626
35626
|
}
|
|
@@ -67480,8 +67480,25 @@ 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({
|
|
67486
|
+
parentArgs
|
|
67487
|
+
}) {
|
|
67488
|
+
if (!parentArgs) return void 0;
|
|
67489
|
+
const [program = "", verb, action, id] = parentArgs;
|
|
67490
|
+
const isRush = program === "rush" || program.endsWith("/rush");
|
|
67491
|
+
if (!isRush || verb !== "host" || action !== "run" || !id) return void 0;
|
|
67492
|
+
return { id, program };
|
|
67493
|
+
}
|
|
67494
|
+
function rushSendCommand({ program, id }) {
|
|
67495
|
+
return ["sh", "-c", 'printf "%s\\n" "$LAZE_WAKE_TEXT" | "$0" session send "$1"', program, id];
|
|
67496
|
+
}
|
|
67497
|
+
|
|
67498
|
+
// src/services/claude-wait.service.ts
|
|
67483
67499
|
var ROUND_SECONDS = 50;
|
|
67484
67500
|
var WATCH_MS = 2e3;
|
|
67501
|
+
var RUSH_RETRY_MS = 3e4;
|
|
67485
67502
|
var CHANNEL_CHECK_MS = 5e3;
|
|
67486
67503
|
async function holderOf({ path }) {
|
|
67487
67504
|
return readFile6(path, "utf8").then(
|
|
@@ -67617,10 +67634,24 @@ async function waitForMessages({ context, args }) {
|
|
|
67617
67634
|
if (!await takeLock({ context, path: lock, sessionId: input2.session_id, claudePid })) return 0;
|
|
67618
67635
|
const seen = () => input2.transcript_path ? readFile6(input2.transcript_path, "utf8") : Promise.resolve("");
|
|
67619
67636
|
const deadline = context.nowMs() + (WAIT_HOOK_TIMEOUT_SECONDS - 60) * 1e3;
|
|
67637
|
+
const rush = rushSessionOf({
|
|
67638
|
+
parentArgs: await context.processes.argsOf(await context.processes.parentOf(claudePid) ?? 0)
|
|
67639
|
+
});
|
|
67620
67640
|
try {
|
|
67621
67641
|
while (context.nowMs() < deadline) {
|
|
67622
67642
|
const code = await settleRound({ context, client, name: name2, lock, claudePid, session, seen });
|
|
67623
|
-
if (code
|
|
67643
|
+
if (code === "again") continue;
|
|
67644
|
+
if (code !== 0 || !rush || context.processes.alive(claudePid)) return code;
|
|
67645
|
+
return await wakeThroughRush({
|
|
67646
|
+
context,
|
|
67647
|
+
client,
|
|
67648
|
+
name: name2,
|
|
67649
|
+
lock,
|
|
67650
|
+
claudePid,
|
|
67651
|
+
session,
|
|
67652
|
+
rush,
|
|
67653
|
+
deadline
|
|
67654
|
+
});
|
|
67624
67655
|
}
|
|
67625
67656
|
return 0;
|
|
67626
67657
|
} finally {
|
|
@@ -67628,6 +67659,40 @@ async function waitForMessages({ context, args }) {
|
|
|
67628
67659
|
await rm2(lock, { force: true });
|
|
67629
67660
|
}
|
|
67630
67661
|
}
|
|
67662
|
+
async function rushRound({
|
|
67663
|
+
context,
|
|
67664
|
+
client,
|
|
67665
|
+
name: name2,
|
|
67666
|
+
lock,
|
|
67667
|
+
claudePid,
|
|
67668
|
+
session,
|
|
67669
|
+
rush
|
|
67670
|
+
}) {
|
|
67671
|
+
if ((await holderOf({ path: lock }))?.pid !== context.processes.pid) return true;
|
|
67672
|
+
const key = session ? sessionKeyOf({ session }) : void 0;
|
|
67673
|
+
if (key && await liveElsewhere({ context, key, claudePid })) return true;
|
|
67674
|
+
const due = await dueFromSpool({ context, profile: name2, seen: async () => "", pushedToo: true });
|
|
67675
|
+
const messages = due.length > 0 ? due : await takeRound({ context, client, claudePid: 0, session });
|
|
67676
|
+
if (messages.length === 0) return false;
|
|
67677
|
+
await keepTaken({ context, profile: name2, messages });
|
|
67678
|
+
const self2 = await currentNameOf({ context, client, profile: name2 });
|
|
67679
|
+
const command = rushSendCommand(rush);
|
|
67680
|
+
const env = { LAZE_WAKE_TEXT: hookContextOf({ messages, self: self2 }) };
|
|
67681
|
+
const quiet = { write: () => true };
|
|
67682
|
+
const sent = await context.runCommand({ command, env, stdout: quiet, stderr: quiet });
|
|
67683
|
+
if (sent !== 0) return false;
|
|
67684
|
+
await turnStarted({ context, client, agent: name2, messages }).catch(() => void 0);
|
|
67685
|
+
await dropFromSpool({ context, profile: name2, messageIds: messages.map((m) => m.messageId) });
|
|
67686
|
+
return true;
|
|
67687
|
+
}
|
|
67688
|
+
async function wakeThroughRush(round) {
|
|
67689
|
+
while (round.context.nowMs() < round.deadline) {
|
|
67690
|
+
const done = await rushRound(round).catch(() => "failed");
|
|
67691
|
+
if (done === true) return 0;
|
|
67692
|
+
await round.context.sleep(done === "failed" ? RUSH_RETRY_MS : 1e3);
|
|
67693
|
+
}
|
|
67694
|
+
return 0;
|
|
67695
|
+
}
|
|
67631
67696
|
async function waitHook({ context, args }) {
|
|
67632
67697
|
try {
|
|
67633
67698
|
return await waitForMessages({ context, args });
|
|
@@ -68706,9 +68771,10 @@ async function queueInCodex({
|
|
|
68706
68771
|
text: text2
|
|
68707
68772
|
}) {
|
|
68708
68773
|
let stderr2 = "";
|
|
68774
|
+
const queue = ["codex", "queue", "--thread", delivery.threadId, "--message", text2];
|
|
68709
68775
|
const code = await context.runCommand({
|
|
68710
|
-
command:
|
|
68711
|
-
env: { CODEX_HOME: delivery.codexHome },
|
|
68776
|
+
command: delivery.rush ? rushSendCommand(delivery.rush) : queue,
|
|
68777
|
+
env: delivery.rush ? { LAZE_WAKE_TEXT: text2 } : { CODEX_HOME: delivery.codexHome },
|
|
68712
68778
|
stderr: {
|
|
68713
68779
|
write: (chunk) => {
|
|
68714
68780
|
stderr2 += chunk;
|
|
@@ -69127,6 +69193,20 @@ async function connectService({ context, args }) {
|
|
|
69127
69193
|
}
|
|
69128
69194
|
}
|
|
69129
69195
|
|
|
69196
|
+
// src/services/rush-host.service.ts
|
|
69197
|
+
async function rushAboveOf({
|
|
69198
|
+
context,
|
|
69199
|
+
from = context.processes.pid
|
|
69200
|
+
}) {
|
|
69201
|
+
let pid = await context.processes.parentOf(from);
|
|
69202
|
+
for (let depth = 0; pid !== void 0 && pid > 1 && depth < 16; depth += 1) {
|
|
69203
|
+
const rush = rushSessionOf({ parentArgs: await context.processes.argsOf(pid) });
|
|
69204
|
+
if (rush) return rush;
|
|
69205
|
+
pid = await context.processes.parentOf(pid);
|
|
69206
|
+
}
|
|
69207
|
+
return void 0;
|
|
69208
|
+
}
|
|
69209
|
+
|
|
69130
69210
|
// src/services/codex-link.service.ts
|
|
69131
69211
|
var ROLLOUTS_READ = 200;
|
|
69132
69212
|
async function firstLineOf({ path }) {
|
|
@@ -69195,6 +69275,7 @@ async function linkCodexSession({
|
|
|
69195
69275
|
return startAdoptInBackground({ context, args, profile, laze });
|
|
69196
69276
|
}
|
|
69197
69277
|
await stopAdopt({ context, profile });
|
|
69278
|
+
const rush = await rushAboveOf({ context });
|
|
69198
69279
|
await context.store.setDelivery({
|
|
69199
69280
|
name: profile,
|
|
69200
69281
|
delivery: {
|
|
@@ -69202,7 +69283,8 @@ async function linkCodexSession({
|
|
|
69202
69283
|
threadId,
|
|
69203
69284
|
codexHome: context.environment.codexHome,
|
|
69204
69285
|
cwd: directory,
|
|
69205
|
-
linkedAt: context.nowMs()
|
|
69286
|
+
linkedAt: context.nowMs(),
|
|
69287
|
+
...rush ? { rush } : {}
|
|
69206
69288
|
}
|
|
69207
69289
|
});
|
|
69208
69290
|
const service = await installConnectService({ context });
|
|
@@ -79500,6 +79582,7 @@ var feedTrpc = defineTrpcContract("feed").query("channelItems").withInput(extern
|
|
|
79500
79582
|
var feedUi = uiTokens("feed");
|
|
79501
79583
|
var FeedNavSlot = feedUi.component("nav");
|
|
79502
79584
|
var FeedChannelCardSlot = feedUi.component("channel-card");
|
|
79585
|
+
var FeedSearchSlot = feedUi.component("search");
|
|
79503
79586
|
|
|
79504
79587
|
// ../../modules/feed/contract/src/feed.events.ts
|
|
79505
79588
|
var byKind = external_exports.enum(["agent", "person", "system"]);
|
package/package.json
CHANGED