agent-afk 5.79.0 → 5.80.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.
@@ -3,4 +3,5 @@ export { buildRuntimeSnapshot, parseView, formatEnvironmentFragment, } from './r
3
3
  export { buildRuntimeStateSource, type RuntimeSourceDeps, } from './runtime-source.js';
4
4
  export { getRuntimeStateTool, AWARENESS_TOOL_NAMES, createGetRuntimeStateHandler, wrapDispatcherWithRuntimeState, } from './tool.js';
5
5
  export { gatherWorkspace } from './workspace-source.js';
6
- export { writePresenceFile, removePresenceFile, removePresenceFileSync, readPresenceFiles, type PresenceFileInfo, type PresenceRecord, } from './presence.js';
6
+ export { writePresenceFile, removePresenceFile, removePresenceFileSync, readPresenceFiles, readLivePresenceFiles, touchPresenceHeartbeat, PRESENCE_SCHEMA_VERSION, type PresenceFileInfo, type PresenceRecord, type PresenceLiveness, type ReadLivePresenceOptions, } from './presence.js';
7
+ export { isProcessAlive, classifyPidLiveness, type ProcessLiveness, } from '../process-liveness.js';
@@ -1,5 +1,7 @@
1
1
  import type { RuntimeWorkspace } from './types.js';
2
2
  import type { TraceActor } from '../session/session-identity.js';
3
+ import { type ProcessLiveness } from '../process-liveness.js';
4
+ export declare const PRESENCE_SCHEMA_VERSION = 1;
3
5
  export interface PresenceFileInfo {
4
6
  sessionId: string;
5
7
  surface: string;
@@ -13,13 +15,23 @@ export interface PresenceFileInfo {
13
15
  workspace: RuntimeWorkspace;
14
16
  pid: number;
15
17
  afk?: boolean;
18
+ schemaVersion?: number;
19
+ heartbeatAt?: string;
16
20
  }
21
+ export type PresenceLiveness = ProcessLiveness;
17
22
  export interface PresenceRecord extends PresenceFileInfo {
18
23
  path: string;
24
+ liveness: PresenceLiveness;
25
+ heartbeatAgeMs: number | null;
19
26
  }
20
27
  export declare function writePresenceFile(info: PresenceFileInfo): Promise<void>;
28
+ export declare function touchPresenceHeartbeat(sessionId: string): Promise<void>;
21
29
  export declare function setPresenceAfk(sessionId: string, afk: boolean): Promise<void>;
22
30
  export declare function updatePresenceCwd(sessionId: string, cwd: string): Promise<void>;
23
31
  export declare function removePresenceFile(sessionId: string): Promise<void>;
24
32
  export declare function removePresenceFileSync(sessionId: string): void;
25
33
  export declare function readPresenceFiles(): Promise<PresenceRecord[]>;
34
+ export interface ReadLivePresenceOptions {
35
+ maxHeartbeatAgeMs?: number;
36
+ }
37
+ export declare function readLivePresenceFiles(options?: ReadLivePresenceOptions): Promise<PresenceRecord[]>;
@@ -0,0 +1,3 @@
1
+ export type ProcessLiveness = 'alive' | 'dead' | 'unknown';
2
+ export declare function isProcessAlive(pid: number): boolean;
3
+ export declare function classifyPidLiveness(pid: unknown): ProcessLiveness;