tnega 0.1.0 → 0.3.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.
Files changed (110) hide show
  1. package/README.md +115 -189
  2. package/dist/agent.js +2907 -0
  3. package/dist/agent.js.map +7 -0
  4. package/dist/bin.js +32512 -4419
  5. package/dist/bin.js.map +4 -4
  6. package/dist/cli-runtime.js +33404 -0
  7. package/dist/cli-runtime.js.map +7 -0
  8. package/dist/coding-agent.js +19088 -0
  9. package/dist/coding-agent.js.map +7 -0
  10. package/dist/core.js +1398 -0
  11. package/dist/core.js.map +7 -0
  12. package/dist/eval.js +23905 -0
  13. package/dist/eval.js.map +7 -0
  14. package/dist/events.js +1215 -0
  15. package/dist/events.js.map +7 -0
  16. package/dist/evolve.js +18303 -0
  17. package/dist/evolve.js.map +7 -0
  18. package/dist/index.js +33087 -4450
  19. package/dist/index.js.map +4 -4
  20. package/dist/llm.js +1016 -0
  21. package/dist/llm.js.map +7 -0
  22. package/dist/services.js +1142 -0
  23. package/dist/services.js.map +7 -0
  24. package/dist/session.js +1045 -0
  25. package/dist/session.js.map +7 -0
  26. package/dist/tools.js +2577 -0
  27. package/dist/tools.js.map +7 -0
  28. package/dist/types/packages/agent/src/definition.d.ts +17 -0
  29. package/dist/types/packages/agent/src/inbox-durable.d.ts +54 -0
  30. package/dist/types/packages/agent/src/index.d.ts +7 -0
  31. package/dist/types/packages/agent/src/live.d.ts +115 -0
  32. package/dist/types/packages/agent/src/llm-service.d.ts +32 -0
  33. package/dist/types/packages/agent/src/prompt.d.ts +55 -0
  34. package/dist/types/packages/agent/src/service.d.ts +68 -0
  35. package/dist/types/packages/agent/src/types.d.ts +215 -0
  36. package/dist/types/packages/benchmark/src/bigcodebench.d.ts +6 -0
  37. package/dist/types/packages/benchmark/src/humaneval.d.ts +11 -0
  38. package/dist/types/packages/benchmark/src/index.d.ts +9 -0
  39. package/dist/types/packages/benchmark/src/manifest.d.ts +10 -0
  40. package/dist/types/packages/benchmark/src/mbpp.d.ts +10 -0
  41. package/dist/types/packages/benchmark/src/parquet.d.ts +2 -0
  42. package/dist/types/packages/benchmark/src/stdlib.d.ts +3 -0
  43. package/dist/types/packages/benchmark/src/swebench.d.ts +2 -0
  44. package/dist/types/packages/benchmark/src/types.d.ts +58 -0
  45. package/dist/types/packages/cli/src/bin.d.ts +2 -0
  46. package/dist/types/packages/cli/src/commands.d.ts +146 -0
  47. package/dist/types/packages/cli/src/config.d.ts +28 -0
  48. package/dist/types/packages/cli/src/index.d.ts +9 -0
  49. package/dist/types/packages/cli/src/profile-file.d.ts +26 -0
  50. package/dist/types/packages/cli/src/profile.d.ts +9 -0
  51. package/dist/types/packages/cli/src/server.d.ts +14 -0
  52. package/dist/types/packages/cli/src/store.d.ts +60 -0
  53. package/dist/types/packages/cli/src/yaml.d.ts +1 -0
  54. package/dist/types/packages/coding-agent/src/codingAgent.d.ts +25 -0
  55. package/dist/types/packages/coding-agent/src/index.d.ts +6 -0
  56. package/dist/types/packages/coding-agent/src/mcp.d.ts +24 -0
  57. package/dist/types/packages/coding-agent/src/plan.d.ts +13 -0
  58. package/dist/types/packages/coding-agent/src/skills.d.ts +12 -0
  59. package/dist/types/packages/coding-agent/src/slash.d.ts +28 -0
  60. package/dist/types/packages/coding-agent/src/types.d.ts +41 -0
  61. package/dist/types/packages/core/src/context.d.ts +28 -0
  62. package/dist/types/packages/core/src/events.d.ts +57 -0
  63. package/dist/types/packages/core/src/fiber.d.ts +79 -0
  64. package/dist/types/packages/core/src/index.d.ts +10 -0
  65. package/dist/types/packages/core/src/invariant.d.ts +45 -0
  66. package/dist/types/packages/core/src/logger.d.ts +48 -0
  67. package/dist/types/packages/core/src/reflect.d.ts +42 -0
  68. package/dist/types/packages/core/src/registry.d.ts +54 -0
  69. package/dist/types/packages/core/src/service.d.ts +19 -0
  70. package/dist/types/packages/core/src/utils.d.ts +54 -0
  71. package/dist/types/packages/eval/src/codingRuntime.d.ts +18 -0
  72. package/dist/types/packages/eval/src/index.d.ts +5 -0
  73. package/dist/types/packages/eval/src/policy.d.ts +8 -0
  74. package/dist/types/packages/eval/src/runner.d.ts +31 -0
  75. package/dist/types/packages/eval/src/service.d.ts +23 -0
  76. package/dist/types/packages/eval/src/strategies.d.ts +58 -0
  77. package/dist/types/packages/eval/src/trace.d.ts +7 -0
  78. package/dist/types/packages/eval/src/types.d.ts +281 -0
  79. package/dist/types/packages/eval/src/utils.d.ts +5 -0
  80. package/dist/types/packages/eval/src/workspace.d.ts +17 -0
  81. package/dist/types/packages/evolve/src/diagnose.d.ts +9 -0
  82. package/dist/types/packages/evolve/src/index.d.ts +7 -0
  83. package/dist/types/packages/evolve/src/llm.d.ts +39 -0
  84. package/dist/types/packages/evolve/src/log.d.ts +26 -0
  85. package/dist/types/packages/evolve/src/select.d.ts +3 -0
  86. package/dist/types/packages/evolve/src/service.d.ts +29 -0
  87. package/dist/types/packages/evolve/src/types.d.ts +176 -0
  88. package/dist/types/packages/llm/src/anthropic-messages.d.ts +4 -0
  89. package/dist/types/packages/llm/src/errors.d.ts +6 -0
  90. package/dist/types/packages/llm/src/index.d.ts +7 -0
  91. package/dist/types/packages/llm/src/models.d.ts +29 -0
  92. package/dist/types/packages/llm/src/openai.d.ts +4 -0
  93. package/dist/types/packages/llm/src/provider.d.ts +3 -0
  94. package/dist/types/packages/llm/src/shared.d.ts +15 -0
  95. package/dist/types/packages/llm/src/types.d.ts +13 -0
  96. package/dist/types/packages/session/src/index.d.ts +500 -0
  97. package/dist/types/packages/session/src/invariant.d.ts +33 -0
  98. package/dist/types/packages/tools/src/builtins.d.ts +25 -0
  99. package/dist/types/packages/tools/src/calc.d.ts +4 -0
  100. package/dist/types/packages/tools/src/execution.d.ts +31 -0
  101. package/dist/types/packages/tools/src/index.d.ts +107 -0
  102. package/dist/types/packages/tools/src/path.d.ts +4 -0
  103. package/dist/types/packages/tools/src/policy.d.ts +14 -0
  104. package/dist/types/src/events.d.ts +1 -0
  105. package/dist/types/src/index.d.ts +15 -0
  106. package/dist/types/src/services.d.ts +4 -0
  107. package/dist/web/assets/index-45pokiBH.js +270 -0
  108. package/dist/web/assets/index-DCLL69Kz.css +1 -0
  109. package/dist/web/index.html +13 -0
  110. package/package.json +92 -35
