@omg-dev/sandbox 0.4.32 → 0.4.34

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omg-dev/sandbox",
3
- "version": "0.4.32",
3
+ "version": "0.4.34",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -1,7 +1,7 @@
1
1
  import { describe, expect, test } from "bun:test";
2
2
  import { join } from "node:path";
3
3
  import { applyTemplate, apt, check, compileStartScript, compileStep, defineTemplate, download, files, run, templateRuntimeContract, templateVersionRef } from "./templates";
4
- import { agentTemplates } from "../../../templates/agent-catalog";
4
+ import { agentTemplates, CLOUD_COMPUTER_DEFAULT_FOLDER } from "../../../templates/agent-catalog";
5
5
  import type { Sandbox } from "./client";
6
6
 
7
7
  const FIXTURE_DIR = join(import.meta.dirname, "__fixtures__", "mini-template");
@@ -148,7 +148,7 @@ describe("sandbox templates", () => {
148
148
 
149
149
  test("LFG owns every runtime dependency and zero-config transport default", () => {
150
150
  const lfg = agentTemplates.lfg;
151
- expect(templateVersionRef(lfg)).toBe("agent-lfg-v33");
151
+ expect(templateVersionRef(lfg)).toBe("agent-lfg-v43");
152
152
  expect(lfg.install).toContainEqual(apt.packages(["tmux"]));
153
153
  expect(lfg.checks).toContainEqual(check.command("tmux"));
154
154
  expect(lfg.checks).toContainEqual(check.file("/home/user/lfg/omg-start.sh"));
@@ -156,7 +156,7 @@ describe("sandbox templates", () => {
156
156
  expect(lfg.start?.env?.LIVE_TRANSPORT).toBe("ws");
157
157
  expect(lfg.start?.readiness?.port).toBe(8766);
158
158
  expect(templateRuntimeContract(lfg, templateVersionRef(lfg))).toEqual({
159
- immutableRef: "agent-lfg-v33",
159
+ immutableRef: "agent-lfg-v43",
160
160
  restoreKind: "full_rootfs",
161
161
  startCommand: "exec /home/user/.omg/template/bootstrap.sh",
162
162
  readinessPort: 8766,
@@ -171,7 +171,15 @@ describe("sandbox templates", () => {
171
171
  expect(startScript).toBeDefined();
172
172
  expect(startScript!).toContain("LFG_CONNECT_EVENTS=1");
173
173
  expect(startScript!).toContain("relay-credentials.json");
174
- expect(startScript!).toContain("trap cleanup EXIT INT TERM");
174
+ expect(startScript!).toContain("trap stop_child EXIT");
175
+ expect(startScript!).toContain("trap cleanup EXIT");
176
+ expect(startScript!).toContain("trap 'exit 143' TERM");
177
+ expect(startScript!).not.toContain("trap cleanup EXIT INT TERM");
178
+ expect(startScript!).not.toContain("trap stop_child EXIT INT TERM");
179
+ expect(startScript!).toContain("export LFG_HOST=0.0.0.0");
180
+ expect(startScript!).toContain("export LFG_PORT=8766");
181
+ expect(startScript!).toContain("export LIVE_TRANSPORT=ws");
182
+ expect(startScript!).toContain('cd "$LFG_ROOT"');
175
183
  });
176
184
 
177
185
  test("LFG bakes the react-ts scaffold into /home/user/project at bake time", () => {
@@ -188,10 +196,33 @@ describe("sandbox templates", () => {
188
196
  .filter((step): step is Extract<typeof step, { kind: "run" }> => step.kind === "run")
189
197
  .map((step) => step.command);
190
198
  expect(commands.some((c) => c.includes("recipe.sh"))).toBe(true);
191
- expect(lfg.metadata?.lfgRelease).toBe("v0.1.167");
199
+ expect(lfg.metadata?.lfgRelease).toBe("v0.1.209");
192
200
  const lfgInstall = commands.find((c) => c.includes("bun install --production"));
193
201
  expect(lfgInstall).toBeDefined();
194
202
  expect(lfgInstall!).not.toContain("delete manifest.workspaces");
195
203
  expect(lfgInstall!).not.toContain("rm -f bun.lock bun.lockb");
196
204
  });
205
+
206
+ test("a new Computer starts with an initialized personal folder in LFG", () => {
207
+ expect(CLOUD_COMPUTER_DEFAULT_FOLDER).toEqual({
208
+ name: "personal",
209
+ path: "/home/user/project",
210
+ });
211
+
212
+ const lfg = agentTemplates.lfg;
213
+ const commands = lfg.install
214
+ .filter((step): step is Extract<typeof step, { kind: "run" }> => step.kind === "run")
215
+ .map((step) => ({ cwd: step.cwd, command: step.command }));
216
+ expect(commands).toContainEqual(expect.objectContaining({
217
+ cwd: CLOUD_COMPUTER_DEFAULT_FOLDER.path,
218
+ command: expect.stringContaining("git init -q"),
219
+ }));
220
+ expect(commands).toContainEqual(expect.objectContaining({
221
+ command: expect.stringContaining(
222
+ JSON.stringify([{ name: "personal", cwd: "/home/user/project" }]),
223
+ ),
224
+ }));
225
+ expect(lfg.checks).toContainEqual(check.file("/home/user/project/.git/HEAD"));
226
+ expect(lfg.checks).toContainEqual(check.file("/home/user/lfg/data/custom-repos.json"));
227
+ });
197
228
  });