omni-notify-mcp 1.3.358 → 1.3.359
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/gateway/mcpDoor.js +1 -1
- package/dist/gateway/sessionDriver.js +7 -265
- package/package.json +1 -1
package/dist/gateway/mcpDoor.js
CHANGED
|
@@ -93,7 +93,7 @@ agent_prompt sends the user's request to that agent and returns its answer. It c
|
|
|
93
93
|
A NEW conversation names the folder it works in and the agent CLI it runs, in the same call that creates it: project and provider are both required, and a call that leaves either out is refused with what to send — nothing is ever started in a folder or on a CLI the caller did not choose. project is exactly one of ${offer.list}, under the workspace root (${offer.under}), never a path, and agent_projects lists them with their paths; provider is exactly one of ${PROVIDER_NAMES.join(", ")}. A call that goes on with a conversation that already exists needs neither, because both were bound when it was created.
|
|
94
94
|
agent_open opens a conversation with no message and starts nothing: it names its project and provider as above, spends nothing and returns the id of a session to ask with agent_send and read with agent_wait. The folder of an existing conversation is switched with agent_project, which never starts a new agent and never makes a new conversation.
|
|
95
95
|
An agent works on the project it runs in: its own folder is the board it writes to, so work belonging to another project is never done from this agent — tell the user in one line which project the work belongs to, then start that project's own agent: agent_start with project naming the project and text carrying the request (agent_prompt with project for a quick answer), read its answer with agent_wait and relay it.
|
|
96
|
-
A request that changes a project is a Story, and the Story belongs on that project's own board: the agent of that project — this conversation's own agent when the work is this project's, the agent this conversation starts with agent_start as above when it belongs to another project — files it or joins it with the bullseye-backlog MCP server that project's folder declares, before any work is done on it. Once a Story is on the board the normal BB → FleetView workflow owns its execution and dispatches the subagents that run it, so BN stays free for the user's questions and follows the Story's progress on the board. A short read-only question or a status check is answered directly. Every agent respects the shared claim store, the one claims file this machine's doors write, so no Story is executed twice:
|
|
96
|
+
A request that changes a project is a Story, and the Story belongs on that project's own board: the agent of that project — this conversation's own agent when the work is this project's, the agent this conversation starts with agent_start as above when it belongs to another project — files it or joins it with the bullseye-backlog MCP server that project's folder declares, before any work is done on it. Once a Story is on the board the normal BB → FleetView workflow owns its execution and dispatches the subagents that run it, so BN stays free for the user's questions and follows the Story's progress on the board. A short read-only question or a status check is answered directly. Every agent respects the shared claim store, the one claims file this machine's doors write, so no Story is executed twice: the lane that works a Story claims it when that lane is dispatched, and a message that only names a Story — a question about it, a status check — claims nothing, so it never stands in the way of the lane that works it. The long task in the example below goes the same way: agent_start and agent_wait are how such a request is sent and read, and the Story it becomes is filed and run as above.
|
|
97
97
|
Each agent_prompt goes on with the same agent as the previous one from this connection, also when a different project is named; new=true starts a fresh agent. With no conversation named, BN also starts a fresh agent by itself when the newest agent is busy and the ask does not point at the work already under way — so the ask never waits behind that turn. An ask that does point at the work under way (a follow-up, "are you done?", "stop") goes to the agent that is doing that work, even when a later independent ask opened another agent. A stopped conversation resumes on its next message.
|
|
98
98
|
A call that finishes inside the wait returns the end of the turn itself — an answer, a failure, or stopped when the conversation was stopped — and that is shown to the user as it is. When it returns working=true the turn is still running: call agent_wait at once with the id and the after it gave, and call it again the moment each read returns, until an answer or failed event arrives, or the conversation is stopped. The events that end the turn carry kind answer, failed or stopped, so read them by kind. A question the agent asks does not end its turn: it waits on the agent's own CLI screen, a status event says so, and the user answers it there by opening the conversation in BN — a message sent meanwhile is queued behind that turn and is not the answer. The working state is not an answer and neither is a read that brought only progress events — never pass either of them to the user as one.
|
|
99
99
|
Pass new=true whenever the question does not depend on the work already running: a fresh agent takes the question in a conversation of its own instead of waiting behind this connection's current turn, which can be minutes on a long one. Naming a conversation sends the call to that agent whatever new says, so to start a fresh one, pass new=true and leave conversation out.
|
|
@@ -15,15 +15,13 @@
|
|
|
15
15
|
* place in line (5A). One start line, a status line after each 2 silent minutes, then the answer (6A); a turn whose CLI
|
|
16
16
|
* writes nothing for 15 minutes is failed and gives its slot up (Meni, #2729).
|
|
17
17
|
*
|
|
18
|
-
* A message that names a story (`#NNNN`)
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* story takes no claim, and a story another session already holds fails this turn in the file's own words.
|
|
18
|
+
* A message that names a story (`#NNNN`) claims nothing (#4098): BN is an interactive entry point, the BB → FleetView
|
|
19
|
+
* workflow owns a story's execution and its lane claims the story when it is dispatched, so a question or a status check
|
|
20
|
+
* about a story never stands in the way of the lane that works it (Meni, Q602).
|
|
22
21
|
*/
|
|
23
22
|
import { randomUUID } from "crypto";
|
|
24
|
-
import { mkdirSync,
|
|
25
|
-
import {
|
|
26
|
-
import { basename, dirname, join, resolve } from "path";
|
|
23
|
+
import { mkdirSync, watch } from "fs";
|
|
24
|
+
import { basename } from "path";
|
|
27
25
|
import { DEFAULT_CAPACITY } from "../shared/agentSession.js";
|
|
28
26
|
import { AgentTurnFailed } from "./provider.js";
|
|
29
27
|
import { PROVIDER_NAMES, providerFor } from "./providers.js";
|
|
@@ -49,191 +47,6 @@ const RESUME_PREAMBLE = "(BN restarted while you were working on the message bel
|
|
|
49
47
|
const SPARE_RETRY_MS = 10_000;
|
|
50
48
|
// GATE: the longest a warm spare stands after the newest message of any open conversation; past it the spare is ended and the next message starts cold (proposed to Meni for #2821, 5 minutes).
|
|
51
49
|
export const SPARE_IDLE_MS = 5 * 60_000;
|
|
52
|
-
// GATE: how long a hold stands without a heartbeat before the story returns to its bucket unheld — ten minutes, the same lease the board's engine and FleetView read (#2838, HOLD_FRESH_MS).
|
|
53
|
-
const HOLD_FRESH_MS = 600_000;
|
|
54
|
-
// GATE: how often a conversation refreshes its hold while its turn runs — two minutes, so two missed beats still fit inside the lease.
|
|
55
|
-
const HOLD_BEAT_MS = 120_000;
|
|
56
|
-
// GATE: a `taken` claim of another session stands without a heartbeat this long before it lapses — sixty seconds, the bound every reader of the one claims file uses.
|
|
57
|
-
const CLAIM_FRESH_MS = 60_000;
|
|
58
|
-
// GATE: a claims lock older than this belongs to a crashed writer and is broken by the next one, exactly as the board's engine and FleetView break it.
|
|
59
|
-
const CLAIMS_LOCK_STALE_MS = 5_000;
|
|
60
|
-
const CLAIMS_LOCK_RACE_CODES = new Set(["ENOENT", "EPERM", "EBUSY", "EACCES"]);
|
|
61
|
-
const CLAIMS_PAUSE = new Int32Array(new SharedArrayBuffer(4));
|
|
62
|
-
/** The one claims file every Bullseye door shares (#1806): BULLSEYE_HOME moves the folder, exactly as the board's engine and FleetView resolve it. */
|
|
63
|
-
function claimsFile() {
|
|
64
|
-
return join(process.env.BULLSEYE_HOME ?? join(homedir(), ".bullseye"), "dispatch-claims.json");
|
|
65
|
-
}
|
|
66
|
-
/** The story a message is about, read from the message's own text the way its project is read: the earliest `#<id>` token, a message naming none being about no story. */
|
|
67
|
-
function storyIdIn(text) {
|
|
68
|
-
const at = /#(\d+)/.exec(text);
|
|
69
|
-
return at === null ? undefined : Number(at[1]);
|
|
70
|
-
}
|
|
71
|
-
/** The Eastern board stamp an instant carries — the board's engine `stampOf` step for step, so every claim in the one file reads on one clock. */
|
|
72
|
-
function boardStamp(ms) {
|
|
73
|
-
const at = new Date(ms);
|
|
74
|
-
const date = new Intl.DateTimeFormat("en-CA", { timeZone: "America/New_York", year: "numeric", month: "2-digit", day: "2-digit" }).format(at);
|
|
75
|
-
const time = new Intl.DateTimeFormat("en-GB", { timeZone: "America/New_York", hour: "2-digit", minute: "2-digit", second: "2-digit", hour12: false }).format(at);
|
|
76
|
-
return `${date} ${time}`;
|
|
77
|
-
}
|
|
78
|
-
/** The instant a board stamp names, read AT the instant it names so a stamp across the fall-back still reads back — FleetView's `claimStampInstant`, step for step. */
|
|
79
|
-
function boardStampInstant(stamp) {
|
|
80
|
-
const m = /^(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})$/.exec(stamp);
|
|
81
|
-
if (m === null)
|
|
82
|
-
return Number.NaN;
|
|
83
|
-
const wall = Date.UTC(Number(m[1]), Number(m[2]) - 1, Number(m[3]), Number(m[4]), Number(m[5]), Number(m[6]));
|
|
84
|
-
const first = wall - (newYorkWallAsUtc(wall) - wall);
|
|
85
|
-
return wall - (newYorkWallAsUtc(first) - first);
|
|
86
|
-
}
|
|
87
|
-
function newYorkWallAsUtc(ms) {
|
|
88
|
-
return Date.parse(`${new Date(ms).toLocaleString("en-US", { timeZone: "America/New_York", hour12: false })} UTC`);
|
|
89
|
-
}
|
|
90
|
-
/** Whether two board folders are one board, path for path, on a machine whose paths may differ only in case (#2280). */
|
|
91
|
-
function sameBoard(a, b) {
|
|
92
|
-
if (typeof a !== "string")
|
|
93
|
-
return false;
|
|
94
|
-
const shape = (folder) => resolve(folder).replace(/[\\/]+$/, "");
|
|
95
|
-
return process.platform === "win32" ? shape(a).toLowerCase() === shape(b).toLowerCase() : shape(a) === shape(b);
|
|
96
|
-
}
|
|
97
|
-
/** The words a refusal names the holder with, the shape every door prints (#2838). */
|
|
98
|
-
function heldByWords(claim) {
|
|
99
|
-
return `#${claim.storyId} is held by ${claim.name} (${String(claim.sessionId).replace(/^hold:/, "")}) — heartbeat ${claim.at}${claim.why === undefined ? "" : ` — why: ${claim.why}`}`;
|
|
100
|
-
}
|
|
101
|
-
/** The address every hold of this daemon is written under and released by (#2838). */
|
|
102
|
-
function holdAddress() {
|
|
103
|
-
return `hold:${hostname()}:${process.pid}`;
|
|
104
|
-
}
|
|
105
|
-
/** The hold a conversation writes for a story: a `hold` in the conversation's own name, addressed by this machine and this process exactly as the board's engine writes one (#2838). `drives` names the agent session this conversation runs, so a door can tell this hold from the work of the very session it holds for (#3850). */
|
|
106
|
-
function holdOf(name, storyId, board, now, drives) {
|
|
107
|
-
return { storyId, name, sessionId: holdAddress(), at: boardStamp(now), kind: "hold", board, drives };
|
|
108
|
-
}
|
|
109
|
-
/** The claims the file still holds at `now`, lapsed ones dropped exactly as every reader of the file drops them; a file that is not there is a machine that has claimed nothing. */
|
|
110
|
-
function readClaims(file, now) {
|
|
111
|
-
let text;
|
|
112
|
-
try {
|
|
113
|
-
text = readFileSync(file, "utf8");
|
|
114
|
-
}
|
|
115
|
-
catch (err) {
|
|
116
|
-
if (err.code === "ENOENT")
|
|
117
|
-
return [];
|
|
118
|
-
throw new GatewayError(500, `the claims file ${file} could not be read (${err instanceof Error ? err.message : String(err)})`);
|
|
119
|
-
}
|
|
120
|
-
let held;
|
|
121
|
-
try {
|
|
122
|
-
held = JSON.parse(text).claims;
|
|
123
|
-
}
|
|
124
|
-
catch (err) {
|
|
125
|
-
throw new GatewayError(500, `the claims file ${file} does not hold the claims shape it is written in (${err instanceof Error ? err.message : String(err)})`);
|
|
126
|
-
}
|
|
127
|
-
if (!Array.isArray(held))
|
|
128
|
-
return [];
|
|
129
|
-
return held
|
|
130
|
-
.filter((c) => typeof c.storyId === "number" && typeof c.name === "string" && typeof c.sessionId === "string" && typeof c.at === "string")
|
|
131
|
-
// A hand-over the board is still owed (an entitlement not yet delivered) never lapses, exactly as the door that reads the same file reads it.
|
|
132
|
-
.filter((c) => (c.kind === "entitlement" && c.delivery === "pending") || now - boardStampInstant(String(c.at)) <= (c.kind === "hold" ? HOLD_FRESH_MS : CLAIM_FRESH_MS));
|
|
133
|
-
}
|
|
134
|
-
/** Runs `change` under the claims lock — the same lock the board's engine and FleetView take, so two writers never merge into one reading and drop each other's claim (#2784/#2791). */
|
|
135
|
-
function underClaimsLock(file, change) {
|
|
136
|
-
mkdirSync(dirname(file), { recursive: true });
|
|
137
|
-
const lock = `${file}.lock`;
|
|
138
|
-
const token = `${process.pid}.${randomUUID()}`;
|
|
139
|
-
for (;;) {
|
|
140
|
-
try {
|
|
141
|
-
createClaimsLock(lock, token);
|
|
142
|
-
break;
|
|
143
|
-
}
|
|
144
|
-
catch (err) {
|
|
145
|
-
if (err.code !== "EEXIST")
|
|
146
|
-
throw err;
|
|
147
|
-
}
|
|
148
|
-
breakStaleClaimsLock(lock);
|
|
149
|
-
Atomics.wait(CLAIMS_PAUSE, 0, 0, 1);
|
|
150
|
-
}
|
|
151
|
-
try {
|
|
152
|
-
return change();
|
|
153
|
-
}
|
|
154
|
-
finally {
|
|
155
|
-
try {
|
|
156
|
-
if (readFileSync(lock, "utf8") === token)
|
|
157
|
-
rmSync(lock, { force: true });
|
|
158
|
-
}
|
|
159
|
-
catch (err) {
|
|
160
|
-
if (err.code !== "ENOENT")
|
|
161
|
-
throw err;
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
/** The exclusive create of the lock, retried (5 tries, 50 ms longer each) while a scanner or a delete-pending previous lock refuses it with EPERM, EBUSY or EACCES, exactly as the board's engine creates the same lock. */
|
|
166
|
-
function createClaimsLock(lock, token) {
|
|
167
|
-
for (let tries = 1;; tries++) {
|
|
168
|
-
try {
|
|
169
|
-
writeFileSync(lock, token, { flag: "wx" });
|
|
170
|
-
return;
|
|
171
|
-
}
|
|
172
|
-
catch (err) {
|
|
173
|
-
if (tries >= 5 || !["EPERM", "EBUSY", "EACCES"].includes(String(err.code)))
|
|
174
|
-
throw err;
|
|
175
|
-
Atomics.wait(CLAIMS_PAUSE, 0, 0, tries * 50);
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
/** A lock older than the bound, or stamped into the future by a clock that moved back, is moved aside so one waiter wins it; a fresh lock is never broken, because NTFS reads its mtime a fraction of a millisecond ahead of `Date.now()` (#2791). */
|
|
180
|
-
function breakStaleClaimsLock(lock) {
|
|
181
|
-
const aside = `${lock}.${process.pid}.stale`;
|
|
182
|
-
try {
|
|
183
|
-
const age = Date.now() - statSync(lock).mtimeMs;
|
|
184
|
-
if (age <= CLAIMS_LOCK_STALE_MS && age >= -CLAIMS_LOCK_STALE_MS)
|
|
185
|
-
return;
|
|
186
|
-
renameSync(lock, aside);
|
|
187
|
-
rmSync(aside, { force: true });
|
|
188
|
-
}
|
|
189
|
-
catch (err) {
|
|
190
|
-
if (!CLAIMS_LOCK_RACE_CODES.has(String(err.code)))
|
|
191
|
-
throw err;
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
/** Writes the whole claim set, staged and renamed onto the file, retried while the operating system refuses the rename because another process holds it open. */
|
|
195
|
-
function writeClaims(file, claims) {
|
|
196
|
-
const staged = `${file}.${process.pid}.${randomUUID()}.tmp`;
|
|
197
|
-
writeFileSync(staged, `${JSON.stringify({ claims })}\n`);
|
|
198
|
-
for (let tries = 1;; tries++) {
|
|
199
|
-
try {
|
|
200
|
-
renameSync(staged, file);
|
|
201
|
-
return;
|
|
202
|
-
}
|
|
203
|
-
catch (err) {
|
|
204
|
-
if (tries >= 5 || !["EPERM", "EBUSY", "EACCES"].includes(String(err.code)))
|
|
205
|
-
throw err;
|
|
206
|
-
Atomics.wait(CLAIMS_PAUSE, 0, 0, tries * 50);
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
/** BN's conversation takes the story's hold: the holder's name IS the conversation's id, so every refusal and every door name this conversation. Another session's standing hold, or its fresh `taken` claim, refuses in the file's own words (#2838/#2040). */
|
|
211
|
-
function holdStory(file, name, storyId, board, now, drives) {
|
|
212
|
-
const claim = holdOf(name, storyId, board, now, drives);
|
|
213
|
-
underClaimsLock(file, () => {
|
|
214
|
-
const before = readClaims(file, now);
|
|
215
|
-
const on = (c) => c.storyId === claim.storyId && sameBoard(c.board, board);
|
|
216
|
-
const prior = before.find(on);
|
|
217
|
-
if (prior !== undefined && prior.sessionId === drives)
|
|
218
|
-
return;
|
|
219
|
-
// The name IS the conversation's id, so a hold in it is this conversation's own even under the address of a BN process that died; a DIFFERENT conversation's hold has another name and neither may overwrite the other.
|
|
220
|
-
const mine = prior !== undefined && prior.kind === "hold" && prior.name === claim.name;
|
|
221
|
-
if (prior !== undefined && !mine && (prior.kind === "hold" || claim.kind === "hold"))
|
|
222
|
-
throw new GatewayError(409, heldByWords(prior));
|
|
223
|
-
writeClaims(file, [...before.filter((c) => !on(c)), claim]);
|
|
224
|
-
});
|
|
225
|
-
}
|
|
226
|
-
/** BN drops the hold it wrote when the work on the story ends: only the claim under its own address AND its own name goes — a different conversation of this daemon shares the address and must keep its own claim (#2838). */
|
|
227
|
-
function releaseStory(file, name, storyId, board, now) {
|
|
228
|
-
const mine = holdAddress();
|
|
229
|
-
underClaimsLock(file, () => {
|
|
230
|
-
const before = readClaims(file, now);
|
|
231
|
-
const isMine = (c) => c.storyId === storyId && sameBoard(c.board, board) && c.sessionId === mine && c.name === name;
|
|
232
|
-
if (!before.some(isMine))
|
|
233
|
-
return;
|
|
234
|
-
writeClaims(file, before.filter((c) => !isMine(c)));
|
|
235
|
-
});
|
|
236
|
-
}
|
|
237
50
|
/** The project the next cold first turn needs: that of the most recently active conversation holding no process of its own and written to within the spare's idle bound, so one spare serves the project the next turn lands in; none when no conversation is expecting a turn or its project holds no board. */
|
|
238
51
|
function spareProjectOf(conversations, holding) {
|
|
239
52
|
const cold = conversations.filter((c) => c.state !== "closed" && c.shelf === undefined && !holding.has(c.id)).sort((a, b) => b.lastMessageAt.localeCompare(a.lastMessageAt));
|
|
@@ -740,20 +553,6 @@ export class SessionDriver {
|
|
|
740
553
|
if (readConversation(c.id).providerArchived !== true)
|
|
741
554
|
continue;
|
|
742
555
|
}
|
|
743
|
-
// The story this message is about, read from its own text the way its project is: a hold in this conversation's own name is taken before its process starts, so no other door starts a second lane on the same story.
|
|
744
|
-
let hold;
|
|
745
|
-
try {
|
|
746
|
-
hold = this.holdFor(c.id, next, project);
|
|
747
|
-
}
|
|
748
|
-
catch (err) {
|
|
749
|
-
if (!(err instanceof Error))
|
|
750
|
-
throw err;
|
|
751
|
-
// OWNER: ITER/LOOP — a story another session already holds, or a claims file that cannot be taken, is a refusal THIS turn must report exactly as the project refusal above is: emitted as that turn's failure, the message consumed and the record left idle, never an exception escaping the loop and leaving the message unconsumed. The cause is narrowed to any Error rather than to a GatewayError alone, because the claims store can also fail at the filesystem.
|
|
752
|
-
this.emit(c.id, "system", "failed", `❌ ${err.message}`, next.n, this.failureTiming(c.id, next.n, Date.now()));
|
|
753
|
-
updateConversation(c.id, { consumed: next.n, state: "idle", pid: undefined });
|
|
754
|
-
this.resuming.delete(c.id);
|
|
755
|
-
return;
|
|
756
|
-
}
|
|
757
556
|
let live;
|
|
758
557
|
try {
|
|
759
558
|
live = this.slot(c, next.n, provider, project);
|
|
@@ -762,78 +561,21 @@ export class SessionDriver {
|
|
|
762
561
|
if (!(err instanceof AgentTurnFailed))
|
|
763
562
|
throw err;
|
|
764
563
|
// OWNER: ITER/LOOP — a CLI that refuses to open in this folder (Claude's folder never trusted) is this turn's failure, reported in its own words with the message consumed, exactly as the refusals above.
|
|
765
|
-
this.dropHold(c.id, hold);
|
|
766
564
|
this.emit(c.id, "system", "failed", err.shown ?? `❌ ${err.message}`, next.n, this.failureTiming(c.id, next.n, Date.now()));
|
|
767
565
|
updateConversation(c.id, { consumed: next.n, state: "idle", pid: undefined });
|
|
768
566
|
this.resuming.delete(c.id);
|
|
769
567
|
return;
|
|
770
568
|
}
|
|
771
569
|
// NULL-OK: field live is OPTIONAL and therefore it is ok to check for NULL
|
|
772
|
-
if (live === undefined)
|
|
773
|
-
// The message is queued, not running: a hold belongs to a turn that is running, so it is given up and taken again when the turn starts.
|
|
774
|
-
this.dropHold(c.id, hold);
|
|
570
|
+
if (live === undefined)
|
|
775
571
|
return;
|
|
776
|
-
|
|
777
|
-
let beat;
|
|
778
|
-
if (hold !== undefined) {
|
|
779
|
-
const held = hold;
|
|
780
|
-
this.refreshHold(c.id, held);
|
|
781
|
-
beat = setInterval(() => this.refreshHold(c.id, held), HOLD_BEAT_MS);
|
|
782
|
-
beat.unref();
|
|
783
|
-
}
|
|
784
|
-
try {
|
|
785
|
-
await this.turn(c, live, next);
|
|
786
|
-
}
|
|
787
|
-
finally {
|
|
788
|
-
if (beat !== undefined)
|
|
789
|
-
clearInterval(beat);
|
|
790
|
-
this.dropHold(c.id, hold);
|
|
791
|
-
}
|
|
572
|
+
await this.turn(c, live, next);
|
|
792
573
|
}
|
|
793
574
|
}
|
|
794
575
|
finally {
|
|
795
576
|
this.driving.delete(id);
|
|
796
577
|
}
|
|
797
578
|
}
|
|
798
|
-
/**
|
|
799
|
-
* The hold this conversation takes on the story its message is about, or none when the message names no story: the story is read
|
|
800
|
-
* from the message's own text the same way its project is, and held in this conversation's own name so every door names it as the holder.
|
|
801
|
-
*/
|
|
802
|
-
holdFor(conversationId, message, project) {
|
|
803
|
-
const storyId = storyIdIn(message.text);
|
|
804
|
-
// NULL-OK: field storyId is OPTIONAL and therefore it is ok to check for NULL
|
|
805
|
-
if (storyId === undefined)
|
|
806
|
-
return undefined;
|
|
807
|
-
holdStory(claimsFile(), conversationId, storyId, project, Date.now(), readConversation(conversationId).sessionId);
|
|
808
|
-
return { storyId, board: project };
|
|
809
|
-
}
|
|
810
|
-
/** The hold is refreshed so it never lapses while the turn it belongs to runs. */
|
|
811
|
-
refreshHold(conversationId, hold) {
|
|
812
|
-
try {
|
|
813
|
-
holdStory(claimsFile(), conversationId, hold.storyId, hold.board, Date.now(), readConversation(conversationId).sessionId);
|
|
814
|
-
}
|
|
815
|
-
catch (err) {
|
|
816
|
-
if (!(err instanceof Error))
|
|
817
|
-
throw err;
|
|
818
|
-
// OWNER: this beat is the refresh's own trigger root — a claims file that cannot be taken while the turn runs must not crash BN, so the failure is reported and the hold is left to lapse in its own time, the turn running on regardless.
|
|
819
|
-
process.stderr.write(`[agent-gateway] the hold of ${conversationId} on #${hold.storyId} could not be refreshed: ${err.message}\n`);
|
|
820
|
-
}
|
|
821
|
-
}
|
|
822
|
-
/** The hold is given up when the work on the story ends. */
|
|
823
|
-
dropHold(conversationId, hold) {
|
|
824
|
-
// NULL-OK: field hold is OPTIONAL and therefore it is ok to check for NULL
|
|
825
|
-
if (hold === undefined)
|
|
826
|
-
return;
|
|
827
|
-
try {
|
|
828
|
-
releaseStory(claimsFile(), conversationId, hold.storyId, hold.board, Date.now());
|
|
829
|
-
}
|
|
830
|
-
catch (err) {
|
|
831
|
-
if (!(err instanceof Error))
|
|
832
|
-
throw err;
|
|
833
|
-
// OWNER: the turn is over and cannot be re-run for a failed release — the failure is reported and the hold left to lapse in its own time, so nothing of this frame propagates out of the driver.
|
|
834
|
-
process.stderr.write(`[agent-gateway] the hold of ${conversationId} on #${hold.storyId} could not be released: ${err.message}\n`);
|
|
835
|
-
}
|
|
836
|
-
}
|
|
837
579
|
/** The session's process, started when it has none: a free slot, else the slot of the longest-idle session, else a place in line. A held process started in another folder is ended first — a process's folder cannot change — and the next one runs there on the SAME session id, so the same agent carries on in the folder the record now points at. */
|
|
838
580
|
slot(c, turn, provider, project) {
|
|
839
581
|
const own = this.lives.get(c.id);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "omni-notify-mcp",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.359",
|
|
4
4
|
"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.",
|
|
5
5
|
"main": "dist/daemon.js",
|
|
6
6
|
"type": "module",
|