@ northlight /env-docker -从Node启动并连接到crtrd容器
@north-light/env-docker 开始,连接和停止 crtrd (crouter守护进程)Docker容器通过 docker 命令行执行命令,并返回指定的连接设置 @north-light/sdk 需要。它没有依赖项,包括SDK。
它不是Docker客户端库或编排器:它运行一个容器并告诉您如何访问它。该映像不包含模型凭据,因此在运行代理执行任何操作之前,您需要在容器内配置提供程序。
安装
npm install @north-light/env-docker @north-light/sdk
必须打开Docker命令行 PATH,并能拉动 ghcr.io/northlight-systems/crtrd (或者你传递的图像)。
启动容器
import { start } from '@north-light/env-docker';
import Crouter from '@north-light/sdk';
const env = await start({
name: 'my-crouter',
volume: 'my-agent-home',
});
const client = new Crouter(env.connection());
console.log(await client.system.health());
await env.stop();
start() 创建一个容器 ghcr.io/northlight-systems/crtrd:latest 除非你通过 image,生成一个承载令牌,授予图像的沙盒启动器所需的特权(SYS_ADMIN 和 NET_ADMIN(无限制的seccomp和AppArmor),将映射的端口绑定到 127.0.0.1,等待 /healthz. connection() 返回 { baseURL, headers },形状 new Crouter(...) 需要。 stop() 移除容器。
选项: env 设置容器环境变量, port 选择主机端口。 volume 将命名Docker卷挂载到 /volume,图像的声明体积。命名卷在重新创建容器时保存画布状态、内存和已安装的凭据。
附加到现有容器
import { attach } from '@north-light/env-docker';
const env = await attach('my-crouter');
const connection = env.connection();
await env.stop(); // stops the container but does not remove it
attach(name) 读取容器的映射端口及其 CRTRD_TOKEN.
相关
@north-light/sdk-消费的客户端connection().docker/README.md-运行crtrd图像与docker run,它的环境变量,并在本地构建它。- 主要存储库 - - -
crtrCLI,crtrd守护进程。
许可证
专有的。版权所有2026 Northlight Systems版权所有。看到 LICENSE.