agent-afk 5.271.3 → 5.272.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.
@@ -15,6 +15,7 @@ export interface WhatifFlagOptions {
15
15
  keepSandboxes: boolean;
16
16
  probes?: number;
17
17
  maxPredictions?: number;
18
+ noBaselineSample?: boolean;
18
19
  }
19
20
  export interface ParsedWhatifArgs {
20
21
  flagChanges: Change[];
@@ -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 --probes <n> Synthetic probe episodes per prediction (1\u201312; default 6)\n --max-predictions <n> Max predictions to retain (1\u20138; default 3 when probes>2, else 8)\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";
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 --probes <n> Synthetic probe episodes per prediction (1\u201312; default 6)\n --max-predictions <n> Max predictions to retain (1\u20138; default 3 when probes>2, else 8)\n --keep-sandboxes Keep sandbox directories after run\n --no-baseline-sample Skip the baseline-sample preflight; use analyst estimate instead (#2511)\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,38 @@
1
+ import type { AgentRunner, Episode, Judge, Prediction, RunnerOptions, Environment, WhatifProgress } from './types.js';
2
+ export declare const BASELINE_SAMPLE_K = 3;
3
+ export interface PredictionBaselineSample {
4
+ predictionId: string;
5
+ probeRates: number[];
6
+ mean: number;
7
+ optimisticHeadroom: number;
8
+ mde: number;
9
+ tripped: boolean;
10
+ }
11
+ export interface BaselineSampleResult {
12
+ perPrediction: PredictionBaselineSample[];
13
+ anyTripped: boolean;
14
+ agentCostUsd: number;
15
+ firstTrip?: {
16
+ predictionId: string;
17
+ fullRunProbes: number;
18
+ message: string;
19
+ };
20
+ }
21
+ export declare function estimateBaselineSampleCost(input: {
22
+ predictions: Prediction[];
23
+ agentModel: string;
24
+ analystModel: string;
25
+ systemTokensBaseline: number;
26
+ judgeExternal: boolean;
27
+ }): number;
28
+ export declare function runBaselineSample(input: {
29
+ predictions: Prediction[];
30
+ episodes: Episode[];
31
+ baseline: Environment;
32
+ runner: AgentRunner;
33
+ judge: Judge;
34
+ runnerOpts: RunnerOptions;
35
+ warnOnly: boolean;
36
+ signal?: AbortSignal;
37
+ onProgress?: (p: WhatifProgress) => void;
38
+ }): Promise<BaselineSampleResult>;
@@ -0,0 +1,66 @@
1
+ import { type BaselineSampleResult } from './baseline-sample.js';
2
+ export interface PreflightInput {
3
+ episodesPerArm: number;
4
+ minProbesPerPrediction: number;
5
+ syntheticPerArm: number;
6
+ predictionCount: number;
7
+ predictions: import('./types.js').Prediction[];
8
+ force: boolean;
9
+ samples: number;
10
+ agentModel: string;
11
+ analystModel: string;
12
+ systemTokens: {
13
+ baseline: number;
14
+ candidate: number;
15
+ };
16
+ judgeExternal: boolean;
17
+ analystCostUsd: number;
18
+ maxUsd: number;
19
+ baselineSampleCostUsd: number;
20
+ measuredHeadroomPending?: boolean;
21
+ onProgress: ((p: {
22
+ stage: 'preflight';
23
+ message: string;
24
+ }) => void) | undefined;
25
+ }
26
+ export declare function runPreflightChecks(input: PreflightInput): void;
27
+ export declare function resolveMinProbesPerPrediction(predictions: import('./types.js').Prediction[], episodes: import('./types.js').Episode[]): number;
28
+ export interface BaselineSamplePhaseInput {
29
+ noBaselineSample: boolean;
30
+ predictions: import('./types.js').Prediction[];
31
+ episodes: import('./types.js').Episode[];
32
+ baseline: import('./types.js').Environment;
33
+ runner: import('./types.js').AgentRunner;
34
+ judge: import('./types.js').Judge;
35
+ episodeTimeoutMs: number;
36
+ maxTurns: number;
37
+ signal?: AbortSignal;
38
+ onProgress?: (p: import('./types.js').WhatifProgress) => void;
39
+ closeJudges: () => Promise<void>;
40
+ runDir: string;
41
+ }
42
+ export declare function runBaselineSamplePhase(input: BaselineSamplePhaseInput): Promise<BaselineSampleResult | undefined>;
43
+ export interface VerifyPreflightInput {
44
+ episodes: import('./types.js').Episode[];
45
+ predictions: import('./types.js').Prediction[];
46
+ structural: import('./types.js').StructuralImpact;
47
+ force: boolean;
48
+ samples: number;
49
+ agentModel: string;
50
+ analystModel: string;
51
+ judgeExternal: boolean;
52
+ analystCostUsd: number;
53
+ maxUsd: number;
54
+ noBaselineSample: boolean;
55
+ onProgress: ((p: {
56
+ stage: 'preflight';
57
+ message: string;
58
+ }) => void) | undefined;
59
+ closeJudges: () => Promise<void>;
60
+ }
61
+ export declare function runVerifyPreflight(input: VerifyPreflightInput): Promise<{
62
+ episodesPerArm: number;
63
+ minProbesPerPrediction: number;
64
+ noBaselineSample: boolean;
65
+ baselineSampleCostUsd: number;
66
+ }>;
@@ -16,5 +16,6 @@ export interface VerifiedReportArgs {
16
16
  resolvedJudge: Judge;
17
17
  autoKeepContextHooks: boolean;
18
18
  judgeResults: JudgeResults;
19
+ baselineSamplePerPrediction?: import('./baseline-sample.js').PredictionBaselineSample[];
19
20
  }
20
21
  export declare function buildAndPersistVerifiedReport(args: VerifiedReportArgs): Promise<WhatifReport>;
@@ -226,6 +226,7 @@ export interface VerifyResult {
226
226
  judgeFailures?: number;
227
227
  failedEpisodeRecords?: import('./run.failures.js').FailedEpisodeRecord[];
228
228
  armImbalance?: import('./run.failures.js').ArmImbalance;
229
+ baselineSample?: import('./baseline-sample.js').PredictionBaselineSample[];
229
230
  }
230
231
  export interface WhatifReport {
231
232
  spec: ChangeSpec;
@@ -34,6 +34,7 @@ export interface WhatifOptions {
34
34
  force?: boolean;
35
35
  probes?: number;
36
36
  maxPredictions?: number;
37
+ noBaselineSample?: boolean;
37
38
  }
38
39
  export interface WhatifDeps {
39
40
  runner: AgentRunner;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-afk",
3
- "version": "5.271.3",
3
+ "version": "5.272.1",
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",