cursedbelt-server 4.47.1 → 4.48.1

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 (203) hide show
  1. package/dist/server/activity/store.d.ts +1 -1
  2. package/dist/server/analytics/injectedScripts.d.ts +1 -1
  3. package/dist/server/analytics/injectedScripts.js +1 -1
  4. package/dist/server/analytics/webAnalytics.d.ts +1 -1
  5. package/dist/server/analytics/webAnalytics.js +1 -1
  6. package/dist/server/auth/loginThrottleDurable.d.ts +3 -3
  7. package/dist/server/auth/loginThrottleDurable.js +3 -3
  8. package/dist/server/auth/passwordCost.js +1 -1
  9. package/dist/server/ctgrChunkDurable.d.ts +1 -1
  10. package/dist/server/ctgrChunkDurable.js +1 -1
  11. package/dist/server/d1/backup.d.ts +1 -1
  12. package/dist/server/d1/backup.js +1 -1
  13. package/dist/server/d1/http.d.ts +2 -2
  14. package/dist/server/d1/http.js +2 -2
  15. package/dist/server/d1/invocation.js +1 -1
  16. package/dist/server/d1/limits.d.ts +1 -1
  17. package/dist/server/d1/limits.js +1 -1
  18. package/dist/server/d1/scheduling.d.ts +1 -1
  19. package/dist/server/d1/scheduling.js +1 -1
  20. package/dist/server/d1/types.d.ts +1 -1
  21. package/dist/server/d1/types.js +1 -1
  22. package/dist/server/d1/values.d.ts +1 -1
  23. package/dist/server/d1/values.js +1 -1
  24. package/dist/server/dropzone/scan.d.ts +1 -1
  25. package/dist/server/engagement/actions.d.ts +20 -0
  26. package/dist/server/engagement/actions.js +62 -0
  27. package/dist/server/engagement/api.d.ts +13 -2
  28. package/dist/server/engagement/api.js +30 -2
  29. package/dist/server/engagement/d1.d.ts +13 -2
  30. package/dist/server/engagement/d1.js +30 -2
  31. package/dist/server/engagement/index.d.ts +5 -4
  32. package/dist/server/engagement/index.js +3 -2
  33. package/dist/server/engagement/manifestPlaces.d.ts +7 -1
  34. package/dist/server/engagement/manifestPlaces.js +21 -0
  35. package/dist/server/engagement/places.d.ts +3 -0
  36. package/dist/server/engagement/places.js +9 -2
  37. package/dist/server/engagement/policy.d.ts +21 -0
  38. package/dist/server/engagement/policy.js +27 -0
  39. package/dist/server/engagement/store.d.ts +12 -3
  40. package/dist/server/engagement/store.js +30 -2
  41. package/dist/server/engagement/summary.d.ts +15 -1
  42. package/dist/server/engagement/summary.js +15 -0
  43. package/dist/server/engagement/types.d.ts +9 -0
  44. package/dist/server/guard/argon2Binding.js +1 -1
  45. package/dist/server/guard/kdfWorkerEntry.js +2 -2
  46. package/dist/server/incidents/index.d.ts +1 -1
  47. package/dist/server/incidents/index.js +1 -1
  48. package/dist/server/incidents/store.d.ts +1 -1
  49. package/dist/server/incidents/store.js +1 -1
  50. package/dist/server/jobs/timeout.d.ts +1 -1
  51. package/dist/server/jobs/timeout.js +1 -1
  52. package/dist/server/master-lock/accountsPage.d.ts +1 -1
  53. package/dist/server/master-lock/accountsPage.js +2 -2
  54. package/dist/server/master-lock/guard.js +1 -1
  55. package/dist/server/master-lock/lockPage.d.ts +1 -1
  56. package/dist/server/master-lock/lockPage.js +2 -2
  57. package/dist/server/master-lock/masterLock.d.ts +2 -2
  58. package/dist/server/master-lock/masterLock.js +2 -2
  59. package/dist/server/metrics/normalizeRoute.js +1 -1
  60. package/dist/server/metrics/telemetrySink.d.ts +2 -2
  61. package/dist/server/metrics/telemetrySink.js +1 -1
  62. package/dist/server/middleware/zValidator.js +2 -2
  63. package/dist/server/notifications/hub.js +1 -1
  64. package/dist/server/requestLog/requestMetrics.d.ts +2 -2
  65. package/dist/server/requestLog/requestMetrics.js +2 -2
  66. package/dist/server/retention/archive.d.ts +1 -1
  67. package/dist/server/retention/archive.js +2 -2
  68. package/dist/server/satellite/config.js +2 -2
  69. package/dist/server/satellite/door.d.ts +1 -1
  70. package/dist/server/sharing/contract.d.ts +1 -1
  71. package/dist/server/storage/binaryStore.d.ts +1 -1
  72. package/dist/server/storage/binaryStore.js +3 -3
  73. package/dist/server/storage/derivatives.d.ts +2 -2
  74. package/dist/server/storage/derivatives.js +2 -2
  75. package/dist/server/storage/files/adapter.d.ts +2 -2
  76. package/dist/server/storage/files/adapter.js +10 -10
  77. package/dist/server/storage/files/catalogue.d.ts +1 -1
  78. package/dist/server/storage/files/catalogue.js +4 -4
  79. package/dist/server/storage/files/chunkedUpload.d.ts +2 -2
  80. package/dist/server/storage/files/chunkedUpload.js +1 -1
  81. package/dist/server/storage/files/fileRoutes.d.ts +1 -1
  82. package/dist/server/storage/files/fileRoutes.js +4 -4
  83. package/dist/server/storage/files/mimeByExt.js +1 -1
  84. package/dist/server/storage/files/stack.d.ts +2 -2
  85. package/dist/server/storage/files/types.d.ts +4 -4
  86. package/dist/server/storage/files/types.js +1 -1
  87. package/dist/server/storage/index.js +1 -1
  88. package/dist/server/storage/objectStoreMediaStore.js +1 -1
  89. package/dist/server/storage/transcodeJobs.js +5 -5
  90. package/dist/server/storage/types.d.ts +1 -1
  91. package/dist/server/storage/types.js +1 -1
  92. package/dist/server/storage/videoDerivativeKeys.d.ts +1 -1
  93. package/dist/server/storage/videoDerivativeKeys.js +1 -1
  94. package/dist/server/storage/videoProcessor.js +1 -1
  95. package/dist/server/sync/status.d.ts +1 -1
  96. package/dist/server/zipStream.d.ts +1 -1
  97. package/dist/server/zipStream.js +1 -1
  98. package/docs/activity.md +2 -2
  99. package/docs/engagement.md +10 -1
  100. package/docs/retention.md +2 -2
  101. package/package.json +1 -1
  102. package/src/leafSubpathsImportNothing.spec.ts +1 -1
  103. package/src/namedSubpathsResolve.spec.ts +1 -1
  104. package/src/noTimerDialsAPeer.spec.ts +1 -1
  105. package/src/nodeBuiltinsAreProbedByCalling.spec.ts +1 -1
  106. package/src/publishShape.spec.ts +1 -1
  107. package/src/server/activity/store.ts +1 -1
  108. package/src/server/analytics/injectedScripts.spec.ts +1 -1
  109. package/src/server/analytics/injectedScripts.ts +1 -1
  110. package/src/server/analytics/webAnalytics.ts +1 -1
  111. package/src/server/auth/loginThrottleDurable.ts +3 -3
  112. package/src/server/auth/passwordCost.ts +1 -1
  113. package/src/server/bench/cpuBudget.spec.ts +1 -1
  114. package/src/server/bench/tail.spec.ts +1 -1
  115. package/src/server/ctgrChunkDurable.ts +1 -1
  116. package/src/server/d1/backup.spec.ts +1 -1
  117. package/src/server/d1/backup.ts +1 -1
  118. package/src/server/d1/http.ts +2 -2
  119. package/src/server/d1/invocation.spec.ts +1 -1
  120. package/src/server/d1/invocation.ts +1 -1
  121. package/src/server/d1/limits.ts +1 -1
  122. package/src/server/d1/pullD1.spec.ts +1 -1
  123. package/src/server/d1/scheduling.ts +1 -1
  124. package/src/server/d1/types.ts +1 -1
  125. package/src/server/d1/values.ts +1 -1
  126. package/src/server/dropzone/scan.spec.ts +2 -2
  127. package/src/server/dropzone/scan.ts +1 -1
  128. package/src/server/engagement/actions.ts +71 -0
  129. package/src/server/engagement/api.ts +36 -1
  130. package/src/server/engagement/d1.spec.ts +49 -3
  131. package/src/server/engagement/d1.ts +35 -2
  132. package/src/server/engagement/engagement.spec.ts +103 -1
  133. package/src/server/engagement/index.ts +5 -2
  134. package/src/server/engagement/manifestPlaces.ts +21 -1
  135. package/src/server/engagement/places.ts +12 -2
  136. package/src/server/engagement/policy.ts +34 -0
  137. package/src/server/engagement/store.ts +33 -4
  138. package/src/server/engagement/summary.ts +33 -0
  139. package/src/server/engagement/types.ts +10 -0
  140. package/src/server/google-oauth/googleOAuth.spec.ts +1 -1
  141. package/src/server/guard/argon2Binding.ts +1 -1
  142. package/src/server/guard/kdfWorkerEntry.ts +2 -2
  143. package/src/server/incidents/index.ts +1 -1
  144. package/src/server/incidents/store.ts +1 -1
  145. package/src/server/jobs/timeout.ts +1 -1
  146. package/src/server/master-lock/accountsPage.spec.ts +2 -2
  147. package/src/server/master-lock/accountsPage.ts +2 -2
  148. package/src/server/master-lock/beaconNeverReachesTheWall.spec.ts +2 -2
  149. package/src/server/master-lock/guard.spec.ts +2 -2
  150. package/src/server/master-lock/guard.ts +1 -1
  151. package/src/server/master-lock/lockPage.spec.ts +1 -1
  152. package/src/server/master-lock/lockPage.ts +2 -2
  153. package/src/server/master-lock/masterLock.spec.ts +1 -1
  154. package/src/server/master-lock/masterLock.ts +2 -2
  155. package/src/server/master-lock/sessions.spec.ts +1 -1
  156. package/src/server/metrics/normalizeRoute.ts +1 -1
  157. package/src/server/metrics/telemetrySink.ts +3 -3
  158. package/src/server/middleware/bodyLimit.spec.ts +1 -1
  159. package/src/server/middleware/zValidator.spec.ts +3 -3
  160. package/src/server/middleware/zValidator.ts +3 -3
  161. package/src/server/notifications/hub.ts +1 -1
  162. package/src/server/requestLog/requestMetrics.spec.ts +2 -2
  163. package/src/server/requestLog/requestMetrics.ts +3 -3
  164. package/src/server/retention/archive.spec.ts +2 -2
  165. package/src/server/retention/archive.ts +2 -2
  166. package/src/server/satellite/config.ts +2 -2
  167. package/src/server/satellite/door.ts +1 -1
  168. package/src/server/satellite/satellite.spec.ts +1 -1
  169. package/src/server/sharing/contract.ts +1 -1
  170. package/src/server/storage/binaryServerProcessing.spec.ts +1 -1
  171. package/src/server/storage/binaryServerProcessing.ts +4 -4
  172. package/src/server/storage/binaryStore.spec.ts +6 -6
  173. package/src/server/storage/binaryStore.ts +4 -4
  174. package/src/server/storage/chunked.integration.spec.ts +2 -2
  175. package/src/server/storage/derivatives.ts +2 -2
  176. package/src/server/storage/fileUploadClient.integration.spec.ts +1 -1
  177. package/src/server/storage/files/adapter.photo.spec.ts +2 -2
  178. package/src/server/storage/files/adapter.spec.ts +3 -3
  179. package/src/server/storage/files/adapter.ts +10 -10
  180. package/src/server/storage/files/catalogue.spec.ts +1 -1
  181. package/src/server/storage/files/catalogue.ts +4 -4
  182. package/src/server/storage/files/chunkedUpload.spec.ts +5 -5
  183. package/src/server/storage/files/chunkedUpload.ts +3 -3
  184. package/src/server/storage/files/fileRoutes.spec.ts +3 -3
  185. package/src/server/storage/files/fileRoutes.ts +5 -5
  186. package/src/server/storage/files/mimeByExt.ts +1 -1
  187. package/src/server/storage/files/stack.ts +3 -3
  188. package/src/server/storage/files/types.ts +6 -6
  189. package/src/server/storage/index.ts +1 -1
  190. package/src/server/storage/objectStoreMediaStore.ts +1 -1
  191. package/src/server/storage/sources.ts +1 -1
  192. package/src/server/storage/transcodeJobs.ts +5 -5
  193. package/src/server/storage/types.ts +2 -2
  194. package/src/server/storage/uploadSession.spec.ts +1 -1
  195. package/src/server/storage/videoDerivativeKeys.spec.ts +3 -3
  196. package/src/server/storage/videoDerivativeKeys.ts +1 -1
  197. package/src/server/storage/videoProcessor.ts +1 -1
  198. package/src/server/sync/status.ts +1 -1
  199. package/src/server/sync/timer.spec.ts +1 -1
  200. package/src/server/worker-argon2/index.spec.ts +1 -1
  201. package/src/server/zipStream.spec.ts +2 -2
  202. package/src/server/zipStream.ts +1 -1
  203. package/src/shippedFilesAreTracked.spec.ts +2 -2
