@alisio/alisio-code 0.6.0 → 0.8.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/eval.d.ts +101 -0
- package/dist/eval.js +690 -0
- package/dist/main.js +96 -1
- package/dist/proof.d.ts +52 -0
- package/dist/proof.js +121 -0
- package/dist/tui/app.js +24 -2
- package/dist/tui/goal.d.ts +5 -0
- package/dist/tui/goal.js +2 -0
- package/dist/tui/plan-review.d.ts +7 -1
- package/dist/tui/plan-review.js +24 -0
- package/dist/tui/proof.d.ts +51 -0
- package/dist/tui/proof.js +126 -0
- package/dist/tui/state.js +6 -0
- package/package.json +8 -8
package/dist/eval.d.ts
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `alisio eval list|run|record|compare|variants|export` (specs/010 5.4, Phases 3-4). Every function
|
|
3
|
+
* returns the exit code and talks only through the injected `EvalEnv`, so tests drive them without
|
|
4
|
+
* a process:
|
|
5
|
+
*
|
|
6
|
+
* 0 completed (independent of which tasks passed) 1 usage or infrastructure error
|
|
7
|
+
* 2 a replay diverged from its cassette 3 `compare` of incompatible suites
|
|
8
|
+
*
|
|
9
|
+
* `record` runs each task once live and writes `<suite>/cassettes/<taskId>.cassette.jsonl`;
|
|
10
|
+
* `run --mode replay` serves those cassettes (no provider, no credentials, no network). `export`
|
|
11
|
+
* writes one local, scrubbed JSON bundle of a stored run (nothing is uploaded). Reports go to `<stateHome>/eval/<runId>/` (or `--out DIR`): report.json, report.md, runs.jsonl.
|
|
12
|
+
* A suite given with `--suite-dir` is third-party code: it needs `--yes` (or an interactive
|
|
13
|
+
* confirmation) because a subprocess is not a sandbox.
|
|
14
|
+
*/
|
|
15
|
+
import type { BuiltinPlugin, Config, EvalApplication } from "@alisio/core";
|
|
16
|
+
import type { ModelProvider } from "@alisio/sdk";
|
|
17
|
+
/** The part of the command line `eval` reads, global flags included. */
|
|
18
|
+
export interface EvalFlags {
|
|
19
|
+
json?: boolean;
|
|
20
|
+
allowWrite?: boolean;
|
|
21
|
+
allowProcess?: boolean;
|
|
22
|
+
allowExternal?: boolean;
|
|
23
|
+
allowAnalysis?: boolean;
|
|
24
|
+
readOnly?: boolean;
|
|
25
|
+
disablePlugin?: string[];
|
|
26
|
+
suiteDir?: string;
|
|
27
|
+
tasks?: string;
|
|
28
|
+
k?: string;
|
|
29
|
+
seed?: string;
|
|
30
|
+
mode?: string;
|
|
31
|
+
keep?: boolean;
|
|
32
|
+
out?: string;
|
|
33
|
+
allowSuiteFull?: boolean;
|
|
34
|
+
yes?: boolean;
|
|
35
|
+
inputRate?: string;
|
|
36
|
+
outputRate?: string;
|
|
37
|
+
variants?: string;
|
|
38
|
+
md?: boolean;
|
|
39
|
+
cassetteDir?: string;
|
|
40
|
+
force?: boolean;
|
|
41
|
+
}
|
|
42
|
+
/** What a live run needs, resolved BEFORE any task starts (the engine takes a provider). */
|
|
43
|
+
export interface EvalRuntime {
|
|
44
|
+
provider: ModelProvider;
|
|
45
|
+
/** The effective configuration (variant overrides are applied on top of it). */
|
|
46
|
+
config: Config;
|
|
47
|
+
builtins: BuiltinPlugin[];
|
|
48
|
+
/** Exact credential values of the run's provider profile (a cassette holding one is refused). */
|
|
49
|
+
secrets?: string[];
|
|
50
|
+
resolveAgent?: (app: EvalApplication, agent: string) => ReturnType<NonNullable<ResolveAgent>>;
|
|
51
|
+
close(): Promise<void>;
|
|
52
|
+
}
|
|
53
|
+
type ResolveAgent = NonNullable<import("@alisio/core").RunEvaluationOptions["resolveAgent"]>;
|
|
54
|
+
export interface EvalEnv {
|
|
55
|
+
out(text: string): void;
|
|
56
|
+
err(text: string): void;
|
|
57
|
+
/** `<stateHome>`: reports default to `<stateDir>/eval/<runId>/`. */
|
|
58
|
+
stateDir: string;
|
|
59
|
+
/** Directory of the bundled suites: `tests/fixtures/eval` of a source checkout, absent elsewhere. */
|
|
60
|
+
bundledDir?: string;
|
|
61
|
+
interactive: boolean;
|
|
62
|
+
confirm(question: string): Promise<boolean>;
|
|
63
|
+
/**
|
|
64
|
+
* `requireProvider: false` (replay) must not fail when no provider is configured: the cassette
|
|
65
|
+
* is the provider, and the returned `provider` is then ignored.
|
|
66
|
+
*/
|
|
67
|
+
openRuntime(flags: EvalFlags, options?: {
|
|
68
|
+
requireProvider?: boolean;
|
|
69
|
+
}): Promise<EvalRuntime>;
|
|
70
|
+
newRunId(): string;
|
|
71
|
+
/** Parent of the per-run temporary directories (tests); default `os.tmpdir()`. */
|
|
72
|
+
tmpRoot?: string;
|
|
73
|
+
}
|
|
74
|
+
export declare function evalList(env: EvalEnv, flags: EvalFlags): Promise<number>;
|
|
75
|
+
export declare function evalRun(env: EvalEnv, flags: EvalFlags, suiteName: string): Promise<number>;
|
|
76
|
+
/**
|
|
77
|
+
* Runs each selected task ONCE live and writes its cassette. A task whose run errored, whose
|
|
78
|
+
* recording is unstable, or whose cassette holds a secret or is over the size limits writes
|
|
79
|
+
* nothing and makes the command exit 1; the other tasks are still recorded.
|
|
80
|
+
*/
|
|
81
|
+
export declare function evalRecord(env: EvalEnv, flags: EvalFlags, suiteName: string): Promise<number>;
|
|
82
|
+
export declare function evalCompare(env: EvalEnv, flags: EvalFlags, pathA: string, pathB: string): Promise<number>;
|
|
83
|
+
export declare function evalVariants(env: EvalEnv, flags: EvalFlags, suiteName: string): Promise<number>;
|
|
84
|
+
/**
|
|
85
|
+
* Writes ONE shareable JSON bundle `{schemaVersion, report, runs, markdown}` of the stored run
|
|
86
|
+
* `<stateDir>/eval/<runId>/`, scrubbed of absolute paths and secrets. A secret hit refuses it
|
|
87
|
+
* (exit 1). The file is local: nothing is uploaded.
|
|
88
|
+
*/
|
|
89
|
+
export declare function evalExport(env: EvalEnv, flags: EvalFlags, runId: string): Promise<number>;
|
|
90
|
+
type CliAppOptions = import("@alisio/core").AppOptions;
|
|
91
|
+
/**
|
|
92
|
+
* The real environment of `alisio eval`: the provider is resolved from the same sources as
|
|
93
|
+
* `alisio run` (flags, saved profile, trusted config) through a throwaway Application that only
|
|
94
|
+
* lends its provider and configuration. It does not carry the invoker's `--read-only`, which
|
|
95
|
+
* would stop the provider plugins from loading; the permissions the runs get come from
|
|
96
|
+
* `InvokerPermissions` instead. Its in-memory database never touches the user's sessions.
|
|
97
|
+
*/
|
|
98
|
+
export declare function realEvalEnv(appOptions: (flags: EvalFlags) => Promise<CliAppOptions>, defaults: () => Promise<{
|
|
99
|
+
builtins: BuiltinPlugin[];
|
|
100
|
+
}>): Promise<EvalEnv>;
|
|
101
|
+
export {};
|