@gjermundgaraba/clankerbox-rivet-sandbox-agent 0.18.3 → 0.19.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.
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as NodeServices from "@effect/platform-node/NodeServices";
2
2
  import * as NodeClient from "@gjermundgaraba/clankerbox-sdk/node";
3
3
  import { Data, Duration, Effect, Exit, FileSystem, Layer, ManagedRuntime, Option, Predicate, Schedule, Schema, Scope, Semaphore } from "effect";
4
- import { ActionName, Client, Conflict, Internal, Prebuild, loadProfile, pinnedSsh, specRequest, sshTarget } from "@gjermundgaraba/clankerbox-sdk";
4
+ import { Client, Conflict, Internal, Prebuild, Superseded, loadProfile, pinnedSsh, specRequest, sshTarget } from "@gjermundgaraba/clankerbox-sdk";
5
5
  import { Hex } from "effect/encoding";
6
6
  import { SandboxDestroyedError } from "sandbox-agent";
7
7
  import { spawn } from "node:child_process";
@@ -124,17 +124,6 @@ const open = (start) => Effect.gen(function* () {
124
124
  });
125
125
  //#endregion
126
126
  //#region src/sandboxes.ts
127
- const makesMachine = {
128
- createMachine: true,
129
- forkMachine: true,
130
- restoreMachine: true,
131
- startMachine: false,
132
- stopMachine: false,
133
- deleteMachine: false,
134
- captureCheckpoint: false,
135
- deleteCheckpoint: false
136
- };
137
- const isActionName = Schema.is(ActionName);
138
127
  const name = "clankerbox";
139
128
  const healthWait = Duration.seconds(3);
140
129
  const Health = Schema.Struct({ status: Schema.Literal("ok") });
@@ -218,13 +207,13 @@ const make = (options, ssh = "ssh") => {
218
207
  });
219
208
  const discard = (error) => Effect.gen(function* () {
220
209
  const client = yield* Client.Client;
221
- if (error.made !== void 0 && isActionName(error.action) && makesMachine[error.action]) yield* Effect.ignore(client.deleteMachine({ id: error.made }));
210
+ if (error.made !== void 0 && !(error instanceof Conflict || error instanceof Superseded)) yield* Effect.ignore(client.deleteMachine({ id: error.made }));
222
211
  return yield* error;
223
212
  });
224
213
  return {
225
214
  create: Effect.suspend(() => {
226
215
  const named = `${options.namePrefix ?? "sandbox"}-${Hex.encode(globalThis.crypto.getRandomValues(/* @__PURE__ */ new Uint8Array(4)))}`;
227
- return made(named).pipe(Effect.map((machine) => machine.id), Effect.catch((error) => error instanceof Conflict ? Effect.fail(error) : discard(error)));
216
+ return made(named).pipe(Effect.map((machine) => machine.id), Effect.catch(discard));
228
217
  }),
229
218
  destroy: (id) => locked(id, (known) => Effect.gen(function* () {
230
219
  const client = yield* Client.Client;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gjermundgaraba/clankerbox-rivet-sandbox-agent",
3
- "version": "0.18.3",
3
+ "version": "0.19.0",
4
4
  "description": "clankerbox machines as sandboxes for Rivet's Sandbox Agent",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -25,19 +25,21 @@
25
25
  "access": "public"
26
26
  },
27
27
  "dependencies": {
28
- "@gjermundgaraba/clankerbox-sdk": "0.18.3"
28
+ "@gjermundgaraba/clankerbox-sdk": "0.19.0"
29
29
  },
30
30
  "devDependencies": {
31
- "@effect/platform-node": "4.0.4",
32
- "@types/node": "26.6.4",
33
- "effect": "4.0.4",
31
+ "@effect/platform-node": "4.0.5",
32
+ "@gjermundgaraba/effect-actions": "0.18.2",
33
+ "@types/node": "26.6.5",
34
+ "effect": "4.0.5",
34
35
  "sandbox-agent": "0.5.2",
35
36
  "typescript": "7.0.2",
36
- "vite": "npm:@voidzero-dev/vite-plus-core@1.2.0",
37
- "vite-plus": "1.2.0"
37
+ "vite": "npm:@voidzero-dev/vite-plus-core@1.3.0",
38
+ "vite-plus": "1.3.0"
38
39
  },
39
40
  "peerDependencies": {
40
41
  "@effect/platform-node": "~4.0.4",
42
+ "@gjermundgaraba/effect-actions": "^0.18.0",
41
43
  "effect": "~4.0.4",
42
44
  "sandbox-agent": "~0.5.2"
43
45
  },
File without changes
File without changes