agent-afk 5.264.0 → 5.265.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.
@@ -1,6 +1,6 @@
1
1
  export { runWhatif, WhatifBudgetError } from './run.js';
2
2
  export { computeStructuralImpact } from './structural.js';
3
- export type { Change, ChangeKind, ChangeSpec, LaunchSettings, Environment, OperatorContext, ChangeOperator, RequestSnapshot, StructuralImpact, PredictionDirection, Confidence, Prediction, Episode, ToolRequest, EpisodeTrace, RunnerOptions, AgentRunner, EpisodeFeatures, JudgeQuestion, JudgeInput, JudgeResult, Judge, RateComparison, Verdict, VerifiedPrediction, PredictionScope, DiscoveredDifference, FeatureDelta, VerifyResult, WhatifReport, WhatifStage, WhatifProgress, CompleteFn, WhatifOptions, WhatifDeps, } from './types.js';
3
+ export type { Change, ChangeKind, ChangeSpec, LaunchSettings, Environment, OperatorContext, ChangeOperator, RequestSnapshot, StructuralImpact, PredictionDirection, Confidence, Prediction, PredictionObservable, Episode, ToolRequest, EpisodeTrace, RunnerOptions, AgentRunner, EpisodeFeatures, JudgeQuestion, JudgeInput, JudgeResult, Judge, RateComparison, Verdict, VerifiedPrediction, PredictionScope, DiscoveredDifference, FeatureDelta, VerifyResult, WhatifReport, WhatifStage, WhatifProgress, CompleteFn, WhatifOptions, WhatifDeps, } from './types.js';
4
4
  export { renderTerminal, renderMarkdown } from './report.js';
5
5
  export { createAfkRunner } from './runner/afk-runner.js';
6
6
  export { createAnthropicComplete } from './complete.js';
@@ -0,0 +1,5 @@
1
+ import type { Prediction, PredictionObservable } from './types.js';
2
+ export declare const INTERCEPTED_INTENT_RULE: string;
3
+ export declare const DEFAULT_DOWNSTREAM_REASON = "needs an intercepted action to complete; episodes stop at the first side-effecting request";
4
+ export declare function observabilityOf(prediction: Pick<Prediction, 'observable'>): PredictionObservable;
5
+ export declare function unobservableReason(prediction: Pick<Prediction, 'observable' | 'observabilityReason'>): string | undefined;
@@ -1,4 +1,5 @@
1
1
  import type { CompleteFn, Prediction, StructuralImpact } from './types.js';
