cursedbelt-server 4.79.0 → 4.79.2

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.
Files changed (54) hide show
  1. package/dist/server/analytics/injectedScripts.d.ts +1 -1
  2. package/dist/server/analytics/injectedScripts.js +1 -1
  3. package/dist/server/analytics/webAnalytics.d.ts +2 -2
  4. package/dist/server/analytics/webAnalytics.js +2 -2
  5. package/dist/server/clientIssues/d1.d.ts +1 -1
  6. package/dist/server/engagement/visits.d.ts +1 -1
  7. package/dist/server/incidents/channels.d.ts +2 -2
  8. package/dist/server/incidents/channels.js +2 -2
  9. package/dist/server/incidents/index.d.ts +2 -2
  10. package/dist/server/incidents/index.js +2 -2
  11. package/dist/server/incidents/notifier.d.ts +6 -6
  12. package/dist/server/incidents/notifier.js +6 -6
  13. package/dist/server/incidents/reporter.d.ts +1 -1
  14. package/dist/server/incidents/types.d.ts +5 -5
  15. package/dist/server/incidents/types.js +2 -2
  16. package/dist/server/master-lock/accountsPage.js +2 -2
  17. package/dist/server/master-lock/attempts.js +1 -1
  18. package/dist/server/master-lock/masterLock.d.ts +2 -2
  19. package/dist/server/master-lock/masterLock.js +3 -3
  20. package/dist/server/master-lock/principals.js +1 -1
  21. package/dist/server/presence/index.d.ts +3 -2
  22. package/dist/server/presence/index.js +35 -2
  23. package/dist/server/resume/store.d.ts +1 -1
  24. package/dist/server/storage/binaryStoreFake.d.ts +1 -1
  25. package/dist/server/sync/status.d.ts +1 -1
  26. package/dist/server/youtube/ytdlp.d.ts +1 -1
  27. package/package.json +3 -3
  28. package/src/cursedopsRange.spec.ts +5 -3
  29. package/src/noTimerDialsAPeer.spec.ts +3 -3
  30. package/src/server/analytics/injectedScripts.spec.ts +1 -1
  31. package/src/server/analytics/injectedScripts.ts +1 -1
  32. package/src/server/analytics/webAnalytics.ts +2 -2
  33. package/src/server/clientIssues/d1.ts +1 -1
  34. package/src/server/engagement/engagement.spec.ts +1 -1
  35. package/src/server/engagement/visits.ts +1 -1
  36. package/src/server/incidents/channels.ts +2 -2
  37. package/src/server/incidents/index.ts +2 -2
  38. package/src/server/incidents/notifier.ts +9 -9
  39. package/src/server/incidents/reporter.ts +1 -1
  40. package/src/server/incidents/types.ts +5 -5
  41. package/src/server/master-lock/accounts.spec.ts +4 -4
  42. package/src/server/master-lock/accountsPage.spec.ts +1 -1
  43. package/src/server/master-lock/accountsPage.ts +2 -2
  44. package/src/server/master-lock/attempts.ts +1 -1
  45. package/src/server/master-lock/beaconNeverReachesTheWall.spec.ts +3 -3
  46. package/src/server/master-lock/guard.spec.ts +1 -1
  47. package/src/server/master-lock/masterLock.ts +3 -3
  48. package/src/server/master-lock/principals.spec.ts +2 -2
  49. package/src/server/master-lock/principals.ts +1 -1
  50. package/src/server/presence/index.ts +3 -2
  51. package/src/server/resume/store.ts +1 -1
  52. package/src/server/storage/binaryStoreFake.ts +1 -1
  53. package/src/server/sync/status.ts +1 -1
  54. package/src/server/youtube/ytdlp.ts +1 -1
@@ -10,7 +10,7 @@
10
10
  * the foreign scripts disappear — green. Decide a third-party script is wanted and allow its
11
11
  * host — green. Harden a page with `script-src 'self'` while something is still injecting into
12
12
  * it — RED, and it names the origin, which is the console line the owner would otherwise find
13
- * himself during an incident.
13
+ * themselves during an incident.
14
14
  *
15
15
  * ## 🔴 Why it lives in this package
16
16
  *
@@ -10,7 +10,7 @@
10
10
  * the foreign scripts disappear — green. Decide a third-party script is wanted and allow its
11
11
  * host — green. Harden a page with `script-src 'self'` while something is still injecting into
12
12
  * it — RED, and it names the origin, which is the console line the owner would otherwise find
13
- * himself during an incident.
13
+ * themselves during an incident.
14
14
  *
15
15
  * ## 🔴 Why it lives in this package
16
16
  *
@@ -11,7 +11,7 @@
11
11
  * line was that tag being refused; it broke nothing and cost an agent the first minutes of
12
12
  * the incident.
13
13
  *
14
- * His decision, 2026-09-18, in his words: *"do your recommendation with option c but not on
14
+ * The owner's decision, 2026-09-18, in their words: *"do your recommendation with option c but not on
15
15
  * the wall. If we can stop the console error that would be good since we are purposely
16
16
  * blocking on that page and it makes it look like there is a mistake when it shows."* — and,
17
17
  * on why the wall's CSP may not simply be loosened: *"I don't want to trust cloudflare with
@@ -105,7 +105,7 @@ export declare const WEB_ANALYTICS_PUBLIC_HOST = "cursedalchemy.com";
105
105
  * `apps/desk` lost 24, both asserting the console is empty, and the owner's own local console
106
106
  * would have gained a red line on every page.
107
107
  *
108
- * That is the exact cost he asked to be rid of, one environment over. So the guard: the beacon
108
+ * That is the exact cost the owner asked to be rid of, one environment over. So the guard: the beacon
109
109
  * is appended only when the page is being served from {@link WEB_ANALYTICS_PUBLIC_HOST}, which
110
110
  * is the only place it can report anyway.
111
111
  *
@@ -11,7 +11,7 @@
11
11
  * line was that tag being refused; it broke nothing and cost an agent the first minutes of
12
12
  * the incident.
13
13
  *
14
- * His decision, 2026-09-18, in his words: *"do your recommendation with option c but not on
14
+ * The owner's decision, 2026-09-18, in their words: *"do your recommendation with option c but not on
15
15
  * the wall. If we can stop the console error that would be good since we are purposely
16
16
  * blocking on that page and it makes it look like there is a mistake when it shows."* — and,
17
17
  * on why the wall's CSP may not simply be loosened: *"I don't want to trust cloudflare with
@@ -112,7 +112,7 @@ export const WEB_ANALYTICS_PUBLIC_HOST = "cursedalchemy.com";
112
112
  * `apps/desk` lost 24, both asserting the console is empty, and the owner's own local console
113
113
  * would have gained a red line on every page.
114
114
  *
115
- * That is the exact cost he asked to be rid of, one environment over. So the guard: the beacon
115
+ * That is the exact cost the owner asked to be rid of, one environment over. So the guard: the beacon
116
116
  * is appended only when the page is being served from {@link WEB_ANALYTICS_PUBLIC_HOST}, which
117
117
  * is the only place it can report anyway.
118
118
  *
@@ -5,7 +5,7 @@
5
5
  * problem a page sees (a stuck video, a failing API, an uncaught error) to {@link CLIENT_ISSUES_PATH};
6
6
  * this door writes one row per report into the app's own D1 `client_issues`, and autopilot's watch
7
7
  * reads that table to file the work. Before it, a problem reached a fix only when the owner copied
8
- * a report off his phone by hand.
8
+ * a report off the owner's phone by hand.
9
9
  *
