@botlearn-course/daemon 0.0.5 → 0.0.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/README.md CHANGED
@@ -40,7 +40,9 @@ npx @botlearn-course/daemon@latest course logout
40
40
  `botlearn-sandbox-supervisor agent-service session`。它不是 BYOA 用户入口:生产环境只允许由
41
41
  Agent Service 以固定 argv 启动,通过 stdin 接收一次性 bootstrap,并把 daemon/runtime 分别降权
42
42
  到 `botlearn-control`/`user` UID。E2B Template 通过 root-owned 固定 launcher 将 DeepSeek
43
- 单向降权为 `user` 并设置 `no_new_privs`;runtime 用户本身没有 sudo 权限。
43
+ 单向降权为 `user` 并设置 `no_new_privs`;runtime 用户本身没有 sudo 权限。托管启动链只执行
44
+ `/opt` 下的固定 Node、supervisor、daemon、launcher 与 DeepSeek 文件,不信任 E2B 会开放给 runtime
45
+ 写入的 `/usr/local/bin`。
44
46
  `agent-service session --bootstrap-stdin` 同样属于受 supervisor 保护的内部协议,不应直接暴露给
45
47
  课程任务或 workspace shell。
46
48
 
@@ -20,7 +20,8 @@ const AGENT_SERVICE_SUPERVISOR_ENV_KEYS = [
20
20
  ];
21
21
  const RUNTIME_USER_PATTERN = /^[a-z_][a-z0-9_-]{0,31}$/;
22
22
  const RUNTIME_SUDO_BINARY = "/usr/bin/sudo";
23
- const MANAGED_RUNTIME_LAUNCHER = "/usr/local/bin/botlearn-runtime-launcher";
23
+ const MANAGED_RUNTIME_LAUNCHER = "/opt/botlearn/bin/botlearn-runtime-launcher";
24
+ const MANAGED_RUNTIME_BINARY = "/opt/deepseek-tui/0.8.39/bin/deepseek";
24
25
  /** Remove Course control-plane coordinates before any model/runtime child is created. */
25
26
  export function clearAgentServiceControlEnv(env = process.env) {
26
27
  for (const key of AGENT_SERVICE_CONTROL_ENV_KEYS)
@@ -72,6 +73,9 @@ export function runtimeChildLaunch(binary, args, env = process.env) {
72
73
  if (env.BOTLEARN_RUNTIME_LAUNCHER !== MANAGED_RUNTIME_LAUNCHER) {
73
74
  throw new Error("invalid supervisor-provided runtime launcher");
74
75
  }
76
+ if (binary !== MANAGED_RUNTIME_BINARY) {
77
+ throw new Error("invalid supervisor-provided runtime binary");
78
+ }
75
79
  return {
76
80
  binary: RUNTIME_SUDO_BINARY,
77
81
  args: [
@@ -10,7 +10,19 @@ const CONTROL_HOME = "/home/botlearn-control/.botlearn-course/daemon";
10
10
  const WORKSPACE = "/workspace";
11
11
  const RUNTIME_PROFILE_ROOT = "/run/botlearn-runtime-profiles";
12
12
  const SUPERVISOR_LOCK_ROOT = "/run/botlearn-sandbox-supervisors";
13
- const DAEMON_BINARY = "/usr/local/bin/botlearn-course-daemon";
13
+ const NODE_BINARY = "/opt/node/22.23.1/bin/node";
14
+ const DAEMON_ENTRY = "/opt/botlearn/course-daemon/dist/cli.js";
15
+ const RUNTIME_LAUNCHER = "/opt/botlearn/bin/botlearn-runtime-launcher";
16
+ const DEEPSEEK_BINARY = "/opt/deepseek-tui/0.8.39/bin/deepseek";
17
+ const MANAGED_PATH = [
18
+ "/opt/deepseek-tui/0.8.39/bin",
19
+ "/opt/node/22.23.1/bin",
20
+ "/usr/bin",
21
+ "/bin",
22
+ // E2B materializes this directory as runtime-writable. Keep it last and never
23
+ // use it for a managed control-plane executable.
24
+ "/usr/local/bin",
25
+ ].join(":");
14
26
  function numericId(flag, user) {
15
27
  const output = execFileSync("/usr/bin/id", [flag, user], {
16
28
  encoding: "utf8",
@@ -117,19 +129,25 @@ export async function runSandboxSupervisor(argv) {
117
129
  if (releaseLock === null)
118
130
  return 0;
119
131
  prepareDirectories(controlUid, controlGid, runtimeUid, runtimeSessionId, sessionGeneration);
120
- child = spawn(DAEMON_BINARY, ["agent-service", "session", "--bootstrap-stdin"], {
132
+ child = spawn(NODE_BINARY, [
133
+ DAEMON_ENTRY,
134
+ "agent-service",
135
+ "session",
136
+ "--bootstrap-stdin",
137
+ ], {
121
138
  uid: controlUid,
122
139
  gid: controlGid,
123
140
  env: {
124
141
  HOME: "/home/botlearn-control",
125
- PATH: "/usr/local/bin:/usr/bin:/bin",
142
+ PATH: MANAGED_PATH,
126
143
  BOTLEARN_DAEMON_HOME: CONTROL_HOME,
127
144
  BOTLEARN_RUNTIME_UID: String(runtimeUid),
128
145
  BOTLEARN_RUNTIME_GID: String(controlGid),
129
146
  BOTLEARN_RUNTIME_USER: RUNTIME_USER,
130
147
  BOTLEARN_RUNTIME_GROUP: CONTROL_USER,
131
148
  BOTLEARN_RUNTIME_HOME: "/home/user",
132
- BOTLEARN_RUNTIME_LAUNCHER: "/usr/local/bin/botlearn-runtime-launcher",
149
+ BOTLEARN_RUNTIME_LAUNCHER: RUNTIME_LAUNCHER,
150
+ BOTLEARN_DEEPSEEK_TUI_BIN: DEEPSEEK_BINARY,
133
151
  BOTLEARN_AGENT_SERVICE_WORKSPACE_ROOT: WORKSPACE,
134
152
  BOTLEARN_AGENT_SERVICE_PROFILE_ROOT: RUNTIME_PROFILE_ROOT,
135
153
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@botlearn-course/daemon",
3
- "version": "0.0.5",
3
+ "version": "0.0.6",
4
4
  "description": "Lightweight BotLearn Course daemon: run course tasks on your own machine with your own agent runtime (BYOA).",
5
5
  "type": "module",
6
6
  "bin": {