@gjermundgaraba/clankerbox-rivet-sandbox-agent 0.20.0 → 0.21.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.d.mts CHANGED
@@ -20,8 +20,6 @@ interface Options {
20
20
  readonly fresh?: boolean | undefined;
21
21
  /** `sandbox` by default. */
22
22
  readonly namePrefix?: string | undefined;
23
- /** The machine's own login user by default. */
24
- readonly sshUser?: string | undefined;
25
23
  /**
26
24
  * The path of a public-key file, such as your `id_ed25519.pub`, whose keys the host installs for
27
25
  * the login user after a profile's setup, as the client config's `authorizedKeys` does: the key
@@ -34,7 +32,7 @@ interface Options {
34
32
  * `-S`): the tunnel ends with its ssh, and those would outlive it.
35
33
  */
36
34
  readonly sshArguments?: ReadonlyArray<string> | undefined;
37
- /** `/home/user` by default, the login user's home, where the Ubuntu recipe runs the server. */
35
+ /** `/home/admin` by default, the login user's home, where the Ubuntu recipe runs the server. */
38
36
  readonly cwd?: string | undefined;
39
37
  }
40
38
  /**
package/dist/index.mjs CHANGED
@@ -166,7 +166,7 @@ const make = (options, ssh = "ssh") => {
166
166
  known.held = {
167
167
  tunnel: yield* Effect.gen(function* () {
168
168
  const directory = yield* (yield* FileSystem.FileSystem).makeTempDirectoryScoped({ prefix: "clankerbox-tunnel-" });
169
- const args = yield* pinnedSsh(target, options.sshUser ?? target.login.user, forwarding(port, options.sshArguments ?? []));
169
+ const args = yield* pinnedSsh(target, target.login.user, forwarding(port, options.sshArguments ?? []));
170
170
  return yield* open({
171
171
  program: ssh,
172
172
  args,
@@ -244,7 +244,7 @@ const provider = (options, layer, ssh) => {
244
244
  const sandboxes = make(options, ssh);
245
245
  return {
246
246
  name,
247
- defaultCwd: options.cwd ?? "/home/user",
247
+ defaultCwd: options.cwd ?? "/home/admin",
248
248
  create: () => runtime.runPromise(sandboxes.create),
249
249
  destroy: (id) => runtime.runPromise(sandboxes.destroy(id)),
250
250
  pause: (id) => runtime.runPromise(sandboxes.pause(id)),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gjermundgaraba/clankerbox-rivet-sandbox-agent",
3
- "version": "0.20.0",
3
+ "version": "0.21.0",
4
4
  "description": "clankerbox machines as sandboxes for Rivet's Sandbox Agent",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -25,7 +25,7 @@
25
25
  "access": "public"
26
26
  },
27
27
  "dependencies": {
28
- "@gjermundgaraba/clankerbox-sdk": "0.20.0"
28
+ "@gjermundgaraba/clankerbox-sdk": "0.21.0"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@effect/platform-node": "4.0.5",
@@ -1,9 +1,8 @@
1
1
  #!/bin/sh
2
2
  # A clankerbox setup that makes an x86_64 Ubuntu machine a sandbox for Rivet's Sandbox Agent:
3
- # the login user `user` with passwordless sudo, for whom the host then installs your keys, sshd
4
- # with root's login off where this recipe installs it, the Sandbox Agent's server and Claude Code
5
- # under `user`, and an /etc/clankerbox/start that keeps the server running on the guest's
6
- # loopback, port 2468.
3
+ # the login user `admin` with passwordless sudo, for whom the host then installs your keys, sshd
4
+ # with root's login off, the Sandbox Agent's server and Claude Code under `admin`, and an
5
+ # /etc/clankerbox/start that keeps the server running on the guest's loopback, port 2468.
7
6
  #
8
7
  # Name this directory, or a copy, as a profile's `setup.path`. An optional `agent.env` beside
9
8
  # it, of `NAME=value` lines such as `ANTHROPIC_API_KEY=…`, becomes the server's environment,
@@ -20,27 +19,22 @@ agent_sha256=5ebefccb130cccb0aa7972eacc8ff7c55550b959b2dd682a232a21a5712d955e
20
19
  node_version=22.23.3
21
20
  node_sha256=df450af89261115ef9f9e3830c3eeb2cc9213b63c720b1af623cb5dcbe2e02de
22
21
 
23
- # A base with its own sshd, such as boat's, keeps it as it is.
24
- if [ -x /usr/sbin/sshd ]; then own_sshd=false; else own_sshd=true; fi
25
-
26
22
  apt-get update -qq
27
23
  apt-get install -y -qq --no-install-recommends \
28
24
  openssh-server sudo curl ca-certificates xz-utils procps >/dev/null
29
25
 
30
- if [ "$own_sshd" = true ]; then
31
- install -d /etc/ssh/sshd_config.d
32
- echo "PermitRootLogin no" >/etc/ssh/sshd_config.d/10-clankerbox.conf
33
- fi
26
+ install -d /etc/ssh/sshd_config.d
27
+ echo "PermitRootLogin no" >/etc/ssh/sshd_config.d/10-clankerbox.conf
34
28
 
35
- # The login user, which boat's bases already have.
36
- if ! id user >/dev/null 2>&1; then
37
- useradd -m -s /bin/bash user
29
+ if ! id admin >/dev/null 2>&1; then
30
+ groupadd -f admin
31
+ useradd -m -s /bin/bash -g admin admin
38
32
  fi
39
33
 
40
- echo "user ALL=(ALL) NOPASSWD: ALL" >/var/tmp/sudoers-user
41
- visudo -cf /var/tmp/sudoers-user >/dev/null
42
- install -m 440 /var/tmp/sudoers-user /etc/sudoers.d/user
43
- rm /var/tmp/sudoers-user
34
+ echo "admin ALL=(ALL) NOPASSWD: ALL" >/var/tmp/sudoers-admin
35
+ visudo -cf /var/tmp/sudoers-admin >/dev/null
36
+ install -m 440 /var/tmp/sudoers-admin /etc/sudoers.d/admin
37
+ rm /var/tmp/sudoers-admin
44
38
 
45
39
  # Downloads $1 to $3 and refuses it unless its sha256 is $2.
46
40
  fetch() {
@@ -58,16 +52,16 @@ fetch "https://nodejs.org/dist/v$node_version/node-v$node_version-linux-x64.tar.
58
52
  tar -xJf /var/tmp/node.tar.xz -C /usr/local --strip-components=1 --no-same-owner
59
53
  rm /var/tmp/node.tar.xz
60
54
 
61
- # The agents run as `user`: as root, Claude Code offers no bypass-permissions mode.
55
+ # The agents run as `admin`: as root, Claude Code offers no bypass-permissions mode.
62
56
  if [ -s agent.env ]; then
63
- install -m 600 -o user -g "$(id -gn user)" agent.env /etc/sandbox-agent.env
57
+ install -m 600 -o admin -g "$(id -gn admin)" agent.env /etc/sandbox-agent.env
64
58
  fi
65
59
 
66
60
  # Claude Code at its latest release, and its adapter at the version the server pins. Other
67
61
  # agents install the same way; `install-agent codex` hangs in its own check at this version, so
68
62
  # give it a timeout too, and end what it leaves running. Claude's install takes about 30 s; 300 s
69
63
  # leaves room for a slow mirror.
70
- timeout 300 su - user -c 'sandbox-agent install-agent claude' >/var/tmp/install-agent.log 2>&1 || {
64
+ timeout 300 su - admin -c 'sandbox-agent install-agent claude' >/var/tmp/install-agent.log 2>&1 || {
71
65
  tail -n 15 /var/tmp/install-agent.log
72
66
  exit 1
73
67
  }
@@ -103,17 +97,17 @@ answers_within() {
103
97
  }
104
98
 
105
99
  running() {
106
- pgrep -u user -f 'sandbox-agent server' >/dev/null
100
+ pgrep -u admin -f 'sandbox-agent server' >/dev/null
107
101
  }
108
102
 
109
103
  # A running server gets 10 s to answer, since this runs at every start, a running machine's too,
110
104
  # before it is ended as hung: TERM, then KILL after 5 s, as a hung one may ignore TERM.
111
105
  if running && ! answers_within 10; then
112
- pkill -u user -f 'sandbox-agent server' || true
106
+ pkill -u admin -f 'sandbox-agent server' || true
113
107
  for tries in $(seq 40); do
114
108
  running || break
115
109
  if [ "$tries" -eq 20 ]; then
116
- pkill -KILL -u user -f 'sandbox-agent server' || true
110
+ pkill -KILL -u admin -f 'sandbox-agent server' || true
117
111
  fi
118
112
  sleep 0.25
119
113
  done
@@ -121,7 +115,7 @@ fi
121
115
 
122
116
  # The server listens on loopback alone, with no token: guest port 22 is the only way to it.
123
117
  if ! running; then
124
- su - user -c '
118
+ su - admin -c '
125
119
  if [ -r /etc/sandbox-agent.env ]; then set -a; . /etc/sandbox-agent.env; set +a; fi
126
120
  setsid -f sandbox-agent server --no-token --no-telemetry >/dev/null 2>&1
127
121
  '