agent-afk 5.261.6 → 5.262.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/dist/agent/outcomes/artifacts.d.ts +17 -0
- package/dist/agent/outcomes/combine.d.ts +13 -0
- package/dist/agent/outcomes/index.d.ts +10 -0
- package/dist/agent/outcomes/lf-delayed.d.ts +19 -0
- package/dist/agent/outcomes/lf-immediate.d.ts +20 -0
- package/dist/agent/outcomes/schema.d.ts +75 -0
- package/dist/agent/whatif-episode-gate.d.ts +1 -0
- package/dist/cli.mjs +288 -276
- package/dist/config/env.d.ts +8 -0
- package/dist/config/env.whatif.d.ts +8 -0
- package/dist/index.mjs +115 -115
- package/dist/telegram.mjs +138 -136
- package/dist/whatif/args.usage.d.ts +1 -1
- package/dist/whatif/index.d.ts +1 -1
- package/dist/whatif/run.limits.d.ts +7 -1
- package/dist/whatif/run.verify.scoring.d.ts +7 -0
- package/dist/whatif/types.d.ts +9 -0
- package/package.json +1 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Artifacts } from './schema.js';
|
|
2
|
+
export interface ToolEvent {
|
|
3
|
+
toolName: string;
|
|
4
|
+
input?: string;
|
|
5
|
+
result?: string;
|
|
6
|
+
isError?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface Turn {
|
|
9
|
+
user?: string;
|
|
10
|
+
assistant?: string;
|
|
11
|
+
toolEvents?: ToolEvent[];
|
|
12
|
+
}
|
|
13
|
+
export declare function recoverCommitSHAs(turns: Turn[]): string[];
|
|
14
|
+
export declare function isPRCreateEvent(ev: ToolEvent): boolean;
|
|
15
|
+
export declare function recoverPRURLs(turns: Turn[]): string[];
|
|
16
|
+
export declare function inferRepo(turns: Turn[]): string | null;
|
|
17
|
+
export declare function recoverArtifacts(turns: Turn[]): Artifacts;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Vote, OutcomeLabel, SelfReport, Artifacts } from './schema.js';
|
|
2
|
+
export interface CombinerInput {
|
|
3
|
+
votes: Vote[];
|
|
4
|
+
selfReport: SelfReport;
|
|
5
|
+
artifacts: Artifacts;
|
|
6
|
+
explicit_feedback?: 'good' | 'bad';
|
|
7
|
+
}
|
|
8
|
+
export interface CombinerResult {
|
|
9
|
+
label: OutcomeLabel;
|
|
10
|
+
confidence: number;
|
|
11
|
+
}
|
|
12
|
+
export declare function computeConfidence(label: OutcomeLabel, votes: Vote[]): number;
|
|
13
|
+
export declare function combine(input: CombinerInput): CombinerResult;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type { VerifiedOutcome, OutcomeLabel, SelfReport, Vote, HistoryEntry, Artifacts } from './schema.js';
|
|
2
|
+
export { VerifiedOutcomeSchema } from './schema.js';
|
|
3
|
+
export type { ToolEvent, Turn } from './artifacts.js';
|
|
4
|
+
export { recoverArtifacts, recoverCommitSHAs, recoverPRURLs, inferRepo } from './artifacts.js';
|
|
5
|
+
export type { ClosureInfo, LoadClosure, ImmediateLFResult } from './lf-immediate.js';
|
|
6
|
+
export { parseSelfReport, lfClosure, lfErrorTail, lfVerification, lfInSessionCorrection, lfSelfReport, runImmediateLFs, } from './lf-immediate.js';
|
|
7
|
+
export type { PrState, FetchPrState, CheckAncestor, CheckRevert, GetDefaultBranch } from './lf-delayed.js';
|
|
8
|
+
export { parsePrUrl, lfPrFate, lfCommitSurvival, lfFixOfFix, realFetchPrState, realCheckAncestor, realCheckRevert, } from './lf-delayed.js';
|
|
9
|
+
export type { CombinerInput, CombinerResult } from './combine.js';
|
|
10
|
+
export { combine, computeConfidence } from './combine.js';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Vote } from './schema.js';
|
|
2
|
+
export interface PrState {
|
|
3
|
+
state: 'OPEN' | 'CLOSED' | 'MERGED';
|
|
4
|
+
mergedAt: string | null;
|
|
5
|
+
}
|
|
6
|
+
export type FetchPrState = (prUrl: string) => Promise<PrState | null>;
|
|
7
|
+
export type CheckAncestor = (sha: string, repoPath: string) => Promise<boolean>;
|
|
8
|
+
export type CheckRevert = (sha: string, repoPath: string) => Promise<boolean>;
|
|
9
|
+
export type GetDefaultBranch = (repoPath: string) => Promise<string>;
|
|
10
|
+
export declare function parsePrUrl(url: string): {
|
|
11
|
+
repo: string;
|
|
12
|
+
number: number;
|
|
13
|
+
} | null;
|
|
14
|
+
export declare function lfPrFate(prUrls: string[], fetchPrState: FetchPrState, now: string): Promise<Vote[]>;
|
|
15
|
+
export declare function lfCommitSurvival(commits: string[], repoPath: string | null, checkAncestor: CheckAncestor, checkRevert: CheckRevert, now: string): Promise<Vote[]>;
|
|
16
|
+
export declare function lfFixOfFix(): Vote[];
|
|
17
|
+
export declare const realFetchPrState: FetchPrState;
|
|
18
|
+
export declare const realCheckAncestor: CheckAncestor;
|
|
19
|
+
export declare const realCheckRevert: CheckRevert;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Vote, SelfReport } from './schema.js';
|
|
2
|
+
import type { Turn } from './artifacts.js';
|
|
3
|
+
export interface ClosureInfo {
|
|
4
|
+
reason: 'abort' | 'iteration_cap' | 'normal' | 'unknown';
|
|
5
|
+
}
|
|
6
|
+
export type LoadClosure = (sessionId: string) => ClosureInfo | null;
|
|
7
|
+
export declare function parseSelfReport(assistantText: string): SelfReport;
|
|
8
|
+
export declare function lfClosure(sessionId: string, loadClosure: LoadClosure, now: string): Vote[];
|
|
9
|
+
export declare function lfErrorTail(turns: Turn[], now: string): Vote | null;
|
|
10
|
+
export declare function lfVerification(turns: Turn[], now: string): Vote | null;
|
|
11
|
+
export declare function lfInSessionCorrection(turns: Turn[], now: string): Vote | null;
|
|
12
|
+
export declare function lfSelfReport(turns: Turn[], now: string): {
|
|
13
|
+
selfReport: SelfReport;
|
|
14
|
+
vote: Vote;
|
|
15
|
+
};
|
|
16
|
+
export interface ImmediateLFResult {
|
|
17
|
+
votes: Vote[];
|
|
18
|
+
selfReport: SelfReport;
|
|
19
|
+
}
|
|
20
|
+
export declare function runImmediateLFs(sessionId: string, turns: Turn[], loadClosure: LoadClosure, now?: string): ImmediateLFResult;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const VoteSchema: z.ZodObject<{
|
|
3
|
+
lf: z.ZodString;
|
|
4
|
+
vote: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<-1>, z.ZodLiteral<0>]>;
|
|
5
|
+
strength: z.ZodEnum<{
|
|
6
|
+
strong: "strong";
|
|
7
|
+
weak: "weak";
|
|
8
|
+
}>;
|
|
9
|
+
evidence: z.ZodString;
|
|
10
|
+
observed_at: z.ZodString;
|
|
11
|
+
}, z.core.$strip>;
|
|
12
|
+
export type Vote = z.infer<typeof VoteSchema>;
|
|
13
|
+
export declare const HistoryEntrySchema: z.ZodObject<{
|
|
14
|
+
at: z.ZodString;
|
|
15
|
+
label: z.ZodString;
|
|
16
|
+
reason: z.ZodString;
|
|
17
|
+
}, z.core.$strip>;
|
|
18
|
+
export type HistoryEntry = z.infer<typeof HistoryEntrySchema>;
|
|
19
|
+
export declare const ArtifactsSchema: z.ZodObject<{
|
|
20
|
+
commits: z.ZodArray<z.ZodString>;
|
|
21
|
+
prs: z.ZodArray<z.ZodString>;
|
|
22
|
+
repo: z.ZodNullable<z.ZodString>;
|
|
23
|
+
}, z.core.$strip>;
|
|
24
|
+
export type Artifacts = z.infer<typeof ArtifactsSchema>;
|
|
25
|
+
export declare const VerifiedOutcomeSchema: z.ZodObject<{
|
|
26
|
+
schema_version: z.ZodLiteral<1>;
|
|
27
|
+
session_id: z.ZodString;
|
|
28
|
+
label: z.ZodEnum<{
|
|
29
|
+
failed: "failed";
|
|
30
|
+
succeeded: "succeeded";
|
|
31
|
+
unknown: "unknown";
|
|
32
|
+
blocked: "blocked";
|
|
33
|
+
interrupted: "interrupted";
|
|
34
|
+
}>;
|
|
35
|
+
confidence: z.ZodNumber;
|
|
36
|
+
state: z.ZodEnum<{
|
|
37
|
+
settled: "settled";
|
|
38
|
+
provisional: "provisional";
|
|
39
|
+
}>;
|
|
40
|
+
settles_after: z.ZodNullable<z.ZodString>;
|
|
41
|
+
session_kind: z.ZodEnum<{
|
|
42
|
+
text: "text";
|
|
43
|
+
mutating: "mutating";
|
|
44
|
+
}>;
|
|
45
|
+
self_report: z.ZodEnum<{
|
|
46
|
+
done: "done";
|
|
47
|
+
blocked: "blocked";
|
|
48
|
+
asking: "asking";
|
|
49
|
+
interrupted: "interrupted";
|
|
50
|
+
none: "none";
|
|
51
|
+
}>;
|
|
52
|
+
artifacts: z.ZodObject<{
|
|
53
|
+
commits: z.ZodArray<z.ZodString>;
|
|
54
|
+
prs: z.ZodArray<z.ZodString>;
|
|
55
|
+
repo: z.ZodNullable<z.ZodString>;
|
|
56
|
+
}, z.core.$strip>;
|
|
57
|
+
votes: z.ZodArray<z.ZodObject<{
|
|
58
|
+
lf: z.ZodString;
|
|
59
|
+
vote: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<-1>, z.ZodLiteral<0>]>;
|
|
60
|
+
strength: z.ZodEnum<{
|
|
61
|
+
strong: "strong";
|
|
62
|
+
weak: "weak";
|
|
63
|
+
}>;
|
|
64
|
+
evidence: z.ZodString;
|
|
65
|
+
observed_at: z.ZodString;
|
|
66
|
+
}, z.core.$strip>>;
|
|
67
|
+
history: z.ZodArray<z.ZodObject<{
|
|
68
|
+
at: z.ZodString;
|
|
69
|
+
label: z.ZodString;
|
|
70
|
+
reason: z.ZodString;
|
|
71
|
+
}, z.core.$strip>>;
|
|
72
|
+
}, z.core.$strip>;
|
|
73
|
+
export type VerifiedOutcome = z.infer<typeof VerifiedOutcomeSchema>;
|
|
74
|
+
export type OutcomeLabel = VerifiedOutcome['label'];
|
|
75
|
+
export type SelfReport = VerifiedOutcome['self_report'];
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { HookContext, HookDecision } from './hooks.js';
|
|
2
2
|
export declare function resetWhatifEpisodeGateForTests(): void;
|
|
3
3
|
export declare function isWhatifEpisode(): boolean;
|
|
4
|
+
export declare function keepContextHooksInEpisode(): boolean;
|
|
4
5
|
export declare const EPISODE_BLOCK_REASON: string;
|
|
5
6
|
export declare function createWhatifEpisodeGate(): (context: HookContext) => HookDecision;
|