@spencer-kit/coder-studio 0.4.5 → 0.4.7

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.
@@ -6,14 +6,14 @@
6
6
  <meta name="description" content="Coder Studio - Agent-First Development Environment" />
7
7
  <title>Coder Studio</title>
8
8
  <link rel="icon" type="image/x-icon" href="/favicon.ico" />
9
- <script type="module" crossorigin src="/assets/main-ShJ51B7m.js"></script>
9
+ <script type="module" crossorigin src="/assets/main-BMKYuTcM.js"></script>
10
10
  <link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-CpWojdLp.js">
11
11
  <link rel="modulepreload" crossorigin href="/assets/monaco-editor-VTbRDH-J.js">
12
12
  <link rel="modulepreload" crossorigin href="/assets/xterm-BVlcrOZ1.js">
13
- <link rel="modulepreload" crossorigin href="/assets/components-CFZItGai.js">
13
+ <link rel="modulepreload" crossorigin href="/assets/components-ynft7c9H.js">
14
14
  <link rel="stylesheet" crossorigin href="/assets/monaco-editor-Br_kD0ds.css">
15
15
  <link rel="stylesheet" crossorigin href="/assets/xterm-BrP-ENHg.css">
16
- <link rel="stylesheet" crossorigin href="/assets/components-BGEBLvHB.css">
16
+ <link rel="stylesheet" crossorigin href="/assets/components-BC_6z_aX.css">
17
17
  </head>
18
18
  <body>
19
19
  <div id="root"></div>
@@ -4,14 +4,14 @@
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <title>Coder Studio UI Preview</title>
7
- <script type="module" crossorigin src="/assets/ui-preview-CKpnmBtY.js"></script>
7
+ <script type="module" crossorigin src="/assets/ui-preview-BC1JKu3-.js"></script>
8
8
  <link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-CpWojdLp.js">
9
9
  <link rel="modulepreload" crossorigin href="/assets/monaco-editor-VTbRDH-J.js">
10
10
  <link rel="modulepreload" crossorigin href="/assets/xterm-BVlcrOZ1.js">
11
- <link rel="modulepreload" crossorigin href="/assets/components-CFZItGai.js">
11
+ <link rel="modulepreload" crossorigin href="/assets/components-ynft7c9H.js">
12
12
  <link rel="stylesheet" crossorigin href="/assets/monaco-editor-Br_kD0ds.css">
13
13
  <link rel="stylesheet" crossorigin href="/assets/xterm-BrP-ENHg.css">
14
- <link rel="stylesheet" crossorigin href="/assets/components-BGEBLvHB.css">
14
+ <link rel="stylesheet" crossorigin href="/assets/components-BC_6z_aX.css">
15
15
  </head>
16
16
  <body>
17
17
  <div id="root"></div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spencer-kit/coder-studio",
3
- "version": "0.4.5",
3
+ "version": "0.4.7",
4
4
  "type": "module",
5
5
  "description": "Deploy once, code everywhere. Browser-based AI coding workspace for Claude Code and Codex.",
6
6
  "main": "./dist/esm/index.mjs",
@@ -4,6 +4,12 @@ import { join } from "node:path";
4
4
  import { afterEach, describe, expect, it, vi } from "vitest";
5
5
  import { runRestartHandoff, runUpdateWorker } from "./update-worker.js";
6
6
 
