@myvillage/cli 1.88.0 → 1.88.1

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myvillage/cli",
3
- "version": "1.88.0",
3
+ "version": "1.88.1",
4
4
  "description": "MyVillageOS CLI for community developers",
5
5
  "type": "module",
6
6
  "bin": {
@@ -251,6 +251,21 @@ async function reconcileOnce(ctx) {
251
251
  continue;
252
252
  }
253
253
  const epoch = lease.json.data.leaseEpoch;
254
+
255
+ // Never fork a second daemon on top of a live one. An agent started outside
256
+ // the fleet (Studio's local Start, or a previous CLI `agent start`) has no
257
+ // lease, so it reaches here with a fresh lease and an already-running
258
+ // process; forking again would double-run it and orphan the first daemon
259
+ // (the pid file is last-writer-wins). Adopt it instead.
260
+ if (isDaemonRunning(entry.name)) {
261
+ ctx.leases.set(a.agentProfileId, { name: entry.name, epoch });
262
+ log(
263
+ `adopted already-running ${entry.name} under lease (epoch ${epoch}) — started outside the fleet, so it ` +
264
+ `reports no fence; stop/start it from Studio to relaunch it fenced`,
265
+ );
266
+ continue;
267
+ }
268
+
254
269
  const pid = startAgent(entry.name, entry.config, ctx.machineId, epoch);
255
270
  ctx.leases.set(a.agentProfileId, { name: entry.name, epoch });
256
271
  log(`started ${entry.name} (pid ${pid}, epoch ${epoch})`);