@agentage/extension 0.12.3 → 0.14.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.
Files changed (119) hide show
  1. package/dist/api/openapi-doc.js +2 -1
  2. package/dist/api/routes.js +1 -1
  3. package/dist/context/context.d.ts +1 -0
  4. package/dist/context/context.js +3 -3
  5. package/dist/context/secrets.d.ts +1 -0
  6. package/dist/context/secrets.js +7 -5
  7. package/dist/context/settings.d.ts +4 -0
  8. package/dist/context/settings.js +6 -5
  9. package/dist/discovery/discovery.d.ts +1 -0
  10. package/dist/discovery/discovery.schema.d.ts +2 -0
  11. package/dist/discovery/discovery.schema.js +30 -12
  12. package/dist/discovery/openapi.d.ts +2 -1
  13. package/dist/discovery/openapi.js +3 -1
  14. package/dist/host/daemon/add.d.ts +9 -0
  15. package/dist/host/daemon/add.js +63 -0
  16. package/dist/host/daemon/child.d.ts +23 -0
  17. package/dist/host/daemon/child.js +100 -0
  18. package/dist/host/daemon/daemon-files.d.ts +17 -0
  19. package/dist/host/daemon/daemon-files.js +27 -0
  20. package/dist/host/daemon/daemon-owner.d.ts +1 -0
  21. package/dist/host/daemon/daemon-owner.js +32 -0
  22. package/dist/host/daemon/daemon.d.ts +17 -0
  23. package/dist/host/daemon/daemon.js +106 -0
  24. package/dist/host/daemon/entries.d.ts +21 -0
  25. package/dist/host/daemon/entries.js +24 -0
  26. package/dist/host/daemon/guard.d.ts +2 -0
  27. package/dist/host/daemon/guard.js +16 -0
  28. package/dist/host/daemon/installation.d.ts +36 -0
  29. package/dist/host/daemon/installation.js +92 -0
  30. package/dist/host/daemon/installer-call.d.ts +21 -0
  31. package/dist/host/daemon/installer-call.js +48 -0
  32. package/dist/host/daemon/json-file.d.ts +4 -0
  33. package/dist/host/daemon/json-file.js +62 -0
  34. package/dist/host/daemon/lane.d.ts +9 -0
  35. package/dist/host/daemon/lane.js +24 -0
  36. package/dist/host/daemon/limits.d.ts +11 -0
  37. package/dist/host/daemon/limits.js +22 -0
  38. package/dist/host/daemon/ops.d.ts +12 -0
  39. package/dist/host/daemon/ops.js +89 -0
  40. package/dist/host/daemon/patch-values.d.ts +6 -0
  41. package/dist/host/daemon/patch-values.js +39 -0
  42. package/dist/host/daemon/pending.d.ts +15 -0
  43. package/dist/host/daemon/pending.js +18 -0
  44. package/dist/host/daemon/proxy.d.ts +6 -0
  45. package/dist/host/daemon/proxy.js +89 -0
  46. package/dist/host/daemon/queue.d.ts +3 -0
  47. package/dist/host/daemon/queue.js +27 -0
  48. package/dist/host/daemon/routes.d.ts +13 -0
  49. package/dist/host/daemon/routes.js +98 -0
  50. package/dist/host/daemon/stopping.d.ts +10 -0
  51. package/dist/host/daemon/stopping.js +28 -0
  52. package/dist/host/daemon/supervisor.d.ts +54 -0
  53. package/dist/host/daemon/supervisor.js +115 -0
  54. package/dist/host/daemon/write-all.d.ts +8 -0
  55. package/dist/host/daemon/write-all.js +45 -0
  56. package/dist/host/data-lock.d.ts +3 -0
  57. package/dist/host/data-lock.js +121 -0
  58. package/dist/host/host-env.d.ts +18 -0
  59. package/dist/host/host-env.js +42 -0
  60. package/dist/host/host-extension.d.ts +29 -0
  61. package/dist/host/host-extension.js +91 -0
  62. package/dist/host/host-store.d.ts +11 -0
  63. package/dist/host/host-store.js +49 -0
  64. package/dist/host/index.d.ts +7 -0
  65. package/dist/host/index.js +7 -0
  66. package/dist/host/main.d.ts +2 -0
  67. package/dist/host/main.js +10 -0
  68. package/dist/host/serve-host.d.ts +17 -0
  69. package/dist/host/serve-host.js +64 -0
  70. package/dist/runtime/part-runners.d.ts +1 -0
  71. package/dist/runtime/part-runners.js +10 -1
  72. package/dist/runtime/run-part.js +2 -0
  73. package/dist/server/app.d.ts +6 -1
  74. package/dist/server/app.js +29 -19
  75. package/dist/server/request-line.d.ts +1 -1
  76. package/dist/server/request-line.js +4 -4
  77. package/dist/server/serve.d.ts +3 -0
  78. package/dist/server/serve.js +17 -4
  79. package/dist/store/pglite-store.d.ts +25 -0
  80. package/dist/store/pglite-store.js +59 -0
  81. package/dist/store/test-store.d.ts +2 -3
  82. package/dist/store/test-store.js +3 -38
  83. package/dist/testing/test-server.d.ts +2 -0
  84. package/dist/testing/test-server.js +1 -1
  85. package/dist/tool/build.d.ts +3 -0
  86. package/dist/tool/build.js +42 -27
  87. package/dist/tool/capabilities.d.ts +1 -0
  88. package/dist/tool/capabilities.js +8 -0
  89. package/dist/tool/container-parts.d.ts +7 -0
  90. package/dist/tool/container-parts.js +10 -0
  91. package/dist/tool/container-recipe.d.ts +4 -0
  92. package/dist/tool/container-recipe.js +55 -0
  93. package/dist/tool/container-stage.d.ts +3 -0
  94. package/dist/tool/container-stage.js +51 -0
  95. package/dist/tool/container.d.ts +73 -0
  96. package/dist/tool/container.js +28 -0
  97. package/dist/tool/docker.d.ts +5 -0
  98. package/dist/tool/docker.js +15 -0
  99. package/dist/tool/format.js +12 -5
  100. package/dist/tool/index.d.ts +2 -0
  101. package/dist/tool/index.js +2 -0
  102. package/dist/tool/kit-version.d.ts +1 -0
  103. package/dist/tool/kit-version.js +16 -2
  104. package/dist/tool/labels.d.ts +1 -1
  105. package/dist/tool/labels.js +4 -2
  106. package/dist/tool/main.js +10 -1
  107. package/dist/tool/record-extras.js +2 -2
  108. package/dist/tool/rules/surface.js +6 -6
  109. package/dist/tool/stage.d.ts +1 -0
  110. package/dist/tool/stage.js +1 -1
  111. package/dist/tool/up/gateway.d.ts +6 -2
  112. package/dist/tool/up/gateway.js +10 -7
  113. package/dist/tool/up/local-record.d.ts +1 -0
  114. package/dist/tool/up/token.js +1 -1
  115. package/dist/tool/up/up.js +2 -2
  116. package/dist/vendor/logs/events-client.js +1 -1
  117. package/package.json +5 -1
  118. package/schemas/extension-discovery.schema.json +8 -1
  119. package/schemas/extension-record.schema.json +8 -1
