omni-notify-mcp 1.3.427 → 1.3.429
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/README.md +3 -3
- package/dist/messaging/decisionDigit.js +40 -5
- package/dist/notify.js +165 -86
- package/dist/shared/agentSession.js +167 -46
- package/dist/shared/webhost/autoSwitch.cjs +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -105,8 +105,8 @@ entirely server-side.
|
|
|
105
105
|
|
|
106
106
|
| Tool | Arguments | Behaviour |
|
|
107
107
|
|---|---|---|
|
|
108
|
-
| `notify` | `message` (≤5000), `priority` = `low`\|`normal`\|`high` | Fan out per the routing table below. The result states `outcome=` with the `attempted` and `delivered` channels, and carries any queued inbox messages for this session. |
|
|
109
|
-
| `ask` | `question` (≤500), `timeout_seconds` (30–3600, default 300) | Sends the question over Telegram and **blocks** until you answer. The wait is clamped to the caller's own transport limit, so it returns `NO REPLY YET` and leaves the question open rather than reporting it as ignored; the answer arrives in the inbox. |
|
|
108
|
+
| `notify` | `message` (≤5000), `priority` = `low`\|`normal`\|`high`, `answers` | Carries only a board decision (the message holds the board's decision link) or an answer to something you asked (`answers` = your own words); anything else is refused with `outcome=blocked` and reaches nobody. Fan out per the routing table below. The result states `outcome=` with the `attempted` and `delivered` channels, and carries any queued inbox messages for this session. |
|
|
109
|
+
| `ask` | `question` (≤500), `answers`, `timeout_seconds` (30–3600, default 300) | Only a question you asked to be put to you (`answers` = your words), else `outcome=blocked`; an agent's own decision goes as the story's board decision instead. Sends the question over Telegram and **blocks** until you answer. The wait is clamped to the caller's own transport limit, so it returns `NO REPLY YET` and leaves the question open rather than reporting it as ignored; the answer arrives in the inbox. |
|
|
110
110
|
| `poll` | — | Drains queued inbox messages for this session; returns `inbox:empty` when there are none. |
|
|
111
111
|
| `wait_for_inbox` | `timeout_seconds` (5–55, default 50) | Blocks and returns the moment you type, as a tool *result* — the delivery path that works in every MCP client. Returns already-queued messages immediately. |
|
|
112
112
|
| `get_idle_seconds` | — | How long since the logged-on user's last keyboard/mouse input, read in his own session, as one of two DIFFERENT answers: `idle: measured N seconds …`, or `idle: could not measure — <why> — user activity unknown, so activity gating is skipped`. |
|
|
@@ -114,7 +114,7 @@ entirely server-side.
|
|
|
114
114
|
| `get_delivery_status` | — | `{ process, healthy, channels, carriage, reason }` from real transport readings, not from config or from the process being alive. `healthy` is true only when every enabled channel has been MEASURED able to carry. |
|
|
115
115
|
| `get_dnd_status` | — | `{ active, reason }` where reason is `disabled`, `manual`, `schedule` or `off`. |
|
|
116
116
|
| `update_instructions` | `instructions` (≤4000), `target` = `global`\|`project` | Rewrites a marker-delimited block in `~/.claude/CLAUDE.md` (global) or `./.claude/CLAUDE.md` (project). |
|
|
117
|
-
| `reply` | `message` (≤2000) | The return path for your most recent channel message, routed back through `notify` so it lands on whichever channel you are reading
|
|
117
|
+
| `reply` | `message` (≤2000), `answers` | The return path for your most recent channel message, routed back through `notify` so it lands on whichever channel you are reading; `answers` carries the words of the message it answers, else `outcome=blocked`. |
|
|
118
118
|
|
|
119
119
|
**Message size and chunking.** `notify` accepts up to 5000 characters and splits
|
|
120
120
|
anything over 500 into numbered `(1/N) …` chunks (word-aware where a break lands past
|
|
@@ -1,12 +1,47 @@
|
|
|
1
1
|
/** #4494 — the BullseyeBacklog service's loopback door that takes a digit he replied to one of its decision messages with. */
|
|
2
|
-
|
|
2
|
+
// GATE: the board's digit door may be moved ONLY under the test gate, so a suite drives a board stand-in on a socket it owns; without the gate it is 7471 and no environment can redirect it
|
|
3
|
+
export const BOARD_DIGIT_DOOR = process.env.NOTIFY_MCP_TEST_ENDPOINTS === "1" && process.env.NOTIFY_BOARD_DIGIT_DOOR ? process.env.NOTIFY_BOARD_DIGIT_DOOR : "http://127.0.0.1:7471/board/decisionDigit";
|
|
4
|
+
/** What he answered, as the log names it. */
|
|
5
|
+
export function replySaid(reply) {
|
|
6
|
+
return "digit" in reply ? reply.digit : `"${reply.words.slice(0, 120)}"`;
|
|
7
|
+
}
|
|
3
8
|
/** The board's door answered something other than a ruling or a reason it ruled nothing. */
|
|
4
9
|
export class BoardDoorRefused extends Error {
|
|
5
10
|
}
|
|
6
|
-
/**
|
|
11
|
+
/** The board decision link a message carries, or undefined when it carries none. */
|
|
12
|
+
export function decisionLink(text) {
|
|
13
|
+
return /https?:\/\/\S+\/board\/decision\?\S+/.exec(text)?.[0];
|
|
14
|
+
}
|
|
15
|
+
/** His reply to a message carrying a board decision link: a lone digit (an optional `.` or `)` after it) picks that option, which the board refuses outside 1-4, and any other words are his own answer; a reply to any other message is undefined. */
|
|
7
16
|
export function decisionReply(text, repliedTo) {
|
|
8
|
-
const
|
|
9
|
-
|
|
17
|
+
const link = decisionLink(repliedTo ?? "");
|
|
18
|
+
if (link === undefined)
|
|
19
|
+
return undefined;
|
|
20
|
+
const digit = /^\s*(\d)[.)]?\s*$/.exec(text)?.[1];
|
|
21
|
+
if (digit !== undefined)
|
|
22
|
+
return { digit, link };
|
|
23
|
+
const words = text.trim();
|
|
24
|
+
return words === "" ? undefined : { words, link };
|
|
25
|
+
}
|
|
26
|
+
const KEYCAPS = ["1️⃣", "2️⃣", "3️⃣", "4️⃣"];
|
|
27
|
+
/** The `callback_data` a decision button carries: the digit it picks, the decision itself named by the message the button sits on. */
|
|
28
|
+
const PICK_DATA = "pick:";
|
|
29
|
+
/** Telegram's inline keyboard for a single-pick board decision message: one button per numbered option line, in order; undefined for any other message, a pick-several decision included. */
|
|
30
|
+
export function decisionButtons(text) {
|
|
31
|
+
if (decisionLink(text) === undefined)
|
|
32
|
+
return undefined;
|
|
33
|
+
const rows = text.split("\n").flatMap((line) => {
|
|
34
|
+
const i = KEYCAPS.findIndex((k) => line.startsWith(`${k} `));
|
|
35
|
+
if (i < 0)
|
|
36
|
+
return [];
|
|
37
|
+
return [[{ text: line.trim(), callback_data: `${PICK_DATA}${i + 1}` }]];
|
|
38
|
+
});
|
|
39
|
+
return rows.length >= 2 && !/PICK ONE OR MORE/.test(text) ? { inline_keyboard: rows } : undefined;
|
|
40
|
+
}
|
|
41
|
+
/** A tap on a decision button as a pick: its digit and the decision link of the message it sits on; else undefined. */
|
|
42
|
+
export function buttonPick(data, messageText) {
|
|
43
|
+
const digit = /^pick:([1-4])$/.exec(data ?? "")?.[1];
|
|
44
|
+
const link = decisionLink(messageText ?? "");
|
|
10
45
|
return digit === undefined || link === undefined ? undefined : { digit, link };
|
|
11
46
|
}
|
|
12
47
|
/** The door's answer as a ruling and a report, or why it is not one. */
|
|
@@ -28,7 +63,7 @@ function answerOf(status, body) {
|
|
|
28
63
|
return { ruled, report };
|
|
29
64
|
}
|
|
30
65
|
/**
|
|
31
|
-
* Hands his digit to the board, which rules that option on the story the replied-to message names. Answers the board's ruling or its
|
|
66
|
+
* Hands his digit or his words to the board, which rules that option, or his words as the answer, on the story the replied-to message names. Answers the board's ruling or its
|
|
32
67
|
* reason for ruling nothing (an already answered, multi-pick or out-of-range decision); throws {@link BoardDoorRefused} when the door
|
|
33
68
|
* could not be reached, timed out, or answered out of contract.
|
|
34
69
|
*/
|
package/dist/notify.js
CHANGED
|
@@ -27,7 +27,7 @@ import { idleNow, playVoice, showBanner } from "./desk.js";
|
|
|
27
27
|
import { AgentGateway, AGENT_PREFIX } from "./agentGateway.js";
|
|
28
28
|
import { PollCursors, DiscordPlatform, TeamsPlatform, NtfyPlatform, SmsPlatform, listenForever, pollForever } from "./messaging/chatInbound.js";
|
|
29
29
|
import { EmailAgentInbox } from "./messaging/emailInbound.js";
|
|
30
|
-
import { BoardDoorRefused, decisionReply, pickByDigit } from "./messaging/decisionDigit.js";
|
|
30
|
+
import { BoardDoorRefused, buttonPick, decisionButtons, decisionLink, decisionReply, pickByDigit, replySaid } from "./messaging/decisionDigit.js";
|
|
31
31
|
import { z } from "zod";
|
|
32
32
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
33
33
|
const MANIFEST_PATH = fileURLToPath(new URL("../package.json", import.meta.url));
|
|
@@ -403,7 +403,7 @@ export const textOwner = (message) => smsEveryNumber(loadConfig(), message);
|
|
|
403
403
|
export function masterMuted() {
|
|
404
404
|
return loadConfig().muteAll === true;
|
|
405
405
|
}
|
|
406
|
-
async function sendNotification(message, priority, client) {
|
|
406
|
+
async function sendNotification(message, priority, client, buttons) {
|
|
407
407
|
const cfg = loadConfig();
|
|
408
408
|
if (cfg.muteAll === true) {
|
|
409
409
|
log("·", "notify", `BLOCKED — all notifications disabled (master mute), priority=${priority}`, client);
|
|
@@ -464,6 +464,9 @@ async function sendNotification(message, priority, client) {
|
|
|
464
464
|
const mode = telegramParseMode(cfg);
|
|
465
465
|
for (const chatId of cfg.telegram.chatIds) {
|
|
466
466
|
const body = { chat_id: chatId, text: message };
|
|
467
|
+
// NULL-OK: field buttons is OPTIONAL and therefore it is ok to check for NULL
|
|
468
|
+
if (buttons !== undefined)
|
|
469
|
+
body.reply_markup = buttons;
|
|
467
470
|
// reply_to only resolves in the chat the last inbound came from.
|
|
468
471
|
if (lastUserMessageId && chatId === lastUserChatId)
|
|
469
472
|
body.reply_to_message_id = lastUserMessageId;
|
|
@@ -1123,6 +1126,60 @@ async function telegramSendTo(token, chatId, text, replyTo) {
|
|
|
1123
1126
|
if (unformatted)
|
|
1124
1127
|
log("→", "telegram:format", `reply to ${chatId} went out UNFORMATTED — Telegram refused the formatting (can't parse entities)`);
|
|
1125
1128
|
}
|
|
1129
|
+
/** One Bot API call answered by its response; a non-2xx is logged with Telegram's reason, never read as done. */
|
|
1130
|
+
async function tgCall(token, method, body) {
|
|
1131
|
+
let r;
|
|
1132
|
+
try {
|
|
1133
|
+
r = await fetch(tgApi(token, method), { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(body), signal: AbortSignal.timeout(15_000) });
|
|
1134
|
+
}
|
|
1135
|
+
catch (err) {
|
|
1136
|
+
if (!(err instanceof TypeError || (err instanceof DOMException && err.name === "TimeoutError")))
|
|
1137
|
+
throw err;
|
|
1138
|
+
// OWNER: one step of answering his tap or digit could not reach Telegram — it is logged NOT DONE and the steps after it still run, so the ruling he made is never hidden by a failed button removal.
|
|
1139
|
+
log("→", `telegram:${method}`, `NOT DONE: Telegram could not be reached: ${err.message}`);
|
|
1140
|
+
return;
|
|
1141
|
+
}
|
|
1142
|
+
if (!r.ok)
|
|
1143
|
+
log("→", `telegram:${method}`, `NOT DONE: ${await telegramSendErrorHint(r)}`);
|
|
1144
|
+
}
|
|
1145
|
+
/** Takes the option buttons off a decision message once it is ruled, so a second tap cannot land on an answered decision. */
|
|
1146
|
+
async function dropDecisionButtons(token, chatId, messageId) {
|
|
1147
|
+
await tgCall(token, "editMessageReplyMarkup", { chat_id: chatId, message_id: messageId, reply_markup: { inline_keyboard: [] } });
|
|
1148
|
+
}
|
|
1149
|
+
/**
|
|
1150
|
+
* A tap on one of a board decision message's buttons: from one of his configured chats (his own, or a group of his) it rules that option on the story the tapped message names,
|
|
1151
|
+
* whatever other decisions are open, answers the tap, takes the buttons off a ruled decision and replies to that message with what the
|
|
1152
|
+
* board said; a tap in any other chat, or on a message carrying no decision, is answered and ruled nowhere.
|
|
1153
|
+
*/
|
|
1154
|
+
async function takeDecisionTap(token, chatIds, tap) {
|
|
1155
|
+
const chatId = tap.message?.chat?.id?.toString();
|
|
1156
|
+
const pick = chatIds.includes(chatId) ? buttonPick(tap.data, tap.message?.text) : undefined;
|
|
1157
|
+
// NULL-OK: field pick is OPTIONAL and therefore it is ok to check for NULL
|
|
1158
|
+
if (pick === undefined) {
|
|
1159
|
+
log("←", "decision:button", `not ruled: tap ${tap.data} from ${tap.from?.id} in chat ${chatId} is not his tap on a decision`);
|
|
1160
|
+
await tgCall(token, "answerCallbackQuery", { callback_query_id: tap.id, text: "Not a decision of yours" });
|
|
1161
|
+
return;
|
|
1162
|
+
}
|
|
1163
|
+
let said;
|
|
1164
|
+
try {
|
|
1165
|
+
said = await pickByDigit(pick);
|
|
1166
|
+
}
|
|
1167
|
+
catch (err) {
|
|
1168
|
+
if (!(err instanceof BoardDoorRefused))
|
|
1169
|
+
throw err;
|
|
1170
|
+
// OWNER: his tap is an unsolicited callback and this is its root — the board could not take it, so he is told on the tap itself to reply with the digit instead and why is logged.
|
|
1171
|
+
log("·", "decision:button", `the board did not take tap ${pick.digit}: ${err.message}`);
|
|
1172
|
+
await tgCall(token, "answerCallbackQuery", { callback_query_id: tap.id, text: "The board could not take it now. Reply to the message with the digit.", show_alert: true });
|
|
1173
|
+
return;
|
|
1174
|
+
}
|
|
1175
|
+
log("←", "decision:button", `${pick.digit} → ${said.report}`);
|
|
1176
|
+
await tgCall(token, "answerCallbackQuery", { callback_query_id: tap.id, text: said.ruled ? "✅ Ruled" : "❌ Not ruled" });
|
|
1177
|
+
if (said.ruled)
|
|
1178
|
+
await dropDecisionButtons(token, chatId, tap.message.message_id);
|
|
1179
|
+
if (masterMuted())
|
|
1180
|
+
return;
|
|
1181
|
+
await telegramSendTo(token, chatId, `${said.ruled ? "✅ RULED" : "❌ NOT RULED"}\n${said.report}`, tap.message.message_id);
|
|
1182
|
+
}
|
|
1126
1183
|
async function startTelegramListener() {
|
|
1127
1184
|
while (pollersWanted) {
|
|
1128
1185
|
try {
|
|
@@ -1149,7 +1206,7 @@ async function startTelegramListener() {
|
|
|
1149
1206
|
}
|
|
1150
1207
|
log("·", "telegram", `listener ready for bot ${bot}, offset=${tgPollOffset}`);
|
|
1151
1208
|
}
|
|
1152
|
-
const r = await fetch(tgApi(token, `getUpdates?offset=${tgPollOffset}&timeout=10`), { signal: AbortSignal.timeout(15_000) });
|
|
1209
|
+
const r = await fetch(tgApi(token, `getUpdates?offset=${tgPollOffset}&timeout=10&allowed_updates=${encodeURIComponent(JSON.stringify(["message", "callback_query"]))}`), { signal: AbortSignal.timeout(15_000) });
|
|
1153
1210
|
// Reset error state on any successful fetch.
|
|
1154
1211
|
if (tgConsecutiveErrors > 0) {
|
|
1155
1212
|
log("·", "telegram", `recovered after ${tgConsecutiveErrors} failed attempt(s)`);
|
|
@@ -1161,6 +1218,11 @@ async function startTelegramListener() {
|
|
|
1161
1218
|
for (const update of json.result ?? []) {
|
|
1162
1219
|
POLL_CURSORS.set(cursorKey, String(update.update_id));
|
|
1163
1220
|
tgPollOffset = update.update_id + 1;
|
|
1221
|
+
// NULL-OK: field callback_query is OPTIONAL and therefore it is ok to check for NULL
|
|
1222
|
+
if (update.callback_query !== undefined) {
|
|
1223
|
+
await takeDecisionTap(token, chatIds, update.callback_query);
|
|
1224
|
+
continue;
|
|
1225
|
+
}
|
|
1164
1226
|
const msg = update.message;
|
|
1165
1227
|
const fromChatId = msg?.chat?.id?.toString();
|
|
1166
1228
|
if (fromChatId && chatIds.includes(fromChatId) && msg.text) {
|
|
@@ -1189,21 +1251,25 @@ async function startTelegramListener() {
|
|
|
1189
1251
|
// Match an outstanding ask first. If the message is tagged, only
|
|
1190
1252
|
// route to a pending ask from that same session — otherwise fall
|
|
1191
1253
|
// through to the inbox so the targeted session can pick it up.
|
|
1192
|
-
// #4494 — a digit he replied to a board decision message with is that decision's pick, whatever else waits on him.
|
|
1254
|
+
// #4494 — a digit he replied to a board decision message with is that decision's pick, and #4123 other words its answer, whatever else waits on him.
|
|
1193
1255
|
const pick = tag === undefined ? decisionReply(text, msg.reply_to_message?.text) : undefined;
|
|
1194
1256
|
let ruling;
|
|
1257
|
+
let unruledWords = false;
|
|
1195
1258
|
// NULL-OK: field pick is OPTIONAL and therefore it is ok to check for NULL
|
|
1196
1259
|
if (pick !== undefined) {
|
|
1197
1260
|
try {
|
|
1198
1261
|
const said = await pickByDigit(pick);
|
|
1199
1262
|
ruling = `${said.ruled ? "✅ RULED" : "❌ NOT RULED"}\n${said.report}`;
|
|
1200
|
-
|
|
1263
|
+
unruledWords = !said.ruled && "words" in pick;
|
|
1264
|
+
log("←", "decision:reply", `${replySaid(pick)} → ${said.report}`);
|
|
1265
|
+
if (said.ruled)
|
|
1266
|
+
await dropDecisionButtons(token, fromChatId, msg.reply_to_message.message_id);
|
|
1201
1267
|
}
|
|
1202
1268
|
catch (err) {
|
|
1203
1269
|
if (!(err instanceof BoardDoorRefused))
|
|
1204
1270
|
throw err;
|
|
1205
|
-
// OWNER: ITER/LOOP — the board could not take his
|
|
1206
|
-
log("·", "decision:
|
|
1271
|
+
// OWNER: ITER/LOOP — the board could not take his reply, so it is queued as an ordinary inbox message (never handed to another agent's pending question), why is logged, and the next update is read.
|
|
1272
|
+
log("·", "decision:reply", `the board did not take reply ${replySaid(pick)}, queued as a message: ${err.message}`);
|
|
1207
1273
|
}
|
|
1208
1274
|
}
|
|
1209
1275
|
const answer = pick === undefined ? takePendingAskFor(tag) : undefined;
|
|
@@ -1215,7 +1281,7 @@ async function startTelegramListener() {
|
|
|
1215
1281
|
const entry = {
|
|
1216
1282
|
text, ts: arrivedAt.toISOString(), messageId: msg.message_id, chatId: fromChatId, tag, origin: "telegram",
|
|
1217
1283
|
};
|
|
1218
|
-
const ackText = ruling
|
|
1284
|
+
const ackText = ruling === undefined ? ingestChatEntry(entry) : unruledWords ? `${ruling}\n\n${ingestChatEntry(entry)}` : ruling;
|
|
1219
1285
|
if (masterMuted())
|
|
1220
1286
|
continue;
|
|
1221
1287
|
// OWNER: ITER/LOOP — a non-2xx does not reject a fetch, so a refused acknowledgement would read as delivered; this frame reports it and the next update is read.
|
|
@@ -2014,8 +2080,10 @@ function drainInboxFor(tag) {
|
|
|
2014
2080
|
// nobody must not be swallowed by the part before it.
|
|
2015
2081
|
async function sendChunked(message, priority, clientId) {
|
|
2016
2082
|
const outcomes = [];
|
|
2017
|
-
|
|
2018
|
-
|
|
2083
|
+
const parts = splitForNotify(message);
|
|
2084
|
+
const buttons = decisionButtons(message);
|
|
2085
|
+
for (const [i, chunk] of parts.entries()) {
|
|
2086
|
+
outcomes.push(await sendNotification(withLead(`[${clientId}]`, chunk), priority, clientId, i === parts.length - 1 ? buttons : undefined));
|
|
2019
2087
|
}
|
|
2020
2088
|
return outcomes;
|
|
2021
2089
|
}
|
|
@@ -2041,54 +2109,42 @@ function appendInbox(baseText, sessionTag, clientId) {
|
|
|
2041
2109
|
return `${baseText}\n\n⚠️ USER SENT YOU A MESSAGE — STOP AND RESPOND BEFORE CONTINUING:\n${inbox}`;
|
|
2042
2110
|
}
|
|
2043
2111
|
const MCP_INSTRUCTIONS = `
|
|
2044
|
-
This server is how
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
just call 'notify' or 'ask' with a generic message and let the server route
|
|
2048
|
-
it.
|
|
2112
|
+
This server is how a board decision, or an answer to something the user
|
|
2113
|
+
asked, reaches him. The channels are configured on the server side; it
|
|
2114
|
+
refuses every other message.
|
|
2049
2115
|
|
|
2050
2116
|
BEHAVIORAL RULES for every client that connects:
|
|
2051
2117
|
|
|
2052
|
-
1.
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
(a) LONG PROCESSING FINISHED. Any single task that took more than ~60
|
|
2056
|
-
seconds of wall-clock time (long build, test run, backtest, migration,
|
|
2057
|
-
big refactor, multi-step plan) gets a 'notify' the moment it completes
|
|
2058
|
-
— success OR failure. Rule of thumb: if the user could have reasonably
|
|
2059
|
-
walked away to grab coffee while you ran, they need a ping on the way
|
|
2060
|
-
back. Don't try to guess whether they were watching. Just notify.
|
|
2118
|
+
1. NOTHING THE USER DID NOT ASK FOR. 'notify' carries exactly two kinds of
|
|
2119
|
+
message, and the SERVER REFUSES every other one (outcome=blocked):
|
|
2061
2120
|
|
|
2062
|
-
(
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2121
|
+
(a) A DECISION ONLY THE USER CAN MAKE — raised on its story as the
|
|
2122
|
+
board's decision; the board itself sends it, carrying its decision
|
|
2123
|
+
link, and the user answers it from the page, by tapping one of its
|
|
2124
|
+
buttons, or by replying to it with one digit or his own words. Never type a decision
|
|
2125
|
+
into 'notify' yourself.
|
|
2067
2126
|
|
|
2068
|
-
(
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
unrecoverable error. When in doubt on importance, ERR ON THE SIDE OF
|
|
2073
|
-
NOTIFYING — the server's idle gating automatically holds a mis-judged
|
|
2074
|
-
'normal' back to local delivery while the user is active, so the
|
|
2075
|
-
cost of over-notifying is near zero. The cost of missing a
|
|
2076
|
-
real event is that the user finds out 4 hours later.
|
|
2127
|
+
(b) AN ANSWER TO SOMETHING THE USER ASKED FOR — he asked a question, or
|
|
2128
|
+
asked in so many words to be told when a thing happens. Pass his own
|
|
2129
|
+
words, verbatim, in 'answers'; a call without them that carries no
|
|
2130
|
+
board decision link is refused.
|
|
2077
2131
|
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2132
|
+
NEVER notify: a task finished, progress, status, a build or test result,
|
|
2133
|
+
"busy on X", an acknowledgement, a heartbeat, anything "important" he did
|
|
2134
|
+
not ask to hear. That belongs on the story, where he reads it when he
|
|
2135
|
+
chooses. Several messages at once flood his phone: send one message per
|
|
2136
|
+
answer, never a running commentary.
|
|
2083
2137
|
|
|
2084
|
-
2.
|
|
2138
|
+
2. Priority: channels each priority reaches, when enabled:
|
|
2085
2139
|
${describePriorityRouting()}
|
|
2086
|
-
- '
|
|
2087
|
-
- '
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2140
|
+
- 'normal' = the default for an answer he asked for.
|
|
2141
|
+
- 'high' = only when his own request says it is urgent.
|
|
2142
|
+
|
|
2143
|
+
2a. PHONE FORMAT — his phone shows emoji, short paragraphs and bullets, and
|
|
2144
|
+
nothing else reads well there: one headline line opening with an emoji
|
|
2145
|
+
that says what this is (✅ done, ❌ failed, ❓ question, ℹ️ answer), then
|
|
2146
|
+
"• " bullets, one fact each, a blank line between sections. No tables,
|
|
2147
|
+
no code blocks, no long paragraphs.
|
|
2092
2148
|
|
|
2093
2149
|
3. Echo the COMPLETE, UNTRUNCATED message body in your own chat / conversation
|
|
2094
2150
|
output as well as sending it through 'notify'. The user may be reading the
|
|
@@ -2119,27 +2175,19 @@ BEHAVIORAL RULES for every client that connects:
|
|
|
2119
2175
|
5. When the user sends you an unsolicited message (visible as INBOX items in
|
|
2120
2176
|
the 'notify' response, via 'poll', via 'wait_for_inbox', via
|
|
2121
2177
|
'get_idle_seconds' piggy-back), reply to
|
|
2122
|
-
them THROUGH '
|
|
2178
|
+
them THROUGH 'reply' — or 'notify' with his words in 'answers' — so the
|
|
2123
2179
|
reply actually reaches them — not just in your chat output. Multiple agents may
|
|
2124
2180
|
be connected simultaneously — the server broadcasts every untagged inbox
|
|
2125
|
-
message to all of them
|
|
2181
|
+
message to all of them. Your reply
|
|
2126
2182
|
MUST identify which session you are (start with your own tag or client id,
|
|
2127
|
-
e.g. "[@alphawave]" or "[sess-abcd]")
|
|
2128
|
-
|
|
2129
|
-
only
|
|
2130
|
-
|
|
2131
|
-
tagged one reply.
|
|
2183
|
+
e.g. "[@alphawave]" or "[sess-abcd]"). Only the session his message is for
|
|
2184
|
+
answers it: if he tagged it (@<tag>), only that session; if it is untagged,
|
|
2185
|
+
only a session whose own work it is about — every other listener stays
|
|
2186
|
+
silent, so one message never brings back several answers.
|
|
2132
2187
|
|
|
2133
|
-
5a.
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
ACT ON THE REQUEST YET. Do not finish the current tool/task first.
|
|
2137
|
-
Drop what you're doing long enough to fire one 'notify' call, THEN
|
|
2138
|
-
resume. Format: "[<your-session-id>] busy on <current-task>; will
|
|
2139
|
-
respond at <milestone>". The user needs to know (a) you heard them,
|
|
2140
|
-
(b) you're not the stuck one, (c) when to expect a real answer. An
|
|
2141
|
-
inbox message that gets a delayed reply is worse than no reply — it
|
|
2142
|
-
wastes the user's time waiting on silence.
|
|
2188
|
+
5a. ONE ANSWER PER MESSAGE: answer his message once, when you have the
|
|
2189
|
+
answer — no "busy on X" acknowledgement first; the server already tells
|
|
2190
|
+
him his message was received.
|
|
2143
2191
|
|
|
2144
2192
|
6. The 'get_idle_seconds', 'get_idle_config', and 'get_dnd_status' tools are
|
|
2145
2193
|
informational reads, but they ALSO drain pending inbox messages. Use them
|
|
@@ -2149,8 +2197,7 @@ BEHAVIORAL RULES for every client that connects:
|
|
|
2149
2197
|
piggy-backed on the response — you don't need to separately call 'poll'.
|
|
2150
2198
|
This is a lightweight local read (no network, no DND or channel routing),
|
|
2151
2199
|
so the cost is near zero. Without this heartbeat pattern, a busy agent is
|
|
2152
|
-
deaf to the user
|
|
2153
|
-
hours away during long work. Treat 'get_idle_seconds' as the "check for
|
|
2200
|
+
deaf to the user's messages for the whole of its long work. Treat 'get_idle_seconds' as the "check for
|
|
2154
2201
|
user input" primitive, not an idle-gate check.
|
|
2155
2202
|
|
|
2156
2203
|
If your work is naturally idle (waiting for the user, between loop iters),
|
|
@@ -2169,9 +2216,6 @@ BEHAVIORAL RULES for every client that connects:
|
|
|
2169
2216
|
host's window — there is no port to probe and no second server to start.
|
|
2170
2217
|
Never tell the user "notify is down" without first trying one more tool call.
|
|
2171
2218
|
|
|
2172
|
-
Bottom line: rule #1 still applies. If you owe the user a notify and your
|
|
2173
|
-
MCP client is broken, you owe them the bypass — not an excuse.
|
|
2174
|
-
|
|
2175
2219
|
8. THE REST OF THIS SERVER, stated here because a dispatcher that never reads
|
|
2176
2220
|
a tool list cannot know it exists:
|
|
2177
2221
|
|
|
@@ -2179,7 +2223,9 @@ BEHAVIORAL RULES for every client that connects:
|
|
|
2179
2223
|
message through the same delivery path as 'notify', with the same
|
|
2180
2224
|
'outcome=' contract. Use it when you are answering a message rather than
|
|
2181
2225
|
starting one.
|
|
2182
|
-
- 'ask(question, timeout_seconds?)' puts ONE question to the user
|
|
2226
|
+
- 'ask(question, answers, timeout_seconds?)' puts ONE question to the user
|
|
2227
|
+
and waits — only a question he asked to be put to him ('answers' = his
|
|
2228
|
+
words); a decision of yours goes as the story's board decision, never here.
|
|
2183
2229
|
Telegram is its only carrier today, and when nothing can carry the
|
|
2184
2230
|
question it REFUSES BEFORE PARKING, naming the channel and why — it never
|
|
2185
2231
|
parks a question into the void and calls the silence an unanswered one.
|
|
@@ -2197,20 +2243,38 @@ BEHAVIORAL RULES for every client that connects:
|
|
|
2197
2243
|
whole. Call it when the user asks you to remember a rule or change how
|
|
2198
2244
|
you act.
|
|
2199
2245
|
|
|
2200
|
-
A CLIENT'S OWN RULES FILE
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
attention that the user's own rules contradict.
|
|
2246
|
+
A CLIENT'S OWN RULES FILE MAY NARROW RULE #1, NEVER WIDEN IT: where that
|
|
2247
|
+
file names another surface — its own prompt, its own tracked UI — that
|
|
2248
|
+
surface carries the message instead, and nothing it says makes an unasked
|
|
2249
|
+
notification one he asked for.
|
|
2205
2250
|
`.trim();
|
|
2251
|
+
/**
|
|
2252
|
+
* 🔴 #4123 — the user is sent only a board decision (the text carries the board's decision link) or an answer to something he asked
|
|
2253
|
+
* (his own words in `answers`); any other text is refused here, for every tool that reaches him, and reaches nobody. Answers the
|
|
2254
|
+
* refusal, or undefined when the text may go.
|
|
2255
|
+
*/
|
|
2256
|
+
function refusedUnasked(text, answers, sessionTag, clientId) {
|
|
2257
|
+
const asked = answers?.trim() ?? "";
|
|
2258
|
+
if (asked !== "") {
|
|
2259
|
+
log("·", "notify", `answers his request: ${asked.slice(0, 200)}`, clientId);
|
|
2260
|
+
return undefined;
|
|
2261
|
+
}
|
|
2262
|
+
if (decisionLink(text) !== undefined)
|
|
2263
|
+
return undefined;
|
|
2264
|
+
log("·", "notify", `REFUSED — neither a board decision nor an answer to his request: ${text.slice(0, 160)}`, clientId);
|
|
2265
|
+
return withInbox("NOT SENT — the user gets only a board decision (the message carries the board's decision link) or an answer to something he asked "
|
|
2266
|
+
+ "(pass his own words in `answers`). This message is neither, so it reached nobody; put it on its story instead.\n"
|
|
2267
|
+
+ "outcome=blocked attempted=[] delivered=[]", false, sessionTag, clientId);
|
|
2268
|
+
}
|
|
2206
2269
|
/** The notify tool surface itself, built for one chat: each session on the HTTP door gets its own. */
|
|
2207
2270
|
export function createMcpServer(clientId, sessionTag) {
|
|
2208
2271
|
const identity = `@${clientId}`;
|
|
2209
2272
|
const identityLine = `\nYOUR SESSION IDENTITY: "${identity}" — use this as your prefix in all notify replies (e.g. "[${identity}] done with build").\n`;
|
|
2210
2273
|
const server = new McpServer({ name: "notify-mcp", version: PACKAGE_VERSION }, { instructions: identityLine + MCP_INSTRUCTIONS });
|
|
2211
2274
|
server.tool("notify", "Send a notification to the user. Delivery channels and DND are server-configured. " +
|
|
2212
|
-
"
|
|
2213
|
-
"
|
|
2275
|
+
"It carries ONLY a board decision (the message holds the board's decision link) or an answer to something the user asked " +
|
|
2276
|
+
"(his own words, verbatim, in `answers`); every other message — a finished task, progress, status, an acknowledgement — " +
|
|
2277
|
+
"is refused with outcome=blocked and reaches nobody. " +
|
|
2214
2278
|
"The result always carries an explicit outcome: \`outcome=delivered\` means at least one " +
|
|
2215
2279
|
"channel carried the message, while \`outcome=failed\` or \`outcome=blocked\` means it " +
|
|
2216
2280
|
"reached NOBODY — never assume the user was told. " +
|
|
@@ -2221,7 +2285,12 @@ export function createMcpServer(clientId, sessionTag) {
|
|
|
2221
2285
|
message: z.string().max(5000).describe("Notification message — up to 5000 chars; the server splits it into numbered parts"),
|
|
2222
2286
|
priority: z.enum(["low", "normal", "high"]).default("normal")
|
|
2223
2287
|
.describe(`Channels per priority, each only when enabled: ${describePriorityRouting()} — high also bypasses activity gating (it never overrides DND)`),
|
|
2224
|
-
|
|
2288
|
+
answers: z.string().max(2000).optional()
|
|
2289
|
+
.describe("The user's own words, verbatim, of the request this notification answers. Required unless the message is a board decision carrying its decision link."),
|
|
2290
|
+
}, async ({ message, priority, answers }) => {
|
|
2291
|
+
const unasked = refusedUnasked(message, answers, sessionTag, clientId);
|
|
2292
|
+
if (unasked !== undefined)
|
|
2293
|
+
return unasked;
|
|
2225
2294
|
const outcomes = await sendChunked(message, priority, clientId);
|
|
2226
2295
|
const notDelivered = outcomes.some((o) => o.outcome !== "delivered");
|
|
2227
2296
|
const held = notDelivered && outcomes.every((o) => o.outcome === "blocked");
|
|
@@ -2238,22 +2307,32 @@ export function createMcpServer(clientId, sessionTag) {
|
|
|
2238
2307
|
return withInbox(summary, notDelivered && !held, sessionTag, clientId);
|
|
2239
2308
|
});
|
|
2240
2309
|
server.tool("reply", "Reply to the user's most recent channel message. Routes through notify so " +
|
|
2241
|
-
"the response reaches whichever channel the user is reading.
|
|
2310
|
+
"the response reaches whichever channel the user is reading. Like notify it carries only an answer to what he asked: " +
|
|
2311
|
+
"pass his message's words in `answers`, or it is refused with outcome=blocked. The result " +
|
|
2242
2312
|
"carries the same \`outcome=\` contract as notify — an error means it reached nobody.", {
|
|
2243
2313
|
message: z.string().max(2000).describe("The reply text to deliver"),
|
|
2244
2314
|
priority: z.enum(["low", "normal", "high"]).default("normal"),
|
|
2245
|
-
|
|
2315
|
+
answers: z.string().max(2000).optional().describe("The user's own words, verbatim, of the message this reply answers."),
|
|
2316
|
+
}, async ({ message, priority, answers }) => {
|
|
2317
|
+
const unasked = refusedUnasked(message, answers, sessionTag, clientId);
|
|
2318
|
+
if (unasked !== undefined)
|
|
2319
|
+
return unasked;
|
|
2246
2320
|
const outcomes = await sendChunked(message, priority, clientId);
|
|
2247
2321
|
const notDelivered = outcomes.every((o) => o.outcome !== "delivered");
|
|
2248
2322
|
const summary = outcomes.map((o) => o.text).join(" ");
|
|
2249
2323
|
return withInbox(summary, notDelivered, sessionTag, clientId);
|
|
2250
2324
|
});
|
|
2251
|
-
server.tool("ask", "
|
|
2252
|
-
"
|
|
2325
|
+
server.tool("ask", "Put a question the user ASKED to be put to him and wait for his reply. Channels are server-configured. " +
|
|
2326
|
+
"A decision of yours is never asked here — raise it as the story's board decision, which reaches him with its link and buttons. " +
|
|
2327
|
+
"Without his words in `answers` (or a board decision link in the question) it is refused with outcome=blocked.", {
|
|
2253
2328
|
question: z.string().max(500).describe("The question to ask the user"),
|
|
2329
|
+
answers: z.string().max(2000).optional().describe("The user's own words, verbatim, of the request this question carries out."),
|
|
2254
2330
|
timeout_seconds: z.number().min(30).max(3600).default(300)
|
|
2255
2331
|
.describe(`How long the question stays open, in seconds (default 5 min). The WAIT is clamped to ${BLOCKING_TOOL_MAX_SECONDS}s because the caller's own transport kills a longer call; a question still unanswered then is NOT lost — it stays open and the answer arrives as an unsolicited message.`),
|
|
2256
|
-
}, async ({ question, timeout_seconds = 300 }) => {
|
|
2332
|
+
}, async ({ question, answers, timeout_seconds = 300 }) => {
|
|
2333
|
+
const unasked = refusedUnasked(question, answers, sessionTag, clientId);
|
|
2334
|
+
if (unasked !== undefined)
|
|
2335
|
+
return unasked;
|
|
2257
2336
|
const token = randomUUID();
|
|
2258
2337
|
const cfg = loadConfig();
|
|
2259
2338
|
if (cfg.muteAll === true) {
|
|
@@ -4,6 +4,7 @@ import * as fs from "node:fs";
|
|
|
4
4
|
import { Agent } from "node:http";
|
|
5
5
|
import { homedir, tmpdir } from "node:os";
|
|
6
6
|
import * as path from "node:path";
|
|
7
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
7
8
|
import { Duplex } from "node:stream";
|
|
8
9
|
import { CLUSTER_OWNER, OwnershipUnreadable, startOwnerOf } from "./providerOwnership.js";
|
|
9
10
|
import { readSettings, settingsFile, SettingsUndefined } from "./workspaceList.js";
|
|
@@ -2797,37 +2798,101 @@ export class QueueBusy extends Error {
|
|
|
2797
2798
|
this.name = "QueueBusy";
|
|
2798
2799
|
}
|
|
2799
2800
|
}
|
|
2800
|
-
|
|
2801
|
-
|
|
2801
|
+
// GATE: how long a press of this process waits in line behind this process's own queue pass before it is refused as busy
|
|
2802
|
+
const PASS_WAIT_MS = 5_000;
|
|
2803
|
+
/**
|
|
2804
|
+
* 🔴 #4336 — this process's line on each lock file: settled once the last holder in it lets go. A pass ({@link driveStoryQueue}) opens it, and
|
|
2805
|
+
* every press that meets it joins its end, so presses that arrive while a pass lets the thread go run one after another once it ends.
|
|
2806
|
+
*/
|
|
2807
|
+
const lineHere = new Map();
|
|
2808
|
+
/** 🔴 #4336 — the lock files the running async context already holds, so a call made from inside a pass never waits on that pass. */
|
|
2809
|
+
const locksHeld = new AsyncLocalStorage();
|
|
2810
|
+
/**
|
|
2811
|
+
* 🔴 #4336 — joins the end of this process's line on the lock file and waits up to {@link PASS_WAIT_MS} for the one ahead to let go;
|
|
2812
|
+
* returns the act that lets the next one in line through. A pass lets the thread go between entries, so a press can arrive mid-pass;
|
|
2813
|
+
* before, the pass held the thread and the press simply ran after it.
|
|
2814
|
+
*/
|
|
2815
|
+
async function joinLine(file, ahead) {
|
|
2816
|
+
let done = () => undefined;
|
|
2817
|
+
const mine = new Promise((resolve) => { done = resolve; });
|
|
2818
|
+
const tail = ahead.then(() => mine);
|
|
2819
|
+
lineHere.set(file, tail);
|
|
2820
|
+
let timer;
|
|
2821
|
+
let aheadLeft = false;
|
|
2822
|
+
await Promise.race([ahead.then(() => { aheadLeft = true; }), new Promise((resolve) => { timer = setTimeout(resolve, PASS_WAIT_MS); })]);
|
|
2823
|
+
clearTimeout(timer);
|
|
2824
|
+
const forget = () => { if (lineHere.get(file) === tail)
|
|
2825
|
+
lineHere.delete(file); };
|
|
2826
|
+
return () => {
|
|
2827
|
+
done();
|
|
2828
|
+
// 🔴 #4336 — one that gave up while the one ahead still holds leaves the line standing until it settles, so a later press still waits behind the pass
|
|
2829
|
+
if (aheadLeft)
|
|
2830
|
+
forget();
|
|
2831
|
+
else
|
|
2832
|
+
void tail.then(forget);
|
|
2833
|
+
};
|
|
2834
|
+
}
|
|
2835
|
+
/**
|
|
2836
|
+
* Runs `drive` holding the board's queue lock, which one process holds at a time; a lock whose process is gone is taken over, and a live holder's never is.
|
|
2837
|
+
* 🔴 #4336 — a call other than a pass that meets this process's line waits its turn in it (see {@link joinLine}) before it is refused; a pass never waits.
|
|
2838
|
+
*/
|
|
2839
|
+
export async function withQueueLock(board, now, drive, pass = false) {
|
|
2802
2840
|
const file = lockFile(board);
|
|
2803
2841
|
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2842
|
+
// 🔴 #4336 — a call that meets no line of this process takes the lock at once, as before, never a tick later
|
|
2843
|
+
const ahead = pass || locksHeld.getStore()?.has(file) === true ? undefined : lineHere.get(file);
|
|
2844
|
+
// NULL-OK: field ahead is OPTIONAL and therefore it is ok to check for NULL
|
|
2845
|
+
const leave = ahead === undefined ? () => undefined : await joinLine(file, ahead);
|
|
2846
|
+
try {
|
|
2847
|
+
for (let attempt = 0;; attempt++) {
|
|
2848
|
+
const tmp = `${file}.${process.pid}.${Math.random().toString(36).slice(2)}.tmp`;
|
|
2849
|
+
fs.writeFileSync(tmp, JSON.stringify({ pid: process.pid, at: now }));
|
|
2850
|
+
try {
|
|
2851
|
+
fs.linkSync(tmp, file);
|
|
2852
|
+
break;
|
|
2853
|
+
}
|
|
2854
|
+
catch (err) {
|
|
2855
|
+
if (err.code !== "EEXIST")
|
|
2856
|
+
throw err;
|
|
2857
|
+
if (attempt > 0)
|
|
2858
|
+
throw new QueueBusy(board, "a driver that took the lock as this one cleared a dead holder's");
|
|
2859
|
+
const held = readJson(file);
|
|
2860
|
+
// NULL-OK: field held is OPTIONAL and therefore it is ok to check for NULL
|
|
2861
|
+
if (held !== undefined && isProcessAlive(held.pid))
|
|
2862
|
+
throw new QueueBusy(board, `process ${held.pid} since ${new Date(held.at).toISOString()}`);
|
|
2863
|
+
takeDeadLock(board, file, held);
|
|
2864
|
+
}
|
|
2865
|
+
finally {
|
|
2866
|
+
fs.rmSync(tmp, { force: true });
|
|
2867
|
+
}
|
|
2810
2868
|
}
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2869
|
+
let passEnded = () => undefined;
|
|
2870
|
+
let line;
|
|
2871
|
+
if (pass) {
|
|
2872
|
+
const ended = new Promise((resolve) => { passEnded = resolve; });
|
|
2873
|
+
const before = lineHere.get(file);
|
|
2874
|
+
// NULL-OK: field before is OPTIONAL and therefore it is ok to check for NULL
|
|
2875
|
+
line = before === undefined ? ended : before.then(() => ended);
|
|
2876
|
+
lineHere.set(file, line);
|
|
2877
|
+
}
|
|
2878
|
+
try {
|
|
2879
|
+
return await locksHeld.run(new Set([...(locksHeld.getStore() ?? []), file]), drive);
|
|
2821
2880
|
}
|
|
2822
2881
|
finally {
|
|
2823
|
-
|
|
2882
|
+
try {
|
|
2883
|
+
fs.rmSync(file, { force: true });
|
|
2884
|
+
}
|
|
2885
|
+
finally {
|
|
2886
|
+
// 🔴 #4336 — the line settles even when the lock file cannot be removed, so no press waits out its whole bound on a pass that ended
|
|
2887
|
+
passEnded();
|
|
2888
|
+
// NULL-OK: field line is OPTIONAL and therefore it is ok to check for NULL
|
|
2889
|
+
if (line !== undefined && lineHere.get(file) === line)
|
|
2890
|
+
lineHere.delete(file);
|
|
2891
|
+
}
|
|
2824
2892
|
}
|
|
2825
2893
|
}
|
|
2826
|
-
try {
|
|
2827
|
-
return await drive();
|
|
2828
|
-
}
|
|
2829
2894
|
finally {
|
|
2830
|
-
|
|
2895
|
+
leave();
|
|
2831
2896
|
}
|
|
2832
2897
|
}
|
|
2833
2898
|
/** A dead holder's lock moved aside under a name of this process's own; a lock that is not the one read (another driver took it meanwhile) is put back and the pass leaves the queue to that driver. */
|
|
@@ -3301,8 +3366,12 @@ export const parkedWaitMs = (worker, parked) => (killedAfterWork(worker, parked)
|
|
|
3301
3366
|
const workerStanding = (storyId) => `A stop you named that you or another agent can clear (a board write refused, the board MCP not loaded yet, a release step) is yours to clear now — never a reason to end your turn. You run no test, on any box (Meni 2026-11-24: "never run agents that perform tests!!!"): write it, compile, ship — DELL-XPS's scheduled runner runs it and its reds come back as rows. A build the box's CPU ceiling refuses is never a reason to end your turn or to say you will retry later — nothing wakes you for it: hold ONE bounded background wait (at most 10 minutes) inside this turn and then rerun; never stop or kill a process to make room.
|
|
3302
3367
|
If a decision only Meni can make stands in the way, ask him with AskUserQuestion: the story queue puts the question on #${storyId}, sends it to him, frees your lane while it waits, and wakes you in this session with his answer, already ruled onto #${storyId} verbatim — apply it and go on. With no AskUserQuestion tool (a Codex worker), record it on #${storyId} with bullseye-backlog \`ask\` and ask him with the notify MCP \`ask\` tool, which reaches his email and text; when its wait ends unanswered, keep calling \`wait_for_inbox\` until his reply arrives, then \`rule\` his answer onto #${storyId} verbatim, apply it and go on. End your turn only once the story is shipped.`;
|
|
3303
3368
|
/** 🔴 #4123 — what a parked worker is told when the queue wakes it in its own session; 🔴 #4499 — with Meni's answer, verbatim, when it was parked on his question. */
|
|
3304
|
-
export const wakeMessage = (storyId, answered) => `FleetView's story queue woke you: #${storyId} is still OPEN on the board and you are its one worker.${answered === undefined ? "" : ` Meni answered your question "${answered.question}" — his words, verbatim: "${answered.answer}". His ruling is already on #${storyId}'s row; apply it.`} Re-read it with bullseye-backlog \`get\` and carry it to \`ship\` in this turn.
|
|
3369
|
+
export const wakeMessage = (storyId, answered) => `FleetView's story queue woke you: #${storyId} is still OPEN on the board and you are its one worker.${answered === undefined ? "" : answered.approval === true ? ` Your tool call stopped on Claude Code's approval prompt ("${answered.question}"), and the queue answered it itself: ${answered.answer}` : ` Meni answered your question "${answered.question}" — his words, verbatim: "${answered.answer}". His ruling is already on #${storyId}'s row; apply it.`} Re-read it with bullseye-backlog \`get\` and carry it to \`ship\` in this turn.
|
|
3305
3370
|
${workerStanding(storyId)}`;
|
|
3371
|
+
/** 🔴 #4518 — the act Claude Code's job record names while one of its tool calls waits on its approval prompt: `approve Bash: <command>`. */
|
|
3372
|
+
export const TOOL_APPROVAL = /^approve [^\s:]+: /;
|
|
3373
|
+
/** 🔴 #4518 — the queue's own answer to a worker stopped on Claude Code's approval of a tool call: a lane already runs in bypass, so what is left is a call Claude Code could not resolve, and it is rewritten, never put to Meni. */
|
|
3374
|
+
export const APPROVAL_ANSWER = "that call was NOT run, and a tool approval is never asked of Meni. In bypass Claude Code still stops a call whose target it cannot resolve — above all a removal or copy whose path is built from shell variables, a loop or a redirect. Make it again as plain calls on literal absolute paths: a merge as `git -C <tree> merge --ff-only <commit>`, main's uncommitted work into your tree with `bash <BullseyeShared>/scripts/wt-land.sh --sync <tree> --repo <main> -- <path>` (BullseyeShared's own absolute path, written out), your work into main with `wt-land.sh --apply`; then go on. Its process was stopped to answer it, so every background task and subagent it had running ended with it: start again any you still need.";
|
|
3306
3375
|
// GATE: how long a worker stopped on Meni's question keeps its lane before it is parked with the lane free; the board sends him the question at 2 minutes, so this leaves him a minute to answer from the notification first
|
|
3307
3376
|
export const QUESTION_HOLD_MS = 180_000;
|
|
3308
3377
|
/** 🔴 #4499 — a moment as the hour and minute of this machine's clock. */
|
|
@@ -3367,10 +3436,28 @@ export const ARCHIVE_KEPT_DAYS = 7;
|
|
|
3367
3436
|
const ACCOUNT_REFUSAL = /API Error: 402\b|\b402 (?:Payment Required|Insufficient Balance|You need positive balance|You have exceeded your monthly quota)|hit your (?:weekly|5-hour|five-hour|session|usage|monthly)? ?limit|Credit balance is too low|issue with the selected model \(claude-|account (?:has been |is )?(?:suspended|disabled)/i;
|
|
3368
3437
|
/** 🔴 #4123 — how long after the queue gave up on a story it is offered to the line again. */
|
|
3369
3438
|
export const rearmDelayMs = (attempts) => REARM_BASE_MS * 2 ** Math.min(Math.max(attempts - WORKER_ATTEMPTS, 0), REARM_DOUBLINGS);
|
|
3370
|
-
|
|
3371
|
-
|
|
3439
|
+
// GATE: how long one stretch of a queue pass may hold the resident service's thread before it lets a waiting request through
|
|
3440
|
+
const QUEUE_SLICE_MS = 16;
|
|
3441
|
+
/** 🔴 #4336 — a pause point for a long queue pass: it yields the thread once the stretch since its last yield reaches {@link QUEUE_SLICE_MS}. */
|
|
3442
|
+
function queueSlicer() {
|
|
3443
|
+
let sliceStart = performance.now();
|
|
3444
|
+
return async () => {
|
|
3445
|
+
if (performance.now() - sliceStart < QUEUE_SLICE_MS)
|
|
3446
|
+
return;
|
|
3447
|
+
await new Promise((resolve) => setImmediate(resolve));
|
|
3448
|
+
sliceStart = performance.now();
|
|
3449
|
+
};
|
|
3450
|
+
}
|
|
3451
|
+
/**
|
|
3452
|
+
* The acks the passes' requests call for: one per request read, carrying its entry's state and place, rewritten only when one of them changed.
|
|
3453
|
+
* 🔴 #4336 — one entry leaving the line moves every place behind it, and on Windows each whole-file write costs milliseconds: a board of
|
|
3454
|
+
* 150 requests held the service's thread for a second. The writes now yield the thread every {@link QUEUE_SLICE_MS}, inside the pass's lock.
|
|
3455
|
+
*/
|
|
3456
|
+
async function writeAcks(board, store, refusals, applied, now) {
|
|
3372
3457
|
const order = queueOrder(store);
|
|
3458
|
+
const slice = queueSlicer();
|
|
3373
3459
|
for (const [storyId, requestId] of applied) {
|
|
3460
|
+
await slice();
|
|
3374
3461
|
const e = store.entries.find((x) => x.storyId === storyId);
|
|
3375
3462
|
const refused = refusals.get(storyId);
|
|
3376
3463
|
const at = e === undefined ? -1 : order.indexOf(e);
|
|
@@ -3601,6 +3688,8 @@ export async function driveStoryQueue(board, world, now) {
|
|
|
3601
3688
|
const refusals = new Map();
|
|
3602
3689
|
const applied = new Map();
|
|
3603
3690
|
const wakeable = new Map();
|
|
3691
|
+
// 🔴 #4336 — each entry's liveness reads cost milliseconds on a board of 150 entries: the pass yields the thread between entries once a stretch runs long
|
|
3692
|
+
const slice = queueSlicer();
|
|
3604
3693
|
for (const id of requestedStories(board)) {
|
|
3605
3694
|
const r = readableRequestView(board, id);
|
|
3606
3695
|
// NULL-OK: field r is OPTIONAL and therefore it is ok to check for NULL
|
|
@@ -3615,6 +3704,7 @@ export async function driveStoryQueue(board, world, now) {
|
|
|
3615
3704
|
applied.set(id, r.requestId);
|
|
3616
3705
|
}
|
|
3617
3706
|
for (const e of store.entries) {
|
|
3707
|
+
await slice();
|
|
3618
3708
|
try {
|
|
3619
3709
|
if (IN_LINE.has(e.state) && inArchive(e.worker) && world.closedWhy(e.storyId) === undefined) {
|
|
3620
3710
|
const worker = e.worker;
|
|
@@ -4006,9 +4096,16 @@ export async function driveStoryQueue(board, world, now) {
|
|
|
4006
4096
|
e.worker.session = w.session;
|
|
4007
4097
|
// NULL-OK: field question is OPTIONAL and therefore it is ok to check for NULL
|
|
4008
4098
|
if (w.blocked === true && w.question !== undefined && e.worker.question?.text !== w.question && (w.guessed !== true || e.worker.question === undefined)) {
|
|
4009
|
-
|
|
4010
|
-
|
|
4011
|
-
|
|
4099
|
+
const from = Math.max(e.worker.startedAt, e.worker.pastAt ?? 0);
|
|
4100
|
+
if (w.approval === true) {
|
|
4101
|
+
e.worker.question = { text: w.question, at: now, from, approval: true, answer: APPROVAL_ANSWER };
|
|
4102
|
+
step(e, now, "answered", `its worker ${e.worker.jobId} stopped on Claude Code's approval of a tool call, which is never Meni's question: the queue answers it itself, stops its process and wakes its own session with the answer — ${w.question}`);
|
|
4103
|
+
}
|
|
4104
|
+
else {
|
|
4105
|
+
e.worker.question = { text: w.question, at: now, from, ...(w.prompted === true ? { prompt: true } : w.guessed === true ? {} : { act: true }) };
|
|
4106
|
+
step(e, now, "asking", `its worker ${e.worker.jobId} waits on Meni's answer to: ${w.question}`);
|
|
4107
|
+
takeRuling(store, e, now);
|
|
4108
|
+
}
|
|
4012
4109
|
}
|
|
4013
4110
|
// a wake whose answer was lost hands his words over only once a reading past its start grace shows the session got past his question: the same question still open there means the wake never landed, so it is woken with them again
|
|
4014
4111
|
// NULL-OK: field question is OPTIONAL and therefore it is ok to check for NULL
|
|
@@ -4073,7 +4170,7 @@ export async function driveStoryQueue(board, world, now) {
|
|
|
4073
4170
|
else
|
|
4074
4171
|
delete worker.killedAt;
|
|
4075
4172
|
// NULL-OK: field question is OPTIONAL and therefore it is ok to check for NULL
|
|
4076
|
-
step(e, now, "parked", asked !== undefined && asked.answer === undefined && asked.prompt === true ? `its ${worker.provider} worker ${worker.jobId} waited on Meni's answer since ${clockOf(asked.at)}, so it is parked and its lane is free; it is woken in its own session, first in line, the moment he answers` : worker.killedAt === undefined ? `its ${worker.provider} worker ${worker.jobId}'s turn is over with the story open, so it is woken in its own session from ${new Date(now + parkedWaitMs(worker, w.parked)).toISOString()}` : `its ${worker.provider} worker ${worker.jobId} was killed mid-work with the story open, so it is woken in its own session at once, ahead of every waiting story he did not place or press Start on`);
|
|
4173
|
+
step(e, now, "parked", asked !== undefined && asked.answer === undefined && asked.prompt === true ? `its ${worker.provider} worker ${worker.jobId} waited on Meni's answer since ${clockOf(asked.at)}, so it is parked and its lane is free; it is woken in its own session, first in line, the moment he answers` : asked?.approval === true ? `its ${worker.provider} worker ${worker.jobId} stopped on Claude Code's approval of a tool call and the queue answered it, so its process is stopped and its own session is woken with that answer from ${new Date(now + parkedWaitMs(worker, w.parked)).toISOString()}` : worker.killedAt === undefined ? `its ${worker.provider} worker ${worker.jobId}'s turn is over with the story open, so it is woken in its own session from ${new Date(now + parkedWaitMs(worker, w.parked)).toISOString()}` : `its ${worker.provider} worker ${worker.jobId} was killed mid-work with the story open, so it is woken in its own session at once, ahead of every waiting story he did not place or press Start on`);
|
|
4077
4174
|
}
|
|
4078
4175
|
if (!w.parked.live) {
|
|
4079
4176
|
e.state = "queued";
|
|
@@ -4090,12 +4187,12 @@ export async function driveStoryQueue(board, world, now) {
|
|
|
4090
4187
|
}
|
|
4091
4188
|
}
|
|
4092
4189
|
// NULL-OK: field question is OPTIONAL and therefore it is ok to check for NULL
|
|
4093
|
-
if (e.forced === true || unhanded(asked) !== undefined
|
|
4190
|
+
if (e.forced === true || due || (unhanded(asked) !== undefined && asked?.approval !== true))
|
|
4094
4191
|
wakeable.set(e, w.parked.sessionId);
|
|
4095
4192
|
continue;
|
|
4096
4193
|
}
|
|
4097
4194
|
// NULL-OK: field tasks is OPTIONAL and therefore it is ok to check for NULL
|
|
4098
|
-
if (w.parked.tasks === undefined && stopDue(worker, now))
|
|
4195
|
+
if ((w.parked.tasks === undefined || asked?.approval === true) && stopDue(worker, now))
|
|
4099
4196
|
idle = worker;
|
|
4100
4197
|
}
|
|
4101
4198
|
// NULL-OK: field retiring is OPTIONAL and therefore it is ok to check for NULL
|
|
@@ -4166,7 +4263,7 @@ export async function driveStoryQueue(board, world, now) {
|
|
|
4166
4263
|
const unscheduled = autoStartHeld(board);
|
|
4167
4264
|
const heldWhy = (e) => {
|
|
4168
4265
|
// 🔴 #4499 — his answer to the question its worker waits on is his own word on that story, so AUTO START off never holds the wake that carries it; his ⏸ Stop still does
|
|
4169
|
-
const manual = unscheduled !== undefined && !hisOwn(e) && unhanded(e.worker?.question) === undefined ? unscheduled : undefined;
|
|
4266
|
+
const manual = unscheduled !== undefined && !hisOwn(e) && (unhanded(e.worker?.question) === undefined || e.worker?.question?.approval === true) ? unscheduled : undefined;
|
|
4170
4267
|
// NULL-OK: field halted is OPTIONAL and therefore it is ok to check for NULL
|
|
4171
4268
|
return e.forced === true ? manual : halted ?? manual;
|
|
4172
4269
|
};
|
|
@@ -4175,14 +4272,16 @@ export async function driveStoryQueue(board, world, now) {
|
|
|
4175
4272
|
// NULL-OK: field lanes is OPTIONAL and therefore it is ok to check for NULL
|
|
4176
4273
|
let running = lanes?.running ?? 0;
|
|
4177
4274
|
/** 🔴 #4460 — a worker this pass started or woke, or whose start may have made one: it takes a lane, and its growth is reserved out of the free reading. */
|
|
4178
|
-
const workerMade = () => {
|
|
4179
|
-
|
|
4275
|
+
const workerMade = (remote = false) => {
|
|
4276
|
+
if (!remote)
|
|
4277
|
+
recentStarts.push(now);
|
|
4180
4278
|
running += 1;
|
|
4181
4279
|
};
|
|
4182
4280
|
/** 🔴 #4460 — why this workspace's lane limit holds the entry's start or wake now, or undefined: no limit is set, a lane is free, or his ⚡ Force start passes it. */
|
|
4183
4281
|
// NULL-OK: field lanes is OPTIONAL and therefore it is ok to check for NULL
|
|
4184
4282
|
const laneHeld = (e) => (lanes === undefined || e.forced === true || running < lanes.limit ? undefined : `⏳ ${running} lanes run, this workspace's limit is ${lanes.limit}`);
|
|
4185
4283
|
for (const e of queueOrder(store)) {
|
|
4284
|
+
await slice();
|
|
4186
4285
|
try {
|
|
4187
4286
|
const sessionId = wakeable.get(e);
|
|
4188
4287
|
// NULL-OK: field sessionId is OPTIONAL and therefore it is ok to check for NULL
|
|
@@ -4237,7 +4336,7 @@ export async function driveStoryQueue(board, world, now) {
|
|
|
4237
4336
|
const released = memoryReleased(e, now);
|
|
4238
4337
|
const wakes = (parked.wakes ?? 0) + 1;
|
|
4239
4338
|
try {
|
|
4240
|
-
const answered = parked.question?.answer === undefined ? undefined : { question: parked.question.text, answer: parked.question.answer };
|
|
4339
|
+
const answered = parked.question?.answer === undefined ? undefined : { question: parked.question.text, answer: parked.question.answer, ...(parked.question.approval === true ? { approval: true } : {}) };
|
|
4241
4340
|
const woken = await world.wake(e, board, sessionId, wakeMessage(e.storyId, answered), worker => { e.worker = worker; save(); });
|
|
4242
4341
|
workerMade();
|
|
4243
4342
|
e.landedAt = now;
|
|
@@ -4250,7 +4349,7 @@ export async function driveStoryQueue(board, world, now) {
|
|
|
4250
4349
|
continue;
|
|
4251
4350
|
}
|
|
4252
4351
|
e.state = "running";
|
|
4253
|
-
e.why = `its ${woken.provider} worker ${woken.jobId} was woken in its own session (wake ${wakes})${answered === undefined ? "" : ` with Meni's answer to "${answered.question}"`}`;
|
|
4352
|
+
e.why = `its ${woken.provider} worker ${woken.jobId} was woken in its own session (wake ${wakes})${answered === undefined ? "" : answered.approval === true ? ` with the queue's own answer to its tool approval "${answered.question}"` : ` with Meni's answer to "${answered.question}"`}`;
|
|
4254
4353
|
step(e, now, "woken", e.why + released);
|
|
4255
4354
|
}
|
|
4256
4355
|
catch (err) {
|
|
@@ -4401,12 +4500,29 @@ export async function driveStoryQueue(board, world, now) {
|
|
|
4401
4500
|
continue;
|
|
4402
4501
|
}
|
|
4403
4502
|
const lowMemory = memoryHeldWhy(world, now);
|
|
4503
|
+
let spillTo;
|
|
4404
4504
|
// NULL-OK: field lowMemory is OPTIONAL and therefore it is ok to check for NULL
|
|
4405
4505
|
if (lowMemory !== undefined) {
|
|
4406
|
-
|
|
4506
|
+
try {
|
|
4507
|
+
// NULL-OK: field spillBox is OPTIONAL and therefore it is ok to check for NULL
|
|
4508
|
+
spillTo = world.spillBox === undefined ? { refused: "no agent cluster starts workers on other boxes for this queue" } : await world.spillBox(e);
|
|
4509
|
+
}
|
|
4510
|
+
catch (err) {
|
|
4511
|
+
if (!(err instanceof WorkerNotStarted))
|
|
4512
|
+
throw err;
|
|
4513
|
+
// OWNER: ITER/LOOP — an agent cluster that could not be asked for this story's box holds the story on memory naming why; the next pass asks again.
|
|
4514
|
+
spillTo = { refused: err.message };
|
|
4515
|
+
}
|
|
4516
|
+
}
|
|
4517
|
+
// NULL-OK: field spillTo is OPTIONAL and therefore it is ok to check for NULL
|
|
4518
|
+
if (lowMemory !== undefined && spillTo !== undefined && "refused" in spillTo) {
|
|
4519
|
+
holdOnMemory(e, now, "held-back", `${lowMemory.why}; no other box takes it: ${spillTo.refused}`, lowMemory.trace);
|
|
4407
4520
|
continue;
|
|
4408
4521
|
}
|
|
4409
|
-
|
|
4522
|
+
// NULL-OK: field spillTo is OPTIONAL and therefore it is ok to check for NULL
|
|
4523
|
+
const box = spillTo === undefined ? undefined : spillTo.box;
|
|
4524
|
+
// NULL-OK: field box is OPTIONAL and therefore it is ok to check for NULL
|
|
4525
|
+
const released = box === undefined ? memoryReleased(e, now) : ` — on ${box}, because ${lowMemory.why}`;
|
|
4410
4526
|
if (e.forced === true)
|
|
4411
4527
|
delete e.accountRefusals;
|
|
4412
4528
|
delete e.forced;
|
|
@@ -4418,11 +4534,14 @@ export async function driveStoryQueue(board, world, now) {
|
|
|
4418
4534
|
step(e, now, "selected", `start ${e.attempts}${e.attempts > WORKER_ATTEMPTS ? ", past the attempts a story is given" : ` of ${WORKER_ATTEMPTS}`}${forced ? ` — ${forcer} ⚡ Force start, past ${forcedPast}` : ""}${released}`);
|
|
4419
4535
|
save();
|
|
4420
4536
|
try {
|
|
4421
|
-
|
|
4537
|
+
const record = (sent) => {
|
|
4422
4538
|
e.worker = sent;
|
|
4423
4539
|
save();
|
|
4424
|
-
}
|
|
4425
|
-
|
|
4540
|
+
};
|
|
4541
|
+
// NULL-OK: field box is OPTIONAL and therefore it is ok to check for NULL
|
|
4542
|
+
e.worker = box === undefined ? await world.launch(e, board, record) : await world.spill(e, board, box, record);
|
|
4543
|
+
// NULL-OK: field box is OPTIONAL and therefore it is ok to check for NULL
|
|
4544
|
+
workerMade(e.worker.box !== undefined);
|
|
4426
4545
|
e.provider = "auto";
|
|
4427
4546
|
e.landedAt = now;
|
|
4428
4547
|
if (noteCarried(e, { alive: true, why: "", carried: e.worker.carried }, now)) {
|
|
@@ -4475,9 +4594,9 @@ export async function driveStoryQueue(board, world, now) {
|
|
|
4475
4594
|
}
|
|
4476
4595
|
}
|
|
4477
4596
|
save();
|
|
4478
|
-
writeAcks(board, store, refusals, applied, now);
|
|
4597
|
+
await writeAcks(board, store, refusals, applied, now);
|
|
4479
4598
|
return store;
|
|
4480
|
-
});
|
|
4599
|
+
}, true);
|
|
4481
4600
|
}
|
|
4482
4601
|
/** 🔴 #4188 — whose press a queue act records when no agent session made it: Meni's own, from the panel or the gateway-signed web page. */
|
|
4483
4602
|
export const HIS_PRESS = "his";
|
|
@@ -4585,7 +4704,7 @@ export async function pressStory(board, storyId, press, now, by, requestHandledB
|
|
|
4585
4704
|
throw new StoryPressRefused(`${String(press)} is not a press FleetView's queue knows; #${storyId} reads: ${e.why}`);
|
|
4586
4705
|
}
|
|
4587
4706
|
writeStore(board, store);
|
|
4588
|
-
writeAcks(board, store, new Map(), new Map([[e.storyId, e.requestId]]), now);
|
|
4707
|
+
await writeAcks(board, store, new Map(), new Map([[e.storyId, e.requestId]]), now);
|
|
4589
4708
|
return did;
|
|
4590
4709
|
});
|
|
4591
4710
|
}
|
|
@@ -5139,8 +5258,10 @@ export function storyWorkerLiveness(worker, now, home = claudeHome()) {
|
|
|
5139
5258
|
return { alive: true, ...progress, parked: { sessionId: job.sessionId, live, failed: true, ...(live ? {} : { killed: true }) }, why: `${said} — it was killed mid-work and its session worked after it was started, so it is parked and woken there` };
|
|
5140
5259
|
}
|
|
5141
5260
|
const asked = questionOf(job);
|
|
5261
|
+
// NULL-OK: field block is OPTIONAL and therefore it is ok to check for NULL
|
|
5262
|
+
const approval = job.state !== "blocked" && job.block?.questions?.[0] === undefined && job.needs !== undefined && TOOL_APPROVAL.test(job.needs);
|
|
5142
5263
|
// NULL-OK: field needs is OPTIONAL and therefore it is ok to check for NULL
|
|
5143
|
-
const blocked = waitsOnMeni(job) ? { blocked: true, ...(job.needs === undefined ? {} : { needs: job.needs }), ...asked, ...(job.state === "blocked" ? {} : { prompted: true }) } : {};
|
|
5264
|
+
const blocked = waitsOnMeni(job) ? { blocked: true, ...(job.needs === undefined ? {} : { needs: job.needs }), ...asked, ...(job.state === "blocked" ? {} : { prompted: true }), ...(approval ? { approval: true } : {}) } : {};
|
|
5144
5265
|
if (live && worksNow(job))
|
|
5145
5266
|
return { alive: true, ...progress, why: `its job ${worker.jobId} runs as session ${job.sessionId} (${job.state})` };
|
|
5146
5267
|
const how = live ? (job.state !== "blocked" && job.tempo === "blocked" ? `its process sits on a prompt waiting on Meni` : `its turn ended ${job.state} and its process waits at the prompt`) : `it reads ${job.state} and no process on this machine runs session ${job.sessionId}`;
|
|
@@ -1124,7 +1124,7 @@ function opencodeEventError(error) {
|
|
|
1124
1124
|
/**
|
|
1125
1125
|
* What a failure on a free model means for the turn, decided once for every OpenCode runner (BN, the shared OpenCodeTurn and through it ai_failover):
|
|
1126
1126
|
* the first failure passes that model over and the turn moves on to the next free model; the same status and message on a second free model is the free tier itself failing —
|
|
1127
|
-
* every free model goes through OpenCode's one gateway — so the whole tier is passed over and the turn goes onto the
|
|
1127
|
+
* every free model goes through OpenCode's one gateway — so the whole tier is passed over and the turn goes onto the keys of the published plan. A failure with no status is ruled the same way.
|
|
1128
1128
|
* @param {{ last: { status: number | undefined, message: string } | undefined }} memory the turn's own record of the free model that failed last
|
|
1129
1129
|
* @param {string} refusalId the refusal id of the free model that failed now
|
|
1130
1130
|
* @param {number | undefined} status
|
|
@@ -1151,7 +1151,7 @@ function opencodeRetryPrompt(movedOff) {
|
|
|
1151
1151
|
}
|
|
1152
1152
|
/** The OpenCode vocabulary a runner that cannot load this file itself is handed: the shared OpenCodeTurn takes it as its spec's `rules`. */
|
|
1153
1153
|
const OPENCODE_RULES = Object.freeze({ eventError: opencodeEventError, freeFailure: opencodeFreeFailure, retryPrompt: opencodeRetryPrompt });
|
|
1154
|
-
/** The
|
|
1154
|
+
/** The keys of DeepAgent's published OpenCode plan, the step after the free tier: the first one with no fresh refusal that runs the asked model. */
|
|
1155
1155
|
function opencodeKeyRoute(home, wanted, now = Date.now(), identities = identitiesHere(), passed = []) {
|
|
1156
1156
|
const { asked, bare } = splitWanted(wanted);
|
|
1157
1157
|
const storeEnv = opencodeStoreEnv(home);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "omni-notify-mcp",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.429",
|
|
4
4
|
"homepage": "https://www.npmjs.com/package/omni-notify-mcp",
|
|
5
5
|
"description": "Reach your AI agents from anywhere — and let them reach you. One resident process on 127.0.0.1:7475 serves the whole tool surface to Claude Code, GitHub Copilot Chat and Codex: desktop, Telegram, Slack, ntfy, Discord, Teams and SMS are configured in one file, and agents notify you when long work finishes or a decision is needed, ask you a question and wait for your answer, and receive and reply to the messages you send them — with Do Not Disturb and idle detection deciding what actually gets through.",
|
|
6
6
|
"main": "dist/daemon.js",
|