@adhd/backlog 0.1.7 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +29 -0
- package/client.d.ts +5 -0
- package/env.d.ts +33 -0
- package/index.js +83 -80
- package/index.mjs +3673 -3540
- package/package.json +4 -4
- package/store/serve-lock.d.ts +42 -0
- package/version-info.d.ts +15 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adhd/backlog",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.9",
|
|
4
4
|
"bin": {
|
|
5
5
|
"backlog": "index.js"
|
|
6
6
|
},
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
"@adhd/apigen-plugin-openapi": "^0.2.2",
|
|
16
16
|
"@adhd/environment": "^0.1.5",
|
|
17
17
|
"@adhd/environment-base-spec": "^0.1.0",
|
|
18
|
-
"@adhd/sox-graph-store": "^0.8.
|
|
19
|
-
"@adhd/sox-store-adapter": "^0.
|
|
20
|
-
"@adhd/sox-telemetry": "^0.2.
|
|
18
|
+
"@adhd/sox-graph-store": "^0.8.6",
|
|
19
|
+
"@adhd/sox-store-adapter": "^0.7.0",
|
|
20
|
+
"@adhd/sox-telemetry": "^0.2.1",
|
|
21
21
|
"pino": "10.3.1",
|
|
22
22
|
"pino-pretty": "13.1.3",
|
|
23
23
|
"yaml": "1.10.3"
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/** Thrown when another live process already holds the serve lock for this
|
|
2
|
+
* store. Carries the holder's pid and the lock file path so callers can
|
|
3
|
+
* surface both — refusing SILENTLY (a bare non-zero exit with no reason)
|
|
4
|
+
* is exactly the failure mode that let this incident go undetected. */
|
|
5
|
+
export declare class ServeLockHeldError extends Error {
|
|
6
|
+
readonly holderPid: number;
|
|
7
|
+
readonly lockPath: string;
|
|
8
|
+
constructor(holderPid: number, lockPath: string);
|
|
9
|
+
}
|
|
10
|
+
export interface ServeLockHandle {
|
|
11
|
+
/** Idempotent. Removes the lock file ONLY if it still names this process
|
|
12
|
+
* as holder (never deletes a lock a later process legitimately took over
|
|
13
|
+
* after detecting this one as stale — that would delete a live peer's
|
|
14
|
+
* lock out from under it). */
|
|
15
|
+
release: () => void;
|
|
16
|
+
}
|
|
17
|
+
/** `:memory:` has no filesystem identity — no cross-process concern, no lock. */
|
|
18
|
+
export declare function isLockableDbPath(dbPath: string): boolean;
|
|
19
|
+
/** Canonicalizes to the realpath when the file (or its parent dir) exists,
|
|
20
|
+
* so two spellings of the same store collapse to one lock identity; falls
|
|
21
|
+
* back to a plain absolute resolve when nothing on disk exists yet (a
|
|
22
|
+
* not-yet-created db is still a valid lock anchor — mirrors sox-ecosystem's
|
|
23
|
+
* `singleton.ts` `canonicalizePath`, reimplemented here for the same reason
|
|
24
|
+
* noted in this file's header). */
|
|
25
|
+
export declare function canonicalDbPath(dbPath: string): string;
|
|
26
|
+
export declare function serveLockPath(dbPath: string): string;
|
|
27
|
+
/**
|
|
28
|
+
* Acquire the `backlog serve` writer lock for `dbPath`. Fails LOUD and
|
|
29
|
+
* IMMEDIATELY (no spin-wait/retry-until-timeout — a refused `serve` should
|
|
30
|
+
* say why right now, not silently poll and eventually give up) when a live
|
|
31
|
+
* holder is found: throws {@link ServeLockHeldError} naming the holder's
|
|
32
|
+
* pid. A lock file whose recorded pid is no longer alive (crash, SIGKILL,
|
|
33
|
+
* native panic — the same "can't run cleanup code" cases
|
|
34
|
+
* `signal-cleanup.ts`'s own doc comment is honest about) is detected via a
|
|
35
|
+
* liveness probe on READ, not relied on to have been cleaned up by the dead
|
|
36
|
+
* process, and is reclaimed automatically.
|
|
37
|
+
*
|
|
38
|
+
* Call this BEFORE opening the store; release the returned handle only
|
|
39
|
+
* AFTER the store is fully closed (see this file's header re: the
|
|
40
|
+
* shutdown-window).
|
|
41
|
+
*/
|
|
42
|
+
export declare function acquireServeLock(dbPath: string): ServeLockHandle;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reports this running package's own real `name`/`version`, read fresh from
|
|
3
|
+
* `package.json` on every call (never a compiled-in constant, so a
|
|
4
|
+
* republished build can never drift from what this reports). Store-free —
|
|
5
|
+
* callable by `client.ts`'s `version()` (apigen-dispatched, ctx-carrying) and
|
|
6
|
+
* by `cli.ts`'s `version` short-circuit (never opens the store) identically.
|
|
7
|
+
* Returns the same `{ name, version }` shape `client.ts`'s `BacklogVersionInfo`
|
|
8
|
+
* declares; the return type is deliberately structural (not an import of that
|
|
9
|
+
* interface) so `client.ts`'s own extraction surface (`client.d.ts`) is
|
|
10
|
+
* byte-for-byte unchanged by this extraction.
|
|
11
|
+
*/
|
|
12
|
+
export declare function readBacklogVersionInfo(): {
|
|
13
|
+
name: string;
|
|
14
|
+
version: string;
|
|
15
|
+
};
|