agent-afk 5.50.0 → 5.51.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.
@@ -22,4 +22,5 @@ export declare function createDefaultHookRegistry(onSubagentComplete?: (info: Su
22
22
  cwd?: string;
23
23
  sessionId?: string;
24
24
  traceWriter?: TraceWriter;
25
+ afkPromptForApproval?: boolean;
25
26
  }, getCwd?: () => string | undefined): DefaultHookRegistryResult;
@@ -5,6 +5,7 @@ export interface ExecuteCommandOptions {
5
5
  agentCwd: string;
6
6
  sessionId?: string;
7
7
  timeoutMs: number;
8
+ pluginRoot?: string;
8
9
  }
9
10
  export interface CommandExecutorResult {
10
11
  decision: HookDecision;
@@ -14,17 +14,19 @@ export interface ResolvedCommandHook {
14
14
  type: 'command';
15
15
  command: string;
16
16
  timeoutMs: number;
17
+ pluginRoot?: string;
17
18
  }
18
19
  export interface ResolvedMatcherGroup {
19
20
  matcher?: string;
20
21
  hooks: ResolvedCommandHook[];
21
- tier?: 'user-global' | 'project-local';
22
+ tier?: 'user-global' | 'project-local' | 'plugin';
22
23
  }
23
24
  export type ResolvedHooksConfig = Partial<Record<HarnessHookEvent, ResolvedMatcherGroup[]>>;
24
25
  export interface LoadedHooksConfig {
25
26
  hooks: ResolvedHooksConfig;
26
27
  userGlobalEnabled: boolean;
27
28
  allowProjectHooks: boolean;
29
+ pluginHooksEnabled: boolean;
28
30
  sources: string[];
29
31
  warnings: string[];
30
32
  }
@@ -33,12 +35,18 @@ interface SingleFileResult {
33
35
  hooks: ResolvedHooksConfig;
34
36
  enableShellHooks: boolean;
35
37
  allowProjectHooks: boolean;
38
+ enablePluginHooks: boolean;
36
39
  sources: string[];
37
40
  warnings: string[];
38
41
  }
39
- export declare function loadHooksConfigFile(path: string, tier: 'user-global' | 'project-local'): SingleFileResult;
42
+ export declare function loadHooksConfigFile(path: string, tier: 'user-global' | 'project-local' | 'plugin', pluginRoot?: string): SingleFileResult;
43
+ export declare function discoverPluginHooksConfigs(pluginsRoot?: string): Array<{
44
+ path: string;
45
+ pluginRoot: string;
46
+ }>;
40
47
  export interface LoadHooksConfigOptions {
41
48
  cwd?: string;
49
+ pluginsDir?: string;
42
50
  }
43
51
  export declare function loadHooksConfig(opts?: LoadHooksConfigOptions): LoadedHooksConfig;
44
52
  export {};
@@ -14,6 +14,7 @@ export type { SubagentStatus, SubagentResult, SubagentTrace, SubagentHandle };
14
14
  export declare const DENY_ELICITATION: NonNullable<AgentConfig['onElicitation']>;
15
15
  export declare const SUBAGENT_DEFAULT_MAX_TOOL_USE_ITERATIONS = 50;
16
16
  export declare const SUBAGENT_DEFAULT_TIMEOUT_MS: number;
17
+ export declare function resolveSubagentTimeoutMs(): number;
17
18
  export declare const SUBAGENT_BACKGROUND_TIMEOUT_MS: number;
18
19
  export interface ForkParent {
19
20
  sessionId?: string;
@@ -26,6 +27,7 @@ export interface ForkSubagentOptions<T = unknown> {
26
27
  outputSchema?: ZodType<T>;
27
28
  agentType: string;
28
29
  parentId?: string;
30
+ promptHead?: string;
29
31
  denyElicitations?: boolean;
30
32
  phaseRole?: PhaseRole;
31
33
  }
@@ -96,6 +96,7 @@ export declare const HookDecisionPayloadSchema: z.ZodObject<{
96
96
  unrecognised: "unrecognised";
97
97
  decline: "decline";
98
98
  cancel: "cancel";
99
+ "hard-block": "hard-block";
99
100
  }>>;
100
101
  }, z.core.$strip>;
101
102
  export declare const SubagentStartedPayloadSchema: z.ZodObject<{
@@ -105,6 +106,8 @@ export declare const SubagentStartedPayloadSchema: z.ZodObject<{
105
106
  model: z.ZodString;
106
107
  allowedTools: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
107
108
  systemPromptHash: z.ZodOptional<z.ZodString>;
109
+ promptHead: z.ZodOptional<z.ZodString>;
110
+ agentType: z.ZodOptional<z.ZodString>;
108
111
  }, z.core.$strip>;
109
112
  export declare const SubagentSucceededPayloadSchema: z.ZodObject<{
110
113
  transition: z.ZodLiteral<"succeeded">;
@@ -121,6 +124,15 @@ export declare const SubagentFailedPayloadSchema: z.ZodObject<{
121
124
  errorClass: z.ZodString;
122
125
  errorMessage: z.ZodString;
123
126
  partialOutputBytes: z.ZodNumber;
127
+ failureClass: z.ZodOptional<z.ZodEnum<{
128
+ abort: "abort";
129
+ "policy-refusal": "policy-refusal";
130
+ timeout: "timeout";
131
+ "permission-denied": "permission-denied";
132
+ "hook-block": "hook-block";
133
+ "elicitation-declined": "elicitation-declined";
134
+ "denial-breaker": "denial-breaker";
135
+ }>>;
124
136
  }, z.core.$strip>;
125
137
  export declare const SubagentCancelledPayloadSchema: z.ZodObject<{
126
138
  transition: z.ZodLiteral<"cancelled">;
@@ -129,6 +141,7 @@ export declare const SubagentCancelledPayloadSchema: z.ZodObject<{
129
141
  cascade: "cascade";
130
142
  explicit: "explicit";
131
143
  }>;
144
+ timeout: z.ZodOptional<z.ZodBoolean>;
132
145
  }, z.core.$strip>;
133
146
  export declare const SubagentLifecyclePayloadSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
134
147
  transition: z.ZodLiteral<"started">;
@@ -137,6 +150,8 @@ export declare const SubagentLifecyclePayloadSchema: z.ZodDiscriminatedUnion<[z.
137
150
  model: z.ZodString;
138
151
  allowedTools: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
139
152
  systemPromptHash: z.ZodOptional<z.ZodString>;
153
+ promptHead: z.ZodOptional<z.ZodString>;
154
+ agentType: z.ZodOptional<z.ZodString>;
140
155
  }, z.core.$strip>, z.ZodObject<{
141
156
  transition: z.ZodLiteral<"succeeded">;
142
157
  subagentId: z.ZodString;
@@ -151,6 +166,15 @@ export declare const SubagentLifecyclePayloadSchema: z.ZodDiscriminatedUnion<[z.
151
166
  errorClass: z.ZodString;
152
167
  errorMessage: z.ZodString;
153
168
  partialOutputBytes: z.ZodNumber;
169
+ failureClass: z.ZodOptional<z.ZodEnum<{
170
+ abort: "abort";
171
+ "policy-refusal": "policy-refusal";
172
+ timeout: "timeout";
173
+ "permission-denied": "permission-denied";
174
+ "hook-block": "hook-block";
175
+ "elicitation-declined": "elicitation-declined";
176
+ "denial-breaker": "denial-breaker";
177
+ }>>;
154
178
  }, z.core.$strip>, z.ZodObject<{
155
179
  transition: z.ZodLiteral<"cancelled">;
156
180
  subagentId: z.ZodString;
@@ -158,6 +182,7 @@ export declare const SubagentLifecyclePayloadSchema: z.ZodDiscriminatedUnion<[z.
158
182
  cascade: "cascade";
159
183
  explicit: "explicit";
160
184
  }>;
185
+ timeout: z.ZodOptional<z.ZodBoolean>;
161
186
  }, z.core.$strip>], "transition">;
162
187
  export declare const BackgroundAgentStartedPayloadSchema: z.ZodObject<{
163
188
  transition: z.ZodLiteral<"started">;
@@ -560,6 +585,7 @@ export declare const TraceEventInputSchema: z.ZodDiscriminatedUnion<[z.ZodObject
560
585
  unrecognised: "unrecognised";
561
586
  decline: "decline";
562
587
  cancel: "cancel";
588
+ "hard-block": "hard-block";
563
589
  }>>;
564
590
  }, z.core.$strip>;
565
591
  }, z.core.$strip>, z.ZodObject<{
@@ -571,6 +597,8 @@ export declare const TraceEventInputSchema: z.ZodDiscriminatedUnion<[z.ZodObject
571
597
  model: z.ZodString;
572
598
  allowedTools: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
573
599
  systemPromptHash: z.ZodOptional<z.ZodString>;
600
+ promptHead: z.ZodOptional<z.ZodString>;
601
+ agentType: z.ZodOptional<z.ZodString>;
574
602
  }, z.core.$strip>, z.ZodObject<{
575
603
  transition: z.ZodLiteral<"succeeded">;
576
604
  subagentId: z.ZodString;
@@ -585,6 +613,15 @@ export declare const TraceEventInputSchema: z.ZodDiscriminatedUnion<[z.ZodObject
585
613
  errorClass: z.ZodString;
586
614
  errorMessage: z.ZodString;
587
615
  partialOutputBytes: z.ZodNumber;
616
+ failureClass: z.ZodOptional<z.ZodEnum<{
617
+ abort: "abort";
618
+ "policy-refusal": "policy-refusal";
619
+ timeout: "timeout";
620
+ "permission-denied": "permission-denied";
621
+ "hook-block": "hook-block";
622
+ "elicitation-declined": "elicitation-declined";
623
+ "denial-breaker": "denial-breaker";
624
+ }>>;
588
625
  }, z.core.$strip>, z.ZodObject<{
589
626
  transition: z.ZodLiteral<"cancelled">;
590
627
  subagentId: z.ZodString;
@@ -592,6 +629,7 @@ export declare const TraceEventInputSchema: z.ZodDiscriminatedUnion<[z.ZodObject
592
629
  cascade: "cascade";
593
630
  explicit: "explicit";
594
631
  }>;
632
+ timeout: z.ZodOptional<z.ZodBoolean>;
595
633
  }, z.core.$strip>], "transition">;
596
634
  }, z.core.$strip>, z.ZodObject<{
597
635
  kind: z.ZodLiteral<"background_agent">;
@@ -854,6 +892,7 @@ export declare const TraceEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
854
892
  unrecognised: "unrecognised";
855
893
  decline: "decline";
856
894
  cancel: "cancel";
895
+ "hard-block": "hard-block";
857
896
  }>>;
858
897
  }, z.core.$strip>;
859
898
  }, z.core.$strip>, z.ZodObject<{
@@ -867,6 +906,8 @@ export declare const TraceEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
867
906
  model: z.ZodString;
868
907
  allowedTools: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
869
908
  systemPromptHash: z.ZodOptional<z.ZodString>;
909
+ promptHead: z.ZodOptional<z.ZodString>;
910
+ agentType: z.ZodOptional<z.ZodString>;
870
911
  }, z.core.$strip>, z.ZodObject<{
871
912
  transition: z.ZodLiteral<"succeeded">;
872
913
  subagentId: z.ZodString;
@@ -881,6 +922,15 @@ export declare const TraceEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
881
922
  errorClass: z.ZodString;
882
923
  errorMessage: z.ZodString;
883
924
  partialOutputBytes: z.ZodNumber;
925
+ failureClass: z.ZodOptional<z.ZodEnum<{
926
+ abort: "abort";
927
+ "policy-refusal": "policy-refusal";
928
+ timeout: "timeout";
929
+ "permission-denied": "permission-denied";
930
+ "hook-block": "hook-block";
931
+ "elicitation-declined": "elicitation-declined";
932
+ "denial-breaker": "denial-breaker";
933
+ }>>;
884
934
  }, z.core.$strip>, z.ZodObject<{
885
935
  transition: z.ZodLiteral<"cancelled">;
886
936
  subagentId: z.ZodString;
@@ -888,6 +938,7 @@ export declare const TraceEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
888
938
  cascade: "cascade";
889
939
  explicit: "explicit";
890
940
  }>;
