@alisio/sdk 0.6.0 → 0.7.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/index.d.ts +261 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -2775,4 +2775,265 @@ export interface ForgeProgress {
|
|
|
2775
2775
|
durationMs?: number;
|
|
2776
2776
|
};
|
|
2777
2777
|
}
|
|
2778
|
+
/** Hard limits of one reliability-lab task (`specs/010`). A run that exceeds one ends `budget_exceeded`. */
|
|
2779
|
+
export interface EvalBudget {
|
|
2780
|
+
maxTurns: number;
|
|
2781
|
+
maxTokens?: number;
|
|
2782
|
+
maxWallMs: number;
|
|
2783
|
+
maxToolCalls?: number;
|
|
2784
|
+
}
|
|
2785
|
+
/** Assertion over the sequence of tool events of one run. */
|
|
2786
|
+
export type ToolSequenceRule =
|
|
2787
|
+
/** `first` must occur before `then`. */
|
|
2788
|
+
{
|
|
2789
|
+
type: "before";
|
|
2790
|
+
first: string;
|
|
2791
|
+
then: string;
|
|
2792
|
+
} | {
|
|
2793
|
+
type: "never";
|
|
2794
|
+
tool: string;
|
|
2795
|
+
} | {
|
|
2796
|
+
type: "max-calls";
|
|
2797
|
+
tool: string;
|
|
2798
|
+
max: number;
|
|
2799
|
+
} | {
|
|
2800
|
+
type: "no-repeat-failure";
|
|
2801
|
+
tool: string;
|
|
2802
|
+
};
|
|
2803
|
+
/** Deterministic, local check of a task result. `kind` stays open for future adapters. */
|
|
2804
|
+
export type EvalVerifier = {
|
|
2805
|
+
kind: "command";
|
|
2806
|
+
id: string;
|
|
2807
|
+
command: string[];
|
|
2808
|
+
timeoutMs: number;
|
|
2809
|
+
expectExit?: number;
|
|
2810
|
+
expectStdoutIncludes?: string;
|
|
2811
|
+
} | {
|
|
2812
|
+
kind: "file-equals";
|
|
2813
|
+
id: string;
|
|
2814
|
+
path: string;
|
|
2815
|
+
sha256: string;
|
|
2816
|
+
} | {
|
|
2817
|
+
kind: "file-contains";
|
|
2818
|
+
id: string;
|
|
2819
|
+
path: string;
|
|
2820
|
+
text: string;
|
|
2821
|
+
} | {
|
|
2822
|
+
kind: "file-absent";
|
|
2823
|
+
id: string;
|
|
2824
|
+
path: string;
|
|
2825
|
+
} | {
|
|
2826
|
+
kind: "tree-diff-within";
|
|
2827
|
+
id: string;
|
|
2828
|
+
allowed: string[];
|
|
2829
|
+
} | {
|
|
2830
|
+
kind: "tool-sequence";
|
|
2831
|
+
id: string;
|
|
2832
|
+
rule: ToolSequenceRule;
|
|
2833
|
+
};
|
|
2834
|
+
export interface EvalTask {
|
|
2835
|
+
id: string;
|
|
2836
|
+
prompt: string;
|
|
2837
|
+
/** Fixture directory, relative to the suite directory. */
|
|
2838
|
+
fixture: string;
|
|
2839
|
+
agent?: string;
|
|
2840
|
+
budget: EvalBudget;
|
|
2841
|
+
/**
|
|
2842
|
+
* `allow` lists extra effects on top of the mode: `write`, `process`, `external` or `analysis`
|
|
2843
|
+
* (never MCP or agents). A task can only equal or restrict what the invoker already holds.
|
|
2844
|
+
*/
|
|
2845
|
+
policy: {
|
|
2846
|
+
mode: "ask" | "auto" | "full";
|
|
2847
|
+
readOnly?: boolean;
|
|
2848
|
+
allow?: string[];
|
|
2849
|
+
};
|
|
2850
|
+
verifiers: EvalVerifier[];
|
|
2851
|
+
tags?: string[];
|
|
2852
|
+
/** Initialize a git repository (identity set, no global config) in the run copy of the fixture. */
|
|
2853
|
+
fixtureGit?: boolean;
|
|
2854
|
+
/**
|
|
2855
|
+
* Replay-only noise filter, versioned with the suite: each `pattern` (a JavaScript regular
|
|
2856
|
+
* expression, applied globally) found in a string of a request is replaced by `replace` BEFORE
|
|
2857
|
+
* the request is fingerprinted, after the lab's own path and id normalization. Use it for
|
|
2858
|
+
* non-deterministic fixture output (a timestamp a command prints). Over-broad rules hide real
|
|
2859
|
+
* regressions; keep them narrow.
|
|
2860
|
+
*/
|
|
2861
|
+
replayNormalize?: Array<{
|
|
2862
|
+
pattern: string;
|
|
2863
|
+
replace: string;
|
|
2864
|
+
}>;
|
|
2865
|
+
}
|
|
2866
|
+
/** Content of a versioned `suite.json`. */
|
|
2867
|
+
export interface EvalSuite {
|
|
2868
|
+
schemaVersion: 1;
|
|
2869
|
+
suiteId: string;
|
|
2870
|
+
suiteVersion: string;
|
|
2871
|
+
description: string;
|
|
2872
|
+
tasks: EvalTask[];
|
|
2873
|
+
}
|
|
2874
|
+
/** One repetition of one task, with the conditions it was measured under. */
|
|
2875
|
+
export interface EvalRunRecord {
|
|
2876
|
+
schemaVersion: 1;
|
|
2877
|
+
runId: string;
|
|
2878
|
+
suiteId: string;
|
|
2879
|
+
suiteVersion: string;
|
|
2880
|
+
taskId: string;
|
|
2881
|
+
repetition: number;
|
|
2882
|
+
seed: number;
|
|
2883
|
+
harnessVersion: string;
|
|
2884
|
+
configHash: string;
|
|
2885
|
+
provider: string;
|
|
2886
|
+
model: string;
|
|
2887
|
+
mode: "live" | "replay";
|
|
2888
|
+
startedAt: number;
|
|
2889
|
+
endedAt: number;
|
|
2890
|
+
status: "pass" | "fail" | "budget_exceeded" | "error";
|
|
2891
|
+
/** Which budget ended the run; present only when `status` is `budget_exceeded`. */
|
|
2892
|
+
budgetExceeded?: "maxTurns" | "maxTokens" | "maxWallMs" | "maxToolCalls";
|
|
2893
|
+
/**
|
|
2894
|
+
* Why the run ended `error` (infrastructure or refusal), or the detail of a failure the model
|
|
2895
|
+
* caused (`fail` with a `run_aborted` incident). Never contains file contents.
|
|
2896
|
+
*/
|
|
2897
|
+
error?: string;
|
|
2898
|
+
/**
|
|
2899
|
+
* `sha256:` of the compaction-related configuration the run was measured under. Compaction
|
|
2900
|
+
* calls are not in `measured` tokens, so two runs with different compaction settings are not
|
|
2901
|
+
* comparable on tokens or cost.
|
|
2902
|
+
*/
|
|
2903
|
+
compactionHash?: string;
|
|
2904
|
+
verifiers: Array<{
|
|
2905
|
+
id: string;
|
|
2906
|
+
status: "pass" | "fail" | "error";
|
|
2907
|
+
detail?: string;
|
|
2908
|
+
}>;
|
|
2909
|
+
/** Provider-reported usage, wall time and event counts. Never mixed with `estimated`. */
|
|
2910
|
+
measured: {
|
|
2911
|
+
inputTokens?: number;
|
|
2912
|
+
outputTokens?: number;
|
|
2913
|
+
/**
|
|
2914
|
+
* True when only SOME turns reported usage: the token totals above understate the run and are
|
|
2915
|
+
* treated as not reported by every aggregation.
|
|
2916
|
+
*/
|
|
2917
|
+
usagePartial?: true;
|
|
2918
|
+
wallMs: number;
|
|
2919
|
+
turns: number;
|
|
2920
|
+
toolCalls: number;
|
|
2921
|
+
};
|
|
2922
|
+
/** Derived values (cost from configured rates, approximate tokens). */
|
|
2923
|
+
estimated?: {
|
|
2924
|
+
costUsd?: number;
|
|
2925
|
+
approxTokens?: number;
|
|
2926
|
+
};
|
|
2927
|
+
incidents: Array<{
|
|
2928
|
+
kind: string;
|
|
2929
|
+
count: number;
|
|
2930
|
+
}>;
|
|
2931
|
+
/**
|
|
2932
|
+
* Present on a replay run that ended `error` with `error: "replay_divergence"`: the harness asked
|
|
2933
|
+
* the provider for something the cassette did not record.
|
|
2934
|
+
*/
|
|
2935
|
+
divergence?: EvalReplayDivergence;
|
|
2936
|
+
}
|
|
2937
|
+
/** One field of a request that differs from the recorded one (excerpts are redacted, at most ~240 characters). */
|
|
2938
|
+
export interface EvalDivergenceEntry {
|
|
2939
|
+
call: number;
|
|
2940
|
+
/** For example `instructions`, `messages[2].tool.result`, `tools[read_file].description`, `model`. */
|
|
2941
|
+
field: string;
|
|
2942
|
+
excerpt: {
|
|
2943
|
+
before: string;
|
|
2944
|
+
after: string;
|
|
2945
|
+
};
|
|
2946
|
+
}
|
|
2947
|
+
/** Why a replay stopped: a changed request, a call past the recording, or recorded calls never asked for. */
|
|
2948
|
+
export interface EvalReplayDivergence {
|
|
2949
|
+
kind: "fingerprint" | "exhausted" | "unconsumed";
|
|
2950
|
+
message: string;
|
|
2951
|
+
/** Empty unless `kind` is `fingerprint`; at most 10 entries. */
|
|
2952
|
+
diff: EvalDivergenceEntry[];
|
|
2953
|
+
}
|
|
2954
|
+
/**
|
|
2955
|
+
* Rates the caller supplies to turn measured tokens into an estimated cost (USD per million
|
|
2956
|
+
* tokens). Alisio never ships or guesses rates: without them no cost is computed.
|
|
2957
|
+
*/
|
|
2958
|
+
export interface EvalRates {
|
|
2959
|
+
inputPerMTokUsd: number;
|
|
2960
|
+
outputPerMTokUsd: number;
|
|
2961
|
+
}
|
|
2962
|
+
/**
|
|
2963
|
+
* Reliability metrics of one task over its repetitions. Runs that ended `error` (infrastructure)
|
|
2964
|
+
* are not repetitions of the task: they are excluded from every number here and counted in
|
|
2965
|
+
* `errored`. `k` is the number of judged runs (pass, fail or budget_exceeded).
|
|
2966
|
+
*/
|
|
2967
|
+
export interface EvalTaskMetrics {
|
|
2968
|
+
taskId: string;
|
|
2969
|
+
k: number;
|
|
2970
|
+
/** Judged runs only. With `k: 0` the value is 0 and the interval [0, 1] carries no information. */
|
|
2971
|
+
successRate: {
|
|
2972
|
+
value: number;
|
|
2973
|
+
wilsonLow: number;
|
|
2974
|
+
wilsonHigh: number;
|
|
2975
|
+
};
|
|
2976
|
+
passAtK: boolean;
|
|
2977
|
+
passPowK: boolean;
|
|
2978
|
+
/** Runs of this task that ended `error` and were excluded from the numbers (omitted when 0). */
|
|
2979
|
+
errored?: number;
|
|
2980
|
+
/** `configHash` the task was measured under (a hash covers the task's own policy and budget). */
|
|
2981
|
+
configHash?: string;
|
|
2982
|
+
/**
|
|
2983
|
+
* Provider-reported usage and wall time only. A value that cannot be computed honestly is
|
|
2984
|
+
* omitted, never invented: the median needs one judged run, a variance two samples, the
|
|
2985
|
+
* per-success figures at least one success (and usage on every judged run for tokens).
|
|
2986
|
+
*/
|
|
2987
|
+
measured: {
|
|
2988
|
+
medianWallMs?: number;
|
|
2989
|
+
varianceWallMs?: number;
|
|
2990
|
+
varianceTokens?: number;
|
|
2991
|
+
tokensPerSuccess?: number;
|
|
2992
|
+
wallMsPerSuccess?: number;
|
|
2993
|
+
};
|
|
2994
|
+
/** Present only when the caller supplied rates and every judged run reported usage. */
|
|
2995
|
+
estimated?: {
|
|
2996
|
+
costUsdPerSuccess?: number;
|
|
2997
|
+
};
|
|
2998
|
+
}
|
|
2999
|
+
export interface EvalReport {
|
|
3000
|
+
schemaVersion: 1;
|
|
3001
|
+
suiteId: string;
|
|
3002
|
+
suiteVersion: string;
|
|
3003
|
+
conditions: {
|
|
3004
|
+
harnessVersion: string;
|
|
3005
|
+
configHash: string;
|
|
3006
|
+
provider: string;
|
|
3007
|
+
model: string;
|
|
3008
|
+
mode: "live" | "replay";
|
|
3009
|
+
k: number;
|
|
3010
|
+
seedBase: number;
|
|
3011
|
+
/** Compaction identity shared by every run (omitted for reports of older runs). */
|
|
3012
|
+
compactionHash?: string;
|
|
3013
|
+
};
|
|
3014
|
+
/** The variant this report was measured as (`eval variants`): its id and config overrides. */
|
|
3015
|
+
variant?: {
|
|
3016
|
+
id: string;
|
|
3017
|
+
overrides: Record<string, unknown>;
|
|
3018
|
+
};
|
|
3019
|
+
/** Caveats about what the numbers mean (for example which tokens are counted). */
|
|
3020
|
+
notes?: string[];
|
|
3021
|
+
tasks: EvalTaskMetrics[];
|
|
3022
|
+
/** IDs of the `EvalRunRecord`s, errored ones included (the detail lives in `runs.jsonl`). */
|
|
3023
|
+
runs: string[];
|
|
3024
|
+
/**
|
|
3025
|
+
* Counts of RUNS, except `tasks`: `passed`, `failed`, `errored` and `budgetExceeded` add up to
|
|
3026
|
+
* `runs`. `errored` runs are infrastructure and are excluded from every rate and spread.
|
|
3027
|
+
*/
|
|
3028
|
+
summary: {
|
|
3029
|
+
tasks: number;
|
|
3030
|
+
passed: number;
|
|
3031
|
+
errored: number;
|
|
3032
|
+
budgetExceeded: number;
|
|
3033
|
+
runs?: number;
|
|
3034
|
+
failed?: number;
|
|
3035
|
+
};
|
|
3036
|
+
/** The rates behind every `estimated` figure; absent when none was supplied. */
|
|
3037
|
+
rates?: EvalRates;
|
|
3038
|
+
}
|
|
2778
3039
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alisio/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Typed plugin SDK for Alisio: the stable contract for tools, commands, context, compaction and session hooks, model completions and storage. Types only plus tiny helpers; zero runtime dependencies.",
|
|
5
5
|
"author": "Gustavo Gutiérrez",
|
|
6
6
|
"license": "MIT",
|