agent-afk 5.78.2 → 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[]>;
@@ -9,6 +9,7 @@ export interface BgJobMeta {
9
9
  endedAt?: number;
10
10
  status: 'running' | 'completed' | 'failed' | 'cancelled';
11
11
  parentSessionId?: string;
12
+ stopReason?: string;
12
13
  schemaVersion: 1;
13
14
  }
14
15
  export declare class BgJobLogWriter {
@@ -54,6 +54,8 @@ export interface PostToolUseContext {
54
54
  input?: unknown;
55
55
  output?: unknown;
56
56
  grantManager?: GrantManager;
57
+ incomplete?: boolean;
58
+ incompleteReason?: string;
57
59
  }
58
60
  export interface PreCompactContext {
59
61
  event: 'PreCompact';
@@ -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;
@@ -89,6 +89,8 @@ export type ProviderEvent = {
89
89
  toolName?: string;
90
90
  batchIndex?: number;
91
91
  batchSize?: number;
92
+ incomplete?: boolean;
93
+ incompleteReason?: string;
92
94
  } | {
93
95
  type: 'tool.diff';
94
96
  toolUseId: string;
@@ -15,6 +15,8 @@ export interface ToolResult {
15
15
  content: string;
16
16
  isError?: boolean;
17
17
  truncated?: boolean;
18
+ incomplete?: boolean;
19
+ incompleteReason?: string;
18
20
  circuitBreaker?: boolean;
19
21
  failureClass?: ToolFailureClass;
20
22
  batchIndex?: number;
@@ -10,6 +10,7 @@ export interface RoutingDecisionEntry {
10
10
  status?: string | undefined;
11
11
  duration_ms?: number | undefined;
12
12
  content_chars?: number | undefined;
13
+ stop_reason?: string | undefined;
13
14
  error_message?: string | undefined;
14
15
  schema_error?: string | undefined;
15
16
  partial_output_chars?: number | undefined;
@@ -5,6 +5,10 @@ export type SubagentStatus = 'idle' | 'running' | 'succeeded' | 'failed' | 'canc
5
5
  export declare const STREAM_INCOMPLETE = "stream_incomplete";
6
6
  export declare function isIncompleteStopReason(stopReason: string | undefined): boolean;
7
7
  export declare function annotateIfIncomplete(content: string, stopReason: string | undefined): string;
8
+ export declare function incompleteToolResultFields(stopReason: string | undefined): {
9
+ incomplete?: true;
10
+ incompleteReason?: string;
11
+ };
8
12
  export interface SubagentToolCall {
9
13
  id: string;
10
14
  name: string;
@@ -23,6 +23,8 @@ export declare const ToolCallCompletedPayloadSchema: z.ZodObject<{
23
23
  isError: z.ZodBoolean;
24
24
  truncated: z.ZodBoolean;
25
25
  durationMs: z.ZodNumber;
26
+ incomplete: z.ZodOptional<z.ZodBoolean>;
27
+ incompleteReason: z.ZodOptional<z.ZodString>;
26
28
  circuitBreaker: z.ZodOptional<z.ZodBoolean>;
27
29
  failureClass: z.ZodOptional<z.ZodEnum<{
28
30
  abort: "abort";
@@ -51,6 +53,8 @@ export declare const ToolCallPayloadSchema: z.ZodDiscriminatedUnion<[z.ZodObject
51
53
  isError: z.ZodBoolean;
52
54
  truncated: z.ZodBoolean;
53
55
  durationMs: z.ZodNumber;
56
+ incomplete: z.ZodOptional<z.ZodBoolean>;
57
+ incompleteReason: z.ZodOptional<z.ZodString>;
54
58
  circuitBreaker: z.ZodOptional<z.ZodBoolean>;
55
59
  failureClass: z.ZodOptional<z.ZodEnum<{
56
60
  abort: "abort";
@@ -562,6 +566,8 @@ export declare const TraceEventInputSchema: z.ZodDiscriminatedUnion<[z.ZodObject
562
566
  isError: z.ZodBoolean;
563
567
  truncated: z.ZodBoolean;
564
568
  durationMs: z.ZodNumber;
569
+ incomplete: z.ZodOptional<z.ZodBoolean>;
570
+ incompleteReason: z.ZodOptional<z.ZodString>;
565
571
  circuitBreaker: z.ZodOptional<z.ZodBoolean>;
566
572
  failureClass: z.ZodOptional<z.ZodEnum<{
567
573
  abort: "abort";
@@ -875,6 +881,8 @@ export declare const TraceEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
875
881
  isError: z.ZodBoolean;
876
882
  truncated: z.ZodBoolean;
877
883
  durationMs: z.ZodNumber;
884
+ incomplete: z.ZodOptional<z.ZodBoolean>;
885
+ incompleteReason: z.ZodOptional<z.ZodString>;
878
886
  circuitBreaker: z.ZodOptional<z.ZodBoolean>;
879
887
  failureClass: z.ZodOptional<z.ZodEnum<{
880
888
  abort: "abort";
@@ -16,6 +16,8 @@ export interface ToolCallCompletedPayload {
16
16
  isError: boolean;
17
17
  truncated: boolean;
18
18
  durationMs: number;
19
+ incomplete?: boolean;
20
+ incompleteReason?: string;
19
21
  circuitBreaker?: boolean;
20
22
  failureClass?: ToolFailureClass;
21
23
  batchIndex?: number;