@tritard/waterbrother 0.16.89 → 0.16.91
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/gateway.js +29 -13
package/package.json
CHANGED
package/src/gateway.js
CHANGED
|
@@ -2192,11 +2192,19 @@ class TelegramGateway {
|
|
|
2192
2192
|
if (!project?.enabled) {
|
|
2193
2193
|
return "This project is not shared.";
|
|
2194
2194
|
}
|
|
2195
|
+
const blockingReview = getLatestBlockingReviewPolicy(project);
|
|
2196
|
+
if (!blockingReview) {
|
|
2197
|
+
return "<b>Reviewer concerns</b>\nNo blocking review is active.";
|
|
2198
|
+
}
|
|
2195
2199
|
const result = getLatestReviewResult(project);
|
|
2196
2200
|
if (!result) {
|
|
2197
2201
|
return "<b>Reviewer concerns</b>\nNo reviewer result is on record yet.";
|
|
2198
2202
|
}
|
|
2199
2203
|
const meta = result.meta && typeof result.meta === "object" ? result.meta : {};
|
|
2204
|
+
const blockingMeta = blockingReview.meta && typeof blockingReview.meta === "object" ? blockingReview.meta : {};
|
|
2205
|
+
if (String(meta.agentId || "").trim() !== String(blockingMeta.agentId || "").trim()) {
|
|
2206
|
+
return "<b>Reviewer concerns</b>\nThe latest reviewer result does not match the current blocking reviewer.";
|
|
2207
|
+
}
|
|
2200
2208
|
if (String(meta.outcome || "").trim() !== "concerns") {
|
|
2201
2209
|
return "<b>Reviewer concerns</b>\nThe latest reviewer result is not concerns.";
|
|
2202
2210
|
}
|
|
@@ -2227,8 +2235,16 @@ class TelegramGateway {
|
|
|
2227
2235
|
if (!project?.enabled) {
|
|
2228
2236
|
return "This project is not shared.";
|
|
2229
2237
|
}
|
|
2238
|
+
const blockingReview = getLatestBlockingReviewPolicy(project);
|
|
2239
|
+
if (!blockingReview) {
|
|
2240
|
+
return "<b>Reviewer override</b>\nNo blocking review is active.";
|
|
2241
|
+
}
|
|
2230
2242
|
const result = getLatestReviewResult(project);
|
|
2231
2243
|
const meta = result?.meta && typeof result.meta === "object" ? result.meta : {};
|
|
2244
|
+
const blockingMeta = blockingReview.meta && typeof blockingReview.meta === "object" ? blockingReview.meta : {};
|
|
2245
|
+
if (String(meta.agentId || "").trim() !== String(blockingMeta.agentId || "").trim()) {
|
|
2246
|
+
return "<b>Reviewer override</b>\nThe latest reviewer result does not match the current blocking reviewer.";
|
|
2247
|
+
}
|
|
2232
2248
|
await addSharedRoomNote(cwd, "Reviewer outcome overridden by the room", {
|
|
2233
2249
|
actorId,
|
|
2234
2250
|
actorName,
|
|
@@ -3172,7 +3188,7 @@ class TelegramGateway {
|
|
|
3172
3188
|
|
|
3173
3189
|
if (text === "/new") {
|
|
3174
3190
|
const sessionId = await this.startFreshSession(message);
|
|
3175
|
-
await this.
|
|
3191
|
+
await this.sendMarkup(message.chat.id, `Started new remote session: <code>${escapeTelegramHtml(sessionId)}</code>`, message.message_id);
|
|
3176
3192
|
return;
|
|
3177
3193
|
}
|
|
3178
3194
|
|
|
@@ -3494,7 +3510,7 @@ class TelegramGateway {
|
|
|
3494
3510
|
if (text === "/claim") {
|
|
3495
3511
|
const { session, project } = await this.bindSharedRoomForMessage(message, sessionId);
|
|
3496
3512
|
if (!project?.enabled) {
|
|
3497
|
-
await this.
|
|
3513
|
+
await this.sendMarkup(message.chat.id, "This project is not shared. Enable sharing from the terminal first with <code>waterbrother project share</code>.", message.message_id);
|
|
3498
3514
|
return;
|
|
3499
3515
|
}
|
|
3500
3516
|
try {
|
|
@@ -3502,7 +3518,7 @@ class TelegramGateway {
|
|
|
3502
3518
|
id: userId,
|
|
3503
3519
|
name: peer?.username || [message?.from?.first_name, message?.from?.last_name].filter(Boolean).join(" ").trim() || userId
|
|
3504
3520
|
});
|
|
3505
|
-
await this.
|
|
3521
|
+
await this.sendMarkup(message.chat.id, `Shared room claimed by <code>${escapeTelegramHtml(claimed.activeOperator?.name || claimed.activeOperator?.id || userId)}</code>`, message.message_id);
|
|
3506
3522
|
} catch (error) {
|
|
3507
3523
|
await this.sendMessage(message.chat.id, escapeTelegramHtml(error instanceof Error ? error.message : String(error)), message.message_id);
|
|
3508
3524
|
}
|
|
@@ -3563,7 +3579,7 @@ Ask them to run <code>/whoami</code> and then <code>/accept-invite ${escapeTeleg
|
|
|
3563
3579
|
}
|
|
3564
3580
|
try {
|
|
3565
3581
|
const result = await approveSharedInvite(session.cwd || this.cwd, inviteId, { actorId: userId });
|
|
3566
|
-
await this.
|
|
3582
|
+
await this.sendMarkup(message.chat.id, `Approved invite <code>${escapeTelegramHtml(result.invite.id)}</code>`, message.message_id);
|
|
3567
3583
|
} catch (error) {
|
|
3568
3584
|
await this.sendMessage(message.chat.id, escapeTelegramHtml(error instanceof Error ? error.message : String(error)), message.message_id);
|
|
3569
3585
|
}
|
|
@@ -3586,7 +3602,7 @@ Ask them to run <code>/whoami</code> and then <code>/accept-invite ${escapeTeleg
|
|
|
3586
3602
|
actorId: userId,
|
|
3587
3603
|
actorName: peer?.username || [message?.from?.first_name, message?.from?.last_name].filter(Boolean).join(" ").trim() || userId
|
|
3588
3604
|
});
|
|
3589
|
-
await this.
|
|
3605
|
+
await this.sendMarkup(message.chat.id, `Accepted invite <code>${escapeTelegramHtml(result.invite.id)}</code>`, message.message_id);
|
|
3590
3606
|
} catch (error) {
|
|
3591
3607
|
await this.sendMessage(message.chat.id, escapeTelegramHtml(error instanceof Error ? error.message : String(error)), message.message_id);
|
|
3592
3608
|
}
|
|
@@ -3606,7 +3622,7 @@ Ask them to run <code>/whoami</code> and then <code>/accept-invite ${escapeTeleg
|
|
|
3606
3622
|
}
|
|
3607
3623
|
try {
|
|
3608
3624
|
const result = await rejectSharedInvite(session.cwd || this.cwd, inviteId, { actorId: userId });
|
|
3609
|
-
await this.
|
|
3625
|
+
await this.sendMarkup(message.chat.id, `Rejected invite <code>${escapeTelegramHtml(result.invite.id)}</code>`, message.message_id);
|
|
3610
3626
|
} catch (error) {
|
|
3611
3627
|
await this.sendMessage(message.chat.id, escapeTelegramHtml(error instanceof Error ? error.message : String(error)), message.message_id);
|
|
3612
3628
|
}
|
|
@@ -3650,7 +3666,7 @@ Ask them to run <code>/whoami</code> and then <code>/accept-invite ${escapeTeleg
|
|
|
3650
3666
|
}
|
|
3651
3667
|
try {
|
|
3652
3668
|
const result = await addSharedTask(session.cwd || this.cwd, taskText, { actorId: userId });
|
|
3653
|
-
await this.
|
|
3669
|
+
await this.sendMarkup(message.chat.id, `Added shared task <code>${escapeTelegramHtml(result.task.id)}</code>`, message.message_id);
|
|
3654
3670
|
} catch (error) {
|
|
3655
3671
|
await this.sendMessage(message.chat.id, escapeTelegramHtml(error instanceof Error ? error.message : String(error)), message.message_id);
|
|
3656
3672
|
}
|
|
@@ -3671,7 +3687,7 @@ Ask them to run <code>/whoami</code> and then <code>/accept-invite ${escapeTeleg
|
|
|
3671
3687
|
try {
|
|
3672
3688
|
const before = (project?.tasks || []).find((task) => task.id === taskId) || null;
|
|
3673
3689
|
const result = await moveSharedTask(session.cwd || this.cwd, taskId, state, { actorId: userId });
|
|
3674
|
-
await this.
|
|
3690
|
+
await this.sendMarkup(message.chat.id, `Moved shared task <code>${escapeTelegramHtml(result.task.id)}</code> to <code>${escapeTelegramHtml(result.task.state)}</code>`, message.message_id);
|
|
3675
3691
|
const notice = buildTaskOwnershipNotice(result.task, { action: "move", previousAssignee: before?.assignedTo || "", previousState: before?.state || "" });
|
|
3676
3692
|
if (notice) await this.sendMessage(message.chat.id, notice, null, { parseMode: "HTML" });
|
|
3677
3693
|
} catch (error) {
|
|
@@ -3694,7 +3710,7 @@ Ask them to run <code>/whoami</code> and then <code>/accept-invite ${escapeTeleg
|
|
|
3694
3710
|
try {
|
|
3695
3711
|
const before = (project?.tasks || []).find((task) => task.id === taskId) || null;
|
|
3696
3712
|
const result = await assignSharedTask(session.cwd || this.cwd, taskId, memberId, { actorId: userId });
|
|
3697
|
-
await this.
|
|
3713
|
+
await this.sendMarkup(message.chat.id, `Assigned shared task <code>${escapeTelegramHtml(result.task.id)}</code> to <code>${escapeTelegramHtml(memberId)}</code>`, message.message_id);
|
|
3698
3714
|
const notice = buildTaskOwnershipNotice(result.task, { action: "assign", previousAssignee: before?.assignedTo || "" });
|
|
3699
3715
|
if (notice) await this.sendMessage(message.chat.id, notice, null, { parseMode: "HTML" });
|
|
3700
3716
|
} catch (error) {
|
|
@@ -3721,7 +3737,7 @@ Ask them to run <code>/whoami</code> and then <code>/accept-invite ${escapeTeleg
|
|
|
3721
3737
|
actorId: userId,
|
|
3722
3738
|
actorName: peer?.username || [message?.from?.first_name, message?.from?.last_name].filter(Boolean).join(" ").trim() || userId
|
|
3723
3739
|
});
|
|
3724
|
-
await this.
|
|
3740
|
+
await this.sendMarkup(message.chat.id, `Commented on shared task <code>${escapeTelegramHtml(result.task.id)}</code>`, message.message_id);
|
|
3725
3741
|
} catch (error) {
|
|
3726
3742
|
await this.sendMessage(message.chat.id, escapeTelegramHtml(error instanceof Error ? error.message : String(error)), message.message_id);
|
|
3727
3743
|
}
|
|
@@ -3761,7 +3777,7 @@ Ask them to run <code>/whoami</code> and then <code>/accept-invite ${escapeTeleg
|
|
|
3761
3777
|
}
|
|
3762
3778
|
try {
|
|
3763
3779
|
const result = await claimSharedTask(session.cwd || this.cwd, taskId, { actorId: userId });
|
|
3764
|
-
await this.
|
|
3780
|
+
await this.sendMarkup(message.chat.id, `Claimed shared task <code>${escapeTelegramHtml(result.task.id)}</code>`, message.message_id);
|
|
3765
3781
|
const notice = buildTaskOwnershipNotice(result.task, { action: "claim" });
|
|
3766
3782
|
if (notice) await this.sendMessage(message.chat.id, notice, null, { parseMode: "HTML" });
|
|
3767
3783
|
} catch (error) {
|
|
@@ -3878,7 +3894,7 @@ Ask them to run <code>/whoami</code> and then <code>/accept-invite ${escapeTeleg
|
|
|
3878
3894
|
}
|
|
3879
3895
|
|
|
3880
3896
|
if (text === "/run") {
|
|
3881
|
-
await this.
|
|
3897
|
+
await this.sendMarkup(message.chat.id, "Usage: <code>/run <prompt></code>", message.message_id);
|
|
3882
3898
|
return;
|
|
3883
3899
|
}
|
|
3884
3900
|
|
|
@@ -4053,7 +4069,7 @@ Ask them to run <code>/whoami</code> and then <code>/accept-invite ${escapeTeleg
|
|
|
4053
4069
|
if (taskText) {
|
|
4054
4070
|
try {
|
|
4055
4071
|
const result = await addSharedTask(sharedBinding.session.cwd || this.cwd, taskText, { actorId: userId });
|
|
4056
|
-
await this.
|
|
4072
|
+
await this.sendMarkup(message.chat.id, `Planner captured task <code>${escapeTelegramHtml(result.task.id)}</code>`, message.message_id);
|
|
4057
4073
|
} catch (error) {
|
|
4058
4074
|
await this.sendMessage(message.chat.id, escapeTelegramHtml(error instanceof Error ? error.message : String(error)), message.message_id);
|
|
4059
4075
|
}
|