agent-afk 5.232.1 → 5.233.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/README.md CHANGED
@@ -19,23 +19,22 @@ Open source. Runs locally. Works with any model provider, including local models
19
19
 
20
20
  > ⭐ **Like the idea of an agent you can walk away from? [Star the repo](https://github.com/griffinwork40/agent-afk/stargazers)** -- it's the fastest way to help other people find it.
21
21
 
22
- ## Install
22
+ ## Quick Start
23
23
 
24
24
  ```bash
25
- npm install -g agent-afk
25
+ npm install -g agent-afk # Node ≥ 22 required
26
+ afk login # authenticate (auto-detects Claude Code / Codex creds)
27
+ afk doctor # verify everything works
28
+ afk chat "hello" # first real conversation
26
29
  ```
27
30
 
28
- Requires Node ≥ 22.
31
+ That's it. You're in.
29
32
 
30
- Smoke test:
33
+ **Try without installing:** `npx agent-afk chat "hello"` runs a one-shot turn with zero global install.
31
34
 
32
- ```bash
33
- afk --version # confirm the install (works before login)
34
- afk doctor # environment self-check
35
- afk chat "hello"
36
- ```
35
+ **Already using Claude Code or Codex?** `afk login` will detect your existing credentials automatically. Run `afk migrate` to import your plugins, skills, and MCP servers too -- it live-reads the source tool's dirs, so anything you install there keeps showing up in AFK with no re-run.
37
36
 
38
- **Already using Claude Code or Codex?** Run `afk migrate` — it imports your existing plugins, skills, and MCP servers. It doesn't copy files; it live-reads the source tool's dirs, so anything you install there keeps showing up in AFK with no re-run.
37
+ > 📖 **Full documentation at [docs.agentafk.com](https://docs.agentafk.com)** -- quickstart, configuration, model setup, surfaces, skills, and SDK reference.
39
38
 
40
39
  ## What you can do with it
41
40
 
@@ -231,7 +230,7 @@ With containment on (`default`), a file tool (read/write/edit/list/glob/grep) ta
231
230
 
232
231
  ## Troubleshooting
233
232
 
234
- **`invalid x-api-key` / `ANTHROPIC_API_KEY not found`** — run `afk doctor`. Confirm the key is set in your shell or in `~/.afk/config/afk.env`.
233
+ **`invalid x-api-key` / `ANTHROPIC_API_KEY not found`** — run `afk login` to authenticate interactively, or set the key manually: `export ANTHROPIC_API_KEY=sk-ant-...` (or add it to `~/.afk/config/afk.env`). Run `afk doctor` to confirm.
235
234
 
236
235
  **`Cannot send message: session is closed`** — the session timed out or was closed. Start a new one (`afk i` or a fresh `afk chat`).
237
236
 
@@ -0,0 +1,36 @@
1
+ export type ExecForBranchPrune = (file: string, args: string[], opts?: {
2
+ cwd?: string;
3
+ }) => Promise<{
4
+ stdout: string;
5
+ stderr: string;
6
+ }>;
7
+ export type PrState = 'open' | 'merged' | 'closed' | 'none';
8
+ export type BranchVerdict = 'prune' | 'keep' | 'error';
9
+ export interface BranchCandidate {
10
+ remoteBranch: string;
11
+ shortName: string;
12
+ prState: PrState;
13
+ commitsAhead: number;
14
+ verdict: BranchVerdict;
15
+ reason: string;
16
+ errorDetail?: string;
17
+ }
18
+ export interface BranchPruneResult {
19
+ candidates: BranchCandidate[];
20
+ deleted: string[];
21
+ warnings: string[];
22
+ dryRun: boolean;
23
+ }
24
+ export interface BranchPruneOptions {
25
+ execFn: ExecForBranchPrune;
26
+ remote?: string;
27
+ baseBranch?: string;
28
+ branchPrefix?: string;
29
+ dryRun?: boolean;
30
+ cwd?: string;
31
+ }
32
+ export declare function parseGhPrState(ghOutput: string): PrState;
33
+ export declare function parseCommitsAhead(revListOutput: string): number;
34
+ export declare function classify(prState: PrState, commitsAhead: number): Pick<BranchCandidate, 'verdict' | 'reason'>;
35
+ export declare function listRemoteBranches(execFn: ExecForBranchPrune, remote: string, branchPrefix: string, cwd: string): Promise<string[]>;
36
+ export declare function runBranchPrune(options: BranchPruneOptions): Promise<BranchPruneResult>;
@@ -1,4 +1,4 @@
1
- export { FACET_VERSION, SessionFacetSchema, StoredSessionInputSchema, FacetOutcomeSchema, SubagentPersistenceSchema, SubagentInvocationSchema, WorldChangesSchema, TokenBreakdownSchema, type SessionFacet, type StoredSessionInput, type ToolEventInput, type FacetOutcome, type SubagentInvocation, type WorldChanges, type TokenBreakdown, } from './schema.js';
1
+ export { FACET_VERSION, SessionFacetSchema, StoredSessionInputSchema, FacetOutcomeSchema, SubagentPersistenceSchema, SubagentInvocationSchema, WorldChangesSchema, TokenBreakdownSchema, ParallelDispatchStatsSchema, type SessionFacet, type StoredSessionInput, type ToolEventInput, type FacetOutcome, type SubagentInvocation, type WorldChanges, type TokenBreakdown, type ParallelDispatchStats, } from './schema.js';
2
2
  export { deriveSessionFacet, type DeriveOptions } from './derive.js';
3
3
  export { getOrDeriveFacet, loadStoredSession, listSessionIds, type FacetStoreOptions, } from './store.js';
4
4
  export { createFacetSessionEndHook } from './session-end-hook.js';
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- export declare const FACET_VERSION = 3;
2
+ export declare const FACET_VERSION = 4;
3
3
  export declare const ToolEventInputSchema: z.ZodObject<{
4
4
  toolName: z.ZodString;
5
5
  toolUseId: z.ZodOptional<z.ZodString>;
@@ -86,6 +86,14 @@ export declare const TokenBreakdownSchema: z.ZodObject<{
86
86
  cost_usd: z.ZodNumber;
87
87
  }, z.core.$strip>;
88
88
  export type TokenBreakdown = z.infer<typeof TokenBreakdownSchema>;
89
+ export declare const ParallelDispatchStatsSchema: z.ZodObject<{
90
+ total_tool_calls: z.ZodNumber;
91
+ parallel_tool_calls: z.ZodNumber;
92
+ parallel_turns: z.ZodNumber;
93
+ tool_turns: z.ZodNumber;
94
+ ratio: z.ZodNullable<z.ZodNumber>;
95
+ }, z.core.$strip>;
96
+ export type ParallelDispatchStats = z.infer<typeof ParallelDispatchStatsSchema>;
89
97
  export declare const SessionFacetSchema: z.ZodObject<{
90
98
  facet_version: z.ZodNumber;
91
99
  session_id: z.ZodString;
@@ -148,6 +156,13 @@ export declare const SessionFacetSchema: z.ZodObject<{
148
156
  cache_creation: z.ZodOptional<z.ZodNumber>;
149
157
  cost_usd: z.ZodNumber;
150
158
  }, z.core.$strip>>;
159
+ parallel_dispatch: z.ZodObject<{
160
+ total_tool_calls: z.ZodNumber;
161
+ parallel_tool_calls: z.ZodNumber;
162
+ parallel_turns: z.ZodNumber;
163
+ tool_turns: z.ZodNumber;
164
+ ratio: z.ZodNullable<z.ZodNumber>;
165
+ }, z.core.$strip>;
151
166
  decisions: z.ZodArray<z.ZodString>;
152
167
  evidence_pointers: z.ZodArray<z.ZodString>;
153
168
  }, z.core.$loose>;
@@ -0,0 +1,2 @@
1
+ import { Command } from 'commander';
2
+ export declare function registerBranchCommand(program: Command): void;
@@ -1,9 +1,12 @@
1
1
  import type { AgentSession } from '../../../agent/session.js';
2
- import type { SessionStats } from '../../slash/types.js';
2
+ import type { SessionStats, ToolEvent } from '../../slash/types.js';
3
+ import type { ContentBlockParam } from '@anthropic-ai/sdk/resources';
3
4
  import { type ImageAttachment } from '../../input/attachments.js';
4
5
  import type { InputSurfaceRefs } from '../../input/input-surface.js';
5
6
  import { type CompletionWriter, type ThinkingUiMode, type TurnHandles } from './shared.js';
6
7
  export { formatToolLine, formatToolResultLine, ToolLane } from './tool-lane.js';
8
+ export declare function buildAssistantContentBlocks(responseText: string, toolEvents: ToolEvent[]): ContentBlockParam[] | undefined;
9
+ export declare function buildUserContentBlocks(userText: string, toolEvents: ToolEvent[]): ContentBlockParam[] | undefined;
7
10
  export type { InputSurfaceRefs } from '../../input/input-surface.js';
8
11
  export declare function runTurn(input: {
9
12
  text: string;
@@ -1,6 +1,7 @@
1
1
  import type { ResponseMetadata } from '../../agent/types/message-types.js';
2
2
  import type { AgentModelInput } from '../../agent/types.js';
3
+ import type { ContentBlockParam } from '@anthropic-ai/sdk/resources';
3
4
  import type { SessionStats, ToolEvent, TurnRecord } from './types.js';
4
5
  export declare function createSessionStats(model: AgentModelInput): SessionStats;
5
6
  export declare function resetStats(stats: SessionStats): void;
6
- export declare function recordTurn(stats: SessionStats, userInput: string, assistantText: string, metadata: ResponseMetadata | undefined, toolEvents?: ToolEvent[]): TurnRecord;
7
+ export declare function recordTurn(stats: SessionStats, userInput: string, assistantText: string, metadata: ResponseMetadata | undefined, toolEvents?: ToolEvent[], userContentBlocks?: ContentBlockParam[], assistantContentBlocks?: ContentBlockParam[]): TurnRecord;