agent-afk 5.26.1 → 5.26.3

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.
@@ -0,0 +1,7 @@
1
+ import type { HookContext, HookDecision } from './hooks.js';
2
+ export declare const ASK_QUESTION_GATE_REASON: string;
3
+ export interface AskQuestionGateOptions {
4
+ hasHandler?: () => boolean;
5
+ notify?: (message: string) => void;
6
+ }
7
+ export declare function createAskQuestionGate(options?: AskQuestionGateOptions): (context: HookContext) => HookDecision;
@@ -8,6 +8,7 @@ declare class ElicitationRouter {
8
8
  private queueDepth;
9
9
  install(handler: ElicitationHandler): void;
10
10
  uninstall(): void;
11
+ hasHandler(): boolean;
11
12
  pendingCount(): number;
12
13
  route(request: ElicitationRequest, options: {
13
14
  signal: AbortSignal;
@@ -0,0 +1,23 @@
1
+ import type { RawMessageStreamEvent } from '@anthropic-ai/sdk/resources';
2
+ import type { ProviderEvent } from '../../provider.js';
3
+ import type { AnthropicClientLike, ToolDispatcherLike, ToolCall, ToolResult, TranslateCtx } from './types.js';
4
+ export declare function fromArray<T>(arr: T[]): AsyncIterable<T>;
5
+ export declare function collect(gen: AsyncGenerator<ProviderEvent>): Promise<ProviderEvent[]>;
6
+ export declare const SESSION_ID = "sess_loop_test";
7
+ export declare const ctx: TranslateCtx;
8
+ export declare function baseUsage(): {
9
+ input_tokens: number;
10
+ output_tokens: number;
11
+ cache_creation_input_tokens: number;
12
+ cache_read_input_tokens: number;
13
+ };
14
+ export declare function makeTextStream(text: string, stopReason?: string): RawMessageStreamEvent[];
15
+ export declare function makeToolUseStream(toolId: string, toolName: string, inputJson: string): RawMessageStreamEvent[];
16
+ export declare function makeMultiToolUseStream(tools: Array<{
17
+ id: string;
18
+ name: string;
19
+ input: string;
20
+ }>): RawMessageStreamEvent[];
21
+ export declare function makeClient(streamFactory: () => AsyncIterable<RawMessageStreamEvent>): AnthropicClientLike;
22
+ export declare function makeDispatcher(executeFn: (call: ToolCall) => Promise<ToolResult>): ToolDispatcherLike;
23
+ export declare function makeBatchDispatcher(executeBatchFn: (calls: ToolCall[]) => Promise<ToolResult[]>): ToolDispatcherLike;
@@ -0,0 +1,11 @@
1
+ ---
2
+ name: diagnose
3
+ description: "Parallel root-cause analysis for bugs and failing tests. Use when a test fails, a bug is reported, or behavior is unexplained — dispatches sub-agents to form and validate hypotheses in isolated worktrees."
4
+ context: fork
5
+ ---
6
+
7
+ Gather context: read the failing test or bug description, relevant error output, and recent git changes. If no failing test exists yet, write a minimal reproducer test (or identify a concrete verification command) before proceeding — hypotheses need a pass/fail signal to validate against. Dispatch two sub-agents in parallel — one to search the codebase for code paths involved in the failure (`subagent_type: research-agent`, read-only), and one to check recent commits and diffs that could have introduced the regression (`subagent_type: general-purpose` — requires Bash for `git log`/`git diff`/`git show`). When both return, synthesize findings into 2–4 ranked hypotheses, each with a specific code location and proposed cause.
8
+
9
+ For each hypothesis, first create a dedicated git worktree with the `worktree` tool (`action: "create"`, one per hypothesis), then dispatch a sub-agent with its `cwd` set to that worktree's absolute path. This is how afk isolates a sub-agent to its own tree — the `agent` tool has NO `isolation` parameter, so parallel agents that omit `cwd` all inherit the same working tree and would contaminate each other's speculative fixes and test runs, invalidating the pass/fail attribution. Each sub-agent applies a minimal speculative fix, runs the test or verification command, then runs the broader related test suite to check for regressions. Run all hypothesis-testing agents in parallel, each in its own worktree; after collecting a result, remove that worktree with the `worktree` tool (`action: "remove"`). Collect results: which fixes passed, which didn't, and any regressions surfaced by the broader suite.
10
+
11
+ Report the validated root cause (the hypothesis whose fix passed), the speculative fix diff, and regression status from the broader test run. If no hypothesis passes, synthesize what was learned and form a second round of hypotheses. If the user approves the fix, apply it to the main worktree.
@@ -1,6 +1,5 @@
1
1
  import type { IAgentSession } from '../../agent/types.js';
2
2
  import '../../skills/mint/index.js';
3
- import '../../skills/diagnose/index.js';
4
3
  export interface RouteResult {
5
4
  handled: true;
6
5
  output: string;
@@ -0,0 +1,10 @@
1
+ import type { AgentSession } from '../../../agent/session.js';
2
+ import type { SlashCommand } from '../types.js';
3
+ import { type DiscoveredSkill } from './state.js';
4
+ export declare function makeForwardHandler(skill: DiscoveredSkill, flags?: readonly string[]): SlashCommand;
5
+ export declare function registerPluginSkills(session: AgentSession): Promise<number | null>;
6
+ export declare function getPluginShadowingNoticeLines(): string[];
7
+ export declare function autoRegisterPluginPassthroughs(session: AgentSession): Promise<{
8
+ skillCount: number | null;
9
+ agentCount: number | null;
10
+ }>;
@@ -0,0 +1,3 @@
1
+ export declare function harvestPluginSkillFlags(cacheRoot?: string): Map<string, string[]>;
2
+ export declare function harvestAllPluginSkillFlags(): Map<string, string[]>;
3
+ export declare function extractHintFromDescription(description: string): string | undefined;
@@ -0,0 +1,4 @@
1
+ import type { SlashCommand } from '../types.js';
2
+ import { type DiscoveredSkill } from './state.js';
3
+ export declare const initialSkillsCmd: SlashCommand;
4
+ export declare function makeDynamicSkillsCmd(plugins: DiscoveredSkill[]): SlashCommand;
@@ -0,0 +1,14 @@
1
+ import { type SkillManifestEntry } from '../../../agent/tools/skill-bridge.js';
2
+ import { type InstalledPlugin } from '../../../agent/plugins/inventory.js';
3
+ import type { SlashCommand } from '../types.js';
4
+ export declare function buildSourceBreakdown(entries: SkillManifestEntry[]): string;
5
+ export declare function computeSkillDelta(prev: ReadonlySet<string>, next: ReadonlySet<string>): {
6
+ added: string[];
7
+ removed: string[];
8
+ } | null;
9
+ export declare function formatSkillDelta(delta: {
10
+ added: string[];
11
+ removed: string[];
12
+ }): string;
13
+ export declare function buildPluginRows(plugins: InstalledPlugin[]): string[];
14
+ export declare const reloadPluginsCmd: SlashCommand;
@@ -0,0 +1,18 @@
1
+ export interface DiscoveredSkill {
2
+ name: string;
3
+ description: string;
4
+ argumentHint?: string;
5
+ }
6
+ export interface PluginCollision {
7
+ bare: string;
8
+ altSlash: string;
9
+ altDescription: string;
10
+ }
11
+ export interface PluginSkillsState {
12
+ discovered: DiscoveredSkill[];
13
+ collisions: PluginCollision[];
14
+ shadowedBareNames: Set<string>;
15
+ }
16
+ export declare let state: PluginSkillsState;
17
+ export declare function setState(next: PluginSkillsState): void;
18
+ export declare function bareName(name: string): string;
@@ -1,32 +1,5 @@
1
- import type { AgentSession } from '../../agent/session.js';
2
- import { type SkillManifestEntry } from '../../agent/tools/skill-bridge.js';
3
- import { type InstalledPlugin } from '../../agent/plugins/inventory.js';
4
- import type { SlashCommand } from './types.js';
5
- interface DiscoveredSkill {
6
- name: string;
7
- description: string;
8
- argumentHint?: string;
9
- }
10
- export declare function harvestPluginSkillFlags(cacheRoot?: string): Map<string, string[]>;
11
- export declare function extractHintFromDescription(description: string): string | undefined;
12
- export declare function makeForwardHandler(skill: DiscoveredSkill, flags?: readonly string[]): SlashCommand;
13
- export declare const initialSkillsCmd: SlashCommand;
14
- export declare function registerPluginSkills(session: AgentSession): Promise<number | null>;
15
- export declare function getPluginShadowingNoticeLines(): string[];
16
- export declare function autoRegisterPluginPassthroughs(session: AgentSession): Promise<{
17
- skillCount: number | null;
18
- agentCount: number | null;
19
- }>;
20
- export declare function buildSourceBreakdown(entries: SkillManifestEntry[]): string;
21
- export declare function computeSkillDelta(prev: ReadonlySet<string>, next: ReadonlySet<string>): {
22
- added: string[];
23
- removed: string[];
24
- } | null;
25
- export declare function formatSkillDelta(delta: {
26
- added: string[];
27
- removed: string[];
28
- }): string;
29
- export declare function buildPluginRows(plugins: InstalledPlugin[]): string[];
30
- export declare const reloadPluginsCmd: SlashCommand;
1
+ export { harvestPluginSkillFlags, extractHintFromDescription, } from './plugin-skills/flags.js';
2
+ export { initialSkillsCmd } from './plugin-skills/listing.js';
3
+ export { makeForwardHandler, registerPluginSkills, getPluginShadowingNoticeLines, autoRegisterPluginPassthroughs, } from './plugin-skills/dispatch.js';
4
+ export { buildSourceBreakdown, computeSkillDelta, formatSkillDelta, buildPluginRows, reloadPluginsCmd, } from './plugin-skills/reload.js';
31
5
  export declare function registerStaticPluginSkillCommands(): void;
32
- export {};