@coworker-jp/aidr 0.0.6 → 0.0.8
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/package.json +1 -1
- package/src/sentinel.mjs +11 -8
package/package.json
CHANGED
package/src/sentinel.mjs
CHANGED
|
@@ -60,7 +60,7 @@ function buildLaunchdPlist(envFile) {
|
|
|
60
60
|
<array>
|
|
61
61
|
<string>/bin/sh</string>
|
|
62
62
|
<string>-c</string>
|
|
63
|
-
<string
|
|
63
|
+
<string>set -a; . ${envFile}; set +a; exec ${SENTINEL_BIN}</string>
|
|
64
64
|
</array>
|
|
65
65
|
<key>RunAtLoad</key>
|
|
66
66
|
<true/>
|
|
@@ -167,13 +167,15 @@ async function _installMacos(dryRun, noActivate) {
|
|
|
167
167
|
console.error(`[sentinel] Written: ${SENTINEL_PLIST}`);
|
|
168
168
|
|
|
169
169
|
if (!noActivate && process.env.AI_SCANNER_NO_SCHEDULED_ACTIVATE !== "1") {
|
|
170
|
-
//
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
170
|
+
// Modern launchctl API (bootstrap/bootout). Mirrors scheduled.mjs so
|
|
171
|
+
// both daemons share one mental model. Idempotent: bootout-before-
|
|
172
|
+
// bootstrap absorbs prior loads regardless of which API installed them.
|
|
173
|
+
try { await execFileP("launchctl", ["bootout", "system", SENTINEL_PLIST]); } catch { /* not loaded */ }
|
|
174
|
+
try {
|
|
175
|
+
await execFileP("launchctl", ["bootstrap", "system", SENTINEL_PLIST]);
|
|
176
176
|
console.error("[sentinel] Daemon loaded via launchctl");
|
|
177
|
+
} catch (e) {
|
|
178
|
+
console.warn("[sentinel] launchctl bootstrap failed — daemon may need manual start:", e.message);
|
|
177
179
|
}
|
|
178
180
|
}
|
|
179
181
|
} else {
|
|
@@ -212,7 +214,8 @@ export async function uninstallSentinel({ dryRun = false } = {}) {
|
|
|
212
214
|
if (process.platform === "darwin") {
|
|
213
215
|
if (await exists(SENTINEL_PLIST)) {
|
|
214
216
|
if (!dryRun) {
|
|
215
|
-
|
|
217
|
+
// Modern launchctl API; mirrors scheduled.mjs's uninstallScheduled.
|
|
218
|
+
try { await execFileP("launchctl", ["bootout", "system", SENTINEL_PLIST]); } catch { /* not loaded */ }
|
|
216
219
|
await fs.unlink(SENTINEL_PLIST);
|
|
217
220
|
console.error(`[sentinel] Removed: ${SENTINEL_PLIST}`);
|
|
218
221
|
} else {
|