@agentage/extension 0.13.0 → 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.
- package/dist/discovery/discovery.d.ts +1 -0
- package/dist/discovery/discovery.schema.d.ts +2 -0
- package/dist/discovery/discovery.schema.js +22 -10
- package/dist/host/daemon/add.d.ts +9 -0
- package/dist/host/daemon/add.js +63 -0
- package/dist/host/daemon/child.d.ts +5 -3
- package/dist/host/daemon/child.js +21 -13
- package/dist/host/daemon/daemon-files.d.ts +3 -5
- package/dist/host/daemon/daemon-files.js +15 -11
- package/dist/host/daemon/daemon-owner.d.ts +1 -0
- package/dist/host/daemon/daemon-owner.js +32 -0
- package/dist/host/daemon/daemon.d.ts +2 -3
- package/dist/host/daemon/daemon.js +53 -31
- package/dist/host/daemon/entries.d.ts +21 -0
- package/dist/host/daemon/entries.js +24 -0
- package/dist/host/daemon/guard.d.ts +1 -1
- package/dist/host/daemon/guard.js +4 -3
- package/dist/host/daemon/installation.d.ts +17 -4
- package/dist/host/daemon/installation.js +52 -8
- package/dist/host/daemon/installer-call.d.ts +16 -2
- package/dist/host/daemon/installer-call.js +33 -7
- package/dist/host/daemon/json-file.d.ts +3 -2
- package/dist/host/daemon/json-file.js +21 -10
- package/dist/host/daemon/lane.d.ts +1 -3
- package/dist/host/daemon/lane.js +4 -9
- package/dist/host/daemon/limits.d.ts +11 -0
- package/dist/host/daemon/limits.js +22 -0
- package/dist/host/daemon/ops.d.ts +2 -26
- package/dist/host/daemon/ops.js +43 -103
- package/dist/host/daemon/patch-values.d.ts +6 -0
- package/dist/host/daemon/patch-values.js +39 -0
- package/dist/host/daemon/pending.d.ts +15 -0
- package/dist/host/daemon/pending.js +18 -0
- package/dist/host/daemon/proxy.d.ts +3 -2
- package/dist/host/daemon/proxy.js +46 -24
- package/dist/host/daemon/queue.d.ts +1 -0
- package/dist/host/daemon/queue.js +19 -0
- package/dist/host/daemon/routes.d.ts +5 -3
- package/dist/host/daemon/routes.js +67 -17
- package/dist/host/daemon/stopping.d.ts +10 -0
- package/dist/host/daemon/stopping.js +28 -0
- package/dist/host/daemon/supervisor.d.ts +13 -11
- package/dist/host/daemon/supervisor.js +17 -18
- package/dist/host/daemon/write-all.d.ts +8 -0
- package/dist/host/daemon/write-all.js +45 -0
- package/dist/host/data-lock.d.ts +1 -0
- package/dist/host/data-lock.js +63 -23
- package/dist/host/host-env.d.ts +2 -1
- package/dist/host/host-env.js +8 -2
- package/dist/host/host-extension.d.ts +4 -0
- package/dist/host/host-extension.js +11 -6
- package/dist/host/host-store.d.ts +8 -1
- package/dist/host/host-store.js +24 -10
- package/dist/host/index.d.ts +4 -0
- package/dist/host/index.js +4 -0
- package/dist/host/serve-host.d.ts +2 -1
- package/dist/host/serve-host.js +12 -9
- package/dist/server/app.d.ts +2 -1
- package/dist/server/app.js +1 -1
- package/dist/server/serve.d.ts +3 -0
- package/dist/server/serve.js +9 -4
- package/dist/tool/build.d.ts +3 -0
- package/dist/tool/build.js +42 -27
- package/dist/tool/capabilities.d.ts +1 -0
- package/dist/tool/capabilities.js +8 -0
- package/dist/tool/container-parts.d.ts +7 -0
- package/dist/tool/container-parts.js +10 -0
- package/dist/tool/container-recipe.d.ts +4 -0
- package/dist/tool/container-recipe.js +55 -0
- package/dist/tool/container-stage.d.ts +3 -0
- package/dist/tool/container-stage.js +51 -0
- package/dist/tool/container.d.ts +73 -0
- package/dist/tool/container.js +28 -0
- package/dist/tool/docker.d.ts +5 -0
- package/dist/tool/docker.js +15 -0
- package/dist/tool/format.js +12 -5
- package/dist/tool/index.d.ts +2 -0
- package/dist/tool/index.js +2 -0
- package/dist/tool/kit-version.d.ts +1 -0
- package/dist/tool/kit-version.js +16 -2
- package/dist/tool/labels.d.ts +1 -1
- package/dist/tool/labels.js +4 -2
- package/dist/tool/main.js +10 -1
- package/dist/tool/stage.d.ts +1 -0
- package/dist/tool/stage.js +1 -1
- package/dist/tool/up/local-record.d.ts +1 -0
- package/package.json +1 -1
- package/schemas/extension-discovery.schema.json +8 -1
- package/schemas/extension-record.schema.json +8 -1
- package/dist/host/daemon/secret-names.d.ts +0 -1
- package/dist/host/daemon/secret-names.js +0 -14
- package/dist/host/daemon/setting-values.d.ts +0 -1
- package/dist/host/daemon/setting-values.js +0 -26
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { type BuildInfo } from '../discovery/discovery.js';
|
|
2
|
+
import { type ExtensionPackage } from '../manifest/manifest.schema.js';
|
|
3
|
+
import { type ContainerParts } from './container-parts.js';
|
|
4
|
+
import { type Docker } from './docker.js';
|
|
5
|
+
export declare const CONTAINER_RECORD_FILE = "agentage-container.json";
|
|
6
|
+
export interface BuiltContainer extends ContainerParts {
|
|
7
|
+
tag: string;
|
|
8
|
+
digest?: string;
|
|
9
|
+
image?: string;
|
|
10
|
+
}
|
|
11
|
+
interface ContainerJob {
|
|
12
|
+
dir: string;
|
|
13
|
+
pkg: ExtensionPackage;
|
|
14
|
+
info: BuildInfo;
|
|
15
|
+
registry: string;
|
|
16
|
+
parts: ContainerParts;
|
|
17
|
+
push?: boolean;
|
|
18
|
+
tmpRoot?: string;
|
|
19
|
+
}
|
|
20
|
+
export declare const buildContainer: (job: ContainerJob, docker: Docker) => Promise<{
|
|
21
|
+
container: BuiltContainer;
|
|
22
|
+
record?: undefined;
|
|
23
|
+
} | {
|
|
24
|
+
container: {
|
|
25
|
+
digest: string;
|
|
26
|
+
image: string;
|
|
27
|
+
tag: string;
|
|
28
|
+
runs: string[];
|
|
29
|
+
skipped: string[];
|
|
30
|
+
};
|
|
31
|
+
record: {
|
|
32
|
+
id: string;
|
|
33
|
+
version: string;
|
|
34
|
+
commit: string;
|
|
35
|
+
buildTime: string;
|
|
36
|
+
parts: {
|
|
37
|
+
pages?: {
|
|
38
|
+
image: string;
|
|
39
|
+
} | undefined;
|
|
40
|
+
ui?: {
|
|
41
|
+
image: string;
|
|
42
|
+
} | undefined;
|
|
43
|
+
api?: {
|
|
44
|
+
image: string;
|
|
45
|
+
} | undefined;
|
|
46
|
+
mcp?: {
|
|
47
|
+
image: string;
|
|
48
|
+
} | undefined;
|
|
49
|
+
worker?: {
|
|
50
|
+
image: string;
|
|
51
|
+
} | undefined;
|
|
52
|
+
store?: {
|
|
53
|
+
kind: "postgres" | "signoz" | "git" | "clickhouse";
|
|
54
|
+
migrations?: number | undefined;
|
|
55
|
+
} | undefined;
|
|
56
|
+
};
|
|
57
|
+
secrets?: string[] | undefined;
|
|
58
|
+
secretParts?: Record<string, ("pages" | "api" | "mcp" | "worker")[]> | undefined;
|
|
59
|
+
image?: string | undefined;
|
|
60
|
+
openapi?: string | undefined;
|
|
61
|
+
tools?: {
|
|
62
|
+
name: string;
|
|
63
|
+
scope: string;
|
|
64
|
+
}[] | undefined;
|
|
65
|
+
widgets?: {
|
|
66
|
+
name: string;
|
|
67
|
+
element: string;
|
|
68
|
+
module: string;
|
|
69
|
+
}[] | undefined;
|
|
70
|
+
commands?: string[] | undefined;
|
|
71
|
+
};
|
|
72
|
+
}>;
|
|
73
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { recordOf, validateRecord } from '../discovery/discovery.js';
|
|
2
|
+
import {} from '../discovery/discovery.schema.js';
|
|
3
|
+
import {} from '../manifest/manifest.schema.js';
|
|
4
|
+
import {} from './container-parts.js';
|
|
5
|
+
import { stageContainer } from './container-stage.js';
|
|
6
|
+
import { buildStaged, pushByDigest } from './docker.js';
|
|
7
|
+
import { labelsOf } from './labels.js';
|
|
8
|
+
import { recordExtras } from './record-extras.js';
|
|
9
|
+
// Beside the release record, so a container push never replaces what `extension release` reads.
|
|
10
|
+
export const CONTAINER_RECORD_FILE = 'agentage-container.json';
|
|
11
|
+
// The one-image record: the image by digest in place of one image per part.
|
|
12
|
+
const containerRecord = async (job, image) => validateRecord({
|
|
13
|
+
...recordOf(job.pkg, job.info, {}, await recordExtras(job.dir, job.pkg)),
|
|
14
|
+
image,
|
|
15
|
+
});
|
|
16
|
+
// --container: one image; pushed, also its record.
|
|
17
|
+
export const buildContainer = async (job, docker) => {
|
|
18
|
+
const tag = `${job.registry}/${job.pkg.agentage.id}:${job.pkg.version}`;
|
|
19
|
+
const context = await stageContainer(job.dir, job.pkg, job.tmpRoot);
|
|
20
|
+
const buildArgs = { COMMIT_SHA: job.info.commit, BUILD_TIME: job.info.buildTime };
|
|
21
|
+
const labels = labelsOf(job.pkg, undefined, job.info);
|
|
22
|
+
await buildStaged(docker, { context, tag, buildArgs, labels });
|
|
23
|
+
const container = { tag, ...job.parts };
|
|
24
|
+
if (!job.push)
|
|
25
|
+
return { container };
|
|
26
|
+
const pushed = { ...container, ...(await pushByDigest(docker, tag)) };
|
|
27
|
+
return { container: pushed, record: await containerRecord(job, pushed.image) };
|
|
28
|
+
};
|
package/dist/tool/docker.d.ts
CHANGED
|
@@ -12,3 +12,8 @@ export interface Docker {
|
|
|
12
12
|
export declare const buildArgsOf: (options: DockerBuild) => string[];
|
|
13
13
|
export declare const digestOf: (pushOutput: string) => string;
|
|
14
14
|
export declare const createDocker: (run: Run) => Docker;
|
|
15
|
+
export declare const buildStaged: (docker: Docker, options: DockerBuild) => Promise<void>;
|
|
16
|
+
export declare const pushByDigest: (docker: Docker, tag: string) => Promise<{
|
|
17
|
+
digest: string;
|
|
18
|
+
image: string;
|
|
19
|
+
}>;
|
package/dist/tool/docker.js
CHANGED
|
@@ -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
|
+
};
|
package/dist/tool/format.js
CHANGED
|
@@ -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
|
-
|
|
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
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
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;
|
package/dist/tool/index.d.ts
CHANGED
|
@@ -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';
|
package/dist/tool/index.js
CHANGED
|
@@ -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';
|
package/dist/tool/kit-version.js
CHANGED
|
@@ -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 =
|
|
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
|
+
};
|
package/dist/tool/labels.d.ts
CHANGED
|
@@ -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>;
|
package/dist/tool/labels.js
CHANGED
|
@@ -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({
|
|
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 })),
|
package/dist/tool/stage.d.ts
CHANGED
|
@@ -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>;
|
package/dist/tool/stage.js
CHANGED
|
@@ -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
|
}
|
|
@@ -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;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentage/extension",
|
|
3
|
-
"version": "0.
|
|
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",
|
|
@@ -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[0-9]+|[a-z][a-z0-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[0-9]+|[a-z][a-z0-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,
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const checkSecrets: (dir: string | undefined, names: string[], id: string) => Promise<void>;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { fail } from '../../envelope/envelope.js';
|
|
2
|
-
import { readManifest } from '../../manifest/read-manifest.js';
|
|
3
|
-
const declared = (secrets = []) => secrets.map((s) => (typeof s === 'string' ? s : s.name));
|
|
4
|
-
// Only a secret the package declares: the name becomes a file name in the child's folder.
|
|
5
|
-
export const checkSecrets = async (dir, names, id) => {
|
|
6
|
-
if (!names.length)
|
|
7
|
-
return;
|
|
8
|
-
if (!dir)
|
|
9
|
-
throw fail('VALIDATION_ERROR', `${id} has no package yet: install it first`);
|
|
10
|
-
const known = declared((await readManifest(dir)).agentage.secrets);
|
|
11
|
-
const unknown = names.filter((name) => !known.includes(name));
|
|
12
|
-
if (unknown.length)
|
|
13
|
-
throw fail('VALIDATION_ERROR', `${id} declares no secret ${unknown.join(', ')}`);
|
|
14
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const coerceSettings: (dir: string | undefined, given: Record<string, unknown>, id: string) => Promise<Record<string, unknown>>;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { fits } from '../../context/settings.js';
|
|
2
|
-
import { fail } from '../../envelope/envelope.js';
|
|
3
|
-
import { readManifest } from '../../manifest/read-manifest.js';
|
|
4
|
-
const PARSE = {
|
|
5
|
-
number: (t) => (/^-?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?$/i.test(t) ? Number(t) : t),
|
|
6
|
-
integer: (t) => (/^-?\d+$/.test(t) ? Number(t) : t),
|
|
7
|
-
boolean: (t) => (t === 'true' ? true : t === 'false' ? false : t),
|
|
8
|
-
};
|
|
9
|
-
const refused = (key, message) => fail('VALIDATION_ERROR', `setting ${key}: ${message}`, { code: 'INVALID_SETTING' });
|
|
10
|
-
const valueOf = (key, setting, given) => {
|
|
11
|
-
if (!setting)
|
|
12
|
-
throw refused(key, 'not declared in the manifest');
|
|
13
|
-
const value = typeof given === 'string' ? (PARSE[setting.type]?.(given) ?? given) : given;
|
|
14
|
-
if (!fits(setting, value))
|
|
15
|
-
throw refused(key, `${JSON.stringify(given)} is not a valid ${setting.type}`);
|
|
16
|
-
return value;
|
|
17
|
-
};
|
|
18
|
-
// A client sends text (`configure probe limit=5`): a string becomes the type the manifest declares.
|
|
19
|
-
export const coerceSettings = async (dir, given, id) => {
|
|
20
|
-
if (!Object.keys(given).length)
|
|
21
|
-
return given;
|
|
22
|
-
if (!dir)
|
|
23
|
-
throw fail('VALIDATION_ERROR', `${id} has no package yet: install it first`);
|
|
24
|
-
const declared = (await readManifest(dir)).agentage.settings ?? {};
|
|
25
|
-
return Object.fromEntries(Object.entries(given).map(([key, value]) => [key, valueOf(key, declared[key], value)]));
|
|
26
|
-
};
|