@primafuture/systemd-tasks 1.1.0 → 1.2.0
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/CHANGELOG.md +13 -0
- package/README.md +56 -1
- package/dist/finalizer.mjs +448 -0
- package/dist/finalizer.mjs.map +1 -0
- package/dist/observed.cjs.map +1 -1
- package/dist/observed.d.cts +1 -1
- package/dist/observed.d.ts +1 -1
- package/dist/observed.mjs.map +1 -1
- package/dist/runtime.cjs +533 -380
- package/dist/runtime.cjs.map +1 -1
- package/dist/runtime.d.cts +21 -1
- package/package.json +1 -1
package/dist/runtime.cjs
CHANGED
|
@@ -1164,12 +1164,12 @@ var require_validators = __commonJS({
|
|
|
1164
1164
|
}
|
|
1165
1165
|
}
|
|
1166
1166
|
var pathRe = /^[A-Za-z0-9_]+$/;
|
|
1167
|
-
function isObjectPathValid(
|
|
1168
|
-
return !!(typeof
|
|
1167
|
+
function isObjectPathValid(path5) {
|
|
1168
|
+
return !!(typeof path5 === "string" && path5 && path5[0] === "/" && (path5.length === 1 || path5[path5.length - 1] !== "/" && path5.split("/").slice(1).every((p) => p && pathRe.test(p))));
|
|
1169
1169
|
}
|
|
1170
|
-
function assertObjectPathValid(
|
|
1171
|
-
if (!isObjectPathValid(
|
|
1172
|
-
throw new Error(`Invalid object path: ${
|
|
1170
|
+
function assertObjectPathValid(path5) {
|
|
1171
|
+
if (!isObjectPathValid(path5)) {
|
|
1172
|
+
throw new Error(`Invalid object path: ${path5}`);
|
|
1173
1173
|
}
|
|
1174
1174
|
}
|
|
1175
1175
|
var elementRe = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
@@ -1334,11 +1334,11 @@ var require_message_type = __commonJS({
|
|
|
1334
1334
|
* @param {Array] body - The body of the message as an array of arguments.
|
|
1335
1335
|
* Must match the signature.
|
|
1336
1336
|
*/
|
|
1337
|
-
static newSignal(
|
|
1337
|
+
static newSignal(path5, iface, name, signature = "", body = []) {
|
|
1338
1338
|
return new _Message({
|
|
1339
1339
|
type: SIGNAL,
|
|
1340
1340
|
interface: iface,
|
|
1341
|
-
path:
|
|
1341
|
+
path: path5,
|
|
1342
1342
|
member: name,
|
|
1343
1343
|
signature,
|
|
1344
1344
|
body
|
|
@@ -1755,7 +1755,7 @@ var require_errors = __commonJS({
|
|
|
1755
1755
|
var require_handlers = __commonJS({
|
|
1756
1756
|
"node_modules/dbus-next/lib/service/handlers.js"(exports2, module2) {
|
|
1757
1757
|
"use strict";
|
|
1758
|
-
var
|
|
1758
|
+
var fs6 = require("fs");
|
|
1759
1759
|
var variant = require_variant();
|
|
1760
1760
|
var Variant2 = variant.Variant;
|
|
1761
1761
|
var { Message: Message2 } = require_message_type();
|
|
@@ -1769,26 +1769,26 @@ var require_handlers = __commonJS({
|
|
|
1769
1769
|
ACCESS_WRITE,
|
|
1770
1770
|
ACCESS_READWRITE
|
|
1771
1771
|
} = require_interface();
|
|
1772
|
-
var
|
|
1772
|
+
var constants5 = require_constants();
|
|
1773
1773
|
var {
|
|
1774
1774
|
METHOD_RETURN
|
|
1775
|
-
} =
|
|
1775
|
+
} = constants5.MessageType;
|
|
1776
1776
|
var { DBusError } = require_errors();
|
|
1777
1777
|
var INVALID_ARGS = "org.freedesktop.DBus.Error.InvalidArgs";
|
|
1778
1778
|
function sendServiceError(bus, msg, errorMessage) {
|
|
1779
1779
|
bus.send(Message2.newError(msg, "com.github.dbus_next.ServiceError", `Service error: ${errorMessage}`));
|
|
1780
1780
|
return true;
|
|
1781
1781
|
}
|
|
1782
|
-
function handleIntrospect(bus, msg,
|
|
1783
|
-
bus.send(Message2.newMethodReturn(msg, "s", [bus._introspect(
|
|
1782
|
+
function handleIntrospect(bus, msg, path5) {
|
|
1783
|
+
bus.send(Message2.newMethodReturn(msg, "s", [bus._introspect(path5)]));
|
|
1784
1784
|
}
|
|
1785
|
-
function handleGetProperty(bus, msg,
|
|
1785
|
+
function handleGetProperty(bus, msg, path5) {
|
|
1786
1786
|
const [ifaceName, prop] = msg.body;
|
|
1787
|
-
if (!bus._serviceObjects[
|
|
1788
|
-
bus.send(Message2.newError(msg, INVALID_ARGS, `Path not exported on bus: '${
|
|
1787
|
+
if (!bus._serviceObjects[path5]) {
|
|
1788
|
+
bus.send(Message2.newError(msg, INVALID_ARGS, `Path not exported on bus: '${path5}'`));
|
|
1789
1789
|
return;
|
|
1790
1790
|
}
|
|
1791
|
-
const obj = bus._getServiceObject(
|
|
1791
|
+
const obj = bus._getServiceObject(path5);
|
|
1792
1792
|
const iface = obj.interfaces[ifaceName];
|
|
1793
1793
|
if (!iface) {
|
|
1794
1794
|
bus.send(Message2.newError(msg, INVALID_ARGS, `No such interface: '${ifaceName}'`));
|
|
@@ -1832,13 +1832,13 @@ ${e.stack}`);
|
|
|
1832
1832
|
const body = new Variant2(options.signature, propertyValue);
|
|
1833
1833
|
bus.send(Message2.newMethodReturn(msg, "v", [body]));
|
|
1834
1834
|
}
|
|
1835
|
-
function handleGetAllProperties(bus, msg,
|
|
1835
|
+
function handleGetAllProperties(bus, msg, path5) {
|
|
1836
1836
|
const ifaceName = msg.body[0];
|
|
1837
|
-
if (!bus._serviceObjects[
|
|
1838
|
-
bus.send(Message2.newError(msg, INVALID_ARGS, `Path not exported on bus: '${
|
|
1837
|
+
if (!bus._serviceObjects[path5]) {
|
|
1838
|
+
bus.send(Message2.newError(msg, INVALID_ARGS, `Path not exported on bus: '${path5}'`));
|
|
1839
1839
|
return;
|
|
1840
1840
|
}
|
|
1841
|
-
const obj = bus._getServiceObject(
|
|
1841
|
+
const obj = bus._getServiceObject(path5);
|
|
1842
1842
|
const iface = obj.interfaces[ifaceName];
|
|
1843
1843
|
const result = {};
|
|
1844
1844
|
if (iface) {
|
|
@@ -1871,13 +1871,13 @@ ${e.stack}`);
|
|
|
1871
1871
|
}
|
|
1872
1872
|
bus.send(Message2.newMethodReturn(msg, "a{sv}", [result]));
|
|
1873
1873
|
}
|
|
1874
|
-
function handleSetProperty(bus, msg,
|
|
1874
|
+
function handleSetProperty(bus, msg, path5) {
|
|
1875
1875
|
const [ifaceName, prop, value] = msg.body;
|
|
1876
|
-
if (!bus._serviceObjects[
|
|
1877
|
-
bus.send(Message2.newError(msg, INVALID_ARGS, `Path not exported on bus: '${
|
|
1876
|
+
if (!bus._serviceObjects[path5]) {
|
|
1877
|
+
bus.send(Message2.newError(msg, INVALID_ARGS, `Path not exported on bus: '${path5}'`));
|
|
1878
1878
|
return;
|
|
1879
1879
|
}
|
|
1880
|
-
const obj = bus._getServiceObject(
|
|
1880
|
+
const obj = bus._getServiceObject(path5);
|
|
1881
1881
|
const iface = obj.interfaces[ifaceName];
|
|
1882
1882
|
if (!iface) {
|
|
1883
1883
|
bus.send(Message2.newError(msg, INVALID_ARGS, `Interface not found: '${ifaceName}'`));
|
|
@@ -1920,7 +1920,7 @@ ${e.stack}`);
|
|
|
1920
1920
|
function handleStdIfaces(bus, msg) {
|
|
1921
1921
|
const {
|
|
1922
1922
|
member,
|
|
1923
|
-
path:
|
|
1923
|
+
path: path5,
|
|
1924
1924
|
signature
|
|
1925
1925
|
} = msg;
|
|
1926
1926
|
const ifaceName = msg.interface;
|
|
@@ -1932,22 +1932,22 @@ ${e.stack}`);
|
|
|
1932
1932
|
bus.send(Message2.newError(msg, INVALID_ARGS, `Invalid member name: '${member}'`));
|
|
1933
1933
|
return true;
|
|
1934
1934
|
}
|
|
1935
|
-
if (!isObjectPathValid(
|
|
1936
|
-
bus.send(Message2.newError(msg, INVALID_ARGS, `Invalid path name: '${
|
|
1935
|
+
if (!isObjectPathValid(path5)) {
|
|
1936
|
+
bus.send(Message2.newError(msg, INVALID_ARGS, `Invalid path name: '${path5}'`));
|
|
1937
1937
|
return true;
|
|
1938
1938
|
}
|
|
1939
1939
|
if (ifaceName === "org.freedesktop.DBus.Introspectable" && member === "Introspect" && !signature) {
|
|
1940
|
-
handleIntrospect(bus, msg,
|
|
1940
|
+
handleIntrospect(bus, msg, path5);
|
|
1941
1941
|
return true;
|
|
1942
1942
|
} else if (ifaceName === "org.freedesktop.DBus.Properties") {
|
|
1943
1943
|
if (member === "Get" && signature === "ss") {
|
|
1944
|
-
handleGetProperty(bus, msg,
|
|
1944
|
+
handleGetProperty(bus, msg, path5);
|
|
1945
1945
|
return true;
|
|
1946
1946
|
} else if (member === "Set" && signature === "ssv") {
|
|
1947
|
-
handleSetProperty(bus, msg,
|
|
1947
|
+
handleSetProperty(bus, msg, path5);
|
|
1948
1948
|
return true;
|
|
1949
1949
|
} else if (member === "GetAll") {
|
|
1950
|
-
handleGetAllProperties(bus, msg,
|
|
1950
|
+
handleGetAllProperties(bus, msg, path5);
|
|
1951
1951
|
return true;
|
|
1952
1952
|
}
|
|
1953
1953
|
} else if (ifaceName === "org.freedesktop.DBus.Peer") {
|
|
@@ -1960,7 +1960,7 @@ ${e.stack}`);
|
|
|
1960
1960
|
});
|
|
1961
1961
|
return true;
|
|
1962
1962
|
} else if (member === "GetMachineId" && !signature) {
|
|
1963
|
-
const machineId =
|
|
1963
|
+
const machineId = fs6.readFileSync("/var/lib/dbus/machine-id").toString().trim();
|
|
1964
1964
|
bus._connection.message({
|
|
1965
1965
|
type: METHOD_RETURN,
|
|
1966
1966
|
serial: bus._serial++,
|
|
@@ -1976,7 +1976,7 @@ ${e.stack}`);
|
|
|
1976
1976
|
}
|
|
1977
1977
|
function handleMessage(msg, bus) {
|
|
1978
1978
|
let {
|
|
1979
|
-
path:
|
|
1979
|
+
path: path5,
|
|
1980
1980
|
member,
|
|
1981
1981
|
signature
|
|
1982
1982
|
} = msg;
|
|
@@ -1985,10 +1985,10 @@ ${e.stack}`);
|
|
|
1985
1985
|
if (handleStdIfaces(bus, msg)) {
|
|
1986
1986
|
return true;
|
|
1987
1987
|
}
|
|
1988
|
-
if (!bus._serviceObjects[
|
|
1988
|
+
if (!bus._serviceObjects[path5]) {
|
|
1989
1989
|
return false;
|
|
1990
1990
|
}
|
|
1991
|
-
const obj = bus._getServiceObject(
|
|
1991
|
+
const obj = bus._getServiceObject(path5);
|
|
1992
1992
|
const iface = obj.interfaces[ifaceName];
|
|
1993
1993
|
if (!iface) {
|
|
1994
1994
|
return false;
|
|
@@ -2050,9 +2050,9 @@ var require_object = __commonJS({
|
|
|
2050
2050
|
var Interface = require_interface().Interface;
|
|
2051
2051
|
var assertObjectPathValid = require_validators().assertObjectPathValid;
|
|
2052
2052
|
var ServiceObject = class _ServiceObject {
|
|
2053
|
-
constructor(
|
|
2054
|
-
assertObjectPathValid(
|
|
2055
|
-
this.path =
|
|
2053
|
+
constructor(path5, bus) {
|
|
2054
|
+
assertObjectPathValid(path5);
|
|
2055
|
+
this.path = path5;
|
|
2056
2056
|
this.bus = bus;
|
|
2057
2057
|
this.interfaces = {};
|
|
2058
2058
|
this._handlers = {};
|
|
@@ -8190,12 +8190,12 @@ var require_parser = __commonJS({
|
|
|
8190
8190
|
};
|
|
8191
8191
|
Parser.prototype.parseStringPromise = function(str) {
|
|
8192
8192
|
return new Promise(/* @__PURE__ */ (function(_this) {
|
|
8193
|
-
return function(
|
|
8193
|
+
return function(resolve3, reject) {
|
|
8194
8194
|
return _this.parseString(str, function(err, value) {
|
|
8195
8195
|
if (err) {
|
|
8196
8196
|
return reject(err);
|
|
8197
8197
|
} else {
|
|
8198
|
-
return
|
|
8198
|
+
return resolve3(value);
|
|
8199
8199
|
}
|
|
8200
8200
|
});
|
|
8201
8201
|
};
|
|
@@ -8459,12 +8459,12 @@ var require_proxy_object = __commonJS({
|
|
|
8459
8459
|
* Create a new `ProxyObject`. This constructor should not be called
|
|
8460
8460
|
* directly. Use {@link MessageBus#getProxyObject} to get a proxy object.
|
|
8461
8461
|
*/
|
|
8462
|
-
constructor(bus, name,
|
|
8462
|
+
constructor(bus, name, path5) {
|
|
8463
8463
|
assertBusNameValid(name);
|
|
8464
|
-
assertObjectPathValid(
|
|
8464
|
+
assertObjectPathValid(path5);
|
|
8465
8465
|
this.bus = bus;
|
|
8466
8466
|
this.name = name;
|
|
8467
|
-
this.path =
|
|
8467
|
+
this.path = path5;
|
|
8468
8468
|
this.nodes = [];
|
|
8469
8469
|
this.interfaces = {};
|
|
8470
8470
|
this._parser = new xml2js.Parser();
|
|
@@ -8492,9 +8492,9 @@ var require_proxy_object = __commonJS({
|
|
|
8492
8492
|
continue;
|
|
8493
8493
|
}
|
|
8494
8494
|
const name = n.$.name;
|
|
8495
|
-
const
|
|
8496
|
-
if (isObjectPathValid(
|
|
8497
|
-
this.nodes.push(
|
|
8495
|
+
const path5 = `${this.path}/${name}`;
|
|
8496
|
+
if (isObjectPathValid(path5)) {
|
|
8497
|
+
this.nodes.push(path5);
|
|
8498
8498
|
}
|
|
8499
8499
|
}
|
|
8500
8500
|
}
|
|
@@ -8508,7 +8508,7 @@ var require_proxy_object = __commonJS({
|
|
|
8508
8508
|
}
|
|
8509
8509
|
}
|
|
8510
8510
|
_init(xml) {
|
|
8511
|
-
return new Promise((
|
|
8511
|
+
return new Promise((resolve3, reject) => {
|
|
8512
8512
|
if (xml) {
|
|
8513
8513
|
this._parser.parseString(xml, (err, data) => {
|
|
8514
8514
|
if (err) {
|
|
@@ -8525,10 +8525,10 @@ var require_proxy_object = __commonJS({
|
|
|
8525
8525
|
});
|
|
8526
8526
|
this.bus.call(nameOwnerMessage).then((msg) => {
|
|
8527
8527
|
this.bus._nameOwners[this.name] = msg.body[0];
|
|
8528
|
-
|
|
8528
|
+
resolve3(this);
|
|
8529
8529
|
}).catch((err2) => {
|
|
8530
8530
|
if (err2.type === "org.freedesktop.DBus.Error.NameHasNoOwner") {
|
|
8531
|
-
return
|
|
8531
|
+
return resolve3(this);
|
|
8532
8532
|
}
|
|
8533
8533
|
return reject(err2);
|
|
8534
8534
|
});
|
|
@@ -8549,7 +8549,7 @@ var require_proxy_object = __commonJS({
|
|
|
8549
8549
|
return reject(err);
|
|
8550
8550
|
}
|
|
8551
8551
|
this._initXml(data);
|
|
8552
|
-
|
|
8552
|
+
resolve3(this);
|
|
8553
8553
|
});
|
|
8554
8554
|
}).catch((err) => {
|
|
8555
8555
|
return reject(err);
|
|
@@ -8558,7 +8558,7 @@ var require_proxy_object = __commonJS({
|
|
|
8558
8558
|
});
|
|
8559
8559
|
}
|
|
8560
8560
|
_callMethod(iface, member, inSignature, outSignature, ...args) {
|
|
8561
|
-
return new Promise((
|
|
8561
|
+
return new Promise((resolve3, reject) => {
|
|
8562
8562
|
args = args || [];
|
|
8563
8563
|
const methodCallMessage = new Message2({
|
|
8564
8564
|
destination: this.name,
|
|
@@ -8571,13 +8571,13 @@ var require_proxy_object = __commonJS({
|
|
|
8571
8571
|
this.bus.call(methodCallMessage).then((msg) => {
|
|
8572
8572
|
const outSignatureTree = parseSignature(outSignature);
|
|
8573
8573
|
if (outSignatureTree.length === 0) {
|
|
8574
|
-
|
|
8574
|
+
resolve3(null);
|
|
8575
8575
|
return;
|
|
8576
8576
|
}
|
|
8577
8577
|
if (outSignatureTree.length === 1) {
|
|
8578
|
-
|
|
8578
|
+
resolve3(msg.body[0]);
|
|
8579
8579
|
} else {
|
|
8580
|
-
|
|
8580
|
+
resolve3(msg.body);
|
|
8581
8581
|
}
|
|
8582
8582
|
}).catch((err) => {
|
|
8583
8583
|
return reject(err);
|
|
@@ -8594,7 +8594,7 @@ var require_bus = __commonJS({
|
|
|
8594
8594
|
"node_modules/dbus-next/lib/bus.js"(exports2, module2) {
|
|
8595
8595
|
"use strict";
|
|
8596
8596
|
var EventEmitter = require("events").EventEmitter;
|
|
8597
|
-
var
|
|
8597
|
+
var constants5 = require_constants();
|
|
8598
8598
|
var handleMethod = require_handlers();
|
|
8599
8599
|
var { DBusError } = require_errors();
|
|
8600
8600
|
var { Message: Message2 } = require_message_type();
|
|
@@ -8605,10 +8605,10 @@ var require_bus = __commonJS({
|
|
|
8605
8605
|
METHOD_RETURN,
|
|
8606
8606
|
ERROR,
|
|
8607
8607
|
SIGNAL
|
|
8608
|
-
} =
|
|
8608
|
+
} = constants5.MessageType;
|
|
8609
8609
|
var {
|
|
8610
8610
|
NO_REPLY_EXPECTED
|
|
8611
|
-
} =
|
|
8611
|
+
} = constants5.MessageFlag;
|
|
8612
8612
|
var {
|
|
8613
8613
|
assertBusNameValid,
|
|
8614
8614
|
assertObjectPathValid
|
|
@@ -8649,8 +8649,8 @@ var require_bus = __commonJS({
|
|
|
8649
8649
|
handler(msg);
|
|
8650
8650
|
}
|
|
8651
8651
|
} else if (msg.type === SIGNAL) {
|
|
8652
|
-
const { sender, path:
|
|
8653
|
-
if (sender === "org.freedesktop.DBus" &&
|
|
8652
|
+
const { sender, path: path5, iface, member } = msg;
|
|
8653
|
+
if (sender === "org.freedesktop.DBus" && path5 === "/org/freedesktop/DBus" && iface === "org.freedesktop.DBus" && member === "NameOwnerChanged") {
|
|
8654
8654
|
const name = msg.body[0];
|
|
8655
8655
|
const newOwner = msg.body[2];
|
|
8656
8656
|
if (!name.startsWith(":")) {
|
|
@@ -8720,8 +8720,8 @@ ${e.stack}`));
|
|
|
8720
8720
|
* @param [xml] {string} - xml introspection data.
|
|
8721
8721
|
* @returns {Promise} - a Promise that resolves with the `ProxyObject`.
|
|
8722
8722
|
*/
|
|
8723
|
-
getProxyObject(name,
|
|
8724
|
-
const obj = new ProxyObject(this, name,
|
|
8723
|
+
getProxyObject(name, path5, xml) {
|
|
8724
|
+
const obj = new ProxyObject(this, name, path5);
|
|
8725
8725
|
return obj._init(xml);
|
|
8726
8726
|
}
|
|
8727
8727
|
/**
|
|
@@ -8735,7 +8735,7 @@ ${e.stack}`));
|
|
|
8735
8735
|
*/
|
|
8736
8736
|
requestName(name, flags) {
|
|
8737
8737
|
flags = flags || 0;
|
|
8738
|
-
return new Promise((
|
|
8738
|
+
return new Promise((resolve3, reject) => {
|
|
8739
8739
|
assertBusNameValid(name);
|
|
8740
8740
|
const requestNameMessage = new Message2({
|
|
8741
8741
|
path: "/org/freedesktop/DBus",
|
|
@@ -8746,7 +8746,7 @@ ${e.stack}`));
|
|
|
8746
8746
|
body: [name, flags]
|
|
8747
8747
|
});
|
|
8748
8748
|
this.call(requestNameMessage).then((msg) => {
|
|
8749
|
-
return
|
|
8749
|
+
return resolve3(msg.body[0]);
|
|
8750
8750
|
}).catch((err) => {
|
|
8751
8751
|
return reject(err);
|
|
8752
8752
|
});
|
|
@@ -8759,7 +8759,7 @@ ${e.stack}`));
|
|
|
8759
8759
|
* @returns {Promise} A Promise that will resolve with the {@link ReleaseNameReply}.
|
|
8760
8760
|
*/
|
|
8761
8761
|
releaseName(name) {
|
|
8762
|
-
return new Promise((
|
|
8762
|
+
return new Promise((resolve3, reject) => {
|
|
8763
8763
|
const msg = new Message2({
|
|
8764
8764
|
path: "/org/freedesktop/DBus",
|
|
8765
8765
|
destination: "org.freedesktop.DBus",
|
|
@@ -8769,7 +8769,7 @@ ${e.stack}`));
|
|
|
8769
8769
|
body: [name]
|
|
8770
8770
|
});
|
|
8771
8771
|
this.call(msg).then((reply) => {
|
|
8772
|
-
return
|
|
8772
|
+
return resolve3(reply.body[0]);
|
|
8773
8773
|
}).catch((err) => {
|
|
8774
8774
|
return reject(err);
|
|
8775
8775
|
});
|
|
@@ -8843,7 +8843,7 @@ ${e.stack}`));
|
|
|
8843
8843
|
* Message} which is a reply to the call.
|
|
8844
8844
|
*/
|
|
8845
8845
|
call(msg) {
|
|
8846
|
-
return new Promise((
|
|
8846
|
+
return new Promise((resolve3, reject) => {
|
|
8847
8847
|
if (!(msg instanceof Message2)) {
|
|
8848
8848
|
throw new Error("The call() method takes a Message class as the first argument.");
|
|
8849
8849
|
}
|
|
@@ -8855,14 +8855,14 @@ ${e.stack}`));
|
|
|
8855
8855
|
}
|
|
8856
8856
|
msg._sent = true;
|
|
8857
8857
|
if (msg.flags & NO_REPLY_EXPECTED) {
|
|
8858
|
-
|
|
8858
|
+
resolve3(null);
|
|
8859
8859
|
} else {
|
|
8860
8860
|
this._methodReturnHandlers[msg.serial] = (reply) => {
|
|
8861
8861
|
this._nameOwners[msg.destination] = reply.sender;
|
|
8862
8862
|
if (reply.type === ERROR) {
|
|
8863
8863
|
return reject(new DBusError(reply.errorName, reply.body[0], reply));
|
|
8864
8864
|
} else {
|
|
8865
|
-
return
|
|
8865
|
+
return resolve3(reply);
|
|
8866
8866
|
}
|
|
8867
8867
|
};
|
|
8868
8868
|
}
|
|
@@ -8896,8 +8896,8 @@ ${e.stack}`));
|
|
|
8896
8896
|
* @param path {string} - The object path to export this `Interface` on.
|
|
8897
8897
|
* @param iface {module:interface~Interface} - The service interface to export.
|
|
8898
8898
|
*/
|
|
8899
|
-
export(
|
|
8900
|
-
const obj = this._getServiceObject(
|
|
8899
|
+
export(path5, iface) {
|
|
8900
|
+
const obj = this._getServiceObject(path5);
|
|
8901
8901
|
obj.addInterface(iface);
|
|
8902
8902
|
}
|
|
8903
8903
|
/**
|
|
@@ -8908,29 +8908,29 @@ ${e.stack}`));
|
|
|
8908
8908
|
* @param {module:interface~Interface} [iface] - The `Interface` to unexport.
|
|
8909
8909
|
* If not given, this will remove all interfaces on the path.
|
|
8910
8910
|
*/
|
|
8911
|
-
unexport(
|
|
8911
|
+
unexport(path5, iface) {
|
|
8912
8912
|
iface = iface || null;
|
|
8913
8913
|
if (iface === null) {
|
|
8914
|
-
this._removeServiceObject(
|
|
8914
|
+
this._removeServiceObject(path5);
|
|
8915
8915
|
} else {
|
|
8916
|
-
const obj = this._getServiceObject(
|
|
8916
|
+
const obj = this._getServiceObject(path5);
|
|
8917
8917
|
obj.removeInterface(iface);
|
|
8918
8918
|
if (!obj.interfaces.length) {
|
|
8919
|
-
this._removeServiceObject(
|
|
8919
|
+
this._removeServiceObject(path5);
|
|
8920
8920
|
}
|
|
8921
8921
|
}
|
|
8922
8922
|
}
|
|
8923
|
-
_introspect(
|
|
8924
|
-
assertObjectPathValid(
|
|
8923
|
+
_introspect(path5) {
|
|
8924
|
+
assertObjectPathValid(path5);
|
|
8925
8925
|
const xml = {
|
|
8926
8926
|
node: {
|
|
8927
8927
|
node: []
|
|
8928
8928
|
}
|
|
8929
8929
|
};
|
|
8930
|
-
if (this._serviceObjects[
|
|
8931
|
-
xml.node.interface = this._serviceObjects[
|
|
8930
|
+
if (this._serviceObjects[path5]) {
|
|
8931
|
+
xml.node.interface = this._serviceObjects[path5].introspect();
|
|
8932
8932
|
}
|
|
8933
|
-
const pathSplit =
|
|
8933
|
+
const pathSplit = path5.split("/").filter((n) => n);
|
|
8934
8934
|
const children2 = /* @__PURE__ */ new Set();
|
|
8935
8935
|
for (const key of Object.keys(this._serviceObjects)) {
|
|
8936
8936
|
const keySplit = key.split("/").filter((n) => n);
|
|
@@ -8950,21 +8950,21 @@ ${e.stack}`));
|
|
|
8950
8950
|
}
|
|
8951
8951
|
return xmlHeader + this._builder.buildObject(xml);
|
|
8952
8952
|
}
|
|
8953
|
-
_getServiceObject(
|
|
8954
|
-
assertObjectPathValid(
|
|
8955
|
-
if (!this._serviceObjects[
|
|
8956
|
-
this._serviceObjects[
|
|
8953
|
+
_getServiceObject(path5) {
|
|
8954
|
+
assertObjectPathValid(path5);
|
|
8955
|
+
if (!this._serviceObjects[path5]) {
|
|
8956
|
+
this._serviceObjects[path5] = new ServiceObject(path5, this);
|
|
8957
8957
|
}
|
|
8958
|
-
return this._serviceObjects[
|
|
8958
|
+
return this._serviceObjects[path5];
|
|
8959
8959
|
}
|
|
8960
|
-
_removeServiceObject(
|
|
8961
|
-
assertObjectPathValid(
|
|
8962
|
-
if (this._serviceObjects[
|
|
8963
|
-
const obj = this._serviceObjects[
|
|
8960
|
+
_removeServiceObject(path5) {
|
|
8961
|
+
assertObjectPathValid(path5);
|
|
8962
|
+
if (this._serviceObjects[path5]) {
|
|
8963
|
+
const obj = this._serviceObjects[path5];
|
|
8964
8964
|
for (const i of Object.keys(obj.interfaces)) {
|
|
8965
8965
|
obj.removeInterface(obj.interfaces[i]);
|
|
8966
8966
|
}
|
|
8967
|
-
delete this._serviceObjects[
|
|
8967
|
+
delete this._serviceObjects[path5];
|
|
8968
8968
|
}
|
|
8969
8969
|
}
|
|
8970
8970
|
_addMatch(match) {
|
|
@@ -10648,7 +10648,7 @@ var require_message = __commonJS({
|
|
|
10648
10648
|
"use strict";
|
|
10649
10649
|
var Buffer2 = require_safe_buffer().Buffer;
|
|
10650
10650
|
var marshall = require_marshall();
|
|
10651
|
-
var
|
|
10651
|
+
var constants5 = require_constants();
|
|
10652
10652
|
var DBusBuffer = require_dbus_buffer();
|
|
10653
10653
|
var headerSignature = require_header_signature();
|
|
10654
10654
|
module2.exports.unmarshalMessages = function messageParser(stream, onMessage, opts) {
|
|
@@ -10658,7 +10658,7 @@ var require_message = __commonJS({
|
|
|
10658
10658
|
let fieldsAndBodyLength = 0;
|
|
10659
10659
|
let bodyLength = 0;
|
|
10660
10660
|
let endian = 0;
|
|
10661
|
-
const LE =
|
|
10661
|
+
const LE = constants5.endianness.le;
|
|
10662
10662
|
stream.on("readable", function() {
|
|
10663
10663
|
while (1) {
|
|
10664
10664
|
if (state === 0) {
|
|
@@ -10689,7 +10689,7 @@ var require_message = __commonJS({
|
|
|
10689
10689
|
const message = {};
|
|
10690
10690
|
message.serial = endian === LE ? header.readUInt32LE(8) : header.readUInt32BE(8);
|
|
10691
10691
|
for (let i = 0; i < unmarshalledHeader.length; ++i) {
|
|
10692
|
-
headerName =
|
|
10692
|
+
headerName = constants5.headerTypeName[unmarshalledHeader[i][0]];
|
|
10693
10693
|
message[headerName] = unmarshalledHeader[i][1][1][0];
|
|
10694
10694
|
}
|
|
10695
10695
|
message.type = header[1];
|
|
@@ -10708,7 +10708,7 @@ var require_message = __commonJS({
|
|
|
10708
10708
|
const headers = msgBuf.read("yyyyuua(yv)");
|
|
10709
10709
|
const message = {};
|
|
10710
10710
|
for (let i = 0; i < headers[6].length; ++i) {
|
|
10711
|
-
const headerName =
|
|
10711
|
+
const headerName = constants5.headerTypeName[headers[6][i][0]];
|
|
10712
10712
|
message[headerName] = headers[6][i][1][1][0];
|
|
10713
10713
|
}
|
|
10714
10714
|
message.type = headers[1];
|
|
@@ -10721,7 +10721,7 @@ var require_message = __commonJS({
|
|
|
10721
10721
|
module2.exports.marshall = function marshallMessage(message) {
|
|
10722
10722
|
if (!message.serial) throw new Error("Missing or invalid serial");
|
|
10723
10723
|
const flags = message.flags || 0;
|
|
10724
|
-
const type = message.type ||
|
|
10724
|
+
const type = message.type || constants5.messageType.METHOD_CALL;
|
|
10725
10725
|
let bodyLength = 0;
|
|
10726
10726
|
let bodyBuff;
|
|
10727
10727
|
const fds = [];
|
|
@@ -10731,21 +10731,21 @@ var require_message = __commonJS({
|
|
|
10731
10731
|
message.unixFd = fds.length;
|
|
10732
10732
|
}
|
|
10733
10733
|
const header = [
|
|
10734
|
-
|
|
10734
|
+
constants5.endianness.le,
|
|
10735
10735
|
type,
|
|
10736
10736
|
flags,
|
|
10737
|
-
|
|
10737
|
+
constants5.protocolVersion,
|
|
10738
10738
|
bodyLength,
|
|
10739
10739
|
message.serial
|
|
10740
10740
|
];
|
|
10741
10741
|
const headerBuff = marshall("yyyyuu", header);
|
|
10742
10742
|
const fields = [];
|
|
10743
|
-
|
|
10743
|
+
constants5.headerTypeName.forEach(function(fieldName) {
|
|
10744
10744
|
const fieldVal = message[fieldName];
|
|
10745
10745
|
if (fieldVal) {
|
|
10746
10746
|
fields.push([
|
|
10747
|
-
|
|
10748
|
-
[
|
|
10747
|
+
constants5.headerTypeId[fieldName],
|
|
10748
|
+
[constants5.fieldSignature[fieldName], fieldVal]
|
|
10749
10749
|
]);
|
|
10750
10750
|
}
|
|
10751
10751
|
});
|
|
@@ -10795,13 +10795,13 @@ var require_handshake = __commonJS({
|
|
|
10795
10795
|
"node_modules/dbus-next/lib/handshake.js"(exports2, module2) {
|
|
10796
10796
|
"use strict";
|
|
10797
10797
|
var Buffer2 = require_safe_buffer().Buffer;
|
|
10798
|
-
var
|
|
10799
|
-
var
|
|
10800
|
-
var
|
|
10801
|
-
var
|
|
10798
|
+
var crypto5 = require("crypto");
|
|
10799
|
+
var fs6 = require("fs");
|
|
10800
|
+
var path5 = require("path");
|
|
10801
|
+
var constants5 = require_constants();
|
|
10802
10802
|
var readLine = require_readline();
|
|
10803
10803
|
function sha1(input) {
|
|
10804
|
-
const shasum =
|
|
10804
|
+
const shasum = crypto5.createHash("sha1");
|
|
10805
10805
|
shasum.update(input);
|
|
10806
10806
|
return shasum.digest("hex");
|
|
10807
10807
|
}
|
|
@@ -10809,26 +10809,26 @@ var require_handshake = __commonJS({
|
|
|
10809
10809
|
return process.env[process.platform.match(/$win/) ? "USERPROFILE" : "HOME"];
|
|
10810
10810
|
}
|
|
10811
10811
|
function getCookie(context, id, cb) {
|
|
10812
|
-
const dirname =
|
|
10812
|
+
const dirname = path5.join(getUserHome(), ".dbus-keyrings");
|
|
10813
10813
|
if (context.length === 0) context = "org_freedesktop_general";
|
|
10814
|
-
const filename =
|
|
10815
|
-
|
|
10814
|
+
const filename = path5.join(dirname, context);
|
|
10815
|
+
fs6.stat(dirname, function(err, stat4) {
|
|
10816
10816
|
if (err) return cb(err);
|
|
10817
|
-
if (
|
|
10817
|
+
if (stat4.mode & 18) {
|
|
10818
10818
|
return cb(
|
|
10819
10819
|
new Error(
|
|
10820
10820
|
"User keyrings directory is writeable by other users. Aborting authentication"
|
|
10821
10821
|
)
|
|
10822
10822
|
);
|
|
10823
10823
|
}
|
|
10824
|
-
if ("getuid" in process &&
|
|
10824
|
+
if ("getuid" in process && stat4.uid !== process.getuid()) {
|
|
10825
10825
|
return cb(
|
|
10826
10826
|
new Error(
|
|
10827
10827
|
"Keyrings directory is not owned by the current user. Aborting authentication!"
|
|
10828
10828
|
)
|
|
10829
10829
|
);
|
|
10830
10830
|
}
|
|
10831
|
-
|
|
10831
|
+
fs6.readFile(filename, "ascii", function(err2, keyrings) {
|
|
10832
10832
|
if (err2) return cb(err2);
|
|
10833
10833
|
const lines = keyrings.split("\n");
|
|
10834
10834
|
for (let l = 0; l < lines.length; ++l) {
|
|
@@ -10847,7 +10847,7 @@ var require_handshake = __commonJS({
|
|
|
10847
10847
|
if (opts.authMethods) {
|
|
10848
10848
|
authMethods = opts.authMethods;
|
|
10849
10849
|
} else {
|
|
10850
|
-
authMethods =
|
|
10850
|
+
authMethods = constants5.defaultAuthMethods;
|
|
10851
10851
|
}
|
|
10852
10852
|
stream.write("\0");
|
|
10853
10853
|
tryAuth(stream, authMethods.slice(), cb);
|
|
@@ -10911,7 +10911,7 @@ var require_handshake = __commonJS({
|
|
|
10911
10911
|
const cookieContext = data[0];
|
|
10912
10912
|
const cookieId = data[1];
|
|
10913
10913
|
const serverChallenge = data[2];
|
|
10914
|
-
const clientChallenge =
|
|
10914
|
+
const clientChallenge = crypto5.randomBytes(16).toString("hex");
|
|
10915
10915
|
getCookie(cookieContext, cookieId, function(err, cookie) {
|
|
10916
10916
|
if (err) return cb(err);
|
|
10917
10917
|
const response = sha1(
|
|
@@ -10941,14 +10941,14 @@ var require_handshake = __commonJS({
|
|
|
10941
10941
|
var require_address_x11 = __commonJS({
|
|
10942
10942
|
"node_modules/dbus-next/lib/address-x11.js"(exports2, module2) {
|
|
10943
10943
|
"use strict";
|
|
10944
|
-
var
|
|
10944
|
+
var fs6 = require("fs");
|
|
10945
10945
|
var os = require("os");
|
|
10946
10946
|
function getDbusAddressFromWindowSelection(callback) {
|
|
10947
10947
|
const x11 = require("x11");
|
|
10948
10948
|
if (x11 === null) {
|
|
10949
10949
|
throw new Error("cannot get session bus address from window selection: dbus-next was installed without x11 support");
|
|
10950
10950
|
}
|
|
10951
|
-
|
|
10951
|
+
fs6.readFile("/var/lib/dbus/machine-id", "ascii", function(err, uuid2) {
|
|
10952
10952
|
if (err) return callback(err);
|
|
10953
10953
|
const hostname = os.hostname().split("-")[0];
|
|
10954
10954
|
x11.createClient(function(err2, display) {
|
|
@@ -10984,8 +10984,8 @@ var require_address_x11 = __commonJS({
|
|
|
10984
10984
|
throw new Error("could not parse DISPLAY environment variable to get dbus address");
|
|
10985
10985
|
}
|
|
10986
10986
|
const displayNum = match[1];
|
|
10987
|
-
const machineId =
|
|
10988
|
-
const dbusInfo =
|
|
10987
|
+
const machineId = fs6.readFileSync("/var/lib/dbus/machine-id").toString().trim();
|
|
10988
|
+
const dbusInfo = fs6.readFileSync(`${home}/.dbus/session-bus/${machineId}-${displayNum}`).toString().trim();
|
|
10989
10989
|
for (let line of dbusInfo.split("\n")) {
|
|
10990
10990
|
line = line.trim();
|
|
10991
10991
|
if (line.startsWith("DBUS_SESSION_BUS_ADDRESS=")) {
|
|
@@ -11971,7 +11971,7 @@ var require_connection = __commonJS({
|
|
|
11971
11971
|
var require_dbus_next = __commonJS({
|
|
11972
11972
|
"node_modules/dbus-next/index.js"(exports2, module2) {
|
|
11973
11973
|
"use strict";
|
|
11974
|
-
var
|
|
11974
|
+
var constants5 = require_constants();
|
|
11975
11975
|
var MessageBus = require_bus();
|
|
11976
11976
|
var errors = require_errors();
|
|
11977
11977
|
var { Variant: Variant2 } = require_variant();
|
|
@@ -11994,11 +11994,11 @@ var require_dbus_next = __commonJS({
|
|
|
11994
11994
|
return createClient(opts);
|
|
11995
11995
|
};
|
|
11996
11996
|
module2.exports.setBigIntCompat = require_library_options().setBigIntCompat;
|
|
11997
|
-
module2.exports.NameFlag =
|
|
11998
|
-
module2.exports.RequestNameReply =
|
|
11999
|
-
module2.exports.ReleaseNameReply =
|
|
12000
|
-
module2.exports.MessageType =
|
|
12001
|
-
module2.exports.MessageFlag =
|
|
11997
|
+
module2.exports.NameFlag = constants5.NameFlag;
|
|
11998
|
+
module2.exports.RequestNameReply = constants5.RequestNameReply;
|
|
11999
|
+
module2.exports.ReleaseNameReply = constants5.ReleaseNameReply;
|
|
12000
|
+
module2.exports.MessageType = constants5.MessageType;
|
|
12001
|
+
module2.exports.MessageFlag = constants5.MessageFlag;
|
|
12002
12002
|
module2.exports.interface = iface;
|
|
12003
12003
|
module2.exports.Variant = Variant2;
|
|
12004
12004
|
module2.exports.Message = Message2;
|
|
@@ -12020,7 +12020,7 @@ __export(runtime_exports, {
|
|
|
12020
12020
|
module.exports = __toCommonJS(runtime_exports);
|
|
12021
12021
|
|
|
12022
12022
|
// src/client.ts
|
|
12023
|
-
var
|
|
12023
|
+
var crypto4 = __toESM(require("crypto"), 1);
|
|
12024
12024
|
|
|
12025
12025
|
// src/errors.ts
|
|
12026
12026
|
var util = __toESM(require("util"), 1);
|
|
@@ -12119,23 +12119,23 @@ var ObservationHub = class {
|
|
|
12119
12119
|
/** Entries exist only while a caller is waiting on a unit. */
|
|
12120
12120
|
groups = /* @__PURE__ */ new Map();
|
|
12121
12121
|
/** Wake one task, or every task after manager disconnection. */
|
|
12122
|
-
notify(
|
|
12122
|
+
notify(unitName2) {
|
|
12123
12123
|
for (const [name, group] of this.groups) {
|
|
12124
|
-
if (
|
|
12124
|
+
if (unitName2 !== void 0 && unitName2 !== name) continue;
|
|
12125
12125
|
group.generation++;
|
|
12126
12126
|
for (const callback of [...group.callbacks]) callback();
|
|
12127
12127
|
}
|
|
12128
12128
|
}
|
|
12129
12129
|
/** Subscribe before the first snapshot, then compare generations before sleeping. */
|
|
12130
|
-
watch(
|
|
12131
|
-
let group = this.groups.get(
|
|
12130
|
+
watch(unitName2) {
|
|
12131
|
+
let group = this.groups.get(unitName2);
|
|
12132
12132
|
if (!group) {
|
|
12133
12133
|
group = { generation: 0, callbacks: /* @__PURE__ */ new Set(), users: 0, timer: setInterval(
|
|
12134
12134
|
/** Reconcile snapshots even if systemd notifications are missed. */
|
|
12135
|
-
() => this.notify(
|
|
12135
|
+
() => this.notify(unitName2),
|
|
12136
12136
|
1e3
|
|
12137
12137
|
) };
|
|
12138
|
-
this.groups.set(
|
|
12138
|
+
this.groups.set(unitName2, group);
|
|
12139
12139
|
}
|
|
12140
12140
|
const state = group;
|
|
12141
12141
|
state.users++;
|
|
@@ -12149,12 +12149,12 @@ var ObservationHub = class {
|
|
|
12149
12149
|
if (closed || version2 !== state.generation) return;
|
|
12150
12150
|
await new Promise(
|
|
12151
12151
|
/** Retain a single wake callback for this observer. */
|
|
12152
|
-
(
|
|
12152
|
+
(resolve3) => {
|
|
12153
12153
|
pending = /** Remove this wake callback before resolving the observer. */
|
|
12154
12154
|
() => {
|
|
12155
12155
|
if (pending) state.callbacks.delete(pending);
|
|
12156
12156
|
pending = void 0;
|
|
12157
|
-
|
|
12157
|
+
resolve3();
|
|
12158
12158
|
};
|
|
12159
12159
|
state.callbacks.add(pending);
|
|
12160
12160
|
}
|
|
@@ -12168,7 +12168,7 @@ var ObservationHub = class {
|
|
|
12168
12168
|
state.users--;
|
|
12169
12169
|
if (state.users === 0) {
|
|
12170
12170
|
clearInterval(state.timer);
|
|
12171
|
-
this.groups.delete(
|
|
12171
|
+
this.groups.delete(unitName2);
|
|
12172
12172
|
}
|
|
12173
12173
|
}
|
|
12174
12174
|
};
|
|
@@ -12230,7 +12230,7 @@ var ClientCore = class {
|
|
|
12230
12230
|
this.diagnostics = sink;
|
|
12231
12231
|
this.unsubscribe = adapter.onChange(
|
|
12232
12232
|
/** Směruje všechny relevantní unit změny do společného hubu. */
|
|
12233
|
-
(
|
|
12233
|
+
(unitName2) => this.hub.notify(unitName2)
|
|
12234
12234
|
);
|
|
12235
12235
|
}
|
|
12236
12236
|
/** Odmítne operaci před jakýmkoliv manager I/O, pokud už klient skončil. */
|
|
@@ -12371,8 +12371,8 @@ var Diagnostics = class {
|
|
|
12371
12371
|
// src/io.ts
|
|
12372
12372
|
var fs = __toESM(require("fs"), 1);
|
|
12373
12373
|
function fileIdentity(fd) {
|
|
12374
|
-
const
|
|
12375
|
-
return `${
|
|
12374
|
+
const stat4 = fs.fstatSync(fd, { bigint: true });
|
|
12375
|
+
return `${stat4.dev}:${stat4.ino}`;
|
|
12376
12376
|
}
|
|
12377
12377
|
function openIO(io) {
|
|
12378
12378
|
const owned = /* @__PURE__ */ new Set();
|
|
@@ -12433,233 +12433,8 @@ function openIO(io) {
|
|
|
12433
12433
|
}
|
|
12434
12434
|
}
|
|
12435
12435
|
|
|
12436
|
-
// src/observed-
|
|
12437
|
-
var
|
|
12438
|
-
var version = 1;
|
|
12439
|
-
var headerBytes = 10;
|
|
12440
|
-
var maximumPayloadBytes = 64 * 1024;
|
|
12441
|
-
var kind = Object.freeze({ ready: 1, stdout: 2, stderr: 3, complete: 4 });
|
|
12442
|
-
|
|
12443
|
-
// src/observed-protocol.ts
|
|
12444
|
-
var receiveBudgetBytes = 256 * 1024;
|
|
12445
|
-
function observationError(error, reason = "observer-transport") {
|
|
12446
|
-
if (error instanceof TaskError) return error;
|
|
12447
|
-
const code = errorCode(error);
|
|
12448
|
-
if (code === "ERR_FDX_PLATFORM" || code === "ERR_FDX_ABI" || code === "ERR_FDX_BINARY_MISSING") {
|
|
12449
|
-
return new TaskError("UNSUPPORTED_ENVIRONMENT", "The installed Unix socket transport does not support observed tasks.", { reason: code }, error);
|
|
12450
|
-
}
|
|
12451
|
-
return new TaskError("OBSERVATION_FAILED", "The observed output connection failed.", { reason }, error);
|
|
12452
|
-
}
|
|
12453
|
-
var OutputObservation = class {
|
|
12454
|
-
/** Veřejný terminal promise zůstává stejný pro všechny callery. */
|
|
12455
|
-
completion;
|
|
12456
|
-
/** Settluje public completion nezávisle na případně visícím application callbacku. */
|
|
12457
|
-
completionResolve;
|
|
12458
|
-
/** Propaguje jedinou redigovanou observation chybu do public completion. */
|
|
12459
|
-
completionReject;
|
|
12460
|
-
/** Package-owned bounded socket po úspěšné adopci. */
|
|
12461
|
-
socket;
|
|
12462
|
-
/** Callback se volá sekvenčně a jeho promise je skutečný backpressure. */
|
|
12463
|
-
onOutput;
|
|
12464
|
-
/** Odstraní handle ze společného client bookkeeping po libovolném settlementu. */
|
|
12465
|
-
onTerminal;
|
|
12466
|
-
/** Start čeká na jediný validní ready frame odděleně od celého output lifecycle. */
|
|
12467
|
-
ready;
|
|
12468
|
-
/** Settluje readiness právě jednou. */
|
|
12469
|
-
readyResolve;
|
|
12470
|
-
/** Propaguje pre-ready protocol nebo detach chybu do startObserved. */
|
|
12471
|
-
readyReject;
|
|
12472
|
-
/** Brání dvojímu settlementu readiness promise. */
|
|
12473
|
-
readySettled = false;
|
|
12474
|
-
/** Explicitní public detach se hlásí jako úspěšný lokální outcome. */
|
|
12475
|
-
detached = false;
|
|
12476
|
-
/** Interní start/protocol chyba má přednost před destroy error z native socketu. */
|
|
12477
|
-
forcedFailure;
|
|
12478
|
-
/** Terminal observation ignoruje pozdější detach nebo abort. */
|
|
12479
|
-
terminal = false;
|
|
12480
|
-
/** Spustí pull pump okamžitě, aby guardian readiness nemohla uváznout na bufferu. */
|
|
12481
|
-
constructor(socket, onOutput, onTerminal) {
|
|
12482
|
-
this.socket = socket;
|
|
12483
|
-
this.onOutput = onOutput;
|
|
12484
|
-
this.onTerminal = onTerminal;
|
|
12485
|
-
this.ready = new Promise(
|
|
12486
|
-
/** Uchová jednorázové readiness settlement funkce. */
|
|
12487
|
-
(resolve2, reject) => {
|
|
12488
|
-
this.readyResolve = resolve2;
|
|
12489
|
-
this.readyReject = reject;
|
|
12490
|
-
}
|
|
12491
|
-
);
|
|
12492
|
-
void this.ready.catch(
|
|
12493
|
-
/** Interní readiness může selhat dřív, než start boundary připojí waiter. */
|
|
12494
|
-
() => {
|
|
12495
|
-
}
|
|
12496
|
-
);
|
|
12497
|
-
this.completion = new Promise(
|
|
12498
|
-
/** Lokální detach nesmí čekat na settlement cizího callback promise. */
|
|
12499
|
-
(resolve2, reject) => {
|
|
12500
|
-
this.completionResolve = resolve2;
|
|
12501
|
-
this.completionReject = reject;
|
|
12502
|
-
}
|
|
12503
|
-
);
|
|
12504
|
-
void this.completion.catch(
|
|
12505
|
-
/** Caller smí completion připojit později bez unhandled-rejection závodu. */
|
|
12506
|
-
() => {
|
|
12507
|
-
}
|
|
12508
|
-
);
|
|
12509
|
-
void this.pump();
|
|
12510
|
-
}
|
|
12511
|
-
/** Přečte exact frame a odmítne neznámou verzi, ancillary FD i oversized payload. */
|
|
12512
|
-
async readFrame() {
|
|
12513
|
-
const header = await this.socket.read({ bytes: headerBytes, fdCount: 0 });
|
|
12514
|
-
if (header === null) return null;
|
|
12515
|
-
if (this.socket.stats.bufferedReceiveFds !== 0 || !header.data.subarray(0, 4).equals(magic) || header.data[4] !== version) throw new TaskError("OBSERVATION_FAILED", "The guardian sent an invalid protocol header.", { reason: "guardian-frame-header" });
|
|
12516
|
-
const frameKind = header.data[5];
|
|
12517
|
-
if (!Object.values(kind).includes(frameKind)) throw new TaskError("OBSERVATION_FAILED", "The guardian sent an unknown frame kind.", { reason: "guardian-frame-kind" });
|
|
12518
|
-
const length = header.data.readUInt32BE(6);
|
|
12519
|
-
if (length > maximumPayloadBytes) throw new TaskError("OBSERVATION_FAILED", "The guardian frame exceeds the protocol limit.", { reason: "guardian-frame-limit" });
|
|
12520
|
-
const payload = length === 0 ? Buffer.alloc(0) : (await this.socket.read({ bytes: length, fdCount: 0 }))?.data;
|
|
12521
|
-
if (!payload || this.socket.stats.bufferedReceiveFds !== 0) throw new TaskError("OBSERVATION_FAILED", "The guardian stream ended inside a frame.", { reason: "guardian-frame-truncated" });
|
|
12522
|
-
return Object.freeze({ kind: frameKind, payload: Buffer.from(payload) });
|
|
12523
|
-
}
|
|
12524
|
-
/** Settluje readiness jen jednou a zachová původní chybu pro start boundary. */
|
|
12525
|
-
settleReady(error) {
|
|
12526
|
-
if (this.readySettled) return;
|
|
12527
|
-
this.readySettled = true;
|
|
12528
|
-
if (error) this.readyReject(error);
|
|
12529
|
-
else this.readyResolve();
|
|
12530
|
-
}
|
|
12531
|
-
/** Settluje public observation a client bookkeeping právě jednou. */
|
|
12532
|
-
settleCompletion(outcome, error) {
|
|
12533
|
-
if (this.terminal) return;
|
|
12534
|
-
this.terminal = true;
|
|
12535
|
-
if (error) this.completionReject(error);
|
|
12536
|
-
else this.completionResolve(outcome);
|
|
12537
|
-
try {
|
|
12538
|
-
this.onTerminal();
|
|
12539
|
-
} catch {
|
|
12540
|
-
}
|
|
12541
|
-
}
|
|
12542
|
-
/** Vynutí ready→data*→complete→EOF pořadí a sekvenční callback backpressure. */
|
|
12543
|
-
async pump() {
|
|
12544
|
-
try {
|
|
12545
|
-
const ready = await this.readFrame();
|
|
12546
|
-
if (ready === null || ready.kind !== kind.ready || ready.payload.byteLength !== 0) throw new TaskError("OBSERVATION_FAILED", "The guardian did not begin with an empty ready frame.", { reason: "guardian-ready-order" });
|
|
12547
|
-
this.settleReady();
|
|
12548
|
-
for (; ; ) {
|
|
12549
|
-
const frame = await this.readFrame();
|
|
12550
|
-
if (frame === null) throw new TaskError("OBSERVATION_FAILED", "The guardian ended before the complete frame.", { reason: "guardian-unexpected-eof" });
|
|
12551
|
-
if (frame.kind === kind.ready) throw new TaskError("OBSERVATION_FAILED", "The guardian repeated its ready frame.", { reason: "guardian-frame-order" });
|
|
12552
|
-
if (frame.kind === kind.complete) {
|
|
12553
|
-
if (frame.payload.byteLength !== 0) throw new TaskError("OBSERVATION_FAILED", "The guardian complete frame carried data.", { reason: "guardian-frame-order" });
|
|
12554
|
-
const trailing = await this.socket.read({ bytes: 1, fdCount: 0 });
|
|
12555
|
-
if (trailing !== null || this.socket.stats.bufferedReceiveFds !== 0) throw new TaskError("OBSERVATION_FAILED", "The guardian sent trailing protocol data.", { reason: "guardian-trailing-data" });
|
|
12556
|
-
this.socket.destroy();
|
|
12557
|
-
this.settleCompletion(Object.freeze({ outcome: "complete" }));
|
|
12558
|
-
return;
|
|
12559
|
-
}
|
|
12560
|
-
if (frame.kind !== kind.stdout && frame.kind !== kind.stderr || frame.payload.byteLength === 0) throw new TaskError("OBSERVATION_FAILED", "The guardian sent an invalid output frame.", { reason: "guardian-frame-order" });
|
|
12561
|
-
try {
|
|
12562
|
-
await this.onOutput(Object.freeze({ stream: frame.kind === kind.stdout ? "stdout" : "stderr", data: Buffer.from(frame.payload) }));
|
|
12563
|
-
} catch (error) {
|
|
12564
|
-
throw new TaskError("OBSERVATION_FAILED", "The observed output callback failed.", { reason: "output-callback" }, error);
|
|
12565
|
-
}
|
|
12566
|
-
}
|
|
12567
|
-
} catch (error) {
|
|
12568
|
-
if (this.detached && !this.forcedFailure) return;
|
|
12569
|
-
const reported = this.forcedFailure ?? observationError(error);
|
|
12570
|
-
this.settleReady(reported);
|
|
12571
|
-
this.socket.destroy();
|
|
12572
|
-
this.settleCompletion(void 0, reported);
|
|
12573
|
-
}
|
|
12574
|
-
}
|
|
12575
|
-
/** Čeká na readiness v pevném budgetu a timeout převádí na terminal observation failure. */
|
|
12576
|
-
async waitReady(timeoutMs) {
|
|
12577
|
-
let timer;
|
|
12578
|
-
const timeout = new Promise(
|
|
12579
|
-
/** Readiness timeout není task runtime timeout ani stop request. */
|
|
12580
|
-
(_resolve, reject) => {
|
|
12581
|
-
timer = setTimeout(
|
|
12582
|
-
/** Odpojí jen lokální peer; přijatý guardian přejde do drain režimu. */
|
|
12583
|
-
() => reject(new TaskError("OBSERVATION_FAILED", "The guardian readiness deadline expired.", { reason: "guardian-readiness-timeout" })),
|
|
12584
|
-
timeoutMs
|
|
12585
|
-
);
|
|
12586
|
-
}
|
|
12587
|
-
);
|
|
12588
|
-
try {
|
|
12589
|
-
await Promise.race([this.ready, timeout]);
|
|
12590
|
-
} catch (error) {
|
|
12591
|
-
const reported = observationError(error, "guardian-readiness");
|
|
12592
|
-
await this.abort(reported);
|
|
12593
|
-
throw reported;
|
|
12594
|
-
} finally {
|
|
12595
|
-
clearTimeout(timer);
|
|
12596
|
-
}
|
|
12597
|
-
}
|
|
12598
|
-
/** Interní start chyba ukončí observation jako failure, nikoliv user-requested detach. */
|
|
12599
|
-
async abort(error) {
|
|
12600
|
-
if (this.terminal) return;
|
|
12601
|
-
this.forcedFailure = error;
|
|
12602
|
-
this.settleReady(error);
|
|
12603
|
-
this.socket.destroy();
|
|
12604
|
-
this.settleCompletion(void 0, error);
|
|
12605
|
-
}
|
|
12606
|
-
/** Explicitní detach zavře lokální socket bez čekání na případně visící application callback. */
|
|
12607
|
-
async detach() {
|
|
12608
|
-
if (this.terminal) return;
|
|
12609
|
-
this.detached = true;
|
|
12610
|
-
this.settleReady(new TaskError("OBSERVATION_FAILED", "The output observation detached before guardian readiness.", { reason: "detached-before-ready" }));
|
|
12611
|
-
this.socket.destroy();
|
|
12612
|
-
this.settleCompletion(Object.freeze({ outcome: "detached" }));
|
|
12613
|
-
}
|
|
12614
|
-
};
|
|
12615
|
-
async function loadFdx() {
|
|
12616
|
-
return await import("usocket");
|
|
12617
|
-
}
|
|
12618
|
-
function prepareSocketsWithRuntime(socketFdx, options, onTerminal) {
|
|
12619
|
-
const owned = [];
|
|
12620
|
-
let adopted;
|
|
12621
|
-
try {
|
|
12622
|
-
const stdout = socketFdx.socketPair();
|
|
12623
|
-
owned.push(...stdout);
|
|
12624
|
-
const stderr = socketFdx.socketPair();
|
|
12625
|
-
owned.push(...stderr);
|
|
12626
|
-
const observer = socketFdx.socketPair();
|
|
12627
|
-
owned.push(...observer);
|
|
12628
|
-
adopted = socketFdx.adoptSocket({ descriptor: observer[0], limits: { receiveBytes: receiveBudgetBytes, receiveFds: 1, readOperations: 2 } });
|
|
12629
|
-
const observation = new OutputObservation(adopted, options.onOutput, onTerminal);
|
|
12630
|
-
let closed = false;
|
|
12631
|
-
return Object.freeze({
|
|
12632
|
-
descriptors: Object.freeze({
|
|
12633
|
-
taskStdout: stdout[0].fd,
|
|
12634
|
-
guardianStdout: stdout[1].fd,
|
|
12635
|
-
taskStderr: stderr[0].fd,
|
|
12636
|
-
guardianStderr: stderr[1].fd,
|
|
12637
|
-
guardianObserver: observer[1].fd
|
|
12638
|
-
}),
|
|
12639
|
-
observation,
|
|
12640
|
-
closeSubmitted: () => {
|
|
12641
|
-
if (closed) return;
|
|
12642
|
-
closed = true;
|
|
12643
|
-
for (const descriptor of owned) descriptor.close();
|
|
12644
|
-
}
|
|
12645
|
-
});
|
|
12646
|
-
} catch (error) {
|
|
12647
|
-
adopted?.destroy();
|
|
12648
|
-
for (const descriptor of owned) descriptor.close();
|
|
12649
|
-
throw observationError(error, "socket-setup");
|
|
12650
|
-
}
|
|
12651
|
-
}
|
|
12652
|
-
async function prepareSockets(options, onTerminal) {
|
|
12653
|
-
return prepareSocketsWithRuntime(await loadFdx(), options, onTerminal);
|
|
12654
|
-
}
|
|
12655
|
-
function validateStartOptions(value) {
|
|
12656
|
-
if (typeof value !== "object" || value === null || Array.isArray(value) || Object.getPrototypeOf(value) !== Object.prototype) throw new TaskError("INVALID_INPUT", "The observed start options are invalid.", { reason: "observed-start-options", mutationOutcome: "not-submitted" });
|
|
12657
|
-
const source = value;
|
|
12658
|
-
if (Object.keys(source).length !== 1 || typeof source.onOutput !== "function" || Object.getOwnPropertySymbols(source).length !== 0) throw new TaskError("INVALID_INPUT", "The observed start options are invalid.", { reason: "observed-start-options", mutationOutcome: "not-submitted" });
|
|
12659
|
-
return Object.freeze({ onOutput: source.onOutput });
|
|
12660
|
-
}
|
|
12661
|
-
|
|
12662
|
-
// src/observed-systemd.ts
|
|
12436
|
+
// src/observed-finalization.ts
|
|
12437
|
+
var crypto3 = __toESM(require("crypto"), 1);
|
|
12663
12438
|
var fs3 = __toESM(require("fs/promises"), 1);
|
|
12664
12439
|
var path3 = __toESM(require("path"), 1);
|
|
12665
12440
|
|
|
@@ -13168,32 +12943,347 @@ async function snapshot(identity3, manager, pair, readPopulation = cgroupPopulat
|
|
|
13168
12943
|
return Object.freeze({ reference: captured, identity: captured.invocationId && captured.retentionInvocationId ? "complete" : "incomplete", phase, ...process2 });
|
|
13169
12944
|
}
|
|
13170
12945
|
|
|
12946
|
+
// src/observed-finalization.ts
|
|
12947
|
+
var maximumBootstrapBytes = maximumObservedInputBytes * 2;
|
|
12948
|
+
function requireCompleteReference(value) {
|
|
12949
|
+
const reference3 = validateObservedReference(value);
|
|
12950
|
+
if (!reference3.invocationId || !reference3.retentionInvocationId || !reference3.guardianInvocationId) {
|
|
12951
|
+
invalid("finalization-reference-incomplete");
|
|
12952
|
+
}
|
|
12953
|
+
return reference3;
|
|
12954
|
+
}
|
|
12955
|
+
function prepare2(reference3, value) {
|
|
12956
|
+
const source = record(value, "finalization-options");
|
|
12957
|
+
keys(source, ["afterRelease", "timeoutMs"], "finalization-option-keys");
|
|
12958
|
+
return Object.freeze({
|
|
12959
|
+
reference: requireCompleteReference(reference3),
|
|
12960
|
+
timeoutMs: duration(source.timeoutMs, maximumLocalTimeoutMs, "finalization-timeout"),
|
|
12961
|
+
afterRelease: normalizeSpec(source.afterRelease)
|
|
12962
|
+
});
|
|
12963
|
+
}
|
|
12964
|
+
function unitName(reference3) {
|
|
12965
|
+
return reference3.unitName.replace(/\.service$/u, "-finalizer.service");
|
|
12966
|
+
}
|
|
12967
|
+
function marker3(bootstrap) {
|
|
12968
|
+
const fingerprint2 = crypto3.createHash("sha256").update(JSON.stringify(bootstrap)).digest("hex");
|
|
12969
|
+
return `@primafuture/systemd-tasks:observed-finalizer:v1:${bootstrap.reference.id}:${fingerprint2}`;
|
|
12970
|
+
}
|
|
12971
|
+
function assertRegistered(bootstrap, unit) {
|
|
12972
|
+
const properties2 = unit.properties;
|
|
12973
|
+
if (properties2.Transient !== true || properties2.Description !== marker3(bootstrap) || properties2.Type !== "exec" || properties2.ExitType !== "main" || properties2.Restart !== "no" || properties2.KillMode !== "control-group" || properties2.RemainAfterExit !== false || properties2.CollectMode !== "inactive-or-failed") {
|
|
12974
|
+
throw new TaskError("IDENTITY_CONFLICT", "The finalizer is not the registered owned instance.", {
|
|
12975
|
+
reason: "finalizer-ownership",
|
|
12976
|
+
taskId: bootstrap.reference.id
|
|
12977
|
+
});
|
|
12978
|
+
}
|
|
12979
|
+
if (properties2.ActiveState === "failed") {
|
|
12980
|
+
throw new TaskError("RESULT_UNAVAILABLE", "The registered finalizer failed.", {
|
|
12981
|
+
reason: "finalizer-failed",
|
|
12982
|
+
taskId: bootstrap.reference.id
|
|
12983
|
+
});
|
|
12984
|
+
}
|
|
12985
|
+
}
|
|
12986
|
+
async function executablePath() {
|
|
12987
|
+
const directory = typeof __systemdTasksRuntimeDirectory === "string" ? __systemdTasksRuntimeDirectory : path3.resolve(process.cwd(), "src");
|
|
12988
|
+
const executable = path3.basename(directory) === "src" ? path3.resolve(directory, "..", "dist", "finalizer.mjs") : path3.join(directory, "finalizer.mjs");
|
|
12989
|
+
try {
|
|
12990
|
+
const stat4 = await fs3.stat(executable);
|
|
12991
|
+
if (!stat4.isFile()) {
|
|
12992
|
+
throw new Error("Finalizer is not a regular file.");
|
|
12993
|
+
}
|
|
12994
|
+
await fs3.access(executable, fs3.constants.R_OK);
|
|
12995
|
+
} catch (error) {
|
|
12996
|
+
throw new TaskError("UNSUPPORTED_ENVIRONMENT", "The packaged finalizer is unavailable.", {
|
|
12997
|
+
reason: "finalizer-unavailable"
|
|
12998
|
+
}, error);
|
|
12999
|
+
}
|
|
13000
|
+
return executable;
|
|
13001
|
+
}
|
|
13002
|
+
async function creationProperties2(bootstrap, inheritedEnvironment) {
|
|
13003
|
+
const input = Buffer.from(JSON.stringify(bootstrap), "utf8");
|
|
13004
|
+
if (input.byteLength > maximumBootstrapBytes) {
|
|
13005
|
+
invalid("finalization-bootstrap-limit");
|
|
13006
|
+
}
|
|
13007
|
+
const executable = await executablePath();
|
|
13008
|
+
const properties2 = [
|
|
13009
|
+
property("Description", "s", marker3(bootstrap)),
|
|
13010
|
+
property("Type", "s", "exec"),
|
|
13011
|
+
property("ExitType", "s", "main"),
|
|
13012
|
+
property("Restart", "s", "no"),
|
|
13013
|
+
property("RemainAfterExit", "b", false),
|
|
13014
|
+
property("CollectMode", "s", "inactive-or-failed"),
|
|
13015
|
+
property("KillMode", "s", "control-group"),
|
|
13016
|
+
property("TimeoutStopUSec", "t", BigInt(bootstrap.afterRelease.spec.stopGraceMs) * 1000n),
|
|
13017
|
+
property("RuntimeMaxUSec", "t", infinityUsec),
|
|
13018
|
+
property("WorkingDirectory", "s", "/"),
|
|
13019
|
+
property("Environment", "as", []),
|
|
13020
|
+
property("UnsetEnvironment", "as", unsetEnvironment(inheritedEnvironment)),
|
|
13021
|
+
property("ExecStartEx", "a(sasas)", [[process.execPath, [process.execPath, executable], ["no-env-expand"]]]),
|
|
13022
|
+
property("StandardInput", "s", "data"),
|
|
13023
|
+
property("StandardInputData", "ay", input),
|
|
13024
|
+
property("StandardOutput", "s", "null"),
|
|
13025
|
+
property("StandardError", "s", "journal")
|
|
13026
|
+
];
|
|
13027
|
+
for (const resource of bootstrap.afterRelease.spec.systemdProperties ?? []) {
|
|
13028
|
+
properties2.push(property(resource.name, resource.signature, BigInt(resource.value)));
|
|
13029
|
+
}
|
|
13030
|
+
return Object.freeze(properties2);
|
|
13031
|
+
}
|
|
13032
|
+
|
|
13033
|
+
// src/observed-framing.ts
|
|
13034
|
+
var magic = Buffer.from("SDTO", "ascii");
|
|
13035
|
+
var version = 1;
|
|
13036
|
+
var headerBytes = 10;
|
|
13037
|
+
var maximumPayloadBytes = 64 * 1024;
|
|
13038
|
+
var kind = Object.freeze({ ready: 1, stdout: 2, stderr: 3, complete: 4 });
|
|
13039
|
+
|
|
13040
|
+
// src/observed-protocol.ts
|
|
13041
|
+
var receiveBudgetBytes = 256 * 1024;
|
|
13042
|
+
function observationError(error, reason = "observer-transport") {
|
|
13043
|
+
if (error instanceof TaskError) return error;
|
|
13044
|
+
const code = errorCode(error);
|
|
13045
|
+
if (code === "ERR_FDX_PLATFORM" || code === "ERR_FDX_ABI" || code === "ERR_FDX_BINARY_MISSING") {
|
|
13046
|
+
return new TaskError("UNSUPPORTED_ENVIRONMENT", "The installed Unix socket transport does not support observed tasks.", { reason: code }, error);
|
|
13047
|
+
}
|
|
13048
|
+
return new TaskError("OBSERVATION_FAILED", "The observed output connection failed.", { reason }, error);
|
|
13049
|
+
}
|
|
13050
|
+
var OutputObservation = class {
|
|
13051
|
+
/** Veřejný terminal promise zůstává stejný pro všechny callery. */
|
|
13052
|
+
completion;
|
|
13053
|
+
/** Settluje public completion nezávisle na případně visícím application callbacku. */
|
|
13054
|
+
completionResolve;
|
|
13055
|
+
/** Propaguje jedinou redigovanou observation chybu do public completion. */
|
|
13056
|
+
completionReject;
|
|
13057
|
+
/** Package-owned bounded socket po úspěšné adopci. */
|
|
13058
|
+
socket;
|
|
13059
|
+
/** Callback se volá sekvenčně a jeho promise je skutečný backpressure. */
|
|
13060
|
+
onOutput;
|
|
13061
|
+
/** Odstraní handle ze společného client bookkeeping po libovolném settlementu. */
|
|
13062
|
+
onTerminal;
|
|
13063
|
+
/** Start čeká na jediný validní ready frame odděleně od celého output lifecycle. */
|
|
13064
|
+
ready;
|
|
13065
|
+
/** Settluje readiness právě jednou. */
|
|
13066
|
+
readyResolve;
|
|
13067
|
+
/** Propaguje pre-ready protocol nebo detach chybu do startObserved. */
|
|
13068
|
+
readyReject;
|
|
13069
|
+
/** Brání dvojímu settlementu readiness promise. */
|
|
13070
|
+
readySettled = false;
|
|
13071
|
+
/** Explicitní public detach se hlásí jako úspěšný lokální outcome. */
|
|
13072
|
+
detached = false;
|
|
13073
|
+
/** Interní start/protocol chyba má přednost před destroy error z native socketu. */
|
|
13074
|
+
forcedFailure;
|
|
13075
|
+
/** Terminal observation ignoruje pozdější detach nebo abort. */
|
|
13076
|
+
terminal = false;
|
|
13077
|
+
/** Spustí pull pump okamžitě, aby guardian readiness nemohla uváznout na bufferu. */
|
|
13078
|
+
constructor(socket, onOutput, onTerminal) {
|
|
13079
|
+
this.socket = socket;
|
|
13080
|
+
this.onOutput = onOutput;
|
|
13081
|
+
this.onTerminal = onTerminal;
|
|
13082
|
+
this.ready = new Promise(
|
|
13083
|
+
/** Uchová jednorázové readiness settlement funkce. */
|
|
13084
|
+
(resolve3, reject) => {
|
|
13085
|
+
this.readyResolve = resolve3;
|
|
13086
|
+
this.readyReject = reject;
|
|
13087
|
+
}
|
|
13088
|
+
);
|
|
13089
|
+
void this.ready.catch(
|
|
13090
|
+
/** Interní readiness může selhat dřív, než start boundary připojí waiter. */
|
|
13091
|
+
() => {
|
|
13092
|
+
}
|
|
13093
|
+
);
|
|
13094
|
+
this.completion = new Promise(
|
|
13095
|
+
/** Lokální detach nesmí čekat na settlement cizího callback promise. */
|
|
13096
|
+
(resolve3, reject) => {
|
|
13097
|
+
this.completionResolve = resolve3;
|
|
13098
|
+
this.completionReject = reject;
|
|
13099
|
+
}
|
|
13100
|
+
);
|
|
13101
|
+
void this.completion.catch(
|
|
13102
|
+
/** Caller smí completion připojit později bez unhandled-rejection závodu. */
|
|
13103
|
+
() => {
|
|
13104
|
+
}
|
|
13105
|
+
);
|
|
13106
|
+
void this.pump();
|
|
13107
|
+
}
|
|
13108
|
+
/** Přečte exact frame a odmítne neznámou verzi, ancillary FD i oversized payload. */
|
|
13109
|
+
async readFrame() {
|
|
13110
|
+
const header = await this.socket.read({ bytes: headerBytes, fdCount: 0 });
|
|
13111
|
+
if (header === null) return null;
|
|
13112
|
+
if (this.socket.stats.bufferedReceiveFds !== 0 || !header.data.subarray(0, 4).equals(magic) || header.data[4] !== version) throw new TaskError("OBSERVATION_FAILED", "The guardian sent an invalid protocol header.", { reason: "guardian-frame-header" });
|
|
13113
|
+
const frameKind = header.data[5];
|
|
13114
|
+
if (!Object.values(kind).includes(frameKind)) throw new TaskError("OBSERVATION_FAILED", "The guardian sent an unknown frame kind.", { reason: "guardian-frame-kind" });
|
|
13115
|
+
const length = header.data.readUInt32BE(6);
|
|
13116
|
+
if (length > maximumPayloadBytes) throw new TaskError("OBSERVATION_FAILED", "The guardian frame exceeds the protocol limit.", { reason: "guardian-frame-limit" });
|
|
13117
|
+
const payload = length === 0 ? Buffer.alloc(0) : (await this.socket.read({ bytes: length, fdCount: 0 }))?.data;
|
|
13118
|
+
if (!payload || this.socket.stats.bufferedReceiveFds !== 0) throw new TaskError("OBSERVATION_FAILED", "The guardian stream ended inside a frame.", { reason: "guardian-frame-truncated" });
|
|
13119
|
+
return Object.freeze({ kind: frameKind, payload: Buffer.from(payload) });
|
|
13120
|
+
}
|
|
13121
|
+
/** Settluje readiness jen jednou a zachová původní chybu pro start boundary. */
|
|
13122
|
+
settleReady(error) {
|
|
13123
|
+
if (this.readySettled) return;
|
|
13124
|
+
this.readySettled = true;
|
|
13125
|
+
if (error) this.readyReject(error);
|
|
13126
|
+
else this.readyResolve();
|
|
13127
|
+
}
|
|
13128
|
+
/** Settluje public observation a client bookkeeping právě jednou. */
|
|
13129
|
+
settleCompletion(outcome, error) {
|
|
13130
|
+
if (this.terminal) return;
|
|
13131
|
+
this.terminal = true;
|
|
13132
|
+
if (error) this.completionReject(error);
|
|
13133
|
+
else this.completionResolve(outcome);
|
|
13134
|
+
try {
|
|
13135
|
+
this.onTerminal();
|
|
13136
|
+
} catch {
|
|
13137
|
+
}
|
|
13138
|
+
}
|
|
13139
|
+
/** Vynutí ready→data*→complete→EOF pořadí a sekvenční callback backpressure. */
|
|
13140
|
+
async pump() {
|
|
13141
|
+
try {
|
|
13142
|
+
const ready = await this.readFrame();
|
|
13143
|
+
if (ready === null || ready.kind !== kind.ready || ready.payload.byteLength !== 0) throw new TaskError("OBSERVATION_FAILED", "The guardian did not begin with an empty ready frame.", { reason: "guardian-ready-order" });
|
|
13144
|
+
this.settleReady();
|
|
13145
|
+
for (; ; ) {
|
|
13146
|
+
const frame = await this.readFrame();
|
|
13147
|
+
if (frame === null) throw new TaskError("OBSERVATION_FAILED", "The guardian ended before the complete frame.", { reason: "guardian-unexpected-eof" });
|
|
13148
|
+
if (frame.kind === kind.ready) throw new TaskError("OBSERVATION_FAILED", "The guardian repeated its ready frame.", { reason: "guardian-frame-order" });
|
|
13149
|
+
if (frame.kind === kind.complete) {
|
|
13150
|
+
if (frame.payload.byteLength !== 0) throw new TaskError("OBSERVATION_FAILED", "The guardian complete frame carried data.", { reason: "guardian-frame-order" });
|
|
13151
|
+
const trailing = await this.socket.read({ bytes: 1, fdCount: 0 });
|
|
13152
|
+
if (trailing !== null || this.socket.stats.bufferedReceiveFds !== 0) throw new TaskError("OBSERVATION_FAILED", "The guardian sent trailing protocol data.", { reason: "guardian-trailing-data" });
|
|
13153
|
+
this.socket.destroy();
|
|
13154
|
+
this.settleCompletion(Object.freeze({ outcome: "complete" }));
|
|
13155
|
+
return;
|
|
13156
|
+
}
|
|
13157
|
+
if (frame.kind !== kind.stdout && frame.kind !== kind.stderr || frame.payload.byteLength === 0) throw new TaskError("OBSERVATION_FAILED", "The guardian sent an invalid output frame.", { reason: "guardian-frame-order" });
|
|
13158
|
+
try {
|
|
13159
|
+
await this.onOutput(Object.freeze({ stream: frame.kind === kind.stdout ? "stdout" : "stderr", data: Buffer.from(frame.payload) }));
|
|
13160
|
+
} catch (error) {
|
|
13161
|
+
throw new TaskError("OBSERVATION_FAILED", "The observed output callback failed.", { reason: "output-callback" }, error);
|
|
13162
|
+
}
|
|
13163
|
+
}
|
|
13164
|
+
} catch (error) {
|
|
13165
|
+
if (this.detached && !this.forcedFailure) return;
|
|
13166
|
+
const reported = this.forcedFailure ?? observationError(error);
|
|
13167
|
+
this.settleReady(reported);
|
|
13168
|
+
this.socket.destroy();
|
|
13169
|
+
this.settleCompletion(void 0, reported);
|
|
13170
|
+
}
|
|
13171
|
+
}
|
|
13172
|
+
/** Čeká na readiness v pevném budgetu a timeout převádí na terminal observation failure. */
|
|
13173
|
+
async waitReady(timeoutMs) {
|
|
13174
|
+
let timer;
|
|
13175
|
+
const timeout = new Promise(
|
|
13176
|
+
/** Readiness timeout není task runtime timeout ani stop request. */
|
|
13177
|
+
(_resolve, reject) => {
|
|
13178
|
+
timer = setTimeout(
|
|
13179
|
+
/** Odpojí jen lokální peer; přijatý guardian přejde do drain režimu. */
|
|
13180
|
+
() => reject(new TaskError("OBSERVATION_FAILED", "The guardian readiness deadline expired.", { reason: "guardian-readiness-timeout" })),
|
|
13181
|
+
timeoutMs
|
|
13182
|
+
);
|
|
13183
|
+
}
|
|
13184
|
+
);
|
|
13185
|
+
try {
|
|
13186
|
+
await Promise.race([this.ready, timeout]);
|
|
13187
|
+
} catch (error) {
|
|
13188
|
+
const reported = observationError(error, "guardian-readiness");
|
|
13189
|
+
await this.abort(reported);
|
|
13190
|
+
throw reported;
|
|
13191
|
+
} finally {
|
|
13192
|
+
clearTimeout(timer);
|
|
13193
|
+
}
|
|
13194
|
+
}
|
|
13195
|
+
/** Interní start chyba ukončí observation jako failure, nikoliv user-requested detach. */
|
|
13196
|
+
async abort(error) {
|
|
13197
|
+
if (this.terminal) return;
|
|
13198
|
+
this.forcedFailure = error;
|
|
13199
|
+
this.settleReady(error);
|
|
13200
|
+
this.socket.destroy();
|
|
13201
|
+
this.settleCompletion(void 0, error);
|
|
13202
|
+
}
|
|
13203
|
+
/** Explicitní detach zavře lokální socket bez čekání na případně visící application callback. */
|
|
13204
|
+
async detach() {
|
|
13205
|
+
if (this.terminal) return;
|
|
13206
|
+
this.detached = true;
|
|
13207
|
+
this.settleReady(new TaskError("OBSERVATION_FAILED", "The output observation detached before guardian readiness.", { reason: "detached-before-ready" }));
|
|
13208
|
+
this.socket.destroy();
|
|
13209
|
+
this.settleCompletion(Object.freeze({ outcome: "detached" }));
|
|
13210
|
+
}
|
|
13211
|
+
};
|
|
13212
|
+
async function loadFdx() {
|
|
13213
|
+
return await import("usocket");
|
|
13214
|
+
}
|
|
13215
|
+
function prepareSocketsWithRuntime(socketFdx, options, onTerminal) {
|
|
13216
|
+
const owned = [];
|
|
13217
|
+
let adopted;
|
|
13218
|
+
try {
|
|
13219
|
+
const stdout = socketFdx.socketPair();
|
|
13220
|
+
owned.push(...stdout);
|
|
13221
|
+
const stderr = socketFdx.socketPair();
|
|
13222
|
+
owned.push(...stderr);
|
|
13223
|
+
const observer = socketFdx.socketPair();
|
|
13224
|
+
owned.push(...observer);
|
|
13225
|
+
adopted = socketFdx.adoptSocket({ descriptor: observer[0], limits: { receiveBytes: receiveBudgetBytes, receiveFds: 1, readOperations: 2 } });
|
|
13226
|
+
const observation = new OutputObservation(adopted, options.onOutput, onTerminal);
|
|
13227
|
+
let closed = false;
|
|
13228
|
+
return Object.freeze({
|
|
13229
|
+
descriptors: Object.freeze({
|
|
13230
|
+
taskStdout: stdout[0].fd,
|
|
13231
|
+
guardianStdout: stdout[1].fd,
|
|
13232
|
+
taskStderr: stderr[0].fd,
|
|
13233
|
+
guardianStderr: stderr[1].fd,
|
|
13234
|
+
guardianObserver: observer[1].fd
|
|
13235
|
+
}),
|
|
13236
|
+
observation,
|
|
13237
|
+
closeSubmitted: () => {
|
|
13238
|
+
if (closed) return;
|
|
13239
|
+
closed = true;
|
|
13240
|
+
for (const descriptor of owned) descriptor.close();
|
|
13241
|
+
}
|
|
13242
|
+
});
|
|
13243
|
+
} catch (error) {
|
|
13244
|
+
adopted?.destroy();
|
|
13245
|
+
for (const descriptor of owned) descriptor.close();
|
|
13246
|
+
throw observationError(error, "socket-setup");
|
|
13247
|
+
}
|
|
13248
|
+
}
|
|
13249
|
+
async function prepareSockets(options, onTerminal) {
|
|
13250
|
+
return prepareSocketsWithRuntime(await loadFdx(), options, onTerminal);
|
|
13251
|
+
}
|
|
13252
|
+
function validateStartOptions(value) {
|
|
13253
|
+
if (typeof value !== "object" || value === null || Array.isArray(value) || Object.getPrototypeOf(value) !== Object.prototype) throw new TaskError("INVALID_INPUT", "The observed start options are invalid.", { reason: "observed-start-options", mutationOutcome: "not-submitted" });
|
|
13254
|
+
const source = value;
|
|
13255
|
+
if (Object.keys(source).length !== 1 || typeof source.onOutput !== "function" || Object.getOwnPropertySymbols(source).length !== 0) throw new TaskError("INVALID_INPUT", "The observed start options are invalid.", { reason: "observed-start-options", mutationOutcome: "not-submitted" });
|
|
13256
|
+
return Object.freeze({ onOutput: source.onOutput });
|
|
13257
|
+
}
|
|
13258
|
+
|
|
13171
13259
|
// src/observed-systemd.ts
|
|
13260
|
+
var fs4 = __toESM(require("fs/promises"), 1);
|
|
13261
|
+
var path4 = __toESM(require("path"), 1);
|
|
13172
13262
|
var guardianReadinessTimeoutMs = 5e3;
|
|
13173
13263
|
function guardianPath() {
|
|
13174
|
-
const directory = typeof __systemdTasksRuntimeDirectory === "string" ? __systemdTasksRuntimeDirectory :
|
|
13175
|
-
return
|
|
13264
|
+
const directory = typeof __systemdTasksRuntimeDirectory === "string" ? __systemdTasksRuntimeDirectory : path4.resolve(process.cwd(), "src");
|
|
13265
|
+
return path4.basename(directory) === "src" ? path4.resolve(directory, "..", "dist", "guardian.mjs") : path4.join(directory, "guardian.mjs");
|
|
13176
13266
|
}
|
|
13177
13267
|
async function assertObservedAvailable() {
|
|
13178
13268
|
await assertRetentionAvailable();
|
|
13179
13269
|
for (const executable of [process.execPath, "/usr/bin/systemd-notify", "/usr/bin/systemctl"]) {
|
|
13180
13270
|
try {
|
|
13181
|
-
const
|
|
13182
|
-
if (!
|
|
13183
|
-
await
|
|
13271
|
+
const stat4 = await fs4.stat(executable);
|
|
13272
|
+
if (!stat4.isFile()) throw new Error("Internal executable is not a regular file.");
|
|
13273
|
+
await fs4.access(executable, fs4.constants.X_OK);
|
|
13184
13274
|
} catch (error) {
|
|
13185
13275
|
throw new TaskError("UNSUPPORTED_ENVIRONMENT", "Observed tasks require their internal executables.", { reason: "observed-executable-unavailable" }, error);
|
|
13186
13276
|
}
|
|
13187
13277
|
}
|
|
13188
13278
|
try {
|
|
13189
|
-
const
|
|
13190
|
-
if (!
|
|
13191
|
-
await
|
|
13279
|
+
const stat4 = await fs4.stat(guardianPath());
|
|
13280
|
+
if (!stat4.isFile()) throw new Error("Packaged guardian is not a regular file.");
|
|
13281
|
+
await fs4.access(guardianPath(), fs4.constants.R_OK);
|
|
13192
13282
|
} catch (error) {
|
|
13193
13283
|
throw new TaskError("UNSUPPORTED_ENVIRONMENT", "The packaged observed-task guardian is unavailable.", { reason: "guardian-unavailable" }, error);
|
|
13194
13284
|
}
|
|
13195
13285
|
}
|
|
13196
|
-
function
|
|
13286
|
+
function creationProperties3(intent, descriptors, managerEnvironment) {
|
|
13197
13287
|
const spec = intent.spec;
|
|
13198
13288
|
const task = [
|
|
13199
13289
|
property("Description", "s", marker2(intent, "task")),
|
|
@@ -13369,7 +13459,7 @@ var ObservedOperations = class {
|
|
|
13369
13459
|
);
|
|
13370
13460
|
unregister = this.core.register(sockets.observation);
|
|
13371
13461
|
if (terminal) unregister();
|
|
13372
|
-
const mapped =
|
|
13462
|
+
const mapped = creationProperties3(intent, sockets.descriptors, inherited);
|
|
13373
13463
|
this.core.assertOpen();
|
|
13374
13464
|
this.core.markAttempt(intent);
|
|
13375
13465
|
stage = "submitted";
|
|
@@ -13409,6 +13499,65 @@ var ObservedOperations = class {
|
|
|
13409
13499
|
async () => await this.lookupInternal(target)
|
|
13410
13500
|
);
|
|
13411
13501
|
}
|
|
13502
|
+
/** Registruje právě jeden exact finalizer; nejasný start se bez lookupu neopakuje. */
|
|
13503
|
+
async finalizeAfterCompletion(value, options) {
|
|
13504
|
+
const bootstrap = prepare2(value, options);
|
|
13505
|
+
const reference3 = bootstrap.reference;
|
|
13506
|
+
const unitName2 = unitName(reference3);
|
|
13507
|
+
return await this.core.diagnostics.run(
|
|
13508
|
+
reference3,
|
|
13509
|
+
/** Registrace používá stejnou task mutation frontu i redigovaný kontext. */
|
|
13510
|
+
async () => {
|
|
13511
|
+
return await this.core.mutate(
|
|
13512
|
+
reference3,
|
|
13513
|
+
/** Jediná registrační mutation stejného tasku drží společnou klientskou frontu. */
|
|
13514
|
+
async () => {
|
|
13515
|
+
let stage = "before-submission";
|
|
13516
|
+
try {
|
|
13517
|
+
this.core.assertOpen();
|
|
13518
|
+
assertManager(reference3.manager, this.core.manager);
|
|
13519
|
+
const existing = await this.core.transport.readUnit(unitName2);
|
|
13520
|
+
if (existing !== null) {
|
|
13521
|
+
assertRegistered(bootstrap, existing);
|
|
13522
|
+
return Object.freeze({ outcome: "already-registered", unitName: unitName2, manager: this.core.manager, jobPath: null });
|
|
13523
|
+
}
|
|
13524
|
+
const found = await this.lookupInternal(reference3);
|
|
13525
|
+
if (found.status !== "found") {
|
|
13526
|
+
throw new TaskError("RESULT_UNAVAILABLE", "The task to finalize is unavailable.", {
|
|
13527
|
+
reason: found.status === "not-found" ? "unit-not-found" : "observed-topology-incomplete"
|
|
13528
|
+
});
|
|
13529
|
+
}
|
|
13530
|
+
const inherited = await this.core.transport.readEnvironment();
|
|
13531
|
+
const properties2 = await creationProperties2(bootstrap, inherited);
|
|
13532
|
+
this.core.assertOpen();
|
|
13533
|
+
stage = "submitted";
|
|
13534
|
+
this.core.diagnostics.emit("observed.finalization.submitted");
|
|
13535
|
+
let jobPath;
|
|
13536
|
+
try {
|
|
13537
|
+
jobPath = await this.core.transport.start(unitName2, properties2, []);
|
|
13538
|
+
} catch (error) {
|
|
13539
|
+
if (error instanceof TaskError && error.details.mutationOutcome === "rejected") {
|
|
13540
|
+
const concurrent = await this.core.transport.readUnit(unitName2);
|
|
13541
|
+
if (concurrent !== null) {
|
|
13542
|
+
assertRegistered(bootstrap, concurrent);
|
|
13543
|
+
return Object.freeze({ outcome: "already-registered", unitName: unitName2, manager: this.core.manager, jobPath: null });
|
|
13544
|
+
}
|
|
13545
|
+
}
|
|
13546
|
+
throw error;
|
|
13547
|
+
}
|
|
13548
|
+
stage = "accepted";
|
|
13549
|
+
this.core.diagnostics.emit("observed.finalization.accepted");
|
|
13550
|
+
return Object.freeze({ outcome: "accepted", unitName: unitName2, manager: this.core.manager, jobPath });
|
|
13551
|
+
} catch (error) {
|
|
13552
|
+
const reported = mutationError(error, "finalizeAfterCompletion", reference3, stage);
|
|
13553
|
+
this.core.diagnostics.emit("observed.finalization.error", reported.code);
|
|
13554
|
+
throw reported;
|
|
13555
|
+
}
|
|
13556
|
+
}
|
|
13557
|
+
);
|
|
13558
|
+
}
|
|
13559
|
+
);
|
|
13560
|
+
}
|
|
13412
13561
|
/** Vyžaduje kompletní exact topologii reference. */
|
|
13413
13562
|
async inspect(value) {
|
|
13414
13563
|
const reference3 = validateObservedReference(value);
|
|
@@ -13619,7 +13768,7 @@ var ObservedOperations = class {
|
|
|
13619
13768
|
|
|
13620
13769
|
// src/transport.ts
|
|
13621
13770
|
var dbus = __toESM(require_dbus_next(), 1);
|
|
13622
|
-
var
|
|
13771
|
+
var fs5 = __toESM(require("fs/promises"), 1);
|
|
13623
13772
|
var managerPath = "/org/freedesktop/systemd1";
|
|
13624
13773
|
var managerInterface = "org.freedesktop.systemd1.Manager";
|
|
13625
13774
|
var busPath = "/org/freedesktop/DBus";
|
|
@@ -13701,7 +13850,7 @@ var DbusTransport = class _DbusTransport {
|
|
|
13701
13850
|
const [major = 0, minor = 0] = process.versions.node.split(".").map(Number);
|
|
13702
13851
|
if (process.platform !== "linux" || major < 24 || major === 24 && minor < 13 || !process.getuid) throw new TaskError("UNSUPPORTED_ENVIRONMENT", "Linux and Node 24.13.0 or newer are required.");
|
|
13703
13852
|
try {
|
|
13704
|
-
await
|
|
13853
|
+
await fs5.access("/sys/fs/cgroup/cgroup.controllers");
|
|
13705
13854
|
} catch (error) {
|
|
13706
13855
|
throw new TaskError("UNSUPPORTED_ENVIRONMENT", "A cgroup v2 hierarchy is required.", {}, error);
|
|
13707
13856
|
}
|
|
@@ -13715,7 +13864,7 @@ var DbusTransport = class _DbusTransport {
|
|
|
13715
13864
|
if (typeof managerProperties.Version !== "string" || Number.parseInt(managerProperties.Version, 10) < 257 || !/^\d/.test(managerProperties.Version)) throw new TaskError("UNSUPPORTED_ENVIRONMENT", "Systemd 257 or newer is required.", { reason: "systemd-version" });
|
|
13716
13865
|
const machineId = scalar(await transport.invoke("GetMachineId", "", [], false, transport.owner, managerPath, "org.freedesktop.DBus.Peer"));
|
|
13717
13866
|
const busId = scalar(await transport.invoke("GetId", "", [], false, "org.freedesktop.DBus", busPath, "org.freedesktop.DBus"));
|
|
13718
|
-
const bootId = (await
|
|
13867
|
+
const bootId = (await fs5.readFile("/proc/sys/kernel/random/boot_id", "utf8")).trim();
|
|
13719
13868
|
transport.boundIdentity = Object.freeze({ scope: "user", uid: process.getuid(), machineId, bootId, busId, owner: transport.owner });
|
|
13720
13869
|
await transport.invoke("AddMatch", "s", [`type='signal',sender='${transport.owner}',path_namespace='${managerPath}'`], false, "org.freedesktop.DBus", busPath, "org.freedesktop.DBus");
|
|
13721
13870
|
await transport.invoke("Subscribe", "", [], false);
|
|
@@ -13738,10 +13887,10 @@ var DbusTransport = class _DbusTransport {
|
|
|
13738
13887
|
if (this.failure) throw this.failure;
|
|
13739
13888
|
}
|
|
13740
13889
|
/** Wake observers without letting a callback disrupt the transport's message dispatch. */
|
|
13741
|
-
notify(
|
|
13890
|
+
notify(unitName2) {
|
|
13742
13891
|
for (const listener of this.listeners) {
|
|
13743
13892
|
try {
|
|
13744
|
-
listener(
|
|
13893
|
+
listener(unitName2);
|
|
13745
13894
|
} catch {
|
|
13746
13895
|
}
|
|
13747
13896
|
}
|
|
@@ -13810,7 +13959,7 @@ var DbusTransport = class _DbusTransport {
|
|
|
13810
13959
|
const serial = message.serial;
|
|
13811
13960
|
return await new Promise(
|
|
13812
13961
|
/** Own the deadline and settlement of exactly one D-Bus request. */
|
|
13813
|
-
(
|
|
13962
|
+
(resolve3, reject) => {
|
|
13814
13963
|
const timer = setTimeout(
|
|
13815
13964
|
/** Invalidate the connection before releasing possibly queued descriptors. */
|
|
13816
13965
|
() => this.fail(new TaskError("MANAGER_UNAVAILABLE", "The manager request deadline expired.", { operation: member, reason: "request-timeout" })),
|
|
@@ -13822,7 +13971,7 @@ var DbusTransport = class _DbusTransport {
|
|
|
13822
13971
|
(reply) => {
|
|
13823
13972
|
if (!this.pending.delete(serial)) return;
|
|
13824
13973
|
clearTimeout(timer);
|
|
13825
|
-
if (reply)
|
|
13974
|
+
if (reply) resolve3(reply.body);
|
|
13826
13975
|
else reject(new TaskError(mutation ? "UNKNOWN_MUTATION_OUTCOME" : "RESULT_UNAVAILABLE", "The manager returned no reply.", { operation: member, ...mutation ? { mutationOutcome: "unknown" } : {} }));
|
|
13827
13976
|
},
|
|
13828
13977
|
/** Translate delivery evidence and clean abandoned upstream reply handlers. */
|
|
@@ -13970,6 +14119,10 @@ var SystemdTaskClient = class {
|
|
|
13970
14119
|
async startObserved(intent, options) {
|
|
13971
14120
|
return await this.observed.startObserved(intent, options);
|
|
13972
14121
|
}
|
|
14122
|
+
/** Registruje manager-owned dokončení bez změny standardního retention kontraktu. */
|
|
14123
|
+
async finalizeAfterCompletion(reference3, options) {
|
|
14124
|
+
return await this.observed.finalizeAfterCompletion(reference3, options);
|
|
14125
|
+
}
|
|
13973
14126
|
/** Směruje podle explicitního versioned kind, nikoliv podle package entrypointu. */
|
|
13974
14127
|
async lookup(value) {
|
|
13975
14128
|
if (isObservedValue(value)) return await this.observed.lookup(value);
|
|
@@ -14190,7 +14343,7 @@ var SystemdTaskClient = class {
|
|
|
14190
14343
|
};
|
|
14191
14344
|
async function openClient(options, observed) {
|
|
14192
14345
|
const validated = validateConnectOptions(options);
|
|
14193
|
-
const sink = new Diagnostics(
|
|
14346
|
+
const sink = new Diagnostics(crypto4.randomUUID(), validated.onDiagnostic);
|
|
14194
14347
|
try {
|
|
14195
14348
|
if (observed) await assertObservedAvailable();
|
|
14196
14349
|
else await assertRetentionAvailable();
|