@virtualkitchenco/multiverse-types 0.0.1

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.
@@ -0,0 +1,284 @@
1
+ /**
2
+ * Multiverse Types
3
+ *
4
+ * Public TypeScript types for the Multiverse SDK.
5
+ */
6
+ /**
7
+ * User persona style for simulation
8
+ */
9
+ export type PersonaStyle = 'cooperative' | 'impatient' | 'confused' | 'adversarial';
10
+ /**
11
+ * Rich persona definition
12
+ */
13
+ export interface Persona {
14
+ /** Detailed backstory */
15
+ backstory: string;
16
+ /** Current situation */
17
+ situation: string;
18
+ /** Interaction style */
19
+ style: PersonaStyle;
20
+ /** World rules/constraints */
21
+ constraints?: {
22
+ budget?: number;
23
+ preferences?: string[];
24
+ [key: string]: unknown;
25
+ };
26
+ }
27
+ /**
28
+ * Failure trigger types
29
+ */
30
+ export type FailureTrigger = 'first_call' | 'nth_call' | 'condition';
31
+ /**
32
+ * Failure types that can be injected
33
+ */
34
+ export type FailureType = 'error' | 'bad_data' | 'timeout' | 'empty';
35
+ /**
36
+ * Planned failure injection
37
+ */
38
+ export interface PlannedFailure {
39
+ tool: string;
40
+ trigger: FailureTrigger;
41
+ triggerValue?: number | string;
42
+ type: FailureType;
43
+ value?: string | Record<string, unknown>;
44
+ }
45
+ /**
46
+ * Expected behavior for grounded evaluation
47
+ */
48
+ export interface ExpectedBehavior {
49
+ mustDo: string[];
50
+ mustNotDo: string[];
51
+ successCriteria: string;
52
+ }
53
+ /**
54
+ * Contrastive examples for judge calibration
55
+ */
56
+ export interface ContrastiveExamples {
57
+ good?: string;
58
+ bad?: string;
59
+ }
60
+ /**
61
+ * Scenario definition
62
+ */
63
+ export interface Scenario {
64
+ name: string;
65
+ persona: Persona;
66
+ failures: PlannedFailure[];
67
+ expected: ExpectedBehavior;
68
+ examples?: ContrastiveExamples;
69
+ }
70
+ /**
71
+ * Entity in the world state
72
+ */
73
+ export interface Entity {
74
+ id: string;
75
+ type: string;
76
+ data: Record<string, unknown>;
77
+ references?: EntityReference[];
78
+ createdAt: number;
79
+ updatedAt: number;
80
+ }
81
+ /**
82
+ * Reference to another entity
83
+ */
84
+ export interface EntityReference {
85
+ collection: string;
86
+ id: string;
87
+ }
88
+ /**
89
+ * Mutation operation types
90
+ */
91
+ export type MutationOperation = 'create' | 'update' | 'delete';
92
+ /**
93
+ * World state mutation
94
+ */
95
+ export interface Mutation {
96
+ operation: MutationOperation;
97
+ collection: string;
98
+ id: string;
99
+ data?: object & {
100
+ references?: EntityReference[];
101
+ };
102
+ }
103
+ /**
104
+ * Trace entry types
105
+ */
106
+ export type TraceEntryType = 'call' | 'result' | 'error' | 'user' | 'agent';
107
+ /**
108
+ * Simulation action types
109
+ */
110
+ export type SimulationAction = 'return_existing' | 'filter' | 'augment' | 'generate';
111
+ /**
112
+ * Analysis result from simulation
113
+ */
114
+ export interface SimulationAnalysis {
115
+ action: SimulationAction;
116
+ matches: string[];
117
+ collection: string | null;
118
+ gaps: string[];
119
+ reasoning: string;
120
+ }
121
+ /**
122
+ * Single trace entry
123
+ */
124
+ export interface TraceEntry {
125
+ type: TraceEntryType;
126
+ timestamp: number;
127
+ tool?: string;
128
+ input?: unknown;
129
+ output?: unknown;
130
+ mutations?: Mutation[];
131
+ error?: string;
132
+ message?: string;
133
+ duration?: number;
134
+ analysis?: SimulationAnalysis;
135
+ }
136
+ /**
137
+ * World state snapshot
138
+ */
139
+ export interface WorldSnapshot {
140
+ id: string;
141
+ timestamp: number;
142
+ state: Map<string, Map<string, Entity>>;
143
+ timelineIndex: number;
144
+ }
145
+ /**
146
+ * Complete trace of an agent run
147
+ */
148
+ export interface Trace {
149
+ id: string;
150
+ scenario: string;
151
+ startTime: number;
152
+ endTime: number;
153
+ entries: TraceEntry[];
154
+ worldSnapshots: WorldSnapshot[];
155
+ }
156
+ /**
157
+ * Score for a single criterion
158
+ */
159
+ export interface CriterionScore {
160
+ name: string;
161
+ score: number;
162
+ explanation: string;
163
+ }
164
+ /**
165
+ * Quality result from the judge
166
+ */
167
+ export interface QualityResult {
168
+ score: number;
169
+ criteriaScores: CriterionScore[];
170
+ explanation: string;
171
+ }
172
+ /**
173
+ * Coverage statistics
174
+ */
175
+ export interface CoverageStats {
176
+ tested: number;
177
+ total: number;
178
+ percent: number;
179
+ untested: string[];
180
+ }
181
+ /**
182
+ * World state accessor for success function
183
+ */
184
+ export interface WorldStateAccessor {
185
+ getCollection: (name: string) => Map<string, Entity>;
186
+ getEntity: (collection: string, id: string) => Entity | undefined;
187
+ hasEntity: (collection: string, id: string) => boolean;
188
+ getCollectionNames: () => string[];
189
+ }
190
+ /**
191
+ * Success function type
192
+ */
193
+ export type SuccessFn = (world: WorldStateAccessor, trace: Trace) => boolean;
194
+ /**
195
+ * Result of a single test run
196
+ */
197
+ export interface RunResult {
198
+ id: string;
199
+ scenario: Scenario;
200
+ trace: Trace;
201
+ worldState: WorldStateAccessor;
202
+ taskCompleted: boolean;
203
+ quality: QualityResult;
204
+ passed: boolean;
205
+ duration: number;
206
+ }
207
+ /**
208
+ * Aggregated test results
209
+ */
210
+ export interface TestResults {
211
+ id: string;
212
+ runs: RunResult[];
213
+ passRate: number;
214
+ weakSpots: Array<{
215
+ scenario: string;
216
+ passRate: number;
217
+ }>;
218
+ duration: number;
219
+ url?: string;
220
+ }
221
+ /**
222
+ * Effect operation - CRUD operations on world state
223
+ */
224
+ export interface Effect {
225
+ operation: 'create' | 'update' | 'delete';
226
+ collection: string;
227
+ id: string;
228
+ data?: object;
229
+ }
230
+ /**
231
+ * Effects function type
232
+ */
233
+ export type EffectsFn<TOutput = unknown> = (output: TOutput, world: WorldStateAccessor) => Effect[];
234
+ /**
235
+ * Invariant condition types
236
+ */
237
+ export type InvariantCondition = 'gt' | 'gte' | 'lt' | 'lte' | 'eq' | 'neq';
238
+ /**
239
+ * Invariant definition
240
+ */
241
+ export interface Invariant {
242
+ collection: string;
243
+ field: string;
244
+ condition: InvariantCondition;
245
+ value: unknown;
246
+ }
247
+ /**
248
+ * Zod-like schema interface
249
+ */
250
+ export interface ZodLikeSchema {
251
+ parse: (data: unknown) => unknown;
252
+ safeParse: (data: unknown) => {
253
+ success: boolean;
254
+ data?: unknown;
255
+ error?: unknown;
256
+ };
257
+ }
258
+ /**
259
+ * Output schema type - can be Zod schema or plain JSON
260
+ */
261
+ export type OutputSchema = ZodLikeSchema | Record<string, unknown>;
262
+ /**
263
+ * Tool configuration for wrapping
264
+ */
265
+ export interface ToolConfig<TInput = unknown, TOutput = unknown> {
266
+ name: string;
267
+ description: string;
268
+ schema?: unknown;
269
+ outputSchema?: OutputSchema;
270
+ effects?: EffectsFn<TOutput>;
271
+ invariants?: Invariant[];
272
+ }
273
+ /**
274
+ * Supported LLM providers
275
+ */
276
+ export type LLMProvider = 'anthropic' | 'openai' | 'google';
277
+ /**
278
+ * LLM configuration
279
+ */
280
+ export interface LLMConfig {
281
+ provider: LLMProvider;
282
+ model?: string;
283
+ }
284
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,aAAa,GAAG,WAAW,GAAG,UAAU,GAAG,aAAa,CAAC;AAEpF;;GAEG;AACH,MAAM,WAAW,OAAO;IACtB,yBAAyB;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,wBAAwB;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,wBAAwB;IACxB,KAAK,EAAE,YAAY,CAAC;IACpB,8BAA8B;IAC9B,WAAW,CAAC,EAAE;QACZ,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;QACvB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;KACxB,CAAC;CACH;AAED;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,YAAY,GAAG,UAAU,GAAG,WAAW,CA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,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,OAAO,CAAC;IAClC,SAAS,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,IAAI,CAAC,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;CACrF;AAED;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEnE;;GAEG;AACH,MAAM,WAAW,UAAU,CAAC,MAAM,GAAG,OAAO,EAAE,OAAO,GAAG,OAAO;IAC7D,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,OAAO,CAAC,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC;IAC7B,UAAU,CAAC,EAAE,SAAS,EAAE,CAAC;CAC1B;AAMD;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,WAAW,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAE5D;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,QAAQ,EAAE,WAAW,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
package/dist/index.js ADDED
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Multiverse Types
3
+ *
4
+ * Public TypeScript types for the Multiverse SDK.
5
+ */
6
+ export {};
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
package/package.json ADDED
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "@virtualkitchenco/multiverse-types",
3
+ "version": "0.0.1",
4
+ "description": "TypeScript types for Multiverse SDK",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/virtualkitchenco/multiverse.git",
11
+ "directory": "packages/types"
12
+ },
13
+ "publishConfig": {
14
+ "access": "public"
15
+ },
16
+ "exports": {
17
+ ".": {
18
+ "types": "./dist/index.d.ts",
19
+ "import": "./dist/index.js"
20
+ }
21
+ },
22
+ "devDependencies": {
23
+ "typescript": "^5.3.3"
24
+ },
25
+ "files": [
26
+ "dist"
27
+ ],
28
+ "license": "MIT",
29
+ "scripts": {
30
+ "build": "tsc",
31
+ "dev": "tsc --watch",
32
+ "typecheck": "tsc --noEmit"
33
+ }
34
+ }