@opencode-ai/util 0.0.0-beta-18414 → 0.0.0-beta-18593

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.
@@ -1,5 +1,3 @@
1
- import * as NodeFileSystem from "@effect/platform-node/NodeFileSystem";
2
- import * as NodePath from "@effect/platform-node/NodePath";
3
1
  import * as NodeSink from "@effect/platform-node/NodeSink";
4
2
  import * as NodeStream from "@effect/platform-node/NodeStream";
5
3
  import { Deferred, Effect, Exit, FileSystem, Layer, Path, PlatformError, Predicate, Sink, Stream } from "effect";
@@ -263,6 +261,16 @@ const makeCrossSpawnSpawner = Effect.gen(function* () {
263
261
  return Effect.void;
264
262
  return Effect.fail(toPlatformError("kill", new Error("Failed to kill child process"), command));
265
263
  });
264
+ const stop = (command, proc, exit, opts) => {
265
+ const send = (signal) => Effect.catch(killGroup(command, proc, signal), () => killOne(command, proc, signal));
266
+ const attempt = send(opts?.killSignal ?? "SIGTERM").pipe(Effect.andThen(Deferred.await(exit)), Effect.asVoid);
267
+ if (!opts?.forceKillAfter)
268
+ return attempt;
269
+ return Effect.timeoutOrElse(attempt, {
270
+ duration: opts.forceKillAfter,
271
+ orElse: () => send("SIGKILL").pipe(Effect.andThen(Deferred.await(exit)), Effect.asVoid),
272
+ });
273
+ };
266
274
  const timeout = (proc, command, opts) => (f) => {
267
275
  const signal = opts?.killSignal ?? "SIGTERM";
268
276
  if (Predicate.isUndefined(opts?.forceKillAfter))
@@ -313,16 +321,7 @@ const makeCrossSpawnSpawner = Effect.gen(function* () {
313
321
  return yield* Effect.ignore(kill(killGroup));
314
322
  return yield* Effect.void;
315
323
  }
316
- const send = (s) => Effect.catch(killGroup(command, proc, s), () => killOne(command, proc, s));
317
- const sig = command.options.killSignal ?? "SIGTERM";
318
- const attempt = send(sig).pipe(Effect.andThen(Deferred.await(signal)), Effect.asVoid);
319
- const escalated = command.options.forceKillAfter
320
- ? Effect.timeoutOrElse(attempt, {
321
- duration: command.options.forceKillAfter,
322
- orElse: () => send("SIGKILL").pipe(Effect.andThen(Deferred.await(signal)), Effect.asVoid),
323
- })
324
- : attempt;
325
- return yield* Effect.ignore(escalated);
324
+ return yield* Effect.ignore(stop(command, proc, signal, command.options));
326
325
  }));
327
326
  const fd = yield* setupFds(command, proc, extra);
328
327
  const out = setupOutput(command, proc, sout, serr);
@@ -341,17 +340,7 @@ const makeCrossSpawnSpawner = Effect.gen(function* () {
341
340
  return Effect.succeed(ExitCode(code));
342
341
  return Effect.fail(toPlatformError("exitCode", new Error(`Process interrupted due to receipt of signal: '${signal}'`), command));
343
342
  }),
344
- kill: (opts) => {
345
- const sig = opts?.killSignal ?? "SIGTERM";
346
- const send = (s) => Effect.catch(killGroup(command, proc, s), () => killOne(command, proc, s));
347
- const attempt = send(sig).pipe(Effect.andThen(Deferred.await(signal)), Effect.asVoid);
348
- if (!opts?.forceKillAfter)
349
- return attempt;
350
- return Effect.timeoutOrElse(attempt, {
351
- duration: opts.forceKillAfter,
352
- orElse: () => send("SIGKILL").pipe(Effect.andThen(Deferred.await(signal)), Effect.asVoid),
353
- });
354
- },
343
+ kill: (opts) => stop(command, proc, signal, opts),
355
344
  unref: Effect.sync(() => {
356
345
  if (ref) {
357
346
  proc.unref();
@@ -64,14 +64,14 @@ function walk(root, visit, options = {}) {
64
64
  const cached = cache.get(target);
65
65
  if (cached !== undefined || cache.has(target))
66
66
  return cached;
67
- if (options.detectCycles !== false && visiting.has(target)) {
67
+ if (visiting.has(target)) {
68
68
  const start = stack.indexOf(target);
69
69
  throw new Error(`Cycle detected in layer tree: ${[...stack.slice(start), target].map((item) => item.name).join(" -> ")}`);
70
70
  }
71
71
  visiting.add(target);
72
72
  stack.push(target);
73
73
  try {
74
- const result = visit(target, { cache, visit: recur });
74
+ const result = visit(target, { visit: recur });
75
75
  if (!cache.has(target))
76
76
  cache.set(target, result);
77
77
  return result;
package/dist/fs-util.js CHANGED
@@ -1,4 +1,3 @@
1
- import * as NodeFileSystem from "@effect/platform-node/NodeFileSystem";
2
1
  import path, { dirname, isAbsolute, join, relative, sep } from "path";
3
2
  import { realpathSync } from "fs";
4
3
  import { readdir } from "fs/promises";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@opencode-ai/util",
4
- "version": "0.0.0-beta-18414",
4
+ "version": "0.0.0-beta-18593",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -43,9 +43,9 @@
43
43
  "typecheck": "tsgo --noEmit"
44
44
  },
45
45
  "dependencies": {
46
- "@effect/opentelemetry": "4.0.0-rc.111",
47
- "@effect/platform-node": "4.0.0-rc.111",
48
- "@effect/platform-node-shared": "4.0.0-rc.111",
46
+ "@effect/opentelemetry": "4.0.0-rc.112",
47
+ "@effect/platform-node": "4.0.0-rc.112",
48
+ "@effect/platform-node-shared": "4.0.0-rc.112",
49
49
  "@npmcli/arborist": "9.4.0",
50
50
  "@npmcli/config": "10.8.1",
51
51
  "@opentelemetry/api": "1.9.0",
@@ -54,7 +54,7 @@
54
54
  "@opentelemetry/sdk-trace-base": "2.6.1",
55
55
  "@opentelemetry/sdk-trace-node": "2.6.1",
56
56
  "cross-spawn": "7.0.6",
57
- "effect": "4.0.0-rc.111",
57
+ "effect": "4.0.0-rc.112",
58
58
  "glob": "13.0.5",
59
59
  "mime-types": "3.0.2",
60
60
  "minimatch": "10.2.5",