10
10
  * ```ts
11
11
  * import { CLIENT_ISSUES_DDL, createD1ClientIssuesRecorder } from "cursedbelt-server/client-issues/d1";
@@ -8,7 +8,7 @@
8
8
  * ── What it may hold, and why this much ─────────────────────────────────────
9
9
  * `store.ts`'s header refuses a timeline of a household's private apps, and that still holds for
10
10
  * everything with a PLACE in it. A row here has no place: a visit's start, end, view count and
11
- * attention, the least that answers his question, and only for {@link ENGAGEMENT_VISIT_RETENTION_DAYS}.
11
+ * attention, the least that answers the owner's question, and only for {@link ENGAGEMENT_VISIT_RETENTION_DAYS}.
12
12
  * One row per VISIT (the same cut as the sessions count, `policy.ts:foldView`), not per beacon: 264
13
13
  * visits across the fleet in the 30 days to 2026-10-30, against "a few thousand a month" as the line.
14
14
  *
@@ -4,8 +4,8 @@
4
4
  *
5
5
  * ── The severity split is the feature ───────────────────────────────────────
6
6
  * The owner asked for "an email and a text message about blocking issues like
7
- * these (can't deploy, can't ingest files)". A warning that texts him is a
8
- * warning that gets the channel muted, and a muted channel puts him back where
7
+ * these (can't deploy, can't ingest files)". A warning that texts the owner is a
8
+ * warning that gets the channel muted, and a muted channel puts the owner back where
9
9
  * this whole unit started — finding out days later, by accident. So: in-app for
10
10
  * everything, email + text for `blocking` only, and `notifier.ts` is the only
11
11
  * place that decision is made.
@@ -4,8 +4,8 @@
4
4
  *
5
5
  * ── The severity split is the feature ───────────────────────────────────────
6
6
  * The owner asked for "an email and a text message about blocking issues like
7
- * these (can't deploy, can't ingest files)". A warning that texts him is a
8
- * warning that gets the channel muted, and a muted channel puts him back where
7
+ * these (can't deploy, can't ingest files)". A warning that texts the owner is a
8
+ * warning that gets the channel muted, and a muted channel puts the owner back where
9
9
  * this whole unit started — finding out days later, by accident. So: in-app for
10
10
  * everything, email + text for `blocking` only, and `notifier.ts` is the only
11
11
  * place that decision is made.
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * `cursedbelt-server/incidents` — the fleet's ONE owner-alert primitive: a
3
3
  * condition that is true for a while, told to the owner exactly once, and told
4
- * to him again when it clears.
4
+ * to the owner again when it clears.
5
5
  *
6
6
  * ── Why it exists (the owner, 2026-08-13) ───────────────────────────────────
7
7
  * *"I found out from an agent my collection uploads were stuck … there are
@@ -10,7 +10,7 @@
10
10
  * The incident behind it: 42 videos / 35 GB sat in the collections dropzone and
11
11
  * every scheduled ingest failed all 42 with EPIPE against binary-server, while
12
12
  * binary-server logged that it was under its 12 GB disk reserve — and the
13
- * dropzone deletes originals once they reach the catalog. Nothing told him. Two
13
+ * dropzone deletes originals once they reach the catalog. Nothing told the owner. Two
14
14
  * separate deterministic checks would each have caught it on the first run.
15
15
  *
16
16
  * ── Why it is HERE and not in `satellite-kit` ───────────────────────────────
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * `cursedbelt-server/incidents` — the fleet's ONE owner-alert primitive: a
3
3
  * condition that is true for a while, told to the owner exactly once, and told
4
- * to him again when it clears.
4
+ * to the owner again when it clears.
5
5
  *
6
6
  * ── Why it exists (the owner, 2026-08-13) ───────────────────────────────────
7
7
  * *"I found out from an agent my collection uploads were stuck … there are
@@ -10,7 +10,7 @@
10
10
  * The incident behind it: 42 videos / 35 GB sat in the collections dropzone and
11
11
  * every scheduled ingest failed all 42 with EPIPE against binary-server, while
12
12
  * binary-server logged that it was under its 12 GB disk reserve — and the
13
- * dropzone deletes originals once they reach the catalog. Nothing told him. Two
13
+ * dropzone deletes originals once they reach the catalog. Nothing told the owner. Two
14
14
  * separate deterministic checks would each have caught it on the first run.
15
15
  *
16
16
  * ── Why it is HERE and not in `satellite-kit` ───────────────────────────────
@@ -13,12 +13,12 @@
13
13
  * symptom, a command and a credential without saying what any of them are. So
14
14
  * an incident message is three sentences with fixed jobs, in this order:
15
15
  *
16
- * WHAT BROKE — in words, naming the app. Assume he does not know what
16
+ * WHAT BROKE — in words, naming the app. Assume the owner does not know what
17
17
  * your daemon, flag, tab or port is.
18
- * WHAT IT BLOCKS — what he cannot do until it is fixed. This is the sentence
18
+ * WHAT IT BLOCKS — what the owner cannot do until it is fixed. This is the sentence
19
19
  * that earns a text message at 2am; if you cannot write it,
20
20
  * the incident is a `warning`.
21
- * WHAT TO DO — a next step. A command carries its own `cd`, because he
21
+ * WHAT TO DO — a next step. A command carries its own `cd`, because the owner
22
22
  * opens terminals anywhere (`fleet/rules/
