@agentshouse/kit 0.1.0-alpha.41 → 0.1.0-alpha.43

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/README.md CHANGED
@@ -13,13 +13,13 @@ The Skill set Kit installs is Matt Pocock's
13
13
  Linux (`amd64`, `arm64`) or macOS (Apple silicon, Intel):
14
14
 
15
15
  ```sh
16
- bash <(curl -fsSL https://github.com/agentshouse/kit/releases/download/v0.1.0-alpha.41/connect-linux.sh)
16
+ bash <(curl -fsSL https://github.com/agentshouse/kit/releases/download/v0.1.0-alpha.43/connect-linux.sh)
17
17
  ```
18
18
 
19
19
  Windows 11 (`amd64`), in PowerShell:
20
20
 
21
21
  ```powershell
22
- & ([scriptblock]::Create((irm https://github.com/agentshouse/kit/releases/download/v0.1.0-alpha.41/connect-windows.ps1)))
22
+ & ([scriptblock]::Create((irm https://github.com/agentshouse/kit/releases/download/v0.1.0-alpha.43/connect-windows.ps1)))
23
23
  ```
24
24
 
25
25
  The command sets up Docker if it is missing, creates `~/.house-kit` (Kit home;
package/bootstrap.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "version": "0.1.0-alpha.41",
3
+ "version": "0.1.0-alpha.43",
4
4
  "hosts": {
5
5
  "linux": {
6
- "command": "bash <(curl -fsSL https://github.com/agentshouse/kit/releases/download/v0.1.0-alpha.41/connect-linux.sh)",
6
+ "command": "bash <(curl -fsSL https://github.com/agentshouse/kit/releases/download/v0.1.0-alpha.43/connect-linux.sh)",
7
7
  "asset": {
8
8
  "name": "connect-linux.sh",
9
- "url": "https://github.com/agentshouse/kit/releases/download/v0.1.0-alpha.41/connect-linux.sh"
9
+ "url": "https://github.com/agentshouse/kit/releases/download/v0.1.0-alpha.43/connect-linux.sh"
10
10
  },
11
11
  "workspace": {
12
12
  "argument": "--workspace",
@@ -14,10 +14,10 @@
14
14
  }
15
15
  },
16
16
  "windows": {
17
- "command": "& ([scriptblock]::Create((irm https://github.com/agentshouse/kit/releases/download/v0.1.0-alpha.41/connect-windows.ps1)))",
17
+ "command": "& ([scriptblock]::Create((irm https://github.com/agentshouse/kit/releases/download/v0.1.0-alpha.43/connect-windows.ps1)))",
18
18
  "asset": {
19
19
  "name": "connect-windows.ps1",
20
- "url": "https://github.com/agentshouse/kit/releases/download/v0.1.0-alpha.41/connect-windows.ps1"
20
+ "url": "https://github.com/agentshouse/kit/releases/download/v0.1.0-alpha.43/connect-windows.ps1"
21
21
  },
22
22
  "workspace": {
23
23
  "argument": "--workspace",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentshouse/kit",
3
- "version": "0.1.0-alpha.41",
3
+ "version": "0.1.0-alpha.43",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
package/src/workspace.js CHANGED
@@ -201,6 +201,13 @@ export async function workspacePrerequisites(host, image) {
201
201
  if (version.status !== 0 || version.stdout.trim() === "") {
202
202
  return { supported: false, refusal: "the container runtime daemon did not answer a version" };
203
203
  }
204
+ const swap = await docker(host, ["info", "--format", "{{.SwapLimit}}"]);
205
+ if (swap.status !== 0 || swap.stdout.trim() !== "true") {
206
+ return {
207
+ supported: false,
208
+ refusal: "the container runtime cannot enforce the workspace memory and swap ceiling",
209
+ };
210
+ }
204
211
  const formatter = await docker(host, [
205
212
  "run",
206
213
  "--rm",
@@ -401,7 +408,7 @@ async function placeReplacement(host, settings, identity, held, running) {
401
408
  }
402
409
 
403
410
  async function rollBack(host, identity, running, cause) {
404
- const unrestored = await restorePrevious(host, identity);
411
+ const unrestored = await restorePrevious(host, identity, true);
405
412
  if (unrestored !== null) return `${cause}, and ${unrestored}`;
406
413
  if (!running) return cause;
407
414
  const restarted = await docker(host, ["start", identity]);
@@ -409,10 +416,16 @@ async function rollBack(host, identity, running, cause) {
409
416
  return `${cause}, and the workspace did not start again: ${restarted.stderr.trim()}`;
410
417
  }
411
418
 
412
- async function restorePrevious(host, identity) {
419
+ async function restorePrevious(host, identity, rollingBack = false) {
413
420
  const previous = previousName(identity);
414
421
  if ((await workspacePresent(host, previous)) === null) return null;
415
- if ((await workspacePresent(host, identity)) !== null) {
422
+ const current = await workspacePresent(host, identity);
423
+ if (current === "running" && !rollingBack) {
424
+ const removed = await docker(host, ["rm", "--force", previous]);
425
+ if (removed.status !== 0) return `the previous workspace was not removed: ${removed.stderr.trim()}`;
426
+ return null;
427
+ }
428
+ if (current !== null) {
416
429
  const discarded = await docker(host, ["rm", "--force", identity]);
417
430
  if (discarded.status !== 0) {
418
431
  return `the replacement was not removed: ${discarded.stderr.trim()}`;