agent-afk 5.266.2 → 5.267.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.
@@ -21,6 +21,7 @@ export interface ParsedWhatifArgs {
21
21
  options: WhatifFlagOptions;
22
22
  yes: boolean;
23
23
  json: boolean;
24
+ force: boolean;
24
25
  }
25
26
  export type ParseResult = ParsedWhatifArgs | string;
26
27
  export declare function parseWhatifArgs(argv: string[]): ParseResult;
@@ -1 +1 @@
1
- export declare const WHATIF_USAGE = "afk whatif \u2014 predict the behavioural impact of a proposed change.\n\nUSAGE\n afk whatif [change text...] [flags]\n /whatif [change text...] [flags]\n\nEXAMPLES\n # Plain English \u2014 compiled to a ChangeSpec, confirmed before running\n afk whatif \"turn off auto-routing\"\n afk whatif \"always ask before using tools\"\n\n # Explicit flags (can be combined and repeated)\n afk whatif --append \"Always ask a clarifying question before running tools.\"\n afk whatif --model claude-haiku-4-5 --verify\n afk whatif --memory-add \"prefers pnpm test:file\" --memory-category preference\n\n # Load a prepared ChangeSpec file\n afk whatif --spec ./my-change.json\n\n # Quick single-turn estimate\n afk whatif \"disable diagnose skill\" --quick\n\n # Full verification with custom judge and budget\n afk whatif --append \"Never use bash\" --verify --judge claude --max-usd 3\n\nCHANGE FLAGS (accumulate in order)\n --append <text> Append text to your AFK.md (user scope)\n --append-project <text> Append text to project AFK.md\n --file <path>=<localfile> Set a file (path: home:<rel> or project:<rel>)\n --hot <localfile> Replace HOT.md with a local file's content\n --memory-add <text> Add a memory fact\n --memory-category <cat> Category for the next --memory-add\n (preference|convention|decision|learning; default: preference)\n --memory-remove <id> Remove a memory fact by numeric id\n --disable-skill <name> Disable a skill by name\n --disable-plugin <name> Disable a plugin by name\n --model <id> Test a different candidate model\n --effort <level> Test a different effort level\n --env KEY=VALUE Set an env var in the candidate sandbox\n --spec <file.json> Load a full ChangeSpec from a JSON file\n\nRUN OPTIONS\n --agent-model <id> Model the agent under test uses (default: current)\n --analyst-model <id> Model for compile/predict/judge (default: sonnet)\n --verify Run episodes and verify predictions empirically\n --quick Single-turn episodes (sets --max-turns 1)\n --turns <n> Real turns to replay (default: 12)\n --samples <n> Samples per episode per environment (default: 3)\n --max-usd <n> Budget cap in USD (default: 5)\n --judge auto|jev|claude Judge to use (default: auto)\n --concurrency <n> Parallel episodes (default: 4)\n --max-turns <n> Max turns per episode (default: 3)\n --timeout <sec> Episode timeout in seconds (default: 180)\n --keep-sandboxes Keep sandbox directories after run\n --yes Skip confirmation of compiled spec\n --json Print results as JSON to stdout\n\nENV VARS (episode behaviour)\n AFK_WHATIF_KEEP_CONTEXT_HOOKS=1\n Keep SessionStart and UserPromptSubmit hooks enabled inside episodes.\n By default those hooks are disabled so both arms see byte-identical\n first user messages. Set this when your change specifically tests\n context-injecting hook behaviour. The engine sets it automatically\n when the change spec targets hooks or plugins (disable-plugin, or a\n file change to afk.config.json or a hooks.json manifest).\n";
1
+ export declare const WHATIF_USAGE = "afk whatif \u2014 predict the behavioural impact of a proposed change.\n\nUSAGE\n afk whatif [change text...] [flags]\n /whatif [change text...] [flags]\n\nEXAMPLES\n # Plain English \u2014 compiled to a ChangeSpec, confirmed before running\n afk whatif \"turn off auto-routing\"\n afk whatif \"always ask before using tools\"\n\n # Explicit flags (can be combined and repeated)\n afk whatif --append \"Always ask a clarifying question before running tools.\"\n afk whatif --model claude-haiku-4-5 --verify\n afk whatif --memory-add \"prefers pnpm test:file\" --memory-category preference\n\n # Load a prepared ChangeSpec file\n afk whatif --spec ./my-change.json\n\n # Quick single-turn estimate\n afk whatif \"disable diagnose skill\" --quick\n\n # Full verification with custom judge and budget\n afk whatif --append \"Never use bash\" --verify --judge claude --max-usd 3\n\nCHANGE FLAGS (accumulate in order)\n --append <text> Append text to your AFK.md (user scope)\n --append-project <text> Append text to project AFK.md\n --file <path>=<localfile> Set a file (path: home:<rel> or project:<rel>)\n --hot <localfile> Replace HOT.md with a local file's content\n --memory-add <text> Add a memory fact\n --memory-category <cat> Category for the next --memory-add\n (preference|convention|decision|learning; default: preference)\n --memory-remove <id> Remove a memory fact by numeric id\n --disable-skill <name> Disable a skill by name\n --disable-plugin <name> Disable a plugin by name\n --model <id> Test a different candidate model\n --effort <level> Test a different effort level\n --env KEY=VALUE Set an env var in the candidate sandbox\n --spec <file.json> Load a full ChangeSpec from a JSON file\n\nRUN OPTIONS\n --agent-model <id> Model the agent under test uses (default: current)\n --analyst-model <id> Model for compile/predict/judge (default: sonnet)\n --verify Run episodes and verify predictions empirically\n --quick Single-turn episodes (sets --max-turns 1)\n --turns <n> Real turns to replay (default: 12)\n --samples <n> Samples per episode per environment (default: 3)\n --max-usd <n> Budget cap in USD (default: 5)\n --judge auto|jev|claude Judge to use (default: auto)\n --concurrency <n> Parallel episodes (default: 4)\n --max-turns <n> Max turns per episode (default: 3)\n --timeout <sec> Episode timeout in seconds (default: 180)\n --keep-sandboxes Keep sandbox directories after run\n --yes Skip confirmation of compiled spec\n --force Bypass the MDE underpowered gate (--verify only)\n --json Print results as JSON to stdout\n\nENV VARS (episode behaviour)\n AFK_WHATIF_KEEP_CONTEXT_HOOKS=1\n Keep SessionStart and UserPromptSubmit hooks enabled inside episodes.\n By default those hooks are disabled so both arms see byte-identical\n first user messages. Set this when your change specifically tests\n context-injecting hook behaviour. The engine sets it automatically\n when the change spec targets hooks or plugins (disable-plugin, or a\n file change to afk.config.json or a hooks.json manifest).\n";
@@ -0,0 +1,9 @@
1
+ export declare const MDE_GATE_THRESHOLD = 0.2;
2
+ export declare const Z_ALPHA = 1.96;
3
+ export declare const Z_POWER = 0.8416;
4
+ export declare function mdeForN(n: number): number;
5
+ export declare function nForMde(mde: number): number;
6
+ export declare function mdePreflightLine(probesPerPrediction: number, targetMde?: number): string;
7
+ export declare function mdeLimitLine(n: number, label: string): string | undefined;
8
+ export declare function isUnderpowered(minProbesPerPrediction: number): boolean;
9
+ export declare function mdeGateRefusedMessage(minProbesPerPrediction: number): string;
@@ -1,9 +1,10 @@
1
1
  import type { ThemePalette } from '../cli/palette.js';
