@praneeth_54/agentdoctor 1.0.0 → 1.1.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.
- package/CHANGELOG.md +60 -5
- package/README.md +462 -251
- package/dist/cli/commands/brain-mcp.d.ts +9 -0
- package/dist/cli/commands/brain-mcp.js +38 -0
- package/dist/cli/program.js +13 -0
- package/dist/constants.d.ts +1 -1
- package/dist/constants.js +1 -1
- package/dist/core/understanding/architecture/index.d.ts +4 -0
- package/dist/core/understanding/architecture/index.js +3 -0
- package/dist/core/understanding/architecture/infer.d.ts +6 -0
- package/dist/core/understanding/architecture/infer.js +39 -0
- package/dist/core/understanding/architecture/models.d.ts +23 -0
- package/dist/core/understanding/architecture/models.js +127 -0
- package/dist/core/understanding/architecture/patterns/distribution.d.ts +2 -0
- package/dist/core/understanding/architecture/patterns/distribution.js +115 -0
- package/dist/core/understanding/architecture/patterns/index.d.ts +2 -0
- package/dist/core/understanding/architecture/patterns/index.js +8 -0
- package/dist/core/understanding/architecture/patterns/layered.d.ts +2 -0
- package/dist/core/understanding/architecture/patterns/layered.js +279 -0
- package/dist/core/understanding/architecture/patterns/structural.d.ts +2 -0
- package/dist/core/understanding/architecture/patterns/structural.js +197 -0
- package/dist/core/understanding/architecture/rules.d.ts +4 -0
- package/dist/core/understanding/architecture/rules.js +6 -0
- package/dist/core/understanding/architecture/types.d.ts +52 -0
- package/dist/core/understanding/architecture/types.js +1 -0
- package/dist/core/understanding/brain/build.d.ts +13 -0
- package/dist/core/understanding/brain/build.js +158 -0
- package/dist/core/understanding/brain/claims/index.d.ts +3 -0
- package/dist/core/understanding/brain/claims/index.js +2 -0
- package/dist/core/understanding/brain/claims/lifecycle.d.ts +16 -0
- package/dist/core/understanding/brain/claims/lifecycle.js +78 -0
- package/dist/core/understanding/brain/claims/types.d.ts +32 -0
- package/dist/core/understanding/brain/claims/types.js +25 -0
- package/dist/core/understanding/brain/components/index.d.ts +17 -0
- package/dist/core/understanding/brain/components/index.js +97 -0
- package/dist/core/understanding/brain/components/types.d.ts +16 -0
- package/dist/core/understanding/brain/components/types.js +8 -0
- package/dist/core/understanding/brain/confidence.d.ts +19 -0
- package/dist/core/understanding/brain/confidence.js +39 -0
- package/dist/core/understanding/brain/contract.d.ts +17 -0
- package/dist/core/understanding/brain/contract.js +100 -0
- package/dist/core/understanding/brain/contradictions/index.d.ts +12 -0
- package/dist/core/understanding/brain/contradictions/index.js +57 -0
- package/dist/core/understanding/brain/contradictions/types.d.ts +12 -0
- package/dist/core/understanding/brain/contradictions/types.js +8 -0
- package/dist/core/understanding/brain/delta.d.ts +25 -0
- package/dist/core/understanding/brain/delta.js +116 -0
- package/dist/core/understanding/brain/evidence/index.d.ts +3 -0
- package/dist/core/understanding/brain/evidence/index.js +2 -0
- package/dist/core/understanding/brain/evidence/redact.d.ts +4 -0
- package/dist/core/understanding/brain/evidence/redact.js +36 -0
- package/dist/core/understanding/brain/evidence/types.d.ts +34 -0
- package/dist/core/understanding/brain/evidence/types.js +35 -0
- package/dist/core/understanding/brain/explain.d.ts +17 -0
- package/dist/core/understanding/brain/explain.js +33 -0
- package/dist/core/understanding/brain/index.d.ts +28 -0
- package/dist/core/understanding/brain/index.js +16 -0
- package/dist/core/understanding/brain/migrate.d.ts +21 -0
- package/dist/core/understanding/brain/migrate.js +47 -0
- package/dist/core/understanding/brain/query.d.ts +60 -0
- package/dist/core/understanding/brain/query.js +92 -0
- package/dist/core/understanding/brain/security.d.ts +3 -0
- package/dist/core/understanding/brain/security.js +43 -0
- package/dist/core/understanding/brain/storage/index.d.ts +2 -0
- package/dist/core/understanding/brain/storage/index.js +1 -0
- package/dist/core/understanding/brain/storage/store.d.ts +53 -0
- package/dist/core/understanding/brain/storage/store.js +305 -0
- package/dist/core/understanding/brain/trace.d.ts +24 -0
- package/dist/core/understanding/brain/trace.js +207 -0
- package/dist/core/understanding/brain/types.d.ts +32 -0
- package/dist/core/understanding/brain/types.js +8 -0
- package/dist/core/understanding/brain/version.d.ts +13 -0
- package/dist/core/understanding/brain/version.js +7 -0
- package/dist/core/understanding/delta/compare.d.ts +26 -0
- package/dist/core/understanding/delta/compare.js +74 -0
- package/dist/core/understanding/delta/index.d.ts +2 -0
- package/dist/core/understanding/delta/index.js +1 -0
- package/dist/core/understanding/dependencies/discover.d.ts +7 -0
- package/dist/core/understanding/dependencies/discover.js +550 -0
- package/dist/core/understanding/dependencies/extract.d.ts +10 -0
- package/dist/core/understanding/dependencies/extract.js +189 -0
- package/dist/core/understanding/dependencies/index.d.ts +4 -0
- package/dist/core/understanding/dependencies/index.js +3 -0
- package/dist/core/understanding/dependencies/models.d.ts +12 -0
- package/dist/core/understanding/dependencies/models.js +125 -0
- package/dist/core/understanding/dependencies/types.d.ts +27 -0
- package/dist/core/understanding/dependencies/types.js +1 -0
- package/dist/core/understanding/domain/discover.d.ts +14 -0
- package/dist/core/understanding/domain/discover.js +90 -0
- package/dist/core/understanding/domain/index.d.ts +2 -0
- package/dist/core/understanding/domain/index.js +1 -0
- package/dist/core/understanding/entrypoints/discover.d.ts +6 -0
- package/dist/core/understanding/entrypoints/discover.js +62 -0
- package/dist/core/understanding/entrypoints/extract.d.ts +19 -0
- package/dist/core/understanding/entrypoints/extract.js +43 -0
- package/dist/core/understanding/entrypoints/index.d.ts +4 -0
- package/dist/core/understanding/entrypoints/index.js +3 -0
- package/dist/core/understanding/entrypoints/models.d.ts +26 -0
- package/dist/core/understanding/entrypoints/models.js +216 -0
- package/dist/core/understanding/entrypoints/types.d.ts +20 -0
- package/dist/core/understanding/entrypoints/types.js +1 -0
- package/dist/core/understanding/index.d.ts +32 -0
- package/dist/core/understanding/index.js +18 -0
- package/dist/core/understanding/mind/build.d.ts +16 -0
- package/dist/core/understanding/mind/build.js +134 -0
- package/dist/core/understanding/mind/index.d.ts +6 -0
- package/dist/core/understanding/mind/index.js +3 -0
- package/dist/core/understanding/mind/query.d.ts +33 -0
- package/dist/core/understanding/mind/query.js +39 -0
- package/dist/core/understanding/mind/types.d.ts +24 -0
- package/dist/core/understanding/mind/types.js +7 -0
- package/dist/core/understanding/model/builder.d.ts +9 -0
- package/dist/core/understanding/model/builder.js +209 -0
- package/dist/core/understanding/model/ids.d.ts +7 -0
- package/dist/core/understanding/model/ids.js +48 -0
- package/dist/core/understanding/model/index.d.ts +7 -0
- package/dist/core/understanding/model/index.js +6 -0
- package/dist/core/understanding/model/schema.d.ts +12 -0
- package/dist/core/understanding/model/schema.js +33 -0
- package/dist/core/understanding/model/serializer.d.ts +9 -0
- package/dist/core/understanding/model/serializer.js +46 -0
- package/dist/core/understanding/model/types.d.ts +110 -0
- package/dist/core/understanding/model/types.js +1 -0
- package/dist/core/understanding/model/validator.d.ts +5 -0
- package/dist/core/understanding/model/validator.js +126 -0
- package/dist/core/understanding/model/version.d.ts +9 -0
- package/dist/core/understanding/model/version.js +7 -0
- package/dist/core/understanding/ownership/discover.d.ts +12 -0
- package/dist/core/understanding/ownership/discover.js +242 -0
- package/dist/core/understanding/ownership/index.d.ts +2 -0
- package/dist/core/understanding/ownership/index.js +1 -0
- package/dist/core/understanding/ownership/types.d.ts +23 -0
- package/dist/core/understanding/ownership/types.js +1 -0
- package/dist/core/understanding/query/engine.d.ts +24 -0
- package/dist/core/understanding/query/engine.js +35 -0
- package/dist/core/understanding/query/errors.d.ts +13 -0
- package/dist/core/understanding/query/errors.js +26 -0
- package/dist/core/understanding/query/executor.d.ts +8 -0
- package/dist/core/understanding/query/executor.js +34 -0
- package/dist/core/understanding/query/index.d.ts +7 -0
- package/dist/core/understanding/query/index.js +5 -0
- package/dist/core/understanding/query/models.d.ts +102 -0
- package/dist/core/understanding/query/models.js +1 -0
- package/dist/core/understanding/query/query.d.ts +68 -0
- package/dist/core/understanding/query/query.js +145 -0
- package/dist/core/understanding/query/registry.d.ts +8 -0
- package/dist/core/understanding/query/registry.js +340 -0
- package/dist/core/understanding/query/types.d.ts +63 -0
- package/dist/core/understanding/query/types.js +1 -0
- package/dist/core/understanding/relationships/discover.d.ts +11 -0
- package/dist/core/understanding/relationships/discover.js +517 -0
- package/dist/core/understanding/relationships/extract.d.ts +14 -0
- package/dist/core/understanding/relationships/extract.js +165 -0
- package/dist/core/understanding/relationships/index.d.ts +4 -0
- package/dist/core/understanding/relationships/index.js +3 -0
- package/dist/core/understanding/relationships/models.d.ts +21 -0
- package/dist/core/understanding/relationships/models.js +185 -0
- package/dist/core/understanding/relationships/types.d.ts +42 -0
- package/dist/core/understanding/relationships/types.js +1 -0
- package/dist/core/understanding/risks/discover.d.ts +8 -0
- package/dist/core/understanding/risks/discover.js +155 -0
- package/dist/core/understanding/risks/index.d.ts +2 -0
- package/dist/core/understanding/risks/index.js +1 -0
- package/dist/core/understanding/risks/types.d.ts +26 -0
- package/dist/core/understanding/risks/types.js +1 -0
- package/dist/core/understanding/shared/domain-lexicon.d.ts +9 -0
- package/dist/core/understanding/shared/domain-lexicon.js +107 -0
- package/dist/core/understanding/shared/index.d.ts +2 -0
- package/dist/core/understanding/shared/index.js +2 -0
- package/dist/core/understanding/shared/tokens.d.ts +7 -0
- package/dist/core/understanding/shared/tokens.js +141 -0
- package/dist/core/understanding/snapshot/identity.d.ts +24 -0
- package/dist/core/understanding/snapshot/identity.js +79 -0
- package/dist/core/understanding/snapshot/index.d.ts +2 -0
- package/dist/core/understanding/snapshot/index.js +1 -0
- package/dist/core/understanding/types/index.d.ts +22 -0
- package/dist/core/understanding/types/index.js +1 -0
- package/dist/core/understanding/understand/formatter.d.ts +10 -0
- package/dist/core/understanding/understand/formatter.js +115 -0
- package/dist/core/understanding/understand/index.d.ts +4 -0
- package/dist/core/understanding/understand/index.js +3 -0
- package/dist/core/understanding/understand/service.d.ts +17 -0
- package/dist/core/understanding/understand/service.js +76 -0
- package/dist/core/understanding/understand/summary.d.ts +14 -0
- package/dist/core/understanding/understand/summary.js +39 -0
- package/dist/core/understanding/understand/types.d.ts +31 -0
- package/dist/core/understanding/understand/types.js +1 -0
- package/dist/mcp/brain/compile.d.ts +9 -0
- package/dist/mcp/brain/compile.js +42 -0
- package/dist/mcp/brain/errors.d.ts +12 -0
- package/dist/mcp/brain/errors.js +23 -0
- package/dist/mcp/brain/index.d.ts +11 -0
- package/dist/mcp/brain/index.js +8 -0
- package/dist/mcp/brain/provenance.d.ts +29 -0
- package/dist/mcp/brain/provenance.js +59 -0
- package/dist/mcp/brain/schemas.d.ts +13 -0
- package/dist/mcp/brain/schemas.js +105 -0
- package/dist/mcp/brain/security/root.d.ts +6 -0
- package/dist/mcp/brain/security/root.js +66 -0
- package/dist/mcp/brain/server.d.ts +12 -0
- package/dist/mcp/brain/server.js +46 -0
- package/dist/mcp/brain/session.d.ts +33 -0
- package/dist/mcp/brain/session.js +117 -0
- package/dist/mcp/brain/tools/handlers.d.ts +13 -0
- package/dist/mcp/brain/tools/handlers.js +483 -0
- package/dist/mcp/brain/tools/registry.d.ts +9 -0
- package/dist/mcp/brain/tools/registry.js +191 -0
- package/package.json +11 -4
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/** Path / name segments ignored when mining domain tokens. */
|
|
2
|
+
export const DOMAIN_STOP_SEGMENTS = new Set([
|
|
3
|
+
"",
|
|
4
|
+
"src",
|
|
5
|
+
"lib",
|
|
6
|
+
"libs",
|
|
7
|
+
"app",
|
|
8
|
+
"apps",
|
|
9
|
+
"packages",
|
|
10
|
+
"package",
|
|
11
|
+
"modules",
|
|
12
|
+
"module",
|
|
13
|
+
"internal",
|
|
14
|
+
"cmd",
|
|
15
|
+
"bin",
|
|
16
|
+
"dist",
|
|
17
|
+
"build",
|
|
18
|
+
"out",
|
|
19
|
+
"public",
|
|
20
|
+
"static",
|
|
21
|
+
"assets",
|
|
22
|
+
"styles",
|
|
23
|
+
"css",
|
|
24
|
+
"js",
|
|
25
|
+
"ts",
|
|
26
|
+
"tsx",
|
|
27
|
+
"jsx",
|
|
28
|
+
"mjs",
|
|
29
|
+
"cjs",
|
|
30
|
+
"py",
|
|
31
|
+
"go",
|
|
32
|
+
"rs",
|
|
33
|
+
"java",
|
|
34
|
+
"kt",
|
|
35
|
+
"php",
|
|
36
|
+
"rb",
|
|
37
|
+
"dart",
|
|
38
|
+
"test",
|
|
39
|
+
"tests",
|
|
40
|
+
"spec",
|
|
41
|
+
"specs",
|
|
42
|
+
"__tests__",
|
|
43
|
+
"fixtures",
|
|
44
|
+
"mocks",
|
|
45
|
+
"mock",
|
|
46
|
+
"stub",
|
|
47
|
+
"stubs",
|
|
48
|
+
"types",
|
|
49
|
+
"type",
|
|
50
|
+
"typings",
|
|
51
|
+
"interfaces",
|
|
52
|
+
"interface",
|
|
53
|
+
"utils",
|
|
54
|
+
"util",
|
|
55
|
+
"helpers",
|
|
56
|
+
"helper",
|
|
57
|
+
"common",
|
|
58
|
+
"shared",
|
|
59
|
+
"core",
|
|
60
|
+
"index",
|
|
61
|
+
"main",
|
|
62
|
+
"init",
|
|
63
|
+
"config",
|
|
64
|
+
"configs",
|
|
65
|
+
"constants",
|
|
66
|
+
"constant",
|
|
67
|
+
"models",
|
|
68
|
+
"model",
|
|
69
|
+
"dto",
|
|
70
|
+
"entity",
|
|
71
|
+
"entities",
|
|
72
|
+
"repository",
|
|
73
|
+
"repositories",
|
|
74
|
+
"service",
|
|
75
|
+
"services",
|
|
76
|
+
"controller",
|
|
77
|
+
"controllers",
|
|
78
|
+
"handler",
|
|
79
|
+
"handlers",
|
|
80
|
+
"middleware",
|
|
81
|
+
"route",
|
|
82
|
+
"routes",
|
|
83
|
+
"router",
|
|
84
|
+
"api",
|
|
85
|
+
"v1",
|
|
86
|
+
"v2",
|
|
87
|
+
"v3",
|
|
88
|
+
"http",
|
|
89
|
+
"grpc",
|
|
90
|
+
"graphql",
|
|
91
|
+
"component",
|
|
92
|
+
"components",
|
|
93
|
+
"hook",
|
|
94
|
+
"hooks",
|
|
95
|
+
"page",
|
|
96
|
+
"pages",
|
|
97
|
+
"view",
|
|
98
|
+
"views",
|
|
99
|
+
"provider",
|
|
100
|
+
"providers",
|
|
101
|
+
"store",
|
|
102
|
+
"stores",
|
|
103
|
+
"context",
|
|
104
|
+
"contexts",
|
|
105
|
+
"domain",
|
|
106
|
+
"domains",
|
|
107
|
+
"feature",
|
|
108
|
+
"features",
|
|
109
|
+
"node_modules",
|
|
110
|
+
"vendor",
|
|
111
|
+
]);
|
|
112
|
+
/**
|
|
113
|
+
* Split a relative path into lowercase semantic tokens.
|
|
114
|
+
* Deterministic: camelCase, snake_case, kebab-case, path segments.
|
|
115
|
+
*/
|
|
116
|
+
export function tokenizeRelativePath(relativePath) {
|
|
117
|
+
const normalized = relativePath.replace(/\\/g, "/");
|
|
118
|
+
const withoutExt = normalized.replace(/\.[a-z0-9]+$/i, "");
|
|
119
|
+
const rawParts = withoutExt.split(/[/_.-]+/);
|
|
120
|
+
const tokens = [];
|
|
121
|
+
for (const part of rawParts) {
|
|
122
|
+
if (!part) {
|
|
123
|
+
continue;
|
|
124
|
+
}
|
|
125
|
+
const camelParts = part.split(/(?<=[a-z0-9])(?=[A-Z])/);
|
|
126
|
+
for (const piece of camelParts) {
|
|
127
|
+
const token = piece.toLowerCase();
|
|
128
|
+
if (token.length < 2) {
|
|
129
|
+
continue;
|
|
130
|
+
}
|
|
131
|
+
if (DOMAIN_STOP_SEGMENTS.has(token)) {
|
|
132
|
+
continue;
|
|
133
|
+
}
|
|
134
|
+
if (/^\d+$/.test(token)) {
|
|
135
|
+
continue;
|
|
136
|
+
}
|
|
137
|
+
tokens.push(token);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
return tokens;
|
|
141
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ProjectModel } from "../model/types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Identity of one deterministic understanding snapshot.
|
|
4
|
+
* contentHash ignores timestamps so structural equality is detectable across rebuild clocks.
|
|
5
|
+
*/
|
|
6
|
+
export interface SnapshotIdentity {
|
|
7
|
+
id: string;
|
|
8
|
+
contentHash: string;
|
|
9
|
+
compilerVersion: string;
|
|
10
|
+
schemaVersion: string;
|
|
11
|
+
projectName: string;
|
|
12
|
+
generatedAt: string;
|
|
13
|
+
domainCount: number;
|
|
14
|
+
entrypointCount: number;
|
|
15
|
+
dependencyCount: number;
|
|
16
|
+
relationshipCount: number;
|
|
17
|
+
architectureCount: number;
|
|
18
|
+
}
|
|
19
|
+
export declare function computeContentHash(model: ProjectModel): string;
|
|
20
|
+
export declare function createSnapshotIdentity(model: ProjectModel, options?: {
|
|
21
|
+
generatedAt?: string;
|
|
22
|
+
}): SnapshotIdentity;
|
|
23
|
+
/** Convenience hash of the full serialized model (includes timestamps). */
|
|
24
|
+
export declare function hashSerializedModel(model: ProjectModel): string;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { serializeProjectModel } from "../model/serializer.js";
|
|
3
|
+
import { UNDERSTANDING_COMPILER_VERSION } from "../model/version.js";
|
|
4
|
+
function structuralPayload(model) {
|
|
5
|
+
return {
|
|
6
|
+
schemaVersion: model.metadata.schemaVersion,
|
|
7
|
+
compilerVersion: model.compilerMetadata.compilerVersion,
|
|
8
|
+
projectName: model.metadata.project.name,
|
|
9
|
+
domains: model.domains.map((d) => ({
|
|
10
|
+
name: d.name,
|
|
11
|
+
paths: d.paths,
|
|
12
|
+
confidence: d.confidence,
|
|
13
|
+
evidence: d.evidence,
|
|
14
|
+
})),
|
|
15
|
+
entrypoints: model.entrypoints.map((e) => ({
|
|
16
|
+
framework: e.framework,
|
|
17
|
+
file: e.file,
|
|
18
|
+
confidence: e.confidence,
|
|
19
|
+
evidence: e.evidence,
|
|
20
|
+
})),
|
|
21
|
+
dependencies: model.dependencies.map((d) => ({
|
|
22
|
+
from: d.from,
|
|
23
|
+
to: d.to,
|
|
24
|
+
type: d.type,
|
|
25
|
+
confidence: d.confidence,
|
|
26
|
+
evidence: d.evidence,
|
|
27
|
+
})),
|
|
28
|
+
relationships: model.relationships.map((r) => ({
|
|
29
|
+
source: r.source,
|
|
30
|
+
target: r.target,
|
|
31
|
+
relationship: r.relationship,
|
|
32
|
+
strength: r.strength,
|
|
33
|
+
bidirectional: r.bidirectional,
|
|
34
|
+
confidence: r.confidence,
|
|
35
|
+
evidence: r.evidence,
|
|
36
|
+
})),
|
|
37
|
+
architectures: model.architectures.map((a) => ({
|
|
38
|
+
pattern: a.pattern,
|
|
39
|
+
matchedRules: a.matchedRules,
|
|
40
|
+
conflictingEvidence: a.conflictingEvidence,
|
|
41
|
+
unknowns: a.unknowns,
|
|
42
|
+
confidence: a.confidence,
|
|
43
|
+
evidence: a.evidence,
|
|
44
|
+
})),
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
export function computeContentHash(model) {
|
|
48
|
+
const json = JSON.stringify(structuralPayload(model));
|
|
49
|
+
return createHash("sha256").update(json).digest("hex").slice(0, 32);
|
|
50
|
+
}
|
|
51
|
+
export function createSnapshotIdentity(model, options = {}) {
|
|
52
|
+
const contentHash = computeContentHash(model);
|
|
53
|
+
const generatedAt = options.generatedAt ?? model.compilerMetadata.generatedAt;
|
|
54
|
+
const id = createHash("sha256")
|
|
55
|
+
.update(contentHash)
|
|
56
|
+
.update("\0")
|
|
57
|
+
.update(generatedAt)
|
|
58
|
+
.update("\0")
|
|
59
|
+
.update(UNDERSTANDING_COMPILER_VERSION)
|
|
60
|
+
.digest("hex")
|
|
61
|
+
.slice(0, 24);
|
|
62
|
+
return {
|
|
63
|
+
id: `snap_${id}`,
|
|
64
|
+
contentHash,
|
|
65
|
+
compilerVersion: model.compilerMetadata.compilerVersion,
|
|
66
|
+
schemaVersion: model.metadata.schemaVersion,
|
|
67
|
+
projectName: model.metadata.project.name,
|
|
68
|
+
generatedAt,
|
|
69
|
+
domainCount: model.domains.length,
|
|
70
|
+
entrypointCount: model.entrypoints.length,
|
|
71
|
+
dependencyCount: model.dependencies.length,
|
|
72
|
+
relationshipCount: model.relationships.length,
|
|
73
|
+
architectureCount: model.architectures.length,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
/** Convenience hash of the full serialized model (includes timestamps). */
|
|
77
|
+
export function hashSerializedModel(model) {
|
|
78
|
+
return createHash("sha256").update(serializeProjectModel(model)).digest("hex").slice(0, 32);
|
|
79
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { computeContentHash, createSnapshotIdentity, hashSerializedModel } from "./identity.js";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export type UnderstandingConfidence = number;
|
|
2
|
+
export interface UnderstandingEvidence {
|
|
3
|
+
path: string;
|
|
4
|
+
}
|
|
5
|
+
export interface DomainMatch {
|
|
6
|
+
name: string;
|
|
7
|
+
confidence: UnderstandingConfidence;
|
|
8
|
+
evidence: string[];
|
|
9
|
+
}
|
|
10
|
+
export interface DomainDiscoveryResult {
|
|
11
|
+
domains: DomainMatch[];
|
|
12
|
+
timingMs: number;
|
|
13
|
+
filesConsidered: number;
|
|
14
|
+
}
|
|
15
|
+
export interface DomainDiscoveryOptions {
|
|
16
|
+
/** Repository root. Defaults to process.cwd(). */
|
|
17
|
+
cwd?: string;
|
|
18
|
+
/** Minimum confidence to include a domain (0–1). Default 0.5. */
|
|
19
|
+
minConfidence?: number;
|
|
20
|
+
/** Minimum distinct evidence paths required. Default 1. */
|
|
21
|
+
minEvidence?: number;
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { UnderstandSection, UnderstandSnapshot } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Assemble a deterministic plain-text report from an UnderstandSnapshot.
|
|
4
|
+
*/
|
|
5
|
+
export declare function formatUnderstandReport(snapshot: UnderstandSnapshot, options: {
|
|
6
|
+
maxItems: number;
|
|
7
|
+
}): {
|
|
8
|
+
text: string;
|
|
9
|
+
sections: UnderstandSection[];
|
|
10
|
+
};
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { formatConfidence } from "./summary.js";
|
|
2
|
+
function take(items, maxItems) {
|
|
3
|
+
return items.slice(0, maxItems);
|
|
4
|
+
}
|
|
5
|
+
function bullet(lines) {
|
|
6
|
+
return lines.map((line) => `- ${line}`);
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Assemble a deterministic plain-text report from an UnderstandSnapshot.
|
|
10
|
+
*/
|
|
11
|
+
export function formatUnderstandReport(snapshot, options) {
|
|
12
|
+
const { maxItems } = options;
|
|
13
|
+
const { repository, domains, entrypoints, architectures, dependencies, relationships, statistics, } = snapshot;
|
|
14
|
+
const sections = [];
|
|
15
|
+
sections.push({
|
|
16
|
+
title: "Repository Overview",
|
|
17
|
+
lines: [
|
|
18
|
+
`Project: ${repository.projectName}`,
|
|
19
|
+
`Schema: ${repository.schemaVersion}`,
|
|
20
|
+
`Compiler: ${repository.compilerVersion}`,
|
|
21
|
+
`Generated At: ${repository.generatedAt}`,
|
|
22
|
+
`Frameworks: ${repository.frameworks.length > 0 ? repository.frameworks.join(", ") : "(none)"}`,
|
|
23
|
+
`Top Domains: ${repository.topDomains.length > 0 ? repository.topDomains.join(", ") : "(none)"}`,
|
|
24
|
+
`Top Architectures: ${repository.topArchitectures.length > 0 ? repository.topArchitectures.join(", ") : "(none)"}`,
|
|
25
|
+
],
|
|
26
|
+
});
|
|
27
|
+
sections.push({
|
|
28
|
+
title: "Detected Domains",
|
|
29
|
+
lines: domains.count === 0
|
|
30
|
+
? ["(none)"]
|
|
31
|
+
: bullet(take(domains.domains, maxItems).map((domain) => `${domain.name} (confidence=${formatConfidence(domain.confidence)}, paths=${domain.paths.length})`)),
|
|
32
|
+
});
|
|
33
|
+
sections.push({
|
|
34
|
+
title: "Primary Entry Points",
|
|
35
|
+
lines: entrypoints.count === 0
|
|
36
|
+
? ["(none)"]
|
|
37
|
+
: bullet(take(entrypoints.entrypoints, maxItems).map((entry) => `${entry.framework}: ${entry.file} (confidence=${formatConfidence(entry.confidence)})`)),
|
|
38
|
+
});
|
|
39
|
+
sections.push({
|
|
40
|
+
title: "Detected Architecture",
|
|
41
|
+
lines: architectures.count === 0
|
|
42
|
+
? ["(none)"]
|
|
43
|
+
: bullet(take(architectures.architectures, maxItems).map((arch) => {
|
|
44
|
+
const conflicts = arch.conflictingEvidence.length > 0
|
|
45
|
+
? `; conflicts=${arch.conflictingEvidence.length}`
|
|
46
|
+
: "";
|
|
47
|
+
return `${arch.pattern} (confidence=${formatConfidence(arch.confidence)}, rules=${arch.matchedRules.length}${conflicts})`;
|
|
48
|
+
})),
|
|
49
|
+
});
|
|
50
|
+
sections.push({
|
|
51
|
+
title: "Dependency Highlights",
|
|
52
|
+
lines: dependencies.count === 0
|
|
53
|
+
? ["(none)"]
|
|
54
|
+
: bullet(take(dependencies.dependencies, maxItems).map((dep) => `${dep.from} -[${dep.type}]-> ${dep.to} (confidence=${formatConfidence(dep.confidence)})`)),
|
|
55
|
+
});
|
|
56
|
+
sections.push({
|
|
57
|
+
title: "Relationship Highlights",
|
|
58
|
+
lines: relationships.count === 0
|
|
59
|
+
? ["(none)"]
|
|
60
|
+
: bullet(take(relationships.relationships, maxItems).map((rel) => `${rel.source} -[${rel.relationship}/${rel.strength}]-> ${rel.target} (confidence=${formatConfidence(rel.confidence)})`)),
|
|
61
|
+
});
|
|
62
|
+
const stats = statistics.summary.statistics;
|
|
63
|
+
sections.push({
|
|
64
|
+
title: "Compiler Confidence",
|
|
65
|
+
lines: [
|
|
66
|
+
`Average Confidence: ${formatConfidence(stats.averageConfidence)}`,
|
|
67
|
+
`Repository Summary Confidence: ${formatConfidence(repository.statistics.averageConfidence)}`,
|
|
68
|
+
`Domains: ${stats.domainCount}`,
|
|
69
|
+
`Entrypoints: ${stats.entrypointCount}`,
|
|
70
|
+
`Dependencies: ${stats.dependencyCount}`,
|
|
71
|
+
`Relationships: ${stats.relationshipCount}`,
|
|
72
|
+
`Architectures: ${stats.architectureCount}`,
|
|
73
|
+
],
|
|
74
|
+
});
|
|
75
|
+
sections.push({
|
|
76
|
+
title: "Statistics",
|
|
77
|
+
lines: [
|
|
78
|
+
`Evidence Count: ${stats.evidenceCount}`,
|
|
79
|
+
`Pass Timing (ms): domains=${stats.passTimingMs.domains}, entrypoints=${stats.passTimingMs.entrypoints}, dependencies=${stats.passTimingMs.dependencies}, relationships=${stats.passTimingMs.relationships}, architectures=${stats.passTimingMs.architectures}`,
|
|
80
|
+
`Queries Executed: ${snapshot.queryCount}`,
|
|
81
|
+
],
|
|
82
|
+
});
|
|
83
|
+
const evidenceLines = [];
|
|
84
|
+
for (const domain of take(domains.domains, Math.min(3, maxItems))) {
|
|
85
|
+
for (const item of take(domain.evidence, 2)) {
|
|
86
|
+
evidenceLines.push(`domain:${domain.name}: ${item}`);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
for (const entry of take(entrypoints.entrypoints, Math.min(3, maxItems))) {
|
|
90
|
+
for (const item of take(entry.evidence, 1)) {
|
|
91
|
+
evidenceLines.push(`entrypoint:${entry.file}: ${item}`);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
for (const arch of take(architectures.architectures, Math.min(3, maxItems))) {
|
|
95
|
+
for (const item of take(arch.matchedRules, 1)) {
|
|
96
|
+
evidenceLines.push(`architecture:${arch.pattern}: ${item}`);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
sections.push({
|
|
100
|
+
title: "Evidence Summary",
|
|
101
|
+
lines: evidenceLines.length === 0 ? ["(none)"] : bullet(evidenceLines),
|
|
102
|
+
});
|
|
103
|
+
sections.push({
|
|
104
|
+
title: "Unknowns",
|
|
105
|
+
lines: snapshot.unknowns.length === 0 ? ["(none)"] : bullet(take(snapshot.unknowns, maxItems)),
|
|
106
|
+
});
|
|
107
|
+
sections.push({
|
|
108
|
+
title: "Limitations",
|
|
109
|
+
lines: bullet([...snapshot.limitations]),
|
|
110
|
+
});
|
|
111
|
+
const text = sections
|
|
112
|
+
.map((section) => `${section.title}\n${section.lines.join("\n")}`)
|
|
113
|
+
.join("\n\n");
|
|
114
|
+
return { text: `${text}\n`, sections };
|
|
115
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { UnderstandService, createUnderstandService, understandAsText } from "./service.js";
|
|
2
|
+
export { formatUnderstandReport } from "./formatter.js";
|
|
3
|
+
export { UNDERSTAND_LIMITATIONS, collectUnknowns, formatConfidence } from "./summary.js";
|
|
4
|
+
export type { UnderstandResult, UnderstandSection, UnderstandSnapshot, UnderstandServiceOptions, UnderstandEngine, } from "./types.js";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { UnderstandEngine, UnderstandResult, UnderstandServiceOptions } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* First vertical-slice consumer of the Software Understanding Compiler.
|
|
4
|
+
* Reads exclusively through QueryEngine — never ProjectModel, never compiler passes.
|
|
5
|
+
*/
|
|
6
|
+
export declare class UnderstandService {
|
|
7
|
+
private readonly engine;
|
|
8
|
+
private readonly maxItems;
|
|
9
|
+
constructor(engine: UnderstandEngine, options?: UnderstandServiceOptions);
|
|
10
|
+
/**
|
|
11
|
+
* Produce a deterministic human-readable repository understanding report.
|
|
12
|
+
*/
|
|
13
|
+
summarize(): UnderstandResult;
|
|
14
|
+
}
|
|
15
|
+
export declare function createUnderstandService(engine: UnderstandEngine, options?: UnderstandServiceOptions): UnderstandService;
|
|
16
|
+
/** Convenience: run understand and return plain text only. */
|
|
17
|
+
export declare function understandAsText(engine: UnderstandEngine, options?: UnderstandServiceOptions): string;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { Queries } from "../query/engine.js";
|
|
2
|
+
import { formatUnderstandReport } from "./formatter.js";
|
|
3
|
+
import { UNDERSTAND_LIMITATIONS, collectUnknowns } from "./summary.js";
|
|
4
|
+
const DEFAULT_MAX_ITEMS = 8;
|
|
5
|
+
/**
|
|
6
|
+
* First vertical-slice consumer of the Software Understanding Compiler.
|
|
7
|
+
* Reads exclusively through QueryEngine — never ProjectModel, never compiler passes.
|
|
8
|
+
*/
|
|
9
|
+
export class UnderstandService {
|
|
10
|
+
engine;
|
|
11
|
+
maxItems;
|
|
12
|
+
constructor(engine, options = {}) {
|
|
13
|
+
this.engine = engine;
|
|
14
|
+
this.maxItems = options.maxItems ?? DEFAULT_MAX_ITEMS;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Produce a deterministic human-readable repository understanding report.
|
|
18
|
+
*/
|
|
19
|
+
summarize() {
|
|
20
|
+
const started = performance.now();
|
|
21
|
+
const repository = this.engine.execute(Queries.repositorySummary());
|
|
22
|
+
const domains = this.engine.execute(Queries.listDomains());
|
|
23
|
+
const entrypoints = this.engine.execute(Queries.listEntrypoints());
|
|
24
|
+
const architectures = this.engine.execute(Queries.listArchitectures());
|
|
25
|
+
const dependencies = this.engine.execute(Queries.listDependencies());
|
|
26
|
+
const relationships = this.engine.execute(Queries.listRelationships());
|
|
27
|
+
const statistics = this.engine.execute(Queries.statistics());
|
|
28
|
+
const queryCount = 7;
|
|
29
|
+
const architectureUnknowns = architectures.result.architectures.flatMap((arch) => arch.unknowns);
|
|
30
|
+
const unknowns = collectUnknowns({
|
|
31
|
+
architectureUnknowns,
|
|
32
|
+
domainCount: domains.result.count,
|
|
33
|
+
entrypointCount: entrypoints.result.count,
|
|
34
|
+
architectureCount: architectures.result.count,
|
|
35
|
+
dependencyCount: dependencies.result.count,
|
|
36
|
+
relationshipCount: relationships.result.count,
|
|
37
|
+
});
|
|
38
|
+
const snapshot = {
|
|
39
|
+
repository: repository.result,
|
|
40
|
+
domains: domains.result,
|
|
41
|
+
entrypoints: entrypoints.result,
|
|
42
|
+
architectures: architectures.result,
|
|
43
|
+
dependencies: dependencies.result,
|
|
44
|
+
relationships: relationships.result,
|
|
45
|
+
statistics: statistics.result,
|
|
46
|
+
unknowns,
|
|
47
|
+
limitations: UNDERSTAND_LIMITATIONS,
|
|
48
|
+
queryCount,
|
|
49
|
+
};
|
|
50
|
+
const { text, sections } = formatUnderstandReport(snapshot, { maxItems: this.maxItems });
|
|
51
|
+
const confidence = Math.round(((repository.confidence +
|
|
52
|
+
domains.confidence +
|
|
53
|
+
entrypoints.confidence +
|
|
54
|
+
architectures.confidence +
|
|
55
|
+
dependencies.confidence +
|
|
56
|
+
relationships.confidence +
|
|
57
|
+
statistics.confidence) /
|
|
58
|
+
queryCount) *
|
|
59
|
+
100) / 100;
|
|
60
|
+
return {
|
|
61
|
+
text,
|
|
62
|
+
sections,
|
|
63
|
+
confidence,
|
|
64
|
+
executionTimeMs: Math.max(0, Math.round(performance.now() - started)),
|
|
65
|
+
queryCount,
|
|
66
|
+
snapshot,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
export function createUnderstandService(engine, options) {
|
|
71
|
+
return new UnderstandService(engine, options);
|
|
72
|
+
}
|
|
73
|
+
/** Convenience: run understand and return plain text only. */
|
|
74
|
+
export function understandAsText(engine, options) {
|
|
75
|
+
return createUnderstandService(engine, options).summarize().text;
|
|
76
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fixed, deterministic limitation statements for Compiler v0.1 understand output.
|
|
3
|
+
* Not generated by AI — static product honesty copy.
|
|
4
|
+
*/
|
|
5
|
+
export declare const UNDERSTAND_LIMITATIONS: readonly string[];
|
|
6
|
+
export declare function collectUnknowns(options: {
|
|
7
|
+
architectureUnknowns: readonly string[];
|
|
8
|
+
domainCount: number;
|
|
9
|
+
entrypointCount: number;
|
|
10
|
+
architectureCount: number;
|
|
11
|
+
dependencyCount: number;
|
|
12
|
+
relationshipCount: number;
|
|
13
|
+
}): string[];
|
|
14
|
+
export declare function formatConfidence(value: number): string;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fixed, deterministic limitation statements for Compiler v0.1 understand output.
|
|
3
|
+
* Not generated by AI — static product honesty copy.
|
|
4
|
+
*/
|
|
5
|
+
export const UNDERSTAND_LIMITATIONS = [
|
|
6
|
+
"Summary is assembled only from Query Engine results over an existing ProjectModel.",
|
|
7
|
+
"No repository scan, compiler pass, or source parse runs during understand.",
|
|
8
|
+
"No AI, LLM, or natural-language generation is used.",
|
|
9
|
+
"Architecture confidence is capped below certainty by the inference engine.",
|
|
10
|
+
"Absence of a signal means evidence was not found, not that the concept is impossible.",
|
|
11
|
+
"Explain/Trace/Verify capabilities are not included in this vertical slice.",
|
|
12
|
+
];
|
|
13
|
+
export function collectUnknowns(options) {
|
|
14
|
+
const unknowns = [];
|
|
15
|
+
for (const item of options.architectureUnknowns) {
|
|
16
|
+
if (!unknowns.includes(item)) {
|
|
17
|
+
unknowns.push(item);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
if (options.domainCount === 0) {
|
|
21
|
+
unknowns.push("No domains were reported by the Query Engine.");
|
|
22
|
+
}
|
|
23
|
+
if (options.entrypointCount === 0) {
|
|
24
|
+
unknowns.push("No entry points were reported by the Query Engine.");
|
|
25
|
+
}
|
|
26
|
+
if (options.architectureCount === 0) {
|
|
27
|
+
unknowns.push("No architecture patterns were reported by the Query Engine.");
|
|
28
|
+
}
|
|
29
|
+
if (options.dependencyCount === 0) {
|
|
30
|
+
unknowns.push("No dependencies were reported by the Query Engine.");
|
|
31
|
+
}
|
|
32
|
+
if (options.relationshipCount === 0) {
|
|
33
|
+
unknowns.push("No relationships were reported by the Query Engine.");
|
|
34
|
+
}
|
|
35
|
+
return unknowns.sort((a, b) => a.localeCompare(b));
|
|
36
|
+
}
|
|
37
|
+
export function formatConfidence(value) {
|
|
38
|
+
return value.toFixed(2);
|
|
39
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { QueryEngine } from "../query/engine.js";
|
|
2
|
+
import type { ListArchitecturesResult, ListDependenciesResult, ListDomainsResult, ListEntrypointsResult, ListRelationshipsResult, RepositorySummaryResult, StatisticsResult } from "../query/models.js";
|
|
3
|
+
export interface UnderstandSection {
|
|
4
|
+
title: string;
|
|
5
|
+
lines: readonly string[];
|
|
6
|
+
}
|
|
7
|
+
export interface UnderstandSnapshot {
|
|
8
|
+
repository: RepositorySummaryResult;
|
|
9
|
+
domains: ListDomainsResult;
|
|
10
|
+
entrypoints: ListEntrypointsResult;
|
|
11
|
+
architectures: ListArchitecturesResult;
|
|
12
|
+
dependencies: ListDependenciesResult;
|
|
13
|
+
relationships: ListRelationshipsResult;
|
|
14
|
+
statistics: StatisticsResult;
|
|
15
|
+
unknowns: readonly string[];
|
|
16
|
+
limitations: readonly string[];
|
|
17
|
+
queryCount: number;
|
|
18
|
+
}
|
|
19
|
+
export interface UnderstandResult {
|
|
20
|
+
text: string;
|
|
21
|
+
sections: readonly UnderstandSection[];
|
|
22
|
+
confidence: number;
|
|
23
|
+
executionTimeMs: number;
|
|
24
|
+
queryCount: number;
|
|
25
|
+
snapshot: UnderstandSnapshot;
|
|
26
|
+
}
|
|
27
|
+
export interface UnderstandServiceOptions {
|
|
28
|
+
/** Max items per list section. Default 8. */
|
|
29
|
+
maxItems?: number;
|
|
30
|
+
}
|
|
31
|
+
export type UnderstandEngine = Pick<QueryEngine, "execute">;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type ProjectBrain } from "../../core/understanding/brain/index.js";
|
|
2
|
+
export interface CompileBrainOptions {
|
|
3
|
+
previousClaims?: ProjectBrain["claims"];
|
|
4
|
+
generatedAt?: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Compile discovery passes → ProjectModel → ProjectBrain for an explicit root.
|
|
8
|
+
*/
|
|
9
|
+
export declare function compileProjectBrain(projectRoot: string, options?: CompileBrainOptions): Promise<ProjectBrain>;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { inferArchitectures } from "../../core/understanding/architecture/index.js";
|
|
3
|
+
import { buildProjectBrain } from "../../core/understanding/brain/index.js";
|
|
4
|
+
import { discoverDependencies } from "../../core/understanding/dependencies/index.js";
|
|
5
|
+
import { discoverDomains } from "../../core/understanding/domain/index.js";
|
|
6
|
+
import { discoverEntrypoints } from "../../core/understanding/entrypoints/index.js";
|
|
7
|
+
import { buildProjectModel } from "../../core/understanding/model/index.js";
|
|
8
|
+
import { discoverRelationships } from "../../core/understanding/relationships/index.js";
|
|
9
|
+
/**
|
|
10
|
+
* Compile discovery passes → ProjectModel → ProjectBrain for an explicit root.
|
|
11
|
+
*/
|
|
12
|
+
export async function compileProjectBrain(projectRoot, options = {}) {
|
|
13
|
+
const domains = await discoverDomains({ cwd: projectRoot });
|
|
14
|
+
const entrypoints = await discoverEntrypoints({ cwd: projectRoot });
|
|
15
|
+
const dependencies = await discoverDependencies({ cwd: projectRoot });
|
|
16
|
+
const relationships = await discoverRelationships({
|
|
17
|
+
cwd: projectRoot,
|
|
18
|
+
domains,
|
|
19
|
+
entrypoints,
|
|
20
|
+
dependencies,
|
|
21
|
+
});
|
|
22
|
+
const architectures = inferArchitectures({
|
|
23
|
+
domains,
|
|
24
|
+
entrypoints,
|
|
25
|
+
dependencies,
|
|
26
|
+
relationships,
|
|
27
|
+
});
|
|
28
|
+
const model = buildProjectModel({
|
|
29
|
+
domains,
|
|
30
|
+
entrypoints,
|
|
31
|
+
dependencies,
|
|
32
|
+
relationships,
|
|
33
|
+
architectures,
|
|
34
|
+
projectName: path.basename(projectRoot),
|
|
35
|
+
...(options.generatedAt !== undefined ? { generatedAt: options.generatedAt } : {}),
|
|
36
|
+
});
|
|
37
|
+
return buildProjectBrain(model, {
|
|
38
|
+
cwd: projectRoot,
|
|
39
|
+
...(options.previousClaims !== undefined ? { previousClaims: options.previousClaims } : {}),
|
|
40
|
+
...(options.generatedAt !== undefined ? { generatedAt: options.generatedAt } : {}),
|
|
41
|
+
});
|
|
42
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type BrainMcpErrorCode = "invalid_root" | "path_escape" | "brain_not_found" | "brain_corrupt" | "unsupported_query" | "invalid_argument" | "not_found" | "read_only" | "internal";
|
|
2
|
+
export declare class BrainMcpError extends Error {
|
|
3
|
+
readonly code: BrainMcpErrorCode;
|
|
4
|
+
constructor(code: BrainMcpErrorCode, message: string);
|
|
5
|
+
}
|
|
6
|
+
export declare function toToolErrorPayload(error: unknown): {
|
|
7
|
+
ok: false;
|
|
8
|
+
error: {
|
|
9
|
+
code: BrainMcpErrorCode | "unknown";
|
|
10
|
+
message: string;
|
|
11
|
+
};
|
|
12
|
+
};
|