agent-afk 5.2.0 → 5.3.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.
- package/dist/agent/afk-mode-gate.d.ts +13 -2
- package/dist/agent/default-hook-registry.d.ts +2 -0
- package/dist/agent/elicitation-router.d.ts +2 -0
- package/dist/agent/trace/events.d.ts +27 -0
- package/dist/agent/trace/index.d.ts +1 -1
- package/dist/agent/trace/types.d.ts +3 -0
- package/dist/cli.mjs +415 -413
- package/dist/improve/schemas.d.ts +4 -4
- package/dist/index.mjs +2 -2
- package/dist/telegram.mjs +202 -200
- package/package.json +1 -1
|
@@ -1,3 +1,14 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { HookHandler } from './hooks.js';
|
|
2
2
|
import type { PermissionMode } from './types/sdk-types.js';
|
|
3
|
-
|
|
3
|
+
import type { ElicitationRequest, ElicitationResult } from './types/sdk-types.js';
|
|
4
|
+
import type { TraceWriter } from './trace/index.js';
|
|
5
|
+
export interface AfkModeGateOptions {
|
|
6
|
+
approvalTimeoutMs?: number;
|
|
7
|
+
promptForApproval?: boolean;
|
|
8
|
+
route?: (request: ElicitationRequest, options: {
|
|
9
|
+
signal: AbortSignal;
|
|
10
|
+
onActive?: () => void;
|
|
11
|
+
}) => Promise<ElicitationResult>;
|
|
12
|
+
traceWriter?: TraceWriter;
|
|
13
|
+
}
|
|
14
|
+
export declare function createAfkModeGate(getMode: () => PermissionMode, cwd?: string, getCwd?: () => string | undefined, opts?: AfkModeGateOptions): HookHandler;
|
|
@@ -2,6 +2,7 @@ import { type HookRegistry } from './hooks.js';
|
|
|
2
2
|
import { MemoryStore } from './memory/index.js';
|
|
3
3
|
import type { GrantManager } from '../cli/slash/commands/allow-dir.js';
|
|
4
4
|
import type { PermissionMode } from './types/sdk-types.js';
|
|
5
|
+
import type { TraceWriter } from './trace/index.js';
|
|
5
6
|
import type { LoadedHooksConfig } from './hooks/config-loader.js';
|
|
6
7
|
export interface SubagentCompleteInfo {
|
|
7
8
|
subagentId: string;
|
|
@@ -20,4 +21,5 @@ export declare function _resetWarningForTests(): void;
|
|
|
20
21
|
export declare function createDefaultHookRegistry(onSubagentComplete?: (info: SubagentCompleteInfo) => void, surface?: string, memoryStore?: MemoryStore, getPermissionMode?: () => PermissionMode, hookConfig?: LoadedHooksConfig, agentOptions?: {
|
|
21
22
|
cwd?: string;
|
|
22
23
|
sessionId?: string;
|
|
24
|
+
traceWriter?: TraceWriter;
|
|
23
25
|
}, getCwd?: () => string | undefined): DefaultHookRegistryResult;
|
|
@@ -11,10 +11,12 @@ declare class ElicitationRouter {
|
|
|
11
11
|
pendingCount(): number;
|
|
12
12
|
route(request: ElicitationRequest, options: {
|
|
13
13
|
signal: AbortSignal;
|
|
14
|
+
onActive?: () => void;
|
|
14
15
|
}): Promise<ElicitationResult>;
|
|
15
16
|
}
|
|
16
17
|
export declare const elicitationRouter: ElicitationRouter;
|
|
17
18
|
export declare function routeElicitation(request: ElicitationRequest, options: {
|
|
18
19
|
signal: AbortSignal;
|
|
20
|
+
onActive?: () => void;
|
|
19
21
|
}): Promise<ElicitationResult>;
|
|
20
22
|
export {};
|
|
@@ -81,6 +81,15 @@ export declare const HookDecisionPayloadSchema: z.ZodObject<{
|
|
|
81
81
|
reason: z.ZodOptional<z.ZodString>;
|
|
82
82
|
blockedTool: z.ZodOptional<z.ZodString>;
|
|
83
83
|
injectedContextBytes: z.ZodOptional<z.ZodNumber>;
|
|
84
|
+
durationMs: z.ZodOptional<z.ZodNumber>;
|
|
85
|
+
approvalOutcome: z.ZodOptional<z.ZodEnum<{
|
|
86
|
+
timeout: "timeout";
|
|
87
|
+
approved: "approved";
|
|
88
|
+
denied: "denied";
|
|
89
|
+
unrecognised: "unrecognised";
|
|
90
|
+
decline: "decline";
|
|
91
|
+
cancel: "cancel";
|
|
92
|
+
}>>;
|
|
84
93
|
}, z.core.$strip>;
|
|
85
94
|
export declare const SubagentStartedPayloadSchema: z.ZodObject<{
|
|
86
95
|
transition: z.ZodLiteral<"started">;
|
|
@@ -510,6 +519,15 @@ export declare const TraceEventInputSchema: z.ZodDiscriminatedUnion<[z.ZodObject
|
|
|
510
519
|
reason: z.ZodOptional<z.ZodString>;
|
|
511
520
|
blockedTool: z.ZodOptional<z.ZodString>;
|
|
512
521
|
injectedContextBytes: z.ZodOptional<z.ZodNumber>;
|
|
522
|
+
durationMs: z.ZodOptional<z.ZodNumber>;
|
|
523
|
+
approvalOutcome: z.ZodOptional<z.ZodEnum<{
|
|
524
|
+
timeout: "timeout";
|
|
525
|
+
approved: "approved";
|
|
526
|
+
denied: "denied";
|
|
527
|
+
unrecognised: "unrecognised";
|
|
528
|
+
decline: "decline";
|
|
529
|
+
cancel: "cancel";
|
|
530
|
+
}>>;
|
|
513
531
|
}, z.core.$strip>;
|
|
514
532
|
}, z.core.$strip>, z.ZodObject<{
|
|
515
533
|
kind: z.ZodLiteral<"subagent_lifecycle">;
|
|
@@ -781,6 +799,15 @@ export declare const TraceEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
781
799
|
reason: z.ZodOptional<z.ZodString>;
|
|
782
800
|
blockedTool: z.ZodOptional<z.ZodString>;
|
|
783
801
|
injectedContextBytes: z.ZodOptional<z.ZodNumber>;
|
|
802
|
+
durationMs: z.ZodOptional<z.ZodNumber>;
|
|
803
|
+
approvalOutcome: z.ZodOptional<z.ZodEnum<{
|
|
804
|
+
timeout: "timeout";
|
|
805
|
+
approved: "approved";
|
|
806
|
+
denied: "denied";
|
|
807
|
+
unrecognised: "unrecognised";
|
|
808
|
+
decline: "decline";
|
|
809
|
+
cancel: "cancel";
|
|
810
|
+
}>>;
|
|
784
811
|
}, z.core.$strip>;
|
|
785
812
|
}, z.core.$strip>, z.ZodObject<{
|
|
786
813
|
ts: z.ZodString;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type { AbortOrigin, AbortPayload, BackgroundAgentCancelledPayload, BackgroundAgentCompletedPayload, BackgroundAgentFailedPayload, BackgroundAgentJoinedPayload, BackgroundAgentPayload, BackgroundAgentStartedPayload, BrowserActAction, BrowserEventPayload, BrowserEventTarget, BrowserEventTool, BudgetPayload, ClaimPayload, ClosurePayload, ClosureReason, CompactionPayloadInput, CompactionPayloadPersisted, CompactionSidecarRef, CompactionTrigger, HookDecisionPayload, HookEventName, SessionPhasePayload, SessionPhaseName, SessionSealedPayload, SubagentCancelledPayload, SubagentFailedPayload, SubagentLifecyclePayload, SubagentStartedPayload, SubagentSucceededPayload, ToolCallCompletedPayload, ToolCallPayload, ToolCallStartedPayload, TraceEvent, TraceEventInput, TraceEventKind, } from './types.js';
|
|
1
|
+
export type { AfkApprovalOutcome, AbortOrigin, AbortPayload, BackgroundAgentCancelledPayload, BackgroundAgentCompletedPayload, BackgroundAgentFailedPayload, BackgroundAgentJoinedPayload, BackgroundAgentPayload, BackgroundAgentStartedPayload, BrowserActAction, BrowserEventPayload, BrowserEventTarget, BrowserEventTool, BudgetPayload, ClaimPayload, ClosurePayload, ClosureReason, CompactionPayloadInput, CompactionPayloadPersisted, CompactionSidecarRef, CompactionTrigger, HookDecisionPayload, HookEventName, SessionPhasePayload, SessionPhaseName, SessionSealedPayload, SubagentCancelledPayload, SubagentFailedPayload, SubagentLifecyclePayload, SubagentStartedPayload, SubagentSucceededPayload, ToolCallCompletedPayload, ToolCallPayload, ToolCallStartedPayload, TraceEvent, TraceEventInput, TraceEventKind, } from './types.js';
|
|
2
2
|
export { AbortOriginSchema, AbortPayloadSchema, BackgroundAgentCancelledPayloadSchema, BackgroundAgentCompletedPayloadSchema, BackgroundAgentFailedPayloadSchema, BackgroundAgentJoinedPayloadSchema, BackgroundAgentPayloadSchema, BackgroundAgentStartedPayloadSchema, BrowserActActionSchema, BrowserEventPayloadSchema, BrowserEventTargetSchema, BrowserEventToolSchema, BudgetPayloadSchema, ClaimPayloadSchema, ClosurePayloadSchema, ClosureReasonSchema, CompactionPayloadInputSchema, CompactionPayloadPersistedSchema, CompactionSidecarRefSchema, CompactionTriggerSchema, HookDecisionPayloadSchema, HookEventNameSchema, SessionPhaseNameSchema, SessionPhasePayloadSchema, SessionSealedPayloadSchema, SubagentCancelledPayloadSchema, SubagentFailedPayloadSchema, SubagentLifecyclePayloadSchema, SubagentStartedPayloadSchema, SubagentSucceededPayloadSchema, ToolCallCompletedPayloadSchema, ToolCallPayloadSchema, ToolCallStartedPayloadSchema, TraceEventInputSchema, TraceEventSchema, } from './events.js';
|
|
3
3
|
export { InMemoryTraceWriter, NdjsonTraceWriter, } from './writer.js';
|
|
4
4
|
export type { NdjsonTraceWriterOptions, TraceWriter } from './writer.js';
|
|
@@ -22,12 +22,15 @@ export interface ToolCallCompletedPayload {
|
|
|
22
22
|
}
|
|
23
23
|
export type ToolCallPayload = ToolCallStartedPayload | ToolCallCompletedPayload;
|
|
24
24
|
export type HookEventName = 'PreToolUse' | 'PostToolUse' | 'PostToolUseFailure' | 'SessionStart' | 'SessionEnd' | 'SubagentStart' | 'SubagentStop';
|
|
25
|
+
export type AfkApprovalOutcome = 'approved' | 'denied' | 'unrecognised' | 'timeout' | 'decline' | 'cancel';
|
|
25
26
|
export interface HookDecisionPayload {
|
|
26
27
|
hookEvent: HookEventName;
|
|
27
28
|
decision?: 'block' | 'approve';
|
|
28
29
|
reason?: string;
|
|
29
30
|
blockedTool?: string;
|
|
30
31
|
injectedContextBytes?: number;
|
|
32
|
+
durationMs?: number;
|
|
33
|
+
approvalOutcome?: AfkApprovalOutcome;
|
|
31
34
|
}
|
|
32
35
|
export interface SubagentStartedPayload {
|
|
33
36
|
transition: 'started';
|