941
+ timeout: z.ZodOptional<z.ZodBoolean>;
891
942
  }, z.core.$strip>], "transition">;
892
943
  }, z.core.$strip>, z.ZodObject<{
893
944
  ts: z.ZodString;
@@ -24,7 +24,7 @@ export interface ToolCallCompletedPayload {
24
24
  }
25
25
  export type ToolCallPayload = ToolCallStartedPayload | ToolCallCompletedPayload;
26
26
  export type HookEventName = 'PreToolUse' | 'PostToolUse' | 'PostToolUseFailure' | 'SessionStart' | 'SessionEnd' | 'SubagentStart' | 'SubagentStop';
27
- export type AfkApprovalOutcome = 'approved' | 'denied' | 'unrecognised' | 'timeout' | 'decline' | 'cancel';
27
+ export type AfkApprovalOutcome = 'approved' | 'denied' | 'unrecognised' | 'timeout' | 'decline' | 'cancel' | 'hard-block';
28
28
  export interface HookDecisionPayload {
29
29
  hookEvent: HookEventName;
30
30
  decision?: 'block' | 'approve';
@@ -41,6 +41,8 @@ export interface SubagentStartedPayload {
41
41
  model: string;
42
42
  allowedTools?: readonly string[];
43
43
  systemPromptHash?: string;
44
+ promptHead?: string;
45
+ agentType?: string;
44
46
  }
45
47
  export interface SubagentSucceededPayload {
46
48
  transition: 'succeeded';
@@ -57,11 +59,13 @@ export interface SubagentFailedPayload {
57
59
  errorClass: string;
58
60
  errorMessage: string;
59
61
  partialOutputBytes: number;
62
+ failureClass?: ToolFailureClass;
60
63
  }
61
64
  export interface SubagentCancelledPayload {
62
65
  transition: 'cancelled';
63
66
  subagentId: string;
64
67
  source: 'cascade' | 'explicit';
68
+ timeout?: boolean;
65
69
  }
66
70
  export type SubagentLifecyclePayload = SubagentStartedPayload | SubagentSucceededPayload | SubagentFailedPayload | SubagentCancelledPayload;
67
71
  export interface BackgroundAgentStartedPayload {
@@ -55,6 +55,7 @@ export interface CliConfig {
55
55
  maxSummaryCallsPerSession?: number;
56
56
  hooks?: RawHooksConfig;
57
57
  enableShellHooks?: boolean;
58
+ enablePluginHooks?: boolean;
58
59
  importFrom?: ImportFromConfig;
59
60
  }
60
61
  export interface ModelSlotConfigEntry {
@@ -115,6 +116,7 @@ export interface ConfigFileSchema {
115
116
  maxSummaryCallsPerSession?: number;
116
117
  hooks?: RawHooksConfig;
117
118
  enableShellHooks?: boolean;
119
+ enablePluginHooks?: boolean;
118
120
  importFrom?: Partial<Record<ImportSourceBinary, boolean | {
119
121
  plugins?: boolean;
120
122
  skills?: boolean;