@@ -1,3 +1,4 @@
1
+ import { rm } from 'node:fs/promises';
1
2
  import { mustRun } from './exec.js';
2
3
  import { TIMEOUTS } from './timeouts.js';
3
4
  const PLATFORM = 'linux/amd64';
@@ -26,3 +27,17 @@ export const createDocker = (run) => ({
26
27
  },
27
28
  push: async (tag) => digestOf(await mustRun(run, 'docker', ['push', tag], { echo: true, timeoutMs: TIMEOUTS.push })),
28
29
  });
30
+ // Builds a staged context, then removes it, also after a failed build.
31
+ export const buildStaged = async (docker, options) => {
32
+ try {
33
+ await docker.build(options);
34
+ }
35
+ finally {
36
+ await rm(options.context, { recursive: true, force: true });
37
+ }
38
+ };
39
+ // The pushed tag by digest: `{repository}@sha256:...`, as the record names an image.
40
+ export const pushByDigest = async (docker, tag) => {
41
+ const digest = await docker.push(tag);
42
+ return { digest, image: `${tag.slice(0, tag.lastIndexOf(':'))}@${digest}` };
43
+ };
@@ -3,13 +3,20 @@ import {} from './build.js';
3
3
  import {} from './check.js';
4
4
  import { plural } from './up/lines.js';