23
23
  * commands-must-run-from-anywhere.md`).
24
24
  *
@@ -50,9 +50,9 @@ export interface AnnounceResult {
50
50
  * overdue backup opened as blocking while the email channel was still
51
51
  * misconfigured, both channels failed, and — because `notifiedAt` was stamped —
52
52
  * nothing would ever have tried again. The owner would have had a blocking
53
- * incident on a board he had no reason to open. The dedupe promise is "you are
53
+ * incident on a board the owner had no reason to open. The dedupe promise is "you are
54
54
  * told ONCE", not "we attempt once": an attempt that reached nobody has not told
55
- * him anything.
55
+ * the owner anything.
56
56
  *
57
57
  * It retries at most hourly, and it STOPS the moment any channel reports
58
58
  * `delivered` — so a permanently broken channel costs one send an hour, and a
@@ -63,7 +63,7 @@ export declare const UNDELIVERED_RETRY_MS: number;
63
63
  export declare function composeOpened(incident: Incident): ChannelMessage;
64
64
  /**
65
65
  * The message for a resolve. It exists so "is it fixed?" is answered without
66
- * him having to go and look — the same reason the open message exists.
66
+ * the owner having to go and look — the same reason the open message exists.
67
67
  */
68
68
  export declare function composeResolved(incident: Incident): ChannelMessage;
69
69
  export interface CreateNotifierOptions {
@@ -6,9 +6,9 @@
6
6
  * overdue backup opened as blocking while the email channel was still
7
7
  * misconfigured, both channels failed, and — because `notifiedAt` was stamped —
8
8
  * nothing would ever have tried again. The owner would have had a blocking
9
- * incident on a board he had no reason to open. The dedupe promise is "you are
9
+ * incident on a board the owner had no reason to open. The dedupe promise is "you are
10
10
  * told ONCE", not "we attempt once": an attempt that reached nobody has not told
11
- * him anything.
11
+ * the owner anything.
12
12
  *
13
13
  * It retries at most hourly, and it STOPS the moment any channel reports
14
14
  * `delivered` — so a permanently broken channel costs one send an hour, and a
@@ -39,7 +39,7 @@ export function composeOpened(incident) {
39
39
  }
40
40
  /**
41
41
  * The message for a resolve. It exists so "is it fixed?" is answered without
42
- * him having to go and look — the same reason the open message exists.
42
+ * the owner having to go and look — the same reason the open message exists.
43
43
  */
44
44
  export function composeResolved(incident) {
45
45
  const minutes = Math.max(1, Math.round(((incident.resolvedAt ?? 0) - incident.firstSeen) / 60000));
@@ -99,8 +99,8 @@ export function createIncidentNotifier(options) {
99
99
  const result = await dispatch(incident, composeOpened(incident), transition);
100
100
  // 🔴 Only stamp `notifiedAt` when there was actually a channel to try.
101
101
  // A host with none (a prod deployment that only stores what the Mac
102
- // pushes it) has not told him anything, and stamping it there is what
103
- // made the resolve message below fire for an open he never saw.
102
+ // pushes it) has not told the owner anything, and stamping it there is what
103
+ // made the resolve message below fire for an open the owner never saw.
104
104
  if (result.results.length > 0) {
105
105
  store.markNotified([incident.fingerprint], summarise(result.results));
106
106
  }
@@ -125,7 +125,7 @@ export function createIncidentNotifier(options) {
125
125
  }
126
126
  for (const incident of t.resolved) {
127
127
  // Never announce a resolve for something whose OPEN was never
128
- // announced — the owner would get "cleared: X" for an X he has never
128
+ // announced — the owner would get "cleared: X" for an X they have never
129
129
  // heard of, which reads as a bug in the alerting rather than as good
130
130
  // news. This happens for real: an incident opened, acknowledged and
131
131
  // resolved between two sweeps of a host that had no channels.
@@ -19,7 +19,7 @@
19
19
  * which is the same uselessness as a permanently green one.
20
20
  *
21
21
  * The dedupe is entirely the console's: post the same thing every five minutes
22
- * for a week and he is told once. So a reporter needs no state, no "have I said
22
+ * for a week and the owner is told once. So a reporter needs no state, no "have I said
23
23
  * this?" flag, and no backoff — which is why this file is forty lines and not
24
24
  * four hundred.
25
25
  *
@@ -5,7 +5,7 @@
5
5
  * "auto notifying me once per incident (it needs to avoid sending me the same
6
6
  * problem over and over in duplicated notifications if it's polling for
7
7
  * problems)". A poller that re-sends every five minutes is the failure mode
8
- * that gets the whole feature muted, which puts him back where he started but
8
+ * that gets the whole feature muted, which puts the owner back where they started but
9
9
  * with more noise. So the unit of this module is a *condition that is true for
10
10
  * a while*, identified by a stable {@link fingerprint}, with a lifecycle —
11
11
  * and a notification is attached to a TRANSITION of that lifecycle, never to
@@ -26,7 +26,7 @@
26
26
  export type IncidentSeverity =
27
27
  /** The owner's own examples: "can't deploy, can't ingest files". Email AND text. */
28
28
  "blocking"
29
- /** Worth knowing, in-app only. A warning that texts him is a warning that mutes the channel. */
29
+ /** Worth knowing, in-app only. A warning that texts the owner is a warning that mutes the channel. */
30
30
  | "warning";
31
31
  /** Where an incident is in its life. */
32
32
  export type IncidentState =
@@ -56,9 +56,9 @@ export interface IncidentReport {
56
56
  severity: IncidentSeverity;
57
57
  /** One line, for a notification subject and a table row. Names the app. */
58
58
  title: string;
59
- /** ELI5: what actually broke. Assume he does not know what your daemon is. */
59
+ /** ELI5: what actually broke. Assume the owner does not know what your daemon is. */
60
60
  whatBroke: string;
61
- /** ELI5: what it stops him doing. This is the sentence that earns the text message. */
61
+ /** ELI5: what it stops the owner doing. This is the sentence that earns the text message. */
62
62
  whatItBlocks: string;
63
63
  /** ELI5: what to do about it. A runnable command carries its own `cd` (fleet rule). */
64
64
  whatToDo: string;
@@ -102,6 +102,6 @@ export interface IncidentTransitions {
102
102
  /**
103
103
  * A stable identity for a condition. Deliberately NOT a hash of the message:
104
104
  * an author who improves the wording of `whatToDo` must not thereby re-alert
105
- * the owner about a problem he already knows about.
105
+ * the owner about a problem they already know about.
106
106
  */
107
107
  export declare function fingerprint(report: Pick<IncidentReport, "source" | "kind" | "subject">): string;
@@ -5,7 +5,7 @@
5
5
  * "auto notifying me once per incident (it needs to avoid sending me the same
6
6
  * problem over and over in duplicated notifications if it's polling for
7
7
  * problems)". A poller that re-sends every five minutes is the failure mode
8
- * that gets the whole feature muted, which puts him back where he started but
8
+ * that gets the whole feature muted, which puts the owner back where they started but
9
9
  * with more noise. So the unit of this module is a *condition that is true for
10
10
  * a while*, identified by a stable {@link fingerprint}, with a lifecycle —
11
11
  * and a notification is attached to a TRANSITION of that lifecycle, never to
@@ -25,7 +25,7 @@
25
25
  /**
26
26
  * A stable identity for a condition. Deliberately NOT a hash of the message:
27
27
  * an author who improves the wording of `whatToDo` must not thereby re-alert
28
- * the owner about a problem he already knows about.
28
+ * the owner about a problem they already know about.
29
29
  */
30
30
  export function fingerprint(report) {
31
31
  return `${report.source}:${report.kind}:${report.subject}`;
@@ -1,11 +1,11 @@
1
1
  /**
2
- * The ACCOUNTS page — where the owner changes his master password.
2
+ * The ACCOUNTS page — where the owner changes their master password.
3
3
  *
4
4
  * ── Why it is here and not in the app ───────────────────────────────────────
5
5
  * `cursedbelt@2.5.1`'s React `MasterLockMenuItems` dialog minted a FRESH `kdf` salt on every
6
6
  * rotation, which is what the wire looked like before accounts existed. Every account on an
7
7
  * app now derives under ONE shared descriptor, so honoring that salt would store a verifier
8
- * hash nothing could ever match: the owner sets a new password, the rotation logs him out,
8
+ * hash nothing could ever match: the owner sets a new password, the rotation logs them out,
9
9
  * and neither the old nor the new one opens the app. `guard.ts` therefore answers that shape
10
10
  * `409 {"error":"stale-client"}`. That is the safe failure; this page is the fix.
11
11
  *
@@ -8,7 +8,7 @@
8
8
  * six before the first wait. On `collections`' Worker it was worse: the count lived in a JSON
9
9
  * blob snapshotted per request, so the twelve each wrote `failures + 1` over one another and
10
10
  * the burst was RECORDED as one guess. The same blob holds the open unlocks, so a failed guess
11
- * settling after the owner's unlock could also drop his fresh session.
11
+ * settling after the owner's unlock could also drop their fresh session.
12
12
  *
13
13
  * `charge` is the one operation that closes it: check the window AND, when it is open, charge
14
14
  * a failure in the same step, before anything slow happens. A correct verifier then `clear`s
@@ -204,7 +204,7 @@ export declare class MasterLock {
204
204
  * App-wide, one unlock was right: one person, one site, and the owner's *"entering it
205
205
  * in one site will only apply it to that site"*. Per person it is wrong twice over.
206
206
  * The owner asked to *"put in prompts for the orch and monitor it from our phones and
207
- * other devices"* — so the desk and the phone are both his, both open at once, and a
207
+ * other devices"* — so the desk and the phone are both the owner's, both open at once, and a
208
208
  * single-token model would have each unlock silently evict the other. And the guard
209
209
  * now demands a PRESENTED token rather than reading `unlocked` (see the guard's own
210
210
  * note), which is only possible if every device that typed the password holds one.
@@ -375,7 +375,7 @@ export declare class MasterLock {
375
375
  /**
376
376
  * Add ANOTHER master password, and with it another tenant.
377
377
  *
378
- * The owner's model, in his words: *"The master passwords represent their own tenants
378
+ * The owner's model, in their words: *"The master passwords represent their own tenants
379
379
  * or you can think of it as a fully separate account even though I am the user in both
380
380
  * cases … If I login with a master password I only see the files I added or removed
381
381
  * with that login."*
@@ -79,7 +79,7 @@ export class MasterLock {
79
79
  * App-wide, one unlock was right: one person, one site, and the owner's *"entering it
80
80
  * in one site will only apply it to that site"*. Per person it is wrong twice over.
81
81
  * The owner asked to *"put in prompts for the orch and monitor it from our phones and
82
- * other devices"* — so the desk and the phone are both his, both open at once, and a
82
+ * other devices"* — so the desk and the phone are both the owner's, both open at once, and a
83
83
  * single-token model would have each unlock silently evict the other. And the guard
84
84
  * now demands a PRESENTED token rather than reading `unlocked` (see the guard's own
85
85
  * note), which is only possible if every device that typed the password holds one.
@@ -443,7 +443,7 @@ export class MasterLock {
443
443
  /**
444
444
  * Add ANOTHER master password, and with it another tenant.
445
445
  *
446
- * The owner's model, in his words: *"The master passwords represent their own tenants
446
+ * The owner's model, in their words: *"The master passwords represent their own tenants
447
447
  * or you can think of it as a fully separate account even though I am the user in both
448
448
  * cases … If I login with a master password I only see the files I added or removed
449
449
  * with that login."*
@@ -851,7 +851,7 @@ function readAccount(value) {
851
851
  };
852
852
  }
853
853
  /** `acct-1`, `acct-2`, … — the lowest number no live account already holds. Sequential
854
- * because the owner reads these ids out of his own vault and types them into a terminal;
854
+ * because the owner reads these ids out of their own vault and types them into a terminal;
855
855
  * a random id would be one more thing to write down. */
856
856
  function nextAccountId(accounts) {
857
857
  const taken = new Set(accounts.map((account) => account.id));
@@ -11,7 +11,7 @@
11
11
  * *"I would pick one that only I know and use and she could pick one for only she knows
12
12
  * just like we did for the vault app."* Two people cannot share one record — the first to
13
13
  * rotate it locks the second out of an app they were granted — and they must not share one
14
- * unlock either, or her phone opens his desk.
14
+ * unlock either, or her phone opens the owner's desk.
15
15
  *
16
16
  * So the unit here is the PERSON. Each principal gets its own {@link MasterLock}: its own
17
17
  * KDF salt, its own `argon2id(verifier)`, its own idle clock, its own guess throttle and
@@ -30,13 +30,14 @@
30
30
  *
31
31
  * 🔴 Worker-safe: nothing here imports `bun:*`.
32
32
  */
33
+ import { IDLE_AFTER_MS } from "cursedops/idle-window";
33
34
  import type { D1LikeDatabase } from "../d1/types.js";
34
35
  /** One row per name: a presence mark (`reader:<tenant>`) or a tick's last run (`tick:<name>`). */
35
36
  export declare const PRESENCE_DDL: string[];
36
37
  /** How often one isolate writes the same presence mark. Presence is an hours-scale question. */
37
38
  export declare const PRESENCE_THROTTLE_MS: number;
38
- /** The default "nobody is here" line: no use for this long and scheduled work stands down. */
39
- export declare const IDLE_AFTER_MS: number;
39
+ /** The default "nobody is here" line: no use for this long and scheduled work stands down. cursedops' one home (forge task 5853). */
40
+ export { IDLE_AFTER_MS };
40
41
  /**
41
42
  * Note that someone used `name` now. At most one D1 write per isolate per `throttleMs`, and the row only
42
43
  * moves when it is older than that, so many isolates add up to a handful of writes an hour while anyone is
@@ -1,9 +1,42 @@
1
+ /**
2
+ * `cursedbelt-server/presence` — 🔴 an app nobody is using costs (close to) nothing (forge task 5325).
3
+ *
4
+ * The owner, 2026-11-16: *"if no one uses apps like photos, roms, flix, vault, desk, etc all day I don't
5
+ * want thousands of requests […] back and forth with no benefit."* Measured that day: the
6
+ * fleet's Worker crons fired ~6,500 times and spent ~172k CPU-ms — about a sixth of the account's Workers
7
+ * CPU, which the month was already past — and nearly all of it ran with nobody there. A five-minute cron
8
+ * is a promise to someone looking at the page; at 4 a.m. it is a promise to no one.
9
+ *
10
+ * So scheduled work keys on PRESENCE, not the clock (night is just the common case of idle):
11
+ *
12
+ * - **{@link createUseTick}** — work that used to run every few minutes runs on USE instead: a signed-in
13
+ * request kicks it under `waitUntil` when it is due, at most once per `everyMs` across every isolate
14
+ * ({@link claimTick} in D1). The Worker's own cron drops to the lowest cadence that is still correct
15
+ * with nobody there (an hourly backstop for queued work, the day's purge), and a stage tier keeps no
16
+ * cron at all: its tests in flight are the use that ticks it.
17
+ * - **{@link notePresence} / {@link lastPresence}** — for a Worker with no sign-in of its own (the media
18
+ * edge): it notes "a reader of <name> was here", throttled per isolate, and its cron asks before it
19
+ * spends anything.
20
+ * - **{@link lastHumanUse}** — for an app behind cursedauth's door: `sessions.last_seen_at` is ALREADY
21
+ * the signal. The door moves it on every signed-in request (`userIdOf`, throttled to a minute), so
22
+ * `MAX(last_seen_at)` is the tier's last human use, with no write of ours at all.
23
+ *
24
+ * Everything is created on first use (`presence_marks`, like `events_days` and the engagement tables),
25
+ * so no app's schema has to learn it. A failed claim runs nothing and warns: a lost tick is the next
26
+ * request's or the backstop cron's, never a double.
27
+ *
28
+ * `tools/check-idle-cost.ts` in the generation holds the other half: a sub-hourly cron or a stage cron
29
+ * that does not go through here is red.
30
+ *
31
+ * 🔴 Worker-safe: nothing here imports `bun:*`.
32
+ */
33
+ import { IDLE_AFTER_MS } from "cursedops/idle-window";
1
34
  /** One row per name: a presence mark (`reader:<tenant>`) or a tick's last run (`tick:<name>`). */
2
35
  export const PRESENCE_DDL = ["CREATE TABLE IF NOT EXISTS presence_marks (name TEXT PRIMARY KEY, at INTEGER NOT NULL)"];
3
36
  /** How often one isolate writes the same presence mark. Presence is an hours-scale question. */
4
37
  export const PRESENCE_THROTTLE_MS = 5 * 60_000;
5
- /** The default "nobody is here" line: no use for this long and scheduled work stands down. */
6
- export const IDLE_AFTER_MS = 3 * 60 * 60_000;
38
+ /** The default "nobody is here" line: no use for this long and scheduled work stands down. cursedops' one home (forge task 5853). */
39
+ export { IDLE_AFTER_MS };
7
40
  const TICK_PREFIX = "tick:";
8
41
  /** An upsert that only moves `at` when the row is older than `?3` — the claim and the throttled mark both. */
9
42
  const UPSERT_IF_OLDER = "INSERT INTO presence_marks (name, at) VALUES (?1, ?2) ON CONFLICT(name) DO UPDATE SET at = excluded.at WHERE presence_marks.at <= ?3";
@@ -4,7 +4,7 @@
4
4
  *
5
5
  * ── Why server-side at all ──────────────────────────────────────────────────
6
6
  * `localStorage` would be one line and would answer the wrong question. The
7
- * owner's report is about coming BACK to an app, and he does that from another
7
+ * owner's report is about coming BACK to an app, and the owner does that from another
8
8
  * device — the 2026-08-13 music sign-in from a second laptop is the same shape.
9
9
  * A place remembered only in the browser that saw it is not remembered.
10
10
  *
@@ -12,7 +12,7 @@
12
12
  * `verify:scoped` only typechecks the workspaces its own diff touches, which is
13
13
  * exactly the property that makes it fast.
14
14
  *
15
- * The owner's rule, in his words: *"a change to roms for example cannot block
15
+ * The owner's rule, in their words: *"a change to roms for example cannot block
16
16
  * family tree app from passing its tests."* This is that rule for the one
17
17
  * interface twenty-two suites all fake by hand.
18
18
  *
@@ -42,7 +42,7 @@ export interface SyncStatusReporter {
42
42
  * genuinely not attempted anything, and a restored `consecutiveFailures: 3` would be
43
43
  * a claim about failures that did not happen. But "a peer authenticated here" is
44
44
  * something that happened to the database, and forgetting it produced the owner's
45
- * 2026-08-16 report — prod saying *"Awaiting first sync"* over a vault he had used
45
+ * 2026-08-16 report — prod saying *"Awaiting first sync"* over a vault the owner had used
46
46
  * for weeks. The badge's own words are "your Mac has not dialed since this server
47
47
  * last restarted", which is true and which nobody reads as anything but "this has
48
48
  * never synced". A receiver restarts on every deploy, and the dialer runs every 5
@@ -50,7 +50,7 @@ export interface YtDownload {
50
50
  dir: string;
51
51
  dispose(): Promise<void>;
52
52
  }
53
- /** What one call may add to the profile: a site that needs the owner's sign-in gets his cookies. */
53
+ /** What one call may add to the profile: a site that needs the owner's sign-in gets their cookies. */
54
54
  interface YtDlpCallOptions {
55
55
  /** A Netscape-format cookie jar yt-dlp reads (`--cookies`). The caller owns and removes it. */
56
56
  cookiesFile?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cursedbelt-server",
3
- "version": "4.79.0",
3
+ "version": "4.79.2",
4
4
  "license": "ISC",
5
5
  "type": "module",
6
6
  "description": "The app-facing Bun/Hono server tier of the cursedbelt split — storage, sharing, activity, guard, sync. React-free; cursedbelt-core below it.",
@@ -419,7 +419,7 @@
419
419
  "dependencies": {
420
420
  "argon2id": "1.0.1",
421
421
  "cursedbelt-core": "^2.20.0",
422
- "cursedops": ">=0.8.1 <1.0.0",
422
+ "cursedops": ">=0.39.0 <1.0.0",
423
423
  "cwip": "^4.6.0",
424
424
  "jose": "^6.2.3"
425
425
  },
@@ -459,7 +459,7 @@
459
459
  "@node-rs/argon2": "^2.0.2",
460
460
  "@types/bun": "^1.3.14",
461
461
  "@types/node": "^24",
462
- "cursedbelt": "^6.30.1",
462
+ "cursedbelt": "^6.31.1",
463
463
  "hono": "4.12.28",
464
464
  "kysely": "^0.28.17",
465
465
  "kysely-bun-sqlite": "^0.4.0",
@@ -7,7 +7,8 @@ import pkg from '../package.json';
7
7
  * range used to stop at the next 0.x minor (`<0.10.0`, `<0.12.0`, `<0.13.0`, `<0.14.0`), and every
8
8
  * cursedops minor needed a hand-widening here before the ship could bump apps onto it with one
9
9
  * copy (4.30.1, 4.40.3, 4.40.4, and again for cursedops 0.14.0 — forge task 2832). All this
10
- * package takes from it is `forgeState` from `cursedops/roots`, and `tools/publish-libs.sh`'s
10
+ * package takes from it is `forgeState` from `cursedops/roots` and `IDLE_AFTER_MS` from
11
+ * `cursedops/idle-window` (0.39.0 — the FLOOR, forge task 5853), and `tools/publish-libs.sh`'s
11
12
  * consumer preflight runs every app on a new cursedops before it ships, so the cap bought nothing
12
13
  * but the chore. It is gone; this keeps it gone for the whole 0.x line.
13
14
  */
@@ -15,12 +16,13 @@ describe('cursedops range', () => {
15
16
  const range = pkg.dependencies.cursedops;
16
17
 
17
18
  it('admits every later cursedops 0.x minor, so an app bumping cursedops keeps one copy', () => {
18
- for (const version of ['0.14.0', '0.15.0', '0.20.3', '0.99.0']) {
19
+ for (const version of ['0.39.0', '0.40.0', '0.52.3', '0.99.0']) {
19
20
  expect({ version, admitted: Bun.semver.satisfies(version, range) }).toEqual({ version, admitted: true });
20
21
  }
21
22
  });
22
23
 
23
- it('still refuses what predates forgeState', () => {
24
+ it('still refuses what predates cursedops/idle-window', () => {
24
25
  expect(Bun.semver.satisfies('0.8.0', range)).toBe(false);
26
+ expect(Bun.semver.satisfies('0.38.9', range)).toBe(false);
25
27
  });
26
28
  });
@@ -8,7 +8,7 @@ import { fileURLToPath } from 'node:url';
8
8
  * The owner's ruling, 2026-09-15: *"station shouldn't need it either. This mac can
9
9
  * use a station api to send updates to prod if needed, such as for openclaw. There
10
10
  * should be no polling in cb unless you can make some good case for it that beats
11
- * the api option."* He asked for the case against; there isn't one, and this file is
11
+ * the api option."* The owner asked for the case against; there isn't one, and this file is
12
12
  * the ruling expressed as a check rather than as a paragraph.
13
13
  *
14
14
  * ## Why a paragraph was not enough
@@ -30,8 +30,8 @@ import { fileURLToPath } from 'node:url';
30
30
  *
31
31
  * 🔴 The third row is why this is not "no `setInterval`". `metricsBuffer`'s flush
32
32
  * timer is literally the *"turn many requests into 1"* the owner asked for in the
33
- * same conversation, and a rule that deleted it would contradict him while claiming
34
- * to enforce him. The forbidden act is **dialing a peer**, not scheduling work. The
33
+ * same conversation, and a rule that deleted it would contradict the owner while claiming
34
+ * to enforce their word. The forbidden act is **dialing a peer**, not scheduling work. The
35
35
  * same carve-out covers `signal.ts`'s heartbeat (a comment frame on an already-open
36
36
  * socket) and its reconnect backoff, which runs *only while disconnected*.
37
37
  *
@@ -61,7 +61,7 @@ describe("scriptsRefusedByCsp", () => {
61
61
 
62
62
  /**
63
63
  * 🔴 The failure path this whole file exists for — the owner's console line, turned into a
64
- * refusal. `script-src 'self'` with something injecting is exactly what he pasted.
64
+ * refusal. `script-src 'self'` with something injecting is exactly what the owner pasted.
65
65
  *
66
66
  * 🔴 **`MASTER_LOCK_CSP` itself, never a hand-typed copy of it.** `guard.ts:91` exports the
67
67
  * policy for exactly this reason and says so — *"EXPORTED so that nothing has to copy it"* —
@@ -10,7 +10,7 @@
10
10
  * the foreign scripts disappear — green. Decide a third-party script is wanted and allow its
11
11
  * host — green. Harden a page with `script-src 'self'` while something is still injecting into
12
12
  * it — RED, and it names the origin, which is the console line the owner would otherwise find
13
- * himself during an incident.
13
+ * themselves during an incident.
14
14
  *
15
15
  * ## 🔴 Why it lives in this package
16
16
  *
@@ -11,7 +11,7 @@
11
11
  * line was that tag being refused; it broke nothing and cost an agent the first minutes of
12
12
  * the incident.
13
13
  *
14
- * His decision, 2026-09-18, in his words: *"do your recommendation with option c but not on
14
+ * The owner's decision, 2026-09-18, in their words: *"do your recommendation with option c but not on
15
15
  * the wall. If we can stop the console error that would be good since we are purposely
16
16
  * blocking on that page and it makes it look like there is a mistake when it shows."* — and,
17
17
  * on why the wall's CSP may not simply be loosened: *"I don't want to trust cloudflare with
@@ -124,7 +124,7 @@ export const WEB_ANALYTICS_PUBLIC_HOST = "cursedalchemy.com";
124
124
  * `apps/desk` lost 24, both asserting the console is empty, and the owner's own local console
125
125
  * would have gained a red line on every page.
126
126
  *
127
- * That is the exact cost he asked to be rid of, one environment over. So the guard: the beacon
127
+ * That is the exact cost the owner asked to be rid of, one environment over. So the guard: the beacon
128
128
  * is appended only when the page is being served from {@link WEB_ANALYTICS_PUBLIC_HOST}, which
129
129
  * is the only place it can report anyway.
130
130
  *
@@ -5,7 +5,7 @@
5
5
  * problem a page sees (a stuck video, a failing API, an uncaught error) to {@link CLIENT_ISSUES_PATH};
6
6
  * this door writes one row per report into the app's own D1 `client_issues`, and autopilot's watch
7
7
  * reads that table to file the work. Before it, a problem reached a fix only when the owner copied
8
- * a report off his phone by hand.
8
+ * a report off the owner's phone by hand.
9
9
  *
10
10
  * ```ts
