@amodalai/amodal 0.3.3 → 0.3.4

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": "@amodalai/amodal",
3
- "version": "0.3.3",
3
+ "version": "0.3.4",
4
4
  "description": "Amodal CLI",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -30,12 +30,12 @@
30
30
  "semver": "^7.6.0",
31
31
  "yargs": "^17.7.2",
32
32
  "zod": "^4.3.6",
33
- "@amodalai/types": "0.3.3",
34
- "@amodalai/core": "0.3.3",
35
- "@amodalai/db": "0.3.3",
36
- "@amodalai/runtime": "0.3.3",
37
- "@amodalai/studio": "0.3.3",
38
- "@amodalai/runtime-app": "0.3.3"
33
+ "@amodalai/core": "0.3.4",
34
+ "@amodalai/db": "0.3.4",
35
+ "@amodalai/runtime": "0.3.4",
36
+ "@amodalai/types": "0.3.4",
37
+ "@amodalai/studio": "0.3.4",
38
+ "@amodalai/runtime-app": "0.3.4"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@types/node": "^20.11.24",
@@ -158,9 +158,6 @@ function spawnStudio(opts: {
158
158
  repoPath: string;
159
159
  agentId?: string;
160
160
  }): StudioSpawnResult | null {
161
- // Resolve @amodalai/studio package directory. Try two strategies:
162
- // 1. Sibling directory relative to the CLI package (works when symlinked from outside)
163
- // 2. Node module resolution via createRequire (works when installed as a dependency)
164
161
  const studioDir = resolveStudioDir();
165
162
  if (!studioDir) {
166
163
  log.info('studio_not_available', {
@@ -169,17 +166,43 @@ function spawnStudio(opts: {
169
166
  return null;
170
167
  }
171
168
 
172
- // Resolve the `next` binary from the studio-app's dependency tree.
173
- // In pnpm the binary may live in the package's own node_modules or in a
174
- // hoisted location; createRequire resolves correctly in both cases.
175
- let nextBin: string;
176
- try {
169
+ const studioEnv: NodeJS.ProcessEnv = {
170
+ ...process.env,
171
+ REPO_PATH: opts.repoPath,
172
+ STUDIO_CORS_ORIGINS: `http://localhost:${String(opts.runtimePort)}`,
173
+ RUNTIME_URL: `http://localhost:${String(opts.runtimePort)}`,
174
+ PORT: String(opts.port),
175
+ HOSTNAME: 'localhost',
176
+ ...(opts.agentId ? {AGENT_ID: opts.agentId} : {}),
177
+ };
178
+
179
+ // Pre-built server (npm install): dist-server/studio-server.js
180
+ // Source mode (monorepo dev): src/server/studio-server.ts via tsx
181
+ const prebuiltEntry = path.join(studioDir, 'dist-server', 'studio-server.js');
182
+ const sourceEntry = path.join(studioDir, 'src', 'server', 'studio-server.ts');
183
+
184
+ let spawnArgs: string[];
185
+
186
+ if (existsSync(prebuiltEntry)) {
187
+ log.info('studio_prebuilt', {path: prebuiltEntry});
188
+ spawnArgs = [prebuiltEntry];
189
+ } else if (existsSync(sourceEntry)) {
190
+ // Resolve tsx from the studio package's dependency tree
177
191
  const studioRequire = createRequire(path.join(studioDir, 'package.json'));
178
- // next/dist/bin/next is the actual CLI entrypoint
179
- nextBin = studioRequire.resolve('next/dist/bin/next');
180
- } catch {
181
- log.info('studio_next_not_found', {
182
- hint: 'next binary not resolvable from @amodalai/studio — Studio subprocess skipped',
192
+ let tsxBin: string;
193
+ try {
194
+ tsxBin = studioRequire.resolve('tsx/dist/cli.mjs');
195
+ } catch {
196
+ log.info('studio_tsx_not_found', {
197
+ hint: 'tsx not resolvable from @amodalai/studio — Studio subprocess skipped',
198
+ });
199
+ return null;
200
+ }
201
+ log.info('studio_dev_mode', {tsxBin, entry: sourceEntry});
202
+ spawnArgs = [tsxBin, sourceEntry];
203
+ } else {
204
+ log.info('studio_entry_not_found', {
205
+ hint: 'Neither dist-server nor src/server found — Studio subprocess skipped',
183
206
  });
184
207
  return null;
185
208
  }
@@ -187,17 +210,10 @@ function spawnStudio(opts: {
187
210
  const studioUrl = `http://localhost:${String(opts.port)}`;
188
211
  const child = spawn(
189
212
  process.execPath,
190
- [nextBin, 'dev', '--port', String(opts.port)],
213
+ spawnArgs,
191
214
  {
192
215
  cwd: studioDir,
193
- env: {
194
- ...process.env,
195
- REPO_PATH: opts.repoPath,
196
- STUDIO_CORS_ORIGINS: `http://localhost:${String(opts.runtimePort)}`,
197
- RUNTIME_URL: `http://localhost:${String(opts.runtimePort)}`,
198
- PORT: String(opts.port),
199
- ...(opts.agentId ? {AGENT_ID: opts.agentId} : {}),
200
- },
216
+ env: studioEnv,
201
217
  stdio: ['ignore', 'pipe', 'pipe'],
202
218
  },
203
219
  );