@open-livex-wiki/eval 0.0.0-stage → 0.1.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.
@@ -0,0 +1,259 @@
1
+ import { z } from "zod";
2
+ export declare const RoutingDimensionSchema: z.ZodEnum<{
3
+ domain: "domain";
4
+ scene: "scene";
5
+ repo: "repo";
6
+ chain: "chain";
7
+ }>;
8
+ export type RoutingDimension = z.infer<typeof RoutingDimensionSchema>;
9
+ export declare const ROUTING_DIMENSIONS: readonly RoutingDimension[];
10
+ export declare const RoutingTargetSetSchema: z.ZodObject<{
11
+ domains: z.ZodDefault<z.ZodArray<z.ZodString>>;
12
+ scenes: z.ZodDefault<z.ZodArray<z.ZodString>>;
13
+ repos: z.ZodDefault<z.ZodArray<z.ZodString>>;
14
+ chains: z.ZodDefault<z.ZodArray<z.ZodString>>;
15
+ }, z.core.$strip>;
16
+ export type RoutingTargetSet = z.infer<typeof RoutingTargetSetSchema>;
17
+ export declare const RoutingDatasetItemSchema: z.ZodObject<{
18
+ id: z.ZodString;
19
+ title: z.ZodOptional<z.ZodString>;
20
+ query: z.ZodString;
21
+ expected: z.ZodObject<{
22
+ domains: z.ZodDefault<z.ZodArray<z.ZodString>>;
23
+ scenes: z.ZodDefault<z.ZodArray<z.ZodString>>;
24
+ repos: z.ZodDefault<z.ZodArray<z.ZodString>>;
25
+ chains: z.ZodDefault<z.ZodArray<z.ZodString>>;
26
+ }, z.core.$strip>;
27
+ }, z.core.$strip>;
28
+ export type RoutingDatasetItem = z.infer<typeof RoutingDatasetItemSchema>;
29
+ export declare const RoutingDatasetObjectSchema: z.ZodObject<{
30
+ version: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
31
+ name: z.ZodOptional<z.ZodString>;
32
+ description: z.ZodOptional<z.ZodString>;
33
+ items: z.ZodArray<z.ZodObject<{
34
+ id: z.ZodString;
35
+ title: z.ZodOptional<z.ZodString>;
36
+ query: z.ZodString;
37
+ expected: z.ZodObject<{
38
+ domains: z.ZodDefault<z.ZodArray<z.ZodString>>;
39
+ scenes: z.ZodDefault<z.ZodArray<z.ZodString>>;
40
+ repos: z.ZodDefault<z.ZodArray<z.ZodString>>;
41
+ chains: z.ZodDefault<z.ZodArray<z.ZodString>>;
42
+ }, z.core.$strip>;
43
+ }, z.core.$strip>>;
44
+ }, z.core.$strip>;
45
+ export declare const RoutingDatasetSchema: z.ZodUnion<readonly [z.ZodObject<{
46
+ version: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
47
+ name: z.ZodOptional<z.ZodString>;
48
+ description: z.ZodOptional<z.ZodString>;
49
+ items: z.ZodArray<z.ZodObject<{
50
+ id: z.ZodString;
51
+ title: z.ZodOptional<z.ZodString>;
52
+ query: z.ZodString;
53
+ expected: z.ZodObject<{
54
+ domains: z.ZodDefault<z.ZodArray<z.ZodString>>;
55
+ scenes: z.ZodDefault<z.ZodArray<z.ZodString>>;
56
+ repos: z.ZodDefault<z.ZodArray<z.ZodString>>;
57
+ chains: z.ZodDefault<z.ZodArray<z.ZodString>>;
58
+ }, z.core.$strip>;
59
+ }, z.core.$strip>>;
60
+ }, z.core.$strip>, z.ZodArray<z.ZodObject<{
61
+ id: z.ZodString;
62
+ title: z.ZodOptional<z.ZodString>;
63
+ query: z.ZodString;
64
+ expected: z.ZodObject<{
65
+ domains: z.ZodDefault<z.ZodArray<z.ZodString>>;
66
+ scenes: z.ZodDefault<z.ZodArray<z.ZodString>>;
67
+ repos: z.ZodDefault<z.ZodArray<z.ZodString>>;
68
+ chains: z.ZodDefault<z.ZodArray<z.ZodString>>;
69
+ }, z.core.$strip>;
70
+ }, z.core.$strip>>]>;
71
+ export type RoutingDatasetFile = z.infer<typeof RoutingDatasetSchema>;
72
+ export declare const RoutingPredictionItemSchema: z.ZodObject<{
73
+ id: z.ZodString;
74
+ predicted: z.ZodObject<{
75
+ domains: z.ZodDefault<z.ZodArray<z.ZodString>>;
76
+ scenes: z.ZodDefault<z.ZodArray<z.ZodString>>;
77
+ repos: z.ZodDefault<z.ZodArray<z.ZodString>>;
78
+ chains: z.ZodDefault<z.ZodArray<z.ZodString>>;
79
+ }, z.core.$strip>;
80
+ visitedScenes: z.ZodOptional<z.ZodArray<z.ZodString>>;
81
+ toolCalls: z.ZodOptional<z.ZodNumber>;
82
+ latencyMs: z.ZodOptional<z.ZodNumber>;
83
+ tokensUsed: z.ZodOptional<z.ZodNumber>;
84
+ verifiedLiveSources: z.ZodOptional<z.ZodBoolean>;
85
+ adoptedPendingItems: z.ZodOptional<z.ZodBoolean>;
86
+ }, z.core.$strip>;
87
+ export type RoutingPredictionItem = z.infer<typeof RoutingPredictionItemSchema>;
88
+ export declare const RoutingPredictionsObjectSchema: z.ZodObject<{
89
+ model: z.ZodOptional<z.ZodString>;
90
+ runId: z.ZodOptional<z.ZodString>;
91
+ timestamp: z.ZodOptional<z.ZodString>;
92
+ items: z.ZodArray<z.ZodObject<{
93
+ id: z.ZodString;
94
+ predicted: z.ZodObject<{
95
+ domains: z.ZodDefault<z.ZodArray<z.ZodString>>;
96
+ scenes: z.ZodDefault<z.ZodArray<z.ZodString>>;
97
+ repos: z.ZodDefault<z.ZodArray<z.ZodString>>;
98
+ chains: z.ZodDefault<z.ZodArray<z.ZodString>>;
99
+ }, z.core.$strip>;
100
+ visitedScenes: z.ZodOptional<z.ZodArray<z.ZodString>>;
101
+ toolCalls: z.ZodOptional<z.ZodNumber>;
102
+ latencyMs: z.ZodOptional<z.ZodNumber>;
103
+ tokensUsed: z.ZodOptional<z.ZodNumber>;
104
+ verifiedLiveSources: z.ZodOptional<z.ZodBoolean>;
105
+ adoptedPendingItems: z.ZodOptional<z.ZodBoolean>;
106
+ }, z.core.$strip>>;
107
+ }, z.core.$strip>;
108
+ export declare const RoutingPredictionsFileSchema: z.ZodUnion<readonly [z.ZodObject<{
109
+ model: z.ZodOptional<z.ZodString>;
110
+ runId: z.ZodOptional<z.ZodString>;
111
+ timestamp: z.ZodOptional<z.ZodString>;
112
+ items: z.ZodArray<z.ZodObject<{
113
+ id: z.ZodString;
114
+ predicted: z.ZodObject<{
115
+ domains: z.ZodDefault<z.ZodArray<z.ZodString>>;
116
+ scenes: z.ZodDefault<z.ZodArray<z.ZodString>>;
117
+ repos: z.ZodDefault<z.ZodArray<z.ZodString>>;
118
+ chains: z.ZodDefault<z.ZodArray<z.ZodString>>;
119
+ }, z.core.$strip>;
120
+ visitedScenes: z.ZodOptional<z.ZodArray<z.ZodString>>;
121
+ toolCalls: z.ZodOptional<z.ZodNumber>;
122
+ latencyMs: z.ZodOptional<z.ZodNumber>;
123
+ tokensUsed: z.ZodOptional<z.ZodNumber>;
124
+ verifiedLiveSources: z.ZodOptional<z.ZodBoolean>;
125
+ adoptedPendingItems: z.ZodOptional<z.ZodBoolean>;
126
+ }, z.core.$strip>>;
127
+ }, z.core.$strip>, z.ZodArray<z.ZodObject<{
128
+ id: z.ZodString;
129
+ predicted: z.ZodObject<{
130
+ domains: z.ZodDefault<z.ZodArray<z.ZodString>>;
131
+ scenes: z.ZodDefault<z.ZodArray<z.ZodString>>;
132
+ repos: z.ZodDefault<z.ZodArray<z.ZodString>>;
133
+ chains: z.ZodDefault<z.ZodArray<z.ZodString>>;
134
+ }, z.core.$strip>;
135
+ visitedScenes: z.ZodOptional<z.ZodArray<z.ZodString>>;
136
+ toolCalls: z.ZodOptional<z.ZodNumber>;
137
+ latencyMs: z.ZodOptional<z.ZodNumber>;
138
+ tokensUsed: z.ZodOptional<z.ZodNumber>;
139
+ verifiedLiveSources: z.ZodOptional<z.ZodBoolean>;
140
+ adoptedPendingItems: z.ZodOptional<z.ZodBoolean>;
141
+ }, z.core.$strip>>]>;
142
+ export type RoutingPredictionsFile = z.infer<typeof RoutingPredictionsFileSchema>;
143
+ export declare const ConsumptionMismatchKindSchema: z.ZodEnum<{
144
+ stale_code: "stale_code";
145
+ missing_chain: "missing_chain";
146
+ broken_anchor: "broken_anchor";
147
+ uncovered_scene: "uncovered_scene";
148
+ }>;
149
+ export type ConsumptionMismatchKind = z.infer<typeof ConsumptionMismatchKindSchema>;
150
+ export declare const CONSUMPTION_MISMATCH_KINDS: readonly ConsumptionMismatchKind[];
151
+ export declare const ConsumptionMismatchSchema: z.ZodObject<{
152
+ sceneId: z.ZodString;
153
+ kind: z.ZodEnum<{
154
+ stale_code: "stale_code";
155
+ missing_chain: "missing_chain";
156
+ broken_anchor: "broken_anchor";
157
+ uncovered_scene: "uncovered_scene";
158
+ }>;
159
+ detail: z.ZodOptional<z.ZodString>;
160
+ }, z.core.$strip>;
161
+ export type ConsumptionMismatch = z.infer<typeof ConsumptionMismatchSchema>;
162
+ export declare const ConsumptionLogEntrySchema: z.ZodObject<{
163
+ taskId: z.ZodString;
164
+ timestamp: z.ZodString;
165
+ queriedDomains: z.ZodDefault<z.ZodArray<z.ZodString>>;
166
+ selectedScenes: z.ZodDefault<z.ZodArray<z.ZodString>>;
167
+ relevantScenes: z.ZodDefault<z.ZodArray<z.ZodString>>;
168
+ adoptedScenes: z.ZodDefault<z.ZodArray<z.ZodString>>;
169
+ wikiSupportedNeeds: z.ZodNumber;
170
+ totalNeeds: z.ZodNumber;
171
+ mismatches: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
172
+ sceneId: z.ZodString;
173
+ kind: z.ZodEnum<{
174
+ stale_code: "stale_code";
175
+ missing_chain: "missing_chain";
176
+ broken_anchor: "broken_anchor";
177
+ uncovered_scene: "uncovered_scene";
178
+ }>;
179
+ detail: z.ZodOptional<z.ZodString>;
180
+ }, z.core.$strip>>>>;
181
+ }, z.core.$strip>;
182
+ export type ConsumptionLogEntry = z.infer<typeof ConsumptionLogEntrySchema>;
183
+ export declare const ConsumptionLogsObjectSchema: z.ZodObject<{
184
+ version: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
185
+ entries: z.ZodArray<z.ZodObject<{
186
+ taskId: z.ZodString;
187
+ timestamp: z.ZodString;
188
+ queriedDomains: z.ZodDefault<z.ZodArray<z.ZodString>>;
189
+ selectedScenes: z.ZodDefault<z.ZodArray<z.ZodString>>;
190
+ relevantScenes: z.ZodDefault<z.ZodArray<z.ZodString>>;
191
+ adoptedScenes: z.ZodDefault<z.ZodArray<z.ZodString>>;
192
+ wikiSupportedNeeds: z.ZodNumber;
193
+ totalNeeds: z.ZodNumber;
194
+ mismatches: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
195
+ sceneId: z.ZodString;
196
+ kind: z.ZodEnum<{
197
+ stale_code: "stale_code";
198
+ missing_chain: "missing_chain";
199
+ broken_anchor: "broken_anchor";
200
+ uncovered_scene: "uncovered_scene";
201
+ }>;
202
+ detail: z.ZodOptional<z.ZodString>;
203
+ }, z.core.$strip>>>>;
204
+ }, z.core.$strip>>;
205
+ }, z.core.$strip>;
206
+ export declare const ConsumptionLogsFileSchema: z.ZodUnion<readonly [z.ZodObject<{
207
+ version: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
208
+ entries: z.ZodArray<z.ZodObject<{
209
+ taskId: z.ZodString;
210
+ timestamp: z.ZodString;
211
+ queriedDomains: z.ZodDefault<z.ZodArray<z.ZodString>>;
212
+ selectedScenes: z.ZodDefault<z.ZodArray<z.ZodString>>;
213
+ relevantScenes: z.ZodDefault<z.ZodArray<z.ZodString>>;
214
+ adoptedScenes: z.ZodDefault<z.ZodArray<z.ZodString>>;
215
+ wikiSupportedNeeds: z.ZodNumber;
216
+ totalNeeds: z.ZodNumber;
217
+ mismatches: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
218
+ sceneId: z.ZodString;
219
+ kind: z.ZodEnum<{
220
+ stale_code: "stale_code";
221
+ missing_chain: "missing_chain";
222
+ broken_anchor: "broken_anchor";
223
+ uncovered_scene: "uncovered_scene";
224
+ }>;
225
+ detail: z.ZodOptional<z.ZodString>;
226
+ }, z.core.$strip>>>>;
227
+ }, z.core.$strip>>;
228
+ }, z.core.$strip>, z.ZodArray<z.ZodObject<{
229
+ taskId: z.ZodString;
230
+ timestamp: z.ZodString;
231
+ queriedDomains: z.ZodDefault<z.ZodArray<z.ZodString>>;
232
+ selectedScenes: z.ZodDefault<z.ZodArray<z.ZodString>>;
233
+ relevantScenes: z.ZodDefault<z.ZodArray<z.ZodString>>;
234
+ adoptedScenes: z.ZodDefault<z.ZodArray<z.ZodString>>;
235
+ wikiSupportedNeeds: z.ZodNumber;
236
+ totalNeeds: z.ZodNumber;
237
+ mismatches: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
238
+ sceneId: z.ZodString;
239
+ kind: z.ZodEnum<{
240
+ stale_code: "stale_code";
241
+ missing_chain: "missing_chain";
242
+ broken_anchor: "broken_anchor";
243
+ uncovered_scene: "uncovered_scene";
244
+ }>;
245
+ detail: z.ZodOptional<z.ZodString>;
246
+ }, z.core.$strip>>>>;
247
+ }, z.core.$strip>>]>;
248
+ export type ConsumptionLogsFile = z.infer<typeof ConsumptionLogsFileSchema>;
249
+ export declare function parseRoutingDataset(raw: unknown): {
250
+ name?: string;
251
+ version?: string | number;
252
+ items: RoutingDatasetItem[];
253
+ };
254
+ export declare function parseRoutingPredictions(raw: unknown): {
255
+ model?: string;
256
+ items: RoutingPredictionItem[];
257
+ };
258
+ export declare function parseConsumptionLogs(raw: unknown): ConsumptionLogEntry[];
259
+ //# sourceMappingURL=schemas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,sBAAsB;;;;;EAA+C,CAAC;AACnF,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEtE,eAAO,MAAM,kBAAkB,EAAE,SAAS,gBAAgB,EAKhD,CAAC;AAEX,eAAO,MAAM,sBAAsB;;;;;iBAKj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CAAC,OAAO,yBAAyB,CAAC,CAAC;AAE5E,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;iBAGtC,CAAC;AAEH,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBAGpC,CAAC;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAE5E,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,OAAO,GAAG;IACjD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC1B,KAAK,EAAE,kBAAkB,EAAE,CAAC;CAC7B,CAUA;AAED,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,OAAO,GAAG;IACrD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,qBAAqB,EAAE,CAAC;CAChC,CASA;AAED,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,OAAO,GAAG,mBAAmB,EAAE,CAGxE"}
@@ -0,0 +1,112 @@
1
+ import { z } from "zod";
2
+ export const RoutingDimensionSchema = z.enum(["domain", "scene", "repo", "chain"]);
3
+ export const ROUTING_DIMENSIONS = [
4
+ "domain",
5
+ "scene",
6
+ "repo",
7
+ "chain",
8
+ ];
9
+ export const RoutingTargetSetSchema = z.object({
10
+ domains: z.array(z.string()).default([]),
11
+ scenes: z.array(z.string()).default([]),
12
+ repos: z.array(z.string()).default([]),
13
+ chains: z.array(z.string()).default([]),
14
+ });
15
+ export const RoutingDatasetItemSchema = z.object({
16
+ id: z.string().min(1),
17
+ title: z.string().min(1).optional(),
18
+ query: z.string().min(1),
19
+ expected: RoutingTargetSetSchema,
20
+ });
21
+ export const RoutingDatasetObjectSchema = z.object({
22
+ version: z.union([z.string().min(1), z.number().int().positive()]).optional(),
23
+ name: z.string().min(1).optional(),
24
+ description: z.string().optional(),
25
+ items: z.array(RoutingDatasetItemSchema),
26
+ });
27
+ export const RoutingDatasetSchema = z.union([
28
+ RoutingDatasetObjectSchema,
29
+ z.array(RoutingDatasetItemSchema),
30
+ ]);
31
+ export const RoutingPredictionItemSchema = z.object({
32
+ id: z.string().min(1),
33
+ predicted: RoutingTargetSetSchema,
34
+ visitedScenes: z.array(z.string()).optional(),
35
+ toolCalls: z.number().int().nonnegative().optional(),
36
+ latencyMs: z.number().nonnegative().optional(),
37
+ tokensUsed: z.number().int().nonnegative().optional(),
38
+ verifiedLiveSources: z.boolean().optional(),
39
+ adoptedPendingItems: z.boolean().optional(),
40
+ });
41
+ export const RoutingPredictionsObjectSchema = z.object({
42
+ model: z.string().min(1).optional(),
43
+ runId: z.string().min(1).optional(),
44
+ timestamp: z.string().min(1).optional(),
45
+ items: z.array(RoutingPredictionItemSchema),
46
+ });
47
+ export const RoutingPredictionsFileSchema = z.union([
48
+ RoutingPredictionsObjectSchema,
49
+ z.array(RoutingPredictionItemSchema),
50
+ ]);
51
+ export const ConsumptionMismatchKindSchema = z.enum([
52
+ "stale_code",
53
+ "missing_chain",
54
+ "broken_anchor",
55
+ "uncovered_scene",
56
+ ]);
57
+ export const CONSUMPTION_MISMATCH_KINDS = [
58
+ "stale_code",
59
+ "missing_chain",
60
+ "broken_anchor",
61
+ "uncovered_scene",
62
+ ];
63
+ export const ConsumptionMismatchSchema = z.object({
64
+ sceneId: z.string().min(1),
65
+ kind: ConsumptionMismatchKindSchema,
66
+ detail: z.string().optional(),
67
+ });
68
+ export const ConsumptionLogEntrySchema = z.object({
69
+ taskId: z.string().min(1),
70
+ timestamp: z.string().min(1),
71
+ queriedDomains: z.array(z.string()).default([]),
72
+ selectedScenes: z.array(z.string()).default([]),
73
+ relevantScenes: z.array(z.string()).default([]),
74
+ adoptedScenes: z.array(z.string()).default([]),
75
+ wikiSupportedNeeds: z.number().int().nonnegative(),
76
+ totalNeeds: z.number().int().nonnegative(),
77
+ mismatches: z.array(ConsumptionMismatchSchema).optional().default([]),
78
+ });
79
+ export const ConsumptionLogsObjectSchema = z.object({
80
+ version: z.union([z.string().min(1), z.number().int().positive()]).optional(),
81
+ entries: z.array(ConsumptionLogEntrySchema),
82
+ });
83
+ export const ConsumptionLogsFileSchema = z.union([
84
+ ConsumptionLogsObjectSchema,
85
+ z.array(ConsumptionLogEntrySchema),
86
+ ]);
87
+ export function parseRoutingDataset(raw) {
88
+ const parsed = RoutingDatasetSchema.parse(raw);
89
+ if (Array.isArray(parsed)) {
90
+ return { items: parsed };
91
+ }
92
+ return {
93
+ ...(parsed.name !== undefined ? { name: parsed.name } : {}),
94
+ ...(parsed.version !== undefined ? { version: parsed.version } : {}),
95
+ items: parsed.items,
96
+ };
97
+ }
98
+ export function parseRoutingPredictions(raw) {
99
+ const parsed = RoutingPredictionsFileSchema.parse(raw);
100
+ if (Array.isArray(parsed)) {
101
+ return { items: parsed };
102
+ }
103
+ return {
104
+ ...(parsed.model !== undefined ? { model: parsed.model } : {}),
105
+ items: parsed.items,
106
+ };
107
+ }
108
+ export function parseConsumptionLogs(raw) {
109
+ const parsed = ConsumptionLogsFileSchema.parse(raw);
110
+ return Array.isArray(parsed) ? parsed : parsed.entries;
111
+ }
112
+ //# sourceMappingURL=schemas.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemas.js","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AAGnF,MAAM,CAAC,MAAM,kBAAkB,GAAgC;IAC7D,QAAQ;IACR,OAAO;IACP,MAAM;IACN,OAAO;CACC,CAAC;AAEX,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7C,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,C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AO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACpE,KAAK,EAAE,MAAM,CAAC,KAAK;KACpB,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,GAAY;IAIlD,MAAM,MAAM,GAAG,4BAA4B,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACvD,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAC1B,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;IAC3B,CAAC;IACD,OAAO;QACL,GAAG,CAAC,MAAM,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC9D,KAAK,EAAE,MAAM,CAAC,KAAK;KACpB,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,GAAY;IAC/C,MAAM,MAAM,GAAG,yBAAyB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACpD,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC;AACzD,CAAC"}
@@ -0,0 +1,37 @@
1
+ import { type ConsumptionLogEntry, type ConsumptionMismatchKind } from "./schemas.js";
2
+ export interface MismatchedSceneSummary {
3
+ sceneId: string;
4
+ count: number;
5
+ kinds: Record<ConsumptionMismatchKind, number>;
6
+ }
7
+ export interface ConsumptionTelemetrySummary {
8
+ generatedAt: string;
9
+ totalTasks: number;
10
+ totalSelectedScenes: number;
11
+ totalRelevantScenes: number;
12
+ totalAdoptedScenes: number;
13
+ totalWikiSupportedNeeds: number;
14
+ totalNeeds: number;
15
+ relevanceRate: number;
16
+ adoptionRate: number;
17
+ adoptionAmongRelevantRate: number;
18
+ wikiSupportRate: number;
19
+ totalMismatches: number;
20
+ mismatchCounts: Record<ConsumptionMismatchKind, number>;
21
+ topMismatchedScenes: MismatchedSceneSummary[];
22
+ domainQueryCounts: Record<string, number>;
23
+ }
24
+ /**
25
+ * Analyzes offline or online consumption telemetry logs to measure relevance rate,
26
+ * adoption rate, wiki need-support rate, and mismatch breakdown by root cause.
27
+ */
28
+ export declare function analyzeConsumptionLogs(entries: ConsumptionLogEntry[]): ConsumptionTelemetrySummary;
29
+ /**
30
+ * Loads a consumption log JSON file from disk and analyzes it.
31
+ */
32
+ export declare function analyzeConsumptionLogFile(logPath: string): Promise<ConsumptionTelemetrySummary>;
33
+ /**
34
+ * Formats a `ConsumptionTelemetrySummary` as a GitHub-flavored Markdown report.
35
+ */
36
+ export declare function formatConsumptionSummaryMarkdown(summary: ConsumptionTelemetrySummary): string;
37
+ //# sourceMappingURL=telemetry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"telemetry.d.ts","sourceRoot":"","sources":["../src/telemetry.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,uBAAuB,EAE7B,MAAM,cAAc,CAAC;AAEtB,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC,uBAAuB,EAAE,MAAM,CAAC,CAAC;CAChD;AAED,MAAM,WAAW,2BAA2B;IAC1C,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,mBAAmB,EAAE,MAAM,CAAC;IAC5B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,uBAAuB,EAAE,MAAM,CAAC;IAChC,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,yBAAyB,EAAE,MAAM,CAAC;IAClC,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC,uBAAuB,EAAE,MAAM,CAAC,CAAC;IACxD,mBAAmB,EAAE,sBAAsB,EAAE,CAAC;IAC9C,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC3C;AAiBD;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,mBAAmB,EAAE,GAC7B,2BAA2B,CAsG7B;AAED;;GAEG;AACH,wBAAsB,yBAAyB,CAC7C,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,2BAA2B,CAAC,CAItC;AAaD;;GAEG;AACH,wBAAgB,gCAAgC,CAAC,OAAO,EAAE,2BAA2B,GAAG,MAAM,CAsD7F"}
@@ -0,0 +1,165 @@
1
+ import fs from "node:fs/promises";
2
+ import path from "node:path";
3
+ import { toPosixPath } from "@open-livex-wiki/core";
4
+ import { CONSUMPTION_MISMATCH_KINDS, parseConsumptionLogs, } from "./schemas.js";
5
+ function round4(value) {
6
+ return Number(value.toFixed(4));
7
+ }
8
+ function normalizeUnique(values) {
9
+ const set = new Set();
10
+ for (const v of values) {
11
+ const norm = toPosixPath(v.trim());
12
+ if (norm.length > 0) {
13
+ set.add(norm);
14
+ }
15
+ }
16
+ return Array.from(set);
17
+ }
18
+ /**
19
+ * Analyzes offline or online consumption telemetry logs to measure relevance rate,
20
+ * adoption rate, wiki need-support rate, and mismatch breakdown by root cause.
21
+ */
22
+ export function analyzeConsumptionLogs(entries) {
23
+ let totalSelectedScenes = 0;
24
+ let totalRelevantScenes = 0;
25
+ let totalAdoptedScenes = 0;
26
+ let totalAdoptedRelevantScenes = 0;
27
+ let totalWikiSupportedNeeds = 0;
28
+ let totalNeeds = 0;
29
+ let totalMismatches = 0;
30
+ const mismatchCounts = {
31
+ stale_code: 0,
32
+ missing_chain: 0,
33
+ broken_anchor: 0,
34
+ uncovered_scene: 0,
35
+ };
36
+ const sceneMismatchMap = new Map();
37
+ const domainQueryCounts = {};
38
+ for (const entry of entries) {
39
+ const selected = normalizeUnique(entry.selectedScenes);
40
+ const relevantSet = new Set(normalizeUnique(entry.relevantScenes));
41
+ const adoptedSet = new Set(normalizeUnique(entry.adoptedScenes));
42
+ const domains = normalizeUnique(entry.queriedDomains);
43
+ const relevantSelected = selected.filter((s) => relevantSet.has(s));
44
+ const adoptedSelected = selected.filter((s) => adoptedSet.has(s));
45
+ const adoptedRelevantSelected = relevantSelected.filter((s) => adoptedSet.has(s));
46
+ totalSelectedScenes += selected.length;
47
+ totalRelevantScenes += relevantSelected.length;
48
+ totalAdoptedScenes += adoptedSelected.length;
49
+ totalAdoptedRelevantScenes += adoptedRelevantSelected.length;
50
+ totalWikiSupportedNeeds += Math.min(entry.wikiSupportedNeeds, entry.totalNeeds);
51
+ totalNeeds += entry.totalNeeds;
52
+ for (const domainId of domains) {
53
+ domainQueryCounts[domainId] = (domainQueryCounts[domainId] ?? 0) + 1;
54
+ }
55
+ for (const mismatch of entry.mismatches ?? []) {
56
+ totalMismatches += 1;
57
+ mismatchCounts[mismatch.kind] += 1;
58
+ const sceneId = toPosixPath(mismatch.sceneId.trim());
59
+ let sceneRecord = sceneMismatchMap.get(sceneId);
60
+ if (!sceneRecord) {
61
+ sceneRecord = {
62
+ count: 0,
63
+ kinds: {
64
+ stale_code: 0,
65
+ missing_chain: 0,
66
+ broken_anchor: 0,
67
+ uncovered_scene: 0,
68
+ },
69
+ };
70
+ sceneMismatchMap.set(sceneId, sceneRecord);
71
+ }
72
+ sceneRecord.count += 1;
73
+ sceneRecord.kinds[mismatch.kind] += 1;
74
+ }
75
+ }
76
+ const relevanceRate = totalSelectedScenes > 0 ? round4(Math.min(1, totalRelevantScenes / totalSelectedScenes)) : 0;
77
+ const adoptionRate = totalSelectedScenes > 0 ? round4(Math.min(1, totalAdoptedScenes / totalSelectedScenes)) : 0;
78
+ const adoptionAmongRelevantRate = totalRelevantScenes > 0
79
+ ? round4(Math.min(1, totalAdoptedRelevantScenes / totalRelevantScenes))
80
+ : 0;
81
+ const wikiSupportRate = totalNeeds > 0 ? round4(Math.min(1, totalWikiSupportedNeeds / totalNeeds)) : 0;
82
+ const topMismatchedScenes = Array.from(sceneMismatchMap.entries())
83
+ .map(([sceneId, info]) => ({
84
+ sceneId,
85
+ count: info.count,
86
+ kinds: info.kinds,
87
+ }))
88
+ .sort((a, b) => b.count - a.count || a.sceneId.localeCompare(b.sceneId));
89
+ return {
90
+ generatedAt: new Date().toISOString(),
91
+ totalTasks: entries.length,
92
+ totalSelectedScenes,
93
+ totalRelevantScenes,
94
+ totalAdoptedScenes,
95
+ totalWikiSupportedNeeds,
96
+ totalNeeds,
97
+ relevanceRate,
98
+ adoptionRate,
99
+ adoptionAmongRelevantRate,
100
+ wikiSupportRate,
101
+ totalMismatches,
102
+ mismatchCounts,
103
+ topMismatchedScenes,
104
+ domainQueryCounts,
105
+ };
106
+ }
107
+ /**
108
+ * Loads a consumption log JSON file from disk and analyzes it.
109
+ */
110
+ export async function analyzeConsumptionLogFile(logPath) {
111
+ const rawText = await fs.readFile(path.resolve(logPath), "utf8");
112
+ const entries = parseConsumptionLogs(JSON.parse(rawText));
113
+ return analyzeConsumptionLogs(entries);
114
+ }
115
+ function fmtPct(value) {
116
+ return `${(value * 100).toFixed(2)}%`;
117
+ }
118
+ const MISMATCH_LABELS = {
119
+ stale_code: "Stale Code (代码基线过期)",
120
+ missing_chain: "Missing Chain (核心链路遗漏)",
121
+ broken_anchor: "Broken Anchor (定位锚点失效)",
122
+ uncovered_scene: "Uncovered Scene (场景未覆盖)",
123
+ };
124
+ /**
125
+ * Formats a `ConsumptionTelemetrySummary` as a GitHub-flavored Markdown report.
126
+ */
127
+ export function formatConsumptionSummaryMarkdown(summary) {
128
+ const lines = [];
129
+ lines.push("# Wiki Consumption Telemetry Report");
130
+ lines.push("");
131
+ lines.push(`- **Tasks Observed**: ${summary.totalTasks}`);
132
+ lines.push(`- **Selected Scenes**: ${summary.totalSelectedScenes}`);
133
+ lines.push(`- **Total Knowledge Needs**: ${summary.totalNeeds} (${summary.totalWikiSupportedNeeds} supported by Wiki)`);
134
+ lines.push("");
135
+ lines.push("## 1. Core Consumption Metrics");
136
+ lines.push("");
137
+ lines.push("| Metric | Rate | Counts |");
138
+ lines.push("| --- | ---: | --- |");
139
+ lines.push(`| Relevance Rate (知识相关率) | **${fmtPct(summary.relevanceRate)}** | ${summary.totalRelevantScenes} / ${summary.totalSelectedScenes} selected |`);
140
+ lines.push(`| Adoption Rate (知识采纳率) | **${fmtPct(summary.adoptionRate)}** | ${summary.totalAdoptedScenes} / ${summary.totalSelectedScenes} selected |`);
141
+ lines.push(`| Adoption Among Relevant | ${fmtPct(summary.adoptionAmongRelevantRate)} | ${summary.totalAdoptedScenes} / ${summary.totalRelevantScenes} relevant |`);
142
+ lines.push(`| Wiki Support Rate (知识库支撑占比) | **${fmtPct(summary.wikiSupportRate)}** | ${summary.totalWikiSupportedNeeds} / ${summary.totalNeeds} needs |`);
143
+ lines.push("");
144
+ lines.push("## 2. Mismatch Breakdown");
145
+ lines.push("");
146
+ lines.push("| Mismatch Category | Count |");
147
+ lines.push("| --- | ---: |");
148
+ for (const kind of CONSUMPTION_MISMATCH_KINDS) {
149
+ lines.push(`| ${MISMATCH_LABELS[kind]} | ${summary.mismatchCounts[kind]} |`);
150
+ }
151
+ lines.push(`| **Total Mismatches** | **${summary.totalMismatches}** |`);
152
+ lines.push("");
153
+ if (summary.topMismatchedScenes.length > 0) {
154
+ lines.push("## 3. Top Mismatched Scenes");
155
+ lines.push("");
156
+ lines.push("| Scene ID | Total | Stale Code | Missing Chain | Broken Anchor | Uncovered |");
157
+ lines.push("| --- | ---: | ---: | ---: | ---: | ---: |");
158
+ for (const item of summary.topMismatchedScenes) {
159
+ lines.push(`| \`${item.sceneId}\` | ${item.count} | ${item.kinds.stale_code} | ${item.kinds.missing_chain} | ${item.kinds.broken_anchor} | ${item.kinds.uncovered_scene} |`);
160
+ }
161
+ lines.push("");
162
+ }
163
+ return lines.join("\n").trimEnd();
164
+ }
165
+ //# sour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ACf,KAAK,CAAC,IAAI,CAAC,+EAA+E,CAAC,CAAC;QAC5F,KAAK,CAAC,IAAI,CAAC,4CAA4C,CAAC,CAAC;QACzD,KAAK,MAAM,IAAI,IAAI,OAAO,CAAC,mBAAmB,EAAE,CAAC;YAC/C,KAAK,CAAC,IAAI,CACR,OAAO,IAAI,CAAC,OAAO,QAAQ,IAAI,CAAC,KAAK,MAAM,IAAI,CAAC,KAAK,CAAC,UAAU,MAAM,IAAI,CAAC,KAAK,CAAC,aAAa,MAAM,IAAI,CAAC,KAAK,CAAC,aAAa,MAAM,IAAI,CAAC,KAAK,CAAC,eAAe,IAAI,CACjK,CAAC;QACJ,CAAC;QACD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACjB,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC;AACpC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,39 @@
1
1
  {
2
2
  "name": "@open-livex-wiki/eval",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.1.0",
4
+ "description": "Routing evaluation harness (4D Precision/Recall/F1 + coverage-split analysis) and consumption telemetry reporter.",
5
+ "author": "AndersonBY",
6
+ "license": "MIT",
7
+ "homepage": "https://github.com/AndersonBY/open-livex-wiki#readme",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/AndersonBY/open-livex-wiki.git",
11
+ "directory": "packages/eval"
12
+ },
13
+ "bugs": {
14
+ "url": "https://github.com/AndersonBY/open-livex-wiki/issues"
15
+ },
16
+ "publishConfig": {
17
+ "access": "public"
18
+ },
19
+ "type": "module",
20
+ "main": "./dist/index.js",
21
+ "types": "./dist/index.d.ts",
22
+ "exports": {
23
+ ".": {
24
+ "types": "./dist/index.d.ts",
25
+ "default": "./dist/index.js"
26
+ }
27
+ },
28
+ "files": [
29
+ "dist"
30
+ ],
31
+ "dependencies": {
32
+ "@open-livex-wiki/core": "0.1.0",
33
+ "zod": "^4.6.7"
34
+ },
35
+ "scripts": {
36
+ "build": "tsc -p tsconfig.json",
37
+ "typecheck": "tsc --emitDeclarationOnly -p tsconfig.json"
38
+ }
6
39
  }
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.