11
11
  * import { CLIENT_ISSUES_DDL, createD1ClientIssuesRecorder } from "cursedbelt-server/client-issues/d1";
@@ -8,7 +8,7 @@
8
8
  * failure that would be invisible in normal use and expensive to discover.
9
9
  *
10
10
  * The arithmetic gets the second most, because the owner's fleet is three
11
- * people: every number the console draws has to be one he could check by hand
11
+ * people: every number the console draws has to be one the owner could check by hand
12
12
  * with a stopwatch and a calendar, so the tests assert exact whole values
13
13
  * rather than "greater than zero".
14
14
  */
@@ -8,7 +8,7 @@
8
8
  * ── What it may hold, and why this much ─────────────────────────────────────
9
9
  * `store.ts`'s header refuses a timeline of a household's private apps, and that still holds for
10
10
  * everything with a PLACE in it. A row here has no place: a visit's start, end, view count and
11
- * attention, the least that answers his question, and only for {@link ENGAGEMENT_VISIT_RETENTION_DAYS}.
11
+ * attention, the least that answers the owner's question, and only for {@link ENGAGEMENT_VISIT_RETENTION_DAYS}.
12
12
  * One row per VISIT (the same cut as the sessions count, `policy.ts:foldView`), not per beacon: 264
13
13
  * visits across the fleet in the 30 days to 2026-10-30, against "a few thousand a month" as the line.
