@holon-run/uxc-daemon-client 0.15.4 → 0.15.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/index.cjs +6 -5
- package/dist/index.js +6 -5
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -36,7 +36,6 @@ __export(index_exports, {
|
|
|
36
36
|
});
|
|
37
37
|
module.exports = __toCommonJS(index_exports);
|
|
38
38
|
var import_node_child_process = require("child_process");
|
|
39
|
-
var import_node_crypto = require("crypto");
|
|
40
39
|
var import_node_os = require("os");
|
|
41
40
|
var import_node_path = require("path");
|
|
42
41
|
var import_node_net = __toESM(require("net"), 1);
|
|
@@ -623,15 +622,17 @@ function normalizeOptions(options) {
|
|
|
623
622
|
};
|
|
624
623
|
}
|
|
625
624
|
function defaultSocketPath(env) {
|
|
626
|
-
if (env?.XDG_RUNTIME_DIR) {
|
|
627
|
-
return (0, import_node_path.join)(env.XDG_RUNTIME_DIR, "uxc", "uxc.sock");
|
|
628
|
-
}
|
|
629
625
|
if (env?.HOME) {
|
|
630
626
|
return (0, import_node_path.join)(env.HOME, ".uxc", "daemon", "uxc.sock");
|
|
631
627
|
}
|
|
632
|
-
const label = (
|
|
628
|
+
const label = bestEffortUserLabel(env);
|
|
633
629
|
return (0, import_node_path.join)((0, import_node_os.tmpdir)(), `uxc-${label}`, "daemon", "uxc.sock");
|
|
634
630
|
}
|
|
631
|
+
function bestEffortUserLabel(env) {
|
|
632
|
+
const raw = env?.USER ?? env?.USERNAME ?? "unknown";
|
|
633
|
+
const filtered = raw.replace(/[^A-Za-z0-9_-]/g, "_");
|
|
634
|
+
return filtered.length > 0 ? filtered : "unknown";
|
|
635
|
+
}
|
|
635
636
|
function requestId(prefix) {
|
|
636
637
|
return `${prefix}-${process.pid}-${Date.now()}`;
|
|
637
638
|
}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
2
|
import { execFile } from "child_process";
|
|
3
|
-
import { createHash } from "crypto";
|
|
4
3
|
import { tmpdir } from "os";
|
|
5
4
|
import { join } from "path";
|
|
6
5
|
import net from "net";
|
|
@@ -587,15 +586,17 @@ function normalizeOptions(options) {
|
|
|
587
586
|
};
|
|
588
587
|
}
|
|
589
588
|
function defaultSocketPath(env) {
|
|
590
|
-
if (env?.XDG_RUNTIME_DIR) {
|
|
591
|
-
return join(env.XDG_RUNTIME_DIR, "uxc", "uxc.sock");
|
|
592
|
-
}
|
|
593
589
|
if (env?.HOME) {
|
|
594
590
|
return join(env.HOME, ".uxc", "daemon", "uxc.sock");
|
|
595
591
|
}
|
|
596
|
-
const label =
|
|
592
|
+
const label = bestEffortUserLabel(env);
|
|
597
593
|
return join(tmpdir(), `uxc-${label}`, "daemon", "uxc.sock");
|
|
598
594
|
}
|
|
595
|
+
function bestEffortUserLabel(env) {
|
|
596
|
+
const raw = env?.USER ?? env?.USERNAME ?? "unknown";
|
|
597
|
+
const filtered = raw.replace(/[^A-Za-z0-9_-]/g, "_");
|
|
598
|
+
return filtered.length > 0 ? filtered : "unknown";
|
|
599
|
+
}
|
|
599
600
|
function requestId(prefix) {
|
|
600
601
|
return `${prefix}-${process.pid}-${Date.now()}`;
|
|
601
602
|
}
|