@@ -0,0 +1,19 @@
1
+ import type { Context } from './context.js';
2
+ import { symbols, type Any } from './utils.js';
3
+ export declare abstract class Service<out T = never> {
4
+ [symbols.config]: T;
5
+ [symbols.filter]: (ctx: Context) => boolean;
6
+ [symbols.extend]: (props?: Any) => any;
7
+ [symbols.resolveConfig]: (base?: T, head?: T) => T;
8
+ protected ctx: Context;
9
+ static readonly init: symbol;
10
+ static readonly check: symbol;
11
+ static readonly config: symbol;
12
+ static readonly invoke: symbol;
13
+ static readonly extend: symbol;
14
+ static readonly tracker: symbol;
15
+ static readonly resolveConfig: symbol;
16
+ name: string;
17
+ constructor(ctx: Context, name?: string);
18
+ static [Symbol.hasInstance](instance: Any): boolean;
19
+ }
@@ -0,0 +1,54 @@
1
+ export type Any = any;
2
+ export type AnyFunction = (...args: Any[]) => Any;
3
+ export type Dict<T = Any, K extends PropertyKey = string> = Record<K, T>;
4
+ export declare class DisposableList<T extends WeakKey> {
5
+ private sn;
6
+ private map;
7
+ private weak;
8
+ get length(): number;
9
+ push(value: T): () => boolean;
10
+ unshift(value: T): () => boolean;
11
+ delete(value: T): boolean;
12
+ clear(): T[];
13
+ [Symbol.iterator](): MapIterator<T>;
14
+ }
15
+ export interface Tracker {
16
+ associate?: string;
17
+ property?: string;
18
+ noShadow?: boolean;
19
+ }
20
+ export declare const symbols: {
21
+ readonly shadow: symbol;
22
+ readonly caller: symbol;
23
+ readonly receiver: symbol;
24
+ readonly original: symbol;
25
+ readonly metadata: symbol;
26
+ readonly initHooks: symbol;
27
+ readonly checkProto: symbol;
28
+ readonly effect: symbol;
29
+ readonly filter: symbol;
30
+ readonly isolate: symbol;
31
+ readonly intercept: symbol;
32
+ readonly init: symbol;
33
+ readonly check: symbol;
34
+ readonly config: symbol;
35
+ readonly invoke: symbol;
36
+ readonly extend: symbol;
37
+ readonly tracker: symbol;
38
+ readonly resolveConfig: symbol;
39
+ };
40
+ export declare function isConstructor(func: Any): func is new (...args: Any[]) => Any;
41
+ export declare function isObject(value: Any): value is object;
42
+ export declare function isNullable(value: Any): boolean;
43
+ export declare function joinPrototype(proto1: object, proto2: object): object;
44
+ export declare function getPropertyDescriptor(target: Any, prop: string | symbol): TypedPropertyDescriptor<any> | undefined;
45
+ export declare function getTraceable<T>(ctx: Any, value: T): T;
46
+ export declare function withProps(target: Any, props?: Any): any;
47
+ export declare function createCallable(name: string, proto: object, tracker: Tracker): any;
48
+ interface StackInfo {
49
+ offset: number;
50
+ error: Error;
51
+ }
52
+ export declare function composeError<T>(callback: (info: StackInfo) => T, getOuterStack?: () => string[]): T;
53
+ export declare function buildOuterStack(offset?: number): () => string[];
54
+ export {};
@@ -0,0 +1,18 @@
1
+ import { type AgentLoop } from "../../agent/src/index.js";
2
+ import { Context } from "../../core/src/index.js";
3
+ import { type ToolPolicy } from "../../tools/src/index.js";
4
+ import type { CodingEvalConfig } from './types.js';
5
+ export interface CodingEvalRuntimeOptions {
6
+ cwd: string;
7
+ sessionFile: string;
8
+ config: CodingEvalConfig;
9
+ toolPolicy: ToolPolicy;
10
+ allowShell?: boolean;
11
+ allowNetwork?: boolean;
12
+ }
13
+ export interface CodingEvalRuntime {
14
+ root: Context;
15
+ loop: AgentLoop;
16
+ dispose(): Promise<void>;
17
+ }
18
+ export declare function createCodingEvalRuntime(options: CodingEvalRuntimeOptions): Promise<CodingEvalRuntime>;
@@ -0,0 +1,5 @@
1
+ export * from './strategies.js';
2
+ export * from './service.js';
3
+ export * from './types.js';
4
+ export * from './utils.js';
5
+ export declare const name = "index.js";
@@ -0,0 +1,8 @@
1
+ import type { ToolPolicy } from "../../tools/src/index.js";
2
+ import type { TaskPermissions } from './types.js';
3
+ export interface EvalToolPolicyOptions {
4
+ workspace: string;
5
+ permissions?: TaskPermissions;
6
+ maxOutputBytes?: number;
7
+ }
8
+ export declare function createEvalToolPolicy(options: EvalToolPolicyOptions): ToolPolicy;
@@ -0,0 +1,31 @@
1
+ import type { Context } from "../../core/src/index.js";
2
+ import { type EvalRun, type EvalRunOptions, type RunBudget } from './types.js';
3
+ import type { StrategyRegistry } from './strategies.js';
4
+ export declare class EvalRunner {
5
+ private ctx;
6
+ private strategies;
7
+ private defaultBudget;
8
+ private outputDir;
9
+ constructor(ctx: Context, strategies: StrategyRegistry, defaultBudget?: RunBudget, outputDir?: string);
10
+ run(options: EvalRunOptions): Promise<EvalRun>;
11
+ private _createTaskScope;
12
+ private _armTimeout;
13
+ private _runTask;
14
+ private _runCodingTask;
15
+ private _runCheck;
16
+ private _aggregateTrials;
17
+ private _fixtureRoot;
18
+ private _loop;
19
+ private _cacheKey;
20
+ private _sessionFile;
21
+ private _tokens;
22
+ private _cost;
23
+ private _exceeded;
24
+ private _summarize;
25
+ private _abort;
26
+ private _loadRun;
27
+ private _loadCachedEvidence;
28
+ private _saveCachedEvidence;
29
+ private _message;
30
+ private _errorPayload;
31
+ }
@@ -0,0 +1,23 @@
1
+ import type { Context } from "../../core/src/index.js";
2
+ import { type StrategyRegistry } from './strategies.js';
3
+ import { type CompareResult, type EvalPluginConfig, type EvalRun, type EvalRunOptions, type EvalStrategyDefinition } from './types.js';
4
+ export declare class EvalService {
5
+ private ctx;
6
+ private config;
7
+ readonly strategies: StrategyRegistry;
8
+ constructor(ctx: Context, config?: EvalPluginConfig);
9
+ register(definition: EvalStrategyDefinition): () => void;
10
+ unregister(name: string): boolean;
11
+ getStrategy(name: string): import("./types.js").EvalStrategy | undefined;
12
+ listStrategies(): string[];
13
+ run(options: EvalRunOptions): Promise<EvalRun>;
14
+ loadRun(input: string | EvalRun): Promise<EvalRun>;
15
+ saveRun(run: EvalRun, file?: string): Promise<string>;
16
+ compare(base: string | EvalRun, head: string | EvalRun): Promise<CompareResult>;
17
+ private _taskVerdict;
18
+ private _score;
19
+ }
20
+ export declare const evalPlugin: {
21
+ name: string;
22
+ apply: (ctx: Context, config?: EvalPluginConfig) => () => void;
23
+ };
@@ -0,0 +1,58 @@
1
+ import { type EvalStrategy, type EvalStrategyDefinition, type Evidence, type Task } from './types.js';
2
+ export interface AssertStrategyOptions {
3
+ /** Compare exact output when no task assertion is present. */
4
+ expect?: string | string[];
5
+ /** Treat a failing task as error instead of fail. */
6
+ strictFiles?: boolean;
7
+ }
8
+ export interface JudgeStrategyOptions {
9
+ judge?: (task: Task, evidence: Evidence) => number | Promise<number>;
10
+ /** Threshold above which the verdict passes (default 0.5). */
11
+ passThreshold?: number;
12
+ }
13
+ export interface RegressionStrategyOptions {
14
+ maxDegradation?: number;
15
+ requireBaseline?: boolean;
16
+ }
17
+ export interface AllStrategyOptions {
18
+ strategies?: string[];
19
+ }
20
+ export interface WeightedStrategyOptions {
21
+ strategies?: Array<{
22
+ name: string;
23
+ weight: number;
24
+ }>;
25
+ passThreshold?: number;
26
+ }
27
+ export interface GateStrategyOptions {
28
+ required?: string[];
29
+ thresholds?: Record<string, number>;
30
+ minScore?: number;
31
+ }
32
+ export interface CheckStrategyOptions {
33
+ /** Minimum pass rate over trials, default 1. */
34
+ passRate?: number;
35
+ }
36
+ export interface TraceStrategyOptions {
37
+ /** Minimum aggregate trace score, default 0.7. */
38
+ passThreshold?: number;
39
+ }
40
+ export declare function assertStrategy(options?: AssertStrategyOptions): EvalStrategy;
41
+ export declare function recordJudgeOutput(key: string, score: number): void;
42
+ export declare function recordedJudgeOutput(key: string): number | undefined;
43
+ export declare function judgeStrategy(options?: JudgeStrategyOptions): EvalStrategy;
44
+ export declare function regressionStrategy(options?: RegressionStrategyOptions): EvalStrategy;
45
+ export declare function allStrategy(options?: AllStrategyOptions): EvalStrategy;
46
+ export declare function weightedStrategy(options?: WeightedStrategyOptions): EvalStrategy;
47
+ export declare function gateStrategy(options?: GateStrategyOptions): EvalStrategy;
48
+ export declare function checkStrategy(options?: CheckStrategyOptions): EvalStrategy;
49
+ export declare function traceStrategy(options?: TraceStrategyOptions): EvalStrategy;
50
+ export interface StrategyRegistry {
51
+ register(definition: EvalStrategyDefinition): () => void;
52
+ unregister(name: string): boolean;
53
+ get(name: string): EvalStrategy | undefined;
54
+ has(name: string): boolean;
55
+ names(): string[];
56
+ }
57
+ export declare function createStrategyRegistry(initial?: EvalStrategyDefinition[]): StrategyRegistry;
58
+ export declare function defaultStrategyDefinitions(): EvalStrategyDefinition[];
@@ -0,0 +1,7 @@
1
+ import type { SessionEvent } from "../../session/src/index.js";
2
+ import type { TrialTrace } from './types.js';
3
+ export declare function readTrace(file: string): Promise<SessionEvent[]>;
4
+ export declare function deriveTraceMetrics(file: string, startedAt: number, endedAt: number, usage?: {
5
+ tokens?: number;
6
+ cost?: number;
7
+ }): Promise<TrialTrace>;
@@ -0,0 +1,281 @@
1
+ import type { Context, Plugin } from "../../core/src/index.js";
2
+ import type { AgentRunResult, LLMAdapter } from "../../agent/src/index.js";
3
+ import type { ModelMessage } from "../../session/src/index.js";
4
+ export type VerdictStatus = 'pass' | 'fail' | 'skip' | 'error';
5
+ export interface EvalWorkspaceFixture {
6
+ /** Template directory relative to the tasks file. */
7
+ root?: string;
8
+ /** Explicit file entries; use content or from. */
9
+ files?: Array<{
10
+ path: string;
11
+ content?: string;
12
+ from?: string;
13
+ }>;
14
+ }
15
+ export interface EvalShellPolicy {
16
+ enabled: boolean;
17
+ /** Allowed command prefixes, e.g. ["pytest", "pip install", "node"]. */
18
+ allow?: string[];
19
+ /** Denied command prefixes, e.g. ["rm", "taskkill"]. */
20
+ deny?: string[];
21
+ }
22
+ export interface TaskPermissions {
23
+ /** Tool whitelist; defaults to the safe builtin set. */
24
+ tools?: string[];
25
+ /** Shell policy; disabled by default. */
26
+ shell?: EvalShellPolicy;
27
+ /** Network tools; false by default. */
28
+ network?: boolean;
29
+ /** Skill tools; follows candidate config by default. */
30
+ skills?: boolean;
31
+ /** MCP is always false during eval. */
32
+ mcp?: boolean;
33
+ }
34
+ export interface TaskAssertion {
35
+ /** Exact output match, or a list of required substrings. */
36
+ expect?: string | string[];
37
+ /** Files that must exist, or a function checking files. */
38
+ files?: string[] | ((evidence: Evidence) => boolean | Promise<boolean>);
39
+ /** Arbitrary predicate over evidence and task. */
40
+ check?: (evidence: Evidence, task: Task) => boolean | Promise<boolean>;
41
+ }
42
+ export interface TaskBudget {
43
+ maxTurns?: number;
44
+ maxSteps?: number;
45
+ maxTimeMs?: number;
46
+ maxTokens?: number;
47
+ maxCost?: number;
48
+ }
49
+ export interface Task {
50
+ id: string;
51
+ name?: string;
52
+ description?: string;
53
+ input?: unknown;
54
+ inputText?: string;
55
+ messages?: ModelMessage[];
56
+ assertion?: TaskAssertion;
57
+ strategies?: string[];
58
+ budget?: TaskBudget;
59
+ artifacts?: Record<string, unknown>;
60
+ fixture?: EvalWorkspaceFixture;
61
+ /** Setup command or hook, run inside the workspace before the agent. */
62
+ setup?: string | ((workspace: string) => void | Promise<void>);
63
+ /** Success check: command (exit 0) or predicate. */
64
+ check?: string | ((evidence: Evidence, workspace: string) => boolean | Promise<boolean>);
65
+ /** Teardown command or hook, run after the trial. */
66
+ teardown?: string | ((workspace: string) => void | Promise<void>);
67
+ /** Default 3; must be >= 1. */
68
+ trials?: number;
69
+ permissions?: TaskPermissions;
70
+ /** Default 'train'. */
71
+ split?: 'train' | 'val';
72
+ }
73
+ export interface CandidateMetadata {
74
+ name: string;
75
+ version?: string;
76
+ config?: Record<string, unknown>;
77
+ model?: Record<string, unknown>;
78
+ }
79
+ export interface CandidatePreset {
80
+ plugin: Plugin;
81
+ name: string;
82
+ version?: string;
83
+ config?: Record<string, unknown>;
84
+ model?: Record<string, unknown>;
85
+ }
86
+ export interface TrialTraceMetrics {
87
+ steps: number;
88
+ turns: number;
89
+ toolCalls: number;
90
+ toolErrors: number;
91
+ invalidToolCalls: number;
92
+ retries: number;
93
+ tokens: number;
94
+ cost: number;
95
+ recoveredAfterError: boolean;
96
+ }
97
+ export interface TrialTrace {
98
+ file: string;
99
+ startedAt: number;
100
+ endedAt: number;
101
+ durationMs: number;
102
+ metrics: TrialTraceMetrics;
103
+ }
104
+ export interface TrialEvidence {
105
+ trial: number;
106
+ verdicts: Verdict[];
107
+ trace: TrialTrace;
108
+ agentResult?: AgentRunResult;
109
+ artifacts: Record<string, unknown>;
110
+ }
111
+ export interface Evidence {
112
+ task: Task;
113
+ agentResult?: AgentRunResult;
114
+ messages: ModelMessage[];
115
+ artifacts: Record<string, unknown>;
116
+ strategyOutputs: Record<string, unknown>;
117
+ trials?: TrialEvidence[];
118
+ }
119
+ export interface Verdict {
120
+ taskId: string;
121
+ strategy: string;
122
+ status: VerdictStatus;
123
+ score: number;
124
+ reason?: string;
125
+ output?: unknown;
126
+ meta?: Record<string, unknown>;
127
+ }
128
+ export interface RunBudget {
129
+ maxTurns?: number;
130
+ maxTokens?: number;
131
+ maxCost?: number;
132
+ maxTimeMs?: number;
133
+ }
134
+ export interface BudgetUsage {
135
+ turns: number;
136
+ tokens: number;
137
+ cost: number;
138
+ timeMs: number;
139
+ }
140
+ export interface EvalRun {
141
+ id: string;
142
+ createdAt: number;
143
+ candidate: CandidateMetadata;
144
+ taskIds: string[];
145
+ verdicts: Verdict[];
146
+ trialSummaries?: TrialSummary[];
147
+ summary: {
148
+ total: number;
149
+ passed: number;
150
+ failed: number;
151
+ skipped: number;
152
+ errors: number;
153
+ score: number;
154
+ budget: BudgetUsage;
155
+ };
156
+ cacheHits: number;
157
+ cacheKey?: string;
158
+ modelConfigHash?: string;
159
+ baselineRunId?: string;
160
+ aborted: boolean;
161
+ abortedReason?: string;
162
+ error?: {
163
+ message: string;
164
+ stack?: string;
165
+ };
166
+ }
167
+ export interface TrialSummary {
168
+ taskId: string;
169
+ trials: number;
170
+ passed: number;
171
+ passRate: number;
172
+ scoreMean: number;
173
+ scoreMedian: number;
174
+ scoreStddev: number;
175
+ costMean: number;
176
+ stepsMean: number;
177
+ }
178
+ export interface CodingEvalAgentConfig {
179
+ systemPrompt?: string;
180
+ maxTurns?: number;
181
+ maxSteps?: number;
182
+ }
183
+ export interface CodingEvalCodingConfig {
184
+ skills?: boolean;
185
+ planTools?: boolean;
186
+ mcp?: boolean;
187
+ planPrompt?: string;
188
+ }
189
+ export interface CodingEvalConfig {
190
+ llm: LLMAdapter;
191
+ agent?: CodingEvalAgentConfig;
192
+ coding?: CodingEvalCodingConfig;
193
+ }
194
+ export interface EvalRunOptions {
195
+ candidate: CandidatePreset;
196
+ tasks: readonly Task[];
197
+ strategyNames?: string[];
198
+ baselineRunId?: string;
199
+ budget?: RunBudget;
200
+ cache?: boolean;
201
+ cacheDir?: string;
202
+ outputFile?: string;
203
+ runCandidate?: (ctx: Context, task: Task) => Promise<AgentRunResult>;
204
+ coding?: CodingEvalConfig;
205
+ }
206
+ export interface StrategyContext {
207
+ ctx: Context;
208
+ run: Pick<EvalRun, 'id' | 'candidate'>;
209
+ baseline?: EvalRun;
210
+ }
211
+ export interface EvalStrategy {
212
+ name: string;
213
+ evaluate(ctx: StrategyContext, task: Task, evidence: Evidence): Verdict | Promise<Verdict>;
214
+ dispose?(): void | Promise<void>;
215
+ }
216
+ export interface EvalStrategyDefinition {
217
+ name: string;
218
+ evaluate: EvalStrategy['evaluate'];
219
+ }
220
+ export interface CompareResult {
221
+ base: EvalRun;
222
+ head: EvalRun;
223
+ summary: {
224
+ baseScore: number;
225
+ headScore: number;
226
+ delta: number;
227
+ passed: number;
228
+ failed: number;
229
+ regressions: string[];
230
+ improvements: string[];
231
+ };
232
+ taskResults: Array<{
233
+ taskId: string;
234
+ base: Verdict | undefined;
235
+ head: Verdict | undefined;
236
+ delta: number;
237
+ changed: boolean;
238
+ }>;
239
+ }
240
+ export interface EvalPluginConfig {
241
+ strategyNames?: string[];
242
+ defaultBudget?: RunBudget;
243
+ outputDir?: string;
244
+ llmJudge?: (task: Task, evidence: Evidence) => Promise<number> | number;
245
+ gate?: {
246
+ required?: string[];
247
+ thresholds?: Record<string, number>;
248
+ minScore?: number;
249
+ };
250
+ }
251
+ export interface EvalStartEvent {
252
+ runId: string;
253
+ candidate: CandidateMetadata;
254
+ taskIds: string[];
255
+ budget: RunBudget;
256
+ }
257
+ export interface EvalTaskStartEvent {
258
+ runId: string;
259
+ task: Task;
260
+ scope: Context;
261
+ }
262
+ export interface EvalTaskEndEvent {
263
+ runId: string;
264
+ task: Task;
265
+ evidence: Evidence;
266
+ durationMs: number;
267
+ fromCache: boolean;
268
+ }
269
+ export interface EvalVerdictEvent {
270
+ runId: string;
271
+ taskId: string;
272
+ verdict: Verdict;
273
+ }
274
+ export interface EvalRunEndEvent {
275
+ run: EvalRun;
276
+ }
277
+ export interface EvalAbortEvent {
278
+ runId: string;
279
+ taskId?: string;
280
+ reason: string;
281
+ }
@@ -0,0 +1,5 @@
1
+ export declare function stableStringify(value: unknown): string;
2
+ export declare function hashJson(value: unknown): string;
3
+ export declare function clone<T>(value: T): T;
4
+ export declare function saveJson(file: string, value: unknown): Promise<void>;
5
+ export declare function loadJson<T>(file: string): Promise<T>;
@@ -0,0 +1,17 @@
1
+ import type { Task } from './types.js';
2
+ export interface TaskWorkspace {
3
+ dir: string;
4
+ dispose(): Promise<void>;
5
+ }
6
+ export interface WorkspaceCommandOptions {
7
+ timeoutMs?: number;
8
+ maxBuffer?: number;
9
+ signal?: AbortSignal;
10
+ }
11
+ export interface WorkspaceCommandResult {
12
+ exitCode: number;
13
+ stdout: string;
14
+ stderr: string;
15
+ }
16
+ export declare function createTaskWorkspace(task: Task, fixtureRoot?: string): Promise<TaskWorkspace>;
17
+ export declare function runWorkspaceCommand(cwd: string, command: string, options?: WorkspaceCommandOptions): Promise<WorkspaceCommandResult>;
@@ -0,0 +1,9 @@
1
+ import type { EvalRun } from "../../eval/src/index.js";
2
+ import { type Candidate, type CandidateSnapshot, type Diagnosis, type ProposalContext, type ProposeRule } from './types.js';
3
+ export declare function emptyDiagnosis(): Diagnosis;
4
+ export declare function diagnose(run: EvalRun): Diagnosis;
5
+ export declare function candidateKey(candidate: Candidate): string;
6
+ export declare function proposeCandidates(context: ProposalContext, rules: readonly ProposeRule[]): Promise<Candidate[]>;
7
+ export declare function proposalContext(baseline: EvalRun | undefined, history: readonly import('./types.js').ExperimentNode[], rules: readonly ProposeRule[], iteration?: number, diagnosis?: Diagnosis): ProposalContext;
8
+ export declare function toCandidateSnapshot(candidate: Candidate): CandidateSnapshot;
9
+ export declare function toCandidatePreset(candidate: Candidate): import("../../eval/src/index.js").CandidatePreset;
@@ -0,0 +1,7 @@
1
+ export * from './diagnose.js';
2
+ export * from './llm.js';
3
+ export * from './log.js';
4
+ export * from './select.js';
5
+ export * from './service.js';
6
+ export * from './types.js';
7
+ export declare const name = "index.js";
@@ -0,0 +1,39 @@
1
+ import type { LLMAdapter } from "../../agent/src/index.js";
2
+ import type { Candidate, CandidateMutation, ProposeRule } from './types.js';
3
+ export interface LlmCandidateConfig {
4
+ system?: string;
5
+ maxTurns?: number;
6
+ maxSteps?: number;
7
+ }
8
+ export interface LlmCandidateOptions {
9
+ name: string;
10
+ version?: string;
11
+ system?: string;
12
+ adapter: LLMAdapter;
13
+ maxTurns?: number;
14
+ maxSteps?: number;
15
+ model?: Record<string, unknown>;
16
+ mutation?: CandidateMutation;
17
+ rationale?: string;
18
+ }
19
+ export interface LlmProposal {
20
+ name: string;
21
+ system: string;
22
+ rationale: string;
23
+ mutationDescription: string;
24
+ }
25
+ export interface LlmProposeRuleOptions {
26
+ adapter: LLMAdapter;
27
+ maxTurns?: number;
28
+ maxSteps?: number;
29
+ model?: Record<string, unknown>;
30
+ ruleId?: string;
31
+ parse?: (content: string) => LlmProposal | Promise<LlmProposal>;
32
+ }
33
+ export declare class LlmProposalError extends Error {
34
+ name: string;
35
+ }
36
+ export declare function withSystemPrompt(adapter: LLMAdapter, system: string): LLMAdapter;
37
+ export declare function llmCandidate(options: LlmCandidateOptions): Candidate;
38
+ export declare function createLlmProposeRule(options: LlmProposeRuleOptions): ProposeRule;
39
+ export declare function parseLlmProposal(content: string): LlmProposal;
@@ -0,0 +1,26 @@
1
+ import type { ExperimentLogData, ExperimentNode, ExperimentReplay } from './types.js';
2
+ export declare class ExperimentLog {
3
+ readonly file: string;
4
+ private _data;
5
+ constructor(file: string, data?: ExperimentLogData);
6
+ static open(file: string): Promise<ExperimentLog>;
7
+ get id(): string;
8
+ get baselineId(): string | undefined;
9
+ get baseline(): ExperimentNode | undefined;
10
+ get size(): number;
11
+ nodes(): ExperimentNode[];
12
+ get(id: string): ExperimentNode | undefined;
13
+ roots(): ExperimentNode[];
14
+ children(parentId: string): ExperimentNode[];
15
+ lineage(id: string): ExperimentNode[];
16
+ add(node: ExperimentNode): Promise<void>;
17
+ update(node: ExperimentNode): Promise<void>;
18
+ setBaseline(nodeId: string): Promise<void>;
19
+ fork(options?: {
20
+ parentId?: string;
21
+ file?: string;
22
+ }): Promise<ExperimentLog>;
23
+ replay(nodeId: string): Promise<ExperimentReplay>;
24
+ save(): Promise<void>;
25
+ private _empty;
26
+ }
@@ -0,0 +1,3 @@
1
+ import type { CompareResult, EvalRun } from "../../eval/src/index.js";
2
+ import type { ExperimentNode, GateCheck, SelectionPolicy } from './types.js';
3
+ export declare function evaluateGate(node: ExperimentNode, baseline: EvalRun | undefined, compare: CompareResult | undefined, policy?: SelectionPolicy): Promise<GateCheck[]>;
@@ -0,0 +1,29 @@
1
+ import type { Context } from "../../core/src/index.js";
2
+ import type { EvalRunOptions } from "../../eval/src/index.js";
3
+ import { ExperimentLog } from './log.js';
4
+ import type { Candidate, EvolveOptions, EvolvePluginConfig, EvolveStepOptions, EvolveStepResult, ExperimentNode, ProposalContext } from './types.js';
5
+ export declare class EvolveService {
6
+ private ctx;
7
+ private config;
8
+ private _log;
9
+ private _ready;
10
+ constructor(ctx: Context, config?: EvolvePluginConfig);
11
+ init(): Promise<ExperimentLog>;
12
+ propose(options?: Partial<ProposalContext>): Promise<Candidate[]>;
13
+ evaluate(candidate: Candidate, options?: Partial<EvalRunOptions>): Promise<ExperimentNode>;
14
+ decide(nodeId: string, approved?: boolean): Promise<ExperimentNode>;
15
+ approve(nodeId: string, approved?: boolean): Promise<ExperimentNode>;
16
+ step(options?: EvolveStepOptions): Promise<EvolveStepResult>;
17
+ evolve(options?: EvolveOptions): Promise<EvolveStepResult>;
18
+ baseline(): Promise<ExperimentNode | undefined>;
19
+ history(): Promise<ExperimentNode[]>;
20
+ replay(nodeId: string): Promise<import("./types.js").ExperimentReplay>;
21
+ loadLog(file?: string): Promise<ExperimentLog>;
22
+ private _eval;
23
+ private _nodeByRunId;
24
+ private _logFile;
25
+ }
26
+ export declare const evolvePlugin: {
27
+ name: string;
28
+ apply: (ctx: Context, config?: EvolvePluginConfig) => Promise<() => void>;
29
+ };