7
+ type UpdateWorkerDeps = NonNullable<Parameters<typeof runUpdateWorker>[1]>;
8
+ type RestartHandoffDeps = NonNullable<Parameters<typeof runRestartHandoff>[1]>;
9
+ type RunCommandMock = NonNullable<UpdateWorkerDeps["runCommand"]>;
10
+ type SpawnDetachedProcessMock = NonNullable<UpdateWorkerDeps["spawnDetachedProcess"]>;
11
+ type WaitForProcessExitMock = NonNullable<RestartHandoffDeps["waitForProcessExit"]>;
12
+
7
13
  describe("update-worker", () => {
8
14
  const tempDirs: string[] = [];
9
15
 
@@ -31,8 +37,8 @@ describe("update-worker", () => {
31
37
 
32
38
  it("writes restarting state and spawns a detached restart handoff after install success", async () => {
33
39
  const env = createEnv();
34
- const runCommand = vi.fn(async () => {});
35
- const spawnDetachedProcess = vi.fn(async () => {});
40
+ const runCommand = vi.fn<RunCommandMock>(async () => {});
41
+ const spawnDetachedProcess = vi.fn<SpawnDetachedProcessMock>(async () => {});
36
42
 
37
43
  await runUpdateWorker(env, {
38
44
  runCommand,
@@ -61,7 +67,7 @@ describe("update-worker", () => {
61
67
 
62
68
  it("falls back to manual_required on permission-related install errors", async () => {
63
69
  const env = createEnv();
64
- const runCommand = vi.fn(async () => {
70
+ const runCommand = vi.fn<RunCommandMock>(async () => {
65
71
  throw new Error("npm install failed with EACCES");
66
72
  });
67
73
 
@@ -82,8 +88,10 @@ describe("update-worker", () => {
82
88
 
83
89
  it("marks restart failures with manual restart guidance", async () => {
84
90
  const env = createEnv();
85
- const runCommand = vi.fn().mockRejectedValueOnce(new Error("pm2 restart failed"));
86
- const waitForProcessExit = vi.fn(async () => {});
91
+ const runCommand = vi
92
+ .fn<RunCommandMock>()
93
+ .mockRejectedValueOnce(new Error("pm2 restart failed"));
94
+ const waitForProcessExit = vi.fn<WaitForProcessExitMock>(async () => {});
87
95
 
88
96
  await runRestartHandoff(env, {
89
97
  runCommand,
@@ -105,8 +113,8 @@ describe("update-worker", () => {
105
113
 
106
114
  it("sanitizes pm2 and runtime override env before invoking install and restart commands", async () => {
107
115
  const env = createEnv();
108
- const runCommand = vi.fn(async () => {});
109
- const spawnDetachedProcess = vi.fn(async () => {});
116
+ const runCommand = vi.fn<RunCommandMock>(async () => {});
117
+ const spawnDetachedProcess = vi.fn<SpawnDetachedProcessMock>(async () => {});
110
118
  const originalEnv = {
111
119
  PM2_HOME: process.env.PM2_HOME,
112
120
  PM2_PROGRAMMATIC: process.env.PM2_PROGRAMMATIC,
@@ -150,8 +158,12 @@ describe("update-worker", () => {
150
158
  }
151
159
  }
152
160
 
153
- for (const call of runCommand.mock.calls) {
154
- const options = call[2] as { env?: NodeJS.ProcessEnv };
161
+ for (const [, , options] of runCommand.mock.calls) {
162
+ expect(options).toBeDefined();
163
+ if (!options) {
164
+ throw new Error("Expected runCommand to receive an options object");
165
+ }
166
+
155
167
  expect(options.env?.PM2_HOME).toBe("/tmp/custom-pm2-home");
156
168
  expect(options.env?.PM2_PROGRAMMATIC).toBeUndefined();
157
169
  expect(options.env?.PM2_JSON_PROCESSING).toBeUndefined();
@@ -165,7 +177,8 @@ describe("update-worker", () => {
165
177
  expect(options.env?.pm_id).toBeUndefined();
166
178
  }
167
179
 
168
- const handoffEnv = spawnDetachedProcess.mock.calls[0]?.[2] as NodeJS.ProcessEnv | undefined;
180
+ const handoffCall = spawnDetachedProcess.mock.calls[0];
181
+ const handoffEnv = handoffCall?.[2];
169
182
  expect(handoffEnv?.PM2_HOME).toBe("/tmp/custom-pm2-home");
170
183
  expect(handoffEnv?.PM2_PROGRAMMATIC).toBeUndefined();
171
184
  expect(handoffEnv?.PM2_JSON_PROCESSING).toBeUndefined();
@@ -180,8 +193,8 @@ describe("update-worker", () => {
180
193
 
181
194
  it("waits for the install worker to exit before running the restart command", async () => {
182
195
  const env = createEnv();
183
- const waitForProcessExit = vi.fn(async () => {});
184
- const runCommand = vi.fn(async () => {});
196
+ const waitForProcessExit = vi.fn<WaitForProcessExitMock>(async () => {});
197
+ const runCommand = vi.fn<RunCommandMock>(async () => {});
185
198
 
186
199
  await runRestartHandoff(env, {
187
200
  runCommand,