@amodalai/amodal 0.3.39 → 0.3.40

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.40",
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.40",
30
+ "@amodalai/core": "0.3.40",
31
+ "@amodalai/db": "0.3.40",
32
+ "@amodalai/runtime": "0.3.40",
33
+ "@amodalai/studio": "0.3.40",
34
+ "@amodalai/runtime-app": "0.3.40"
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';
@@ -287,6 +287,27 @@ async function spawnAdminAgent(opts: {
287
287
  return null;
288
288
  }
289
289
 
290
+ const adminVersion = await getAdminAgentVersion(adminAgentPath);
291
+ log.info('admin_agent_resolved', {path: adminAgentPath, version: adminVersion ?? 'unknown'});
292
+
293
+ // Non-blocking upgrade check for unpinned admin agent
294
+ void (async () => {
295
+ try {
296
+ const config = await getAdminAgentConfig(opts.repoPath);
297
+ if (config.pathOverride || config.pinnedVersion) return;
298
+ const cached = await getAdminAgentVersion(adminAgentPath);
299
+ if (!cached) return;
300
+ const registry = await checkRegistryVersion();
301
+ if (registry && registry !== cached) {
302
+ process.stderr.write(
303
+ `[admin] Admin agent v${cached} — v${registry} available (run \`amodal update --admin-agent\` to upgrade)\n`,
304
+ );
305
+ }
306
+ } catch {
307
+ // Non-blocking — silently ignore
308
+ }
309
+ })().catch(() => {});
310
+
290
311
  // Verify the admin agent directory has an amodal.json
291
312
  if (!existsSync(path.join(adminAgentPath, 'amodal.json'))) {
292
313
  log.warn('admin_agent_invalid', {