omni-notify-mcp 1.3.482 → 1.3.483
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/shared/agentSession.js +51 -314
- package/dist/shared/webhost/autoSwitch.cjs +28 -10
- package/package.json +1 -1
|
@@ -11,7 +11,7 @@ import { AsyncLocalStorage } from "node:async_hooks";
|
|
|
11
11
|
import { Duplex } from "node:stream";
|
|
12
12
|
import { Worker } from "node:worker_threads";
|
|
13
13
|
import { CLUSTER_OWNER, OwnershipUnreadable, startOwnerOf } from "./providerOwnership.js";
|
|
14
|
-
import { AutoStartUnread,
|
|
14
|
+
import { AutoStartUnread, sameRoot, savedAutoStart, workspacesHere } from "./workspaceList.js";
|
|
15
15
|
export function isProcessAlive(pid) {
|
|
16
16
|
try {
|
|
17
17
|
process.kill(pid, 0);
|
|
@@ -2983,7 +2983,6 @@ export const blockedAct = (worker) => (worker.needs === undefined ? "an act its
|
|
|
2983
2983
|
export function workerRunner(worker) {
|
|
2984
2984
|
return worker.blocked === true ? `${worker.provider} worker, stopped until it gets ${blockedAct(worker)}` : `${worker.provider} worker`;
|
|
2985
2985
|
}
|
|
2986
|
-
const STOP_AUTHOR_WORDS = { press: "his ⏸ Stop press", emergency: "emergency stop of every board, not his press", caller: "a caller of the stop verb, not his press" };
|
|
2987
2986
|
export const storyQueueDir = (board) => path.join(board, ".fleetview", "queue");
|
|
2988
2987
|
/** 🔴 #4595 — the folders the deleted hand-over wrote beside the queue (BullseyeBacklog's requests, FleetView's acks): a pass removes any it finds. */
|
|
2989
2988
|
const handOverDirs = (board) => ["requests", "acks"].map((d) => path.join(storyQueueDir(board), d));
|
|
@@ -3130,7 +3129,7 @@ function derived(fields, now) {
|
|
|
3130
3129
|
}
|
|
3131
3130
|
/**
|
|
3132
3131
|
* 🔴 #4595 — FLEETVIEW'S OWN DECISION OF WHAT STARTS, made on every pass from the board's startable read: a story his press stands on is
|
|
3133
|
-
* eligible as his press unless the board refuses a press of it;
|
|
3132
|
+
* eligible as his press unless the board refuses a press of it; with this board's AUTO START on, every
|
|
3134
3133
|
* story the board lets AUTO START start is eligible as AUTO START's; everything else is ineligible with the one reason. An entry the line
|
|
3135
3134
|
* still holds for a story the read no longer lists is asked out in the board's words, and the presses and removals of such a story are
|
|
3136
3135
|
* dropped with it. A read the board could not give derives nothing, so nothing is withdrawn on a failed read.
|
|
@@ -3138,20 +3137,11 @@ function derived(fields, now) {
|
|
|
3138
3137
|
export function boardRequests(board, store, reading, now, closedWhy) {
|
|
3139
3138
|
if ("unread" in reading)
|
|
3140
3139
|
return [];
|
|
3141
|
-
carryOldRemoves(store);
|
|
3142
3140
|
const held = autoStartHeld(board);
|
|
3143
|
-
// the turn-on time is read only while AUTO START reads on, so a file the hold above already named unreadable never stops the pass
|
|
3144
|
-
const onAt = held === undefined ? autoStartOnAt(board) : undefined;
|
|
3145
|
-
// NULL-OK: field onAt is OPTIONAL and therefore it is ok to check for NULL
|
|
3146
|
-
if (onAt !== undefined && store.removed !== undefined)
|
|
3147
|
-
for (const [key, r] of Object.entries(store.removed))
|
|
3148
|
-
if (r.at < onAt)
|
|
3149
|
-
delete store.removed[key];
|
|
3150
3141
|
const listed = new Set(reading.stories.map((s) => s.storyId));
|
|
3151
3142
|
const requests = reading.stories.map((s) => {
|
|
3152
3143
|
const key = String(s.storyId);
|
|
3153
3144
|
const press = store.presses?.[key];
|
|
3154
|
-
const removed = store.removed?.[key];
|
|
3155
3145
|
const base = { storyId: s.storyId, title: s.title, pri: s.pri, effort: s.effort, name: s.name, ...(s.ruling === undefined ? {} : { ruling: s.ruling }) };
|
|
3156
3146
|
const entry = store.entries.find((x) => x.storyId === s.storyId);
|
|
3157
3147
|
// 🔴 #4762 — with AUTO START off a Start press already spent (its worker ended, or it was withdrawn) never brings its story back into line: only a newer press does
|
|
@@ -3160,14 +3150,13 @@ export function boardRequests(board, store, reading, now, closedWhy) {
|
|
|
3160
3150
|
if (press !== undefined && s.pressRefusal === undefined && !spent) {
|
|
3161
3151
|
return derived({ ...base, brief: briefFor(s, press.by), eligible: true, why: PRESSED_WHY[press.by], origin: originOf(press.by), by: press.by, ...(press.by === "press" ? { pressedAt: press.at } : {}), ...(press.top === true ? { place: "top" } : {}), ...(press.forced === undefined ? {} : { forced: press.forced }) }, now);
|
|
3162
3152
|
}
|
|
3163
|
-
// 🔴 #4811 — an agent's ⚡ Force start is an order to start like his press: eligible on the press refusal alone, never held by AUTO START
|
|
3153
|
+
// 🔴 #4811 — an agent's ⚡ Force start is an order to start like his press: eligible on the press refusal alone, never held by AUTO START or the auto refusal; applyRequest's ahead block starts it as the agent's
|
|
3164
3154
|
const ahead = store.forcesAhead?.[key];
|
|
3165
3155
|
// NULL-OK: field ahead is OPTIONAL and therefore it is ok to check for NULL
|
|
3166
3156
|
if (press === undefined && ahead !== undefined && s.pressRefusal === undefined) {
|
|
3167
3157
|
return derived({ ...base, brief: briefFor(s, "auto"), eligible: true, why: `${ahead.by} ⚡ Force start`, origin: "auto", by: "auto" }, now);
|
|
3168
3158
|
}
|
|
3169
|
-
|
|
3170
|
-
const why = press !== undefined ? (spent ? `${held}; his Start press on it is spent` : s.pressRefusal) : removed !== undefined ? `${removed.by} ✕ Remove took it out of the line — his Start press puts it back` : held ?? s.autoRefusal;
|
|
3159
|
+
const why = press !== undefined ? (spent ? `${held}; his Start press on it is spent` : s.pressRefusal) : held ?? s.autoRefusal;
|
|
3171
3160
|
// NULL-OK: field why is OPTIONAL and therefore it is ok to check for NULL
|
|
3172
3161
|
return derived({ ...base, brief: briefFor(s, "auto"), eligible: why === undefined, why: why ?? "ready on the board", origin: "auto", by: "auto" }, now);
|
|
3173
3162
|
});
|
|
@@ -3177,8 +3166,8 @@ export function boardRequests(board, store, reading, now, closedWhy) {
|
|
|
3177
3166
|
continue;
|
|
3178
3167
|
requests.push(derived({ storyId: e.storyId, title: e.title, pri: e.pri, effort: e.effort, name: e.name, brief: e.brief, eligible: false, why: "it is no longer an OUTSTANDING story on the board", origin: "auto", by: "auto", ...(e.ruling === undefined ? {} : { ruling: e.ruling }) }, now));
|
|
3179
3168
|
}
|
|
3180
|
-
// a press
|
|
3181
|
-
for (const kept of [store.presses, store.
|
|
3169
|
+
// a press stands while its story is open on the board — a read taken before it was made, or a story a 🚧 holds, never drops it; the board closing the story does
|
|
3170
|
+
for (const kept of [store.presses, store.forcesAhead])
|
|
3182
3171
|
for (const key of Object.keys(kept ?? {}))
|
|
3183
3172
|
if (!listed.has(Number(key)) && closedWhy(Number(key)) !== undefined)
|
|
3184
3173
|
delete kept[key];
|
|
@@ -3211,23 +3200,6 @@ export function slotRequests(requests, store, lanes, held) {
|
|
|
3211
3200
|
const unslotted = new Set(requests.filter((r) => r.eligible && r.origin === "press" && r.forced === undefined && !inLine.has(r.storyId) && !held(r.storyId) && !admitted.has(r)).map((r) => r.storyId));
|
|
3212
3201
|
return { requests: requests.filter((r) => !r.eligible || inLine.has(r.storyId) || admitted.has(r)), unslotted };
|
|
3213
3202
|
}
|
|
3214
|
-
/** 🔴 #4595 — an entry his ✕ Remove withdrew before removals were kept on the store: its removal is recorded once, at the step that withdrew it, so the pull pass keeps it out until his Start press or his AUTO START turned on. */
|
|
3215
|
-
function carryOldRemoves(store) {
|
|
3216
|
-
if (store.removalsCarried === true)
|
|
3217
|
-
return;
|
|
3218
|
-
store.removalsCarried = true;
|
|
3219
|
-
for (const e of store.entries) {
|
|
3220
|
-
const key = String(e.storyId);
|
|
3221
|
-
// 🔴 #4812 — a recorded withdrawal (`withdrawn-<time>` request) with the ✕ Remove words: the words alone never make a removal
|
|
3222
|
-
if (e.state !== "withdrawn" || !e.requestId.startsWith("withdrawn-") || store.removed?.[key] !== undefined || store.presses?.[key] !== undefined)
|
|
3223
|
-
continue;
|
|
3224
|
-
const said = /^(.+?) ✕ Remove took it out of the line/.exec(e.why);
|
|
3225
|
-
if (said === null)
|
|
3226
|
-
continue;
|
|
3227
|
-
const at = [...e.trace].reverse().find((t) => t.stage === "withdrawn")?.at ?? e.trace[e.trace.length - 1].at;
|
|
3228
|
-
store.removed = { ...store.removed, [key]: { at, by: said[1] } };
|
|
3229
|
-
}
|
|
3230
|
-
}
|
|
3231
3203
|
/**
|
|
3232
3204
|
* 🔴 #4232 — the beat the last pass on a board left. A beat with no `driver` was written before the field existed, when only FleetView drove. Its writer still
|
|
3233
3205
|
* runs only while a process with its pid runs that had started by the beat's own moment: a pid the OS handed a process started after the beat never wrote it.
|
|
@@ -3661,8 +3633,15 @@ function takeDeadLock(board, file, held) {
|
|
|
3661
3633
|
export function readQueueStore(board) {
|
|
3662
3634
|
const stored = readJson(storeFile(board));
|
|
3663
3635
|
// NULL-OK: field stored is OPTIONAL and therefore it is ok to check for NULL
|
|
3664
|
-
|
|
3665
|
-
}
|
|
3636
|
+
if (stored === undefined)
|
|
3637
|
+
return { v: STORY_QUEUE_WIRE, nextSeq: 1, entries: [] };
|
|
3638
|
+
// 🔴 #4799 — the records of the deleted queue acts (⏸ Stop and its lifts, ✕ Remove and its carry) are read off an old store and never written back, so no store keeps them after its next pass
|
|
3639
|
+
for (const gone of LEGACY_QUEUE_FIELDS)
|
|
3640
|
+
delete stored[gone];
|
|
3641
|
+
return withoutRepeatedSteps(stored);
|
|
3642
|
+
}
|
|
3643
|
+
/** 🔴 #4799 — the store fields only the deleted queue acts wrote: ⏸ Stop (`stopped`, `lifted`, `halted`) and ✕ Remove (`removed`, `removalsCarried`). */
|
|
3644
|
+
const LEGACY_QUEUE_FIELDS = ["stopped", "lifted", "halted", "removed", "removalsCarried"];
|
|
3666
3645
|
/** 🔴 #4581 — the two ways work stands still that ask FleetView's progress checker: Meni, 2026-11-27, *"fv for queue without agents and for bb stories without agents or queue"*. */
|
|
3667
3646
|
export const CLOG_TRIGGERS = ["queue without agents", "stories without agents or queue"];
|
|
3668
3647
|
// GATE: how long a stuck set must stand before the progress check is asked — a pass about to start it, or a hand-over in flight, is never checked
|
|
@@ -3794,13 +3773,6 @@ export function queueOrder(store) {
|
|
|
3794
3773
|
}
|
|
3795
3774
|
/** 🔴 #4162 — whether `e` is a worker killed mid-work, parked in line until it is woken in its own session: its story is still being worked, so {@link queueOrder} moves it, never back, into the first places that are not his (a story he placed, or pressed Start or ⚡ on), keeping its order among other killed workers, and a lane its kill freed goes back to it; once he places it himself after its kill it stays where he put it, while a place he gave before the kill does not hold it back. The kill mark counts only beside the park it was written with, so any later park, wake or failure voids it. */
|
|
3796
3775
|
const killedInLine = (e) => e.state === "queued" && e.worker?.parkedAt !== undefined && e.worker.killedAt === e.worker.parkedAt;
|
|
3797
|
-
/** His order of the whole waiting line: each story is stamped with its place in `order`, so the order holds whichever story starts, finishes or arrives — a story he never placed waits behind the ones he ordered, by priority and size. */
|
|
3798
|
-
function stampOrder(order) {
|
|
3799
|
-
order.forEach((e, place) => {
|
|
3800
|
-
e.manual = place;
|
|
3801
|
-
e.ordered = true;
|
|
3802
|
-
});
|
|
3803
|
-
}
|
|
3804
3776
|
/** His placement of `e` at the 0-based place `k` among the waiting stories: every other entry he placed at `k` or after moves down one, so no two of his places tie and his newest move holds the place he chose. */
|
|
3805
3777
|
function placeAt(store, e, k) {
|
|
3806
3778
|
for (const o of store.entries)
|
|
@@ -3936,7 +3908,7 @@ function applyRequest(store, r, now) {
|
|
|
3936
3908
|
step(e, now, "updated", e.why);
|
|
3937
3909
|
}
|
|
3938
3910
|
else if (r.eligible && !newPress && (e.state === "failed" || e.state === "withdrawn") && neverRecordedSpent(e)) {
|
|
3939
|
-
// 🔴 #4485 — a story reported for a never-recorded worker, withdrawn while its decision was open and asked for again, goes back to failed: only his press
|
|
3911
|
+
// 🔴 #4485 — a story reported for a never-recorded worker, withdrawn while its decision was open and asked for again, goes back to failed: only his press starts it
|
|
3940
3912
|
const reported = `the board asks for it again, but ${NEVER_RECORDED_REPORT} — its worker never recorded itself after its one restart for that cause`;
|
|
3941
3913
|
if (e.state !== "failed") {
|
|
3942
3914
|
e.state = "failed";
|
|
@@ -4001,7 +3973,7 @@ function applyRequest(store, r, now) {
|
|
|
4001
3973
|
}
|
|
4002
3974
|
return undefined;
|
|
4003
3975
|
}
|
|
4004
|
-
/** 🔴 #4156 — his ⚡ Force start on an entry in line: it starts on the next pass
|
|
3976
|
+
/** 🔴 #4156 — his ⚡ Force start on an entry in line: it starts on the next pass; the request that carries it (#4177) and the queue's own ⚡ press both force it here. */
|
|
4005
3977
|
function forceEntry(e, now, by, eventAt = now) {
|
|
4006
3978
|
// 🔴 #4799 — a ⚡ Force start is an explicit order to start: it lifts the 🛑 Stop that held the row, never reports ok and leaves it held (the row stayed withdrawn under the same Stop)
|
|
4007
3979
|
if (e.handStop !== undefined) {
|
|
@@ -4691,7 +4663,7 @@ async function passHeld(board, world, now, yieldsToPresses = true) {
|
|
|
4691
4663
|
step(e, now, "archived", `its story is no longer an open row on the board, so its conversation ${session.id} left every history list for the archive`);
|
|
4692
4664
|
save();
|
|
4693
4665
|
});
|
|
4694
|
-
// 🔴 #4761 — a ⚡ Force start ORDER outlives the start that spent its mark: back in line with no worker (it ended, or its start failed), the order is armed again on this pass, so the story restarts without a new press and AUTO START never holds it; one that left the line (
|
|
4666
|
+
// 🔴 #4761 — a ⚡ Force start ORDER outlives the start that spent its mark: back in line with no worker (it ended, or its start failed), the order is armed again on this pass, so the story restarts without a new press and AUTO START never holds it; one that left the line (🛑 Stop, the story's end) is dropped
|
|
4695
4667
|
for (const e of store.entries) {
|
|
4696
4668
|
if (e.forceOrder === undefined)
|
|
4697
4669
|
continue;
|
|
@@ -4932,10 +4904,10 @@ async function passHeld(board, world, now, yieldsToPresses = true) {
|
|
|
4932
4904
|
}
|
|
4933
4905
|
if (e.state === "failed") {
|
|
4934
4906
|
const gaveUp = e.trace.filter((t) => t.stage === "failed").pop();
|
|
4935
|
-
// 🔴 #4485 — a story reported for a worker that never recorded itself, after its one restart, waits for his press
|
|
4907
|
+
// 🔴 #4485 — a story reported for a worker that never recorded itself, after its one restart, waits for his press: no re-arm starts it a third time on the same cause
|
|
4936
4908
|
if (!e.eligible || gaveUp === undefined || (world.resolveRoute === undefined && neverRecordedSpent(e)))
|
|
4937
4909
|
continue;
|
|
4938
|
-
// 🔴 #4642 — A STORY WHOSE WORKERS KEEP ENDING `stopped` IS NEVER STARTED AGAIN: past WORKER_ATTEMPTS such ends the cause is outside the story — something stops its worker — so a fourth start is spent to be stopped again. It keeps this `failed` row with its reason, and only his Start press
|
|
4910
|
+
// 🔴 #4642 — A STORY WHOSE WORKERS KEEP ENDING `stopped` IS NEVER STARTED AGAIN: past WORKER_ATTEMPTS such ends the cause is outside the story — something stops its worker — so a fourth start is spent to be stopped again. It keeps this `failed` row with its reason, and only his Start press puts it back in line.
|
|
4939
4911
|
if ((e.stoppedStarts ?? 0) >= WORKER_ATTEMPTS) {
|
|
4940
4912
|
const said = `its worker was stopped ${e.stoppedStarts} times and the story is still open, so it is not started again — only his ▶ Start press puts it back in line`;
|
|
4941
4913
|
if (e.why !== said) {
|
|
@@ -4947,7 +4919,7 @@ async function passHeld(board, world, now, yieldsToPresses = true) {
|
|
|
4947
4919
|
// 🔴 #4642 — AND A ROW A PASS KEEPS FINDING WEDGED IS NOT STARTED AGAIN EITHER, and this guard is what makes its row's own words true: the wedge
|
|
4948
4920
|
// block sets this `failed` row past {@link WORKER_ATTEMPTS} givings-back, and WITHOUT a guard here the general re-arm below would offer it to the line
|
|
4949
4921
|
// again after {@link rearmDelayMs} and spend another start to be wedged again — one start per cycle, forever. It keeps this row with its reason, and
|
|
4950
|
-
// only his ▶ Start press
|
|
4922
|
+
// only his ▶ Start press or a ⚡ Force start puts it back in line. The words are the same ones the wedge block writes, so the row is not
|
|
4951
4923
|
// rewritten on every pass.
|
|
4952
4924
|
if ((e.wedgeGives ?? 0) > WORKER_ATTEMPTS) {
|
|
4953
4925
|
const said = `it was found with no worker of its own recorded for the start it spent ${e.wedgeGives} times running, so something stops its own start and it rests here — only his ▶ Start press puts it back in line`;
|
|
@@ -5227,7 +5199,7 @@ async function passHeld(board, world, now, yieldsToPresses = true) {
|
|
|
5227
5199
|
continue;
|
|
5228
5200
|
}
|
|
5229
5201
|
if (e.neverRecorded > NEVER_RECORDED_RESTARTS) {
|
|
5230
|
-
// 🔴 #4485 — the restart for this cause was spent and its worker never recorded itself either: reported with the cause, never started again on it until his press
|
|
5202
|
+
// 🔴 #4485 — the restart for this cause was spent and its worker never recorded itself either: reported with the cause, never started again on it until his press (a story the board no longer asks for rests withdrawn with the same words, and a later ask puts it back to failed)
|
|
5231
5203
|
e.state = e.eligible ? "failed" : "withdrawn";
|
|
5232
5204
|
delete e.nextTryAt;
|
|
5233
5205
|
e.why = `${w.why} — restarted once already for the same cause and that worker never recorded itself either, so it is not started again; ${NEVER_RECORDED_REPORT}`;
|
|
@@ -5500,16 +5472,14 @@ async function passHeld(board, world, now, yieldsToPresses = true) {
|
|
|
5500
5472
|
}
|
|
5501
5473
|
save();
|
|
5502
5474
|
// NULL-OK: field stopped is OPTIONAL and therefore it is ok to check for NULL
|
|
5503
|
-
const halted = store.stopped === undefined ? undefined : `the queue is stopped (${store.stopped.by}; ${store.stopped.author === undefined ? "author not recorded" : STOP_AUTHOR_WORDS[store.stopped.author]}), so nothing more starts or wakes until ▶ Run`;
|
|
5504
5475
|
const unscheduled = autoStartHeld(board);
|
|
5505
5476
|
const heldWhy = (e, waking = false) => {
|
|
5506
|
-
// 🔴 #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
|
|
5477
|
+
// 🔴 #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
|
|
5507
5478
|
const answer = e.worker?.question;
|
|
5508
5479
|
const humanAnswer = (unhanded(answer) !== undefined && answer?.approval !== true) || (e.lastWorkerAnswer !== undefined && e.lastWorkerAnswer.approval !== true);
|
|
5509
5480
|
// 🔴 #4601 — his Start press (or board-carried Force) stands: it wakes the parked session after every turn, and never restarts an ended worker
|
|
5510
5481
|
const manual = unscheduled !== undefined && !hisOwn(e) && !(waking && e.startPressedAt !== undefined && e.pressSpent !== true) && !humanAnswer ? unscheduled : undefined;
|
|
5511
|
-
|
|
5512
|
-
return e.forced === true ? manual : halted ?? manual;
|
|
5482
|
+
return e.forced === true ? undefined : manual;
|
|
5513
5483
|
};
|
|
5514
5484
|
// NULL-OK: field lanes is OPTIONAL and therefore it is ok to check for NULL
|
|
5515
5485
|
let running = lanes?.running ?? 0;
|
|
@@ -5883,10 +5853,9 @@ async function passHeld(board, world, now, yieldsToPresses = true) {
|
|
|
5883
5853
|
}
|
|
5884
5854
|
// NULL-OK: field forcedBy is OPTIONAL and therefore it is ok to check for NULL
|
|
5885
5855
|
const forcer = e.forcedBy ?? "an unrecorded presser's";
|
|
5886
|
-
// NULL-OK: field
|
|
5887
|
-
const forced = e.forced === true &&
|
|
5888
|
-
|
|
5889
|
-
const forcedPast = halted !== undefined ? "the queue's ⏸ Stop" : "AUTO START being off";
|
|
5856
|
+
// NULL-OK: field unscheduled is OPTIONAL and therefore it is ok to check for NULL
|
|
5857
|
+
const forced = e.forced === true && unscheduled !== undefined;
|
|
5858
|
+
const forcedPast = "AUTO START being off";
|
|
5890
5859
|
const full = laneHeld(e);
|
|
5891
5860
|
// NULL-OK: field full is OPTIONAL and therefore it is ok to check for NULL
|
|
5892
5861
|
if (full !== undefined) {
|
|
@@ -6090,8 +6059,6 @@ export class StoryPressRefused extends Error {
|
|
|
6090
6059
|
function forceAhead(board, store, storyId, now, by, wasInLine = false) {
|
|
6091
6060
|
if (by === HIS_PRESS) {
|
|
6092
6061
|
store.presses = { ...store.presses, [String(storyId)]: { at: now, by: "press", forced: now } };
|
|
6093
|
-
if (store.removed !== undefined)
|
|
6094
|
-
delete store.removed[String(storyId)];
|
|
6095
6062
|
}
|
|
6096
6063
|
else
|
|
6097
6064
|
store.forcesAhead = { ...store.forcesAhead, [String(storyId)]: { at: now, by } };
|
|
@@ -6100,7 +6067,7 @@ function forceAhead(board, store, storyId, now, by, wasInLine = false) {
|
|
|
6100
6067
|
}
|
|
6101
6068
|
/**
|
|
6102
6069
|
* 🔴 #4595 — HIS START PRESS, MADE ON FLEETVIEW DIRECTLY: kept on the queue's store by story, so every pass derives the story's request from it
|
|
6103
|
-
* while the story is OUTSTANDING on the board — with AUTO START off too
|
|
6070
|
+
* while the story is OUTSTANDING on the board — with AUTO START off too. `top` asks for the
|
|
6104
6071
|
* first place in line, `forced` for a ⚡ Force start riding on it. Never refused because the queue is driven: recorded beside the queue
|
|
6105
6072
|
* for the pass that holds its lock. Answers what it did, in words.
|
|
6106
6073
|
*/
|
|
@@ -6126,8 +6093,6 @@ function startHeld(board, storyId, at, start) {
|
|
|
6126
6093
|
const store = readQueueStore(board);
|
|
6127
6094
|
const key = String(storyId);
|
|
6128
6095
|
store.presses = { ...store.presses, [key]: { at, ...start } };
|
|
6129
|
-
if (store.removed !== undefined)
|
|
6130
|
-
delete store.removed[key];
|
|
6131
6096
|
if (store.pressRefused !== undefined)
|
|
6132
6097
|
delete store.pressRefused[key];
|
|
6133
6098
|
writeStore(board, store);
|
|
@@ -6136,9 +6101,8 @@ function startHeld(board, storyId, at, start) {
|
|
|
6136
6101
|
: `#${storyId}'s ⚡ Force start starts it on FleetView's next pass, past this workspace's lane limit, pausing the running story with the least progress`;
|
|
6137
6102
|
}
|
|
6138
6103
|
/**
|
|
6139
|
-
* 🔴 #4156 — HIS PRESS ON ONE STORY OF FLEETVIEW'S QUEUE, under the queue's lock:
|
|
6140
|
-
* next
|
|
6141
|
-
* it on the next pass past a ⏸ Stop, and 🔔 Nudge ends the wait it stands on (a retry's backoff, a parked worker's wake delay). A press
|
|
6104
|
+
* 🔴 #4156 — HIS PRESS ON ONE STORY OF FLEETVIEW'S QUEUE, under the queue's lock: ⚡ Force start starts
|
|
6105
|
+
* it on the next pass past the lane limit, 🛑 Stop worker asks its worker to stop, and ⛔ Kill ends its worker. A press
|
|
6142
6106
|
* that does not apply throws
|
|
6143
6107
|
* {@link StoryPressRefused}; one on a story not in line throws {@link NotInQueue}, except 🔴 #4522 a ⚡ Force start, which takes in the board's standing request or keeps the force for the request to come. Answers what it did, in words.
|
|
6144
6108
|
*/
|
|
@@ -6160,7 +6124,7 @@ export async function pressStory(board, storyId, press, now, by, requestHandledB
|
|
|
6160
6124
|
}
|
|
6161
6125
|
}
|
|
6162
6126
|
/**
|
|
6163
|
-
* 🔴 #4761 — HIS PRESS ON SEVERAL STORIES OF ONE BOARD AS ONE OPERATION: every story is pressed under ONE hold of the queue's lock, so a hundred
|
|
6127
|
+
* 🔴 #4761 — HIS PRESS ON SEVERAL STORIES OF ONE BOARD AS ONE OPERATION: every story is pressed under ONE hold of the queue's lock, so a hundred presses cost one wait and one pass of the disk, never a hundred waits behind the queue's pass.
|
|
6164
6128
|
* Another driver holding the lock records every press beside the queue and takes them in together, once. Answers each story's own words, a refusal as `ok: false`.
|
|
6165
6129
|
*/
|
|
6166
6130
|
export async function pressStories(board, ids, press, now, by) {
|
|
@@ -6202,7 +6166,7 @@ export async function pressStories(board, ids, press, now, by) {
|
|
|
6202
6166
|
}
|
|
6203
6167
|
}
|
|
6204
6168
|
/** 🔴 #4592 — how a press reads in the words that tell him it was recorded for the driver. */
|
|
6205
|
-
const PRESS_LABEL = {
|
|
6169
|
+
const PRESS_LABEL = { force: "⚡ Force start", stop: "🛑 Stop worker", kill: "⛔ Kill" };
|
|
6206
6170
|
/** 🔴 #4592 — the one look a recorded press takes at the lock before it answers: the holder may have let go meanwhile, so it is taken in at once and answered as a direct press answers; never a second wait in line behind it. */
|
|
6207
6171
|
async function handedToDriver(board, name, now, said) {
|
|
6208
6172
|
try {
|
|
@@ -6221,61 +6185,6 @@ async function handedToDriver(board, name, now, said) {
|
|
|
6221
6185
|
}
|
|
6222
6186
|
return said;
|
|
6223
6187
|
}
|
|
6224
|
-
export function shiftedTogether(pending, moved, delta) {
|
|
6225
|
-
const out = pending.slice();
|
|
6226
|
-
const up = delta < 0;
|
|
6227
|
-
for (let step = 0; step < Math.abs(delta) && step < out.length; step++) {
|
|
6228
|
-
let changed = false;
|
|
6229
|
-
const walk = up ? out.map((_, i) => i) : out.map((_, i) => out.length - 1 - i);
|
|
6230
|
-
for (const i of walk) {
|
|
6231
|
-
const j = up ? i - 1 : i + 1;
|
|
6232
|
-
if (moved.has(out[i]) && j >= 0 && j < out.length && !moved.has(out[j])) {
|
|
6233
|
-
[out[i], out[j]] = [out[j], out[i]];
|
|
6234
|
-
changed = true;
|
|
6235
|
-
}
|
|
6236
|
-
}
|
|
6237
|
-
if (!changed)
|
|
6238
|
-
break;
|
|
6239
|
-
}
|
|
6240
|
-
return out;
|
|
6241
|
-
}
|
|
6242
|
-
export function droppedBefore(pending, moved, anchor) {
|
|
6243
|
-
if (anchor !== undefined && (!pending.includes(anchor) || moved.has(anchor)))
|
|
6244
|
-
throw new StoryPressRefused(`${String(anchor)} is not a waiting row that stays where it is, so nothing was dropped before it`);
|
|
6245
|
-
const rest = pending.filter((id) => !moved.has(id));
|
|
6246
|
-
const at = anchor === undefined ? rest.length : rest.indexOf(anchor);
|
|
6247
|
-
return [...rest.slice(0, at), ...pending.filter((id) => moved.has(id)), ...rest.slice(at)];
|
|
6248
|
-
}
|
|
6249
|
-
/** The row a drop lands before, as a waiting row: a row that already started, drawn above the waiting ones, stands for the first waiting row drawn after it, so a drop at the very top of the strip puts the rows first in line. */
|
|
6250
|
-
function firstWaitingFrom(anchor, drawn, waiting, moved) {
|
|
6251
|
-
if (anchor === undefined || waiting.includes(anchor) || drawn === undefined || !drawn.includes(anchor))
|
|
6252
|
-
return anchor;
|
|
6253
|
-
return drawn.slice(drawn.indexOf(anchor)).find((id) => waiting.includes(id) && !moved.has(id));
|
|
6254
|
-
}
|
|
6255
|
-
/** 🔴 #4592 — what a move decides over the waiting stories: the new order and the stories he moved. */
|
|
6256
|
-
function movedLine(m) {
|
|
6257
|
-
const moved = new Set(m.ids);
|
|
6258
|
-
return (waiting) => ({ next: "delta" in m.how ? shiftedTogether(waiting, moved, m.how.delta) : droppedBefore(waiting, moved, firstWaitingFrom(m.how.before ?? undefined, m.visible, waiting, moved)), moved });
|
|
6259
|
-
}
|
|
6260
|
-
const movedLineWords = (ids, line) => ids.map((id) => `#${id} is now ${line.indexOf(id) + 1} of ${line.length} in FleetView's story queue`).join(" | ");
|
|
6261
|
-
/**
|
|
6262
|
-
* 🔴 #4592 — HIS MOVE OF WAITING STORIES, never refused because the queue is driven: made under the lock when it is free, and
|
|
6263
|
-
* otherwise recorded beside the queue for the pass that holds it to make before it lets go (or the next one).
|
|
6264
|
-
*/
|
|
6265
|
-
export async function moveStories(board, ids, how, visible, by, now) {
|
|
6266
|
-
const move = { ids: [...ids], how, ...(visible === undefined ? {} : { visible: [...visible] }) };
|
|
6267
|
-
try {
|
|
6268
|
-
return movedLineWords(ids, await placeWaiting(board, now, by, movedLine(move), visible));
|
|
6269
|
-
}
|
|
6270
|
-
catch (err) {
|
|
6271
|
-
if (!(err instanceof QueueBusy))
|
|
6272
|
-
throw err;
|
|
6273
|
-
// OWNER: ITER/LOOP — another driver holds the queue's lock for its pass: his move is recorded beside the queue and the pass that holds the lock makes it before it lets go (or the next pass does) — never refused.
|
|
6274
|
-
const name = `move-${now}-${Math.random().toString(36).slice(2, 8)}`;
|
|
6275
|
-
writeWhole(board, pressFile(board, name), { press: "move", at: now, by, move });
|
|
6276
|
-
return handedToDriver(board, name, now, `the move of ${ids.map((id) => `#${id}`).join(", ")} is recorded — ${err.message}, and the queue's pass makes it — the pass holding the queue now before it lets go, or the next one`);
|
|
6277
|
-
}
|
|
6278
|
-
}
|
|
6279
6188
|
const pressDir = (board) => path.join(storyQueueDir(board), "presses");
|
|
6280
6189
|
const pressFile = (board, name) => path.join(pressDir(board), `${name}.json`);
|
|
6281
6190
|
/** 🔴 #4529/#4592 — the presses recorded while another driver held the queue's lock: `<story>.<press>`, a move's `move-…`, and the bare `<story>` an older build wrote for a ⚡ Force start. */
|
|
@@ -6283,6 +6192,7 @@ function pendingPresses(board) {
|
|
|
6283
6192
|
const dir = pressDir(board);
|
|
6284
6193
|
if (!fs.existsSync(dir))
|
|
6285
6194
|
return [];
|
|
6195
|
+
// 🔴 #4799 — the record names of the deleted presses (✕ Remove, ↻ Retry, 🔔 Nudge, a move) are still matched, so an old record is answered "not a press this queue knows" and let go, never left in the folder
|
|
6286
6196
|
return fs.readdirSync(dir).filter((f) => /^(\d+(\.(force|remove|retry|nudge|stop|kill|start))?|move-[\w-]+)\.json$/.test(f)).map((f) => f.slice(0, -".json".length));
|
|
6287
6197
|
}
|
|
6288
6198
|
/**
|
|
@@ -6326,23 +6236,14 @@ async function takePendingPresses(board, now) {
|
|
|
6326
6236
|
continue;
|
|
6327
6237
|
}
|
|
6328
6238
|
const press = pending.press;
|
|
6329
|
-
if (typeof pending.by !== "string" || typeof pending.at !== "number" || (press !== "
|
|
6239
|
+
if (typeof pending.by !== "string" || typeof pending.at !== "number" || (press !== "start" && !(press !== undefined && Object.prototype.hasOwnProperty.call(PRESS_LABEL, press)))) {
|
|
6330
6240
|
answered.set(name, new StoryPressRefused(`the recorded press ${name} is not a press this queue knows, so it was dropped`));
|
|
6331
6241
|
release();
|
|
6332
6242
|
continue;
|
|
6333
6243
|
}
|
|
6334
6244
|
const by = pending.by;
|
|
6335
|
-
// a move is not idempotent: its record is let go before it is made, so a failed release can never make it twice
|
|
6336
|
-
if (press === "move")
|
|
6337
|
-
release();
|
|
6338
6245
|
try {
|
|
6339
|
-
if (press === "
|
|
6340
|
-
// NULL-OK: field move is OPTIONAL and therefore it is ok to check for NULL
|
|
6341
|
-
if (pending.move === undefined)
|
|
6342
|
-
throw new StoryPressRefused(`the recorded move ${name} names no stories, so it was dropped`);
|
|
6343
|
-
answered.set(name, movedLineWords(pending.move.ids, placeWaitingHeld(board, now, by, movedLine(pending.move), pending.move.visible)));
|
|
6344
|
-
}
|
|
6345
|
-
else if (press === "start") {
|
|
6246
|
+
if (press === "start") {
|
|
6346
6247
|
// NULL-OK: field start is OPTIONAL and therefore it is ok to check for NULL
|
|
6347
6248
|
if (pending.start === undefined)
|
|
6348
6249
|
throw new StoryPressRefused(`the recorded Start press ${name} names no start, so it was dropped`);
|
|
@@ -6362,8 +6263,8 @@ async function takePendingPresses(board, now) {
|
|
|
6362
6263
|
// OWNER: ITER/LOOP — the recorded press does not apply (the story is not in line, or is at work, or the board says it is not to be started): its words are kept on the story's entry and returned as the refusal; the next record is pressed.
|
|
6363
6264
|
answered.set(name, err);
|
|
6364
6265
|
const store = readQueueStore(board);
|
|
6365
|
-
const hit =
|
|
6366
|
-
const label = press === "
|
|
6266
|
+
const hit = [id];
|
|
6267
|
+
const label = press === "start" ? "Start press" : PRESS_LABEL[press];
|
|
6367
6268
|
let wrote = false;
|
|
6368
6269
|
for (const e of store.entries.filter((x) => hit.includes(x.storyId) && IN_LINE.has(x.state))) {
|
|
6369
6270
|
step(e, now, "updated", `${by} ${label}, recorded while another driver held the queue, was not applied — ${err.message}`);
|
|
@@ -6386,86 +6287,27 @@ async function pressHeld(board, storyId, press, now, by, requestHandledByOwner =
|
|
|
6386
6287
|
if (e === undefined) {
|
|
6387
6288
|
const left = store.entries.find((x) => x.storyId === storyId);
|
|
6388
6289
|
// NULL-OK: field left is OPTIONAL and therefore it is ok to check for NULL
|
|
6389
|
-
// 🔴 #4761 — a
|
|
6390
|
-
|
|
6391
|
-
if (press === "force" && (left === undefined || putBack(left)))
|
|
6290
|
+
// 🔴 #4761/#4799 — a ⚡ Force start on a story no lane works (none ever did, its 🛑 Stop, AUTO START off, or a start no lane took) is kept and started by the next pass; one the board says is not to be started stays refused
|
|
6291
|
+
if (press === "force" && (left === undefined || left.state === "withdrawn" || left.state === "done"))
|
|
6392
6292
|
return forceAhead(board, store, storyId, eventAt, by, left !== undefined);
|
|
6393
|
-
// 🔴 #4761 — ↻ Retry on a story that left the line (his ✕ Remove, AUTO START off) puts it back in line as his Start press does, never "nothing was done"
|
|
6394
|
-
if (press === "retry" && putBack(left))
|
|
6395
|
-
return startHeld(board, storyId, eventAt, { by: "press" });
|
|
6396
6293
|
throw new NotInQueue(board, storyId, left);
|
|
6397
6294
|
}
|
|
6398
6295
|
const working = e.state === "starting" || e.state === "running";
|
|
6399
|
-
// NULL-OK: field stopped is OPTIONAL and therefore it is ok to check for NULL
|
|
6400
|
-
const afterStop = store.stopped === undefined ? "" : " after ▶ Run lifts the queue's ⏸ Stop";
|
|
6401
6296
|
let did;
|
|
6402
|
-
|
|
6403
|
-
const held = autoStartHeld(board);
|
|
6404
|
-
// NULL-OK: field held is OPTIONAL and therefore it is ok to check for NULL
|
|
6405
|
-
if (held !== undefined && !hisOwn(e))
|
|
6406
|
-
throw new StoryPressRefused(`#${storyId}: ${held} — ${verb} starts and wakes nothing on its own`);
|
|
6407
|
-
};
|
|
6408
|
-
if (press === "remove") {
|
|
6409
|
-
// 🔴 #4592 — ✕ Remove is unconditional: a worker at work is told to stop (⛔ Kill's own record, whose delivery the pass keeps asking for) and the row leaves the line in the same press, never a refusal
|
|
6410
|
-
if (working && e.worker !== undefined) {
|
|
6411
|
-
let told = "its worker could not be told to stop";
|
|
6412
|
-
try {
|
|
6413
|
-
told = await pressHeld(board, storyId, "kill", now, by, requestHandledByOwner, ownerAction, eventAt);
|
|
6414
|
-
}
|
|
6415
|
-
catch (err) {
|
|
6416
|
-
if (!(err instanceof StoryPressRefused))
|
|
6417
|
-
throw err;
|
|
6418
|
-
// OWNER: ITER/LOOP — the worker's stop did not apply as it stands (one already asked, or none to ask): the row still leaves the line, and the stop's words go on the answer.
|
|
6419
|
-
told = err.message;
|
|
6420
|
-
}
|
|
6421
|
-
const fresh = readQueueStore(board);
|
|
6422
|
-
const gone = fresh.entries.find((x) => x.storyId === storyId && IN_LINE.has(x.state));
|
|
6423
|
-
// NULL-OK: field gone is OPTIONAL and therefore it is ok to check for NULL
|
|
6424
|
-
if (gone !== undefined) {
|
|
6425
|
-
gone.state = "withdrawn";
|
|
6426
|
-
gone.pressSpent = true;
|
|
6427
|
-
delete gone.forced;
|
|
6428
|
-
delete gone.forcedBy;
|
|
6429
|
-
delete gone.forceOrder;
|
|
6430
|
-
gone.why = `${by} ✕ Remove took it out of the line with its worker at work — his Start press puts it back`;
|
|
6431
|
-
gone.requestId = `withdrawn-${now}`;
|
|
6432
|
-
step(gone, now, "withdrawn", gone.why);
|
|
6433
|
-
removedFromLine(fresh, storyId, eventAt, by);
|
|
6434
|
-
writeStore(board, fresh);
|
|
6435
|
-
}
|
|
6436
|
-
return `#${storyId} is out of the line — ${told}`;
|
|
6437
|
-
}
|
|
6438
|
-
e.state = "withdrawn";
|
|
6439
|
-
e.pressSpent = true;
|
|
6440
|
-
delete e.forced;
|
|
6441
|
-
delete e.forcedBy;
|
|
6442
|
-
delete e.forceOrder;
|
|
6443
|
-
e.why = `${by} ✕ Remove took it out of the line — his Start press puts it back`;
|
|
6444
|
-
e.requestId = `withdrawn-${now}`;
|
|
6445
|
-
step(e, now, "withdrawn", e.why);
|
|
6446
|
-
removedFromLine(store, storyId, eventAt, by);
|
|
6447
|
-
did = `#${storyId} is out of the line`;
|
|
6448
|
-
}
|
|
6449
|
-
else if (press === "retry") {
|
|
6450
|
-
if (e.state !== "failed" && e.state !== "retrying")
|
|
6451
|
-
throw new StoryPressRefused(`#${storyId} is ${e.state}, and ↻ Retry puts back only a failed or retrying story`);
|
|
6452
|
-
startsNothingOnItsOwn("↻ Retry");
|
|
6453
|
-
e.state = "queued";
|
|
6454
|
-
e.attempts = 0;
|
|
6455
|
-
delete e.neverRecorded;
|
|
6456
|
-
delete e.stoppedStarts;
|
|
6457
|
-
delete e.wedgeGives;
|
|
6458
|
-
delete e.accountRefused;
|
|
6459
|
-
delete e.accountRefusals;
|
|
6460
|
-
delete e.nextTryAt;
|
|
6461
|
-
e.why = `${by} ↻ Retry put it back in line with its attempts reset`;
|
|
6462
|
-
step(e, now, "retry", e.why);
|
|
6463
|
-
did = `#${storyId} is back in line`;
|
|
6464
|
-
}
|
|
6465
|
-
else if (press === "force") {
|
|
6297
|
+
if (press === "force") {
|
|
6466
6298
|
if (working)
|
|
6467
6299
|
throw new StoryPressRefused(`#${storyId} already has a worker at work, so there is nothing to force`);
|
|
6468
|
-
|
|
6300
|
+
// 🔴 #4799 — the force is kept beside the row as forceAhead keeps it, so the next pass derives an eligible request from it whatever AUTO START says: a row still in line under AUTO START off is never withdrawn with the force on it.
|
|
6301
|
+
// His rides on his Start press (applyRequest sees it already applied: no second force); an agent's waits in forcesAhead, whose ahead block forces the row as the agent's.
|
|
6302
|
+
const key = String(storyId);
|
|
6303
|
+
if (by === HIS_PRESS) {
|
|
6304
|
+
forceEntry(e, now, by, eventAt);
|
|
6305
|
+
// 🔴 #4762 — a fresh press: his ⚡ is a newer press than the one his worker spent, so AUTO START off never reads it as spent
|
|
6306
|
+
// NULL-OK: field presses is OPTIONAL and therefore it is ok to check for NULL
|
|
6307
|
+
store.presses = { ...store.presses, [key]: { ...store.presses?.[key], at: eventAt, by: "press", forced: eventAt } };
|
|
6308
|
+
}
|
|
6309
|
+
else
|
|
6310
|
+
store.forcesAhead = { ...store.forcesAhead, [key]: { at: eventAt, by } };
|
|
6469
6311
|
did = `#${storyId} starts on the next pass, past this workspace's lane limit, pausing the running story with the least progress`;
|
|
6470
6312
|
}
|
|
6471
6313
|
else if (press === "stop" || press === "kill") {
|
|
@@ -6484,29 +6326,6 @@ async function pressHeld(board, storyId, press, now, by, requestHandledByOwner =
|
|
|
6484
6326
|
step(e, now, "stop-asked", e.why);
|
|
6485
6327
|
did = told.did;
|
|
6486
6328
|
}
|
|
6487
|
-
else if (press === "nudge") {
|
|
6488
|
-
startsNothingOnItsOwn("🔔 Nudge");
|
|
6489
|
-
const parked = working || parkedInLine(e) ? e.worker : undefined;
|
|
6490
|
-
// NULL-OK: field parkedAt is OPTIONAL and therefore it is ok to check for NULL
|
|
6491
|
-
if (parked?.parkedAt !== undefined) {
|
|
6492
|
-
const killed = killedInLine(e);
|
|
6493
|
-
parked.parkedAt = now - wakeDelayMs(parked.wakes ?? 0);
|
|
6494
|
-
if (killed)
|
|
6495
|
-
parked.killedAt = parked.parkedAt;
|
|
6496
|
-
e.why = `${by} 🔔 Nudge ended its parked worker ${parked.jobId}'s wake delay, so it is woken on the next pass${afterStop}`;
|
|
6497
|
-
did = `#${storyId}'s worker is woken on the next pass${afterStop}`;
|
|
6498
|
-
// NULL-OK: field nextTryAt is OPTIONAL and therefore it is ok to check for NULL
|
|
6499
|
-
}
|
|
6500
|
-
else if (e.nextTryAt !== undefined && e.nextTryAt > now) {
|
|
6501
|
-
e.nextTryAt = now;
|
|
6502
|
-
e.why = `${by} 🔔 Nudge ended its wait, so it is tried on the next pass${afterStop}`;
|
|
6503
|
-
did = `#${storyId} is tried on the next pass${afterStop}`;
|
|
6504
|
-
}
|
|
6505
|
-
else {
|
|
6506
|
-
throw new StoryPressRefused(`#${storyId} waits on nothing a nudge ends — it reads: ${e.why}${e.state === "queued" ? "; ⚡ Force start runs it past a ⏸ Stop" : ""}`);
|
|
6507
|
-
}
|
|
6508
|
-
step(e, now, "retry", e.why);
|
|
6509
|
-
}
|
|
6510
6329
|
else {
|
|
6511
6330
|
throw new StoryPressRefused(`${String(press)} is not a press FleetView's queue knows; #${storyId} reads: ${e.why}`);
|
|
6512
6331
|
}
|
|
@@ -6514,13 +6333,6 @@ async function pressHeld(board, storyId, press, now, by, requestHandledByOwner =
|
|
|
6514
6333
|
return did;
|
|
6515
6334
|
}
|
|
6516
6335
|
}
|
|
6517
|
-
/** 🔴 #4595 — his ✕ Remove keeps the story out of the line: his Start press on it is spent, and AUTO START never takes it back in until his next Start press or his AUTO START turned on. */
|
|
6518
|
-
function removedFromLine(store, storyId, at, by) {
|
|
6519
|
-
const key = String(storyId);
|
|
6520
|
-
if (store.presses !== undefined)
|
|
6521
|
-
delete store.presses[key];
|
|
6522
|
-
store.removed = { ...store.removed, [key]: { at, by } };
|
|
6523
|
-
}
|
|
6524
6336
|
/** 🔴 #4595 — why this board's AUTO START holds every story but his presses — off, or its choice in the workspace's fv.json unreadable — or undefined while it is on. */
|
|
6525
6337
|
export function autoStartHeld(board) {
|
|
6526
6338
|
const hold = "so only his Start press or ⚡ Force start starts or wakes a story";
|
|
@@ -6567,81 +6379,6 @@ function pressedFor(e) {
|
|
|
6567
6379
|
// NULL-OK: field landedAt is OPTIONAL and therefore it is ok to check for NULL
|
|
6568
6380
|
return e.startPressedAt > (e.landedAt ?? e.worker?.startedAt ?? -Infinity);
|
|
6569
6381
|
}
|
|
6570
|
-
/** 🔴 #4156 — his ▶ Run or ⏸ Stop on the board's queue: stopped, nothing more starts or wakes until he runs it again; workers already running carry on. Answers whether it changed. */
|
|
6571
|
-
export async function setStoryQueueStopped(board, stopped, by, now, author = "caller") {
|
|
6572
|
-
return withQueueLock(board, now, async () => {
|
|
6573
|
-
const store = readQueueStore(board);
|
|
6574
|
-
// NULL-OK: field stopped is OPTIONAL and therefore it is ok to check for NULL
|
|
6575
|
-
if ((store.stopped !== undefined) === stopped)
|
|
6576
|
-
return false;
|
|
6577
|
-
if (stopped)
|
|
6578
|
-
store.stopped = { at: now, by, author };
|
|
6579
|
-
else {
|
|
6580
|
-
store.lifted = { at: now, by, stoppedBy: store.stopped.by, stoppedAuthor: store.stopped.author };
|
|
6581
|
-
delete store.stopped;
|
|
6582
|
-
}
|
|
6583
|
-
writeStore(board, store);
|
|
6584
|
-
return true;
|
|
6585
|
-
});
|
|
6586
|
-
}
|
|
6587
|
-
/** His placement of one story in FleetView's queue: a 0-based place, or `auto` to hand it back to priority and size. */
|
|
6588
|
-
export async function placeStory(board, storyId, place, now, by) {
|
|
6589
|
-
return withQueueLock(board, now, async () => {
|
|
6590
|
-
const store = readQueueStore(board);
|
|
6591
|
-
const e = store.entries.find((x) => x.storyId === storyId && IN_LINE.has(x.state));
|
|
6592
|
-
if (e === undefined)
|
|
6593
|
-
throw new NotInQueue(board, storyId, store.entries.find((x) => x.storyId === storyId));
|
|
6594
|
-
if (place === "auto") {
|
|
6595
|
-
delete e.manual;
|
|
6596
|
-
delete e.ordered;
|
|
6597
|
-
delete e.hisPlace;
|
|
6598
|
-
delete e.killStamp;
|
|
6599
|
-
}
|
|
6600
|
-
else
|
|
6601
|
-
placeAt(store, e, Math.max(0, place - store.entries.filter((x) => IN_LINE.has(x.state) && !WAITING_STATES.has(x.state)).length));
|
|
6602
|
-
step(e, now, "placed", place === "auto" ? `${by} move handed it back to priority and size` : `${by} move put it at place ${place + 1}`);
|
|
6603
|
-
writeStore(board, store);
|
|
6604
|
-
return e;
|
|
6605
|
-
});
|
|
6606
|
-
}
|
|
6607
|
-
/**
|
|
6608
|
-
* 🔴 #4354 — HIS MOVE OF ONE OR SEVERAL WAITING STORIES, ATOMIC AND MINIMAL: under ONE lock the line is read, `decide` is handed the waiting
|
|
6609
|
-
* stories (the ones named in `visible` when given) in their order and answers the new order and which stories moved, and the store is
|
|
6610
|
-
* written ONCE with each moved story, and each story he placed before, put at the place it holds in the new line — so a queue pass never
|
|
6611
|
-
* reads half a move, and a story that arrives later still sorts by priority and size around the places he pinned. Throws {@link NotInQueue}
|
|
6612
|
-
* for a story the line does not wait on; a move that changes nothing writes nothing; answers the new waiting order.
|
|
6613
|
-
*/
|
|
6614
|
-
export async function placeWaiting(board, now, by, decide, visible) {
|
|
6615
|
-
return withQueueLock(board, now, async () => placeWaitingHeld(board, now, by, decide, visible));
|
|
6616
|
-
}
|
|
6617
|
-
/** {@link placeWaiting}'s move, run by a caller that already holds the queue's lock. */
|
|
6618
|
-
function placeWaitingHeld(board, now, by, decide, visible) {
|
|
6619
|
-
{
|
|
6620
|
-
const store = readQueueStore(board);
|
|
6621
|
-
const line = queueOrder(store).filter((e) => WAITING_STATES.has(e.state));
|
|
6622
|
-
const waiting = line.filter((e) => visible === undefined || visible.includes(e.storyId)).map((e) => e.storyId);
|
|
6623
|
-
const { next, moved } = decide(waiting);
|
|
6624
|
-
for (const id of moved)
|
|
6625
|
-
if (!waiting.includes(id))
|
|
6626
|
-
throw new NotInQueue(board, id, store.entries.find((x) => x.storyId === id));
|
|
6627
|
-
if (next.join() === waiting.join())
|
|
6628
|
-
return waiting;
|
|
6629
|
-
const refill = next.slice();
|
|
6630
|
-
const ordered = line.map((e) => (waiting.includes(e.storyId) ? refill.shift() : e.storyId));
|
|
6631
|
-
stampOrder(ordered.map((id) => line.find((e) => e.storyId === id)));
|
|
6632
|
-
for (const e of line)
|
|
6633
|
-
if (killedInLine(e) && e.hisPlace !== true && !moved.has(e.storyId))
|
|
6634
|
-
e.killStamp = e.worker.killedAt;
|
|
6635
|
-
else
|
|
6636
|
-
delete e.killStamp;
|
|
6637
|
-
for (const id of moved)
|
|
6638
|
-
line.find((e) => e.storyId === id).hisPlace = true;
|
|
6639
|
-
for (const id of moved)
|
|
6640
|
-
step(line.find((e) => e.storyId === id), now, "placed", `${by} move put it at place ${ordered.indexOf(id) + 1}`);
|
|
6641
|
-
writeStore(board, store);
|
|
6642
|
-
return queueOrder(store).filter((e) => waiting.includes(e.storyId)).map((e) => e.storyId);
|
|
6643
|
-
}
|
|
6644
|
-
}
|
|
6645
6382
|
/** 🔴 #4154 — FleetView's investigator ruled ABORT on the worker `jobId` of this story: its entry leaves the line, so the stopped worker is never woken, and his next Start press brings the story back; undefined when no entry in line runs that worker. */
|
|
6646
6383
|
export async function withdrawStory(board, storyId, jobId, why, now) {
|
|
6647
6384
|
return withQueueLock(board, now, async () => {
|
|
@@ -1171,14 +1171,28 @@ function identitiesHere() {
|
|
|
1171
1171
|
* @returns {{ identityId: string, named: string, model: string, env: Record<string, string>, modelRefusalId?: string }}
|
|
1172
1172
|
*/
|
|
1173
1173
|
function opencodeRoute(home, wanted, now = Date.now(), identities = identitiesHere()) {
|
|
1174
|
-
const passed = [];
|
|
1175
1174
|
const byok = readOpencodeRoute(home) === "byok";
|
|
1175
|
+
const route = (asked) => {
|
|
1176
|
+
const passed = [];
|
|
1177
|
+
if (byok)
|
|
1178
|
+
return opencodeKeyRoute(home, asked, now, identities, passed);
|
|
1179
|
+
return opencodeFreeRoute(home, asked, now, passed) ?? opencodeKeyRoute(home, asked, now, identities, passed);
|
|
1180
|
+
};
|
|
1181
|
+
if (wanted !== undefined)
|
|
1182
|
+
return route(wanted);
|
|
1176
1183
|
const picked = readOpencodeModel(home) || undefined;
|
|
1177
1184
|
const fits = picked !== undefined && !(byok && splitWanted(picked).asked === OPENCODE_PROVIDER);
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1185
|
+
if (fits) {
|
|
1186
|
+
try {
|
|
1187
|
+
return route(picked);
|
|
1188
|
+
}
|
|
1189
|
+
catch (cause) {
|
|
1190
|
+
// OWNER: the launch owns a saved default it cannot use — try the current route's default; explicit launch arguments stay exact
|
|
1191
|
+
if (!(cause instanceof NoOpenCodeKey))
|
|
1192
|
+
throw cause;
|
|
1193
|
+
}
|
|
1194
|
+
}
|
|
1195
|
+
return route(undefined);
|
|
1182
1196
|
}
|
|
1183
1197
|
function opencodeStoreEnv(home) {
|
|
1184
1198
|
const store = path.join(home, ".bullseye", "opencode");
|
|
@@ -1186,7 +1200,9 @@ function opencodeStoreEnv(home) {
|
|
|
1186
1200
|
}
|
|
1187
1201
|
function splitWanted(wanted) {
|
|
1188
1202
|
const cut = wanted === undefined ? -1 : wanted.indexOf("/");
|
|
1189
|
-
|
|
1203
|
+
const prefix = cut === -1 ? undefined : wanted.slice(0, cut);
|
|
1204
|
+
const qualified = prefix === OPENCODE_PROVIDER || Object.values(OPENCODE_KEY_KINDS).some((kind) => kind.provider === prefix);
|
|
1205
|
+
return qualified ? { asked: prefix, bare: wanted.slice(cut + 1) } : { asked: undefined, bare: wanted };
|
|
1190
1206
|
}
|
|
1191
1207
|
/**
|
|
1192
1208
|
* OpenCode's free tier as every surface reads it — the route, DeepAgent's panel row and provider_room: the free models its catalogue names, the ones with no fresh failure, each failed one with why, and why the whole tier is passed over when it is.
|
|
@@ -1259,14 +1275,16 @@ const OPENCODE_KEY_REFUSAL_TYPES = Object.freeze(new Set(["provider.auth", "prov
|
|
|
1259
1275
|
/**
|
|
1260
1276
|
* An error OpenCode reported in one of its JSON events, read once for every reader — BN, the shared OpenCodeTurn and DeepAgent's Test: the provider's own message,
|
|
1261
1277
|
* its HTTP status when it sent one, whether it refused the key or account, and the line every surface shows.
|
|
1262
|
-
* @param {{ name?: string, data?: { message?: string, statusCode?: number } } | undefined} error
|
|
1278
|
+
* @param {{ type?: string, message?: string, status?: number, name?: string, data?: { message?: string, statusCode?: number } } | undefined} error
|
|
1263
1279
|
* @returns {{ message: string, status: number | undefined, keyRefusal: boolean, said: string }}
|
|
1264
1280
|
*/
|
|
1265
1281
|
function opencodeEventError(error) {
|
|
1266
1282
|
const data = error?.data ?? {};
|
|
1267
|
-
const
|
|
1268
|
-
const
|
|
1269
|
-
|
|
1283
|
+
const type = error?.type ?? error?.name;
|
|
1284
|
+
const message = error?.message ?? data.message ?? type ?? "the CLI reported an error";
|
|
1285
|
+
const stated = error?.status ?? data.statusCode;
|
|
1286
|
+
const status = typeof stated === "number" ? stated : undefined;
|
|
1287
|
+
return { message, status, keyRefusal: (status !== undefined && OPENCODE_KEY_REFUSAL_STATUSES.has(status)) || OPENCODE_KEY_REFUSAL_WORDS.test(message) || OPENCODE_KEY_REFUSAL_TYPES.has(type), said: status === undefined ? message : `${message} (HTTP ${status})` };
|
|
1270
1288
|
}
|
|
1271
1289
|
/**
|
|
1272
1290
|
* 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):
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "omni-notify-mcp",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.483",
|
|
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",
|