@zenera/cli 1.2.5 → 1.2.6
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/container.d.ts +22 -1
- package/dist/container.js +137 -29
- package/dist/validate.d.ts +2 -2
- package/dist/validate.js +19 -4
- package/package.json +8 -7
- package/templates/project/sandbox/Dockerfile.tmpl +27 -47
package/dist/container.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export declare const AGENT_RUNTIME_REPO = "ghcr.io/zenera-ai/zenera-agent-runtime";
|
|
1
2
|
export declare const AGENT_UID = 10001;
|
|
2
3
|
export declare const AGENT_GID = 10001;
|
|
3
4
|
export interface AgentImage {
|
|
@@ -43,7 +44,27 @@ export interface ContainerRun {
|
|
|
43
44
|
* machine, a Ctrl-C or SIGTERM passed on so its runs save before it goes.
|
|
44
45
|
*/
|
|
45
46
|
export declare function runContainer(run: ContainerRun): Promise<void>;
|
|
46
|
-
|
|
47
|
+
/**
|
|
48
|
+
* The agent image's Dockerfile. `runtime`: a prebuilt runtime image to copy /opt/zenera from
|
|
49
|
+
* (node, the @zenera packages, bwrap); without it they are installed and compiled here.
|
|
50
|
+
*/
|
|
51
|
+
export declare function agentDockerfile(base: string, identity: Record<string, string>, runtime?: string): string;
|
|
52
|
+
/**
|
|
53
|
+
* The prebuilt runtime image of a release (packages/cli/agent-runtime.Dockerfile is this, kept
|
|
54
|
+
* in step by a test): /opt/zenera with node, @zenera/cli@ZEN_VERSION and every @zenera package
|
|
55
|
+
* pinned to that version, and bwrap. CI builds it for amd64 and arm64 and pushes it to
|
|
56
|
+
* AGENT_RUNTIME_REPO:<version> (RELEASE.md).
|
|
57
|
+
*/
|
|
58
|
+
export declare function agentRuntimeDockerfile(): string;
|
|
59
|
+
/**
|
|
60
|
+
* The runtime image to copy from, or null to build the runtime here. ZEN_AGENT_RUNTIME=local
|
|
61
|
+
* always builds here; ZEN_AGENT_RUNTIME_IMAGE names another image (a mirror); otherwise a
|
|
62
|
+
* released CLI uses its release's image, and a dev checkout builds its own code here.
|
|
63
|
+
*/
|
|
64
|
+
export declare function agentRuntimeRef(release: {
|
|
65
|
+
version: string;
|
|
66
|
+
installed: boolean;
|
|
67
|
+
}, env?: NodeJS.ProcessEnv): string | null;
|
|
47
68
|
/** Everything that went into the image: the base's id and the context, file by file. */
|
|
48
69
|
export declare function contentHash(ctx: string, baseId: string): string;
|
|
49
70
|
//# sourceMappingURL=container.d.ts.map
|
package/dist/container.js
CHANGED
|
@@ -30,11 +30,19 @@ import { bold, CliError, cyan, dim, EXIT, green, note, table, yellow } from "./t
|
|
|
30
30
|
// commands, all under /opt/zenera, with `zen server start` as its command.
|
|
31
31
|
// Inside it the server finds itself in the agent image: bwrap, /project,
|
|
32
32
|
// /state. Nothing in it builds or starts containers.
|
|
33
|
+
//
|
|
34
|
+
// The Node runtime, the @zenera packages and bwrap are the same for every
|
|
35
|
+
// project, so a released CLI copies them from the release's prebuilt image
|
|
36
|
+
// (zenera-agent-runtime:<version>, agent-runtime.Dockerfile, published by
|
|
37
|
+
// CI) instead of installing and compiling them here. A dev checkout, a
|
|
38
|
+
// failed pull or ZEN_AGENT_RUNTIME=local builds them here as before.
|
|
33
39
|
// ---------------------------------------------------------------------------
|
|
34
40
|
/** The packages the server needs, in an order npm can install from files. */
|
|
35
41
|
const PACKAGES = ['sandbox', 'neo', 'view', 'engine', 'server', 'cli'];
|
|
36
42
|
const BWRAP_VERSION = '0.13.1';
|
|
37
43
|
const IMAGE_REPO = 'localhost/zenera-agent';
|
|
44
|
+
export const AGENT_RUNTIME_REPO = 'ghcr.io/zenera-ai/zenera-agent-runtime';
|
|
45
|
+
const ENTRY = '/opt/zenera/app/node_modules/@zenera/cli/dist/main.js';
|
|
38
46
|
export const AGENT_UID = 10001;
|
|
39
47
|
export const AGENT_GID = 10001;
|
|
40
48
|
/** The agent image for a project, built unless this machine has it already. */
|
|
@@ -58,25 +66,29 @@ export async function buildAgentImage(projectDir, opts = {}) {
|
|
|
58
66
|
}
|
|
59
67
|
const inspected = await podman(['image', 'inspect', '--format', '{{json .}}', base]);
|
|
60
68
|
const image = JSON.parse(inspected);
|
|
61
|
-
// 2. The context: zen packed, the libraries, the image's environment
|
|
69
|
+
// 2. The context: zen packed (unless prebuilt), the libraries, the image's environment.
|
|
70
|
+
const runtime = await prebuiltRuntime();
|
|
62
71
|
const ctx = join(home(), 'images', `ctx-${randomBytes(4).toString('hex')}`);
|
|
63
|
-
mkdirSync(
|
|
72
|
+
mkdirSync(ctx, { recursive: true });
|
|
64
73
|
try {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
tarballs
|
|
74
|
+
if (!runtime) {
|
|
75
|
+
mkdirSync(join(ctx, 'pkgs'));
|
|
76
|
+
const tarballs = {};
|
|
77
|
+
for (const name of PACKAGES) {
|
|
78
|
+
tarballs[`@zenera/${name}`] = await pack(packageDir(name), join(ctx, 'pkgs'));
|
|
79
|
+
}
|
|
80
|
+
writeFileSync(join(ctx, 'app.json'), JSON.stringify(appManifest(tarballs), null, 2));
|
|
68
81
|
}
|
|
69
82
|
writeRuntime(join(ctx, 'runtime'));
|
|
70
83
|
mkdirSync(join(ctx, 'etc'), { recursive: true });
|
|
71
84
|
writeFileSync(join(ctx, 'etc', 'image-env.json'), JSON.stringify(envOf(image.Config?.Env)));
|
|
72
|
-
writeFileSync(join(ctx, 'app.json'), JSON.stringify(appManifest(tarballs), null, 2));
|
|
73
85
|
const identity = build
|
|
74
86
|
? { ZEN_IMAGE_BUILD: build.hash }
|
|
75
87
|
: { ZEN_IMAGE_BASE: base };
|
|
76
|
-
const dockerfile = agentDockerfile(base, identity);
|
|
88
|
+
const dockerfile = agentDockerfile(base, identity, runtime?.image);
|
|
77
89
|
writeFileSync(join(ctx, 'Dockerfile'), dockerfile);
|
|
78
90
|
// 3. Named by everything that went in, so an unchanged one is not built again.
|
|
79
|
-
const tag = `${IMAGE_REPO}:${contentHash(ctx, image.Id)}`;
|
|
91
|
+
const tag = `${IMAGE_REPO}:${contentHash(ctx, runtime ? `${image.Id}\0${runtime.id}` : image.Id)}`;
|
|
80
92
|
const present = await runProcess('podman', ['image', 'exists', tag], { timeoutMs: 30_000 });
|
|
81
93
|
if (present.code === 0 && !opts.rebuild) {
|
|
82
94
|
return { tag, base, built: false };
|
|
@@ -86,6 +98,7 @@ export async function buildAgentImage(projectDir, opts = {}) {
|
|
|
86
98
|
for (const line of table([
|
|
87
99
|
['Image', tag],
|
|
88
100
|
['Base', base],
|
|
101
|
+
['Runtime', runtime?.image ?? 'built here'],
|
|
89
102
|
]))
|
|
90
103
|
note(` ${dim(line)}`);
|
|
91
104
|
await streamAgentBuild('podman', ['build', '-t', tag, '-f', join(ctx, 'Dockerfile'), ctx], opts.verbose);
|
|
@@ -329,20 +342,8 @@ function envOf(lines = []) {
|
|
|
329
342
|
}
|
|
330
343
|
return env;
|
|
331
344
|
}
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
return `# Generated by zen server start --container. The project's environment, plus zen.
|
|
335
|
-
FROM docker.io/library/node:24-trixie-slim AS runtime
|
|
336
|
-
COPY pkgs/ /opt/zenera/pkgs/
|
|
337
|
-
COPY app.json /opt/zenera/app/package.json
|
|
338
|
-
RUN cd /opt/zenera/app \\
|
|
339
|
-
&& npm install --omit=dev --ignore-scripts --no-audit --no-fund \\
|
|
340
|
-
&& mkdir -p /opt/zenera/bin \\
|
|
341
|
-
&& cp "$(command -v node)" /opt/zenera/bin/node \\
|
|
342
|
-
&& rm -rf /opt/zenera/pkgs \\
|
|
343
|
-
&& /opt/zenera/bin/node ${entry} version
|
|
344
|
-
|
|
345
|
-
FROM docker.io/library/alpine:3.22 AS bwrap
|
|
345
|
+
// Static bwrap, compiled; shared by the agent image (built here) and the prebuilt runtime.
|
|
346
|
+
const BWRAP_STAGE = `FROM docker.io/library/alpine:3.22 AS bwrap
|
|
346
347
|
ARG BWRAP_VERSION=${BWRAP_VERSION}
|
|
347
348
|
RUN apk add --no-cache build-base meson ninja pkgconf libcap-dev libcap-static linux-headers curl xz
|
|
348
349
|
RUN mkdir -p /src && curl -fsSL https://github.com/containers/bubblewrap/releases/download/v\${BWRAP_VERSION}/bubblewrap-\${BWRAP_VERSION}.tar.xz \\
|
|
@@ -350,12 +351,33 @@ RUN mkdir -p /src && curl -fsSL https://github.com/containers/bubblewrap/release
|
|
|
350
351
|
RUN cd /src && meson setup build --buildtype=release --prefer-static --default-library=static \\
|
|
351
352
|
-Dc_link_args=-static -Dselinux=disabled -Dman=disabled -Dtests=false \\
|
|
352
353
|
-Dbash_completion=disabled -Dzsh_completion=disabled \\
|
|
353
|
-
&& ninja -C build bwrap && strip build/bwrap
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
354
|
+
&& ninja -C build bwrap && strip build/bwrap`;
|
|
355
|
+
/**
|
|
356
|
+
* The agent image's Dockerfile. `runtime`: a prebuilt runtime image to copy /opt/zenera from
|
|
357
|
+
* (node, the @zenera packages, bwrap); without it they are installed and compiled here.
|
|
358
|
+
*/
|
|
359
|
+
export function agentDockerfile(base, identity, runtime) {
|
|
360
|
+
const parts = runtime
|
|
361
|
+
? [`FROM ${base}`, 'USER root', `COPY --from=${runtime} /opt/zenera /opt/zenera`]
|
|
362
|
+
: [
|
|
363
|
+
`FROM docker.io/library/node:24-trixie-slim AS runtime
|
|
364
|
+
COPY pkgs/ /opt/zenera/pkgs/
|
|
365
|
+
COPY app.json /opt/zenera/app/package.json
|
|
366
|
+
RUN cd /opt/zenera/app \\
|
|
367
|
+
&& npm install --omit=dev --ignore-scripts --no-audit --no-fund \\
|
|
368
|
+
&& mkdir -p /opt/zenera/bin \\
|
|
369
|
+
&& cp "$(command -v node)" /opt/zenera/bin/node \\
|
|
370
|
+
&& rm -rf /opt/zenera/pkgs \\
|
|
371
|
+
&& /opt/zenera/bin/node ${ENTRY} version
|
|
372
|
+
`,
|
|
373
|
+
`${BWRAP_STAGE}\n`,
|
|
374
|
+
`FROM ${base}`,
|
|
375
|
+
'USER root',
|
|
376
|
+
'COPY --from=runtime /opt/zenera /opt/zenera',
|
|
377
|
+
'COPY --from=bwrap /src/build/bwrap /opt/zenera/bin/bwrap',
|
|
378
|
+
];
|
|
379
|
+
return `# Generated by zen server start --container. The project's environment, plus zen.
|
|
380
|
+
${parts.join('\n')}
|
|
359
381
|
COPY runtime/ /opt/zenera/runtime/
|
|
360
382
|
COPY etc/ /opt/zenera/etc/
|
|
361
383
|
# Mount points: the image's root is read-only to every command. Node needs glibc: a base
|
|
@@ -369,10 +391,96 @@ ENV ${Object.entries(identity)
|
|
|
369
391
|
.map(([k, v]) => `${k}=${JSON.stringify(v)}`)
|
|
370
392
|
.join(' ')}
|
|
371
393
|
LABEL zenera.agent=1
|
|
372
|
-
ENTRYPOINT ["/opt/zenera/bin/node", "${
|
|
394
|
+
ENTRYPOINT ["/opt/zenera/bin/node", "${ENTRY}"]
|
|
373
395
|
CMD ["server", "start"]
|
|
374
396
|
`;
|
|
375
397
|
}
|
|
398
|
+
/**
|
|
399
|
+
* The prebuilt runtime image of a release (packages/cli/agent-runtime.Dockerfile is this, kept
|
|
400
|
+
* in step by a test): /opt/zenera with node, @zenera/cli@ZEN_VERSION and every @zenera package
|
|
401
|
+
* pinned to that version, and bwrap. CI builds it for amd64 and arm64 and pushes it to
|
|
402
|
+
* AGENT_RUNTIME_REPO:<version> (RELEASE.md).
|
|
403
|
+
*/
|
|
404
|
+
export function agentRuntimeDockerfile() {
|
|
405
|
+
const pins = PACKAGES.filter((name) => name !== 'cli')
|
|
406
|
+
.map((name) => `"overrides.@zenera/${name}=$ZEN_VERSION"`)
|
|
407
|
+
.join(' ');
|
|
408
|
+
return `# Generated from agentRuntimeDockerfile() in src/container.ts - edit that, then run
|
|
409
|
+
# \`npm run agent-runtime:dockerfile -w packages/cli\`. zen's prebuilt agent runtime: what every
|
|
410
|
+
# agent image copies into /opt/zenera. Build with --build-arg ZEN_VERSION=<a published version>.
|
|
411
|
+
FROM docker.io/library/node:24-trixie-slim AS runtime
|
|
412
|
+
ARG ZEN_VERSION
|
|
413
|
+
RUN test -n "$ZEN_VERSION" \\
|
|
414
|
+
&& mkdir -p /opt/zenera/app /opt/zenera/bin && cd /opt/zenera/app \\
|
|
415
|
+
&& printf '{"name":"zenera-runtime","private":true}\\n' > package.json \\
|
|
416
|
+
&& npm pkg set "dependencies.@zenera/cli=$ZEN_VERSION" ${pins} \\
|
|
417
|
+
&& npm install --omit=dev --ignore-scripts --no-audit --no-fund \\
|
|
418
|
+
&& cp "$(command -v node)" /opt/zenera/bin/node \\
|
|
419
|
+
&& test "$(/opt/zenera/bin/node ${ENTRY} --version)" = "$ZEN_VERSION"
|
|
420
|
+
|
|
421
|
+
${BWRAP_STAGE}
|
|
422
|
+
|
|
423
|
+
FROM scratch
|
|
424
|
+
ARG ZEN_VERSION
|
|
425
|
+
COPY --from=runtime /opt/zenera /opt/zenera
|
|
426
|
+
COPY --from=bwrap /src/build/bwrap /opt/zenera/bin/bwrap
|
|
427
|
+
LABEL zenera.agent-runtime=1 zenera.version=$ZEN_VERSION \\
|
|
428
|
+
org.opencontainers.image.source=https://github.com/zenera-ai/ZeneraNeo
|
|
429
|
+
`;
|
|
430
|
+
}
|
|
431
|
+
/** This CLI's version, and whether every @zenera package it runs came from npm. */
|
|
432
|
+
function cliRelease() {
|
|
433
|
+
const manifest = JSON.parse(readFileSync(join(packageDir('cli'), 'package.json'), 'utf8'));
|
|
434
|
+
const installed = PACKAGES.every((name) => packageDir(name).split(/[\\/]/).includes('node_modules'));
|
|
435
|
+
return { version: manifest.version, installed };
|
|
436
|
+
}
|
|
437
|
+
/**
|
|
438
|
+
* The runtime image to copy from, or null to build the runtime here. ZEN_AGENT_RUNTIME=local
|
|
439
|
+
* always builds here; ZEN_AGENT_RUNTIME_IMAGE names another image (a mirror); otherwise a
|
|
440
|
+
* released CLI uses its release's image, and a dev checkout builds its own code here.
|
|
441
|
+
*/
|
|
442
|
+
export function agentRuntimeRef(release, env = process.env) {
|
|
443
|
+
if (env.ZEN_AGENT_RUNTIME?.trim() === 'local')
|
|
444
|
+
return null;
|
|
445
|
+
const override = env.ZEN_AGENT_RUNTIME_IMAGE?.trim();
|
|
446
|
+
if (override)
|
|
447
|
+
return override;
|
|
448
|
+
return release.installed ? `${AGENT_RUNTIME_REPO}:${release.version}` : null;
|
|
449
|
+
}
|
|
450
|
+
/**
|
|
451
|
+
* The prebuilt runtime, pulled unless present, with its image id; null (with a note) to build it
|
|
452
|
+
* here: none for this CLI, unreachable, or not the version this CLI is.
|
|
453
|
+
*/
|
|
454
|
+
async function prebuiltRuntime() {
|
|
455
|
+
const release = cliRelease();
|
|
456
|
+
const image = agentRuntimeRef(release);
|
|
457
|
+
if (!image)
|
|
458
|
+
return null;
|
|
459
|
+
const fallback = (why) => {
|
|
460
|
+
note(` ${yellow('!')} ${dim(`prebuilt runtime ${image}: ${why}; building it here`)}`);
|
|
461
|
+
return null;
|
|
462
|
+
};
|
|
463
|
+
const present = await runProcess('podman', ['image', 'exists', image], { timeoutMs: 30_000 });
|
|
464
|
+
if (present.code !== 0) {
|
|
465
|
+
note(` ${dim(`Pulling ${image}…`)}`);
|
|
466
|
+
const pulled = await runProcess('podman', ['pull', '--quiet', image], {
|
|
467
|
+
timeoutMs: 15 * 60_000,
|
|
468
|
+
maxBytes: 1024 * 1024,
|
|
469
|
+
});
|
|
470
|
+
if (pulled.code !== 0) {
|
|
471
|
+
return fallback((pulled.stderr.trim() || `exit ${pulled.code}`).split('\n').at(-1));
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
const inspected = await runProcess('podman', ['image', 'inspect', '--format', '{{.Id}} {{index .Labels "zenera.version"}}', image], { timeoutMs: 60_000 });
|
|
475
|
+
const [id, version] = inspected.stdout.trim().split(' ');
|
|
476
|
+
if (inspected.code !== 0 || !id)
|
|
477
|
+
return fallback('cannot inspect it');
|
|
478
|
+
// A mirror named by ZEN_AGENT_RUNTIME_IMAGE must still be this CLI's runtime.
|
|
479
|
+
if (version !== release.version) {
|
|
480
|
+
return fallback(`it holds zen ${version || '(unlabelled)'}, this is ${release.version}`);
|
|
481
|
+
}
|
|
482
|
+
return { image, id };
|
|
483
|
+
}
|
|
376
484
|
/** Everything that went into the image: the base's id and the context, file by file. */
|
|
377
485
|
export function contentHash(ctx, baseId) {
|
|
378
486
|
const hash = createHash('sha256').update(baseId);
|
package/dist/validate.d.ts
CHANGED
|
@@ -177,8 +177,8 @@ export interface ValidateOptions {
|
|
|
177
177
|
export declare function validateProject(opts: ValidateOptions): Promise<Report>;
|
|
178
178
|
export declare function availableTools(root: string, config: ProjectConfig): AnyTool<unknown>[];
|
|
179
179
|
/**
|
|
180
|
-
* Pins every `@zenera/*` install in the project's Dockerfile
|
|
181
|
-
* which is what `zen check --fix` does about `sandbox.pin.stale` and
|
|
180
|
+
* Pins every `@zenera/*` install in the project's Dockerfile, and the zenera sandbox base's tag,
|
|
181
|
+
* to this `zen`, which is what `zen check --fix` does about `sandbox.pin.stale` and
|
|
182
182
|
* `sandbox.pin.absent`. Only the version after each name is touched, and only
|
|
183
183
|
* on lines `checkPin` reads, so whatever else the file holds is left alone.
|
|
184
184
|
*
|
package/dist/validate.js
CHANGED
|
@@ -1285,8 +1285,11 @@ function checkSandbox(root, config, record, add) {
|
|
|
1285
1285
|
}
|
|
1286
1286
|
/** `@zenera/cli`, and the version after it when the line pins one. */
|
|
1287
1287
|
const ZENERA_INSTALL = /@zenera\/([a-z0-9-]+)(?:@([^\s\\'"]+))?/g;
|
|
1288
|
+
// `FROM ghcr.io/zenera-ai/zenera-sandbox:<version>`: zen's sandbox base, whose tag is the zen in it.
|
|
1289
|
+
const ZENERA_BASE = /^(\s*FROM\s+(?:--platform=\S+\s+)?ghcr\.io\/zenera-ai\/zenera-sandbox)(?::([^\s@]+))?/i;
|
|
1288
1290
|
/**
|
|
1289
|
-
* Whether the Dockerfile's `@zenera/*` installs
|
|
1291
|
+
* Whether the Dockerfile's `@zenera/*` installs, and the tag of the zenera sandbox base it
|
|
1292
|
+
* starts FROM, name this `zen`.
|
|
1290
1293
|
*
|
|
1291
1294
|
* `zen init` writes the version it was run by and never rewrites the file
|
|
1292
1295
|
* again — the scaffold keeps what the project already has — so the pin is fixed
|
|
@@ -1316,6 +1319,16 @@ function checkPin(path, rel, add) {
|
|
|
1316
1319
|
if (/^\s*#/.test(line)) {
|
|
1317
1320
|
continue;
|
|
1318
1321
|
}
|
|
1322
|
+
const base = ZENERA_BASE.exec(line);
|
|
1323
|
+
if (base) {
|
|
1324
|
+
const name = 'ghcr.io/zenera-ai/zenera-sandbox';
|
|
1325
|
+
if (base[2] === undefined) {
|
|
1326
|
+
loose.add(name);
|
|
1327
|
+
}
|
|
1328
|
+
else if (base[2] !== mine) {
|
|
1329
|
+
stale.add(`${name}:${base[2]}`);
|
|
1330
|
+
}
|
|
1331
|
+
}
|
|
1319
1332
|
for (const match of line.matchAll(ZENERA_INSTALL)) {
|
|
1320
1333
|
const name = `@zenera/${match[1]}`;
|
|
1321
1334
|
const pinned = match[2];
|
|
@@ -1350,8 +1363,8 @@ function checkPin(path, rel, add) {
|
|
|
1350
1363
|
}
|
|
1351
1364
|
}
|
|
1352
1365
|
/**
|
|
1353
|
-
* Pins every `@zenera/*` install in the project's Dockerfile
|
|
1354
|
-
* which is what `zen check --fix` does about `sandbox.pin.stale` and
|
|
1366
|
+
* Pins every `@zenera/*` install in the project's Dockerfile, and the zenera sandbox base's tag,
|
|
1367
|
+
* to this `zen`, which is what `zen check --fix` does about `sandbox.pin.stale` and
|
|
1355
1368
|
* `sandbox.pin.absent`. Only the version after each name is touched, and only
|
|
1356
1369
|
* on lines `checkPin` reads, so whatever else the file holds is left alone.
|
|
1357
1370
|
*
|
|
@@ -1384,7 +1397,9 @@ export function repinDockerfile(root) {
|
|
|
1384
1397
|
.split('\n')
|
|
1385
1398
|
.map((line) => /^\s*#/.test(line)
|
|
1386
1399
|
? line
|
|
1387
|
-
: line
|
|
1400
|
+
: line
|
|
1401
|
+
.replace(ZENERA_BASE, (_, from) => `${from}:${mine}`)
|
|
1402
|
+
.replace(ZENERA_INSTALL, (_, name) => `@zenera/${name}@${mine}`))
|
|
1388
1403
|
.join('\n');
|
|
1389
1404
|
if (next === text) {
|
|
1390
1405
|
return [];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zenera/cli",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.6",
|
|
4
4
|
"description": "Command-line front end for @zenera/neo: agentic projects you can run, share and commit.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agents",
|
|
@@ -48,18 +48,19 @@
|
|
|
48
48
|
"build": "tsc -b",
|
|
49
49
|
"clean": "tsc -b --clean && rm -rf dist",
|
|
50
50
|
"postinstall": "node postinstall.mjs",
|
|
51
|
-
"prepack": "tsc -b"
|
|
51
|
+
"prepack": "tsc -b",
|
|
52
|
+
"agent-runtime:dockerfile": "tsc -b && node -e \"import(\\\"./dist/container.js\\\").then((m) => process.stdout.write(m.agentRuntimeDockerfile()))\" > agent-runtime.Dockerfile"
|
|
52
53
|
},
|
|
53
54
|
"dependencies": {
|
|
54
55
|
"@anthropic-ai/sdk": "^0.120.0",
|
|
55
56
|
"@google/genai": "^2.30.0",
|
|
56
57
|
"@inkjs/ui": "^2.0.0",
|
|
57
58
|
"@openrouter/sdk": "^1.4.25",
|
|
58
|
-
"@zenera/engine": "^1.2.
|
|
59
|
-
"@zenera/neo": "^1.2.
|
|
60
|
-
"@zenera/sandbox": "^1.2.
|
|
61
|
-
"@zenera/server": "^1.2.
|
|
62
|
-
"@zenera/view": "^1.2.
|
|
59
|
+
"@zenera/engine": "^1.2.6",
|
|
60
|
+
"@zenera/neo": "^1.2.6",
|
|
61
|
+
"@zenera/sandbox": "^1.2.6",
|
|
62
|
+
"@zenera/server": "^1.2.6",
|
|
63
|
+
"@zenera/view": "^1.2.6",
|
|
63
64
|
"google-auth-library": "^10.0.0",
|
|
64
65
|
"ink": "^7.1.1",
|
|
65
66
|
"openai": "^6.0.0",
|
|
@@ -1,52 +1,32 @@
|
|
|
1
1
|
# The container `run_command` runs in. Built by `zen run` and `zen check`, and
|
|
2
2
|
# named by the `sandbox: build:` block in agents.yaml.
|
|
3
3
|
#
|
|
4
|
-
#
|
|
5
|
-
#
|
|
6
|
-
#
|
|
7
|
-
#
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
# Copy Node.js runtime and global modules from official Node image
|
|
13
|
-
COPY --from=node /usr/local/bin/node /usr/local/bin/node
|
|
14
|
-
COPY --from=node /usr/local/include/node /usr/local/include/node
|
|
15
|
-
COPY --from=node /usr/local/lib/node_modules /usr/local/lib/node_modules
|
|
16
|
-
|
|
17
|
-
# Symlink npm and npx executables
|
|
18
|
-
RUN ln -s /usr/local/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm \
|
|
19
|
-
&& ln -s /usr/local/lib/node_modules/npm/bin/npx-cli.js /usr/local/bin/npx
|
|
4
|
+
# It starts from zen's sandbox base: Python and Node, the packages zen's tools
|
|
5
|
+
# need, the HTTP clients `requests` (Python) and `axios` (Node), and this `zen`
|
|
6
|
+
# itself (the tag is its version - `zen check --fix` moves it after an upgrade).
|
|
7
|
+
# Pulled once; built here if it cannot be pulled.
|
|
8
|
+
#
|
|
9
|
+
# Add what this project always needs below rather than letting an agent install
|
|
10
|
+
# it at run time: a root `pip install` or `apt-get` lands in the container's own
|
|
11
|
+
# filesystem, which is thrown away.
|
|
20
12
|
|
|
21
|
-
|
|
22
|
-
# when the pinned CLI release changes. Keep in sync with their package.json files.
|
|
23
|
-
RUN npm install -g \
|
|
24
|
-
"@anthropic-ai/sdk@^0.120.0" \
|
|
25
|
-
"@apidevtools/swagger-parser@^12.0.0" \
|
|
26
|
-
"@google/genai@^2.30.0" \
|
|
27
|
-
"@inkjs/ui@^2.0.0" \
|
|
28
|
-
"@lancedb/lancedb@^0.38.0" \
|
|
29
|
-
"@openrouter/sdk@^1.4.25" \
|
|
30
|
-
"@types/hast@^3.0.5" \
|
|
31
|
-
"google-auth-library@^10.0.0" \
|
|
32
|
-
"graphology@^0.26.0" \
|
|
33
|
-
"ink@^7.1.1" \
|
|
34
|
-
"lowlight@^3.3.0" \
|
|
35
|
-
"mermaid@^12.2.0" \
|
|
36
|
-
"openai@^6.0.0" \
|
|
37
|
-
"react@^19.2.8" \
|
|
38
|
-
"rehype-sanitize@^6.0.0" \
|
|
39
|
-
"rehype-slug@^6.0.0" \
|
|
40
|
-
"remark-frontmatter@^5.0.0" \
|
|
41
|
-
"remark-gfm@^4.0.1" \
|
|
42
|
-
"remark-parse@^11.0.0" \
|
|
43
|
-
"remark-rehype@^11.1.2" \
|
|
44
|
-
"unified@^11.0.5" \
|
|
45
|
-
"yaml@^2.9.1" \
|
|
46
|
-
"yauzl@^3.4.0" \
|
|
47
|
-
"yazl@^3.3.1" \
|
|
48
|
-
"zod@^4.6.7"
|
|
13
|
+
FROM ghcr.io/zenera-ai/zenera-sandbox:{{version}}
|
|
49
14
|
|
|
50
|
-
#
|
|
51
|
-
#
|
|
52
|
-
|
|
15
|
+
# Examples - uncomment and edit what this project needs. Each change rebuilds the
|
|
16
|
+
# image once; later runs reuse it.
|
|
17
|
+
#
|
|
18
|
+
# Command-line tools for documents and data (Debian packages): PDF to text,
|
|
19
|
+
# document conversion, JSON, SQLite, images, audio and video.
|
|
20
|
+
# RUN apt-get update \
|
|
21
|
+
# && apt-get install -y --no-install-recommends \
|
|
22
|
+
# poppler-utils pandoc jq sqlite3 imagemagick ffmpeg \
|
|
23
|
+
# && rm -rf /var/lib/apt/lists/*
|
|
24
|
+
#
|
|
25
|
+
# Python libraries for analysis, charts, spreadsheets and PDFs:
|
|
26
|
+
# RUN pip install --no-cache-dir \
|
|
27
|
+
# pandas \
|
|
28
|
+
# numpy \
|
|
29
|
+
# matplotlib \
|
|
30
|
+
# scikit-learn \
|
|
31
|
+
# openpyxl \
|
|
32
|
+
# pypdf
|