@@ -5,5 +5,11 @@
5
5
  *
6
6
  * Anything it cannot read is `[]`, never a throw: see `places.ts`, "Missing is EMPTY".
7
7
  */
8
- import type { PlaceRef } from "./policy.js";
8
+ import type { ActionRef, PlaceRef } from "./policy.js";
9
9
  export declare function placesFromManifest(doc: unknown): PlaceRef[];
10
+ /**
11
+ * A parsed `routes.manifest.json` → the ACTION allowlist (task 3470): its top-level `actions`,
12
+ * each `{ id, label }` or a bare id. The same contract as the places — anything unreadable is
13
+ * `[]`, never a throw — and the same consequence: an app with no `actions` has no action door.
14
+ */
15
+ export declare function actionsFromManifest(doc: unknown): ActionRef[];
@@ -15,3 +15,24 @@ export function placesFromManifest(doc) {
15
15
  places.sort((a, b) => a.id.localeCompare(b.id));
16
16
  return places;
17
17
  }
18
+ /**
19
+ * A parsed `routes.manifest.json` → the ACTION allowlist (task 3470): its top-level `actions`,
20
+ * each `{ id, label }` or a bare id. The same contract as the places — anything unreadable is
21
+ * `[]`, never a throw — and the same consequence: an app with no `actions` has no action door.
22
+ */
23
+ export function actionsFromManifest(doc) {
24
+ const raw = Array.isArray(doc) ? undefined : doc?.actions;
25
+ if (!Array.isArray(raw))
26
+ return [];
27
+ const seen = new Set();
28
+ const actions = [];
29
+ for (const item of raw) {
30
+ const a = (typeof item === "string" ? { id: item } : item);
31
+ if (!a || typeof a.id !== "string" || !a.id.trim() || seen.has(a.id))
32
+ continue;
33
+ seen.add(a.id);
34
+ actions.push(typeof a.label === "string" ? { id: a.id, label: a.label } : { id: a.id });
35
+ }
36
+ actions.sort((a, b) => a.id.localeCompare(b.id));
37
+ return actions;
38
+ }
@@ -1,3 +1,4 @@
1
+ import type { ActionRef } from "./policy.js";
1
2
  /**
2
3
  * One declared page: the id the board shows, and the URL shape that reaches it.
3
4
  *
@@ -20,3 +21,5 @@ export interface EngagementPlace {
20
21
  * manifest is copied into both.
21
22
  */
