@artemiskit/core 0.5.1 → 0.5.2
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/CHANGELOG.md +8 -0
- package/dist/artifacts/manifest.d.ts +4 -1
- package/dist/artifacts/manifest.d.ts.map +1 -1
- package/dist/artifacts/types.d.ts +58 -0
- package/dist/artifacts/types.d.ts.map +1 -1
- package/dist/index.js +517 -390
- package/dist/runner/executor.d.ts.map +1 -1
- package/dist/runner/runner.d.ts.map +1 -1
- package/dist/runner/types.d.ts +13 -1
- package/dist/runner/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/artifacts/manifest.test.ts +87 -1
- package/src/artifacts/manifest.ts +21 -29
- package/src/artifacts/types.ts +173 -0
- package/src/runner/executor.test.ts +50 -0
- package/src/runner/executor.ts +74 -2
- package/src/runner/runner.ts +20 -0
- package/src/runner/types.ts +7 -1
- package/src/scenario/schema.ts +1 -1
package/src/runner/runner.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Scenario runner - main entry point for running test scenarios
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
+
import { nanoid } from 'nanoid';
|
|
5
6
|
import { createRunManifest } from '../artifacts/manifest';
|
|
6
7
|
import type { CaseResult, ManifestRedactionInfo } from '../artifacts/types';
|
|
7
8
|
import { createExecutionProvenance, createWorkloadIdentity } from '../provenance';
|
|
@@ -22,6 +23,8 @@ export async function runScenario(options: RunOptions): Promise<RunResult> {
|
|
|
22
23
|
concurrency = 1,
|
|
23
24
|
timeout,
|
|
24
25
|
retries,
|
|
26
|
+
repetition = { index: 1, total: 1 },
|
|
27
|
+
costProvenance,
|
|
25
28
|
redaction,
|
|
26
29
|
toolExecutor,
|
|
27
30
|
onCaseComplete,
|
|
@@ -42,6 +45,7 @@ export async function runScenario(options: RunOptions): Promise<RunResult> {
|
|
|
42
45
|
onProgress?.(`Running ${cases.length} test cases...`);
|
|
43
46
|
|
|
44
47
|
const startTime = new Date();
|
|
48
|
+
const runId = nanoid(12);
|
|
45
49
|
const results: CaseResult[] = [];
|
|
46
50
|
|
|
47
51
|
if (concurrency === 1) {
|
|
@@ -54,6 +58,8 @@ export async function runScenario(options: RunOptions): Promise<RunResult> {
|
|
|
54
58
|
requestedModel: resolvedConfig?.model,
|
|
55
59
|
timeout: testCase.timeout || timeout,
|
|
56
60
|
retries: testCase.retries ?? retries,
|
|
61
|
+
runId,
|
|
62
|
+
repetition,
|
|
57
63
|
redaction,
|
|
58
64
|
toolExecutor,
|
|
59
65
|
});
|
|
@@ -74,6 +80,8 @@ export async function runScenario(options: RunOptions): Promise<RunResult> {
|
|
|
74
80
|
requestedModel: resolvedConfig?.model,
|
|
75
81
|
timeout: testCase.timeout || timeout,
|
|
76
82
|
retries: testCase.retries ?? retries,
|
|
83
|
+
runId,
|
|
84
|
+
repetition,
|
|
77
85
|
redaction,
|
|
78
86
|
toolExecutor,
|
|
79
87
|
});
|
|
@@ -132,9 +140,21 @@ export async function runScenario(options: RunOptions): Promise<RunResult> {
|
|
|
132
140
|
seed: scenario.seed,
|
|
133
141
|
cases: results,
|
|
134
142
|
}),
|
|
143
|
+
attemptEvidence: {
|
|
144
|
+
schema_version: '1',
|
|
145
|
+
repetition,
|
|
146
|
+
retry_policy: {
|
|
147
|
+
default_max_retries: retries ?? 0,
|
|
148
|
+
backoff: 'exponential',
|
|
149
|
+
initial_delay_ms: 1000,
|
|
150
|
+
},
|
|
151
|
+
...(timeout ? { timeout: { default_ms: timeout } } : {}),
|
|
152
|
+
},
|
|
153
|
+
costProvenance,
|
|
135
154
|
cases: results,
|
|
136
155
|
startTime,
|
|
137
156
|
endTime,
|
|
157
|
+
runId,
|
|
138
158
|
redaction: redactionInfo,
|
|
139
159
|
});
|
|
140
160
|
|
package/src/runner/types.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import type { ModelClient } from '../adapters/types';
|
|
6
|
-
import type { CaseResult, ResolvedConfig, RunManifest } from '../artifacts/types';
|
|
6
|
+
import type { CaseResult, CostProvenance, ResolvedConfig, RunManifest } from '../artifacts/types';
|
|
7
7
|
import type { RedactionConfig } from '../redaction/types';
|
|
8
8
|
import type { Scenario } from '../scenario/schema';
|
|
9
9
|
import type { ToolExecutor } from '../tools';
|
|
@@ -28,6 +28,10 @@ export interface RunOptions {
|
|
|
28
28
|
timeout?: number;
|
|
29
29
|
/** Number of retries per case */
|
|
30
30
|
retries?: number;
|
|
31
|
+
/** One-based coordinate for an independently planned repetition. */
|
|
32
|
+
repetition?: { index: number; total: number };
|
|
33
|
+
/** Attested or operator-supplied monetary evidence; omitted means unavailable. */
|
|
34
|
+
costProvenance?: CostProvenance;
|
|
31
35
|
/** Redaction configuration (CLI overrides scenario) */
|
|
32
36
|
redaction?: RedactionConfig;
|
|
33
37
|
/** SDK-only executor for explicitly supplied real tools. */
|
|
@@ -60,6 +64,8 @@ export interface ExecutorContext {
|
|
|
60
64
|
requestedModel?: string;
|
|
61
65
|
timeout?: number;
|
|
62
66
|
retries?: number;
|
|
67
|
+
runId?: string;
|
|
68
|
+
repetition?: { index: number; total: number };
|
|
63
69
|
/** Redaction configuration for this execution */
|
|
64
70
|
redaction?: RedactionConfig;
|
|
65
71
|
toolExecutor?: ToolExecutor;
|
package/src/scenario/schema.ts
CHANGED
|
@@ -225,7 +225,7 @@ export const TestCaseSchema = z.object({
|
|
|
225
225
|
tags: z.array(z.string()).optional().default([]),
|
|
226
226
|
metadata: z.record(z.unknown()).optional().default({}),
|
|
227
227
|
timeout: z.number().optional(),
|
|
228
|
-
retries: z.number().optional().default(0),
|
|
228
|
+
retries: z.number().int().min(0).max(99).optional().default(0),
|
|
229
229
|
provider: ProviderSchema.optional(),
|
|
230
230
|
model: z.string().optional(),
|
|
231
231
|
variables: VariablesSchema.optional(),
|