cursedbelt-server 4.48.0 → 4.49.0

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 (186) 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/pullD1.d.ts +4 -1
  19. package/dist/server/d1/pullD1.js +5 -2
  20. package/dist/server/d1/scheduling.d.ts +1 -1
  21. package/dist/server/d1/scheduling.js +1 -1
  22. package/dist/server/d1/types.d.ts +1 -1
  23. package/dist/server/d1/types.js +1 -1
  24. package/dist/server/d1/values.d.ts +1 -1
  25. package/dist/server/d1/values.js +1 -1
  26. package/dist/server/dropzone/index.d.ts +1 -0
  27. package/dist/server/dropzone/index.js +1 -0
  28. package/dist/server/dropzone/report.d.ts +188 -0
  29. package/dist/server/dropzone/report.js +430 -0
  30. package/dist/server/dropzone/scan.d.ts +22 -3
  31. package/dist/server/dropzone/scan.js +46 -1
  32. package/dist/server/engagement/index.d.ts +1 -1
  33. package/dist/server/engagement/index.js +1 -1
  34. package/dist/server/guard/argon2Binding.js +1 -1
  35. package/dist/server/guard/kdfWorkerEntry.js +2 -2
  36. package/dist/server/incidents/index.d.ts +1 -1
  37. package/dist/server/incidents/index.js +1 -1
  38. package/dist/server/incidents/store.d.ts +1 -1
  39. package/dist/server/incidents/store.js +1 -1
  40. package/dist/server/jobs/timeout.d.ts +1 -1
  41. package/dist/server/jobs/timeout.js +1 -1
  42. package/dist/server/master-lock/accountsPage.d.ts +1 -1
  43. package/dist/server/master-lock/accountsPage.js +2 -2
  44. package/dist/server/master-lock/guard.js +1 -1
  45. package/dist/server/master-lock/lockPage.d.ts +1 -1
  46. package/dist/server/master-lock/lockPage.js +2 -2
  47. package/dist/server/master-lock/masterLock.d.ts +2 -2
  48. package/dist/server/master-lock/masterLock.js +2 -2
  49. package/dist/server/metrics/normalizeRoute.js +1 -1
  50. package/dist/server/metrics/telemetrySink.d.ts +2 -2
  51. package/dist/server/metrics/telemetrySink.js +1 -1
  52. package/dist/server/middleware/zValidator.js +2 -2
  53. package/dist/server/notifications/hub.js +1 -1
  54. package/dist/server/requestLog/requestMetrics.d.ts +2 -2
  55. package/dist/server/requestLog/requestMetrics.js +2 -2
  56. package/dist/server/retention/archive.d.ts +1 -1
  57. package/dist/server/retention/archive.js +2 -2
  58. package/dist/server/satellite/config.js +2 -2
  59. package/dist/server/satellite/door.d.ts +1 -1
  60. package/dist/server/sharing/contract.d.ts +1 -1
  61. package/dist/server/storage/binaryStore.d.ts +1 -1
  62. package/dist/server/storage/binaryStore.js +3 -3
  63. package/dist/server/storage/derivatives.d.ts +2 -2
  64. package/dist/server/storage/derivatives.js +2 -2
  65. package/dist/server/storage/files/adapter.d.ts +2 -2
  66. package/dist/server/storage/files/adapter.js +10 -10
  67. package/dist/server/storage/files/catalogue.d.ts +1 -1
  68. package/dist/server/storage/files/catalogue.js +4 -4
  69. package/dist/server/storage/files/chunkedUpload.d.ts +2 -2
  70. package/dist/server/storage/files/chunkedUpload.js +1 -1
  71. package/dist/server/storage/files/fileRoutes.d.ts +1 -1
  72. package/dist/server/storage/files/fileRoutes.js +4 -4
  73. package/dist/server/storage/files/mimeByExt.js +1 -1
  74. package/dist/server/storage/files/stack.d.ts +2 -2
  75. package/dist/server/storage/files/types.d.ts +4 -4
  76. package/dist/server/storage/files/types.js +1 -1
  77. package/dist/server/storage/index.js +1 -1
  78. package/dist/server/storage/objectStoreMediaStore.js +1 -1
  79. package/dist/server/storage/transcodeJobs.js +5 -5
  80. package/dist/server/storage/types.d.ts +1 -1
  81. package/dist/server/storage/types.js +1 -1
  82. package/dist/server/storage/videoDerivativeKeys.d.ts +1 -1
  83. package/dist/server/storage/videoDerivativeKeys.js +1 -1
  84. package/dist/server/storage/videoProcessor.js +1 -1
  85. package/dist/server/sync/status.d.ts +1 -1
  86. package/dist/server/zipStream.d.ts +1 -1
  87. package/dist/server/zipStream.js +1 -1
  88. package/docs/activity.md +2 -2
  89. package/docs/retention.md +2 -2
  90. package/package.json +1 -1
  91. package/src/leafSubpathsImportNothing.spec.ts +1 -1
  92. package/src/namedSubpathsResolve.spec.ts +1 -1
  93. package/src/noTimerDialsAPeer.spec.ts +1 -1
  94. package/src/nodeBuiltinsAreProbedByCalling.spec.ts +1 -1
  95. package/src/publishShape.spec.ts +1 -1
  96. package/src/server/activity/store.ts +1 -1
  97. package/src/server/analytics/injectedScripts.spec.ts +1 -1
  98. package/src/server/analytics/injectedScripts.ts +1 -1
  99. package/src/server/analytics/webAnalytics.ts +1 -1
  100. package/src/server/auth/loginThrottleDurable.ts +3 -3
  101. package/src/server/auth/passwordCost.ts +1 -1
  102. package/src/server/bench/cpuBudget.spec.ts +1 -1
  103. package/src/server/bench/tail.spec.ts +1 -1
  104. package/src/server/ctgrChunkDurable.ts +1 -1
  105. package/src/server/d1/backup.spec.ts +1 -1
  106. package/src/server/d1/backup.ts +1 -1
  107. package/src/server/d1/http.ts +2 -2
  108. package/src/server/d1/invocation.spec.ts +1 -1
  109. package/src/server/d1/invocation.ts +1 -1
  110. package/src/server/d1/limits.ts +1 -1
  111. package/src/server/d1/pullD1.spec.ts +9 -1
  112. package/src/server/d1/pullD1.ts +5 -2
  113. package/src/server/d1/scheduling.ts +1 -1
  114. package/src/server/d1/types.ts +1 -1
  115. package/src/server/d1/values.ts +1 -1
  116. package/src/server/dropzone/index.ts +8 -0
  117. package/src/server/dropzone/report.spec.ts +275 -0
  118. package/src/server/dropzone/report.ts +568 -0
  119. package/src/server/dropzone/scan.spec.ts +2 -2
  120. package/src/server/dropzone/scan.ts +68 -5
  121. package/src/server/engagement/engagement.spec.ts +1 -1
  122. package/src/server/engagement/index.ts +1 -1
  123. package/src/server/google-oauth/googleOAuth.spec.ts +1 -1
  124. package/src/server/guard/argon2Binding.ts +1 -1
  125. package/src/server/guard/kdfWorkerEntry.ts +2 -2
  126. package/src/server/incidents/index.ts +1 -1
  127. package/src/server/incidents/store.ts +1 -1
  128. package/src/server/jobs/timeout.ts +1 -1
  129. package/src/server/master-lock/accountsPage.spec.ts +2 -2
  130. package/src/server/master-lock/accountsPage.ts +2 -2
  131. package/src/server/master-lock/beaconNeverReachesTheWall.spec.ts +2 -2
  132. package/src/server/master-lock/guard.spec.ts +2 -2
  133. package/src/server/master-lock/guard.ts +1 -1
  134. package/src/server/master-lock/lockPage.spec.ts +1 -1
  135. package/src/server/master-lock/lockPage.ts +2 -2
  136. package/src/server/master-lock/masterLock.spec.ts +1 -1
  137. package/src/server/master-lock/masterLock.ts +2 -2
  138. package/src/server/master-lock/sessions.spec.ts +1 -1
  139. package/src/server/metrics/normalizeRoute.ts +1 -1
  140. package/src/server/metrics/telemetrySink.ts +3 -3
  141. package/src/server/middleware/bodyLimit.spec.ts +1 -1
  142. package/src/server/middleware/zValidator.spec.ts +3 -3
  143. package/src/server/middleware/zValidator.ts +3 -3
  144. package/src/server/notifications/hub.ts +1 -1
  145. package/src/server/requestLog/requestMetrics.spec.ts +2 -2
  146. package/src/server/requestLog/requestMetrics.ts +3 -3
  147. package/src/server/retention/archive.spec.ts +2 -2
  148. package/src/server/retention/archive.ts +2 -2
  149. package/src/server/satellite/config.ts +2 -2
  150. package/src/server/satellite/door.ts +1 -1
  151. package/src/server/satellite/satellite.spec.ts +1 -1
  152. package/src/server/sharing/contract.ts +1 -1
  153. package/src/server/storage/binaryServerProcessing.spec.ts +1 -1
  154. package/src/server/storage/binaryServerProcessing.ts +4 -4
  155. package/src/server/storage/binaryStore.spec.ts +6 -6
  156. package/src/server/storage/binaryStore.ts +4 -4
  157. package/src/server/storage/chunked.integration.spec.ts +2 -2
  158. package/src/server/storage/derivatives.ts +2 -2
  159. package/src/server/storage/fileUploadClient.integration.spec.ts +1 -1
  160. package/src/server/storage/files/adapter.photo.spec.ts +2 -2
  161. package/src/server/storage/files/adapter.spec.ts +3 -3
  162. package/src/server/storage/files/adapter.ts +10 -10
  163. package/src/server/storage/files/catalogue.spec.ts +1 -1
  164. package/src/server/storage/files/catalogue.ts +4 -4
  165. package/src/server/storage/files/chunkedUpload.spec.ts +5 -5
  166. package/src/server/storage/files/chunkedUpload.ts +3 -3
  167. package/src/server/storage/files/fileRoutes.spec.ts +3 -3
  168. package/src/server/storage/files/fileRoutes.ts +5 -5
  169. package/src/server/storage/files/mimeByExt.ts +1 -1
  170. package/src/server/storage/files/stack.ts +3 -3
  171. package/src/server/storage/files/types.ts +6 -6
  172. package/src/server/storage/index.ts +1 -1
  173. package/src/server/storage/objectStoreMediaStore.ts +1 -1
  174. package/src/server/storage/sources.ts +1 -1
  175. package/src/server/storage/transcodeJobs.ts +5 -5
  176. package/src/server/storage/types.ts +2 -2
  177. package/src/server/storage/uploadSession.spec.ts +1 -1
  178. package/src/server/storage/videoDerivativeKeys.spec.ts +3 -3
  179. package/src/server/storage/videoDerivativeKeys.ts +1 -1
  180. package/src/server/storage/videoProcessor.ts +1 -1
  181. package/src/server/sync/status.ts +1 -1
  182. package/src/server/sync/timer.spec.ts +1 -1
  183. package/src/server/worker-argon2/index.spec.ts +1 -1
  184. package/src/server/zipStream.spec.ts +2 -2
  185. package/src/server/zipStream.ts +1 -1
  186. package/src/shippedFilesAreTracked.spec.ts +2 -2
