@hasna/machines 0.0.5 → 0.0.7

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/cli/index.js CHANGED
@@ -18214,6 +18214,39 @@ function hasCommand3(binary) {
18214
18214
  const result = Bun.spawnSync(["bash", "-lc", `command -v ${binary} >/dev/null 2>&1`], { stdout: "ignore", stderr: "ignore", env: process.env });
18215
18215
  return result.exitCode === 0;
18216
18216
  }
18217
+ function hasDisplayServer() {
18218
+ const display = process.env["DISPLAY"] || "";
18219
+ const wayland = process.env["WAYLAND_DISPLAY"] || "";
18220
+ if (display || wayland)
18221
+ return true;
18222
+ if (process.platform === "darwin")
18223
+ return true;
18224
+ if (process.platform === "linux") {
18225
+ try {
18226
+ const result = Bun.spawnSync(["loginctl", "list-sessions", "--no-legend"], { stdout: "pipe", stderr: "pipe", env: process.env, timeout: 2000 });
18227
+ if (result.exitCode === 0) {
18228
+ const sessions = result.stdout.toString("utf8").trim();
18229
+ if (sessions) {
18230
+ for (const line of sessions.split(`
18231
+ `)) {
18232
+ const sessionId = line.trim().split(/\s+/)[0];
18233
+ if (sessionId) {
18234
+ const typeResult = Bun.spawnSync(["loginctl", "show-session", sessionId, "-p", "Type", "--value"], { stdout: "pipe", stderr: "pipe", env: process.env, timeout: 2000 });
18235
+ if (typeResult.exitCode === 0) {
18236
+ const sessionType = typeResult.stdout.toString("utf8").trim();
18237
+ if (sessionType === "wayland" || sessionType === "x11") {
18238
+ return true;
18239
+ }
18240
+ }
18241
+ }
18242
+ }
18243
+ }
18244
+ }
18245
+ } catch {}
18246
+ return false;
18247
+ }
18248
+ return false;
18249
+ }
18217
18250
  function computeHash2(content) {
18218
18251
  return createHash3("sha256").update(content).digest("hex").slice(0, 16);
18219
18252
  }
@@ -18263,7 +18296,13 @@ function startClipboardDaemon(port) {
18263
18296
  let lastHash = "";
18264
18297
  const secret = loadSharedSecret2();
18265
18298
  const machineId = process.env["HASNA_MACHINES_MACHINE_ID"] || "unknown";
18299
+ const hasDisplay = hasDisplayServer();
18300
+ if (!hasDisplay) {
18301
+ console.log("clipboard daemon running in receive-only mode (no display server)");
18302
+ }
18266
18303
  setInterval(async () => {
18304
+ if (!hasDisplay)
18305
+ return;
18267
18306
  const content = readLocalClipboardSync2();
18268
18307
  if (!content)
18269
18308
  return;
@@ -1 +1 @@
1
- {"version":3,"file":"clipboard-daemon.d.ts","sourceRoot":"","sources":["../../src/commands/clipboard-daemon.ts"],"names":[],"mappings":"AAwFA,wBAAgB,mBAAmB,IAAI;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAO9E;AAED,wBAAgB,oBAAoB,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAqDxD"}
1
+ {"version":3,"file":"clipboard-daemon.d.ts","sourceRoot":"","sources":["../../src/commands/clipboard-daemon.ts"],"names":[],"mappings":"AA2HA,wBAAgB,mBAAmB,IAAI;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAO9E;AAED,wBAAgB,oBAAoB,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CA6DxD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hasna/machines",
3
- "version": "0.0.5",
3
+ "version": "0.0.7",
4
4
  "description": "Machine fleet management CLI + MCP for developers",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",