22
23
  export declare function engagementPlacesFor(dir: string): EngagementPlace[];
24
+ /** The declared ACTIONS in `<dir>/routes.manifest.json` — `[]` when it has none (task 3470). */
25
+ export declare function engagementActionsFor(dir: string): ActionRef[];
@@ -24,7 +24,7 @@
24
24
  */
25
25
  import { existsSync, readFileSync } from "node:fs";
26
26
  import { join } from "node:path";
27
- import { placesFromManifest } from "./manifestPlaces.js";
27
+ import { actionsFromManifest, placesFromManifest } from "./manifestPlaces.js";
28
28
  /** Where the manifest sits, in a source tree and in a built artifact alike. */
29
29
  const MANIFEST = "routes.manifest.json";
30
30
  /**
@@ -35,11 +35,18 @@ const MANIFEST = "routes.manifest.json";
35
35
  * manifest is copied into both.
36
36
  */
37
37
  export function engagementPlacesFor(dir) {
38
+ return readManifest(dir, placesFromManifest);
39
+ }
40
+ /** The declared ACTIONS in `<dir>/routes.manifest.json` — `[]` when it has none (task 3470). */
41
+ export function engagementActionsFor(dir) {
42
+ return readManifest(dir, actionsFromManifest);
43
+ }
44
+ function readManifest(dir, read) {
38
45
  const path = join(dir, MANIFEST);
39
46
  if (!existsSync(path))
40
47
  return [];
41
48
  try {
42
- return placesFromManifest(JSON.parse(readFileSync(path, "utf8")));
49
+ return read(JSON.parse(readFileSync(path, "utf8")));
43
50
  }
44
51
  catch {
45
52
  return [];
@@ -83,6 +83,27 @@ export declare function resolvePlace(claimed: string, allowed: readonly (string
83
83
  * unpopular features rather than one popular one.
84
84
  */
85
85
  export declare function normalizePlaceId(raw: string): string;
86
+ /**
87
+ * Resolve the action a browser reported to one of the app's DECLARED actions (task 3470).
88
+ *
89
+ * A place says where somebody was; an action says what they DID there — a search run, a track
90
+ * played, a download started. The owner's question ("what features do they use and ignore") is
91
+ * about the second, and it carries the same risk as the first: the obvious way to record "a
92
+ * search" is to record the search. So rule 1 holds for actions exactly as for places — an action
93
+ * is a NAME from the app's own `routes.manifest.json` `actions` list, never a value. There is no
94
+ * field for the query, the track or the URL, and anything off the list records as
95
+ * {@link OTHER_PLACE}, so an app that forgot to declare a name sees an `other` row rather than
96
+ * a feature that reads as unused.
97
+ */
98
+ export declare function resolveAction(claimed: string, allowed: readonly (string | ActionRef)[]): string;
99
+ /** One declared action — `routes.manifest.json`'s `actions[]`. */
100
+ export interface ActionRef {
101
+ id: string;
102
+ /** What the console shows beside the id — "play a track". */
103
+ label?: string;
104
+ }
105
+ /** `Play ` → `play`. Case and surrounding space are one action, not two. */
106
+ export declare function normalizeActionId(raw: string): string;
86
107
  /**
87
108
  * How long a gap between two views before the second one starts a new session.
88
109
  *
@@ -128,6 +128,33 @@ export function normalizePlaceId(raw) {
128
128
  .replace(/^\/?#/, "")
129
129
  .replace(/^\/+|\/+$/g, ""));
130
130
  }
131
+ /**
132
+ * Resolve the action a browser reported to one of the app's DECLARED actions (task 3470).
133
+ *
134
+ * A place says where somebody was; an action says what they DID there — a search run, a track
135
+ * played, a download started. The owner's question ("what features do they use and ignore") is
136
+ * about the second, and it carries the same risk as the first: the obvious way to record "a
137
+ * search" is to record the search. So rule 1 holds for actions exactly as for places — an action
138
+ * is a NAME from the app's own `routes.manifest.json` `actions` list, never a value. There is no
139
+ * field for the query, the track or the URL, and anything off the list records as
140
+ * {@link OTHER_PLACE}, so an app that forgot to declare a name sees an `other` row rather than
141
+ * a feature that reads as unused.
142
+ */
143
+ export function resolveAction(claimed, allowed) {
144
+ const want = normalizeActionId(claimed);
145
+ if (!want)
146
+ return OTHER_PLACE;
147
+ for (const entry of allowed) {
148
+ const id = typeof entry === "string" ? entry : entry.id;
149
+ if (normalizeActionId(id) === want)
150
+ return id;
151
+ }
152
+ return OTHER_PLACE;
153
+ }
154
+ /** `Play ` → `play`. Case and surrounding space are one action, not two. */
155
+ export function normalizeActionId(raw) {
156
+ return raw.trim().toLowerCase();
157
+ }
131
158
  /**
132
159
  * How long a gap between two views before the second one starts a new session.
133
160
  *
@@ -32,8 +32,9 @@
32
32
  * every lapsed user look like a new one.
33
33
  */
34
34
  import { Database } from "bun:sqlite";
35
- import type { EngagementDay, EngagementUser, EngagementUserPlace } from "./types.js";
36
- export type { EngagementDay, EngagementUser, EngagementUserPlace } from "./types.js";
35
+ import { type ActionUse } from "./actions.js";
36
+ import type { EngagementActionUse, EngagementDay, EngagementUser, EngagementUserPlace } from "./types.js";
37
+ export type { EngagementActionUse, EngagementDay, EngagementUser, EngagementUserPlace } from "./types.js";
37
38
  /** How much history the daily grain keeps. */
38
39
  export declare const ENGAGEMENT_DAY_RETENTION_DAYS = 120;
39
40
  export interface EngagementStoreOptions {
@@ -66,6 +67,14 @@ export declare class EngagementStore {
66
67
  newSession: boolean;
67
68
  activeMs: number;
68
69
  };
70
+ /**
71
+ * Count one resolved action. Like {@link recordView}, `place` and `action` must ALREADY be
72
+ * resolved against the app's manifest — the door (`api.ts`) does it. Touches no clock and no
73
+ * dwell: an action is something done on the page the view already counted.
74
+ */
75
+ recordAction(use: ActionUse): void;
76
+ /** Every (user, place, action) lifetime roll-up, most used first. */
77
+ actions(): EngagementActionUse[];
69
78
  /** Every account's roll-up for this app, most recently seen first. */
70
79
  users(): EngagementUser[];
71
80
  /** Every (user, place) roll-up — the per-FEATURE grain, whole-fleet readable. */
@@ -75,7 +84,7 @@ export declare class EngagementStore {
75
84
  /**
76
85
  * Drop daily rows older than the retention window.
77
86
  *
78
- * 🔴 Only `engagement_days`. The two roll-ups are deliberately untouched —
87
+ * 🔴 Only the daily grains (`engagement_days`, `engagement_action_days`). The roll-ups are deliberately untouched —
79
88
  * see the file header. An agent "completing" this by trimming them too would
80
89
  * delete the only record that somebody used to be here, which is the entire
81
90
  * drop-off signal.
@@ -34,6 +34,7 @@
34
34
  import { Database } from "bun:sqlite";
35
35
  import { mkdirSync } from "node:fs";
36
36
  import { dirname, resolve } from "node:path";
37
+ import { actionStatements, ENGAGEMENT_ACTION_DDL } from "./actions.js";
37
38
  import { dayKey, foldView } from "./policy.js";
38
39
  /**
39
40
  * `bun:sqlite`'s `create: true` creates the FILE, never the directory above it, so a first boot
@@ -110,6 +111,9 @@ export class EngagementStore {
110
111
  last_ts INTEGER NOT NULL,
111
112
  last_place TEXT NOT NULL DEFAULT ''
112
113
  )`);
114
+ // Feature actions (task 3470) — `actions.ts` says why they are their own two tables.
115
+ for (const ddl of ENGAGEMENT_ACTION_DDL)
116
+ this.handle.run(ddl);
113
117
  }
114
118
  /**
115
119
  * Record one resolved place-view.
@@ -165,6 +169,28 @@ export class EngagementStore {
165
169
  this.prune(ts);
166
170
  return fold;
167
171
  }
172
+ /**
173
+ * Count one resolved action. Like {@link recordView}, `place` and `action` must ALREADY be
174
+ * resolved against the app's manifest — the door (`api.ts`) does it. Touches no clock and no
175
+ * dwell: an action is something done on the page the view already counted.
176
+ */
177
+ recordAction(use) {
178
+ const statements = actionStatements(use);
179
+ this.handle.transaction(() => {
180
+ for (const { sql, params } of statements)
181
+ this.handle.run(sql, params);
182
+ })();
183
+ if (++this.writes % 256 === 0)
184
+ this.prune(use.ts);
185
+ }
186
+ /** Every (user, place, action) lifetime roll-up, most used first. */
187
+ actions() {
188
+ return this.handle
189
+ .query(`SELECT user_key AS userKey, place, action, uses, first_ts AS firstTs, last_ts AS lastTs
190
+ FROM engagement_actions
191
+ ORDER BY uses DESC`)
192
+ .all();
193
+ }
168
194
  /** Every account's roll-up for this app, most recently seen first. */
169
195
  users() {
170
196
  return this.handle
@@ -195,14 +221,16 @@ export class EngagementStore {
195
221
  /**
196
222
  * Drop daily rows older than the retention window.
197
223
  *
198
- * 🔴 Only `engagement_days`. The two roll-ups are deliberately untouched —
224
+ * 🔴 Only the daily grains (`engagement_days`, `engagement_action_days`). The roll-ups are deliberately untouched —
199
225
  * see the file header. An agent "completing" this by trimming them too would
200
226
  * delete the only record that somebody used to be here, which is the entire
201
227
  * drop-off signal.
202
228
  */
203
229
  prune(at = Date.now()) {
204
230
  const cutoff = dayKey(at - this.retentionDays * 86_400_000);
205
- return this.handle.run("DELETE FROM engagement_days WHERE day < ?", [cutoff]).changes;
231
+ // The action DAYS age out with the view days; `engagement_actions` is a roll-up and stays.
232
+ const actionDays = this.handle.run("DELETE FROM engagement_action_days WHERE day < ?", [cutoff]).changes;
233
+ return this.handle.run("DELETE FROM engagement_days WHERE day < ?", [cutoff]).changes + actionDays;
206
234
  }
207
235
  /** Row counts + age bounds, for the retention card. */
208
236
  stats() {
@@ -13,7 +13,7 @@
13
13
  * drives it with hand-written rows and checks arithmetic a human can verify —
14
14
  * which is the whole design constraint at n = 3. No I/O, no `Date.now()`.
15
15
  */
16
- import { type EngagementDay, type EngagementUser, type EngagementUserPlace, type InterestVerdict } from "./types.js";
16
+ import { type EngagementActionUse, type EngagementDay, type EngagementUser, type EngagementUserPlace, type InterestVerdict } from "./types.js";
17
17
  /** One account's relationship with one app. */
18
18
  export interface UserEngagement {
19
19
  userKey: string;
@@ -40,6 +40,16 @@ export interface PlaceEngagement {
40
40
  /** Mean ms of attention per view. The "does it hold interest" number. */
41
41
  msPerView: number;
42
42
  }
43
+ /** One declared action on one place, across every account — "what features they use" (task 3470). */
44
+ export interface ActionEngagement {
45
+ place: string;
46
+ name: string;
47
+ /** Times it was used, every account together. */
48
+ count: number;
49
+ /** Distinct accounts that have used it. */
50
+ accounts: number;
51
+ lastTs: number;
52
+ }
43
53
  /** One day of the app's whole activity. */
44
54
  export interface DailyEngagement {
45
55
  day: string;
@@ -63,6 +73,8 @@ export interface AppEngagement {
63
73
  lastTs: number;
64
74
  }>;
65
75
  daily: DailyEngagement[];
76
+ /** Per place, per action — most used first. Empty for an app that records no actions. */
77
+ actions: ActionEngagement[];
66
78
  totals: {
67
79
  users: number;
68
80
  views: number;
@@ -82,6 +94,8 @@ export interface SummarizeInput {
82
94
  users: EngagementUser[];
83
95
  places: EngagementUserPlace[];
84
96
  days: EngagementDay[];
97
+ /** The (user, place, action) roll-ups. Absent → no actions. */
98
+ actions?: EngagementActionUse[];
85
99
  }
86
100
  export declare function summarize(input: SummarizeInput): AppEngagement;
87
101
  /**
@@ -82,6 +82,20 @@ export function summarize(input) {
82
82
  lastTs: p.lastTs,
83
83
  }))
84
84
  .sort((a, b) => b.views - a.views);
85
+ const byAction = new Map();
86
+ for (const row of input.actions ?? []) {
87
+ const key = `${row.place}\u0000${row.action}`;
88
+ const existing = byAction.get(key);
89
+ if (existing) {
90
+ existing.count += row.uses;
91
+ existing.accounts += 1;
92
+ existing.lastTs = Math.max(existing.lastTs, row.lastTs);
93
+ }
94
+ else {
95
+ byAction.set(key, { place: row.place, name: row.action, count: row.uses, accounts: 1, lastTs: row.lastTs });
96
+ }
97
+ }
98
+ const actions = [...byAction.values()].sort((a, b) => b.count - a.count || a.place.localeCompare(b.place) || a.name.localeCompare(b.name));
85
99
  return {
86
100
  app,
87
101
  generatedAt: now,
@@ -89,6 +103,7 @@ export function summarize(input) {
89
103
  places,
90
104
  userPlaces,
91
105
  daily,
106
+ actions,
92
107
  totals: {
93
108
  users: users.length,
94
109
  views: users.reduce((n, u) => n + u.views, 0),
@@ -29,6 +29,15 @@ export interface EngagementUserPlace {
29
29
  firstTs: number;
30
30
  lastTs: number;
31
31
  }
32
+ /** One (user, place, action) lifetime roll-up — "who uses this feature, and when last" (task 3470). */
33
+ export interface EngagementActionUse {
34
+ userKey: string;
35
+ place: string;
36
+ action: string;
37
+ uses: number;
38
+ firstTs: number;
39
+ lastTs: number;
40
+ }
32
41
  /** One account's relationship with the whole app. */
33
42
  export interface EngagementUser {
34
43
  userKey: string;
@@ -66,7 +66,7 @@ export const argon2idDeriverFrom = (binding) => {
66
66
  // 0x10 and 0x13 ARE the Argon2 version identifiers: the spec, the reference
67
67
  // implementation and every envelope on disk write them in hex. Biome's autofix
68
68
  // rewrites them as 16 and 19 — the same map and a worse one, because nobody
69
- // reading an `$argon2id$v=19$` record would recognise the decimal.
69
+ // reading an `$argon2id$v=19$` record would recognize the decimal.
70
70
  // biome-ignore lint/complexity/useSimpleNumberKeys: see above — hex IS the spec's spelling
71
71
  const NODE_RS_VERSION = { 0x10: 0, 0x13: 1 };
72
72
  /**
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * The SHIPPED KDF worker entry (05 §B6).
3
3
  *
4
- * Unlike a marshalling worker — where every marshaller declares its own entry
5
- * because every marshaller has its own schema — there is exactly ONE password
4
+ * Unlike a marshaling worker — where every marshaler declares its own entry
5
+ * because every marshaler has its own schema — there is exactly ONE password
6
6
  * KDF in the platform (Law #7), so there is exactly one entry and the framework
7
7
  * ships it. A host does not write this file; it points
8
8
  * `createKdfWorkerPasswordVerifier({ entry: kdfWorkerEntryUrl() })` at it.
@@ -29,7 +29,7 @@
29
29
  * something is new.
30
30
  * - {@link runIncidentSweep} — runs checks; a check that THROWS resolves
31
31
  * nothing, so a broken detector can never announce that an outage is over.
32
- * - channels — in-app (the fleet's existing notification centre), email, and a
32
+ * - channels — in-app (the fleet's existing notification center), email, and a
33
33
  * text message from this Mac that reads `chat.db` back to prove it left.
34
34
  * - {@link createIncidentNotifier} — composes the three-sentence message and
35
35
  * sends it on OPEN, on ESCALATE and on RESOLVE. Never on an observation.
@@ -29,7 +29,7 @@
29
29
  * something is new.
30
30
  * - {@link runIncidentSweep} — runs checks; a check that THROWS resolves
31
31
  * nothing, so a broken detector can never announce that an outage is over.
32
- * - channels — in-app (the fleet's existing notification centre), email, and a
32
+ * - channels — in-app (the fleet's existing notification center), email, and a
33
33
  * text message from this Mac that reads `chat.db` back to prove it left.
34
34
  * - {@link createIncidentNotifier} — composes the three-sentence message and
35
35
  * sends it on OPEN, on ESCALATE and on RESOLVE. Never on an observation.
@@ -34,7 +34,7 @@ import { type Incident, type IncidentReport, type IncidentTransitions } from "./
34
34
  * bytes free, items failed, commits behind — and a string slipping in there is
35
35
  * how a file name reaches an SMS. See the header of `types.ts`.
36
36
  *
37
- * It throws rather than sanitising, because a detector author meets the failure
37
+ * It throws rather than sanitizing, because a detector author meets the failure
38
38
  * in their own test run, which is the only moment the mistake is cheap.
39
39
  */
40
40
  export declare function assertNoContent(report: IncidentReport): void;
@@ -28,7 +28,7 @@ const toIncident = (r) => ({
28
28
  * bytes free, items failed, commits behind — and a string slipping in there is
29
29
  * how a file name reaches an SMS. See the header of `types.ts`.
30
30
  *
31
- * It throws rather than sanitising, because a detector author meets the failure
31
+ * It throws rather than sanitizing, because a detector author meets the failure
32
32
  * in their own test run, which is the only moment the mistake is cheap.
33
33
  */
34
34
  export function assertNoContent(report) {
@@ -15,7 +15,7 @@ export declare class JobTimeoutError extends Error {
15
15
  * Resolve/reject with `promise`, but reject with a {@link JobTimeoutError} if it
16
16
  * has not settled within `timeoutMs`. `onTimeout` fires on timeout — the runner
17
17
  * uses it to abort the handler's context signal so a cooperative handler can
18
- * short-circuit (a pending promise cannot be force-cancelled).
18
+ * short-circuit (a pending promise cannot be force-canceled).
19
19
  *
20
20
  * Order matters: the timeout promise is rejected BEFORE `onTimeout` runs. Aborting
21
21
  * the signal can synchronously resolve a cooperative handler; if that resolution
@@ -19,7 +19,7 @@ export class JobTimeoutError extends Error {
19
19
  * Resolve/reject with `promise`, but reject with a {@link JobTimeoutError} if it
20
20
  * has not settled within `timeoutMs`. `onTimeout` fires on timeout — the runner
21
21
  * uses it to abort the handler's context signal so a cooperative handler can
22
- * short-circuit (a pending promise cannot be force-cancelled).
22
+ * short-circuit (a pending promise cannot be force-canceled).
23
23
  *
24
24
  * Order matters: the timeout promise is rejected BEFORE `onTimeout` runs. Aborting
25
25
  * the signal can synchronously resolve a cooperative handler; if that resolution
@@ -18,7 +18,7 @@ export { MASTER_LOCK_MIN_PASSWORD_LENGTH } from "./lockPage.js";
18
18
  * The document.
19
19
  *
20
20
  * It links the LOCK's stylesheet first and its own second, so the two pages share one set of
21
- * colour tokens and a change to the palette cannot land on only one of them.
21
+ * color tokens and a change to the palette cannot land on only one of them.
22
22
  */
23
23
  export declare function accountsPageHtml(options: LockPageOptions): string;
24
24
  /**
@@ -4,7 +4,7 @@
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
- * app now derives under ONE shared descriptor, so honouring that salt would store a verifier
7
+ * app now derives under ONE shared descriptor, so honoring that salt would store a verifier
8
8
  * hash nothing could ever match: the owner sets a new password, the rotation logs him 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.
@@ -54,7 +54,7 @@ export { MASTER_LOCK_MIN_PASSWORD_LENGTH } from "./lockPage.js";
54
54
  * The document.
55
55
  *
56
56
  * It links the LOCK's stylesheet first and its own second, so the two pages share one set of
57
- * colour tokens and a change to the palette cannot land on only one of them.
57
+ * color tokens and a change to the palette cannot land on only one of them.
58
58
  */
59
59
  export function accountsPageHtml(options) {
60
60
  const label = escapeHtml(options.appLabel);
@@ -209,7 +209,7 @@ export function createMasterLockGuard(options) {
209
209
  * owner would set a new password, be logged out by the rotation, and find that
210
210
  * neither the old nor the new one opens the app.
211
211
  *
212
- * There is no safe way to honour it either, since every account on this app shares
212
+ * There is no safe way to honor it either, since every account on this app shares
213
213
  * one descriptor. So it is refused, loudly, with the one thing that distinguishes
214
214
  * it from a wrong password.
215
215
  */
@@ -37,7 +37,7 @@ export declare function lockPageHtml(options: LockPageOptions): string;
37
37
  export declare const LOCK_STYLE = ":root{color-scheme:light dark;\n --ml-bg:#f4f5f7;--ml-card:#ffffff;--ml-text:#14171c;--ml-muted:#69707c;--ml-border:#d9dde3;\n --ml-accent:#1f6feb;--ml-accent-text:#ffffff;--ml-danger:#b42318;\n --ml-shadow:0 18px 48px rgba(16,18,22,.14)}\n@media (prefers-color-scheme:dark){:root{\n --ml-bg:#0d0f13;--ml-card:#171a20;--ml-text:#e7eaef;--ml-muted:#8b93a1;--ml-border:#2b3039;\n --ml-accent:#4f8cf7;--ml-accent-text:#0b0d11;--ml-danger:#f97066;\n --ml-shadow:0 18px 48px rgba(0,0,0,.55)}}\n*{box-sizing:border-box}\nbody{margin:0;min-height:100vh;display:flex;align-items:center;justify-content:center;padding:24px;\n background:var(--ml-bg);color:var(--ml-text);\n font:15px/1.55 ui-sans-serif,system-ui,-apple-system,\"Segoe UI\",sans-serif}\n.card{width:100%;max-width:23rem;background:var(--ml-card);border:1px solid var(--ml-border);\n border-radius:16px;padding:28px 26px 24px;box-shadow:var(--ml-shadow);text-align:center}\n.glyph{font-size:30px;line-height:1;margin-bottom:10px}\nh1{margin:0 0 6px;font-size:18px;font-weight:650;letter-spacing:-.01em}\n.note{margin:0 0 20px;font-size:13px;color:var(--ml-muted)}\n.field{display:block;text-align:left;margin-bottom:14px}\n.field span{display:block;font-size:12px;font-weight:600;color:var(--ml-muted);margin-bottom:6px}\ninput{width:100%;height:40px;padding:0 12px;border:1px solid var(--ml-border);border-radius:9px;\n background:var(--ml-bg);color:inherit;font:inherit;font-size:16px}\ninput:focus{outline:2px solid var(--ml-accent);outline-offset:1px;border-color:transparent}\nbutton{width:100%;height:40px;border:0;border-radius:9px;background:var(--ml-accent);\n color:var(--ml-accent-text);font:inherit;font-weight:600;cursor:pointer}\nbutton[disabled]{opacity:.6;cursor:progress}\n.status{margin:14px 0 0;min-height:1.2em;font-size:12.5px;color:var(--ml-muted)}\n.status[data-tone=\"error\"]{color:var(--ml-danger)}\n.field span em{font-style:normal;font-weight:500;text-transform:none;opacity:.7}\nbutton.quiet{margin-top:10px;height:32px;background:none;color:var(--ml-muted);font-weight:500;\n font-size:12.5px;text-decoration:underline;text-underline-offset:3px}\nbutton.quiet:hover{color:var(--ml-text)}\nbutton.quiet[disabled]{opacity:.5}\n.hints{margin:10px 0 0;padding:12px 14px;text-align:left;border:1px solid var(--ml-border);\n border-radius:10px;background:var(--ml-bg);font-size:12.5px}\n.hints dt{font-weight:650;color:var(--ml-text)}\n.hints dd{margin:2px 0 10px;color:var(--ml-muted);overflow-wrap:anywhere}\n.hints dd:last-child{margin-bottom:0}\n.secret{position:relative;display:block}\n.secret input{padding-right:48px}\n.secret .reveal{position:absolute;right:5px;top:50%;transform:translateY(-50%);width:36px;height:32px;\n display:grid;place-items:center;padding:0;border-radius:7px;background:none;color:var(--ml-muted)}\n.secret .reveal svg{width:18px;height:18px}\n.secret .reveal .eye-off,.secret .reveal[aria-pressed=\"true\"] .eye{display:none}\n.secret .reveal[aria-pressed=\"true\"] .eye-off{display:block}\n.secret .reveal:hover{color:var(--ml-text);background:var(--ml-card)}\n.secret .reveal:focus-visible{outline:2px solid var(--ml-accent);outline-offset:1px}\n";
38
38
  export declare function withRevealToggles(html: string): string;
39
39
  /**
40
- * The toggle's behaviour, as browser source. It flips the input BEFORE it to `text` and back,
40
+ * The toggle's behavior, as browser source. It flips the input BEFORE it to `text` and back,
41
41
  * keeps `aria-pressed`/`aria-label` true to what is on screen, and returns every field to
42
42
  * `password` when its form submits — so a manager saving the credential sees a password field.
43
43
  * Publishes itself on `globalThis`, the seam `lockPage.spec.ts` drives it through.
@@ -157,7 +157,7 @@ button.quiet[disabled]{opacity:.5}
157
157
  *
158
158
  * Markup: {@link withRevealToggles} wraps each `type="password"` input in `.secret` with a
159
159
  * `<button type="button" data-reveal>` after it — the inputs keep every attribute, `autocomplete`
160
- * included, so a password manager still sees a password field. Behaviour:
160
+ * included, so a password manager still sees a password field. Behavior:
161
161
  * {@link MASTER_LOCK_REVEAL_SOURCE}, interpolated into BOTH same-origin scripts, because the wall's
162
162
  * CSP is `script-src 'self'` and allows no inline script (`MASTER_LOCK_CSP`, pinned by
163
163
  * `beaconNeverReachesTheWall.spec.ts`). Nothing about the CSP changes for this.
@@ -174,7 +174,7 @@ export function withRevealToggles(html) {
174
174
  return html.replace(/(<input\b[^>]*\btype="password"[^>]*>)/g, `<span class="secret">$1<button type="button" class="reveal" data-reveal aria-label="Show password" aria-pressed="false">${EYE}${EYE_OFF}</button></span>`);
175
175
  }
176
176
  /**
177
- * The toggle's behaviour, as browser source. It flips the input BEFORE it to `text` and back,
177
+ * The toggle's behavior, as browser source. It flips the input BEFORE it to `text` and back,
178
178
  * keeps `aria-pressed`/`aria-label` true to what is on screen, and returns every field to
179
179
  * `password` when its form submits — so a manager saving the credential sees a password field.
180
180
  * Publishes itself on `globalThis`, the seam `lockPage.spec.ts` drives it through.
@@ -286,7 +286,7 @@ export declare class MasterLock {
286
286
  *
287
287
  * `null` means "no live unlock is presented here", which is the only thing that may
288
288
  * ever refuse a request. It deliberately does not fall back to {@link unlocked}: that
289
- * reads "somebody's device is open", and honouring it would make the unlock AMBIENT —
289
+ * reads "somebody's device is open", and honoring it would make the unlock AMBIENT —
290
290
  * a second browser signed in as the owner would walk through having typed nothing, and
291
291
  * would then be served whichever tenant happened to be open. While an app had one
292
292
  * password that was merely sloppy; with several it hands the wrong library to the
@@ -325,7 +325,7 @@ export declare class MasterLock {
325
325
  * answer's latency says nothing the answer itself does not.
326
326
  *
327
327
  * 🔴 **Every account is tried, and the loop does not stop at the first match.**
328
- * Stopping early is the obvious optimisation and it is a timing oracle: a password
328
+ * Stopping early is the obvious optimization and it is a timing oracle: a password
329
329
  * matching the first account would answer in one argon2id and a wrong one in N, so the
330
330
  * shape of the reply would say how many tenants exist and roughly where in the list
331
331
  * this one sits. The cost is bounded by how many passwords the owner has made — single
@@ -226,7 +226,7 @@ export class MasterLock {
226
226
  *
227
227
  * `null` means "no live unlock is presented here", which is the only thing that may
228
228
  * ever refuse a request. It deliberately does not fall back to {@link unlocked}: that
229
- * reads "somebody's device is open", and honouring it would make the unlock AMBIENT —
229
+ * reads "somebody's device is open", and honoring it would make the unlock AMBIENT —
230
230
  * a second browser signed in as the owner would walk through having typed nothing, and
231
231
  * would then be served whichever tenant happened to be open. While an app had one
232
232
  * password that was merely sloppy; with several it hands the wrong library to the
@@ -291,7 +291,7 @@ export class MasterLock {
291
291
  * answer's latency says nothing the answer itself does not.
292
292
  *
293
293
  * 🔴 **Every account is tried, and the loop does not stop at the first match.**
294
- * Stopping early is the obvious optimisation and it is a timing oracle: a password
294
+ * Stopping early is the obvious optimization and it is a timing oracle: a password
295
295
  * matching the first account would answer in one argon2id and a wrong one in N, so the
296
296
  * shape of the reply would say how many tenants exist and roughly where in the list
297
297
  * this one sits. The cost is bounded by how many passwords the owner has made — single
@@ -3,7 +3,7 @@
3
3
  * (e.g. `/api/v1/notes/:id`). The method is tracked separately.
4
4
  *
5
5
  * Two wrinkles, same as the old Express normalizer:
6
- * 1. ctgr GET-tunnelled mutations match the `/ctgr<xx>` twin route — we map them
6
+ * 1. ctgr GET-tunneled mutations match the `/ctgr<xx>` twin route — we map them
7
7
  * back to the real verb + path so a POST and its ctgr twin aggregate together.
8
8
  * 2. Unmatched requests (404s, static, the SPA fallback) have no matched route
9
9
  * pattern, so we collapse dynamic-looking segments to avoid unbounded
@@ -26,7 +26,7 @@ import { type MetricRow } from './metricsBuffer.js';
26
26
  * run concurrently in many datacentres, so a `/metrics` scrape reaches ONE
27
27
  * arbitrary isolate holding a random fraction of the counters. The in-process
28
28
  * registry has nowhere to live. (A Durable Object does have a durable identity
29
- * *and* memory, and is the real `prom-client` analogue — but it is a whole
29
+ * *and* memory, and is the real `prom-client` analog — but it is a whole
30
30
  * stateful object to operate for counters Analytics Engine already aggregates.
31
31
  * Prometheus itself also needs an always-on host to scrape FROM, and that host
32
32
  * is the Mac this fleet is trying to switch off.)
@@ -44,7 +44,7 @@ import { type MetricRow } from './metricsBuffer.js';
44
44
  * Worker supplies the real binding at runtime).
45
45
  *
46
46
  * Platform limits, which {@link toDataPoint} respects:
47
- * **1** index of ≤96 bytes, ≤**20** blobs totalling ≤5120 bytes, ≤**20** doubles.
47
+ * **1** index of ≤96 bytes, ≤**20** blobs totaling ≤5120 bytes, ≤**20** doubles.
48
48
  */
49
49
  export interface AnalyticsEngineDataset {
50
50
  writeDataPoint(point: {
@@ -34,7 +34,7 @@ function truncateUtf8(value, maxBytes) {
34
34
  if (encoded.length <= maxBytes)
35
35
  return value;
36
36
  return new TextDecoder('utf-8', { fatal: false }).decode(encoded.subarray(0, maxBytes)).replace(
37
- // A cut through a multi-byte sequence decodes to U+FFFD; drop that trailing artefact.
37
+ // A cut through a multi-byte sequence decodes to U+FFFD; drop that trailing artifact.
38
38
  /�+$/, '');
39
39
  }
40
40
  const num = (value) => typeof value === 'number' && Number.isFinite(value) ? value : -1;
@@ -1,8 +1,8 @@
1
1
  import { validationEnvelope } from '../errors.js';
2
2
  /**
3
3
  * Read the value a target validates against. The body targets (`json`/`form`) prefer
4
- * the ctgr-decoded body so a tunnelled mutation validates its real payload; the
5
- * URL-bound targets (`query`/`param`) are never tunnelled (GETs go direct) and read
4
+ * the ctgr-decoded body so a tunneled mutation validates its real payload; the
5
+ * URL-bound targets (`query`/`param`) are never tunneled (GETs go direct) and read
6
6
  * from the live request. A query object collapses single-valued keys to a string so
7
7
  * `z.string()`/`z.coerce.number()` field schemas see a scalar (repeated keys stay an
8
8
  * array) — matching Hono's own validator semantics.
@@ -25,7 +25,7 @@ export function createNotificationHub(options = {}) {
25
25
  if (!set)
26
26
  return;
27
27
  // Snapshot: a listener may unsubscribe itself while being called (a
28
- // stream that has just been cancelled does exactly that).
28
+ // stream that has just been canceled does exactly that).
29
29
  for (const listener of [...set]) {
30
30
  try {
31
31
  listener(event);
@@ -6,7 +6,7 @@
6
6
  * ── Why it is here (4.21.0) ─────────────────────────────────────────────────
7
7
  * `apps/family` and `apps/roms` held this module byte-identically (task 265's rollout), and
8
8
  * `check-copies` counted it as five copy groups. The API, the header marker and the migration name
9
- * are exactly the apps' — a live corpus is recognised by `METRICS_APPLICATION_ID` and by the
9
+ * are exactly the apps' — a live corpus is recognized by `METRICS_APPLICATION_ID` and by the
10
10
  * `0001_request_metrics` row in its migrations table, so changing either would make every
11
11
  * existing `metrics.sqlite` look inherited and archive it. Bun-only (`bun:sqlite`, `node:fs`): under
12
12
  * Node the export map routes this subpath to `_bunOnly.js`, the way `./engagement` does; it is NOT
@@ -85,7 +85,7 @@ export interface RequestMetricsOptions {
85
85
  /**
86
86
  * Place each request (`{ country, region?, city? }` or `null`) — never an address; the raw IP
87
87
  * is not stored. Default: the edge's own answer, `locateFromCloudflare` (the `cf-ipcountry`
88
- * header every tunnelled request carries). station passes its DB-IP reader here.
88
+ * header every tunneled request carries). station passes its DB-IP reader here.
89
89
  */
90
90
  locate?: RequestLocator;
91
91
  }
@@ -6,7 +6,7 @@
6
6
  * ── Why it is here (4.21.0) ─────────────────────────────────────────────────
7
7
  * `apps/family` and `apps/roms` held this module byte-identically (task 265's rollout), and
8
8
  * `check-copies` counted it as five copy groups. The API, the header marker and the migration name
9
- * are exactly the apps' — a live corpus is recognised by `METRICS_APPLICATION_ID` and by the
9
+ * are exactly the apps' — a live corpus is recognized by `METRICS_APPLICATION_ID` and by the
10
10
  * `0001_request_metrics` row in its migrations table, so changing either would make every
11
11
  * existing `metrics.sqlite` look inherited and archive it. Bun-only (`bun:sqlite`, `node:fs`): under
12
12
  * Node the export map routes this subpath to `_bunOnly.js`, the way `./engagement` does; it is NOT
@@ -129,7 +129,7 @@ export function retireInheritedCorpus(dir) {
129
129
  const live = join(dir, METRICS_DB);
130
130
  if (!existsSync(live))
131
131
  return null;
132
- // An empty file with no journal holds nothing — SQLite simply initialises it.
132
+ // An empty file with no journal holds nothing — SQLite simply initializes it.
133
133
  if (sizeOf(live) === 0 && SIDECARS.every((s) => sizeOf(live + s) === 0))
134
134
  return null;
135
135
  if (headerApplicationId(live) === METRICS_APPLICATION_ID)