semantic-atlas 0.2.0 → 0.3.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/.agents/skills/semantic-atlas/SKILL.md +3 -0
- package/.agents/skills/semantic-atlas/references/product-feedback.md +34 -0
- package/.agents/skills/semantic-atlas-insights/SKILL.md +55 -0
- package/README.md +203 -88
- package/README.zh-CN.md +181 -85
- package/dist/cli/argument-parser.js +9 -1
- package/dist/cli/bin.js +10 -2
- package/dist/cli/cli-application.d.ts +1 -0
- package/dist/cli/cli-application.d.ts.map +1 -1
- package/dist/cli/cli-application.js +64 -12
- package/dist/cli/insights-cli.d.ts +6 -0
- package/dist/cli/insights-cli.d.ts.map +1 -0
- package/dist/cli/insights-cli.js +236 -0
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/cli/main.js +94 -2
- package/dist/cli/standalone-cli.d.ts.map +1 -1
- package/dist/cli/standalone-cli.js +36 -5
- package/dist/cli/types.d.ts +2 -0
- package/dist/cli/types.d.ts.map +1 -1
- package/dist/contracts/cli.d.ts +63 -0
- package/dist/contracts/cli.d.ts.map +1 -1
- package/dist/contracts/cli.js +7 -0
- package/dist/contracts/insights.d.ts +2 -0
- package/dist/contracts/insights.d.ts.map +1 -0
- package/dist/contracts/insights.js +1 -0
- package/dist/contracts/public-contracts.d.ts +1 -0
- package/dist/contracts/public-contracts.d.ts.map +1 -1
- package/dist/contracts/public-contracts.js +1 -0
- package/dist/insights/contracts.d.ts +266 -0
- package/dist/insights/contracts.d.ts.map +1 -0
- package/dist/insights/contracts.js +124 -0
- package/dist/insights/insights-store.d.ts +73 -0
- package/dist/insights/insights-store.d.ts.map +1 -0
- package/dist/insights/insights-store.js +246 -0
- package/dist/setup/package-upgrader.d.ts +54 -0
- package/dist/setup/package-upgrader.d.ts.map +1 -0
- package/dist/setup/package-upgrader.js +169 -0
- package/dist/setup/skill-installer.d.ts +3 -2
- package/dist/setup/skill-installer.d.ts.map +1 -1
- package/dist/setup/skill-installer.js +67 -36
- package/dist/storage/atlas-database.d.ts +1 -0
- package/dist/storage/atlas-database.d.ts.map +1 -1
- package/dist/storage/atlas-database.js +13 -6
- package/docs/contracts/cli-v1.md +25 -4
- package/docs/contracts/insights-v1.md +84 -0
- package/docs/index.md +2 -0
- package/docs/log.md +24 -0
- package/docs/product-contract.md +15 -8
- package/package.json +3 -1
- package/schemas/cli-envelope-v1.schema.json +85 -1
- package/schemas/insights-envelope-v1.schema.json +428 -0
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const observedCommandSchema: z.ZodEnum<{
|
|
3
|
+
status: "status";
|
|
4
|
+
index: "index";
|
|
5
|
+
changes: "changes";
|
|
6
|
+
learn: "learn";
|
|
7
|
+
"map.view": "map.view";
|
|
8
|
+
"map.search": "map.search";
|
|
9
|
+
"map.show": "map.show";
|
|
10
|
+
"code.search": "code.search";
|
|
11
|
+
"feedback.report": "feedback.report";
|
|
12
|
+
}>;
|
|
13
|
+
export declare const commandOutcomeSchema: z.ZodEnum<{
|
|
14
|
+
error: "error";
|
|
15
|
+
ok: "ok";
|
|
16
|
+
partial: "partial";
|
|
17
|
+
}>;
|
|
18
|
+
export declare const feedbackKindSchema: z.ZodEnum<{
|
|
19
|
+
problem: "problem";
|
|
20
|
+
suggestion: "suggestion";
|
|
21
|
+
}>;
|
|
22
|
+
export declare const feedbackCategorySchema: z.ZodEnum<{
|
|
23
|
+
"misleading-result": "misleading-result";
|
|
24
|
+
"missing-knowledge": "missing-knowledge";
|
|
25
|
+
"workflow-friction": "workflow-friction";
|
|
26
|
+
performance: "performance";
|
|
27
|
+
"cli-error": "cli-error";
|
|
28
|
+
"skill-instruction": "skill-instruction";
|
|
29
|
+
}>;
|
|
30
|
+
export declare const feedbackImpactSchema: z.ZodEnum<{
|
|
31
|
+
minor: "minor";
|
|
32
|
+
blocked: "blocked";
|
|
33
|
+
slowed: "slowed";
|
|
34
|
+
}>;
|
|
35
|
+
export declare const feedbackStatusSchema: z.ZodEnum<{
|
|
36
|
+
new: "new";
|
|
37
|
+
triaged: "triaged";
|
|
38
|
+
resolved: "resolved";
|
|
39
|
+
dismissed: "dismissed";
|
|
40
|
+
}>;
|
|
41
|
+
export declare const insightsPeriodSchema: z.ZodEnum<{
|
|
42
|
+
today: "today";
|
|
43
|
+
yesterday: "yesterday";
|
|
44
|
+
"7d": "7d";
|
|
45
|
+
"30d": "30d";
|
|
46
|
+
all: "all";
|
|
47
|
+
}>;
|
|
48
|
+
export declare const feedbackReportInputSchema: z.ZodObject<{
|
|
49
|
+
kind: z.ZodEnum<{
|
|
50
|
+
problem: "problem";
|
|
51
|
+
suggestion: "suggestion";
|
|
52
|
+
}>;
|
|
53
|
+
category: z.ZodEnum<{
|
|
54
|
+
"misleading-result": "misleading-result";
|
|
55
|
+
"missing-knowledge": "missing-knowledge";
|
|
56
|
+
"workflow-friction": "workflow-friction";
|
|
57
|
+
performance: "performance";
|
|
58
|
+
"cli-error": "cli-error";
|
|
59
|
+
"skill-instruction": "skill-instruction";
|
|
60
|
+
}>;
|
|
61
|
+
impact: z.ZodEnum<{
|
|
62
|
+
minor: "minor";
|
|
63
|
+
blocked: "blocked";
|
|
64
|
+
slowed: "slowed";
|
|
65
|
+
}>;
|
|
66
|
+
observed: z.ZodString;
|
|
67
|
+
expected: z.ZodString;
|
|
68
|
+
suggestion: z.ZodOptional<z.ZodString>;
|
|
69
|
+
sourceConfirmed: z.ZodBoolean;
|
|
70
|
+
}, z.core.$strict>;
|
|
71
|
+
export declare const feedbackReportUpdateInputSchema: z.ZodObject<{
|
|
72
|
+
id: z.ZodString;
|
|
73
|
+
status: z.ZodEnum<{
|
|
74
|
+
triaged: "triaged";
|
|
75
|
+
resolved: "resolved";
|
|
76
|
+
dismissed: "dismissed";
|
|
77
|
+
}>;
|
|
78
|
+
note: z.ZodString;
|
|
79
|
+
}, z.core.$strict>;
|
|
80
|
+
export type ObservedCommand = z.infer<typeof observedCommandSchema>;
|
|
81
|
+
export type CommandOutcome = z.infer<typeof commandOutcomeSchema>;
|
|
82
|
+
export type FeedbackReportInput = z.infer<typeof feedbackReportInputSchema>;
|
|
83
|
+
export type FeedbackStatus = z.infer<typeof feedbackStatusSchema>;
|
|
84
|
+
export type InsightsPeriod = z.infer<typeof insightsPeriodSchema>;
|
|
85
|
+
export type FeedbackReportUpdateInput = z.infer<typeof feedbackReportUpdateInputSchema>;
|
|
86
|
+
export declare const feedbackReportResultSchema: z.ZodObject<{
|
|
87
|
+
id: z.ZodString;
|
|
88
|
+
kind: z.ZodEnum<{
|
|
89
|
+
problem: "problem";
|
|
90
|
+
suggestion: "suggestion";
|
|
91
|
+
}>;
|
|
92
|
+
category: z.ZodEnum<{
|
|
93
|
+
"misleading-result": "misleading-result";
|
|
94
|
+
"missing-knowledge": "missing-knowledge";
|
|
95
|
+
"workflow-friction": "workflow-friction";
|
|
96
|
+
performance: "performance";
|
|
97
|
+
"cli-error": "cli-error";
|
|
98
|
+
"skill-instruction": "skill-instruction";
|
|
99
|
+
}>;
|
|
100
|
+
impact: z.ZodEnum<{
|
|
101
|
+
minor: "minor";
|
|
102
|
+
blocked: "blocked";
|
|
103
|
+
slowed: "slowed";
|
|
104
|
+
}>;
|
|
105
|
+
sourceConfirmed: z.ZodBoolean;
|
|
106
|
+
status: z.ZodEnum<{
|
|
107
|
+
new: "new";
|
|
108
|
+
triaged: "triaged";
|
|
109
|
+
resolved: "resolved";
|
|
110
|
+
dismissed: "dismissed";
|
|
111
|
+
}>;
|
|
112
|
+
contextEventCount: z.ZodNumber;
|
|
113
|
+
createdAt: z.ZodISODateTime;
|
|
114
|
+
}, z.core.$strict>;
|
|
115
|
+
export declare const insightsEnvelopeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
116
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
117
|
+
status: z.ZodLiteral<"ok">;
|
|
118
|
+
data: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
119
|
+
command: z.ZodLiteral<"insights.summary">;
|
|
120
|
+
range: z.ZodObject<{
|
|
121
|
+
from: z.ZodISODateTime;
|
|
122
|
+
to: z.ZodISODateTime;
|
|
123
|
+
}, z.core.$strict>;
|
|
124
|
+
summary: z.ZodObject<{
|
|
125
|
+
commands: z.ZodObject<{
|
|
126
|
+
total: z.ZodNumber;
|
|
127
|
+
outcomes: z.ZodObject<{
|
|
128
|
+
ok: z.ZodNumber;
|
|
129
|
+
partial: z.ZodNumber;
|
|
130
|
+
error: z.ZodNumber;
|
|
131
|
+
}, z.core.$strict>;
|
|
132
|
+
byCommand: z.ZodArray<z.ZodObject<{
|
|
133
|
+
command: z.ZodEnum<{
|
|
134
|
+
status: "status";
|
|
135
|
+
index: "index";
|
|
136
|
+
changes: "changes";
|
|
137
|
+
learn: "learn";
|
|
138
|
+
"map.view": "map.view";
|
|
139
|
+
"map.search": "map.search";
|
|
140
|
+
"map.show": "map.show";
|
|
141
|
+
"code.search": "code.search";
|
|
142
|
+
"feedback.report": "feedback.report";
|
|
143
|
+
}>;
|
|
144
|
+
count: z.ZodNumber;
|
|
145
|
+
}, z.core.$strict>>;
|
|
146
|
+
warningCodes: z.ZodArray<z.ZodObject<{
|
|
147
|
+
code: z.ZodString;
|
|
148
|
+
count: z.ZodNumber;
|
|
149
|
+
}, z.core.$strict>>;
|
|
150
|
+
}, z.core.$strict>;
|
|
151
|
+
feedback: z.ZodObject<{
|
|
152
|
+
total: z.ZodNumber;
|
|
153
|
+
byCategory: z.ZodArray<z.ZodObject<{
|
|
154
|
+
category: z.ZodEnum<{
|
|
155
|
+
"misleading-result": "misleading-result";
|
|
156
|
+
"missing-knowledge": "missing-knowledge";
|
|
157
|
+
"workflow-friction": "workflow-friction";
|
|
158
|
+
performance: "performance";
|
|
159
|
+
"cli-error": "cli-error";
|
|
160
|
+
"skill-instruction": "skill-instruction";
|
|
161
|
+
}>;
|
|
162
|
+
count: z.ZodNumber;
|
|
163
|
+
}, z.core.$strict>>;
|
|
164
|
+
}, z.core.$strict>;
|
|
165
|
+
}, z.core.$strict>;
|
|
166
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
167
|
+
command: z.ZodLiteral<"insights.feedback">;
|
|
168
|
+
range: z.ZodObject<{
|
|
169
|
+
from: z.ZodISODateTime;
|
|
170
|
+
to: z.ZodISODateTime;
|
|
171
|
+
}, z.core.$strict>;
|
|
172
|
+
reports: z.ZodArray<z.ZodObject<{
|
|
173
|
+
kind: z.ZodEnum<{
|
|
174
|
+
problem: "problem";
|
|
175
|
+
suggestion: "suggestion";
|
|
176
|
+
}>;
|
|
177
|
+
category: z.ZodEnum<{
|
|
178
|
+
"misleading-result": "misleading-result";
|
|
179
|
+
"missing-knowledge": "missing-knowledge";
|
|
180
|
+
"workflow-friction": "workflow-friction";
|
|
181
|
+
performance: "performance";
|
|
182
|
+
"cli-error": "cli-error";
|
|
183
|
+
"skill-instruction": "skill-instruction";
|
|
184
|
+
}>;
|
|
185
|
+
impact: z.ZodEnum<{
|
|
186
|
+
minor: "minor";
|
|
187
|
+
blocked: "blocked";
|
|
188
|
+
slowed: "slowed";
|
|
189
|
+
}>;
|
|
190
|
+
observed: z.ZodString;
|
|
191
|
+
expected: z.ZodString;
|
|
192
|
+
suggestion: z.ZodOptional<z.ZodString>;
|
|
193
|
+
sourceConfirmed: z.ZodBoolean;
|
|
194
|
+
id: z.ZodString;
|
|
195
|
+
repositoryId: z.ZodString;
|
|
196
|
+
snapshotId: z.ZodNullable<z.ZodString>;
|
|
197
|
+
contextEventIds: z.ZodArray<z.ZodString>;
|
|
198
|
+
status: z.ZodEnum<{
|
|
199
|
+
new: "new";
|
|
200
|
+
triaged: "triaged";
|
|
201
|
+
resolved: "resolved";
|
|
202
|
+
dismissed: "dismissed";
|
|
203
|
+
}>;
|
|
204
|
+
note: z.ZodNullable<z.ZodString>;
|
|
205
|
+
createdAt: z.ZodISODateTime;
|
|
206
|
+
updatedAt: z.ZodISODateTime;
|
|
207
|
+
}, z.core.$strict>>;
|
|
208
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
209
|
+
command: z.ZodLiteral<"insights.feedback.update">;
|
|
210
|
+
report: z.ZodObject<{
|
|
211
|
+
kind: z.ZodEnum<{
|
|
212
|
+
problem: "problem";
|
|
213
|
+
suggestion: "suggestion";
|
|
214
|
+
}>;
|
|
215
|
+
category: z.ZodEnum<{
|
|
216
|
+
"misleading-result": "misleading-result";
|
|
217
|
+
"missing-knowledge": "missing-knowledge";
|
|
218
|
+
"workflow-friction": "workflow-friction";
|
|
219
|
+
performance: "performance";
|
|
220
|
+
"cli-error": "cli-error";
|
|
221
|
+
"skill-instruction": "skill-instruction";
|
|
222
|
+
}>;
|
|
223
|
+
impact: z.ZodEnum<{
|
|
224
|
+
minor: "minor";
|
|
225
|
+
blocked: "blocked";
|
|
226
|
+
slowed: "slowed";
|
|
227
|
+
}>;
|
|
228
|
+
observed: z.ZodString;
|
|
229
|
+
expected: z.ZodString;
|
|
230
|
+
suggestion: z.ZodOptional<z.ZodString>;
|
|
231
|
+
sourceConfirmed: z.ZodBoolean;
|
|
232
|
+
id: z.ZodString;
|
|
233
|
+
repositoryId: z.ZodString;
|
|
234
|
+
snapshotId: z.ZodNullable<z.ZodString>;
|
|
235
|
+
contextEventIds: z.ZodArray<z.ZodString>;
|
|
236
|
+
status: z.ZodEnum<{
|
|
237
|
+
new: "new";
|
|
238
|
+
triaged: "triaged";
|
|
239
|
+
resolved: "resolved";
|
|
240
|
+
dismissed: "dismissed";
|
|
241
|
+
}>;
|
|
242
|
+
note: z.ZodNullable<z.ZodString>;
|
|
243
|
+
createdAt: z.ZodISODateTime;
|
|
244
|
+
updatedAt: z.ZodISODateTime;
|
|
245
|
+
}, z.core.$strict>;
|
|
246
|
+
}, z.core.$strict>], "command">;
|
|
247
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
248
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
249
|
+
status: z.ZodLiteral<"error">;
|
|
250
|
+
data: z.ZodObject<{
|
|
251
|
+
command: z.ZodNullable<z.ZodEnum<{
|
|
252
|
+
"insights.summary": "insights.summary";
|
|
253
|
+
"insights.feedback": "insights.feedback";
|
|
254
|
+
"insights.feedback.update": "insights.feedback.update";
|
|
255
|
+
}>>;
|
|
256
|
+
error: z.ZodObject<{
|
|
257
|
+
code: z.ZodString;
|
|
258
|
+
message: z.ZodString;
|
|
259
|
+
}, z.core.$strict>;
|
|
260
|
+
}, z.core.$strict>;
|
|
261
|
+
}, z.core.$strict>], "status">;
|
|
262
|
+
export type InsightsEnvelope = z.infer<typeof insightsEnvelopeSchema>;
|
|
263
|
+
export type InsightsSuccessData = Extract<InsightsEnvelope, {
|
|
264
|
+
readonly status: "ok";
|
|
265
|
+
}>["data"];
|
|
266
|
+
//# sourceMappingURL=contracts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../../src/insights/contracts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,qBAAqB;;;;;;;;;;EAUhC,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;EAAqC,CAAC;AAEvE,eAAO,MAAM,kBAAkB;;;EAAoC,CAAC;AACpE,eAAO,MAAM,sBAAsB;;;;;;;EAOjC,CAAC;AACH,eAAO,MAAM,oBAAoB;;;;EAAyC,CAAC;AAC3E,eAAO,MAAM,oBAAoB;;;;;EAAsD,CAAC;AACxF,eAAO,MAAM,oBAAoB;;;;;;EAAqD,CAAC;AAEvF,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;kBAQpC,CAAC;AAEH,eAAO,MAAM,+BAA+B;;;;;;;;kBAI1C,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AACpE,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAClE,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAC5E,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAClE,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAClE,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAC;AA4CxF,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBASrC,CAAC;AAmBH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8BAiBjC,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AACtE,MAAM,MAAM,mBAAmB,GAAG,OAAO,CAAC,gBAAgB,EAAE;IAAE,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAA;CAAE,CAAC,CAAC,MAAM,CAAC,CAAC"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const observedCommandSchema = z.enum([
|
|
3
|
+
"status",
|
|
4
|
+
"index",
|
|
5
|
+
"map.view",
|
|
6
|
+
"map.search",
|
|
7
|
+
"map.show",
|
|
8
|
+
"code.search",
|
|
9
|
+
"learn",
|
|
10
|
+
"changes",
|
|
11
|
+
"feedback.report",
|
|
12
|
+
]);
|
|
13
|
+
export const commandOutcomeSchema = z.enum(["ok", "partial", "error"]);
|
|
14
|
+
export const feedbackKindSchema = z.enum(["problem", "suggestion"]);
|
|
15
|
+
export const feedbackCategorySchema = z.enum([
|
|
16
|
+
"misleading-result",
|
|
17
|
+
"missing-knowledge",
|
|
18
|
+
"workflow-friction",
|
|
19
|
+
"performance",
|
|
20
|
+
"cli-error",
|
|
21
|
+
"skill-instruction",
|
|
22
|
+
]);
|
|
23
|
+
export const feedbackImpactSchema = z.enum(["blocked", "slowed", "minor"]);
|
|
24
|
+
export const feedbackStatusSchema = z.enum(["new", "triaged", "resolved", "dismissed"]);
|
|
25
|
+
export const insightsPeriodSchema = z.enum(["today", "yesterday", "7d", "30d", "all"]);
|
|
26
|
+
export const feedbackReportInputSchema = z.strictObject({
|
|
27
|
+
kind: feedbackKindSchema,
|
|
28
|
+
category: feedbackCategorySchema,
|
|
29
|
+
impact: feedbackImpactSchema,
|
|
30
|
+
observed: z.string().trim().min(1).max(4_000),
|
|
31
|
+
expected: z.string().trim().min(1).max(4_000),
|
|
32
|
+
suggestion: z.string().trim().min(1).max(4_000).optional(),
|
|
33
|
+
sourceConfirmed: z.boolean(),
|
|
34
|
+
});
|
|
35
|
+
export const feedbackReportUpdateInputSchema = z.strictObject({
|
|
36
|
+
id: z.string().uuid(),
|
|
37
|
+
status: z.enum(["triaged", "resolved", "dismissed"]),
|
|
38
|
+
note: z.string().trim().min(1).max(4_000),
|
|
39
|
+
});
|
|
40
|
+
const timestampSchema = z.iso.datetime();
|
|
41
|
+
const nonNegativeIntegerSchema = z.number().int().nonnegative();
|
|
42
|
+
const insightRangeSchema = z.strictObject({
|
|
43
|
+
from: timestampSchema,
|
|
44
|
+
to: timestampSchema,
|
|
45
|
+
});
|
|
46
|
+
const feedbackReportSchema = feedbackReportInputSchema.extend({
|
|
47
|
+
id: z.string().uuid(),
|
|
48
|
+
repositoryId: z.string().regex(/^[a-f0-9]{64}$/),
|
|
49
|
+
snapshotId: z.string().regex(/^[a-f0-9]{64}$/).nullable(),
|
|
50
|
+
contextEventIds: z.array(z.string().uuid()),
|
|
51
|
+
status: feedbackStatusSchema,
|
|
52
|
+
note: z.string().nullable(),
|
|
53
|
+
createdAt: timestampSchema,
|
|
54
|
+
updatedAt: timestampSchema,
|
|
55
|
+
});
|
|
56
|
+
const insightsSummarySchema = z.strictObject({
|
|
57
|
+
commands: z.strictObject({
|
|
58
|
+
total: nonNegativeIntegerSchema,
|
|
59
|
+
outcomes: z.strictObject({
|
|
60
|
+
ok: nonNegativeIntegerSchema,
|
|
61
|
+
partial: nonNegativeIntegerSchema,
|
|
62
|
+
error: nonNegativeIntegerSchema,
|
|
63
|
+
}),
|
|
64
|
+
byCommand: z.array(z.strictObject({
|
|
65
|
+
command: observedCommandSchema,
|
|
66
|
+
count: nonNegativeIntegerSchema,
|
|
67
|
+
})),
|
|
68
|
+
warningCodes: z.array(z.strictObject({
|
|
69
|
+
code: z.string().min(1),
|
|
70
|
+
count: nonNegativeIntegerSchema,
|
|
71
|
+
})),
|
|
72
|
+
}),
|
|
73
|
+
feedback: z.strictObject({
|
|
74
|
+
total: nonNegativeIntegerSchema,
|
|
75
|
+
byCategory: z.array(z.strictObject({
|
|
76
|
+
category: feedbackCategorySchema,
|
|
77
|
+
count: nonNegativeIntegerSchema,
|
|
78
|
+
})),
|
|
79
|
+
}),
|
|
80
|
+
});
|
|
81
|
+
export const feedbackReportResultSchema = z.strictObject({
|
|
82
|
+
id: z.string().uuid(),
|
|
83
|
+
kind: feedbackKindSchema,
|
|
84
|
+
category: feedbackCategorySchema,
|
|
85
|
+
impact: feedbackImpactSchema,
|
|
86
|
+
sourceConfirmed: z.boolean(),
|
|
87
|
+
status: feedbackStatusSchema,
|
|
88
|
+
contextEventCount: nonNegativeIntegerSchema,
|
|
89
|
+
createdAt: timestampSchema,
|
|
90
|
+
});
|
|
91
|
+
const insightsSuccessDataSchema = z.discriminatedUnion("command", [
|
|
92
|
+
z.strictObject({
|
|
93
|
+
command: z.literal("insights.summary"),
|
|
94
|
+
range: insightRangeSchema,
|
|
95
|
+
summary: insightsSummarySchema,
|
|
96
|
+
}),
|
|
97
|
+
z.strictObject({
|
|
98
|
+
command: z.literal("insights.feedback"),
|
|
99
|
+
range: insightRangeSchema,
|
|
100
|
+
reports: z.array(feedbackReportSchema),
|
|
101
|
+
}),
|
|
102
|
+
z.strictObject({
|
|
103
|
+
command: z.literal("insights.feedback.update"),
|
|
104
|
+
report: feedbackReportSchema,
|
|
105
|
+
}),
|
|
106
|
+
]);
|
|
107
|
+
export const insightsEnvelopeSchema = z.discriminatedUnion("status", [
|
|
108
|
+
z.strictObject({
|
|
109
|
+
schemaVersion: z.literal(1),
|
|
110
|
+
status: z.literal("ok"),
|
|
111
|
+
data: insightsSuccessDataSchema,
|
|
112
|
+
}),
|
|
113
|
+
z.strictObject({
|
|
114
|
+
schemaVersion: z.literal(1),
|
|
115
|
+
status: z.literal("error"),
|
|
116
|
+
data: z.strictObject({
|
|
117
|
+
command: z.enum(["insights.summary", "insights.feedback", "insights.feedback.update"]).nullable(),
|
|
118
|
+
error: z.strictObject({
|
|
119
|
+
code: z.string().regex(/^[A-Z][A-Z0-9_]*$/),
|
|
120
|
+
message: z.string().min(1),
|
|
121
|
+
}),
|
|
122
|
+
}),
|
|
123
|
+
}),
|
|
124
|
+
]);
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { DatabaseSync as NodeDatabaseSync } from "node:sqlite";
|
|
2
|
+
import { type CommandOutcome, type FeedbackReportInput, type FeedbackStatus, type ObservedCommand } from "./contracts.js";
|
|
3
|
+
export interface CommandObservationInput {
|
|
4
|
+
readonly repositoryId: string;
|
|
5
|
+
readonly command: ObservedCommand;
|
|
6
|
+
readonly outcome: CommandOutcome;
|
|
7
|
+
readonly exitCode: number;
|
|
8
|
+
readonly warningCodes: readonly string[];
|
|
9
|
+
readonly durationMs: number;
|
|
10
|
+
readonly snapshotId: string | null;
|
|
11
|
+
}
|
|
12
|
+
export interface CommandObservation extends CommandObservationInput {
|
|
13
|
+
readonly id: string;
|
|
14
|
+
readonly occurredAt: string;
|
|
15
|
+
}
|
|
16
|
+
export interface FeedbackReport extends FeedbackReportInput {
|
|
17
|
+
readonly id: string;
|
|
18
|
+
readonly repositoryId: string;
|
|
19
|
+
readonly snapshotId: string | null;
|
|
20
|
+
readonly contextEventIds: string[];
|
|
21
|
+
readonly status: FeedbackStatus;
|
|
22
|
+
readonly note: string | null;
|
|
23
|
+
readonly createdAt: string;
|
|
24
|
+
readonly updatedAt: string;
|
|
25
|
+
}
|
|
26
|
+
export interface InsightsRange {
|
|
27
|
+
readonly from: string;
|
|
28
|
+
readonly to: string;
|
|
29
|
+
}
|
|
30
|
+
export interface InsightsSummary {
|
|
31
|
+
readonly commands: {
|
|
32
|
+
readonly total: number;
|
|
33
|
+
readonly outcomes: Record<CommandOutcome, number>;
|
|
34
|
+
readonly byCommand: {
|
|
35
|
+
readonly command: ObservedCommand;
|
|
36
|
+
readonly count: number;
|
|
37
|
+
}[];
|
|
38
|
+
readonly warningCodes: {
|
|
39
|
+
readonly code: string;
|
|
40
|
+
readonly count: number;
|
|
41
|
+
}[];
|
|
42
|
+
};
|
|
43
|
+
readonly feedback: {
|
|
44
|
+
readonly total: number;
|
|
45
|
+
readonly byCategory: {
|
|
46
|
+
readonly category: FeedbackReport["category"];
|
|
47
|
+
readonly count: number;
|
|
48
|
+
}[];
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
export declare class InsightsStore implements Disposable {
|
|
52
|
+
#private;
|
|
53
|
+
readonly databasePath: string;
|
|
54
|
+
readonly connection: NodeDatabaseSync;
|
|
55
|
+
constructor(databasePath?: string);
|
|
56
|
+
close(): void;
|
|
57
|
+
[Symbol.dispose](): void;
|
|
58
|
+
recordCommand(input: CommandObservationInput): CommandObservation;
|
|
59
|
+
recordFeedback(input: FeedbackReportInput & {
|
|
60
|
+
readonly repositoryId: string;
|
|
61
|
+
readonly snapshotId: string | null;
|
|
62
|
+
}): FeedbackReport;
|
|
63
|
+
listFeedback(range: InsightsRange, status?: FeedbackStatus): FeedbackReport[];
|
|
64
|
+
updateFeedback(input: {
|
|
65
|
+
readonly id: string;
|
|
66
|
+
readonly status: FeedbackStatus;
|
|
67
|
+
readonly note?: string;
|
|
68
|
+
}): FeedbackReport;
|
|
69
|
+
summary(range: InsightsRange): InsightsSummary;
|
|
70
|
+
private recentCommandEventIds;
|
|
71
|
+
private initializeSchema;
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=insights-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"insights-store.d.ts","sourceRoot":"","sources":["../../src/insights/insights-store.ts"],"names":[],"mappings":"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"}
|