@gadicc/loom 2.3.1 → 2.5.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 (68) hide show
  1. package/.loom-source-manifest.json +10 -1
  2. package/esm/src/cli/machineSlots.d.ts +149 -0
  3. package/esm/src/cli/machineSlots.d.ts.map +1 -0
  4. package/esm/src/cli/machineSlots.js +417 -0
  5. package/esm/src/cli/machineSlots.js.map +1 -0
  6. package/esm/src/cli/machineSlotsCommand.d.ts +24 -0
  7. package/esm/src/cli/machineSlotsCommand.d.ts.map +1 -0
  8. package/esm/src/cli/machineSlotsCommand.js +431 -0
  9. package/esm/src/cli/machineSlotsCommand.js.map +1 -0
  10. package/esm/src/cli/machineSlotsHost.d.ts +50 -0
  11. package/esm/src/cli/machineSlotsHost.d.ts.map +1 -0
  12. package/esm/src/cli/machineSlotsHost.js +192 -0
  13. package/esm/src/cli/machineSlotsHost.js.map +1 -0
  14. package/esm/src/cli/mod.d.ts.map +1 -1
  15. package/esm/src/cli/mod.js +39 -1
  16. package/esm/src/cli/mod.js.map +1 -1
  17. package/esm/src/cli/testResourceLaunch.d.ts +29 -1
  18. package/esm/src/cli/testResourceLaunch.d.ts.map +1 -1
  19. package/esm/src/cli/testResourceLaunch.js +49 -12
  20. package/esm/src/cli/testResourceLaunch.js.map +1 -1
  21. package/esm/src/geo/client.d.ts +74 -0
  22. package/esm/src/geo/client.d.ts.map +1 -0
  23. package/esm/src/geo/client.js +135 -0
  24. package/esm/src/geo/client.js.map +1 -0
  25. package/esm/src/geo/mod.d.ts +5 -0
  26. package/esm/src/geo/mod.d.ts.map +1 -0
  27. package/esm/src/geo/mod.js +5 -0
  28. package/esm/src/geo/mod.js.map +1 -0
  29. package/esm/src/geo/place.d.ts +28 -0
  30. package/esm/src/geo/place.d.ts.map +1 -0
  31. package/esm/src/geo/place.js +41 -0
  32. package/esm/src/geo/place.js.map +1 -0
  33. package/esm/src/geo/places.d.ts +16 -0
  34. package/esm/src/geo/places.d.ts.map +1 -0
  35. package/esm/src/geo/places.js +154 -0
  36. package/esm/src/geo/places.js.map +1 -0
  37. package/esm/src/geo/placesFormat.d.ts +49 -0
  38. package/esm/src/geo/placesFormat.d.ts.map +1 -0
  39. package/esm/src/geo/placesFormat.js +38 -0
  40. package/esm/src/geo/placesFormat.js.map +1 -0
  41. package/esm/src/geo/preference.d.ts +15 -0
  42. package/esm/src/geo/preference.d.ts.map +1 -0
  43. package/esm/src/geo/preference.js +21 -0
  44. package/esm/src/geo/preference.js.map +1 -0
  45. package/esm/src/geo/timeZone.d.ts +20 -0
  46. package/esm/src/geo/timeZone.d.ts.map +1 -0
  47. package/esm/src/geo/timeZone.js +65 -0
  48. package/esm/src/geo/timeZone.js.map +1 -0
  49. package/esm/src/geo/vercel.d.ts +15 -0
  50. package/esm/src/geo/vercel.d.ts.map +1 -0
  51. package/esm/src/geo/vercel.js +64 -0
  52. package/esm/src/geo/vercel.js.map +1 -0
  53. package/package.json +26 -2
  54. package/skills/loom/SKILL.md +43 -15
  55. package/skills/loom/references/verification-workflow.md +128 -0
  56. package/source/src/cli/machineSlots.ts +543 -0
  57. package/source/src/cli/machineSlotsCommand.ts +549 -0
  58. package/source/src/cli/machineSlotsHost.ts +215 -0
  59. package/source/src/cli/mod.ts +53 -1
  60. package/source/src/cli/testResourceLaunch.ts +71 -9
  61. package/source/src/geo/client.ts +241 -0
  62. package/source/src/geo/mod.ts +12 -0
  63. package/source/src/geo/place.ts +61 -0
  64. package/source/src/geo/places.ts +195 -0
  65. package/source/src/geo/placesFormat.ts +58 -0
  66. package/source/src/geo/preference.ts +24 -0
  67. package/source/src/geo/timeZone.ts +78 -0
  68. package/source/src/geo/vercel.ts +78 -0
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 1,
3
- "supportDigest": "8a037d6466febb97f71148bc0f9cdc764bc996bc26671e620ecfcf50aa496e88",
3
+ "supportDigest": "d854d03dfce0d06ae80d1d92e1ffe8d32169b53267c80f72b6898b4a9cda5aee",
4
4
  "supportSources": [
5
5
  "src/apiKeys/betterAuth.ts",
6
6
  "src/apiKeys/permissions.ts",
@@ -20,6 +20,9 @@
20
20
  "src/cli/localDb.ts",
21
21
  "src/cli/localDevLock.ts",
22
22
  "src/cli/localDevPackage.ts",
23
+ "src/cli/machineSlots.ts",
24
+ "src/cli/machineSlotsCommand.ts",
25
+ "src/cli/machineSlotsHost.ts",
23
26
  "src/cli/managedFiles.ts",
24
27
  "src/cli/migrationEnv.ts",
25
28
  "src/cli/mod.ts",
@@ -54,6 +57,9 @@
54
57
  "./src/apiKeys/mod.js": "src/apiKeys/mod.ts",
55
58
  "./src/clientData/mod.js": "src/clientData/mod.ts",
56
59
  "./src/files/mod.js": "src/files/mod.ts",
60
+ "./src/geo/mod.js": "src/geo/mod.ts",
61
+ "./src/geo/client.js": "src/geo/client.ts",
62
+ "./src/geo/places.js": "src/geo/places.ts",
57
63
  "./src/mail/mod.js": "src/mail/mod.ts",
58
64
  "./src/mail/postal.js": "src/mail/postal.ts",
59
65
  "./src/mui/apiKeys.js": "src/mui/apiKeys.tsx",
@@ -73,6 +79,9 @@
73
79
  ".": "mod.ts",
74
80
  "./release": "src/release/mod.ts",
75
81
  "./client-data": "src/clientData/mod.ts",
82
+ "./geo": "src/geo/mod.ts",
83
+ "./geo/client": "src/geo/client.ts",
84
+ "./geo/places": "src/geo/places.ts",
76
85
  "./files": "src/files/mod.ts",
77
86
  "./api-keys": "src/apiKeys/mod.ts",
78
87
  "./apiKeys": "src/apiKeys/mod.ts",
@@ -0,0 +1,149 @@
1
+ /** Spec identifier recorded in labels and shown by `loom slots status`. */
2
+ export declare const SLOTS_SPEC = "loom-slots-v1";
3
+ /** Lock operations the grant loop needs; real ones use `flock(1)`. */
4
+ export interface SlotLocks {
5
+ /** Tries to take a slot without waiting; true if it is now held. */
6
+ tryTake(cpu: number): Promise<boolean>;
7
+ /** Gives a held slot back. */
8
+ release(cpu: number): Promise<void>;
9
+ }
10
+ /** A job's request: at least `min` CPUs, at most `max`. */
11
+ export interface SlotRequest {
12
+ min: number;
13
+ max: number;
14
+ }
15
+ /**
16
+ * Parses and clamps `--min`/`--max` against the pool and any known quota.
17
+ * The floor defaults to 2 and the ceiling to `defaultMax` (never below the
18
+ * floor); both are clamped to what the pool and quota allow.
19
+ */
20
+ export declare function resolveSlotRequest(pool: number, min: string | undefined, max: string | undefined, options?: {
21
+ defaultMax?: number;
22
+ quota?: number;
23
+ }): SlotRequest;
24
+ /**
25
+ * Orders the pool for scanning. With hybrid core types it interleaves them in
26
+ * proportion (one performance core to about three efficiency cores here), so
27
+ * each grant gets its share of fast cores; otherwise ascending CPU id. The
28
+ * order never affects which CPUs are shared, only which a job gets first.
29
+ */
30
+ export declare function scanOrder(pool: readonly number[], coreTypes: readonly string[]): number[];
31
+ /**
32
+ * One pass over the pool in scan order, taking free slots until `max` are
33
+ * held. Fewer than `min` gives every slot back at once, so a job never holds
34
+ * slots while it waits; enough is topped up by one more pass for slots freed
35
+ * meanwhile.
36
+ */
37
+ export declare function scanForGrant(pool: readonly number[], request: SlotRequest, locks: SlotLocks): Promise<number[] | null>;
38
+ /**
39
+ * Takes a non-blocking exclusive `flock` on an open descriptor through
40
+ * util-linux `flock(1)`, which receives it as fd 3. The lock belongs to the
41
+ * open file description, so it stays with `fd` after `flock(1)` exits.
42
+ */
43
+ export declare function flockDescriptor(fd: number, flockPath?: string): "taken" | "busy" | "interrupted" | "unavailable";
44
+ /** What a slot or ticket file says about its holder while it is locked. */
45
+ export interface SlotLabel {
46
+ spec: typeof SLOTS_SPEC;
47
+ kind: "slot" | "ticket";
48
+ lease: string;
49
+ pid: number;
50
+ /** The holder's start time from `/proc/<pid>/stat`, so a reused pid is not taken for it. */
51
+ pidStart: string | null;
52
+ label: string;
53
+ startedAt: string;
54
+ request?: SlotRequest;
55
+ }
56
+ /** Writes a label over a held file's contents. */
57
+ export declare function writeLabel(fd: number, label: SlotLabel): void;
58
+ /** Reads a label from an open descriptor; anything unexpected is null. */
59
+ export declare function readLabel(fd: number): SlotLabel | null;
60
+ /** Whether a label's holder is still the process that wrote it. */
61
+ export declare function holderAlive(label: SlotLabel): boolean;
62
+ /** A new label for this process. */
63
+ export declare function ownLabel(kind: SlotLabel["kind"], lease: string, text: string, request?: SlotRequest): SlotLabel;
64
+ /** A fresh random lease id. */
65
+ export declare function newLease(): string;
66
+ /** Raised when a signal ends a lock attempt: the caller is being interrupted. */
67
+ export declare class SlotsInterrupted extends Error {
68
+ constructor();
69
+ }
70
+ /** Slot locks on `<dir>/cpu-<id>` files; this process alone holds them. */
71
+ export declare class FlockSlotLocks implements SlotLocks {
72
+ #private;
73
+ constructor(dir: string, flockPath?: string);
74
+ tryTake(cpu: number): Promise<boolean>;
75
+ release(cpu: number): Promise<void>;
76
+ /** Labels every held slot. */
77
+ label(label: SlotLabel): void;
78
+ /** Releases every held slot. */
79
+ releaseAll(): void;
80
+ }
81
+ /** One pool file's state: free, or held with the label its holder wrote. */
82
+ export type FileState = {
83
+ state: "missing";
84
+ } | {
85
+ state: "free";
86
+ } | {
87
+ state: "held";
88
+ label: SlotLabel | null;
89
+ };
90
+ /**
91
+ * Probes a pool file without changing who holds it: a free file is locked for
92
+ * a moment and released (a concurrent taker may then see it busy and skip it);
93
+ * a held one has its label read. `whenFree` runs while the probe holds a free
94
+ * file, so a dead ticket can be removed under its own lock.
95
+ */
96
+ export declare function probeFile(path: string, flockPath?: string, whenFree?: () => void): FileState;
97
+ /** A waiter's place in line, held for as long as it waits. */
98
+ export interface Ticket {
99
+ name: string;
100
+ fd: number;
101
+ }
102
+ /**
103
+ * Joins the line: creates a ticket under a `pending-` name, locks and labels
104
+ * it, then renames it into the line, so no prober ever sees it unlocked.
105
+ */
106
+ export declare function takeTicket(dir: string, label: SlotLabel, flockPath?: string): Ticket;
107
+ /** Leaves the line. */
108
+ export declare function dropTicket(dir: string, ticket: Ticket): void;
109
+ /** A live waiter, for the head decision and for `status`. */
110
+ export interface Waiter {
111
+ name: string;
112
+ label: SlotLabel | null;
113
+ stopped: boolean;
114
+ }
115
+ /**
116
+ * Lists live tickets in arrival order. A ticket nobody holds, once past its
117
+ * short creation grace, belongs to a dead waiter and is removed under its own
118
+ * lock. Stopped holders (Ctrl-Z) are marked so they do not block the line.
119
+ */
120
+ export declare function liveWaiters(dir: string, own: string | null, flockPath?: string, now?: number): Waiter[];
121
+ /** Whether `own` is first in line among waiters that are not stopped. */
122
+ export declare function isHead(waiters: readonly Waiter[], own: string): boolean;
123
+ /**
124
+ * Verifies an inherited grant for nesting: every CPU it names is locked, by a
125
+ * live holder whose label carries the same lease, and this process's own
126
+ * affinity lies within it. Returns the grant's CPUs, or null when the
127
+ * variables are absent, stale or forged.
128
+ */
129
+ export declare function verifyLease(dir: string, env: Readonly<Record<string, string | undefined>>, inherited: readonly number[], flockPath?: string): number[] | null;
130
+ /** `status` view of one CPU in the pool. */
131
+ export interface SlotStatus {
132
+ cpu: number;
133
+ state: "free" | "held" | "unknown";
134
+ label: SlotLabel | null;
135
+ }
136
+ /** Reads every pool CPU's state for `loom slots status`. */
137
+ export declare function readSlots(dir: string, pool: readonly number[], flockPath?: string): SlotStatus[];
138
+ /**
139
+ * Finds a grant held by an ancestor of this process among the pool's slots,
140
+ * by matching each holder's pid and start time against this process's
141
+ * `/proc` parent chain. This recognises nesting even when an intermediary
142
+ * scrubbed the grant variables; without it an inner run would queue for CPUs
143
+ * its own ancestor holds and wait forever.
144
+ */
145
+ export declare function ancestorGrant(dir: string, pool: readonly number[], flockPath?: string, ancestors?: Set<string>): {
146
+ lease: string;
147
+ cpus: number[];
148
+ } | null;
149
+ //# sourceMappingURL=machineSlots.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"machineSlots.d.ts","sourceRoot":"","sources":["../../../source/src/cli/machineSlots.ts"],"names":[],"mappings":"AA2BA,2EAA2E;AAC3E,eAAO,MAAM,UAAU,kBAAkB,CAAC;AAQ1C,sEAAsE;AACtE,MAAM,WAAW,SAAS;IACxB,oE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D,wBAAgB,SAAS,CACvB,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,SAAS,SAAU,GAClB,UAAU,EAAE,CAYd;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAC3B,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,SAAS,SAAU,EACnB,SAAS,GAAE,GAAG,CAAC,MAAM,CAAkB,GACtC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAA;CAAE,GAAG,IAAI,CAa1C"}
@@ -0,0 +1,417 @@
1
+ import { spawnSync } from "node:child_process";
2
+ /**
3
+ * Machine-wide CPU slots (`loom-slots-v1`, docs/machine-slots.md): one
4
+ * per-user pool of CPUs shared by every Loom consumer on the machine.
5
+ * Holding a slot is holding an exclusive `flock` on `<dir>/cpu-<id>`; only the
6
+ * wrapper holds it, and the job runs pinned to its grant.
7
+ */
8
+ import { randomBytes } from "node:crypto";
9
+ import { closeSync, ftruncateSync, readdirSync, readSync, renameSync, statSync, unlinkSync, writeSync, } from "node:fs";
10
+ import { join } from "node:path";
11
+ import process from "node:process";
12
+ import { ancestorKeys, openPoolFile, readProcessStat, } from "./machineSlotsHost.js";
13
+ import { parseCpuList } from "./testResourcePolicy.js";
14
+ /** Spec identifier recorded in labels and shown by `loom slots status`. */
15
+ export const SLOTS_SPEC = "loom-slots-v1";
16
+ /** Exit code `flock(1)` is told to use when the lock is already held. */
17
+ const FLOCK_BUSY = 75;
18
+ /** A ticket older than this that nobody holds belongs to a dead waiter. */
19
+ const TICKET_GRACE_MS = 2_000;
20
+ /**
21
+ * Parses and clamps `--min`/`--max` against the pool and any known quota.
22
+ * The floor defaults to 2 and the ceiling to `defaultMax` (never below the
23
+ * floor); both are clamped to what the pool and quota allow.
24
+ */
25
+ export function resolveSlotRequest(pool, min, max, options = {}) {
26
+ const parse = (value, name) => {
27
+ if (value === undefined)
28
+ return undefined;
29
+ if (!/^\d+$/.test(value) || Number(value) < 1)
30
+ throw new Error(`--${name} must be a positive whole number`);
31
+ return Number(value);
32
+ };
33
+ const limit = Math.min(pool, options.quota ?? pool);
34
+ if (limit < 1)
35
+ throw new Error("The slot pool is empty");
36
+ const requestedMax = parse(max, "max");
37
+ // Without --min, the default floor never exceeds a given --max.
38
+ const floor = Math.min(parse(min, "min") ?? Math.min(2, requestedMax ?? 2), limit);
39
+ if (requestedMax !== undefined && requestedMax < floor)
40
+ throw new Error("--max must not be below --min");
41
+ const ceiling = Math.min(requestedMax ?? Math.max(floor, options.defaultMax ?? Math.ceil(pool / 2)), limit);
42
+ return { min: floor, max: ceiling };
43
+ }
44
+ /**
45
+ * Orders the pool for scanning. With hybrid core types it interleaves them in
46
+ * proportion (one performance core to about three efficiency cores here), so
47
+ * each grant gets its share of fast cores; otherwise ascending CPU id. The
48
+ * order never affects which CPUs are shared, only which a job gets first.
49
+ */
50
+ export function scanOrder(pool, coreTypes) {
51
+ const sorted = [...pool].sort((a, b) => a - b);
52
+ let groups;
53
+ try {
54
+ const inPool = new Set(sorted);
55
+ groups = coreTypes
56
+ .map((text) => parseCpuList(text).filter((cpu) => inPool.has(cpu)))
57
+ .filter((group) => group.length > 0);
58
+ }
59
+ catch {
60
+ return sorted;
61
+ }
62
+ const covered = new Set(groups.flat());
63
+ if (groups.length < 2 || covered.size !== sorted.length)
64
+ return sorted;
65
+ const taken = groups.map(() => 0);
66
+ const order = [];
67
+ while (order.length < sorted.length) {
68
+ // Next from the type furthest behind its share; ties go to the first type.
69
+ let best = -1;
70
+ for (let index = 0; index < groups.length; index++) {
71
+ if (taken[index] >= groups[index].length)
72
+ continue;
73
+ if (best < 0 ||
74
+ taken[index] / groups[index].length < taken[best] / groups[best].length)
75
+ best = index;
76
+ }
77
+ order.push(groups[best][taken[best]++]);
78
+ }
79
+ return order;
80
+ }
81
+ /**
82
+ * One pass over the pool in scan order, taking free slots until `max` are
83
+ * held. Fewer than `min` gives every slot back at once, so a job never holds
84
+ * slots while it waits; enough is topped up by one more pass for slots freed
85
+ * meanwhile.
86
+ */
87
+ export async function scanForGrant(pool, request, locks) {
88
+ const held = [];
89
+ const pass = async () => {
90
+ for (const cpu of pool) {
91
+ if (held.length >= request.max)
92
+ return;
93
+ if (!held.includes(cpu) && (await locks.tryTake(cpu)))
94
+ held.push(cpu);
95
+ }
96
+ };
97
+ await pass();
98
+ if (held.length < request.min) {
99
+ for (const cpu of held)
100
+ await locks.release(cpu);
101
+ return null;
102
+ }
103
+ if (held.length < request.max)
104
+ await pass();
105
+ return held;
106
+ }
107
+ /**
108
+ * Takes a non-blocking exclusive `flock` on an open descriptor through
109
+ * util-linux `flock(1)`, which receives it as fd 3. The lock belongs to the
110
+ * open file description, so it stays with `fd` after `flock(1)` exits.
111
+ */
112
+ export function flockDescriptor(fd, flockPath = "flock") {
113
+ const result = spawnSync(flockPath, [
114
+ "--nonblock",
115
+ "--exclusive",
116
+ "--conflict-exit-code",
117
+ String(FLOCK_BUSY),
118
+ "3",
119
+ ], { stdio: ["ignore", "ignore", "ignore", fd] });
120
+ if (result.error)
121
+ return "unavailable";
122
+ // A terminal's Ctrl-C reaches flock(1) too; that is an interrupt, not a fault.
123
+ if (result.signal)
124
+ return "interrupted";
125
+ if (result.status === 0)
126
+ return "taken";
127
+ if (result.status === FLOCK_BUSY)
128
+ return "busy";
129
+ return "unavailable";
130
+ }
131
+ /** Writes a label over a held file's contents. */
132
+ export function writeLabel(fd, label) {
133
+ ftruncateSync(fd, 0);
134
+ writeSync(fd, JSON.stringify(label), 0);
135
+ }
136
+ /** Reads a label from an open descriptor; anything unexpected is null. */
137
+ export function readLabel(fd) {
138
+ const buffer = Buffer.alloc(4096);
139
+ const length = readSync(fd, buffer, 0, buffer.length, 0);
140
+ try {
141
+ const value = JSON.parse(buffer.subarray(0, length).toString("utf8"));
142
+ if (value?.spec === SLOTS_SPEC &&
143
+ (value.kind === "slot" || value.kind === "ticket") &&
144
+ typeof value.lease === "string" &&
145
+ Number.isSafeInteger(value.pid) &&
146
+ typeof value.label === "string" &&
147
+ typeof value.startedAt === "string")
148
+ return value;
149
+ }
150
+ catch {
151
+ /* An empty or partly written file has no label. */
152
+ }
153
+ return null;
154
+ }
155
+ /** Whether a label's holder is still the process that wrote it. */
156
+ export function holderAlive(label) {
157
+ const stat = readProcessStat(label.pid);
158
+ return Boolean(stat && (label.pidStart === null || stat.start === label.pidStart));
159
+ }
160
+ /** A new label for this process. */
161
+ export function ownLabel(kind, lease, text, request) {
162
+ return {
163
+ spec: SLOTS_SPEC,
164
+ kind,
165
+ lease,
166
+ pid: process.pid,
167
+ pidStart: readProcessStat(process.pid)?.start ?? null,
168
+ label: text,
169
+ startedAt: new Date().toISOString(),
170
+ ...(request ? { request } : {}),
171
+ };
172
+ }
173
+ /** A fresh random lease id. */
174
+ export function newLease() {
175
+ return randomBytes(9).toString("base64url");
176
+ }
177
+ /** Raised when a signal ends a lock attempt: the caller is being interrupted. */
178
+ export class SlotsInterrupted extends Error {
179
+ constructor() {
180
+ super("interrupted");
181
+ }
182
+ }
183
+ /** Slot locks on `<dir>/cpu-<id>` files; this process alone holds them. */
184
+ export class FlockSlotLocks {
185
+ #dir;
186
+ #flock;
187
+ #held = new Map();
188
+ constructor(dir, flockPath = "flock") {
189
+ this.#dir = dir;
190
+ this.#flock = flockPath;
191
+ }
192
+ tryTake(cpu) {
193
+ if (this.#held.has(cpu))
194
+ return Promise.resolve(true);
195
+ try {
196
+ const fd = openPoolFile(join(this.#dir, `cpu-${cpu}`));
197
+ const outcome = flockDescriptor(fd, this.#flock);
198
+ if (outcome === "taken") {
199
+ this.#held.set(cpu, fd);
200
+ return Promise.resolve(true);
201
+ }
202
+ closeSync(fd);
203
+ if (outcome === "unavailable")
204
+ return Promise.reject(new Error("flock(1) is unavailable"));
205
+ if (outcome === "interrupted")
206
+ return Promise.reject(new SlotsInterrupted());
207
+ return Promise.resolve(false);
208
+ }
209
+ catch (error) {
210
+ return Promise.reject(error);
211
+ }
212
+ }
213
+ release(cpu) {
214
+ const fd = this.#held.get(cpu);
215
+ if (fd !== undefined) {
216
+ this.#held.delete(cpu);
217
+ closeSync(fd);
218
+ }
219
+ return Promise.resolve();
220
+ }
221
+ /** Labels every held slot. */
222
+ label(label) {
223
+ for (const fd of this.#held.values())
224
+ writeLabel(fd, label);
225
+ }
226
+ /** Releases every held slot. */
227
+ releaseAll() {
228
+ for (const fd of this.#held.values())
229
+ closeSync(fd);
230
+ this.#held.clear();
231
+ }
232
+ }
233
+ /**
234
+ * Probes a pool file without changing who holds it: a free file is locked for
235
+ * a moment and released (a concurrent taker may then see it busy and skip it);
236
+ * a held one has its label read. `whenFree` runs while the probe holds a free
237
+ * file, so a dead ticket can be removed under its own lock.
238
+ */
239
+ export function probeFile(path, flockPath = "flock", whenFree) {
240
+ const fd = openPoolFile(path, { existingOnly: true });
241
+ if (fd === null)
242
+ return { state: "missing" };
243
+ try {
244
+ const outcome = flockDescriptor(fd, flockPath);
245
+ if (outcome === "unavailable")
246
+ throw new Error("flock(1) is unavailable");
247
+ if (outcome === "interrupted")
248
+ throw new SlotsInterrupted();
249
+ if (outcome === "taken") {
250
+ whenFree?.();
251
+ return { state: "free" };
252
+ }
253
+ return { state: "held", label: readLabel(fd) };
254
+ }
255
+ finally {
256
+ closeSync(fd);
257
+ }
258
+ }
259
+ /**
260
+ * Joins the line: creates a ticket under a `pending-` name, locks and labels
261
+ * it, then renames it into the line, so no prober ever sees it unlocked.
262
+ */
263
+ export function takeTicket(dir, label, flockPath = "flock") {
264
+ const stem = `${String(Date.now()).padStart(15, "0")}-${process.pid}-${randomBytes(4).toString("hex")}`;
265
+ const pending = join(dir, `pending-${stem}`);
266
+ const fd = openPoolFile(pending, { exclusive: true });
267
+ const outcome = flockDescriptor(fd, flockPath);
268
+ if (outcome !== "taken") {
269
+ unlinkSync(pending);
270
+ closeSync(fd);
271
+ if (outcome === "interrupted")
272
+ throw new SlotsInterrupted();
273
+ throw new Error("Could not lock a new ticket");
274
+ }
275
+ writeLabel(fd, label);
276
+ const name = `ticket-${stem}`;
277
+ renameSync(pending, join(dir, name));
278
+ return { name, fd };
279
+ }
280
+ /** Leaves the line. */
281
+ export function dropTicket(dir, ticket) {
282
+ try {
283
+ unlinkSync(join(dir, ticket.name));
284
+ }
285
+ catch {
286
+ /* Already removed by someone who found it unheld; that cannot happen while held. */
287
+ }
288
+ closeSync(ticket.fd);
289
+ }
290
+ /**
291
+ * Lists live tickets in arrival order. A ticket nobody holds, once past its
292
+ * short creation grace, belongs to a dead waiter and is removed under its own
293
+ * lock. Stopped holders (Ctrl-Z) are marked so they do not block the line.
294
+ */
295
+ export function liveWaiters(dir, own, flockPath = "flock", now = Date.now()) {
296
+ const waiters = [];
297
+ const all = readdirSync(dir);
298
+ // A pending ticket left by a waiter that died before renaming it.
299
+ for (const name of all.filter((one) => one.startsWith("pending-"))) {
300
+ const path = join(dir, name);
301
+ try {
302
+ if (now - statSync(path).mtimeMs > TICKET_GRACE_MS)
303
+ probeFile(path, flockPath, () => unlinkSync(path));
304
+ }
305
+ catch {
306
+ /* Gone already, or not ours to judge. */
307
+ }
308
+ }
309
+ const names = all.filter((name) => name.startsWith("ticket-")).sort();
310
+ for (const name of names) {
311
+ const path = join(dir, name);
312
+ if (name === own) {
313
+ waiters.push({ name, label: null, stopped: false });
314
+ continue;
315
+ }
316
+ let old = false;
317
+ try {
318
+ old = now - statSync(path).mtimeMs > TICKET_GRACE_MS;
319
+ }
320
+ catch {
321
+ continue;
322
+ }
323
+ let state;
324
+ try {
325
+ state = probeFile(path, flockPath, () => {
326
+ if (old)
327
+ unlinkSync(path);
328
+ });
329
+ }
330
+ catch {
331
+ continue;
332
+ }
333
+ if (state.state !== "held")
334
+ continue;
335
+ const stat = state.label ? readProcessStat(state.label.pid) : null;
336
+ waiters.push({
337
+ name,
338
+ label: state.label,
339
+ stopped: Boolean(stat && (stat.state === "T" || stat.state === "t")),
340
+ });
341
+ }
342
+ return waiters;
343
+ }
344
+ /** Whether `own` is first in line among waiters that are not stopped. */
345
+ export function isHead(waiters, own) {
346
+ return waiters.find((waiter) => !waiter.stopped)?.name === own;
347
+ }
348
+ /**
349
+ * Verifies an inherited grant for nesting: every CPU it names is locked, by a
350
+ * live holder whose label carries the same lease, and this process's own
351
+ * affinity lies within it. Returns the grant's CPUs, or null when the
352
+ * variables are absent, stale or forged.
353
+ */
354
+ export function verifyLease(dir, env, inherited, flockPath = "flock") {
355
+ const lease = env.LOOM_SLOTS_LEASE;
356
+ const listed = env.LOOM_SLOT_CPUS;
357
+ if (!lease || !listed)
358
+ return null;
359
+ let cpus;
360
+ try {
361
+ cpus = parseCpuList(listed);
362
+ }
363
+ catch {
364
+ return null;
365
+ }
366
+ if (cpus.length === 0 || !inherited.every((cpu) => cpus.includes(cpu)))
367
+ return null;
368
+ for (const cpu of cpus) {
369
+ let state;
370
+ try {
371
+ state = probeFile(join(dir, `cpu-${cpu}`), flockPath);
372
+ }
373
+ catch {
374
+ return null;
375
+ }
376
+ if (state.state !== "held" ||
377
+ state.label?.lease !== lease ||
378
+ !holderAlive(state.label))
379
+ return null;
380
+ }
381
+ return cpus;
382
+ }
383
+ /** Reads every pool CPU's state for `loom slots status`. */
384
+ export function readSlots(dir, pool, flockPath = "flock") {
385
+ return pool.map((cpu) => {
386
+ let state;
387
+ try {
388
+ state = probeFile(join(dir, `cpu-${cpu}`), flockPath);
389
+ }
390
+ catch {
391
+ return { cpu, state: "unknown", label: null };
392
+ }
393
+ return state.state === "held"
394
+ ? { cpu, state: "held", label: state.label }
395
+ : { cpu, state: "free", label: null };
396
+ });
397
+ }
398
+ /**
399
+ * Finds a grant held by an ancestor of this process among the pool's slots,
400
+ * by matching each holder's pid and start time against this process's
401
+ * `/proc` parent chain. This recognises nesting even when an intermediary
402
+ * scrubbed the grant variables; without it an inner run would queue for CPUs
403
+ * its own ancestor holds and wait forever.
404
+ */
405
+ export function ancestorGrant(dir, pool, flockPath = "flock", ancestors = ancestorKeys()) {
406
+ const byLease = new Map();
407
+ for (const slot of readSlots(dir, pool, flockPath)) {
408
+ const label = slot.label;
409
+ if (slot.state === "held" &&
410
+ label?.kind === "slot" &&
411
+ ancestors.has(`${label.pid}:${label.pidStart}`))
412
+ byLease.set(label.lease, [...(byLease.get(label.lease) ?? []), slot.cpu]);
413
+ }
414
+ const [first] = byLease;
415
+ return first ? { lease: first[0], cpus: first[1] } : null;
416
+ }
417
+ //# sourceMappingURL=machineSlots.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"machineSlots.js","sourceRoot":"","sources":["../../../source/src/cli/machineSlots.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C;;;;;GAKG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EACL,SAAS,EACT,aAAa,EACb,WAAW,EACX,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,UAAU,EACV,SAAS,GACV,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,eAAe,GAChB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvD,2EAA2E;AAC3E,MAAM,CAAC,MAAM,UAAU,GAAG,eAAe,CAAC;AAE1C,yEAAyE;AACzE,MAAM,UAAU,GAAG,EAAE,CAAC;AAEtB,2EAA2E;AAC3E,MAAM,eAAe,GAAG,KAAK,CAAC;AAgB9B;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAChC,IAAY,EACZ,GAAuB,EACvB,GAAuB,EACvB,UAAmD,EAAE;IAErD,MAAM,KAAK,GAAG,CAAC,KAAyB,EAAE,IAAY,EAAE,EAAE;QACxD,IAAI,KAAK,KAAK,SAAS;YAAE,OAAO,SAAS,CAAC;QAC1C,IAAI,CAAC,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CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AAC5D,CAAC"}
@@ -0,0 +1,24 @@
1
+ /** Options `loom slots` accepts. */
2
+ export interface SlotsOptions {
3
+ min?: string;
4
+ max?: string;
5
+ label?: string;
6
+ waitTimeout?: string;
7
+ allowUnpooled?: boolean;
8
+ quiet?: boolean;
9
+ json?: boolean;
10
+ }
11
+ type Io = {
12
+ out: (line: string) => void;
13
+ err: (line: string) => void;
14
+ };
15
+ /** Whether this is CI: a CI variable set, and no agent-session marker. */
16
+ export declare function slotsProfile(env: Readonly<Record<string, string | undefined>>): "local" | "ci";
17
+ /** The label text a job shows other waiters: never its command line. */
18
+ export declare function jobLabel(explicit: string | undefined, env: Readonly<Record<string, string | undefined>>): string;
19
+ /** Which flags each subcommand accepts; anything else is a usage error. */
20
+ export declare function slotsFlagProblem(sub: string | undefined, options: SlotsOptions): string | null;
21
+ /** Entry point for `loom slots <sub> [-- command]`. */
22
+ export declare function runSlotsCommand(cwd: string, sub: string | undefined, command: string[], options: SlotsOptions, io: Io): Promise<number>;
23
+ export {};
24
+ //# sourceMappingURL=machineSlotsCommand.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"machineSlotsCommand.d.ts","sourceRoot":"","sources":["../../../source/src/cli/machineSlotsCommand.ts"],"names":[],"mappings":"AA+DA,oCAAoC;AACpC,MAAM,WAAW,YAAY;IAC3B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,KAAK,EAAE,GAAG;IAAE,GAAG,EAAE,CAAC,IAAI,EAAE,MAA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