@agentage/cli 0.66.1 → 0.67.0

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.
@@ -1,4 +1,4 @@
1
- import type { Installer } from '@agentage/extension/host';
1
+ import type { Installer } from '@agentage/apphost';
2
2
  import { type Npm, type NpmManifest } from '../../core/installer/npm.js';
3
3
  import { type Market } from '../../lib/net/market.js';
4
4
  export interface InstallerDeps {
@@ -1,4 +1,4 @@
1
- import type * as KitHost from '@agentage/extension/host';
1
+ import type * as AppHost from '@agentage/apphost';
2
2
  import { type Moved, type Skipped } from './move-plan.js';
3
3
  export declare const MOVED_MARKER = "installation.moved";
4
4
  export declare const MOVE_REPORT = "installation.moved.json";
@@ -7,7 +7,7 @@ export interface MoveReport {
7
7
  skipped: Skipped[];
8
8
  warning: string | null;
9
9
  }
10
- export type KitMove = Pick<typeof KitHost, 'updateInstallation' | 'withFileLock'>;
10
+ export type KitMove = Pick<typeof AppHost, 'updateInstallation' | 'withFileLock'>;
11
11
  export declare const readMoveReport: () => MoveReport | null;
12
12
  export interface MoveHooks {
13
13
  entry?: (moved: Moved) => void;
@@ -9,7 +9,7 @@ import { movePlan } from './move-plan.js';
9
9
  export const MOVED_MARKER = 'installation.moved';
10
10
  // What the last move did: the skipped entries and why, or the warning that stopped it.
11
11
  export const MOVE_REPORT = 'installation.moved.json';
12
- const kitMove = () => import('@agentage/extension/host');
12
+ const kitMove = () => import('@agentage/apphost');
13
13
  // An id in installation.json keeps its row: a rerun after a stop adds only what is missing.
14
14
  const addRow = (kit, row) => kit.updateInstallation(getConfigDir(), (doc) => doc.extensions.some((r) => r.id === row.id)
15
15
  ? doc
@@ -1,4 +1,4 @@
1
- import type { Installer } from '@agentage/extension/host';
1
+ import type { Installer } from '@agentage/apphost';
2
2
  export interface DaemonRunDeps {
3
3
  installer: () => Installer;
4
4
  before?: () => Promise<void>;
@@ -39,7 +39,7 @@ export const runDaemon = async (deps) => {
39
39
  // Attached first: a stop during the move or the boot is kept and served once the boot ends.
40
40
  const stopping = signalled();
41
41
  await deps.before?.().catch(running);
42
- const { createDaemon } = await import('@agentage/extension/host');
42
+ const { createDaemon } = await import('@agentage/apphost');
43
43
  const opts = {
44
44
  configDir: getConfigDir(),
45
45
  port: daemonPort(),
@@ -33,7 +33,7 @@ Docker stack up --docker started there (its containers, network and the store's
33
33
  --keep-data keeps the volume). It says so when nothing runs. Exits 1 when that fails.`;
34
34
  const TOKEN_HELP = `
35
35
  Prints a token from the dev issuer agentage extension up started for the package in --dir,
36
- alone on stdout, for calling /api/v1/ and /mcp by hand or from tests. Only up trusts it. Exits 1
36
+ alone on stdout, for calling /api/{id}/ and /mcp by hand or from tests. Only up trusts it. Exits 1
37
37
  when the stack on localhost:4281 is not this package's (it names the one that is), or when the
38
38
  issuer refuses or does not answer within 5 s. --issuer asks that issuer and skips the check.`;
39
39
  const DIR = '--dir <path>';
@@ -1,16 +1,3 @@
1
- import { isRecord } from '../fs/json-file.js';
2
1
  import {} from '../net/discovery.js';
3
- import { routeCall } from '../net/route-base.js';
4
- // The machines route's own 404 is MACHINE_NOT_FOUND; any other 404 is a host without the route.
5
- const missingRoute = async (res) => {
6
- if (res.status !== 404)
7
- return false;
8
- const body = await res
9
- .clone()
10
- .json()
11
- .catch(() => null);
12
- const error = isRecord(body) && isRecord(body['error']) ? body['error'] : {};
13
- return error['code'] !== 'MACHINE_NOT_FOUND';
14
- };
15
- // `machines` first, then the v13 `fallback` on a missing route; a 5xx decides nothing.
16
- export const machinesCall = (platform, path, call) => routeCall({ primary: platform.machines, fallback: platform.fallback }, path, call, missingRoute);
2
+ // The machines routes of the platform: one base, no v13 route (J.4.3).
3
+ export const machinesCall = (platform, path, call) => call(`${platform.machines}${path}`);
@@ -97,5 +97,5 @@ const fetchAt = async (auth, links, found, url, init, opts) => {
97
97
  await res.body?.cancel();
98
98
  throw refuse(links.auth, 'platform token refused (401) by the platform');
99
99
  };
100
- // The machines routes at `<platform>/api/platform/machines`, else the v13 `/api/v1/machines`.
100
+ // The machines routes at `<platform>/api/platform/machines`.
101
101
  export const platformFetch = (auth, links, found, path, init, opts) => machinesCall(found.platform, path, (url) => fetchAt(auth, links, found, url, init, opts));
@@ -3,7 +3,6 @@ type Get = (url: string) => Promise<Response>;
3
3
  export interface Platform {
4
4
  url: string;
5
5
  machines: string;
6
- fallback?: string;
7
6
  }
8
7
  export declare const issuerAllowed: (issuer: string, site: string) => boolean;
9
8
  export interface Target {
@@ -48,11 +48,7 @@ const platformOf = (doc, site, url) => {
48
48
  if (typeof platform !== 'string' || !sameSite(platform, site))
49
49
  throw new Error(`FAIL discovery: ${url} has no "platform"`);
50
50
  const origin = new URL(platform).origin;
51
- return {
52
- url: origin,
53
- machines: `${origin}/api/platform/machines`,
54
- fallback: `${origin}/api/v1/machines`,
55
- };
51
+ return { url: origin, machines: `${origin}/api/platform/machines` };
56
52
  };
57
53
  const issuerOf = (doc, base, url) => {
58
54
  const issuer = isRecord(doc) ? doc['issuer'] : undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentage/cli",
3
- "version": "0.66.1",
3
+ "version": "0.67.0",
4
4
  "description": "The agentage CLI - connect this machine to agentage from the terminal",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -54,7 +54,8 @@
54
54
  "prepublishOnly": "npm run verify"
55
55
  },
56
56
  "dependencies": {
57
- "@agentage/extension": "0.20.0",
57
+ "@agentage/apphost": "0.1.0",
58
+ "@agentage/extension": "0.20.2",
58
59
  "@electric-sql/pglite": "^0.5.16",
59
60
  "@tailwindcss/postcss": "^4.3.5",
60
61
  "chalk": "^6.0.0",
@@ -1,9 +0,0 @@
1
- type Call = (url: string) => Promise<Response>;
2
- export interface Bases {
3
- primary: string;
4
- fallback?: string;
5
- }
6
- export type Missing = (res: Response) => Promise<boolean>;
7
- export declare const forgetRouteBases: () => void;
8
- export declare const routeCall: ({ primary, fallback }: Bases, path: string, call: Call, missing: Missing) => Promise<Response>;
9
- export {};
@@ -1,34 +0,0 @@
1
- import { isRecord } from '../fs/json-file.js';
2
- // The base that answered, per primary base: a v13 row costs one 404 per run, not one per call.
3
- const chosen = new Map();
4
- export const forgetRouteBases = () => chosen.clear();
5
- // 4xx codes a route itself answers; 401, 403, 429 or an unknown body may be the edge's, not the route's.
6
- const OWNED = new Set(['VALIDATION_ERROR', 'CONFLICT', 'PRECONDITION_FAILED', 'MACHINE_NOT_FOUND']);
7
- const codeOf = async (res) => {
8
- const body = await res
9
- .clone()
10
- .json()
11
- .catch(() => null);
12
- const error = isRecord(body) && isRecord(body['error']) ? body['error'] : {};
13
- return error['code'];
14
- };
15
- // Only a 2xx or the route's own refusal pins a base.
16
- const pins = async (res) => res.ok || (res.status >= 400 && res.status < 500 && OWNED.has(String(await codeOf(res))));
17
- // `primary` first, then `fallback` on a missing route; a 5xx, 401, 403 or 429 decides nothing.
18
- export const routeCall = async ({ primary, fallback }, path, call, missing) => {
19
- const known = chosen.get(primary);
20
- if (known !== undefined || fallback === undefined)
21
- return call(`${known ?? primary}${path}`);
22
- const res = await call(`${primary}${path}`);
23
- if (!(await missing(res))) {
24
- if (await pins(res))
25
- chosen.set(primary, primary);
26
- return res;
27
- }
28
- // Unawaited: a tee'd body (a clone) cancels only once its sibling does.
29
- void res.body?.cancel().catch(() => undefined);
30
- const old = await call(`${fallback}${path}`);
31
- if (!(await missing(old)) && (await pins(old)))
32
- chosen.set(primary, fallback);
33
- return old;
34
- };