@atolis-hq/wake 0.2.72 → 0.2.73

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.
@@ -4,44 +4,20 @@ import { buildResourceUri } from '../../domain/resource-uri.js';
4
4
  import { isTerminalStage } from '../../domain/stages.js';
5
5
  import { isWorkItemDeleted, isWorkItemFrozen } from '../../domain/work-item-lifecycle.js';
6
6
  import { workflowForProjection, workflowNameForProjection } from '../../domain/workflows.js';
7
- function parseLockMetadata(raw) {
8
- try {
9
- const parsed = JSON.parse(raw);
10
- if (typeof parsed.pid !== 'number' || typeof parsed.acquiredAt !== 'string') {
11
- return null;
12
- }
13
- return { pid: parsed.pid, acquiredAt: parsed.acquiredAt };
14
- }
15
- catch {
16
- return null;
17
- }
18
- }
19
- function isPidAlive(pid) {
20
- try {
21
- process.kill(pid, 0);
22
- return true;
23
- }
24
- catch (error) {
25
- return error.code !== 'ESRCH';
26
- }
27
- }
28
- async function readLockInfo(lockFile, now) {
29
- try {
30
- const metadata = parseLockMetadata(await readFile(lockFile, 'utf8'));
31
- if (metadata === null) {
32
- return { present: true };
33
- }
34
- return {
35
- present: true,
36
- pid: metadata.pid,
37
- acquiredAt: metadata.acquiredAt,
38
- ageMs: now.getTime() - Date.parse(metadata.acquiredAt),
39
- pidAlive: isPidAlive(metadata.pid),
40
- };
41
- }
42
- catch {
43
- return { present: false };
44
- }
7
+ import { readFileLockStatus } from '../../lib/lock.js';
8
+ async function readLockInfo(lockFile, now, processInspector) {
9
+ const status = await readFileLockStatus(lockFile, {
10
+ now,
11
+ ...(processInspector === undefined ? {} : { processInspector }),
12
+ });
13
+ return {
14
+ present: status.present,
15
+ ...(status.metadata === undefined ? {} : { pid: status.metadata.pid }),
16
+ ...(status.metadata === undefined ? {} : { acquiredAt: status.metadata.acquiredAt }),
17
+ ...(status.ageMs === undefined ? {} : { ageMs: status.ageMs }),
18
+ pidAlive: status.active,
19
+ ...(status.staleReason === undefined ? {} : { staleReason: status.staleReason }),
20
+ };
45
21
  }
46
22
  /**
47
23
  * Reproduces the sentinel-driven part of policy eligibility for display purposes only.
@@ -188,8 +164,8 @@ export async function buildStatus(input) {
188
164
  buildBoard(input),
189
165
  ]);
190
166
  const [tickLock, runnerLock] = await Promise.all([
191
- readLockInfo(input.stateStore.paths.tickLockFile, input.now),
192
- readLockInfo(input.stateStore.paths.runnerLockFile, input.now),
167
+ readLockInfo(input.stateStore.paths.tickLockFile, input.now, input.processInspector),
168
+ readLockInfo(input.stateStore.paths.runnerLockFile, input.now, input.processInspector),
193
169
  ]);
194
170
  const tickLockLive = tickLock.present && tickLock.pidAlive === true;
195
171
  const runnerLockLive = runnerLock.present && runnerLock.pidAlive === true;
@@ -124,4 +124,4 @@ export function resolveWakeVersion(options = {}) {
124
124
  }
125
125
  return '0.1.0-dev';
126
126
  }
127
- export const wakeVersion = "g2328db4";
127
+ export const wakeVersion = "g7746beb";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atolis-hq/wake",
3
- "version": "0.2.72",
3
+ "version": "0.2.73",
4
4
  "description": "Local autonomous agent control plane for software development",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {