@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/CHANGELOG.md +21 -0
- package/dist/src/commands/dev.d.ts.map +1 -1
- package/dist/src/commands/dev.js +37 -22
- package/dist/src/commands/dev.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -7
- package/src/commands/dev.ts +38 -22
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@amodalai/amodal",
|
|
3
|
-
"version": "0.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/
|
|
34
|
-
"@amodalai/
|
|
35
|
-
"@amodalai/
|
|
36
|
-
"@amodalai/
|
|
37
|
-
"@amodalai/studio": "0.3.
|
|
38
|
-
"@amodalai/runtime-app": "0.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",
|
package/src/commands/dev.ts
CHANGED
|
@@ -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
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
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
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
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
|
-
|
|
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
|
);
|