yaver-cli 1.99.27 → 1.99.29

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 (2) hide show
  1. package/package.json +1 -1
  2. package/src/postinstall.js +68 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yaver-cli",
3
- "version": "1.99.27",
3
+ "version": "1.99.29",
4
4
  "mcpName": "io.github.kivanccakmak/yaver",
5
5
  "description": "Unified npm bootstrap for the Yaver agent, SDK injection, and local-first developer runtime",
6
6
  "bin": {
@@ -69,6 +69,71 @@ function installMissingCodingRunners() {
69
69
  }
70
70
  }
71
71
 
72
+ function ensureLinuxRunnerSandboxPackages() {
73
+ try {
74
+ if (process.platform !== "linux") return;
75
+ if (typeof process.geteuid !== "function" || process.geteuid() !== 0) return;
76
+ const missing = [];
77
+ if (!commandExists("bwrap")) missing.push("bubblewrap");
78
+ if (!commandExists("newuidmap")) missing.push("uidmap");
79
+ if (missing.length === 0) return;
80
+ if (!commandExists("apt-get")) {
81
+ log(`Runner sandbox packages missing (${missing.join(", ")}) and no apt-get is available for auto-install.`);
82
+ return;
83
+ }
84
+ execSync("apt-get update -y", { stdio: ["ignore", "ignore", "ignore"] });
85
+ execSync(`DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends ${missing.join(" ")}`, {
86
+ stdio: "inherit",
87
+ });
88
+ log(`Installed Linux runner sandbox packages: ${missing.join(", ")}.`);
89
+ } catch (error) {
90
+ log(`Skipping Linux runner sandbox package bootstrap: ${error.message}`);
91
+ }
92
+ }
93
+
94
+ function ensureLinuxRunnerSandboxSupport() {
95
+ try {
96
+ if (process.platform !== "linux") return;
97
+ if (typeof process.geteuid !== "function" || process.geteuid() !== 0) return;
98
+ const confPath = "/etc/sysctl.d/99-yaver-runner-sandbox.conf";
99
+ let body = "kernel.unprivileged_userns_clone=1\nuser.max_user_namespaces=1048576\n";
100
+ if (fs.existsSync("/proc/sys/kernel/apparmor_restrict_unprivileged_userns")) {
101
+ body += "kernel.apparmor_restrict_unprivileged_userns=0\n";
102
+ }
103
+ fs.writeFileSync(confPath, body);
104
+ execSync("sysctl --system", { stdio: ["ignore", "ignore", "ignore"] });
105
+ log("Enabled Linux user-namespace prerequisites for Codex/runner sandboxes.");
106
+ } catch (error) {
107
+ log(`Skipping Linux runner sandbox bootstrap: ${error.message}`);
108
+ }
109
+ }
110
+
111
+ function reportLinuxRunnerSandboxStatus() {
112
+ try {
113
+ if (process.platform !== "linux") return;
114
+ const issues = [];
115
+ if (!commandExists("bwrap")) issues.push("bubblewrap");
116
+ if (!commandExists("newuidmap")) issues.push("uidmap");
117
+ try {
118
+ const userns = fs.readFileSync("/proc/sys/kernel/unprivileged_userns_clone", "utf8").trim();
119
+ if (userns === "0") issues.push("kernel.unprivileged_userns_clone=0");
120
+ } catch (_) {}
121
+ try {
122
+ const maxUserns = fs.readFileSync("/proc/sys/user/max_user_namespaces", "utf8").trim();
123
+ if (!maxUserns || maxUserns === "0") issues.push("user.max_user_namespaces=0");
124
+ } catch (_) {}
125
+ try {
126
+ const apparmor = fs.readFileSync("/proc/sys/kernel/apparmor_restrict_unprivileged_userns", "utf8").trim();
127
+ if (apparmor === "1") issues.push("kernel.apparmor_restrict_unprivileged_userns=1");
128
+ } catch (_) {}
129
+ if (issues.length > 0) {
130
+ log(`Linux runner sandbox still has blockers: ${issues.join(", ")}. Yaver will mark Codex blocked until the host allows it.`);
131
+ }
132
+ } catch (_) {
133
+ // Best-effort only.
134
+ }
135
+ }
136
+
72
137
  function installMissingMobileTools() {
73
138
  const missing = MOBILE_TOOL_BOOTSTRAP.filter((entry) => !commandExists(entry.command));
74
139
  if (missing.length === 0) {
@@ -158,6 +223,9 @@ async function main() {
158
223
  }
159
224
 
160
225
  ensurePathOnUnix();
226
+ ensureLinuxRunnerSandboxPackages();
227
+ ensureLinuxRunnerSandboxSupport();
228
+ reportLinuxRunnerSandboxStatus();
161
229
 
162
230
  if (process.platform !== "linux" && process.platform !== "darwin") {
163
231
  return;