@indigoai-us/hq-cli 5.345.215 → 5.345.217

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 (135) hide show
  1. package/CHANGELOG.md +141 -0
  2. package/README.md +45 -0
  3. package/assets/scaffold/core/scripts/lib/epochrealtime.sh +30 -0
  4. package/assets/scaffold/core/scripts/lib/work-mesh-enqueue.sh +12 -5
  5. package/dist/command-catalog.generated.d.ts +59 -4
  6. package/dist/command-catalog.generated.js +74 -4
  7. package/dist/command-help.js +3 -1
  8. package/dist/command-registration-plan.d.ts +6 -0
  9. package/dist/command-registration-plan.js +1 -0
  10. package/dist/commands/auth.d.ts +1 -1
  11. package/dist/commands/auth.js +11 -52
  12. package/dist/commands/bot.js +11 -4
  13. package/dist/commands/cloud-demote.d.ts +19 -4
  14. package/dist/commands/cloud-demote.js +85 -12
  15. package/dist/commands/cloud-provision.d.ts +5 -1
  16. package/dist/commands/cloud-provision.js +6 -2
  17. package/dist/commands/cloud.d.ts +36 -0
  18. package/dist/commands/cloud.js +109 -26
  19. package/dist/commands/core.js +1 -0
  20. package/dist/commands/daemon.js +4 -1
  21. package/dist/commands/dm.js +7 -0
  22. package/dist/commands/doctor-usage.d.ts +8 -0
  23. package/dist/commands/doctor-usage.js +20 -0
  24. package/dist/commands/doctor.js +7 -1
  25. package/dist/commands/env.d.ts +18 -0
  26. package/dist/commands/env.js +82 -0
  27. package/dist/commands/install-global.js +2 -2
  28. package/dist/commands/lanes.js +100 -24
  29. package/dist/commands/logout.d.ts +7 -0
  30. package/dist/commands/logout.js +41 -34
  31. package/dist/commands/sources.d.ts +8 -2
  32. package/dist/commands/sources.js +65 -9
  33. package/dist/commands/whoami.js +26 -1
  34. package/dist/data/command-states.json +15 -0
  35. package/dist/index.js +52 -4
  36. package/dist/lazy-commands.js +2 -1
  37. package/dist/lib/anywhere-person-setting.d.ts +2 -0
  38. package/dist/lib/anywhere-person-setting.js +6 -3
  39. package/dist/lib/billing/usage-card.d.ts +25 -4
  40. package/dist/lib/billing/usage-card.js +76 -9
  41. package/dist/lib/billing/usage-cost.d.ts +3 -3
  42. package/dist/lib/billing/usage-cost.js +35 -13
  43. package/dist/lib/billing/usage-only.js +4 -2
  44. package/dist/lib/billing/usage-rate-card.d.ts +2 -2
  45. package/dist/lib/billing/usage-rate-card.js +3 -0
  46. package/dist/lib/bot/fleet-cron.js +93 -6
  47. package/dist/lib/bot/inflight.d.ts +9 -0
  48. package/dist/lib/bot/inflight.js +10 -0
  49. package/dist/lib/bot/jobs/hot-signal-sync.js +12 -1
  50. package/dist/lib/bot/runtime/grok-acp.d.ts +1 -0
  51. package/dist/lib/bot/runtime/grok-acp.js +26 -11
  52. package/dist/lib/bot/runtime/grok.js +1 -1
  53. package/dist/lib/daemon/flag-monitor.d.ts +8 -0
  54. package/dist/lib/daemon/flag-monitor.js +17 -6
  55. package/dist/lib/daemon/flag.d.ts +65 -1
  56. package/dist/lib/daemon/flag.js +190 -40
  57. package/dist/lib/daemon/ops/policy.js +62 -5
  58. package/dist/lib/daemon/paths.d.ts +72 -2
  59. package/dist/lib/daemon/paths.js +154 -3
  60. package/dist/lib/daemon/run.js +25 -20
  61. package/dist/lib/daemon/selfcheck.d.ts +22 -0
  62. package/dist/lib/daemon/selfcheck.js +40 -1
  63. package/dist/lib/daemon/server.d.ts +3 -1
  64. package/dist/lib/daemon/server.js +7 -22
  65. package/dist/lib/daemon/state-file-switch.d.ts +57 -0
  66. package/dist/lib/daemon/state-file-switch.js +88 -0
  67. package/dist/lib/daemon/state-file.d.ts +198 -0
  68. package/dist/lib/daemon/state-file.js +419 -0
  69. package/dist/lib/daemon/timed-flag-monitors.d.ts +47 -0
  70. package/dist/lib/daemon/timed-flag-monitors.js +75 -0
  71. package/dist/lib/doctor/checks/host-core.d.ts +50 -0
  72. package/dist/lib/doctor/checks/host-core.js +269 -0
  73. package/dist/lib/doctor/checks/replay-recorder.d.ts +39 -0
  74. package/dist/lib/doctor/checks/replay-recorder.js +261 -0
  75. package/dist/lib/doctor/registry.js +4 -0
  76. package/dist/lib/environment/profile.d.ts +239 -0
  77. package/dist/lib/environment/profile.js +251 -0
  78. package/dist/lib/hook-engine/reconcile.js +39 -13
  79. package/dist/lib/hook-engine/registration.d.ts +9 -0
  80. package/dist/lib/hook-engine/registration.js +19 -0
  81. package/dist/lib/hot-channels/adapters/slack.d.ts +21 -5
  82. package/dist/lib/hot-channels/adapters/slack.js +64 -21
  83. package/dist/lib/hot-channels/alert.d.ts +2 -0
  84. package/dist/lib/hot-channels/alert.js +8 -1
  85. package/dist/lib/hot-channels/contract.d.ts +12 -0
  86. package/dist/lib/hot-channels/contract.js +7 -0
  87. package/dist/lib/hot-channels/loop.js +1 -0
  88. package/dist/lib/hot-channels/run.d.ts +6 -0
  89. package/dist/lib/hot-channels/run.js +4 -0
  90. package/dist/lib/hot-channels/signals-pass.d.ts +64 -1
  91. package/dist/lib/hot-channels/signals-pass.js +21 -49
  92. package/dist/lib/install/claude-targets.d.ts +12 -1
  93. package/dist/lib/install/claude-targets.js +57 -5
  94. package/dist/lib/install/codex-targets.d.ts +2 -2
  95. package/dist/lib/install/codex-targets.js +36 -6
  96. package/dist/lib/install/hook-target.d.ts +3 -0
  97. package/dist/lib/install/hook-target.js +11 -0
  98. package/dist/lib/lanes/canonical-host.d.ts +35 -0
  99. package/dist/lib/lanes/canonical-host.js +65 -0
  100. package/dist/lib/lanes/host-capacity.d.ts +30 -0
  101. package/dist/lib/lanes/host-capacity.js +29 -3
  102. package/dist/lib/mesh/live/daemon/run.d.ts +2 -0
  103. package/dist/lib/mesh/live/daemon/run.js +5 -2
  104. package/dist/lib/mesh/live/flush.d.ts +5 -1
  105. package/dist/lib/mesh/live/flush.js +12 -6
  106. package/dist/lib/mesh/live/reporting-privacy.d.ts +32 -0
  107. package/dist/lib/mesh/live/reporting-privacy.js +56 -1
  108. package/dist/lib/mesh/live/spool.d.ts +7 -0
  109. package/dist/lib/mesh/live/spool.js +25 -0
  110. package/dist/lib/person-setting-cache.d.ts +38 -0
  111. package/dist/lib/person-setting-cache.js +98 -0
  112. package/dist/lib/safe-store.d.ts +245 -0
  113. package/dist/lib/safe-store.js +777 -0
  114. package/dist/lib/signals/engine.d.ts +29 -2
  115. package/dist/lib/signals/engine.js +103 -4
  116. package/dist/lib/signals/reply.js +73 -18
  117. package/dist/lib/signals/steps/adapters.js +7 -2
  118. package/dist/lib/signals/steps/extract.d.ts +13 -0
  119. package/dist/lib/signals/steps/extract.js +84 -4
  120. package/dist/main.js +46 -3
  121. package/dist/schemas/hq-environment-profile.v1.schema.json +438 -0
  122. package/dist/utils/auth-expiry.d.ts +8 -0
  123. package/dist/utils/auth-expiry.js +53 -0
  124. package/dist/utils/cli-telemetry.d.ts +21 -0
  125. package/dist/utils/cli-telemetry.js +34 -0
  126. package/dist/utils/command-usage.d.ts +275 -0
  127. package/dist/utils/command-usage.js +797 -0
  128. package/dist/utils/hook-trust.d.ts +7 -0
  129. package/dist/utils/hook-trust.js +31 -4
  130. package/dist/utils/host-registration.d.ts +126 -0
  131. package/dist/utils/host-registration.js +378 -0
  132. package/dist/utils/resident-package-preload.js +2 -0
  133. package/package.json +10 -8
  134. package/scripts/bench-core.mjs +1096 -0
  135. package/scripts/check-function-manifest.mjs +702 -0