14
14
  *
@@ -4,8 +4,8 @@
4
4
  *
5
5
  * ── The severity split is the feature ───────────────────────────────────────
6
6
  * The owner asked for "an email and a text message about blocking issues like
7
- * these (can't deploy, can't ingest files)". A warning that texts him is a
8
- * warning that gets the channel muted, and a muted channel puts him back where
7
+ * these (can't deploy, can't ingest files)". A warning that texts the owner is a
8
+ * warning that gets the channel muted, and a muted channel puts the owner back where
9
9
  * this whole unit started — finding out days later, by accident. So: in-app for
10
10
  * everything, email + text for `blocking` only, and `notifier.ts` is the only
11
11
  * place that decision is made.
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * `cursedbelt-server/incidents` — the fleet's ONE owner-alert primitive: a
3
3
  * condition that is true for a while, told to the owner exactly once, and told
4
- * to him again when it clears.
4
+ * to the owner again when it clears.
5
5
  *
6
6
  * ── Why it exists (the owner, 2026-08-13) ───────────────────────────────────
7
7
  * *"I found out from an agent my collection uploads were stuck … there are
@@ -10,7 +10,7 @@
10
10
  * The incident behind it: 42 videos / 35 GB sat in the collections dropzone and
11
11
  * every scheduled ingest failed all 42 with EPIPE against binary-server, while
