@amodalai/amodal 0.3.39 → 0.3.41

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.39",
3
+ "version": "0.3.41",
4
4
  "description": "Amodal CLI",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -26,12 +26,12 @@
26
26
  "react": "^19.2.4",
27
27
  "yargs": "^17.7.2",
28
28
  "zod": "^4.3.6",
29
- "@amodalai/types": "0.3.39",
30
- "@amodalai/core": "0.3.39",
31
- "@amodalai/db": "0.3.39",
32
- "@amodalai/runtime": "0.3.39",
33
- "@amodalai/studio": "0.3.39",
34
- "@amodalai/runtime-app": "0.3.39"
29
+ "@amodalai/types": "0.3.41",
30
+ "@amodalai/core": "0.3.41",
31
+ "@amodalai/db": "0.3.41",
32
+ "@amodalai/runtime": "0.3.41",
33
+ "@amodalai/studio": "0.3.41",
34
+ "@amodalai/runtime-app": "0.3.41"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@types/node": "^20.11.24",
@@ -4,10 +4,9 @@
4
4
  * SPDX-License-Identifier: MIT
5
5
  */
6
6
 
7
- import {readFile} from 'node:fs/promises';
8
- import * as path from 'node:path';
9
7
  import {
10
8
  fetchAdminAgent,
9
+ getAdminAgentConfig,
11
10
  getAdminAgentVersion,
12
11
  } from '@amodalai/core';
13
12
  import {findRepoRoot} from '../shared/repo-discovery.js';
@@ -17,7 +16,6 @@ import {findRepoRoot} from '../shared/repo-discovery.js';
17
16
  * Called by `amodal update --admin-agent`.
18
17
  */
19
18
  export async function updateAdminAgentCommand(): Promise<number> {
20
- // Check if amodal.json overrides the admin agent
21
19
  let repoPath: string | undefined;
22
20
  try {
23
21
  repoPath = findRepoRoot();
@@ -25,27 +23,20 @@ export async function updateAdminAgentCommand(): Promise<number> {
25
23
  // Not in a repo — that's fine
26
24
  }
27
25
 
28
- if (repoPath) {
29
- try {
30
- const configRaw = await readFile(path.join(repoPath, 'amodal.json'), 'utf-8');
31
- const parsed: unknown = JSON.parse(configRaw);
32
- if (parsed && typeof parsed === 'object' && 'adminAgent' in parsed) {
33
-
34
- const adminPath = (parsed as Record<string, unknown>)['adminAgent'];
35
- if (typeof adminPath === 'string') {
36
- process.stderr.write(`[update] Admin agent is overridden in amodal.json (adminAgent: "${adminPath}").\n`);
37
- process.stderr.write('[update] The global cache is not used. Update your local copy directly.\n');
38
- return 1;
39
- }
40
- }
41
- } catch {
42
- // No config or parse error — proceed
43
- }
26
+ const config = await getAdminAgentConfig(repoPath);
27
+
28
+ if (config.pathOverride) {
29
+ process.stderr.write(`[update] Admin agent is overridden in amodal.json (adminAgent: "${config.pathOverride}").\n`);
30
+ process.stderr.write('[update] The global cache is not used. Update your local copy directly.\n');
31
+ return 1;
44
32
  }
45
33
 
46
- process.stderr.write('[update] Fetching latest admin agent from registry...\n');
34
+ process.stderr.write(config.pinnedVersion
35
+ ? `[update] Fetching admin agent v${config.pinnedVersion} from registry...\n`
36
+ : '[update] Fetching latest admin agent from registry...\n');
37
+
47
38
  try {
48
- const dir = await fetchAdminAgent();
39
+ const dir = await fetchAdminAgent({version: config.pinnedVersion});
49
40
  const version = await getAdminAgentVersion(dir);
50
41
  process.stderr.write(`[update] Admin agent updated to v${version ?? 'unknown'}\n`);
51
42
  process.stderr.write(`[update] Cached at ${dir}\n`);
@@ -12,7 +12,7 @@ import {spawn} from 'node:child_process';
12
12
  import path from 'node:path';
13
13
  import {fileURLToPath} from 'node:url';
14
14
  import {createLocalServer, initLogLevel, interceptConsole, log} from '@amodalai/runtime';
15
- import {ensureAdminAgent} from '@amodalai/core';
15
+ import {ensureAdminAgent, getAdminAgentConfig, getAdminAgentVersion, checkRegistryVersion} from '@amodalai/core';
16
16
  import {findRepoRoot} from '../shared/repo-discovery.js';
17
17
  import {createServer} from 'node:net';
18
18
  import {runConnectionPreflight, printPreflightTable} from '../shared/connection-preflight.js';
@@ -179,6 +179,7 @@ function spawnStudio(opts: {
179
179
  repoPath: string;
180
180
  agentId?: string;
181
181
  adminAgentUrl?: string;
182
+ basePath?: string;
182
183
  }): StudioSpawnResult | null {
183
184
  const studioDir = resolveStudioDir();
184
185
  if (!studioDir) {
@@ -197,6 +198,7 @@ function spawnStudio(opts: {
197
198
  HOSTNAME: '0.0.0.0',
198
199
  ...(opts.agentId ? {AGENT_ID: opts.agentId} : {}),
199
200
  ...(opts.adminAgentUrl ? {ADMIN_AGENT_URL: opts.adminAgentUrl} : {}),
201
+ ...(opts.basePath ? {BASE_PATH: opts.basePath} : {}),
200
202
  };
201
203
 
202
204
  // Pre-built server (npm install): dist-server/studio-server.js
@@ -287,6 +289,27 @@ async function spawnAdminAgent(opts: {
287
289
  return null;
288
290
  }
289
291
 
292
+ const adminVersion = await getAdminAgentVersion(adminAgentPath);
293
+ log.info('admin_agent_resolved', {path: adminAgentPath, version: adminVersion ?? 'unknown'});
294
+
295
+ // Non-blocking upgrade check for unpinned admin agent
296
+ void (async () => {
297
+ try {
298
+ const config = await getAdminAgentConfig(opts.repoPath);
299
+ if (config.pathOverride || config.pinnedVersion) return;
300
+ const cached = await getAdminAgentVersion(adminAgentPath);
301
+ if (!cached) return;
302
+ const registry = await checkRegistryVersion();
303
+ if (registry && registry !== cached) {
304
+ process.stderr.write(
305
+ `[admin] Admin agent v${cached} — v${registry} available (run \`amodal update --admin-agent\` to upgrade)\n`,
306
+ );
307
+ }
308
+ } catch {
309
+ // Non-blocking — silently ignore
310
+ }
311
+ })().catch(() => {});
312
+
290
313
  // Verify the admin agent directory has an amodal.json
291
314
  if (!existsSync(path.join(adminAgentPath, 'amodal.json'))) {
292
315
  log.warn('admin_agent_invalid', {