@@ -0,0 +1,98 @@
1
+ import { performance } from "node:perf_hooks";
2
+ /**
3
+ * How long a long-running process may keep using a person setting it read.
4
+ * The setting changes rarely, so the process reads it once and re-reads on a
5
+ * local change signal. This interval is the safety refresh for a change the
6
+ * process cannot be told about: one made on another device, or on a machine
7
+ * where nothing local records the change. It is the longest a remote opt-out
8
+ * can go unnoticed. Age is measured on the monotonic clock and on the wall
9
+ * clock, and the value is dropped when either says it is too old, so time
10
+ * spent suspended counts.
11
+ */
12
+ export const PERSON_SETTING_REFRESH_MS = 15 * 60_000;
13
+ /** A failed read is not retried before this; the answer stays closed meanwhile. */
14
+ export const PERSON_SETTING_FAILURE_RETRY_MS = 60_000;
15
+ /**
16
+ * Wrap a person-setting reader so a long-running caller reads the server once
17
+ * per refresh interval instead of once per call.
18
+ *
19
+ * Fails closed: the result is null (unknown) until a read succeeds, after a
20
+ * failed read, and whenever the stored value is older than the refresh
21
+ * interval and its refresh failed. A stored `true` is never returned past the
22
+ * interval or after the change signal moved. Concurrent callers share one
23
+ * in-flight read.
24
+ */
25
+ export function cachedPersonSettingReader(read, options = {}) {
26
+ const refreshMs = options.refreshMs ?? PERSON_SETTING_REFRESH_MS;
27
+ const failureRetryMs = Math.min(options.failureRetryMs ?? PERSON_SETTING_FAILURE_RETRY_MS, refreshMs);
28
+ const now = options.now ?? (() => performance.now());
29
+ const wallNow = options.wallNow ?? (() => Date.now());
30
+ /** null: the signal could not be read, so nothing stored can be trusted. */
31
+ const currentSignal = () => {
32
+ if (!options.changeSignal)
33
+ return "";
34
+ try {
35
+ return options.changeSignal();
36
+ }
37
+ catch {
38
+ return null;
39
+ }
40
+ };
41
+ let stored = null;
42
+ let inFlight = null;
43
+ const usable = (entry, signal) => {
44
+ if (!entry || entry.signal !== signal)
45
+ return false;
46
+ const limit = entry.value === null ? failureRetryMs : refreshMs;
47
+ // A negative age means a clock moved backwards; do not trust the entry.
48
+ const fresh = (age) => age >= 0 && age < limit;
49
+ return fresh(now() - entry.at) && fresh(wallNow() - entry.wallAt);
50
+ };
51
+ const startRead = (signal) => {
52
+ // Age is counted from before the request: the value is at least that old.
53
+ const at = now();
54
+ const wallAt = wallNow();
55
+ const promise = (async () => {
56
+ let value;
57
+ try {
58
+ const result = await read();
59
+ value = result === true ? true : result === false ? false : null;
60
+ }
61
+ catch {
62
+ value = null;
63
+ }
64
+ const entry = { value, at, wallAt, signal };
65
+ stored = entry;
66
+ return entry;
67
+ })().finally(() => {
68
+ if (inFlight?.promise === promise)
69
+ inFlight = null;
70
+ });
71
+ inFlight = { signal, promise };
72
+ return promise;
73
+ };
74
+ return async () => {
75
+ const signal = currentSignal();
76
+ // Closed, and without a server read whose answer could not be kept.
77
+ if (signal === null)
78
+ return null;
79
+ if (usable(stored, signal))
80
+ return stored.value;
81
+ if (inFlight && inFlight.signal !== signal) {
82
+ // That read began before the local state changed; its answer may belong
83
+ // to the earlier state. Let it finish, then read again.
84
+ try {
85
+ await inFlight.promise;
86
+ }
87
+ catch { /* startRead never rejects */ }
88
+ }
89
+ const entry = await (inFlight && inFlight.signal === signal ? inFlight.promise : startRead(signal));
90
+ // The local state moved while this read was in flight: closed for this
91
+ // call; the next call reads again under the new state. A person token
92
+ // refresh during the read does this too, at the cost of one more read.
93
+ if (currentSignal() !== signal)
94
+ return null;
95
+ return entry.value;
96
+ };
97
+ }
98
+ //# sourceMappingURL=person-setting-cache.js.map
@@ -0,0 +1,245 @@
1
+ /**
2
+ * One private store folder, held open, with file operations bound to it.
3
+ *
4
+ * Every store hq writes under the user's home goes through this module so the
5
+ * file-safety rules live in one place. The rules (store rule v2):
6
+ *
7
+ * - Nothing left on disk beforehand can redirect a read or a write: a symlink
8
+ * or hardlink at a file, a symlink or junction at the folder, a FIFO, device
9
+ * or folder in a file's place, or a folder or file owned by another user or
10
+ * writable by group or others is refused.
11
+ * - A same-user process that swaps the folder while an operation runs is
12
+ * caught as far as Node allows (see "Binding to the folder" below).
13
+ *
14
+ * Every refusal is a typed result ({ ok: false, code }), never a thrown
15
+ * error, so a caller can carry on with nothing counted and nothing written.
16
+ *
17
+ * Parent folders. At open, every folder above the store folder (real path) is
18
+ * checked up to the user's home, inclusive, when the store is inside it, and
19
+ * otherwise up to the filesystem root. Each must be owned by this user or by
20
+ * root and not writable by group or others; a root-owned folder with the
21
+ * sticky bit (such as /tmp) is allowed, because others cannot rename or
22
+ * remove entries they do not own there. Parents are checked at open only. A
23
+ * symlink in a parent path that this user made is followed: same-user
24
+ * changes above the store are outside what this module defends against.
25
+ *
26
+ * Binding to the folder. Node has no openat, renameat or unlinkat, so:
27
+ *
28
+ * 1. The folder is opened once with O_DIRECTORY|O_NOFOLLOW and the descriptor
29
+ * is held until close(). Its owner and mode are checked by fstat on that
30
+ * descriptor.
31
+ * 2. Before each operation, before each rename retry, and after a listing,
32
+ * the folder path's lstat device and inode are compared with the held
33
+ * descriptor's fstat, and the held folder's owner and mode are checked
34
+ * again; on a mismatch the operation is refused. writeAtomic and rename
35
+ * compare again after the rename and report a mismatch as
36
+ * "folder-changed-after".
37
+ * 3. Files are opened with O_NOFOLLOW (and O_NONBLOCK, so a FIFO never hangs
38
+ * the process), then checked on the opened descriptor: regular file, one
39
+ * link, owned by this user, not writable by group or others. After the
40
+ * open, the name's lstat device and inode must match the opened descriptor
41
+ * and the folder comparison runs again, so a file opened through a folder
42
+ * swapped in and back again is not used.
43
+ * 4. Temporary and exclusive files are opened with O_CREAT|O_EXCL|O_NOFOLLOW,
44
+ * mode 0600; temporary names are random.
45
+ * 5. On Linux, when /proc is mounted, file paths are built as
46
+ * /proc/self/fd/<n>/<name>, which resolve through the held descriptor and
47
+ * not the folder's name.
48
+ *
49
+ * Remaining window (everywhere except Linux with /proc): the checks are
50
+ * comparisons by path, so a same-user process that replaces the folder after
51
+ * the last comparison and before an operation's own path lookup, and puts it
52
+ * back before the next comparison, microseconds apart, is not always seen:
53
+ * - a rename or remove can act on the replacement; a rename is reported when
54
+ * the folder is still replaced at the comparison after it;
55
+ * - an opened file is refused unless the attacker also moves that same file
56
+ * into the store folder before the post-open check, which is a direct write
57
+ * to the store that a same-user process can do anyway;
58
+ * - a refused atomic write can leave an owner-only temporary file under a
59
+ * random name in the held folder.
60
+ *
61
+ * Windows: Node cannot open a folder there, and O_NOFOLLOW does not exist. The
62
+ * folder is checked by lstat (a real folder, not a symlink or junction) and its
63
+ * device and inode are compared by lstat at the same points. Files are checked
64
+ * by lstat for a link before they are opened. Owner and mode, of the folder,
65
+ * its parents and its files, are not checked on Windows, because Node reports
66
+ * no owner and no ACL there.
67
+ */
68
+ import * as fs from "node:fs";
69
+ /** Why an operation was refused or failed. */
70
+ export type SafeStoreRefusalCode =
71
+ /** The folder does not exist (and create was not asked for). */
72
+ "folder-missing"
73
+ /** The folder path is a symlink or junction. */
74
+ | "folder-link"
75
+ /** The folder path is not a folder. */
76
+ | "not-a-folder"
77
+ /** The folder is owned by another user. */
78
+ | "folder-foreign-owner"
79
+ /** Group or others can write the folder. */
80
+ | "folder-writable"
81
+ /** A folder above the store folder is owned by another user (not root) or writable by group or others. */
82
+ | "parent-unsafe"
83
+ /** The folder path no longer leads to the held folder; nothing was done. */
84
+ | "folder-changed"
85
+ /** The folder path stopped leading to the held folder during a rename that had already run. */
86
+ | "folder-changed-after"
87
+ /** The file does not exist. */
88
+ | "missing"
89
+ /** The file is a symlink. */
90
+ | "file-link"
91
+ /** The file is a FIFO, device, socket or folder. */
92
+ | "not-regular-file"
93
+ /** The file has more than one link (a hardlink). */
94
+ | "file-hardlinked"
95
+ /** The file is owned by another user. */
96
+ | "file-foreign-owner"
97
+ /** Group or others can write the file. */
98
+ | "file-writable"
99
+ /** The name no longer leads to the file that was opened. */
100
+ | "file-changed"
101
+ /** The file is larger than the caller's limit. */
102
+ | "too-large"
103
+ /** The name is empty, ".", "..", or holds a path separator or NUL. */
104
+ | "bad-name"
105
+ /** close() already ran. */
106
+ | "closed"
107
+ /** Any other filesystem error; `errno` holds its code. */
108
+ | "io-error";
109
+ export interface SafeStoreRefusal {
110
+ ok: false;
111
+ code: SafeStoreRefusalCode;
112
+ message: string;
113
+ /** The underlying error code (ENOENT, EACCES, ...) when one caused this. */
114
+ errno?: string;
115
+ }
116
+ export type SafeStoreResult<T> = {
117
+ ok: true;
118
+ value: T;
119
+ } | SafeStoreRefusal;
120
+ /** Points at which a test can act between the steps of an operation. */
121
+ export type SafeStorePoint =
122
+ /** Start of every operation, before the folder comparison. */
123
+ "before-check"
124
+ /** writeAtomic: after the comparison, before the temporary file is opened. */
125
+ | "before-temp-open"
126
+ /** appendLine, read, createExclusive, stat: after the comparison, before the file is opened. */
127
+ | "before-open"
128
+ /** writeAtomic, appendLine, read, createExclusive, stat: after the open, before the post-open checks. */
129
+ | "after-open"
130
+ /** appendLine: after the post-open checks, before the comparison that precedes the write. */
131
+ | "before-write"
132
+ /** writeAtomic, rename: before the comparison that precedes the rename. */
133
+ | "before-rename"
134
+ /** writeAtomic, rename: after the rename, before the comparison that reports. */
135
+ | "after-rename"
136
+ /** remove: before the comparison that precedes the unlink. */
137
+ | "before-remove"
138
+ /** list: after the folder was read, before the comparison that follows. */
139
+ | "after-list";
140
+ export type SafeStoreOperation = "appendLine" | "writeAtomic" | "read" | "rename" | "remove" | "list" | "createExclusive" | "stat";
141
+ export interface OpenStoreDirOptions {
142
+ /**
143
+ * Create the folder (and missing parents) with mode 0700 when it is missing.
144
+ * An existing folder of this user that group and others cannot write is
145
+ * tightened to 0700 through the held descriptor.
146
+ */
147
+ create?: boolean;
148
+ /** Test seam: called at each named point of every operation. */
149
+ at?: (point: SafeStorePoint, operation: SafeStoreOperation) => void;
150
+ /** Platform whose rules apply (tests). Defaults to process.platform. */
151
+ platform?: NodeJS.Platform;
152
+ /** Where the parent check stops when the store is inside it. Defaults to os.homedir(). */
153
+ home?: string;
154
+ }
155
+ export interface ReadOptions {
156
+ /** Refuse a file larger than this. Default 1 MiB. */
157
+ maxBytes?: number;
158
+ }
159
+ export interface AppendOptions {
160
+ /** Refuse to append when the file is already this size or larger. */
161
+ maxBytes?: number;
162
+ }
163
+ export interface AppendResult {
164
+ /** The file's size after the write. */
165
+ size: number;
166
+ /** The file had no name left after the write (removed or rotated away by another process). */
167
+ unlinked: boolean;
168
+ }
169
+ export interface FileFacts {
170
+ size: number;
171
+ mtimeMs: number;
172
+ }
173
+ /** FileFacts plus the exact modification time in nanoseconds (mtimeMs is a float and can round across a millisecond). */
174
+ export interface ReadFacts extends FileFacts {
175
+ mtimeNs: bigint;
176
+ }
177
+ export interface RenameOptions {
178
+ /** Waits in milliseconds between rename attempts on EPERM, EACCES or EBUSY (Windows). Empty: no retry. */
179
+ retryDelaysMs?: readonly number[];
180
+ /** Synchronous wait between rename attempts (tests). */
181
+ sleep?: (ms: number) => void;
182
+ /** Replaces fs.renameSync (tests). */
183
+ renameFile?: (from: string, to: string) => void;
184
+ }
185
+ export type WriteAtomicOptions = RenameOptions;
186
+ export interface SafeStore {
187
+ /** The folder path, resolved to an absolute path. */
188
+ readonly path: string;
189
+ /** Append `line` (a newline is added when missing) in one write, creating the file 0600. Returns the size after. */
190
+ appendLine(name: string, line: string, options?: AppendOptions): SafeStoreResult<AppendResult>;
191
+ /** Replace `name` with `data` so a reader sees the old file or the new one. */
192
+ writeAtomic(name: string, data: string | Uint8Array, options?: WriteAtomicOptions): SafeStoreResult<void>;
193
+ /** Read a regular single-link file of this user, up to a size cap. */
194
+ read(name: string, options?: ReadOptions): SafeStoreResult<Buffer>;
195
+ /** As read, plus the size and modification time of the same opened file (one descriptor for both). */
196
+ readWithFacts(name: string, options?: ReadOptions): SafeStoreResult<{
197
+ data: Buffer;
198
+ facts: ReadFacts;
199
+ }>;
200
+ /**
201
+ * Create `name` only if no entry has that name (O_CREAT|O_EXCL|O_NOFOLLOW,
202
+ * 0600), optionally writing `data` to it. Returns true when this call created
203
+ * it and false when the name was already taken (by anything, a link
204
+ * included). Usable as a lock.
205
+ */
206
+ createExclusive(name: string, data?: string | Uint8Array): SafeStoreResult<boolean>;
207
+ /** Size and modification time of a regular single-link file of this user, read from the opened descriptor. */
208
+ stat(name: string): SafeStoreResult<FileFacts>;
209
+ /** Rename a regular single-link file of this user within the folder. */
210
+ rename(from: string, to: string, options?: RenameOptions): SafeStoreResult<void>;
211
+ /** Remove `name` from the folder. Returns false when it was already gone. A link is removed, never followed. */
212
+ remove(name: string): SafeStoreResult<boolean>;
213
+ /** The names in the folder. */
214
+ list(): SafeStoreResult<string[]>;
215
+ /** Release the held folder. Later calls are refused with "closed". */
216
+ close(): void;
217
+ }
218
+ /** A plain file name: no separator, no NUL, not "." or "..", at most 255 bytes. */
219
+ export declare function isPlainName(name: string): boolean;
220
+ /** Owner and mode facts a check needs, from fs.Stats or fs.BigIntStats. */
221
+ interface OwnerMode {
222
+ uid: number | bigint;
223
+ mode: number | bigint;
224
+ }
225
+ /**
226
+ * Whether a folder or file is owned by `uid` and closed to group and other
227
+ * writes. `uid` undefined (Windows) skips both checks.
228
+ */
229
+ export declare function ownerModeRefusal(stat: OwnerMode, uid: number | undefined, kind: "folder" | "file"): SafeStoreRefusal | null;
230
+ /**
231
+ * Whether a folder above the store is safe: owned by `uid` or root, and not
232
+ * writable by group or others unless it is a root-owned sticky folder.
233
+ */
234
+ export declare function parentStatRefusal(stat: OwnerMode, uid: number): SafeStoreRefusal | null;
235
+ /** The checks every file this module reads or appends to must pass, on the opened descriptor. */
236
+ export declare function fileStatRefusal(stat: fs.Stats | fs.BigIntStats, uid: number | undefined): SafeStoreRefusal | null;
237
+ /**
238
+ * Open `dir` as a store folder. With `create`, a missing folder is made 0700.
239
+ * The folder must be a real folder (not a symlink or junction); on POSIX it
240
+ * must be owned by this user and not writable by group or others, and so must
241
+ * the folders above it (see "Parent folders" above).
242
+ */
243
+ export declare function openStoreDir(dir: string, options?: OpenStoreDirOptions): SafeStoreResult<SafeStore>;
244
+ export {};
245
+ //# sourceMappingURL=safe-store.d.ts.map