@artemiskit/core 0.1.5 → 0.2.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/CHANGELOG.md +90 -0
- package/README.md +1 -0
- package/dist/adapters/types.d.ts +3 -1
- package/dist/adapters/types.d.ts.map +1 -1
- package/dist/artifacts/types.d.ts +39 -0
- package/dist/artifacts/types.d.ts.map +1 -1
- package/dist/cost/index.d.ts +5 -0
- package/dist/cost/index.d.ts.map +1 -0
- package/dist/cost/pricing.d.ts +66 -0
- package/dist/cost/pricing.d.ts.map +1 -0
- package/dist/evaluators/combined.d.ts +10 -0
- package/dist/evaluators/combined.d.ts.map +1 -0
- package/dist/evaluators/index.d.ts +4 -0
- package/dist/evaluators/index.d.ts.map +1 -1
- package/dist/evaluators/inline.d.ts +22 -0
- package/dist/evaluators/inline.d.ts.map +1 -0
- package/dist/evaluators/not-contains.d.ts +10 -0
- package/dist/evaluators/not-contains.d.ts.map +1 -0
- package/dist/evaluators/similarity.d.ts +16 -0
- package/dist/evaluators/similarity.d.ts.map +1 -0
- package/dist/events/emitter.d.ts +111 -0
- package/dist/events/emitter.d.ts.map +1 -0
- package/dist/events/index.d.ts +6 -0
- package/dist/events/index.d.ts.map +1 -0
- package/dist/events/types.d.ts +177 -0
- package/dist/events/types.d.ts.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +16904 -18362
- package/dist/scenario/discovery.d.ts +72 -0
- package/dist/scenario/discovery.d.ts.map +1 -0
- package/dist/scenario/index.d.ts +1 -0
- package/dist/scenario/index.d.ts.map +1 -1
- package/dist/scenario/schema.d.ts +1245 -9
- package/dist/scenario/schema.d.ts.map +1 -1
- package/dist/utils/logger.d.ts.map +1 -1
- package/package.json +5 -6
- package/src/adapters/types.ts +3 -1
- package/src/artifacts/types.ts +39 -0
- package/src/cost/index.ts +14 -0
- package/src/cost/pricing.ts +273 -0
- package/src/evaluators/combined.test.ts +172 -0
- package/src/evaluators/combined.ts +95 -0
- package/src/evaluators/index.ts +12 -0
- package/src/evaluators/inline.test.ts +409 -0
- package/src/evaluators/inline.ts +393 -0
- package/src/evaluators/not-contains.test.ts +105 -0
- package/src/evaluators/not-contains.ts +45 -0
- package/src/evaluators/similarity.test.ts +333 -0
- package/src/evaluators/similarity.ts +258 -0
- package/src/index.ts +3 -0
- package/src/scenario/discovery.test.ts +153 -0
- package/src/scenario/discovery.ts +277 -0
- package/src/scenario/index.ts +1 -0
- package/src/scenario/schema.ts +43 -2
- package/src/utils/logger.ts +45 -16
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Event types for observability integration
|
|
3
|
+
*
|
|
4
|
+
* These events are emitted by the core runner and can be consumed by
|
|
5
|
+
* the @artemiskit/observability package for metrics, traces, and hooks.
|
|
6
|
+
*/
|
|
7
|
+
import type { TokenUsage } from '../adapters/types';
|
|
8
|
+
/**
|
|
9
|
+
* Emitted when a test case starts execution
|
|
10
|
+
*/
|
|
11
|
+
export interface TestStartEvent {
|
|
12
|
+
type: 'test:start';
|
|
13
|
+
timestamp: number;
|
|
14
|
+
testId: string;
|
|
15
|
+
testName?: string;
|
|
16
|
+
scenarioName: string;
|
|
17
|
+
tags: string[];
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Emitted when a test case completes (success or failure)
|
|
21
|
+
*/
|
|
22
|
+
export interface TestCompleteEvent {
|
|
23
|
+
type: 'test:complete';
|
|
24
|
+
timestamp: number;
|
|
25
|
+
testId: string;
|
|
26
|
+
testName?: string;
|
|
27
|
+
scenarioName: string;
|
|
28
|
+
passed: boolean;
|
|
29
|
+
score: number;
|
|
30
|
+
durationMs: number;
|
|
31
|
+
evaluatorType: string;
|
|
32
|
+
reason?: string;
|
|
33
|
+
error?: string;
|
|
34
|
+
tags: string[];
|
|
35
|
+
tokens: TokenUsage;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Emitted when a scenario starts execution
|
|
39
|
+
*/
|
|
40
|
+
export interface ScenarioStartEvent {
|
|
41
|
+
type: 'scenario:start';
|
|
42
|
+
timestamp: number;
|
|
43
|
+
scenarioName: string;
|
|
44
|
+
testCount: number;
|
|
45
|
+
provider: string;
|
|
46
|
+
model?: string;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Emitted when a scenario completes
|
|
50
|
+
*/
|
|
51
|
+
export interface ScenarioCompleteEvent {
|
|
52
|
+
type: 'scenario:complete';
|
|
53
|
+
timestamp: number;
|
|
54
|
+
scenarioName: string;
|
|
55
|
+
durationMs: number;
|
|
56
|
+
passed: number;
|
|
57
|
+
failed: number;
|
|
58
|
+
skipped: number;
|
|
59
|
+
passRate: number;
|
|
60
|
+
totalTokens: number;
|
|
61
|
+
provider: string;
|
|
62
|
+
model?: string;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Emitted before a provider/LLM API call
|
|
66
|
+
*/
|
|
67
|
+
export interface ProviderCallStartEvent {
|
|
68
|
+
type: 'provider:call:start';
|
|
69
|
+
timestamp: number;
|
|
70
|
+
provider: string;
|
|
71
|
+
model: string;
|
|
72
|
+
testId: string;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Emitted after a provider/LLM API call completes
|
|
76
|
+
*/
|
|
77
|
+
export interface ProviderCallCompleteEvent {
|
|
78
|
+
type: 'provider:call:complete';
|
|
79
|
+
timestamp: number;
|
|
80
|
+
provider: string;
|
|
81
|
+
model: string;
|
|
82
|
+
testId: string;
|
|
83
|
+
latencyMs: number;
|
|
84
|
+
tokens: TokenUsage;
|
|
85
|
+
success: boolean;
|
|
86
|
+
error?: string;
|
|
87
|
+
finishReason?: string;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Emitted before an evaluator runs
|
|
91
|
+
*/
|
|
92
|
+
export interface EvaluatorStartEvent {
|
|
93
|
+
type: 'evaluator:start';
|
|
94
|
+
timestamp: number;
|
|
95
|
+
evaluatorType: string;
|
|
96
|
+
testId: string;
|
|
97
|
+
expected: unknown;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Emitted after an evaluator completes
|
|
101
|
+
*/
|
|
102
|
+
export interface EvaluatorCompleteEvent {
|
|
103
|
+
type: 'evaluator:complete';
|
|
104
|
+
timestamp: number;
|
|
105
|
+
evaluatorType: string;
|
|
106
|
+
testId: string;
|
|
107
|
+
passed: boolean;
|
|
108
|
+
score: number;
|
|
109
|
+
durationMs: number;
|
|
110
|
+
reason?: string;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Emitted when a run starts (can include multiple scenarios)
|
|
114
|
+
*/
|
|
115
|
+
export interface RunStartEvent {
|
|
116
|
+
type: 'run:start';
|
|
117
|
+
timestamp: number;
|
|
118
|
+
runId: string;
|
|
119
|
+
project: string;
|
|
120
|
+
command: 'run' | 'stress' | 'redteam';
|
|
121
|
+
scenarioCount: number;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Emitted when a run completes
|
|
125
|
+
*/
|
|
126
|
+
export interface RunCompleteEvent {
|
|
127
|
+
type: 'run:complete';
|
|
128
|
+
timestamp: number;
|
|
129
|
+
runId: string;
|
|
130
|
+
project: string;
|
|
131
|
+
command: 'run' | 'stress' | 'redteam';
|
|
132
|
+
durationMs: number;
|
|
133
|
+
totalTests: number;
|
|
134
|
+
passed: number;
|
|
135
|
+
failed: number;
|
|
136
|
+
success: boolean;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Emitted when an error occurs
|
|
140
|
+
*/
|
|
141
|
+
export interface ErrorEvent {
|
|
142
|
+
type: 'error';
|
|
143
|
+
timestamp: number;
|
|
144
|
+
error: Error;
|
|
145
|
+
source: 'test' | 'scenario' | 'provider' | 'evaluator' | 'runner';
|
|
146
|
+
context?: {
|
|
147
|
+
testId?: string;
|
|
148
|
+
scenarioName?: string;
|
|
149
|
+
provider?: string;
|
|
150
|
+
evaluatorType?: string;
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* All possible event types
|
|
155
|
+
*/
|
|
156
|
+
export type ArtemisEvent = TestStartEvent | TestCompleteEvent | ScenarioStartEvent | ScenarioCompleteEvent | ProviderCallStartEvent | ProviderCallCompleteEvent | EvaluatorStartEvent | EvaluatorCompleteEvent | RunStartEvent | RunCompleteEvent | ErrorEvent;
|
|
157
|
+
/**
|
|
158
|
+
* Event type string literals
|
|
159
|
+
*/
|
|
160
|
+
export type ArtemisEventType = ArtemisEvent['type'];
|
|
161
|
+
/**
|
|
162
|
+
* Map of event types to their payloads
|
|
163
|
+
*/
|
|
164
|
+
export interface ArtemisEventMap {
|
|
165
|
+
'test:start': TestStartEvent;
|
|
166
|
+
'test:complete': TestCompleteEvent;
|
|
167
|
+
'scenario:start': ScenarioStartEvent;
|
|
168
|
+
'scenario:complete': ScenarioCompleteEvent;
|
|
169
|
+
'provider:call:start': ProviderCallStartEvent;
|
|
170
|
+
'provider:call:complete': ProviderCallCompleteEvent;
|
|
171
|
+
'evaluator:start': EvaluatorStartEvent;
|
|
172
|
+
'evaluator:complete': EvaluatorCompleteEvent;
|
|
173
|
+
'run:start': RunStartEvent;
|
|
174
|
+
'run:complete': RunCompleteEvent;
|
|
175
|
+
error: ErrorEvent;
|
|
176
|
+
}
|
|
177
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/events/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAMpD;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,YAAY,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,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IACvC,oBAAoB,EAAE,sBAAsB,CAAC;IAC7C,WAAW,EAAE,aAAa,CAAC;IAC3B,cAAc,EAAE,gBAAgB,CAAC;IACjC,KAAK,EAAE,UAAU,CAAC;CACnB"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,cAAc,YAAY,CAAC;AAG3B,cAAc,YAAY,CAAC;AAG3B,cAAc,cAAc,CAAC;AAG7B,cAAc,UAAU,CAAC;AAGzB,cAAc,WAAW,CAAC;AAG1B,cAAc,aAAa,CAAC;AAG5B,cAAc,cAAc,CAAC;AAG7B,cAAc,SAAS,CAAC;AAGxB,cAAc,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,cAAc,YAAY,CAAC;AAG3B,cAAc,YAAY,CAAC;AAG3B,cAAc,cAAc,CAAC;AAG7B,cAAc,UAAU,CAAC;AAGzB,cAAc,WAAW,CAAC;AAG1B,cAAc,aAAa,CAAC;AAG5B,cAAc,cAAc,CAAC;AAG7B,cAAc,SAAS,CAAC;AAGxB,cAAc,aAAa,CAAC;AAG5B,cAAc,QAAQ,CAAC"}
|