12
12
  * binary-server logged that it was under its 12 GB disk reserve — and the
13
- * dropzone deletes originals once they reach the catalog. Nothing told him. Two
13
+ * dropzone deletes originals once they reach the catalog. Nothing told the owner. Two
14
14
  * separate deterministic checks would each have caught it on the first run.
15
15
  *
16
16
  * ── Why it is HERE and not in `satellite-kit` ───────────────────────────────
@@ -13,12 +13,12 @@
13
13
  * symptom, a command and a credential without saying what any of them are. So
14
14
  * an incident message is three sentences with fixed jobs, in this order:
15
15
  *
16
- * WHAT BROKE — in words, naming the app. Assume he does not know what
16
+ * WHAT BROKE — in words, naming the app. Assume the owner does not know what
17
17
  * your daemon, flag, tab or port is.
18
- * WHAT IT BLOCKS — what he cannot do until it is fixed. This is the sentence
18
+ * WHAT IT BLOCKS — what the owner cannot do until it is fixed. This is the sentence
19
19
  * that earns a text message at 2am; if you cannot write it,
20
20
  * the incident is a `warning`.
21
- * WHAT TO DO — a next step. A command carries its own `cd`, because he
21
+ * WHAT TO DO — a next step. A command carries its own `cd`, because the owner
22
22
  * opens terminals anywhere (`fleet/rules/
23
23
  * commands-must-run-from-anywhere.md`).
24
24
  *