2
+ import type { RepoManifest } from './repo-manifest.js';
2
3
  export interface PredictInput {
3
4
  spec: {
4
5
  title: string;
@@ -7,5 +8,6 @@ export interface PredictInput {
7
8
  changeDescriptions: string[];
8
9
  structural: StructuralImpact;
9
10
  trackRecord?: string;
11
+ repoManifest?: RepoManifest;
10
12
  }
11
13
  export declare function predictChanges(input: PredictInput, complete: CompleteFn, model: string): Promise<Prediction[]>;
@@ -0,0 +1,17 @@
1
+ export interface DroppedProbe {
2
+ predictionId: string;
3
+ probe: string;
4
+ reason: string;
5
+ }
6
+ export interface GroundedPrediction {
7
+ id: string;
8
+ probes: string[];
9
+ }
10
+ export interface GroundProbesResult<T extends GroundedPrediction> {
11
+ predictions: T[];
12
+ droppedProbes: DroppedProbe[];
13
+ }
14
+ export declare function extractPathTokens(probe: string): string[];
15
+ export type ExistenceChecker = (relPath: string) => boolean;
16
+ export declare function makeSetChecker(allPaths: Set<string>): ExistenceChecker;
17
+ export declare function groundProbes<T extends GroundedPrediction>(predictions: T[], existenceChecker: ExistenceChecker): GroundProbesResult<T>;
@@ -0,0 +1,8 @@
1
+ export interface RepoManifest {
2
+ languages: string[];
3
+ paths: string[];
4
+ allPaths: Set<string>;
5
+ }
6
+ export declare function buildRepoManifest(cwd: string): RepoManifest;
7
+ export declare function formatRepoManifest(manifest: RepoManifest): string;
8
+ export declare function pathExistsInCwd(cwd: string, relPath: string): boolean;
@@ -0,0 +1,3 @@
1
+ import type { Verdict, VerifiedPrediction } from './types.js';
2
+ export declare function verdictEmoji(v: Verdict): string;
3
+ export declare function verdictLabel(vp: Pick<VerifiedPrediction, 'verdict' | 'unobservableReason'>): string;
@@ -0,0 +1,2 @@
1
+ import type { EpisodeTrace } from './types.js';
2
+ export declare function renderTrace(trace: EpisodeTrace): string;
@@ -95,6 +95,7 @@ export interface StructuralImpact {
95
95
  }
96
96
  export type PredictionDirection = 'added' | 'removed' | 'strengthened' | 'weakened';
97
97
  export type Confidence = 'high' | 'medium' | 'low';
98
+ export type PredictionObservable = 'decision' | 'downstream';
98
99
  export interface Prediction {
99
100
  id: string;
100
101
  behavior: string;
@@ -103,6 +104,8 @@ export interface Prediction {
103
104
  reason: string;
104
105
  testQuestion: string;
105
106
  probes: string[];
107
+ observable?: PredictionObservable;
108
+ observabilityReason?: string;
106
109
  }
107
110
  export interface Episode {
108
111
  id: string;
@@ -174,7 +177,7 @@ export interface RateComparison {
174
177
  candidate: number;
175
178
  };
176
179
  }
177
- export type Verdict = 'confirmed' | 'refuted' | 'unclear';
180
+ export type Verdict = 'confirmed' | 'refuted' | 'unclear' | 'unobservable';
178
181
  export interface PredictionScope {
179
182
  episodes: {
180
183
  baseline: string[];
@@ -188,6 +191,7 @@ export interface VerifiedPrediction {
188
191
  rates: RateComparison;
189
192
  verdict: Verdict;
190
193
  scope?: PredictionScope;
194
+ unobservableReason?: string;
191
195
  }
192
196
  export interface DiscoveredDifference {
193
197
  id: string;
@@ -224,47 +228,7 @@ export interface WhatifReport {
224
228
  runDir: string;
225
229
  limits: string[];
226
230
  headline: string;
231
+ droppedProbes?: import('./probe-grounding.js').DroppedProbe[];
227
232
  corpusExclusions?: import('./episodes.js').CorpusExclusions;
228
233
  }
229
- export type WhatifStage = 'compile' | 'sandbox' | 'snapshot' | 'predict' | 'episodes' | 'run' | 'judge' | 'discover' | 'report';
230
- export interface WhatifProgress {
231
- stage: WhatifStage;
232
- message: string;
233
- done?: number;
234
- total?: number;
235
- }
236
- export type CompleteFn = (req: {
237
- system: string;
238
- user: string;
239
- maxTokens: number;
240
- model: string;
241
- signal?: AbortSignal;
242
- }) => Promise<{
243
- text: string;
244
- costUsd: number;
245
- }>;
246
- export interface WhatifOptions {
247
- spec: ChangeSpec;
248
- realHome: string;
249
- realCwd: string;
250
- agentModel: string;
251
- analystModel: string;
252
- verify: boolean;
253
- turns: number;
254
- samples: number;
255
- maxUsd: number;
256
- judge: 'auto' | 'jev' | 'claude';
257
- concurrency: number;
258
- maxTurns: number;
259
- episodeTimeoutMs: number;
260
- keepSandboxes: boolean;
261
- }
262
- export interface WhatifDeps {
263
- runner: AgentRunner;
264
- complete: CompleteFn;
265
- makeJudge(choice: WhatifOptions['judge']): Promise<Judge>;
266
- makeCrossCheckJudge(): Promise<Judge | undefined>;
267
- onProgress?: (p: WhatifProgress) => void;
268
- signal?: AbortSignal;
269
- now?: () => Date;
270
- }
234
+ export type { WhatifStage, WhatifProgress, CompleteFn, WhatifOptions, WhatifDeps, } from './types.orchestration.js';
@@ -0,0 +1,43 @@
1
+ import type { AgentRunner, ChangeSpec, Judge } from './types.js';
2
+ export type WhatifStage = 'compile' | 'sandbox' | 'snapshot' | 'predict' | 'episodes' | 'run' | 'judge' | 'discover' | 'report';
3
+ export interface WhatifProgress {
4
+ stage: WhatifStage;
5
+ message: string;
6
+ done?: number;
7
+ total?: number;
8
+ }
9
+ export type CompleteFn = (req: {
10
+ system: string;
11
+ user: string;
12
+ maxTokens: number;
13
+ model: string;
14
+ signal?: AbortSignal;
15
+ }) => Promise<{
16
+ text: string;
17
+ costUsd: number;
18
+ }>;
19
+ export interface WhatifOptions {
20
+ spec: ChangeSpec;
21
+ realHome: string;
22
+ realCwd: string;
23
+ agentModel: string;
24
+ analystModel: string;
25
+ verify: boolean;
26
+ turns: number;
27
+ samples: number;
28
+ maxUsd: number;
29
+ judge: 'auto' | 'jev' | 'claude';
30
+ concurrency: number;
31
+ maxTurns: number;
32
+ episodeTimeoutMs: number;
33
+ keepSandboxes: boolean;
34
+ }
35
+ export interface WhatifDeps {
36
+ runner: AgentRunner;
37
+ complete: CompleteFn;
38
+ makeJudge(choice: WhatifOptions['judge']): Promise<Judge>;
39
+ makeCrossCheckJudge(): Promise<Judge | undefined>;
40
+ onProgress?: (p: WhatifProgress) => void;
41
+ signal?: AbortSignal;
42
+ now?: () => Date;
43
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-afk",
3
- "version": "5.264.0",
3
+ "version": "5.265.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",