@@ -51,7 +51,7 @@ export type FilePage = {
51
51
  items: FileRecord[];
52
52
  nextCursor?: string;
53
53
  };
54
- /** Every listing order the catalogue understands — the single source of truth the route layer
54
+ /** Every listing order the catalog understands — the single source of truth the route layer
55
55
  * validates against and the `FileSort` union derives from. `recent` = newest first (default);
56
56
  * `oldest` = oldest first; `name` = A→Z; `size` = largest first; `random` = a seeded shuffle
57
57
  * (the seed is minted per session and folded into the cursor, so a visit reshuffles but its own
@@ -85,7 +85,7 @@ export type ListFilesOptions = {
85
85
  /** Server-authoritative smart-view classification, computed ONCE at write time and stored.
86
86
  * `isText` (a non-binary inline file) ⇒ code; else by mime. */
87
87
  export declare function classifyFileType(mime: string, isText?: boolean): FileType;
88
- /** The catalogue contract. A SQLite implementation is the production default; the interface lets
88
+ /** The catalog contract. A SQLite implementation is the production default; the interface lets
89
89
  * an app swap it. All calls are owner-scoped via {@link MediaCtx} (one tenant never sees another). */
90
90
  /** Cheap owner-scoped aggregates (COUNT/SUM over the files table) — the admin
91
91
  * surface's "site stats" source. */
