@lazehq/cli 0.1.82 → 0.1.83
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 +43 -12
- package/package.json +1 -1
package/dist/laze.mjs
CHANGED
|
@@ -36990,7 +36990,7 @@ function flagText({
|
|
|
36990
36990
|
}
|
|
36991
36991
|
|
|
36992
36992
|
// src/rules/cli-version.rules.ts
|
|
36993
|
-
var STAMPED = "0.1.
|
|
36993
|
+
var STAMPED = "0.1.83";
|
|
36994
36994
|
function cliVersionOf({ stamped = STAMPED } = {}) {
|
|
36995
36995
|
return stamped.startsWith("__") ? "dev" : stamped;
|
|
36996
36996
|
}
|
|
@@ -72083,6 +72083,17 @@ function beat({
|
|
|
72083
72083
|
...working && state?.messageId ? { messageId: state.messageId } : {}
|
|
72084
72084
|
});
|
|
72085
72085
|
}
|
|
72086
|
+
function placeOf(message2) {
|
|
72087
|
+
return { channelId: message2.channelId, threadRootId: message2.threadRootId };
|
|
72088
|
+
}
|
|
72089
|
+
function newestPerConversation({ messages }) {
|
|
72090
|
+
const newest = /* @__PURE__ */ new Map();
|
|
72091
|
+
for (const message2 of messages) {
|
|
72092
|
+
newest.delete(message2.channelId);
|
|
72093
|
+
newest.set(message2.channelId, message2);
|
|
72094
|
+
}
|
|
72095
|
+
return [...newest.values()];
|
|
72096
|
+
}
|
|
72086
72097
|
async function turnStarted({
|
|
72087
72098
|
context,
|
|
72088
72099
|
client,
|
|
@@ -72096,10 +72107,18 @@ async function turnStarted({
|
|
|
72096
72107
|
threadRootId: last.threadRootId,
|
|
72097
72108
|
messageId: last.messageId
|
|
72098
72109
|
};
|
|
72110
|
+
const others = newestPerConversation({ messages }).filter(
|
|
72111
|
+
(message2) => message2.channelId !== last.channelId
|
|
72112
|
+
);
|
|
72099
72113
|
const before = await readState({ context, agent: agent3 });
|
|
72100
|
-
|
|
72114
|
+
const kept = before && others.some((message2) => message2.channelId === before.channelId);
|
|
72115
|
+
if (before && before.channelId !== state.channelId && !kept) {
|
|
72101
72116
|
await beat({ client, state: before, working: false }).catch(() => void 0);
|
|
72102
72117
|
}
|
|
72118
|
+
for (const other of others) {
|
|
72119
|
+
const opened = { ...placeOf(other), messageId: other.messageId };
|
|
72120
|
+
await beat({ client, state: opened, working: true }).catch(() => void 0);
|
|
72121
|
+
}
|
|
72103
72122
|
const path = statePath({ context, agent: agent3 });
|
|
72104
72123
|
await mkdir5(dirname5(path), { recursive: true, mode: 448 });
|
|
72105
72124
|
await writeFile5(path, JSON.stringify(state));
|
|
@@ -72314,7 +72333,7 @@ async function attachmentIdsOf({
|
|
|
72314
72333
|
function utcTimeOf(iso3) {
|
|
72315
72334
|
return `${iso3.slice(0, 10)} ${iso3.slice(11, 16)} UTC`;
|
|
72316
72335
|
}
|
|
72317
|
-
function
|
|
72336
|
+
function placeOf2(item) {
|
|
72318
72337
|
if (item.channelKind === "public" || item.channelKind === "private") {
|
|
72319
72338
|
return `in #${item.channelName}`;
|
|
72320
72339
|
}
|
|
@@ -72322,7 +72341,7 @@ function placeOf(item) {
|
|
|
72322
72341
|
}
|
|
72323
72342
|
function activityLineOf({ item }) {
|
|
72324
72343
|
const who = item.actor.name;
|
|
72325
|
-
const where =
|
|
72344
|
+
const where = placeOf2(item);
|
|
72326
72345
|
switch (item.kind) {
|
|
72327
72346
|
case "mention":
|
|
72328
72347
|
return `${who} mentioned you ${where}`;
|
|
@@ -72379,7 +72398,7 @@ function sendAtOf({ at, timeZone }) {
|
|
|
72379
72398
|
return null;
|
|
72380
72399
|
}
|
|
72381
72400
|
}
|
|
72382
|
-
function
|
|
72401
|
+
function placeOf3({ scheduled: scheduled2 }) {
|
|
72383
72402
|
const inChannel = scheduled2.channelKind === "public" || scheduled2.channelKind === "private";
|
|
72384
72403
|
const channel = inChannel ? `#${scheduled2.channelName}` : "a direct message";
|
|
72385
72404
|
if (!scheduled2.threadRootId) return channel;
|
|
@@ -72402,7 +72421,7 @@ function scheduledLine({
|
|
|
72402
72421
|
timeZone
|
|
72403
72422
|
}) {
|
|
72404
72423
|
const when = zonedTimeOf({ iso: scheduled2.sendAt, timeZone });
|
|
72405
|
-
return `Scheduled ${scheduled2.id} for ${
|
|
72424
|
+
return `Scheduled ${scheduled2.id} for ${placeOf3({ scheduled: scheduled2 })} at ${when}.
|
|
72406
72425
|
${indented(scheduled2.body)}
|
|
72407
72426
|
`;
|
|
72408
72427
|
}
|
|
@@ -72415,7 +72434,7 @@ var FAILURES = {
|
|
|
72415
72434
|
};
|
|
72416
72435
|
function entryOf(scheduled2) {
|
|
72417
72436
|
const failed2 = scheduled2.failure ? `failed: ${FAILURES[scheduled2.failure]}; give it a new time with laze scheduled edit --at, or cancel it` : scheduled2.status;
|
|
72418
|
-
const head = `${utcTimeOf(scheduled2.sendAt)} ${failed2} ${
|
|
72437
|
+
const head = `${utcTimeOf(scheduled2.sendAt)} ${failed2} ${placeOf3({ scheduled: scheduled2 })} ${scheduled2.id}`;
|
|
72419
72438
|
return `${head}
|
|
72420
72439
|
${indented(scheduled2.body)}`;
|
|
72421
72440
|
}
|
|
@@ -72523,7 +72542,7 @@ async function actOn({
|
|
|
72523
72542
|
});
|
|
72524
72543
|
if (args.flags.json) return context.out(`${JSON.stringify(done, null, 2)}
|
|
72525
72544
|
`);
|
|
72526
|
-
const place =
|
|
72545
|
+
const place = placeOf3({ scheduled: done });
|
|
72527
72546
|
context.out(
|
|
72528
72547
|
action === "send" ? `Sent ${done.id} now in ${place} as ${done.messageId ?? "a new message"}.
|
|
72529
72548
|
` : `Cancelled ${done.id} in ${place}.
|
|
@@ -75000,13 +75019,24 @@ async function settleRound(round) {
|
|
|
75000
75019
|
return 2;
|
|
75001
75020
|
}
|
|
75002
75021
|
if (messages.length === 0) return "again";
|
|
75003
|
-
await turnStarted({ context, client, agent: name3, messages }).catch(() => void 0);
|
|
75004
75022
|
const self2 = await currentNameOf({ context, client, profile: name3 });
|
|
75005
|
-
|
|
75023
|
+
const text3 = hookContextOf({ messages, self: self2 });
|
|
75024
|
+
const sent = round.rush ? await sentThroughRush({ context, rush: round.rush, text: text3 }) : false;
|
|
75025
|
+
await turnStarted({ context, client, agent: name3, messages }).catch(() => void 0);
|
|
75026
|
+
if (!sent) context.err(`${text3}
|
|
75006
75027
|
`);
|
|
75007
75028
|
const messageIds = messages.map((message2) => message2.messageId);
|
|
75008
75029
|
await dropFromSpool({ context, profile: name3, messageIds });
|
|
75009
|
-
return 2;
|
|
75030
|
+
return sent ? 0 : 2;
|
|
75031
|
+
}
|
|
75032
|
+
async function sentThroughRush({
|
|
75033
|
+
context,
|
|
75034
|
+
rush,
|
|
75035
|
+
text: text3
|
|
75036
|
+
}) {
|
|
75037
|
+
const command = rushSendCommand(rush);
|
|
75038
|
+
const code = await context.runCommand({ command, env: { LAZE_WAKE_TEXT: text3 } }).catch(() => 1);
|
|
75039
|
+
return code === 0;
|
|
75010
75040
|
}
|
|
75011
75041
|
async function waitForMessages({ context, args }) {
|
|
75012
75042
|
const raw = await context.readStdin();
|
|
@@ -75029,7 +75059,8 @@ async function waitForMessages({ context, args }) {
|
|
|
75029
75059
|
const deadline = context.nowMs() + (WAIT_HOOK_TIMEOUT_SECONDS - 60) * 1e3;
|
|
75030
75060
|
try {
|
|
75031
75061
|
while (context.nowMs() < deadline) {
|
|
75032
|
-
const
|
|
75062
|
+
const round = { context, client, name: name3, lock, claudePid, session, seen, rush };
|
|
75063
|
+
const code = await settleRound(round);
|
|
75033
75064
|
if (code !== "again") return code;
|
|
75034
75065
|
}
|
|
75035
75066
|
return 0;
|
package/package.json
CHANGED