@ouro.bot/cli 0.1.0-alpha.544 → 0.1.0-alpha.546
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.json
CHANGED
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"_note": "This changelog is maintained as part of the PR/version-bump workflow. Agent-curated, not auto-generated. Agents read this file directly via read_file to understand what changed between versions.",
|
|
3
3
|
"versions": [
|
|
4
|
+
{
|
|
5
|
+
"version": "0.1.0-alpha.546",
|
|
6
|
+
"changes": [
|
|
7
|
+
"Launchd habit sync now leaves the daemon launch agent plist alone, preventing the daemon from booting out its own `bot.ouro.daemon` service during startup."
|
|
8
|
+
]
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"version": "0.1.0-alpha.545",
|
|
12
|
+
"changes": [
|
|
13
|
+
"Launchd-managed habit jobs now inherit the runtime PATH in their plist environment, preventing login-started jobs from failing to find the Node runtime.",
|
|
14
|
+
"The default daemon starter now launches with the current process executable instead of a bare `node` lookup, so background restarts survive sparse launch contexts.",
|
|
15
|
+
"Adds regression coverage for restart launch path hardening and mail-import discovery timestamp fallbacks."
|
|
16
|
+
]
|
|
17
|
+
},
|
|
4
18
|
{
|
|
5
19
|
"version": "0.1.0-alpha.544",
|
|
6
20
|
"changes": [
|
|
@@ -81,7 +81,7 @@ function defaultStartDaemonProcess(socketPath) {
|
|
|
81
81
|
// when the daemon's logging system writes to stderr after the parent exits.
|
|
82
82
|
const outFd = fs.openSync(os.devNull, "w");
|
|
83
83
|
const errFd = fs.openSync(os.devNull, "w");
|
|
84
|
-
const child = (0, child_process_1.spawn)(
|
|
84
|
+
const child = (0, child_process_1.spawn)(process.execPath, [entry, "--socket", socketPath], {
|
|
85
85
|
detached: true,
|
|
86
86
|
stdio: ["ignore", outFd, errFd],
|
|
87
87
|
});
|
|
@@ -43,6 +43,7 @@ exports.crontabLine = crontabLine;
|
|
|
43
43
|
const os = __importStar(require("os"));
|
|
44
44
|
const runtime_1 = require("../../nerves/runtime");
|
|
45
45
|
const PLIST_PREFIX = "bot.ouro.";
|
|
46
|
+
const DAEMON_PLIST_FILENAME = "bot.ouro.daemon.plist";
|
|
46
47
|
function plistLabel(job) {
|
|
47
48
|
return `${PLIST_PREFIX}${job.agent}.${job.taskId}`;
|
|
48
49
|
}
|
|
@@ -80,7 +81,7 @@ function scheduleToCalendarInterval(schedule) {
|
|
|
80
81
|
result.Month = parseInt(month, 10);
|
|
81
82
|
return Object.keys(result).length > 0 ? result : null;
|
|
82
83
|
}
|
|
83
|
-
function generatePlistXml(job) {
|
|
84
|
+
function generatePlistXml(job, envPath) {
|
|
84
85
|
const label = plistLabel(job);
|
|
85
86
|
const seconds = cadenceToSeconds(job.schedule);
|
|
86
87
|
const calendar = seconds === null ? scheduleToCalendarInterval(job.schedule) : null;
|
|
@@ -97,7 +98,7 @@ function generatePlistXml(job) {
|
|
|
97
98
|
else {
|
|
98
99
|
triggerXml = ` <key>StartInterval</key>\n <integer>1800</integer>`;
|
|
99
100
|
}
|
|
100
|
-
|
|
101
|
+
const lines = [
|
|
101
102
|
`<?xml version="1.0" encoding="UTF-8"?>`,
|
|
102
103
|
`<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">`,
|
|
103
104
|
`<plist version="1.0">`,
|
|
@@ -110,14 +111,12 @@ function generatePlistXml(job) {
|
|
|
110
111
|
...job.command.split(" ").slice(1).map((arg) => ` <string>${arg}</string>`),
|
|
111
112
|
` </array>`,
|
|
112
113
|
triggerXml,
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
` <key>
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
``,
|
|
120
|
-
].join("\n");
|
|
114
|
+
];
|
|
115
|
+
if (envPath) {
|
|
116
|
+
lines.push(` <key>EnvironmentVariables</key>`, ` <dict>`, ` <key>PATH</key>`, ` <string>${envPath}</string>`, ` </dict>`);
|
|
117
|
+
}
|
|
118
|
+
lines.push(` <key>StandardOutPath</key>`, ` <string>/tmp/${label}.stdout.log</string>`, ` <key>StandardErrorPath</key>`, ` <string>/tmp/${label}.stderr.log</string>`, `</dict>`, `</plist>`, ``);
|
|
119
|
+
return lines.join("\n");
|
|
121
120
|
}
|
|
122
121
|
class LaunchdCronManager {
|
|
123
122
|
deps;
|
|
@@ -148,7 +147,7 @@ class LaunchdCronManager {
|
|
|
148
147
|
const label = plistLabel(job);
|
|
149
148
|
const filename = `${label}.plist`;
|
|
150
149
|
const fullPath = `${this.launchAgentsDir}/${filename}`;
|
|
151
|
-
const xml = generatePlistXml(job);
|
|
150
|
+
const xml = generatePlistXml(job, this.deps.envPath);
|
|
152
151
|
try {
|
|
153
152
|
this.deps.exec(`launchctl unload "${fullPath}"`);
|
|
154
153
|
}
|
|
@@ -178,7 +177,9 @@ class LaunchdCronManager {
|
|
|
178
177
|
listPlistFiles() {
|
|
179
178
|
if (!this.deps.existsFile(this.launchAgentsDir))
|
|
180
179
|
return [];
|
|
181
|
-
return this.deps.listDir(this.launchAgentsDir).filter((f) => f.startsWith(PLIST_PREFIX) &&
|
|
180
|
+
return this.deps.listDir(this.launchAgentsDir).filter((f) => f.startsWith(PLIST_PREFIX) &&
|
|
181
|
+
f.endsWith(".plist") &&
|
|
182
|
+
f !== DAEMON_PLIST_FILENAME);
|
|
182
183
|
}
|
|
183
184
|
}
|
|
184
185
|
exports.LaunchdCronManager = LaunchdCronManager;
|
|
@@ -248,6 +249,7 @@ function createOsCronManager(options = {}) {
|
|
|
248
249
|
listDir: () => [],
|
|
249
250
|
mkdirp: () => { },
|
|
250
251
|
homeDir: os.homedir(),
|
|
252
|
+
envPath: process.env.PATH ?? "",
|
|
251
253
|
};
|
|
252
254
|
/* v8 ignore stop */
|
|
253
255
|
return new LaunchdCronManager(deps);
|