@@ -111,7 +111,7 @@ export interface FileCatalogue {
111
111
  tags?: string[];
112
112
  }): Promise<FileRecord>;
113
113
  /** Register bytes uploaded OUT OF BAND (a chunked upload sent direct to the backend) — insert the
114
- * row + kick processing WITHOUT re-storing bytes (they already sit at the catalogue's key for this
114
+ * row + kick processing WITHOUT re-storing bytes (they already sit at the catalog's key for this
115
115
  * id: fsSourceKey for video, fileBinaryKey otherwise). */
116
116
  registerUploaded(ctx: MediaCtx, upload: {
117
117
  id: string;
@@ -148,7 +148,7 @@ export interface FileCatalogue {
148
148
  restore(ctx: MediaCtx, id: string): Promise<void>;
149
149
  /** Ingest file(s) from a LOCAL path already on this host's disk (a directory imports every
150
150
  * regular file inside it, recursively; a file imports just itself). Each imported file is
151
- * tagged with its immediate containing folder name (the catalogue is flat — folder structure
151
+ * tagged with its immediate containing folder name (the catalog is flat — folder structure
152
152
  * survives as a tag, not a tree) plus any `tags` passed. Unreadable/unsupported entries are
153
153
  * skipped, not thrown — the return value reports both. */
154
154
  importFromPath(ctx: MediaCtx, absPath: string, opts?: {
@@ -1,4 +1,4 @@
1
- /** Every listing order the catalogue understands — the single source of truth the route layer
1
+ /** Every listing order the catalog understands — the single source of truth the route layer
2
2
  * validates against and the `FileSort` union derives from. `recent` = newest first (default);
3
3
  * `oldest` = oldest first; `name` = A→Z; `size` = largest first; `random` = a seeded shuffle
4
4
  * (the seed is minted per session and folded into the cursor, so a visit reshuffles but its own
@@ -9,7 +9,7 @@ export { DERIVATIVE_SUFFIXES, hlsMasterKeyFor, hlsPrefixFor, isDerivativeKey, po
9
9
  export { createBinaryServerStore } from './binaryServerStore.js';
10
10
  export { createBinaryServerProcessing, } from './binaryServerProcessing.js';
11
11
  // The transcode API as a plain job client, for apps whose binaries do NOT live in the file
12
- // catalogue (apps/notes keys attachments by sha256). One derivative pipeline, two doors.
12
+ // catalog (apps/notes keys attachments by sha256). One derivative pipeline, two doors.
13
13
  export { createTranscodeJobClient, } from './transcodeJobs.js';
14
14
  export { createDiskStore } from './diskStore.js';
15
15
  // The FileCatalogue: a SQLite-backed tagged flat file system over this storage layer — one
@@ -7,7 +7,7 @@
7
7
  // fork the whole transcode orchestrator onto a second store type, the asset
8
8
  // `transcode` handler wraps its `ObjectStore` in this adapter and reuses the
9
9
  // pipeline unchanged. There is deliberately NO `localPath`, so `processVideo`
10
- // materialises the source by download — correct for a stream store where the
10
+ // materializes the source by download — correct for a stream store where the
11
11
  // bytes may live off-box (S3/R2).
12
12
  const streamToBytes = async (stream) => new Uint8Array(await new Response(stream).arrayBuffer());
13
13
  const bytesToStream = (bytes) => new ReadableStream({
@@ -3,12 +3,12 @@
3
3
  //
4
4
  // It was already here, inlined inside `createBinaryServerProcessing`, but only reachable
5
5
  // through that module's two seams (`VideoProcessor` / `ImageDerivatives`), which are shaped
6
- // for the cursedbelt file CATALOGUE: they take a `MediaStore`, a `workDir`, an owner and a
7
- // catalogue id. An app that stores binaries some other way — apps/notes keys attachments by
8
- // sha256 through satellite-kit's binary-store and has no catalogue at all — could not reach
9
- // the pipeline without either adopting the catalogue or writing a second HTTP client.
6
+ // for the cursedbelt file CATALOG: they take a `MediaStore`, a `workDir`, an owner and a
7
+ // catalog id. An app that stores binaries some other way — apps/notes keys attachments by
8
+ // sha256 through satellite-kit's binary-store and has no catalog at all — could not reach
9
+ // the pipeline without either adopting the catalog or writing a second HTTP client.
10
10
  //
11
- // So the transport lives here and the catalogue seams are built on top of it. There is ONE
11
+ // So the transport lives here and the catalog seams are built on top of it. There is ONE
12
12
  // derivative pipeline in the fleet, and this is its entry point.
13
13
  //
14
14
  // ── Why binary-server rather than deriving locally ──────────────────────────────────────
@@ -173,7 +173,7 @@ export interface PhotoSource {
173
173
  recordView?(ctx: MediaCtx, photoId: string): Promise<void>;
174
174
  }
175
175
  /** A source of MIXED media (photos + videos) for a combined gallery — the union of
176
- * {@link MediaSource} and {@link PhotoSource} over ONE catalogue. `list`/`resolve`
176
+ * {@link MediaSource} and {@link PhotoSource} over ONE catalog. `list`/`resolve`
177
177
  * yield `GalleryMedia` (a `mediaKind`-tagged photo|video), and a `kind` filter narrows
178
178
  * to just photos or just videos. Same cursor/tag/sort listing contract as its siblings. */
179
179
  export interface MediaGallerySource {
@@ -11,7 +11,7 @@
11
11
  // no packages resolvable at all and fails if it throws, so an `import` here that survives
12
12
  // transpilation (anything that is not `import type`) turns that spec red rather than turning
13
13
  // up in a consumer's install. The subpath exists because `./server/storage`'s own index is a
14
- // barrel: it reaches `streamToken` → `auth/jwt` → jose, the whole SQLite file catalogue under
14
+ // barrel: it reaches `streamToken` → `auth/jwt` → jose, the whole SQLite file catalog under
15
15
  // `files/`, and a lazily-imported `sharp` — while an app that wants only the SHAPE of a file
16
16
  // token (apps/collections wanted exactly `FileTokenClaims`, a type TypeScript erases) was made
17
17
  // to install a one-time-password library to get it. Add types here freely; add a value import
@@ -26,7 +26,7 @@
26
26
  * FileCatalogue: a caller that holds an owner and an item id, whose derivatives live in their
27
27
  * own top-level namespaces. This module addresses a caller that holds a binary-server KEY and
28
28
  * derives sibling names from it, which is what makes "ask /meta for a name you computed" work
29
- * with no catalogue at all.
29
+ * with no catalog at all.
30
30
  *
31
31
  * Two consumers, two shapes, both correct:
32
32
  * · `fs*` — cursedbelt's own FileCatalogue / the `library` transcode strategy.
@@ -26,7 +26,7 @@
26
26
  * FileCatalogue: a caller that holds an owner and an item id, whose derivatives live in their
27
27
  * own top-level namespaces. This module addresses a caller that holds a binary-server KEY and
28
28
  * derives sibling names from it, which is what makes "ask /meta for a name you computed" work
29
- * with no catalogue at all.
29
+ * with no catalog at all.
30
30
  *
31
31
  * Two consumers, two shapes, both correct:
32
32
  * · `fs*` — cursedbelt's own FileCatalogue / the `library` transcode strategy.
@@ -64,7 +64,7 @@ export async function processVideo(opts) {
64
64
  await mkdir(jobDir, { recursive: true });
65
65
  try {
66
66
  report('processing', 1);
67
- // 1. Materialise the source locally for ffmpeg (use the backend's own path if local).
67
+ // 1. Materialize the source locally for ffmpeg (use the backend's own path if local).
68
68
  let srcPath = (await store.localPath?.(sourceKey)) ?? null;
69
69
  if (!srcPath) {
70
70
  const bytes = await store.get(sourceKey);
@@ -43,7 +43,7 @@ export interface SyncStatusReporter {
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
45
  * 2026-08-16 report — prod saying *"Awaiting first sync"* over a vault he had used
46
- * for weeks. The badge's own words are "your Mac has not dialled since this server
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
49
49
  * minutes only while the Mac is awake — so the window in which a perfectly converged
@@ -87,7 +87,7 @@ export declare function dosDateTime(when: Date | string | null | undefined): {
87
87
  * want `Notes/Summary.md` produce `Summary.md` and `Summary (2).md`, because a zip with two
88
88
  * identical names extracts as one file, silently losing the other. A duplicate FOLDER is written
89
89
  * once: its files already land in it. Names are compared the way the person's disk will compare
90
- * them — case-folded and Unicode-normalised, since macOS and Windows both treat `Todo.md` and
90
+ * them — case-folded and Unicode-normalized, since macOS and Windows both treat `Todo.md` and
91
91
  * `todo.md` as ONE file — so the later one is numbered rather than overwriting the first on unzip.
92
92
  *
93
93
  * A member that cannot be read (its `open()` returns `null` or throws, or the caller yielded it
@@ -181,7 +181,7 @@ function asStream(body) {
181
181
  * want `Notes/Summary.md` produce `Summary.md` and `Summary (2).md`, because a zip with two
182
182
  * identical names extracts as one file, silently losing the other. A duplicate FOLDER is written
183
183
  * once: its files already land in it. Names are compared the way the person's disk will compare
184
- * them — case-folded and Unicode-normalised, since macOS and Windows both treat `Todo.md` and
184
+ * them — case-folded and Unicode-normalized, since macOS and Windows both treat `Todo.md` and
185
185
  * `todo.md` as ONE file — so the later one is numbered rather than overwriting the first on unzip.
186
186
  *
187
187
  * A member that cannot be read (its `open()` returns `null` or throws, or the caller yielded it
package/docs/activity.md CHANGED
@@ -24,7 +24,7 @@ value of the column:
24
24
  | `error` | the app **failed** to do what it meant to do | whoever maintains the app |
25
25
 
26
26
  A refusal recorded as `error` makes the app look broken exactly when it worked, and buries its
27
- real failures under correct behaviour; a failure recorded as `denied` hides a bug as a policy.
27
+ real failures under correct behavior; a failure recorded as `denied` hides a bug as a policy.
28
28
  `roms` records BOTH halves of an upload for this reason: an accepted one puts a file on the
29
29
  owner's storage under his name, and a refused one — `denied` — is the row that answers "I tried
30
30
  to add that game weeks ago".
@@ -33,7 +33,7 @@ to add that game weeks ago".
33
33
 
34
34
  Identical to `cursedbelt-core/sharing`'s `ShareResource`, so a resource passes from one
35
35
  primitive to the other with no translation (`activityFromShareEvent`). `app` is on every row so
36
- a merge across apps stays labelled.
36
+ a merge across apps stays labeled.
37
37
 
38
38
  ## 4. Describing an event is the library's job
39
39
 
package/docs/retention.md CHANGED
@@ -17,7 +17,7 @@ Why by category rather than by table:
17
17
 
18
18
  - **Long-term data is protected by ABSENCE.** There is no category that can describe a note, a
19
19
  setting, a password, a save state, a playlist or a vault entry. "Should this table have a
20
- policy?" is answered by whether an honest category exists, not by somebody's judgement on
20
+ policy?" is answered by whether an honest category exists, not by somebody's judgment on
21
21
  the day — and a new table is safe by default, because it is not swept until it is declared.
22
22
  - **The number is the category's, not the app's.** Every deleting category defaults to the
23
23
  owner's two-week standard or shorter. A deleting category that wanted a longer default would
@@ -53,7 +53,7 @@ it is that the thing should not be accumulating.
53
53
 
54
54
  ## 6. A threshold is tuned against the CORPUS, never against the story
55
55
 
56
- `apps/music/scripts/backup.ts:172-190` records the failure: a refusal keyed on "a catalogue
56
+ `apps/music/scripts/backup.ts:172-190` records the failure: a refusal keyed on "a catalog
57
57
  with tracks and no organizing work must be a stage database" was written from the story, and
58
58
  the live corpus at cutover (5,391 tracks, 0 playlists, 0 tags) would have tripped it nightly on
59
59
  a healthy library. Before a retention or refusal number ships, measure it against what the app
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cursedbelt-server",
3
- "version": "4.48.0",
3
+ "version": "4.49.0",
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.",
@@ -141,7 +141,7 @@ const LEAVES = [
141
141
  * in 4.1.0 from five app-side copies, and it is the module that decides whether a ROM
142
142
  * byte, a photograph, a song and a scanned document are readable — so every app takes
143
143
  * it, and none of them may pay `sharp`/`otplib`/`kysely` for the privilege. It sits
144
- * in `src/server/storage/` beside the file-catalogue and transcode graph, which is
144
+ * in `src/server/storage/` beside the file-catalog and transcode graph, which is
145
145
  * exactly the barrel this must never be reached through: `./storage`'s index is heavy
146
146
  * and this module's whole point is that it costs `node:crypto` and nothing else.
147
147
  * Its batched `/internal/ops/meta` client (4.47.0) is a sibling that imports nothing.
@@ -103,7 +103,7 @@ describe('subpaths named in this repo resolve', () => {
103
103
  });
104
104
 
105
105
  it('knows what the manifest exports', () => {
106
- // If `exports` is ever read wrong, every offence below silently becomes one.
106
+ // If `exports` is ever read wrong, every offense below silently becomes one.
107
107
  expect(exported.has('')).toBe(true); // the "." root entry
108
108
  expect(exported.has('/master-lock')).toBe(true);
109
109
  expect(exported.has('/react')).toBe(false); // the react tier stayed in `cursedbelt` at the 2026-09-15 split
@@ -46,7 +46,7 @@ import { fileURLToPath } from 'node:url';
46
46
  * dependency: `sync/timer.ts`'s callback calls `deps.sync(peer)`, which dials, and
47
47
  * that is legitimate (it is the push). A reintroduced `deps.checkRequest(peer)`
48
48
  * would be structurally identical and this check would miss it. Nothing static can
49
- * separate those two — so the strict measurement is **behavioural** and lives in
49
+ * separate those two — so the strict measurement is **behavioral** and lives in
50
50
  * `sync/timer.spec.ts` ("a healthy peer with no local news is dialed ONCE at boot,
51
51
  * then never", 24 simulated hours) and `sync/signal.spec.ts` ("a connected client
52
52
  * issues exactly ONE outbound request, forever"). Those two bound the sync engine
@@ -46,7 +46,7 @@ import { fileURLToPath } from 'node:url';
46
46
  * ## The excuse, and why there is one
47
47
  *
48
48
  * A line carrying `probe-by-calling:ignore` (on it, or on the line above) is allowed — for
49
- * the one honest use left: labelling. `cpuClock.ts` decides by calling and then uses a
49
+ * the one honest use left: labeling. `cpuClock.ts` decides by calling and then uses a
50
50
  * presence check only to say `(absent)` or `(throws)` in the clock's source string. Excuse
51
51
  * the LINE, never delete the rule.
52
52
  *
@@ -65,7 +65,7 @@ describe('publish shape', () => {
65
65
  // npm rejects a "./"-prefixed bin value, calls the NAME invalid, and drops
66
66
  // the entry — with a warning, not an error. The package publishes fine and
67
67
  // installs with no CLI at all. Invisible under a file: link, where the bin
68
- // is linked from the source manifest before npm ever normalises it.
68
+ // is linked from the source manifest before npm ever normalizes it.
69
69
  const bin = (pkg as { bin?: Record<string, string> }).bin ?? {};
70
70
  const prefixed = Object.entries(bin).filter(([, v]) => v.startsWith('./'));
71
71
  expect(
@@ -19,7 +19,7 @@
19
19
  * ```
20
20
  *
21
21
  * ── 🔴 Four properties this file exists to guarantee ────────────────────────
22
- * 1. **Append only.** No update verb, no delete verb, no `TRUNCATE`. Ageing
22
+ * 1. **Append only.** No update verb, no delete verb, no `TRUNCATE`. Aging
23
23
  * rows out is the fleet retention standard's job, through a declaration the
24
24
  * owner can see (`satellite-kit/retention`) — never a silent cutoff here.
25
25
  * 2. **A source is READ, never copied.** `share_events` stays the canonical
@@ -9,7 +9,7 @@ const PAGE = "https://collections.cursedalchemy.com/";
9
9
  * The tag Cloudflare's Automatic Setup appended, byte-for-byte as the zone emitted it on
10
10
  * 2026-09-18 — pinned path, integrity hash, `crossorigin` and all. It is kept in its
11
11
  * AUTOMATIC spelling on purpose: this is the shape that was arriving unasked-for, and a
12
- * checker that only recognised the manual snippet would go quiet the moment somebody turned
12
+ * checker that only recognized the manual snippet would go quiet the moment somebody turned
13
13
  * auto-install back on.
14
14
  */
15
15
  const BEACON =
@@ -41,7 +41,7 @@ export interface InjectedScript {
41
41
  * Every `<script src=…>` in `html` whose origin is NOT `pageUrl`'s.
42
42
  *
43
43
  * Inline scripts are ignored: they are the page's own (most shells here ship one, a pre-paint
44
- * colour-scheme script) and a CSP that refuses them is a different finding from this one.
44
+ * color-scheme script) and a CSP that refuses them is a different finding from this one.
45
45
  * `data:` and `blob:` are ignored for the same reason — neither is a host anything could have
46
46
  * injected.
47
47
  */
@@ -139,7 +139,7 @@ export const WEB_ANALYTICS_PUBLIC_HOST = "cursedalchemy.com";
139
139
  *
140
140
  * A device in GET-only mode (`cursedbelt-core/ctgr-client`) sits behind something that drops
141
141
  * every non-GET, and the beacon reports with a POST to the page's `/cdn-cgi/rum`. It cannot be
142
- * tunnelled the way our own API is — the script is Cloudflare's — so there it only ever failed,
142
+ * tunneled the way our own API is — the script is Cloudflare's — so there it only ever failed,
143
143
  * a red line per page view, and recorded nothing. Not loading it loses no data (2026-10-08).
144
144
  *
145
145
  * The guard reads the URL as well as `localStorage.ctgr`: this script runs before the app's
@@ -11,7 +11,7 @@
11
11
  * spread across N isolates gets N × the global allowance the header calls "the actual defense".
12
12
  *
13
13
  * A Durable Object is the exact shape of the fix: one instance addressed by name, requests to it
14
- * serialised, so every isolate in every colo meets the same counts. It runs the SAME
14
+ * serialized, so every isolate in every colo meets the same counts. It runs the SAME
15
15
  * `createLoginThrottle` algorithm — nothing here re-decides a threshold or a delay — and persists
16
16
  * the ledger to the object's storage after every change, so the object's own eviction (minutes
17
17
  * idle, measured on patterns' live object) forgets nothing either.
@@ -20,10 +20,10 @@
20
20
  * The throttle is checked BEFORE argon2, on every attempt, and the point of checking first is
21
21
  * that a refused attempt is cheap. A D1 read-modify-write per attempt is a query against the
22
22
  * invocation's 1,000-query budget and, worse, not atomic across concurrent invocations: two
23
- * guesses that snapshot the same count both write count+1. The object serialises for free.
23
+ * guesses that snapshot the same count both write count+1. The object serializes for free.
24
24
  *
25
25
  * ── `attempt` is one operation, not two ─────────────────────────────────────
26
- * `/throttle/attempt` checks and charges in one serialised step, so a burst of concurrent guesses
26
+ * `/throttle/attempt` checks and charges in one serialized step, so a burst of concurrent guesses
27
27
  * is admitted only up to the threshold rather than all at once against one stale count. See
28
28
  * `loginThrottle.ts`'s `attempt` section.
29
29
  *
@@ -14,7 +14,7 @@
14
14
  * production cost 52.85 s
15
15
  * test cost 7.32 s
16
16
  *
17
- * Eighty-six per cent of what was, that morning, the largest single workspace in
17
+ * Eighty-six percent of what was, that morning, the largest single workspace in
18
18
  * `verify:scoped` — paid by every agent on every branch touching auth or any shared
19
19
  * package, and again on every union gate.
20
20
  *
@@ -328,7 +328,7 @@ describe('the bench runner', () => {
328
328
  *
329
329
  * Filed 2026-09-19 by the `collections` port — the first app to mount this harness — which
330
330
  * had to leave `POST /api/duplicates/rescan` and `POST /api/recycle/purge`, the only two
331
- * routes in it whose cost is O(catalogue), declared but unbenched for exactly this reason.
331
+ * routes in it whose cost is O(catalog), declared but unbenched for exactly this reason.
332
332
  */
333
333
  describe('a destructive case — the fixture rebuild between iterations', () => {
334
334
  /** ~4 CPU-ms per item held, ~0 CPU-ms when the library is empty. */
@@ -55,7 +55,7 @@ describe('recordTailTraces', () => {
55
55
  expect(report.routes.map((r) => r.key)).toEqual(['GET /api/items/:id']);
56
56
  });
57
57
 
58
- it('🔴 refuses a PROXY recorder — real numbers may not be labelled a proxy, nor the reverse', () => {
58
+ it('🔴 refuses a PROXY recorder — real numbers may not be labeled a proxy, nor the reverse', () => {
59
59
  const recorder = createCpuRecorder({ clock: processCpuClock(), config: BUDGETS });
60
60
  expect(() => recordTailTraces(recorder, [])).toThrow(/is a PROXY/);
61
61
  });
@@ -18,7 +18,7 @@
18
18
  *
19
19
  * ── One object per payload ───────────────────────────────────────────────────
20
20
  * Addressed by `ctgr:<_cid>` (a `crypto.randomUUID()` the client mints per request), so the
21
- * chunks of one request are serialised through one object and different requests never
21
+ * chunks of one request are serialized through one object and different requests never
22
22
  * contend. The partial lives in the object's memory: chunks arrive milliseconds apart, the idle
23
23
  * TTL is 30 s, and an object is only evicted after minutes idle — a partial it loses is one a
24
24
  * deploy would have lost too. An object holding nothing costs nothing.
@@ -98,7 +98,7 @@ describe('the D1 half records a coordinate instead of copying bytes', () => {
98
98
 
99
99
  test('🔴 it reports needsPeriodicCapture: false — Time Travel is automatic', () => {
100
100
  // A nightly no-op job logging "backup complete" is worse than no job, because it
101
- // reads as evidence. A scheduler must honour this flag.
101
+ // reads as evidence. A scheduler must honor this flag.
102
102
  expect(createTimeTravelBackup({ databaseName: 'patterns' }).needsPeriodicCapture).toBe(false);
103
103
  });
104
104
 
@@ -67,7 +67,7 @@ export interface TimeTravelOpts {
67
67
  /**
68
68
  * The D1 implementation: record the coordinate, because retention is automatic.
69
69
  *
70
- * 🔴 It reports `needsPeriodicCapture: false`, and a scheduler must honour that rather
70
+ * 🔴 It reports `needsPeriodicCapture: false`, and a scheduler must honor that rather
71
71
  * than calling `capture()` on a timer — a nightly no-op job that logs "backup complete"
72
72
  * is worse than no job, because it reads as evidence.
73
73
  */
@@ -10,12 +10,12 @@
10
10
  * the only other door into D1 was a per-app bearer route on the Worker for each one.
11
11
  *
12
12
  * So the Mac gets the same {@link D1LikeDatabase} a Worker holds, pointed at the same
13
- * database, and the app's own catalogue code runs unchanged against production — ONE writer
13
+ * database, and the app's own catalog code runs unchanged against production — ONE writer
14
14
  * of the rows, one schema, one set of statements.
15
15
  *
16
16
  * ── How ──────────────────────────────────────────────────────────────────────────────────
17
17
  * It is a {@link D1BindingLike} over `POST /accounts/:account/d1/database/:db/query` (and
18
- * `/raw`), handed to {@link createRemoteD1} — so every value normalisation, limit check and
18
+ * `/raw`), handed to {@link createRemoteD1} — so every value normalization, limit check and
19
19
  * `success: false` guard is the binding driver's own, not a second copy that could drift.
20
20
  * `batch()` sends `{ batch: [...] }`, which D1 runs as one unit exactly as a binding's batch
21
21
  * does: measured 2026-09-23 on a throwaway database, a batch whose second statement violated
@@ -129,7 +129,7 @@ describe('the per-invocation query budget', () => {
129
129
  expect(db.used).toBe(0);
130
130
  });
131
131
 
132
- test('a budget above D1\'s real cap is refused rather than honoured', () => {
132
+ test('a budget above D1\'s real cap is refused rather than honored', () => {
133
133
  expect(() => perInvocation(base, { max: LIMITS.queriesPerInvocation + 1 })).toThrow(D1LimitError);
134
134
  expect(() => perInvocation(base, { max: 0 })).toThrow(RangeError);
135
135
  expect(() => perInvocation(base, { max: 1.5 })).toThrow(RangeError);
@@ -170,7 +170,7 @@ export function perInvocation(db: D1LikeDatabase, opts: { max?: number } = {}):
170
170
  'queries per Worker invocation',
171
171
  max,
172
172
  LIMITS.queriesPerInvocation,
173
- 'A budget above D1\'s own cap cannot be honoured — the service refuses first. Lower it, or split the work across invocations.',
173
+ 'A budget above D1\'s own cap cannot be honored — the service refuses first. Lower it, or split the work across invocations.',
174
174
  );
175
175
  }
176
176
  const budget = new Budget(max);
@@ -226,7 +226,7 @@ export function chunkForBind<T>(items: readonly T[], paramsPerItem: number): T[]
226
226
  * `WHERE … ORDER BY … LIMIT ? OFFSET ?` page and the `COUNT(*)` beside it), and on a write
227
227
  * it trades one atomic statement for a batch that is atomic only per chunk. `json_each`
228
228
  * over a JSON array is one parameter however long the list is, keeps the statement whole,
229
- * and SQLite still drives the column's index through the materialised set.
229
+ * and SQLite still drives the column's index through the materialized set.
230
230
  *
231
231
  * The array travels as one TEXT value, so the ceiling moves from 100 ids to
232
232
  * `LIMITS.valueBytes` (2 MB) of JSON — about 70,000 of this fleet's 25-character ids — and
@@ -324,7 +324,7 @@ describe('pulling D1 down — paged SELECTs, table by table, never an export', (
324
324
 
325
325
  test('a page that blips is asked again at the SAME size — a wire failure is not a page too large', async () => {
326
326
  const source = live("INSERT INTO items VALUES ('i1', 'a');");
327
- // wrangler's coloured form, as patterns' log has it.
327
+ // wrangler's colored form, as patterns' log has it.
328
328
  const { run, seen } = blipping(source, (sql) => sql.includes('FROM "items"'), 1, '✘ \u001b[1mfetch failed\u001b[0m');
329
329
  const slept: number[] = [];
330
330
  await pullWaiting(scratch(), run, slept);
@@ -336,6 +336,14 @@ describe('pulling D1 down — paged SELECTs, table by table, never an export', (
336
336
  expect(slept).toEqual([WAITS[0] as number]);
337
337
  });
338
338
 
339
+ test("🔴 wrangler crashing on `setTypeOfService EINVAL` is a dropped connection, waited out (vault, 2026-10-23)", async () => {
340
+ const source = live("INSERT INTO items VALUES ('i1', 'a');");
341
+ const said = 'error: could not list D1\'s tables: …\nerror: setTypeOfService EINVAL\n errno: -22,\n syscall: "setTypeOfService",\n code: "EINVAL"';
342
+ const slept: number[] = [];
343
+ await pullWaiting(scratch(), blipping(source, (sql) => sql.includes('sqlite_master'), 1, said).run, slept);
344
+ expect(slept).toEqual([WAITS[0] as number]);
345
+ });
346
+
339
347
  test('a wire that stays down still REFUSES, with its own words, after every wait', async () => {
340
348
  const source = live("INSERT INTO items VALUES ('i1', 'a');");
341
349
  const slept: number[] = [];
@@ -244,12 +244,15 @@ export const TRANSIENT_WAITS_MS: readonly number[] = [5_000, 20_000, 60_000];
244
244
 
245
245
  /**
246
246
  * A failure of the WIRE between this Mac and Cloudflare, not an answer from D1 — which asking
247
- * again a little later fixes. Only these are waited out — a refusal D1 actually made (a page too
247
+ * again a little later fixes. `setTypeOfService EINVAL` is one in disguise: undici sets the socket's
248
+ * TOS before every request, and macOS answers `setsockopt` on a connection the peer already reset
249
+ * with EINVAL — so under Bun a dropped connection crashes wrangler with it instead of ECONNRESET
250
+ * (vault's and auth's nightly pulls, 2026-10-23, both under the background clamp's starved handshakes). Only these are waited out — a refusal D1 actually made (a page too
248
251
  * large, bad SQL, auth) is never retried here, so a page refused for its size still halves at
249
252
  * once instead of sleeping ~1.5 minutes per halving.
250
253
  */
251
254
  export const isTransient = (message: string): boolean =>
252
- /fetch failed|ECONNRESET|ECONNREFUSED|ETIMEDOUT|ENOTFOUND|EAI_AGAIN|socket hang up|network connection was lost/i.test(
255
+ /fetch failed|ECONNRESET|ECONNREFUSED|ETIMEDOUT|ENOTFOUND|EAI_AGAIN|socket hang up|network connection was lost|setTypeOfService EINVAL/i.test(
253
256
  message,
254
257
  );
255
258
 
@@ -31,7 +31,7 @@
31
31
  * a 6-field expression with a leading seconds column, and this repo already contains three
32
32
  * jobs declared `'* * * * * *'` — once per second. Those cannot become Cron Triggers at
33
33
  * all, and {@link classifySchedule} says so by name instead of silently rounding them up to
34
- * a minute, which would change behaviour in production and nowhere else.
34
+ * a minute, which would change behavior in production and nowhere else.
35
35
  */
36
36
 
37
37
  import type { D1LikeDatabase } from './types.js';
@@ -40,7 +40,7 @@
40
40
  *
41
41
  * D1 has no interactive transaction — there is no `BEGIN`/`COMMIT` over HTTP, only
42
42
  * {@link D1LikeDatabase.batch}, which is atomic and runs as one round trip. A local
43
- * driver that happily honoured `BEGIN` would be the sync-vs-async trap a third time, so
43
+ * driver that happily honored `BEGIN` would be the sync-vs-async trap a third time, so
44
44
  * {@link D1UnsupportedError} is thrown by both. Wrap the statements in `batch()` instead;
45
45
  * it is atomic on D1 and wrapped in a real `bun:sqlite` transaction locally, so the
46
46
  * guarantee is the same.
@@ -97,7 +97,7 @@ const LEADING_NOISE = /^(?:\s|--[^\n]*\n?|\/\*[\s\S]*?\*\/)+/;
97
97
  * Only a leading `SELECT` is claimed, because that is the one keyword that is
98
98
  * unambiguous: `WITH … INSERT … RETURNING` and `INSERT … RETURNING` both return rows AND
99
99
  * write. Anything this returns `false` for is measured exactly instead (see
100
- * `local.ts`), so a statement shape this does not recognise costs two extra queries —
100
+ * `local.ts`), so a statement shape this does not recognize costs two extra queries —
101
101
  * never a wrong number.
102
102
  */
103
103
  export const isPureReadSql = (sql: string): boolean => /^select\b/i.test(sql.replace(LEADING_NOISE, ''));
@@ -28,3 +28,11 @@ export {
28
28
  type DuplicateVerdict,
29
29
  type DuplicateQuestion,
30
30
  } from "./duplicates.js";
31
+ export {
32
+ createIngestReporter,
33
+ FILES_JOURNAL,
34
+ type FileOutcome,
35
+ type IngestReporter,
36
+ type ReportFile,
37
+ type SourceDrive,
38
+ } from "./report.js";