2
- import type { WhatifReport } from './types.js';
2
+ import type { VerifiedPrediction, WhatifReport } from './types.js';
3
3
  export { buildHeadline } from './report.headline.js';
4
4
  export declare function renderMarkdown(report: WhatifReport): string;
5
5
  export declare function renderTerminal(report: WhatifReport, palette: ThemePalette): string[];
6
6
  export declare function standardLimits(opts: {
7
7
  verified: boolean;
8
8
  judgeExternal: boolean;
9
+ verifiedPredictions?: VerifiedPrediction[];
9
10
  }): string[];
@@ -4,6 +4,10 @@ export declare class WhatifBudgetError extends Error {
4
4
  readonly maxUsd: number;
5
5
  constructor(estimateUsd: number, maxUsd: number);
6
6
  }
7
+ export declare class WhatifMdeError extends Error {
8
+ readonly episodesPerArm: number;
9
+ constructor(minProbesPerPrediction: number);
10
+ }
7
11
  export declare function runWhatif(options: WhatifOptions & {
8
12
  sessionsDir?: string;
9
13
  }, deps: WhatifDeps): Promise<WhatifReport>;
@@ -1,8 +1,11 @@
1
- import type { Prediction, RateComparison, Verdict } from './types.js';
1
+ import type { Prediction, RateComparison, VerifiedPrediction, Verdict } from './types.js';
2
2
  export declare function compareRates(baseline: number[], candidate: number[]): RateComparison;
3
3
  export declare const EQUIVALENCE_MARGIN = 0.05;
4
4
  export declare function verdictFor(pred: Prediction, rates: RateComparison): Verdict;
5
5
  export declare function predictionAccuracy(verified: ReadonlyArray<{
6
6
  verdict: Verdict;
7
7
  }>): number | undefined;
8
+ export declare const CROSS_CHECK_MIN_AGREEMENT = 0.75;
9
+ export declare const CROSS_CHECK_MIN_ITEMS = 5;
10
+ export declare function applyAgreementDowngrade(vp: VerifiedPrediction, mainScores: number[], crossScores: number[]): VerifiedPrediction;
8
11
  export declare function agreementRate(a: number[], b: number[]): number;
@@ -193,6 +193,9 @@ export interface VerifiedPrediction {
193
193
  verdict: Verdict;
194
194
  scope?: PredictionScope;
195
195
  unobservableReason?: string;
196
+ crossCheckAgreement?: number;
197
+ crossCheckTooFew?: boolean;
198
+ verdictReason?: 'judges disagree';
196
199
  }
197
200
  export interface DiscoveredDifference {
198
201
  id: string;
@@ -1,5 +1,5 @@
1
1
  import type { AgentRunner, ChangeSpec, Judge } from './types.js';
2
- export type WhatifStage = 'compile' | 'sandbox' | 'snapshot' | 'predict' | 'episodes' | 'run' | 'judge' | 'discover' | 'report';
2
+ export type WhatifStage = 'compile' | 'sandbox' | 'snapshot' | 'predict' | 'episodes' | 'preflight' | 'run' | 'judge' | 'discover' | 'report';
3
3
  export interface WhatifProgress {
4
4
  stage: WhatifStage;
5
5
  message: string;
@@ -31,6 +31,7 @@ export interface WhatifOptions {
31
31
  maxTurns: number;
32
32
  episodeTimeoutMs: number;
33
33
  keepSandboxes: boolean;
34
+ force?: boolean;
34
35
  }
35
36
  export interface WhatifDeps {
36
37
  runner: AgentRunner;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-afk",
3
- "version": "5.266.2",
3
+ "version": "5.267.0",
4
4
  "description": "Open-source coding-agent harness you can actually change — own the loop (prompts, gates, routing, skills, terminal states), use any model, run long tasks while you're away.",
5
5
  "main": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",