5
5
  const shortDigest = (digest) => digest.slice(0, 'sha256:'.length + 8);
6
- // One line per image, the record path last: what `agentage extension build` prints.
6
+ const rowsOf = ({ images, container }) => [
7
+ ...images.map(({ part, tag, digest }) => ({ label: part, tag, digest })),
8
+ ...(container ? [{ label: container.runs.join(','), ...container }] : []),
9
+ ];
10
+ const skippedLines = ({ container }) => (container?.skipped ?? []).map((part) => `${part.padEnd(8)}not run by the one image yet`);
11
+ // One line per image (the one image under the parts it runs), skipped parts, then the record.
7
12
  export const buildLines = (result, cwd = process.cwd()) => {
8
- const width = Math.max(...result.images.map((image) => image.tag.length)) + 2;
9
- const lines = result.images.map((image) => {
10
- const state = image.digest ? `${shortDigest(image.digest)} pushed` : 'built';
11
- return `${image.part.padEnd(8)}${image.tag.padEnd(width)}${state}`;
13
+ const rows = rowsOf(result);
14
+ const width = Math.max(...rows.map((row) => row.tag.length)) + 2;
15
+ const lines = rows.map((row) => {
16
+ const state = row.digest ? `${shortDigest(row.digest)} pushed` : 'built';
17
+ return `${row.label.padEnd(8)}${row.tag.padEnd(width)}${state}`;
12
18
  });
19
+ lines.push(...skippedLines(result));
13
20
  if (result.recordFile)
14
21
  lines.push(`${'record'.padEnd(8)}${relative(cwd, result.recordFile)}`);
15
22
  return lines;
@@ -6,6 +6,8 @@ export { SERVED_KINDS, STORE_KINDS, type StoreKind } from '../manifest/primitive
6
6
  export { readManifest, validateManifest } from '../manifest/read-manifest.js';
7
7
  export { canonical, mcpSnapshot, PROTOCOL_VERSIONS, type McpSnapshot, type ProtocolVersion, } from '../mcp/snapshot.js';
8
8
  export { build, type BuildDeps, type BuildOptions, type BuildResult, type BuiltImage, } from './build.js';
9
+ export { type BuiltContainer } from './container.js';
10
+ export { capabilities } from './capabilities.js';
9
11
  export { check, type CheckProblem, type CheckReport } from './check.js';
10
12
  export { writeContracts } from './contracts.js';
11
13
  export { buildLines, checkLines } from './format.js';
@@ -6,6 +6,8 @@ export { SERVED_KINDS, STORE_KINDS } from '../manifest/primitives.schema.js';
6
6
  export { readManifest, validateManifest } from '../manifest/read-manifest.js';
7
7
  export { canonical, mcpSnapshot, PROTOCOL_VERSIONS, } from '../mcp/snapshot.js';
8
8
  export { build, } from './build.js';
9
+ export {} from './container.js';
10
+ export { capabilities } from './capabilities.js';
9
11
  export { check } from './check.js';
10
12
  export { writeContracts } from './contracts.js';
11
13
  export { buildLines, checkLines } from './format.js';
@@ -1 +1,2 @@
1
1
  export declare const KIT_VERSION: string;
2
+ export declare const kitPgliteVersion: (from?: string) => string | undefined;
@@ -1,3 +1,17 @@
1
- import { readFileSync } from 'node:fs';
1
+ import { existsSync, readFileSync } from 'node:fs';
2
+ import { dirname, join } from 'node:path';
3
+ import { fileURLToPath } from 'node:url';
4
+ const KIT_DIR = fileURLToPath(new URL('../..', import.meta.url));
5
+ const readJson = (file) => JSON.parse(readFileSync(file, 'utf8'));
2
6
  // The kit's own version: what a kit-shaped manifest's engines.agentage ranges over.
3
- export const KIT_VERSION = JSON.parse(readFileSync(new URL('../../package.json', import.meta.url), 'utf8')).version;
7
+ export const KIT_VERSION = readJson(join(KIT_DIR, 'package.json')).version;
8
+ // The PGlite copy the kit resolves (node_modules up from the kit folder): an exact version, or none.
9
+ export const kitPgliteVersion = (from = KIT_DIR) => {
10
+ for (let dir = from;; dir = dirname(dir)) {
11
+ const file = join(dir, 'node_modules', '@electric-sql', 'pglite', 'package.json');
12
+ if (existsSync(file))
13
+ return readJson(file).version;
14
+ if (dirname(dir) === dir)
15
+ return undefined;
16
+ }
17
+ };
@@ -1,4 +1,4 @@
1
1
  import { type BuildInfo } from '../discovery/discovery.js';
2
2
  import { type ExtensionPackage } from '../manifest/manifest.schema.js';
3
3
  import { type ImagePartKind } from '../manifest/primitives.schema.js';
4
- export declare const labelsOf: (pkg: ExtensionPackage, part: ImagePartKind, build: BuildInfo) => Record<string, string>;
4
+ export declare const labelsOf: (pkg: ExtensionPackage, part: ImagePartKind | undefined, build: BuildInfo) => Record<string, string>;
@@ -9,15 +9,17 @@ const repositoryUrl = (pkg) => {
9
9
  return url.replace(/^git\+/, '').replace(/\.git$/, '');
10
10
  };
11
11
  // OCI labels: revision is the full sha, created the build time; source links the GHCR package.
12
+ // No part: the one image, titled {id} with no io.agentage.part.
12
13
  export const labelsOf = (pkg, part, build) => {
13
14
  const labels = {
14
15
  'org.opencontainers.image.revision': build.commit,
15
16
  'org.opencontainers.image.created': build.buildTime,
16
17
  'org.opencontainers.image.version': pkg.version,
17
- 'org.opencontainers.image.title': `${pkg.agentage.id}-${part}`,
18
+ 'org.opencontainers.image.title': part ? `${pkg.agentage.id}-${part}` : pkg.agentage.id,
18
19
  'io.agentage.extension': pkg.agentage.id,
19
- 'io.agentage.part': part,
20
20
  };
21
+ if (part)
22
+ labels['io.agentage.part'] = part;
21
23
  const source = repositoryUrl(pkg);
22
24
  if (source)
23
25
  labels['org.opencontainers.image.source'] = source;
package/dist/tool/main.js CHANGED
@@ -10,6 +10,9 @@ const USAGE = `usage: agentage-extension <build|up|down|token> [options]
10
10
 
11
11
  build one image per part from the kit recipe
12
12
  --push push the images and write dist/agentage-extension.json with their digests
13
+ --container one image, ghcr.io/agentage/<id>:<version>, that runs the api part; it
14
+ lists the parts it does not run yet; with --push the record is
15
+ dist/agentage-container.json
13
16
  --registry image registry and owner (default: ghcr.io/agentage)
14
17
  up the release images on Docker: store, dev issuer, gateway on localhost:4280
15
18
  down remove what up started; --keep-data keeps the store volume
@@ -25,6 +28,7 @@ const defaultDeps = {
25
28
  };
26
29
  const OPTIONS = {
27
30
  push: { type: 'boolean' },
31
+ container: { type: 'boolean' },
28
32
  dir: { type: 'string' },
29
33
  registry: { type: 'string' },
30
34
  'keep-data': { type: 'boolean' },
@@ -35,7 +39,12 @@ const OPTIONS = {
35
39
  const parse = (argv) => parseArgs({ args: argv, allowPositionals: true, options: OPTIONS });
36
40
  const COMMANDS = {
37
41
  build: async (v, deps) => {
38
- for (const line of buildLines(await deps.build({ push: v.push, dir: v.dir, registry: v.registry })))
42
+ for (const line of buildLines(await deps.build({
43
+ push: v.push,
44
+ container: v.container,
45
+ dir: v.dir,
46
+ registry: v.registry,
47
+ })))
39
48
  deps.out(line);
40
49
  },
41
50
  up: async (v, deps) => void (await deps.up({ dir: v.dir, onLine: deps.out })),
@@ -5,7 +5,7 @@ import { scopeOf } from '../auth/token-check.js';
5
5
  import { createContext } from '../context/context.js';
6
6
  import {} from '../discovery/discovery.js';
7
7
  import { WidgetSchema } from '../discovery/discovery.schema.js';
8
- import { OPENAPI_PATH, readOpenapi } from '../discovery/openapi.js';
8
+ import { openapiPath, readOpenapi } from '../discovery/openapi.js';
9
9
  import { createLog } from '../log/log.js';
10
10
  import { loadCreate } from '../manifest/entry.js';
11
11
  import { readJsonIfExists } from '../manifest/read-manifest.js';
@@ -66,7 +66,7 @@ export const recordExtras = async (dir, pkg) => {
66
66
  if (code.ui)
67
67
  extras.widgets = await widgetsOf(dir);
68
68
  if (code.api && (await readOpenapi(dir)))
69
- extras.openapi = OPENAPI_PATH;
69
+ extras.openapi = openapiPath(pkg.agentage.id);
70
70
  if (migratesStore(pkg))
71
71
  extras.migrations = (await sqlFiles(join(dir, 'migrations'))).length;
72
72
  return extras;
@@ -1,7 +1,7 @@
1
1
  import { join } from 'node:path';
2
2
  import { generatedOpenapi, schemaOf } from '../../api/openapi-doc.js';
3
3
  import {} from '../../api/routes.js';
4
- import { OPENAPI_FILE, readOpenapi } from '../../discovery/openapi.js';
4
+ import { apiPrefix, OPENAPI_FILE, readOpenapi } from '../../discovery/openapi.js';
5
5
  import { loadCreate } from '../../manifest/entry.js';
6
6
  import {} from '../../manifest/manifest.schema.js';
7
7
  import { normalizeParts } from '../../manifest/parts.js';
@@ -11,17 +11,17 @@ import { prefixed } from '../../mcp/tools.js';
11
11
  import {} from '../check.js';
12
12
  import { registeredRoutes, registeredTools } from '../record-extras.js';
13
13
  const differing = (generated, committed) => [...new Set([...Object.keys(generated), ...Object.keys(committed)])].filter((key) => JSON.stringify(canonical(generated[key])) !== JSON.stringify(canonical(committed[key])));
14
- const routeKeys = ({ path, stack }) => [path].flat().flatMap((one) => {
15
- const at = `/api/v1${String(one).replace(/:(\w+)/g, '{$1}')}`;
14
+ const routeKeys = (prefix, { path, stack }) => [path].flat().flatMap((one) => {
15
+ const at = `${prefix}${String(one).replace(/:(\w+)/g, '{$1}')}`;
16
16
  // router.all names no method, so it has no operation to compare.
17
17
  return stack.flatMap(({ method }) => (method ? [`${method.toUpperCase()} ${at}`] : []));
18
18
  });
19
19
  // Express routes (of a Router or an express() app) as OpenAPI keys; a sub-router hides its routes, so it never matches one.
20
- const servedRoutes = (app) => {
20
+ const servedRoutes = (prefix, app) => {
21
21
  const { stack, router } = (app ?? {});
22
22
  return (stack ?? router?.stack ?? []).flatMap(({ name, route, handle }) => {
23
23
  if (route)
24
- return routeKeys(route);
24
+ return routeKeys(prefix, route);
25
25
  return handle?.stack ? [`${name} sub-router`] : [];
26
26
  });
27
27
  };
@@ -58,7 +58,7 @@ const routeProblems = (pkg, doc, routes, returned) => {
58
58
  return diff.length > 0 ? [`differs from the generated contract (${diff.join(', ')})`] : [];
59
59
  };
60
60
  const routerProblems = (pkg, doc, returned) => doc
61
- ? apiProblems(doc, servedRoutes(returned), pkg.version)
61
+ ? apiProblems(doc, servedRoutes(apiPrefix(pkg.agentage.id), returned), pkg.version)
62
62
  : ['is missing: the api part commits its contract'];
63
63
  const apiSurface = async ({ dir, pkg }) => {
64
64
  const create = await loadCreate(dir, pkg, 'api').catch(() => null);
@@ -4,6 +4,7 @@ export declare const RECORD_FILE = "agentage-extension.json";
4
4
  export declare const MIGRATE_SHIM = "// Generated by @agentage/extension build.\nimport '@agentage/extension/migrate';\n";
5
5
  export declare const localTarballs: (pkg: ExtensionPackage) => string[];
6
6
  export declare const exists: (path: string) => Promise<boolean>;
7
+ export declare const copyDeps: (dir: string, root: string, pkg: ExtensionPackage) => Promise<void>;
7
8
  export declare const appPaths: (dir: string, pkg: ExtensionPackage, part: ImagePartKind) => Promise<string[]>;
8
9
  export declare const assertBuilt: (dir: string, pkg: ExtensionPackage, part: ImagePartKind) => Promise<void>;
9
10
  export declare const stageContext: (dir: string, pkg: ExtensionPackage, part: ImagePartKind, tmpRoot?: string) => Promise<string>;
@@ -30,7 +30,7 @@ const copyInto = async (from, to) => {
30
30
  await mkdir(dirname(to), { recursive: true });
31
31
  await cp(from, to, { recursive: true });
32
32
  };
33
- const copyDeps = async (dir, root, pkg) => {
33
+ export const copyDeps = async (dir, root, pkg) => {
34
34
  if (!(await exists(join(dir, 'package-lock.json')))) {
35
35
  throw new Error('package-lock.json is missing: the image installs with npm ci');
36
36
  }
@@ -10,8 +10,12 @@ export declare const PART_PATHS: {
10
10
  mcp: string;
11
11
  };
12
12
  type RoutedPart = keyof typeof PART_PATHS;
13
- export declare const partPath: (part: RoutedPart, version: string) => string;
14
- export declare const gatewayConfig: (parts: ImagePartKind[], version: string) => {
13
+ export interface PathOf {
14
+ id: string;
15
+ version: string;
16
+ }
17
+ export declare const partPath: (part: RoutedPart, { id, version }: PathOf) => string;
18
+ export declare const gatewayConfig: (parts: ImagePartKind[], of: PathOf) => {
15
19
  http: {
16
20
  middlewares: {
17
21
  'gateway-headers': {
@@ -6,11 +6,11 @@ export const TRAEFIK_IMAGE = 'traefik:v3.7.17@sha256:68ae5fe5b64ca166704b746a9e8
6
6
  // The URL layout of api-standards section 1, as the estate's gateway renders it.
7
7
  const RESERVED = 'PathPrefix(`/api/`) || Path(`/mcp`) || PathPrefix(`/mcp/`) || PathPrefix(`/ui/`) || PathPrefix(`/.well-known/`) || PathPrefix(`/git/`) || Path(`/health`)';
8
8
  // Each routed part's path, in the order `up` prints them; /mcp is exact, the rest are prefixes.
9
- export const PART_PATHS = { pages: '/', ui: '/ui/{version}/', api: '/api/v1/', mcp: '/mcp' };
9
+ export const PART_PATHS = { pages: '/', ui: '/ui/{version}/', api: '/api/{id}/', mcp: '/mcp' };
10
10
  // In this order, so the first present serves /.well-known/ (api-standards section 1).
11
11
  const ROUTED = ['api', 'mcp', 'pages', 'ui'];
12
- export const partPath = (part, version) => PART_PATHS[part].replace('{version}', version);
13
- const ruleOf = (part, version) => part === 'mcp' ? 'Path(`/mcp`)' : `PathPrefix(\`${partPath(part, version)}\`)`;
12
+ export const partPath = (part, { id, version }) => PART_PATHS[part].replace('{version}', version).replace('{id}', id);
13
+ const ruleOf = (part, of) => part === 'mcp' ? 'Path(`/mcp`)' : `PathPrefix(\`${partPath(part, of)}\`)`;
14
14
  const router = (rule, priority, service) => ({
15
15
  rule,
16
16
  priority,
@@ -18,16 +18,19 @@ const router = (rule, priority, service) => ({
18
18
  entryPoints: ['web'],
19
19
  middlewares: ['gateway-headers'],
20
20
  });
21
- const partRouters = (routed, version) => {
21
+ const partRouters = (routed, of) => {
22
22
  const routers = {};
23
23
  for (const part of routed)
24
- routers[part] = router(ruleOf(part, version), part === 'pages' ? 1 : 100, part);
24
+ routers[part] = router(ruleOf(part, of), part === 'pages' ? 1 : 100, part);
25
+ // The old api prefix, as runPart serves it, until phase 4.
26
+ if (routed.includes('api'))
27
+ routers['api-v1'] = router('PathPrefix(`/api/v1/`)', 100, 'api');
25
28
  if (routed[0])
26
29
  routers['well-known'] = router('PathPrefix(`/.well-known/`)', 100, routed[0]);
27
30
  return routers;
28
31
  };
29
32
  // Traefik's file provider: a reserved-prefix miss is Traefik's own 404, like the estate gateway.
30
- export const gatewayConfig = (parts, version) => {
33
+ export const gatewayConfig = (parts, of) => {
31
34
  const routed = ROUTED.filter((part) => parts.includes(part));
32
35
  const services = {
33
36
  'gateway-miss': { loadBalancer: { servers: [{ url: 'http://127.0.0.1:8081' }] } },
@@ -36,7 +39,7 @@ export const gatewayConfig = (parts, version) => {
36
39
  services[part] = { loadBalancer: { servers: [{ url: `http://${part}:${PART_PORT}` }] } };
37
40
  const routers = {
38
41
  reserved: router(RESERVED, 50, 'gateway-miss'),
39
- ...partRouters(routed, version),
42
+ ...partRouters(routed, of),
40
43
  };
41
44
  if (!routed.includes('pages'))
42
45
  routers['host'] = router('PathPrefix(`/`)', 1, 'gateway-miss');
@@ -34,6 +34,7 @@ export declare const writeLocalRecord: (dir: string, pkg: ExtensionPackage, buil
34
34
  };
35
35
  secrets?: string[] | undefined;
36
36
  secretParts?: Record<string, ("pages" | "api" | "mcp" | "worker")[]> | undefined;
37
+ image?: string | undefined;
37
38
  openapi?: string | undefined;
38
39
  tools?: {
39
40
  name: string;
@@ -2,7 +2,7 @@ import { z } from 'zod';
2
2
  import { TIMEOUTS } from '../timeouts.js';
3
3
  import { DEV_ISSUER } from './dev-issuer-app.js';
4
4
  const AnswerSchema = z.object({ token: z.string().startsWith('aga_') });
5
- // A token from the dev issuer of `up`, for calling /api/v1/ and /mcp by hand or from tests.
5
+ // A token from the dev issuer of `up`, for calling /api/{id}/ and /mcp by hand or from tests.
6
6
  export const token = async (options) => {
7
7
  const issuer = options.issuer ?? DEV_ISSUER;
8
8
  const res = await (options.fetch ?? fetch)(`${issuer}/token`, {
@@ -25,7 +25,7 @@ const renderFiles = async (s, recordFile, tags) => {
25
25
  const gatewayFile = join(s.dir, LOCAL_DIR, 'gateway.yml');
26
26
  const seeds = join(s.dir, 'seeds');
27
27
  const seedsDir = (await exists(seeds)) ? seeds : undefined;
28
- await jsonFile(gatewayFile, gatewayConfig(imageParts(s.pkg), s.pkg.version));
28
+ await jsonFile(gatewayFile, gatewayConfig(imageParts(s.pkg), { id: s.pkg.agentage.id, version: s.pkg.version }));
29
29
  const { pkg, secretFiles, target } = s;
30
30
  const project = target.project;
31
31
  await jsonFile(target.file, composeFile({ pkg, project, tags, recordFile, gatewayFile, seedsDir, secretFiles }));
@@ -53,7 +53,7 @@ const storeStep = async (s) => {
53
53
  };
54
54
  export const routesOf = (pkg) => Object.keys(PART_PATHS)
55
55
  .filter((part) => imageParts(pkg).includes(part))
56
- .map((part) => partPath(part, pkg.version));
56
+ .map((part) => partPath(part, { id: pkg.agentage.id, version: pkg.version }));
57
57
  const partsStep = async (s, commit) => {
58
58
  await compose(s.deps.run, s.target, ['up', '-d', '--remove-orphans'], TIMEOUTS.start);
59
59
  await waitHealthy(s.target, [...imageParts(s.pkg), 'gateway', 'issuer'], s.deps);
@@ -24,7 +24,7 @@ const fitting = (event) => {
24
24
  process.emitWarning(`@agentage/logs: dropped a ${event.kind} row over 900 KB`);
25
25
  return false;
26
26
  };
27
- // Each batch under 1 MB and at most 1000 rows (the ingest wire, C3).
27
+ // Each batch under 1 MB and at most 1000 rows (the ingest wire).
28
28
  export const batchesOf = (events) => {
29
29
  const batches = [];
30
30
  let batch = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentage/extension",
3
- "version": "0.12.3",
3
+ "version": "0.14.0",
4
4
  "description": "The agentage extension kit: create(ctx) per part (pages, ui, api, mcp, worker, cli), the store, /health, discovery, the envelope, and the build tool with up and token",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -32,6 +32,10 @@
32
32
  "types": "./dist/contracts/index.d.ts",
33
33
  "default": "./dist/contracts/index.js"
34
34
  },
35
+ "./host": {
36
+ "types": "./dist/host/index.d.ts",
37
+ "default": "./dist/host/index.js"
38
+ },
35
39
  "./logs": {
36
40
  "types": "./dist/logs/index.d.ts",
37
41
  "default": "./dist/logs/index.js"
@@ -121,9 +121,16 @@
121
121
  },
122
122
  "additionalProperties": false
123
123
  },
124
+ "image": {
125
+ "description": "The one image (build --container). A record has part images or this image: never both, never none.",
126
+ "type": "string",
127
+ "maxLength": 256,
128
+ "pattern": "^[a-z0-9][a-z0-9.-]*(:[0-9]{1,5})?(\\/[a-z0-9][a-z0-9_.-]*)+\\/[a-z][a-z0-9-]*@sha256:[0-9a-f]{64}$"
129
+ },
124
130
  "openapi": {
125
131
  "type": "string",
126
- "pattern": "^\\/api\\/v[1-9][0-9]*\\/openapi\\.json$"
132
+ "pattern": "^\\/api\\/(?:v[0-9]+|[a-z][a-z0-9-]*)\\/openapi\\.json$",
133
+ "description": "/api/{id}/openapi.json, or the old /api/v{N}; only the kit checks that {id} is the id"
127
134
  },
128
135
  "tools": {
129
136
  "minItems": 1,
@@ -121,9 +121,16 @@
121
121
  },
122
122
  "additionalProperties": false
123
123
  },
124
+ "image": {
125
+ "description": "The one image (build --container). A record has part images or this image: never both, never none.",
126
+ "type": "string",
127
+ "maxLength": 256,
128
+ "pattern": "^[a-z0-9][a-z0-9.-]*(:[0-9]{1,5})?(\\/[a-z0-9][a-z0-9_.-]*)+\\/[a-z][a-z0-9-]*@sha256:[0-9a-f]{64}$"
129
+ },
124
130
  "openapi": {
125
131
  "type": "string",
126
- "pattern": "^\\/api\\/v[1-9][0-9]*\\/openapi\\.json$"
132
+ "pattern": "^\\/api\\/(?:v[0-9]+|[a-z][a-z0-9-]*)\\/openapi\\.json$",
133
+ "description": "/api/{id}/openapi.json, or the old /api/v{N}; only the kit checks that {id} is the id"
127
134
  },
128
135
  "tools": {
129
136
  "minItems": 1,