semantic-atlas 0.2.0 → 0.4.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 +229 -88
- package/README.zh-CN.md +204 -85
- package/dist/cli/argument-parser.js +9 -1
- package/dist/cli/bin.js +17 -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 +44 -5
- package/dist/cli/types.d.ts +2 -0
- package/dist/cli/types.d.ts.map +1 -1
- package/dist/cli/web-cli.d.ts +9 -0
- package/dist/cli/web-cli.d.ts.map +1 -0
- package/dist/cli/web-cli.js +134 -0
- 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/graph/graph-store.d.ts +2 -2
- package/dist/graph/graph-store.d.ts.map +1 -1
- package/dist/graph/graph-store.js +2 -2
- 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/repository/repository-inspector.d.ts +1 -0
- package/dist/repository/repository-inspector.d.ts.map +1 -1
- package/dist/repository/repository-inspector.js +13 -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 +8 -1
- package/dist/storage/atlas-database.d.ts.map +1 -1
- package/dist/storage/atlas-database.js +68 -11
- package/dist/web/application/atlas-read-service.d.ts +27 -0
- package/dist/web/application/atlas-read-service.d.ts.map +1 -0
- package/dist/web/application/atlas-read-service.js +216 -0
- package/dist/web/application/primary-repository-catalog.d.ts +15 -0
- package/dist/web/application/primary-repository-catalog.d.ts.map +1 -0
- package/dist/web/application/primary-repository-catalog.js +202 -0
- package/dist/web/application/types.d.ts +41 -0
- package/dist/web/application/types.d.ts.map +1 -0
- package/dist/web/application/types.js +1 -0
- package/dist/web/server/api-router.d.ts +4 -0
- package/dist/web/server/api-router.d.ts.map +1 -0
- package/dist/web/server/api-router.js +151 -0
- package/dist/web/server/local-web-server.d.ts +12 -0
- package/dist/web/server/local-web-server.d.ts.map +1 -0
- package/dist/web/server/local-web-server.js +100 -0
- package/dist/web-client/assets/index-DneaErDj.css +1 -0
- package/dist/web-client/assets/index-cze_4vtt.js +2 -0
- package/dist/web-client/assets/index-cze_4vtt.js.map +1 -0
- package/dist/web-client/index.html +61 -0
- package/dist/world/world-graph-query.d.ts +5 -1
- package/dist/world/world-graph-query.d.ts.map +1 -1
- package/dist/world/world-graph-query.js +4 -2
- package/dist/world/world-snapshot-store.d.ts +2 -1
- package/dist/world/world-snapshot-store.d.ts.map +1 -1
- package/dist/world/world-snapshot-store.js +2 -2
- package/docs/architecture/web-viewer.md +225 -0
- package/docs/contracts/cli-v1.md +40 -4
- package/docs/contracts/http-api-v1.md +155 -0
- package/docs/contracts/insights-v1.md +84 -0
- package/docs/index.md +7 -0
- package/docs/log.md +103 -0
- package/docs/product-contract.md +45 -10
- package/package.json +7 -4
- package/schemas/cli-envelope-v1.schema.json +85 -1
- package/schemas/insights-envelope-v1.schema.json +428 -0
package/dist/contracts/cli.d.ts
CHANGED
|
@@ -598,6 +598,37 @@ export declare const cliCommandDataSchema: z.ZodDiscriminatedUnion<[z.ZodObject<
|
|
|
598
598
|
removed: z.ZodArray<z.ZodString>;
|
|
599
599
|
}, z.core.$loose>;
|
|
600
600
|
staleAssertions: z.ZodArray<z.ZodString>;
|
|
601
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
602
|
+
command: z.ZodLiteral<"feedback.report">;
|
|
603
|
+
report: z.ZodObject<{
|
|
604
|
+
id: z.ZodString;
|
|
605
|
+
kind: z.ZodEnum<{
|
|
606
|
+
problem: "problem";
|
|
607
|
+
suggestion: "suggestion";
|
|
608
|
+
}>;
|
|
609
|
+
category: z.ZodEnum<{
|
|
610
|
+
"misleading-result": "misleading-result";
|
|
611
|
+
"missing-knowledge": "missing-knowledge";
|
|
612
|
+
"workflow-friction": "workflow-friction";
|
|
613
|
+
performance: "performance";
|
|
614
|
+
"cli-error": "cli-error";
|
|
615
|
+
"skill-instruction": "skill-instruction";
|
|
616
|
+
}>;
|
|
617
|
+
impact: z.ZodEnum<{
|
|
618
|
+
minor: "minor";
|
|
619
|
+
blocked: "blocked";
|
|
620
|
+
slowed: "slowed";
|
|
621
|
+
}>;
|
|
622
|
+
sourceConfirmed: z.ZodBoolean;
|
|
623
|
+
status: z.ZodEnum<{
|
|
624
|
+
new: "new";
|
|
625
|
+
triaged: "triaged";
|
|
626
|
+
resolved: "resolved";
|
|
627
|
+
dismissed: "dismissed";
|
|
628
|
+
}>;
|
|
629
|
+
contextEventCount: z.ZodNumber;
|
|
630
|
+
createdAt: z.ZodISODateTime;
|
|
631
|
+
}, z.core.$strict>;
|
|
601
632
|
}, z.core.$loose>], "command">;
|
|
602
633
|
export declare const cliEnvelopeSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
603
634
|
schemaVersion: z.ZodLiteral<1>;
|
|
@@ -1098,6 +1129,37 @@ export declare const cliEnvelopeSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
1098
1129
|
removed: z.ZodArray<z.ZodString>;
|
|
1099
1130
|
}, z.core.$loose>;
|
|
1100
1131
|
staleAssertions: z.ZodArray<z.ZodString>;
|
|
1132
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
1133
|
+
command: z.ZodLiteral<"feedback.report">;
|
|
1134
|
+
report: z.ZodObject<{
|
|
1135
|
+
id: z.ZodString;
|
|
1136
|
+
kind: z.ZodEnum<{
|
|
1137
|
+
problem: "problem";
|
|
1138
|
+
suggestion: "suggestion";
|
|
1139
|
+
}>;
|
|
1140
|
+
category: z.ZodEnum<{
|
|
1141
|
+
"misleading-result": "misleading-result";
|
|
1142
|
+
"missing-knowledge": "missing-knowledge";
|
|
1143
|
+
"workflow-friction": "workflow-friction";
|
|
1144
|
+
performance: "performance";
|
|
1145
|
+
"cli-error": "cli-error";
|
|
1146
|
+
"skill-instruction": "skill-instruction";
|
|
1147
|
+
}>;
|
|
1148
|
+
impact: z.ZodEnum<{
|
|
1149
|
+
minor: "minor";
|
|
1150
|
+
blocked: "blocked";
|
|
1151
|
+
slowed: "slowed";
|
|
1152
|
+
}>;
|
|
1153
|
+
sourceConfirmed: z.ZodBoolean;
|
|
1154
|
+
status: z.ZodEnum<{
|
|
1155
|
+
new: "new";
|
|
1156
|
+
triaged: "triaged";
|
|
1157
|
+
resolved: "resolved";
|
|
1158
|
+
dismissed: "dismissed";
|
|
1159
|
+
}>;
|
|
1160
|
+
contextEventCount: z.ZodNumber;
|
|
1161
|
+
createdAt: z.ZodISODateTime;
|
|
1162
|
+
}, z.core.$strict>;
|
|
1101
1163
|
}, z.core.$loose>], "command">;
|
|
1102
1164
|
warnings: z.ZodArray<z.ZodObject<{
|
|
1103
1165
|
code: z.ZodString;
|
|
@@ -1131,6 +1193,7 @@ export declare const cliEnvelopeSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
1131
1193
|
"map.search": "map.search";
|
|
1132
1194
|
"map.show": "map.show";
|
|
1133
1195
|
"code.search": "code.search";
|
|
1196
|
+
"feedback.report": "feedback.report";
|
|
1134
1197
|
}>>;
|
|
1135
1198
|
error: z.ZodObject<{
|
|
1136
1199
|
code: z.ZodString;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/contracts/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/contracts/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAwDxB,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAUhC,CAAC;AAEH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAGxB,CAAC;AAqKH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8BAU/B,CAAC;AA6BH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBAG5B,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAClE,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC"}
|
package/dist/contracts/cli.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { assertionCertaintySchema, businessKeySchema, businessNodeReferenceSchema, businessNodeKindSchema, businessRelationTypeSchema, evidenceSchema, knowledgeValiditySchema, relativeSourcePathSchema, sourceRangeSchema, structuralNodeKindSchema, structuralNodeIdSchema, structuralSupportSchema, } from "./graph.js";
|
|
3
3
|
import { contentIdentifierSchema, gitObjectIdSchema, } from "./identifiers.js";
|
|
4
|
+
import { feedbackReportResultSchema } from "./insights.js";
|
|
4
5
|
const repositoryDescriptorSchema = z.strictObject({
|
|
5
6
|
id: contentIdentifierSchema,
|
|
6
7
|
root: z.string().min(1),
|
|
@@ -54,6 +55,7 @@ const commandNameSchema = z.enum([
|
|
|
54
55
|
"code.search",
|
|
55
56
|
"learn",
|
|
56
57
|
"changes",
|
|
58
|
+
"feedback.report",
|
|
57
59
|
]);
|
|
58
60
|
const countSchema = z.number().int().nonnegative();
|
|
59
61
|
const sourceChangeCountsSchema = z.looseObject({
|
|
@@ -185,6 +187,10 @@ const changesDataSchema = z.looseObject({
|
|
|
185
187
|
relations: changeSetSchema,
|
|
186
188
|
staleAssertions: z.array(z.string().min(1)),
|
|
187
189
|
});
|
|
190
|
+
const feedbackReportDataSchema = z.looseObject({
|
|
191
|
+
command: z.literal("feedback.report"),
|
|
192
|
+
report: feedbackReportResultSchema,
|
|
193
|
+
});
|
|
188
194
|
export const cliCommandDataSchema = z.discriminatedUnion("command", [
|
|
189
195
|
statusDataSchema,
|
|
190
196
|
indexDataSchema,
|
|
@@ -194,6 +200,7 @@ export const cliCommandDataSchema = z.discriminatedUnion("command", [
|
|
|
194
200
|
codeSearchDataSchema,
|
|
195
201
|
learnDataSchema,
|
|
196
202
|
changesDataSchema,
|
|
203
|
+
feedbackReportDataSchema,
|
|
197
204
|
]);
|
|
198
205
|
const errorDataSchema = z.looseObject({
|
|
199
206
|
command: commandNameSchema.nullable(),
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"insights.d.ts","sourceRoot":"","sources":["../../src/contracts/insights.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../insights/contracts.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public-contracts.d.ts","sourceRoot":"","sources":["../../src/contracts/public-contracts.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"public-contracts.d.ts","sourceRoot":"","sources":["../../src/contracts/public-contracts.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { GitRepository } from "../repository/types.js";
|
|
2
|
-
import { CURRENT_ATLAS_SCHEMA_VERSION } from "../storage/atlas-database.js";
|
|
2
|
+
import { CURRENT_ATLAS_SCHEMA_VERSION, type AtlasDatabaseOptions } from "../storage/atlas-database.js";
|
|
3
3
|
import type { BusinessGraphMutation, BusinessGraphNode, BusinessGraphRelation, Evidence, EvidenceOwner, GraphNeighbor, GraphNode, GraphNodeReference, GraphSearchOptions, GraphSearchResult, GraphTraversalOptions } from "./types.js";
|
|
4
4
|
export declare class GraphStore implements Disposable {
|
|
5
5
|
#private;
|
|
6
6
|
readonly databasePath: string;
|
|
7
|
-
constructor(repository: GitRepository);
|
|
7
|
+
constructor(repository: GitRepository, options?: AtlasDatabaseOptions);
|
|
8
8
|
get schemaVersion(): number;
|
|
9
9
|
reconcileSnapshot(snapshotId: string): void;
|
|
10
10
|
mutateBusinessGraph(mutation: BusinessGraphMutation): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph-store.d.ts","sourceRoot":"","sources":["../../src/graph/graph-store.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAE5D,OAAO,EAEL,4BAA4B,
|
|
1
|
+
{"version":3,"file":"graph-store.d.ts","sourceRoot":"","sources":["../../src/graph/graph-store.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAE5D,OAAO,EAEL,4BAA4B,EAC5B,KAAK,oBAAoB,EAC1B,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAEV,qBAAqB,EACrB,iBAAiB,EACjB,qBAAqB,EAKrB,QAAQ,EACR,aAAa,EACb,aAAa,EACb,SAAS,EACT,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EAEjB,qBAAqB,EAGtB,MAAM,YAAY,CAAC;AA0DpB,qBAAa,UAAW,YAAW,UAAU;;IAC3C,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;gBAKlB,UAAU,EAAE,aAAa,EAAE,OAAO,GAAE,oBAAyB;IAOzE,IAAI,aAAa,IAAI,MAAM,CAE1B;IAED,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAS3C,mBAAmB,CAAC,QAAQ,EAAE,qBAAqB,GAAG,IAAI;IAsB1D,OAAO,CAAC,SAAS,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS;IAOjF,WAAW,CAAC,KAAK,EAAE,aAAa,GAAG,SAAS,QAAQ,EAAE;IAWtD,qBAAqB,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,qBAAqB,EAAE;IAK3E,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,iBAAiB,EAAE;IAYnE,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,iBAAiB,EAAE;IAoBnE,QAAQ,CACN,KAAK,EAAE,kBAAkB,EACzB,OAAO,EAAE,qBAAqB,GAC7B,SAAS,aAAa,EAAE;IA0D3B,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,kBAAkB,GAAG,SAAS,iBAAiB,EAAE;IA0ChF,KAAK,IAAI,IAAI;IAIb,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,IAAI;IAIxB,OAAO,KAAK,QAAQ,GAEnB;IAED,OAAO,CAAC,WAAW;IAWnB,OAAO,CAAC,wBAAwB;IAwChC,OAAO,CAAC,wBAAwB;IAgBhC,OAAO,CAAC,yBAAyB;IA4CjC,OAAO,CAAC,gBAAgB;IAMxB,OAAO,CAAC,eAAe;IAYvB,OAAO,CAAC,kBAAkB;IAmE1B,OAAO,CAAC,sBAAsB;IAgC9B,OAAO,CAAC,qBAAqB;IA8E7B,OAAO,CAAC,kBAAkB;IAkB1B,OAAO,CAAC,sBAAsB;IAY9B,OAAO,CAAC,kBAAkB;IA6C1B,OAAO,CAAC,sBAAsB;IA6C9B,OAAO,CAAC,qBAAqB;IAkC7B,OAAO,CAAC,6BAA6B;IAoDrC,OAAO,CAAC,eAAe;IASvB,OAAO,CAAC,iBAAiB;IAYzB,OAAO,CAAC,0BAA0B;IAYlC,OAAO,CAAC,yBAAyB;IAejC,OAAO,CAAC,6BAA6B;IA0DrC,OAAO,CAAC,uBAAuB;IA+D/B,OAAO,CAAC,gBAAgB;IAuCxB,OAAO,CAAC,gBAAgB;IAIxB,OAAO,CAAC,oBAAoB;IA2B5B,OAAO,CAAC,oBAAoB;IAI5B,OAAO,CAAC,wBAAwB;IA2BhC,OAAO,CAAC,qBAAqB;IA2B7B,OAAO,CAAC,eAAe;IAevB,OAAO,CAAC,qBAAqB;IAkC7B,OAAO,CAAC,oBAAoB;IAiC5B,OAAO,CAAC,kBAAkB;IAS1B,OAAO,CAAC,qBAAqB;CAO9B;AA2ED,OAAO,EAAE,4BAA4B,EAAE,CAAC"}
|
|
@@ -7,8 +7,8 @@ export class GraphStore {
|
|
|
7
7
|
#atlasDatabase;
|
|
8
8
|
#repositoryId;
|
|
9
9
|
#gitDirectory;
|
|
10
|
-
constructor(repository) {
|
|
11
|
-
this.#atlasDatabase = new AtlasDatabase(repository);
|
|
10
|
+
constructor(repository, options = {}) {
|
|
11
|
+
this.#atlasDatabase = new AtlasDatabase(repository, options);
|
|
12
12
|
this.databasePath = this.#atlasDatabase.databasePath;
|
|
13
13
|
this.#repositoryId = repository.repositoryId;
|
|
14
14
|
this.#gitDirectory = repository.gitDirectory;
|
|
@@ -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
|