agent-afk 5.298.1 → 5.299.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.
@@ -1,5 +1,5 @@
1
1
  export declare const DEFAULT_SESSIONSTART_COOLDOWN_MS: number;
2
- export type SessionStartSkipReason = 'cooldown' | 'overlap' | 'budget-over';
2
+ export type SessionStartSkipReason = 'cooldown' | 'overlap' | 'budget-over' | 'telemetry-unwritable';
3
3
  export interface GateDecision {
4
4
  fire: boolean;
5
5
  skipReason?: SessionStartSkipReason;
@@ -56,6 +56,7 @@ export declare class CronScheduler {
56
56
  private readonly queueDir;
57
57
  private readonly inFlightTaskIds;
58
58
  private readonly budgetAlerts;
59
+ private readonly telemetryAlerts;
59
60
  constructor(options?: SchedulerOptions);
60
61
  register(task: ScheduledTask): void;
61
62
  unregister(taskId: string): void;
@@ -4,4 +4,5 @@ import type { TelemetryRecord, TelemetryTrigger } from './scheduler.js';
4
4
  import { type BudgetGateSkip } from './budget-gate.js';
5
5
  export declare function makeOverlapSkipRecord(task: ScheduledTask, trigger: TelemetryTrigger, nowMs: number): TelemetryRecord;
6
6
  export declare function makeBudgetSkipRecord(task: ScheduledTask, trigger: TelemetryTrigger, nowMs: number, skip: BudgetGateSkip): TelemetryRecord;
7
+ export declare function makeTelemetryUnwritableSkipRecord(task: ScheduledTask, nowMs: number, errorDescription: string): TelemetryRecord;
7
8
  export declare function makeSessionStartSkipRecord(task: ScheduledTask, decision: GateDecision, nowMs: number): TelemetryRecord;
@@ -0,0 +1,6 @@
1
+ export declare function probeTelemetryWritable(telemetryPath: string): string | null;
2
+ export declare class TelemetryAlertLatch {
3
+ private alerted;
4
+ notify(telemetryPath: string, errno: string): Promise<void>;
5
+ _reset(): void;
6
+ }
@@ -0,0 +1,17 @@
1
+ import type { Vote, OutcomeLabel, SelfReport, Artifacts, VoteSeverity } from './schema.js';
2
+ export interface CombinerV2Input {
3
+ votes: Vote[];
4
+ selfReport: SelfReport;
5
+ artifacts: Artifacts;
6
+ explicit_feedback?: 'good' | 'bad';
7
+ settleWindowPassed?: boolean;
8
+ normalClosure?: boolean;
9
+ }
10
+ export interface CombinerV2Result {
11
+ label: OutcomeLabel;
12
+ confidence: number;
13
+ basis?: 'proven' | 'no_bad_signals';
14
+ }
15
+ export declare function effectiveSeverity(vote: Vote): VoteSeverity;
16
+ export declare function computeConfidenceV2(label: OutcomeLabel, votes: Vote[]): number;
17
+ export declare function combineV2(input: CombinerV2Input): CombinerV2Result;
@@ -4,10 +4,13 @@ export interface CombinerInput {
4
4
  selfReport: SelfReport;
5
5
  artifacts: Artifacts;
6
6
  explicit_feedback?: 'good' | 'bad';
7
+ settleWindowPassed?: boolean;
8
+ normalClosure?: boolean;
7
9
  }
8
10
  export interface CombinerResult {
9
11
  label: OutcomeLabel;
10
12
  confidence: number;
13
+ basis?: 'proven' | 'no_bad_signals';
11
14
  }
12
15
  export declare function computeConfidence(label: OutcomeLabel, votes: Vote[]): number;
13
16
  export declare function combine(input: CombinerInput): CombinerResult;
@@ -4,6 +4,7 @@ export interface ClosureInfo {
4
4
  reason: 'abort' | 'iteration_cap' | 'normal' | 'unknown';
5
5
  }
6
6
  export type LoadClosure = (sessionId: string) => ClosureInfo | null;
7
+ export declare function stripMachineContent(text: string): string;
7
8
  export declare function parseSelfReport(assistantText: string): SelfReport;
8
9
  export declare function lfClosure(sessionId: string, loadClosure: LoadClosure, now: string): Vote[];
9
10
  export declare function lfErrorTail(turns: Turn[], now: string): Vote | null;
@@ -3,4 +3,7 @@ export declare const FINGERPRINT_MAX_TOKENS = 64;
3
3
  export declare function normalizeTokens(text: string): Set<string>;
4
4
  export declare function promptFingerprint(text: string): string[];
5
5
  export declare function jaccardSimilarity(a: Set<string>, b: Set<string>): number;
6
- export declare function lfReask(newSessionId: string, newPrompt: string, newCwd: string | undefined, now: string): void;
6
+ export interface LfReaskDeps {
7
+ outcomesDir?: string;
8
+ }
9
+ export declare function lfReask(newSessionId: string, newPrompt: string, newCwd: string | undefined, now: string, deps?: LfReaskDeps): void;
@@ -30,3 +30,15 @@ export interface ProcessResult {
30
30
  }
31
31
  export declare function processRecord(sessionId: string, deps: RelabelDeps, dryRun: boolean, outcomesDir?: string): Promise<ProcessResult>;
32
32
  export declare function runRelabelJob(opts?: RelabelJobOptions): Promise<RelabelJobResult>;
33
+ export interface RescoreResult {
34
+ scanned: number;
35
+ relabeled: number;
36
+ skipped: number;
37
+ errors: number;
38
+ }
39
+ export interface RescoreOptions {
40
+ limit?: number;
41
+ dryRun?: boolean;
42
+ outcomesDir?: string;
43
+ }
44
+ export declare function rescoreSettledUnknown(opts?: RescoreOptions): Promise<RescoreResult>;
@@ -1,4 +1,10 @@
1
1
  import { z } from 'zod';
2
+ export declare const VoteSeveritySchema: z.ZodEnum<{
3
+ critical: "critical";
4
+ major: "major";
5
+ minor: "minor";
6
+ }>;
7
+ export type VoteSeverity = z.infer<typeof VoteSeveritySchema>;
2
8
  export declare const VoteSchema: z.ZodObject<{
3
9
  lf: z.ZodString;
4
10
  vote: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<-1>, z.ZodLiteral<0>]>;
@@ -6,6 +12,11 @@ export declare const VoteSchema: z.ZodObject<{
6
12
  strong: "strong";
7
13
  weak: "weak";
8
14
  }>;
15
+ severity: z.ZodOptional<z.ZodEnum<{
16
+ critical: "critical";
17
+ major: "major";
18
+ minor: "minor";
19
+ }>>;
9
20
  evidence: z.ZodString;
10
21
  observed_at: z.ZodString;
11
22
  }, z.core.$strip>;
@@ -61,6 +72,11 @@ export declare const VerifiedOutcomeSchema: z.ZodObject<{
61
72
  strong: "strong";
62
73
  weak: "weak";
63
74
  }>;
75
+ severity: z.ZodOptional<z.ZodEnum<{
76
+ critical: "critical";
77
+ major: "major";
78
+ minor: "minor";
79
+ }>>;
64
80
  evidence: z.ZodString;
65
81
  observed_at: z.ZodString;
66
82
  }, z.core.$strip>>;
@@ -71,6 +87,10 @@ export declare const VerifiedOutcomeSchema: z.ZodObject<{
71
87
  }, z.core.$strip>>;
72
88
  first_prompt_tokens: z.ZodOptional<z.ZodArray<z.ZodString>>;
73
89
  first_cwd: z.ZodOptional<z.ZodString>;
90
+ basis: z.ZodOptional<z.ZodEnum<{
91
+ proven: "proven";
92
+ no_bad_signals: "no_bad_signals";
93
+ }>>;
74
94
  }, z.core.$strip>;
75
95
  export type VerifiedOutcome = z.infer<typeof VerifiedOutcomeSchema>;
76
96
  export type OutcomeLabel = VerifiedOutcome['label'];