docks-kit 0.21.0 → 0.22.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.
@@ -16,6 +16,7 @@ import {
16
16
  advisorRecommendation,
17
17
  buildOmpArgs,
18
18
  ladderCeiling,
19
+ ompChildEnvironment,
19
20
  overlayFileName,
20
21
  planEffortChoice,
21
22
  parseFreeModels,
@@ -80,20 +81,20 @@ export function resolveFreeSelector(
80
81
  }
81
82
 
82
83
  /**
83
- * The omp profile that the forwarded arguments select. omp reads
84
- * `--profile <name>` or `--profile=<name>` before a `--`, the last one wins,
85
- * and it rejects a missing or empty name. The catalog check must query the
86
- * profile the session runs, so it reads the arguments the same way.
84
+ * Every omp profile that the forwarded arguments can select, in argv order.
85
+ * omp reads `--profile <name>` or `--profile=<name>`, the last one wins, and
86
+ * it rejects a missing or empty name. The scan does not stop at `--`,
87
+ * because omp can read that `--` as the value of a flag such as
88
+ * `--system-prompt` and still select a later profile.
87
89
  */
88
90
  export type ForwardedProfile =
89
- | { readonly ok: true; readonly profile: string | undefined }
91
+ | { readonly ok: true; readonly profiles: ReadonlyArray<string> }
90
92
  | { readonly ok: false; readonly message: string };
91
93
 
92
94
  export function forwardedProfile(forwarded: ReadonlyArray<string>): ForwardedProfile {
93
- let profile: string | undefined;
95
+ const profiles: Array<string> = [];
94
96
  for (let index = 0; index < forwarded.length; index++) {
95
97
  const arg = forwarded[index]!;
96
- if (arg === "--") break;
97
98
  let value: string | undefined;
98
99
  if (arg === "--profile") {
99
100
  value = forwarded[index + 1];
@@ -105,9 +106,48 @@ export function forwardedProfile(forwarded: ReadonlyArray<string>): ForwardedPro
105
106
  continue;
106
107
  }
107
108
  if (value === "") return { ok: false, message: "--profile requires a profile name" };
108
- profile = value;
109
+ profiles.push(value);
109
110
  }
110
- return { ok: true, profile };
111
+ return { ok: true, profiles };
112
+ }
113
+
114
+ // omp flags that can select a model the free overlay does not control.
115
+ const MODEL_SELECTING_FLAGS: Record<string, true> = {
116
+ "--config": true,
117
+ "--model": true,
118
+ "--smol": true,
119
+ "--slow": true,
120
+ "--plan": true,
121
+ "--models": true,
122
+ "--provider": true,
123
+ "--prewalk-into": true,
124
+ "--plan-yolo-into": true,
125
+ };
126
+
127
+ export type ForwardedFlagCheck =
128
+ | { readonly ok: true }
129
+ | { readonly ok: false; readonly message: string };
130
+
131
+ /**
132
+ * Reject a forwarded omp flag that can select a model outside the free
133
+ * session. The scan does not stop at `--`, because omp can read that `--` as
134
+ * the value of a flag and then parse the next token as a flag.
135
+ */
136
+ export function rejectedForwardedFlag(forwarded: ReadonlyArray<string>): ForwardedFlagCheck {
137
+ for (const arg of forwarded) {
138
+ const equals = arg.indexOf("=");
139
+ const flag = equals === -1 ? arg : arg.slice(0, equals);
140
+ if (MODEL_SELECTING_FLAGS[flag] !== true) continue;
141
+ const configNote =
142
+ flag === "--config"
143
+ ? " To load another config, list it in PI_CONFIG_FILES, which omp loads below the overlay."
144
+ : "";
145
+ return {
146
+ ok: false,
147
+ message: `Forwarded ${flag} can select a model outside the free session. For a free model, put --model <selector> before other arguments or use --pick; for a paid model, run omp directly.${configNote}`,
148
+ };
149
+ }
150
+ return { ok: true };
111
151
  }
112
152
 
113
153
  const loadFreeCatalog = (
@@ -213,6 +253,11 @@ const pickLevels = (catalogModel: CatalogModel) =>
213
253
 
214
254
  export const ompCommand = Command.make("omp", { model, pick, fast, args }, (config) =>
215
255
  Effect.gen(function* () {
256
+ // Check the forwarded arguments before omp, the catalog, or kit.db, so a
257
+ // rejected launch starts no process and writes nothing.
258
+ const forwardedFlag = rejectedForwardedFlag(config.args);
259
+ if (!forwardedFlag.ok) return yield* bail(forwardedFlag.message);
260
+
216
261
  if (Option.isSome(config.model) && config.pick) {
217
262
  return yield* bail("Pass either --model <selector> or --pick, not both");
218
263
  }
@@ -251,13 +296,24 @@ export const ompCommand = Command.make("omp", { model, pick, fast, args }, (conf
251
296
  if (config.pick && (!process.stdin.isTTY || !process.stdout.isTTY)) {
252
297
  return yield* bail("Picking needs a terminal; pass --model <selector> instead");
253
298
  }
254
- // Every launch reads the live catalog once, because a remembered or
255
- // default model can be renamed, repriced, or lose its provider login.
256
- // omp then silently starts a paid default model instead. The catalog
257
- // comes from the profile that the forwarded arguments select.
299
+ // Every launch reads the live catalog, because a remembered or default
300
+ // model can be renamed, repriced, or lose its provider login. omp then
301
+ // silently starts a paid default model instead. omp can run the
302
+ // environment's profile or any forwarded one, so the session model must
303
+ // be free in the catalog of each.
258
304
  const profile = forwardedProfile(config.args);
259
305
  if (!profile.ok) return yield* bail(profile.message);
260
- const free = yield* loadFreeCatalog(omp, profile.profile);
306
+ const candidates: Array<string | undefined> = [undefined];
307
+ for (const name of profile.profiles) {
308
+ if (!candidates.includes(name)) candidates.push(name);
309
+ }
310
+ const catalogs: Array<ReadonlyArray<CatalogModel>> = [];
311
+ for (const candidate of candidates) {
312
+ catalogs.push(yield* loadFreeCatalog(omp, candidate));
313
+ }
314
+ // --model and --pick choose from the catalog of the last forwarded
315
+ // profile, which omp selects when no flag consumes it.
316
+ const free = catalogs[candidates.indexOf(profile.profiles.at(-1))]!;
261
317
  // The value the launcher writes is the value it runs, so a concurrent
262
318
  // launcher or a failed read of kit.db cannot change this session.
263
319
  let chosen: OmpSessionModel | undefined;
@@ -298,19 +354,22 @@ export const ompCommand = Command.make("omp", { model, pick, fast, args }, (conf
298
354
  };
299
355
  }
300
356
 
301
- if (chosen !== undefined) {
302
- const remembered = chosen;
303
- yield* Effect.sync(() => writeOmpSessionModel(home, remembered));
304
- }
305
-
306
357
  const session: OmpSessionModel =
307
358
  chosen ?? (yield* Effect.sync(() => readOmpSessionModel(home))) ?? DEFAULT_OMP_SESSION_MODEL;
308
- if (!free.some((candidate) => candidate.selector === session.selector)) {
359
+ const freeInEveryProfile = catalogs.every((catalog) =>
360
+ catalog.some((candidate) => candidate.selector === session.selector),
361
+ );
362
+ if (!freeInEveryProfile) {
309
363
  return yield* bail(
310
364
  `free model '${session.selector}' is not available in the omp catalog (renamed, repriced, or provider not logged in); log in to its provider or choose another with --model or --pick`,
311
365
  );
312
366
  }
313
367
 
368
+ if (chosen !== undefined) {
369
+ const remembered = chosen;
370
+ yield* Effect.sync(() => writeOmpSessionModel(home, remembered));
371
+ }
372
+
314
373
  // A stable cache path, not a temp file deleted at exit, because omp may
315
374
  // re-read the overlay during a live session. The name carries a digest of
316
375
  // the rendered overlay, so a second launcher on another model or level
@@ -344,8 +403,20 @@ export const ompCommand = Command.make("omp", { model, pick, fast, args }, (conf
344
403
  `Starting omp with ${session.selector} at ${levelText}${advisorText} (session only; deployed config unchanged)`,
345
404
  );
346
405
 
406
+ // An exported model variable would set its role above the overlay, so the
407
+ // session gets the overlay value and the user sees what changed.
408
+ const childEnvironment = ompChildEnvironment(process.env, overlayPath, session);
409
+ for (const name of childEnvironment.replaced) {
410
+ yield* Console.error(
411
+ `${name} is set; this session uses ${childEnvironment.env[name]} instead`,
412
+ );
413
+ }
414
+
347
415
  const child = yield* Effect.sync(() =>
348
- spawnHost("omp", buildOmpArgs(overlayPath, config.args), { stdio: "inherit" }),
416
+ spawnHost("omp", buildOmpArgs(overlayPath, session, config.args), {
417
+ stdio: "inherit",
418
+ env: childEnvironment.env,
419
+ }),
349
420
  );
350
421
  if (child.error !== undefined) {
351
422
  return yield* bail(
@@ -357,6 +428,6 @@ export const ompCommand = Command.make("omp", { model, pick, fast, args }, (conf
357
428
  }),
358
429
  ).pipe(
359
430
  Command.withDescription(
360
- "Start omp with every chat-model role set to the remembered free model for this run only. The web-search role keeps the deployed provider order, which can include a paid model. No deployed configuration changes; --model or --pick remembers a new free default. Every launch checks the model against the live free catalog. --fast instead toggles OpenAI/Codex fast mode in the deployed omp config and exits.",
431
+ "Start omp with every chat-model role set to the remembered free model for this run only. The launcher starts 'omp launch' with an explicit --model, so omp reads a forwarded subcommand name as message text and a resumed session keeps the free model. It rejects forwarded flags that can select another model (--config, --model, --smol, --slow, --plan, --models, --provider, --prewalk-into, --plan-yolo-into); run omp directly for a paid model or a subcommand. The web-search role keeps the deployed provider order, which can include a paid model. No deployed configuration changes; --model or --pick remembers a new free default. Every launch checks the model against the live free catalog of each candidate profile. --fast instead toggles OpenAI/Codex fast mode in the deployed omp config and exits.",
361
432
  ),
362
433
  );
@@ -70,6 +70,6 @@ export const scratchCommand = Command.make("scratch", { action, operands }, (con
70
70
  }),
71
71
  ).pipe(
72
72
  Command.withDescription(
73
- "Create or remove agent temporary directories; removal accepts only paths inside the scratch root, the system temporary directory, or /var/tmp.",
73
+ "Create an agent temporary directory, or remove agent temporary files and directories; removal accepts only paths inside the scratch root, the system temporary directory, or /var/tmp.",
74
74
  ),
75
75
  );
@@ -180,7 +180,8 @@ active logger binding.
180
180
 
181
181
  ## Platform Support
182
182
 
183
- - EngineNative supports Linux, macOS, and Windows on x64 and arm64.
183
+ - EngineNative supports Linux on x64 and arm64, macOS on arm64, and Windows on
184
+ x64.
184
185
  - Unsupported hosts fail before launcher fallback, dependency probes, downloads,
185
186
  settings writes, or sync work.
186
187
  - Claude runtime settings use absolute Bun/script paths and materialize
@@ -204,8 +205,8 @@ active logger binding.
204
205
  command checks, and compilation and execution of the native host artifact.
205
206
  The Linux-canonical snapshot lane stays on Ubuntu and runs both golden suites
206
207
  plus their prove-red checks.
207
- - `.github/workflows/release-cli.yml` publishes six binaries for Linux, macOS,
208
- and Windows on x64 and arm64, plus `SHA256SUMS` and the npm package.
208
+ - `.github/workflows/release-cli.yml` publishes four binaries (Linux x64 and
209
+ arm64, macOS arm64, Windows x64), plus `SHA256SUMS` and the npm package.
209
210
 
210
211
  ## Non-Goals
211
212
 
@@ -1,15 +1,17 @@
1
1
  /**
2
2
  * Run overlay for `docks-kit omp`. The overlay merges over the deployed omp
3
3
  * config for one run only. It sets the 16 roles in ROLE_ORDER to the free
4
- * model and empties the 13 retry chains in FALLBACK_ORDER. omp merges the
5
- * overlay key by key, so each deployed retry chain that is not in
6
- * FALLBACK_ORDER stays as deployed. The `web` role and its retry chain are
7
- * not in the overlay, so the deployed web-search provider order applies, and
8
- * that order can include a paid chat model. A deployed `plan`, `slow`, or
9
- * `designer` chain also stays and can name a paid model. Every other key
10
- * falls through to the deployed config.
4
+ * model and empties the 13 retry chains in FALLBACK_ORDER and the chains keyed
5
+ * by the free model. omp merges the overlay key by key, so each deployed retry
6
+ * chain that is not in FALLBACK_ORDER stays as deployed. The `web` role and
7
+ * its retry chain are not in the overlay, so the deployed web-search provider
8
+ * order applies, and that order can include a paid chat model. A deployed
9
+ * `plan`, `slow`, or `designer` chain also stays, but a retry of the free
10
+ * model uses the empty chain keyed by that model first. Every other key falls
11
+ * through to the deployed config.
11
12
  */
12
13
  import { createHash } from "node:crypto";
14
+ import { delimiter } from "node:path";
13
15
  import type { OmpSessionModel } from "./harnesses";
14
16
 
15
17
  export interface CatalogModel {
@@ -199,42 +201,110 @@ export function advisorRecommendation(
199
201
  return known[Math.max(0, index - 2)];
200
202
  }
201
203
 
204
+ /** A thinking level the overlay can render, or undefined for a blank one. */
205
+ function renderableLevel(level: string | undefined): string | undefined {
206
+ return typeof level === "string" && level.trim() !== "" ? level : undefined;
207
+ }
208
+
209
+ /**
210
+ * The value the overlay gives one role. The overlay, the session `--model`,
211
+ * and the child environment all use it, so the three cannot drift apart. A
212
+ * model without a level gets the bare selector so the deployed level applies.
213
+ */
214
+ function roleValue(model: OmpSessionModel, role: string): string {
215
+ const thinking = renderableLevel(model.thinking);
216
+ if (thinking === undefined) return model.selector;
217
+ const level =
218
+ role === "advisor" ? (renderableLevel(model.advisorThinking) ?? thinking) : thinking;
219
+ return `${model.selector}:${level}`;
220
+ }
221
+
202
222
  /**
203
223
  * Render the run overlay as YAML text. Empty fallback chains keep a retry
204
224
  * from falling back onto a paid model. A model without a level renders bare
205
225
  * selectors with no thinking keys so the deployed values apply.
206
226
  */
207
227
  export function renderFreeOverlay(model: OmpSessionModel): string {
208
- const thinking =
209
- typeof model.thinking === "string" && model.thinking.trim() !== "" ? model.thinking : undefined;
228
+ const thinking = renderableLevel(model.thinking);
210
229
  const lines: Array<string> = ["# Generated per run by docks-kit omp. Edits are overwritten."];
211
- if (thinking !== undefined) {
212
- lines.push(`defaultThinkingLevel: ${thinking}`, "modelRoles:");
213
- const advisor =
214
- typeof model.advisorThinking === "string" && model.advisorThinking.trim() !== ""
215
- ? model.advisorThinking
216
- : thinking;
217
- for (const role of ROLE_ORDER) {
218
- lines.push(` ${role}: ${model.selector}:${role === "advisor" ? advisor : thinking}`);
219
- }
220
- lines.push("task:", ` maxEffort: ${thinking}`);
221
- } else {
222
- lines.push("modelRoles:");
223
- for (const role of ROLE_ORDER) {
224
- lines.push(` ${role}: ${model.selector}`);
225
- }
230
+ if (thinking !== undefined) lines.push(`defaultThinkingLevel: ${thinking}`);
231
+ lines.push("modelRoles:");
232
+ for (const role of ROLE_ORDER) {
233
+ lines.push(` ${role}: ${roleValue(model, role)}`);
226
234
  }
235
+ if (thinking !== undefined) lines.push("task:", ` maxEffort: ${thinking}`);
227
236
  lines.push("retry:", " fallbackChains:");
228
237
  for (const chain of FALLBACK_ORDER) {
229
238
  lines.push(` ${chain}: []`);
230
239
  }
240
+ // A chain keyed by the selector outranks a role chain, so a project or
241
+ // PI_CONFIG_FILES chain for the free model could otherwise reach a paid
242
+ // model. The session can run the model at any level, `off` included.
243
+ for (const level of [undefined, "off", ...THINKING_LADDER]) {
244
+ const key = level === undefined ? model.selector : `${model.selector}:${level}`;
245
+ lines.push(` ${JSON.stringify(key)}: []`);
246
+ }
231
247
  return `${lines.join("\n")}\n`;
232
248
  }
233
249
 
234
- /** Build the omp argv with the overlay flag ahead of the forwarded args. */
250
+ /**
251
+ * Build the omp argv. `launch` first makes omp read every forwarded word as
252
+ * message text, so no omp subcommand, with its own model selection, runs
253
+ * through the launcher. The explicit `--model` outranks a restored session
254
+ * model, so `--continue` and `--resume` keep the free model.
255
+ */
235
256
  export function buildOmpArgs(
236
257
  overlayPath: string,
258
+ session: OmpSessionModel,
237
259
  passthrough: ReadonlyArray<string>,
238
260
  ): ReadonlyArray<string> {
239
- return ["--config", overlayPath, ...passthrough];
261
+ return [
262
+ "launch",
263
+ "--config",
264
+ overlayPath,
265
+ "--model",
266
+ roleValue(session, "default"),
267
+ ...passthrough,
268
+ ];
269
+ }
270
+
271
+ // Variables that omp reads at launch to set a role above every config layer.
272
+ const MODEL_ENV_ROLES: ReadonlyArray<readonly [string, string]> = [
273
+ ["PI_SMOL_MODEL", "smol"],
274
+ ["PI_SLOW_MODEL", "slow"],
275
+ ["PI_PLAN_MODEL", "plan"],
276
+ ];
277
+
278
+ export interface OmpChildEnvironment {
279
+ readonly env: Record<string, string | undefined>;
280
+ /** Model variables whose non-empty parent value the overlay value replaced. */
281
+ readonly replaced: ReadonlyArray<string>;
282
+ }
283
+
284
+ /**
285
+ * The omp session environment. The model variables get the overlay role
286
+ * values, because removing them would let a `.env` file refill them. The
287
+ * overlay joins PI_CONFIG_FILES, so an omp that the session's bash tool
288
+ * starts loads it too.
289
+ */
290
+ export function ompChildEnvironment(
291
+ parent: Readonly<Record<string, string | undefined>>,
292
+ overlayPath: string,
293
+ session: OmpSessionModel,
294
+ ): OmpChildEnvironment {
295
+ const inherited = (parent["PI_CONFIG_FILES"] ?? "")
296
+ .split(delimiter)
297
+ .filter((entry) => entry !== "");
298
+ const env: Record<string, string | undefined> = {
299
+ ...parent,
300
+ PI_CONFIG_FILES: [...inherited, overlayPath].join(delimiter),
301
+ };
302
+ const replaced: Array<string> = [];
303
+ for (const [name, role] of MODEL_ENV_ROLES) {
304
+ const value = roleValue(session, role);
305
+ const previous = parent[name];
306
+ if (previous !== undefined && previous !== "" && previous !== value) replaced.push(name);
307
+ env[name] = value;
308
+ }
309
+ return { env, replaced };
240
310
  }
@@ -10,13 +10,7 @@
10
10
  */
11
11
  import { platformName, type PlatformName } from "./index";
12
12
 
13
- export type TargetId =
14
- | "linux-x64"
15
- | "linux-arm64"
16
- | "darwin-x64"
17
- | "darwin-arm64"
18
- | "windows-x64"
19
- | "windows-arm64";
13
+ export type TargetId = "linux-x64" | "linux-arm64" | "darwin-arm64" | "windows-x64";
20
14
 
21
15
  export type TargetArch = "x64" | "arm64";
22
16
 
@@ -32,8 +26,8 @@ export interface HostTarget {
32
26
  readonly unameKeys: ReadonlyArray<string>;
33
27
  /**
34
28
  * `$env:PROCESSOR_ARCHITECTURE` values the PowerShell launcher matches; empty
35
- * off Windows. Windows PowerShell 5.1 runs emulated on ARM64 and reports
36
- * `AMD64` there, so a launcher must read `PROCESSOR_ARCHITEW6432` first.
29
+ * off Windows. A 32-bit shell on an x64 host reports `x86` there, so a
30
+ * launcher must read `PROCESSOR_ARCHITEW6432` first.
37
31
  */
38
32
  readonly processorArchitectures: ReadonlyArray<string>;
39
33
  }
@@ -57,10 +51,8 @@ const target = (
57
51
  export const HOST_TARGETS: ReadonlyArray<HostTarget> = [
58
52
  target("linux-x64", "linux", "x64", ["Linux-x86_64"], []),
59
53
  target("linux-arm64", "linux", "arm64", ["Linux-aarch64"], []),
60
- target("darwin-x64", "darwin", "x64", ["Darwin-x86_64"], []),
61
54
  target("darwin-arm64", "darwin", "arm64", ["Darwin-arm64"], []),
62
55
  target("windows-x64", "windows", "x64", [], ["AMD64"]),
63
- target("windows-arm64", "windows", "arm64", [], ["ARM64"]),
64
56
  ];
65
57
 
66
58
  function targetFor(platform: PlatformName, arch: string): HostTarget | undefined {
@@ -97,7 +97,7 @@ function commandShimInvocation(executablePath: string, args: ReadonlyArray<strin
97
97
  } as const;
98
98
  }
99
99
 
100
- // Host module for the windows-x64 and windows-arm64 targets admitted in os/targets.ts.
100
+ // Host module for the windows-x64 target admitted in os/targets.ts.
101
101
  export const windows: HostOs = {
102
102
  id: "windows",
103
103
  toolchainOs: "windows",
@@ -8,6 +8,9 @@
8
8
  * the holder checks staleness again before it removes the lock. Thus two
9
9
  * runs never both remove a stale lock and both create a new one.
10
10
  * - A run removes the lock and the mutex only while they still hold its token.
11
+ * - On Windows, another process can delete or hold the lock or the mutex while
12
+ * a run reads or removes it. Such a path counts as absent, and only the
13
+ * exclusive create decides the result.
11
14
  */
12
15
  import { randomBytes } from "node:crypto";
13
16
  import {
@@ -35,13 +38,31 @@ function errorCode(cause: unknown): string | undefined {
35
38
  : undefined;
36
39
  }
37
40
 
38
- /** Create `path` with `wx` and write `text`; false when the path exists. */
41
+ /**
42
+ * Windows keeps a deleted file "delete pending" while a handle to it is open,
43
+ * and refuses a new open of that name with ERROR_ACCESS_DENIED. A delete of a
44
+ * file that another process holds without delete sharing fails with
45
+ * ERROR_SHARING_VIOLATION. libuv, which runs the `node:fs` calls of Bun and
46
+ * Node.js on Windows, reports these errors as EPERM and EBUSY.
47
+ */
48
+ const WINDOWS_CONTENTION: Record<string, true> = { EBUSY: true, EPERM: true };
49
+
50
+ /** True on Windows for an error that another process causes when it deletes or holds the path. */
51
+ function isWindowsContention(cause: unknown): boolean {
52
+ const code = errorCode(cause);
53
+ return process.platform === "win32" && code !== undefined && WINDOWS_CONTENTION[code] === true;
54
+ }
55
+
56
+ /**
57
+ * Create `path` with `wx` and write `text`. False when the path exists or, on
58
+ * Windows, when another process deletes it now.
59
+ */
39
60
  function createExclusive(path: string, text: string): boolean {
40
61
  let fd: number;
41
62
  try {
42
63
  fd = openSync(path, "wx", 0o600);
43
64
  } catch (cause) {
44
- if (errorCode(cause) === "EEXIST") return false;
65
+ if (errorCode(cause) === "EEXIST" || isWindowsContention(cause)) return false;
45
66
  throw cause;
46
67
  }
47
68
  try {
@@ -52,13 +73,13 @@ function createExclusive(path: string, text: string): boolean {
52
73
  return true;
53
74
  }
54
75
 
55
- /** `lstat`, `undefined` when absent; any other error throws. */
76
+ /** `lstat`; `undefined` when absent or, on Windows, when another process deletes it. */
56
77
  function lstatIfPresent(path: string): Stats | undefined {
57
78
  try {
58
79
  return lstatSync(path);
59
80
  } catch (cause) {
60
81
  const code = errorCode(cause);
61
- if (code === "ENOENT" || code === "ENOTDIR") return undefined;
82
+ if (code === "ENOENT" || code === "ENOTDIR" || isWindowsContention(cause)) return undefined;
62
83
  throw cause;
63
84
  }
64
85
  }
@@ -71,11 +92,15 @@ function readText(path: string): string | undefined {
71
92
  }
72
93
  }
73
94
 
95
+ /**
96
+ * Remove `path`. Ignore a path that is absent or, on Windows, a path that
97
+ * another process deletes or holds.
98
+ */
74
99
  function unlinkIfPresent(path: string): void {
75
100
  try {
76
101
  unlinkSync(path);
77
102
  } catch (cause) {
78
- if (errorCode(cause) !== "ENOENT") throw cause;
103
+ if (errorCode(cause) !== "ENOENT" && !isWindowsContention(cause)) throw cause;
79
104
  }
80
105
  }
81
106
 
package/cli/src/engine.ts CHANGED
@@ -21,7 +21,7 @@ const requireSupportedHost = () => {
21
21
  return targetForHost(platform, arch) !== undefined
22
22
  ? Effect.void
23
23
  : bail(
24
- `unsupported host ${platform}/${arch}; docks-kit supports only Linux, macOS, and Windows on x64 or arm64`,
24
+ `unsupported host ${platform}/${arch}; docks-kit supports Linux on x64 and arm64, macOS on arm64, and Windows on x64`,
25
25
  2,
26
26
  );
27
27
  };