@@ -53,9 +53,9 @@ export interface AnnounceResult {
53
53
  * overdue backup opened as blocking while the email channel was still
54
54
  * misconfigured, both channels failed, and — because `notifiedAt` was stamped —
55
55
  * nothing would ever have tried again. The owner would have had a blocking
56
- * incident on a board he had no reason to open. The dedupe promise is "you are
56
+ * incident on a board the owner had no reason to open. The dedupe promise is "you are
57
57
  * told ONCE", not "we attempt once": an attempt that reached nobody has not told
58
- * him anything.
58
+ * the owner anything.
59
59
  *
60
60
  * It retries at most hourly, and it STOPS the moment any channel reports
61
61
  * `delivered` — so a permanently broken channel costs one send an hour, and a
@@ -90,7 +90,7 @@ export function composeOpened(incident: Incident): ChannelMessage {
90
90
 
91
91
  /**
92
92
  * The message for a resolve. It exists so "is it fixed?" is answered without
93
- * him having to go and look — the same reason the open message exists.
93
+ * the owner having to go and look — the same reason the open message exists.
94
94
  */
95
95
  export function composeResolved(incident: Incident): ChannelMessage {
96
96
  const minutes = Math.max(1, Math.round(((incident.resolvedAt ?? 0) - incident.firstSeen) / 60000));
@@ -175,8 +175,8 @@ export function createIncidentNotifier(options: CreateNotifierOptions): Incident
175
175
  const result = await dispatch(incident, composeOpened(incident), transition);
176
176
  // 🔴 Only stamp `notifiedAt` when there was actually a channel to try.
177
177
  // A host with none (a prod deployment that only stores what the Mac
178
- // pushes it) has not told him anything, and stamping it there is what
179
- // made the resolve message below fire for an open he never saw.
178
+ // pushes it) has not told the owner anything, and stamping it there is what
179
+ // made the resolve message below fire for an open the owner never saw.
180
180
  if (result.results.length > 0) {
181
181
  store.markNotified([incident.fingerprint], summarise(result.results));
182
182
  }
@@ -199,7 +199,7 @@ export function createIncidentNotifier(options: CreateNotifierOptions): Incident
199
199
 
200
200
  for (const incident of t.resolved) {
201
201
  // Never announce a resolve for something whose OPEN was never
202
- // announced — the owner would get "cleared: X" for an X he has never
202
+ // announced — the owner would get "cleared: X" for an X they have never
203
203
  // heard of, which reads as a bug in the alerting rather than as good
204
204
  // news. This happens for real: an incident opened, acknowledged and
205
205
  // resolved between two sweeps of a host that had no channels.
@@ -19,7 +19,7 @@
19
19
  * which is the same uselessness as a permanently green one.
20
20
  *
21
21
  * The dedupe is entirely the console's: post the same thing every five minutes
22
- * for a week and he is told once. So a reporter needs no state, no "have I said
22
+ * for a week and the owner is told once. So a reporter needs no state, no "have I said
23
23
  * this?" flag, and no backoff — which is why this file is forty lines and not
24
24
  * four hundred.
25
25
  *
@@ -5,7 +5,7 @@
5
5
  * "auto notifying me once per incident (it needs to avoid sending me the same
6
6
  * problem over and over in duplicated notifications if it's polling for
7
7
  * problems)". A poller that re-sends every five minutes is the failure mode
8
- * that gets the whole feature muted, which puts him back where he started but
8
+ * that gets the whole feature muted, which puts the owner back where they started but
9
9
  * with more noise. So the unit of this module is a *condition that is true for
10
10
  * a while*, identified by a stable {@link fingerprint}, with a lifecycle —
11
11
  * and a notification is attached to a TRANSITION of that lifecycle, never to
@@ -27,7 +27,7 @@
27
27
  export type IncidentSeverity =
28
28
  /** The owner's own examples: "can't deploy, can't ingest files". Email AND text. */
29
29
  | "blocking"
30
- /** Worth knowing, in-app only. A warning that texts him is a warning that mutes the channel. */
30
+ /** Worth knowing, in-app only. A warning that texts the owner is a warning that mutes the channel. */
31
31
  | "warning";
32
32
 
33
33
  /** Where an incident is in its life. */
@@ -60,9 +60,9 @@ export interface IncidentReport {
60
60
  severity: IncidentSeverity;
61
61
  /** One line, for a notification subject and a table row. Names the app. */
62
62
  title: string;
63
- /** ELI5: what actually broke. Assume he does not know what your daemon is. */
63
+ /** ELI5: what actually broke. Assume the owner does not know what your daemon is. */
64
64
  whatBroke: string;
65
- /** ELI5: what it stops him doing. This is the sentence that earns the text message. */
65
+ /** ELI5: what it stops the owner doing. This is the sentence that earns the text message. */
66
66
  whatItBlocks: string;
67
67
  /** ELI5: what to do about it. A runnable command carries its own `cd` (fleet rule). */
68
68
  whatToDo: string;
@@ -109,7 +109,7 @@ export interface IncidentTransitions {
109
109
  /**
110
110
  * A stable identity for a condition. Deliberately NOT a hash of the message:
111
111
  * an author who improves the wording of `whatToDo` must not thereby re-alert
112
- * the owner about a problem he already knows about.
112
+ * the owner about a problem they already know about.
113
113
  */
114
114
  export function fingerprint(report: Pick<IncidentReport, "source" | "kind" | "subject">): string {
115
115
  return `${report.source}:${report.kind}:${report.subject}`;
@@ -67,7 +67,7 @@ async function open(lock: MasterLock, verifier: string) {
67
67
  return { ...result, req: req(result.token) };
68
68
  }
69
69
 
70
- describe("🔴 claim 1 — the owner's existing password keeps opening everything he has", () => {
70
+ describe("🔴 claim 1 — the owner's existing password keeps opening everything they have", () => {
71
71
  test("a legacy single-password record becomes acct-1, and that password still works", async () => {
72
72
  // THE migration guarantee. `apps/collections` stamps its 279 existing rows with this
73
73
  // id, so an id that moved — or a record that failed to parse and armed nothing —
@@ -152,7 +152,7 @@ describe("🔴 claim 2 — a second password is a second tenant, and never the f
152
152
 
153
153
  test("creating a tenant does NOT enter it", async () => {
154
154
  // Switching means typing that tenant's password. If creating one dropped you into
155
- // it, the owner would add an account and watch his library apparently vanish.
155
+ // it, the owner would add an account and watch their library apparently vanish.
156
156
  const { lock } = build(legacyJson);
157
157
  const first = await open(lock, firstVerifier);
158
158
  await lock.addAccount(first.req, {
@@ -165,8 +165,8 @@ describe("🔴 claim 2 — a second password is a second tenant, and never the f
165
165
 
166
166
  test("🔴 a password that already opens something is refused", async () => {
167
167
  // Two accounts under one password would make `unlock` serve whichever the loop
168
- // reached first — so the owner would type the password he has always typed and be
169
- // handed an empty library, with his real one apparently gone.
168
+ // reached first — so the owner would type the password they have always typed and be
169
+ // handed an empty library, with the owner's real one apparently gone.
170
170
  const { lock } = build(legacyJson);
171
171
  const first = await open(lock, firstVerifier);
172
172
  expect(
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * `cursedbelt@2.5.1`'s React dialog minted a FRESH `kdf` salt on every rotation. Every
5
5
  * account on an app derives under one shared descriptor, so honoring that salt stores a
6
- * verifier hash nothing can match — the owner sets a new password, the rotation logs him
6
+ * verifier hash nothing can match — the owner sets a new password, the rotation logs them
7
7
  * out, and neither the old nor the new one opens the app. The server refuses that shape with
8
8
  * `409 stale-client`; this page is what replaces the client that sent it.
9
9
  *
@@ -1,11 +1,11 @@
1
1
  /**
2
- * The ACCOUNTS page — where the owner changes his master password.
2
+ * The ACCOUNTS page — where the owner changes their master password.
3
3
  *
4
4
  * ── Why it is here and not in the app ───────────────────────────────────────
5
5
  * `cursedbelt@2.5.1`'s React `MasterLockMenuItems` dialog minted a FRESH `kdf` salt on every
6
6
  * rotation, which is what the wire looked like before accounts existed. Every account on an
7
7
  * app now derives under ONE shared descriptor, so honoring that salt would store a verifier
8
- * hash nothing could ever match: the owner sets a new password, the rotation logs him out,
8
+ * hash nothing could ever match: the owner sets a new password, the rotation logs them out,
9
9
  * and neither the old nor the new one opens the app. `guard.ts` therefore answers that shape
10
10
  * `409 {"error":"stale-client"}`. That is the safe failure; this page is the fix.
11
11
  *
@@ -8,7 +8,7 @@
8
8
  * six before the first wait. On `collections`' Worker it was worse: the count lived in a JSON
9
9
  * blob snapshotted per request, so the twelve each wrote `failures + 1` over one another and
10
10
  * the burst was RECORDED as one guess. The same blob holds the open unlocks, so a failed guess
11
- * settling after the owner's unlock could also drop his fresh session.
11
+ * settling after the owner's unlock could also drop their fresh session.
12
12
  *
13
13
  * `charge` is the one operation that closes it: check the window AND, when it is open, charge
14
14
  * a failure in the same step, before anything slow happens. A correct verifier then `clear`s
@@ -29,9 +29,9 @@ import { createMemoryMasterLockStore } from "./store.js";
29
29
  * the one page whose entire job is to take a master password with nothing else on it. The
30
30
  * wall's {@link MASTER_LOCK_CSP} refused the tag, correctly, and the refusal printed in the
31
31
  * console. The owner read that console during an outage on 2026-09-17 and it was the first
32
- * line he saw.
32
+ * line the owner saw.
33
33
  *
34
- * Three ways out were put to him. He took none of them as written (2026-09-18):
34
+ * Three ways out were put to the owner. The owner took none of them as written (2026-09-18):
35
35
  *
36
36
  * > *"do your recommendation with option c but not on the wall. If we can stop the console
37
37
  * > error that would be good since we are purposely blocking on that page and it makes it look
@@ -54,7 +54,7 @@ import { createMemoryMasterLockStore } from "./store.js";
54
54
  *
55
55
  * ## What would turn this red
56
56
  *
57
- * · somebody adds `static.cloudflareinsights.com` to {@link MASTER_LOCK_CSP} — the thing he
57
+ * · somebody adds `static.cloudflareinsights.com` to {@link MASTER_LOCK_CSP} — the thing the owner
58
58
  * refused;
59
59
  * · somebody pastes the analytics tag into `lockPage.ts` or `accountsPage.ts`;
60
60
  * · the wall starts serving any cross-origin script its own policy would refuse, beacon or
@@ -159,7 +159,7 @@ describe("while locked", () => {
159
159
  test("🔴 a rotation carrying a STALE kdf is refused, not silently honored", async () => {
160
160
  // The pre-accounts wire minted a fresh salt on every rotation. Every account now
161
161
  // derives under one shared descriptor, so honoring that would store a verifier hash
162
- // nothing can ever match — the owner sets a new password, the rotation logs him out,
162
+ // nothing can ever match — the owner sets a new password, the rotation logs them out,
163
163
  // and neither the old nor the new one opens the app. `409 stale-client` is the one
164
164
  // refusal here that is deliberately distinguishable from a wrong password.
165
165
  const { guard } = build();
@@ -261,7 +261,7 @@ export class MasterLock {
261
261
  * App-wide, one unlock was right: one person, one site, and the owner's *"entering it
262
262
  * in one site will only apply it to that site"*. Per person it is wrong twice over.
263
263
  * The owner asked to *"put in prompts for the orch and monitor it from our phones and
264
- * other devices"* — so the desk and the phone are both his, both open at once, and a
264
+ * other devices"* — so the desk and the phone are both the owner's, both open at once, and a
265
265
  * single-token model would have each unlock silently evict the other. And the guard
266
266
  * now demands a PRESENTED token rather than reading `unlocked` (see the guard's own
267
267
  * note), which is only possible if every device that typed the password holds one.
@@ -639,7 +639,7 @@ export class MasterLock {
639
639
  /**
640
640
  * Add ANOTHER master password, and with it another tenant.
641
641
  *
642
- * The owner's model, in his words: *"The master passwords represent their own tenants
642
+ * The owner's model, in their words: *"The master passwords represent their own tenants
643
643
  * or you can think of it as a fully separate account even though I am the user in both
644
644
  * cases … If I login with a master password I only see the files I added or removed
645
645
  * with that login."*
@@ -1054,7 +1054,7 @@ function readAccount(value: unknown): MasterLockAccount | null {
1054
1054
  }
1055
1055
 
1056
1056
  /** `acct-1`, `acct-2`, … — the lowest number no live account already holds. Sequential
1057
- * because the owner reads these ids out of his own vault and types them into a terminal;
1057
+ * because the owner reads these ids out of their own vault and types them into a terminal;
1058
1058
  * a random id would be one more thing to write down. */
1059
1059
  function nextAccountId(accounts: readonly MasterLockAccount[]): string {
1060
1060
  const taken = new Set(accounts.map((account) => account.id));
@@ -143,8 +143,8 @@ describe("🔴 claim 1b — the unlock is a TOKEN, never ambient state", () => {
143
143
  /**
144
144
  * Measured while building this, and the reason the guard no longer reads `unlocked` in
145
145
  * per-person mode: with `lock.unlocked ||` in front of the token check, the owner
146
- * enrolling in one browser opened the app for every OTHER browser signed in as him —
147
- * his phone rode his desk's unlock, and an invented `x-master-lock` value was accepted
146
+ * enrolling in one browser opened the app for every OTHER browser signed in as the owner —
147
+ * the owner's phone rode their desk's unlock, and an invented `x-master-lock` value was accepted
148
148
  * because nothing ever looked at it. Both tests below fail if that `||` comes back.
149
149
  */
150
150
  test("a second device signed in as the SAME person still has to type it", async () => {
@@ -11,7 +11,7 @@
11
11
  * *"I would pick one that only I know and use and she could pick one for only she knows
12
12
  * just like we did for the vault app."* Two people cannot share one record — the first to
13
13
  * rotate it locks the second out of an app they were granted — and they must not share one
14
- * unlock either, or her phone opens his desk.
14
+ * unlock either, or her phone opens the owner's desk.
15
15
  *
16
16
  * So the unit here is the PERSON. Each principal gets its own {@link MasterLock}: its own
17
17
  * KDF salt, its own `argon2id(verifier)`, its own idle clock, its own guess throttle and
@@ -30,6 +30,7 @@
30
30
  *
31
31
  * 🔴 Worker-safe: nothing here imports `bun:*`.
32
32
  */
33
+ import { IDLE_AFTER_MS } from "cursedops/idle-window";
33
34
  import type { D1LikeDatabase } from "../d1/types.js";
34
35
 
35
36
  /** One row per name: a presence mark (`reader:<tenant>`) or a tick's last run (`tick:<name>`). */
@@ -38,8 +39,8 @@ export const PRESENCE_DDL = ["CREATE TABLE IF NOT EXISTS presence_marks (name TE
38
39
  /** How often one isolate writes the same presence mark. Presence is an hours-scale question. */
39
40
  export const PRESENCE_THROTTLE_MS = 5 * 60_000;
40
41
 
41
- /** The default "nobody is here" line: no use for this long and scheduled work stands down. */
42
- export const IDLE_AFTER_MS = 3 * 60 * 60_000;
42
+ /** The default "nobody is here" line: no use for this long and scheduled work stands down. cursedops' one home (forge task 5853). */
43
+ export { IDLE_AFTER_MS };
43
44
 
44
45
  const TICK_PREFIX = "tick:";
45
46
 
@@ -4,7 +4,7 @@
4
4
  *
5
5
  * ── Why server-side at all ──────────────────────────────────────────────────
6
6
  * `localStorage` would be one line and would answer the wrong question. The
7
- * owner's report is about coming BACK to an app, and he does that from another
7
+ * owner's report is about coming BACK to an app, and the owner does that from another
8
8
  * device — the 2026-08-13 music sign-in from a second laptop is the same shape.
9
9
  * A place remembered only in the browser that saw it is not remembered.
10
10
  *
@@ -12,7 +12,7 @@
12
12
  * `verify:scoped` only typechecks the workspaces its own diff touches, which is
13
13
  * exactly the property that makes it fast.
14
14
  *
15
- * The owner's rule, in his words: *"a change to roms for example cannot block
15
+ * The owner's rule, in their words: *"a change to roms for example cannot block
16
16
  * family tree app from passing its tests."* This is that rule for the one
17
17
  * interface twenty-two suites all fake by hand.
18
18
  *
@@ -58,7 +58,7 @@ export interface SyncStatusReporter {
58
58
  * genuinely not attempted anything, and a restored `consecutiveFailures: 3` would be
59
59
  * a claim about failures that did not happen. But "a peer authenticated here" is
60
60
  * something that happened to the database, and forgetting it produced the owner's
61
- * 2026-08-16 report — prod saying *"Awaiting first sync"* over a vault he had used
61
+ * 2026-08-16 report — prod saying *"Awaiting first sync"* over a vault the owner had used
62
62
  * for weeks. The badge's own words are "your Mac has not dialed since this server
63
63
  * last restarted", which is true and which nobody reads as anything but "this has
64
64
  * never synced". A receiver restarts on every deploy, and the dialer runs every 5
@@ -120,7 +120,7 @@ export interface YtDownload {
120
120
  dispose(): Promise<void>;
121
121
  }
122
122
 
123
- /** What one call may add to the profile: a site that needs the owner's sign-in gets his cookies. */
123
+ /** What one call may add to the profile: a site that needs the owner's sign-in gets their cookies. */
124
124
  interface YtDlpCallOptions {
125
125
  /** A Netscape-format cookie jar yt-dlp reads (`--cookies`). The caller owns and removes it. */
126
126
  cookiesFile?: string;