@autonav/core 1.0.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/README.md +115 -0
- package/dist/adapter/claude-adapter.d.ts +136 -0
- package/dist/adapter/claude-adapter.d.ts.map +1 -0
- package/dist/adapter/claude-adapter.js +340 -0
- package/dist/adapter/claude-adapter.js.map +1 -0
- package/dist/adapter/index.d.ts +7 -0
- package/dist/adapter/index.d.ts.map +1 -0
- package/dist/adapter/index.js +7 -0
- package/dist/adapter/index.js.map +1 -0
- package/dist/cli/autonav.d.ts +11 -0
- package/dist/cli/autonav.d.ts.map +1 -0
- package/dist/cli/autonav.js +79 -0
- package/dist/cli/autonav.js.map +1 -0
- package/dist/cli/nav-chat.d.ts +3 -0
- package/dist/cli/nav-chat.d.ts.map +1 -0
- package/dist/cli/nav-chat.js +151 -0
- package/dist/cli/nav-chat.js.map +1 -0
- package/dist/cli/nav-init.d.ts +3 -0
- package/dist/cli/nav-init.d.ts.map +1 -0
- package/dist/cli/nav-init.js +366 -0
- package/dist/cli/nav-init.js.map +1 -0
- package/dist/cli/nav-query.d.ts +3 -0
- package/dist/cli/nav-query.d.ts.map +1 -0
- package/dist/cli/nav-query.js +217 -0
- package/dist/cli/nav-query.js.map +1 -0
- package/dist/conversation/App.d.ts +14 -0
- package/dist/conversation/App.d.ts.map +1 -0
- package/dist/conversation/App.js +229 -0
- package/dist/conversation/App.js.map +1 -0
- package/dist/conversation/index.d.ts +29 -0
- package/dist/conversation/index.d.ts.map +1 -0
- package/dist/conversation/index.js +44 -0
- package/dist/conversation/index.js.map +1 -0
- package/dist/conversation/prompts.d.ts +9 -0
- package/dist/conversation/prompts.d.ts.map +1 -0
- package/dist/conversation/prompts.js +47 -0
- package/dist/conversation/prompts.js.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +24 -0
- package/dist/index.js.map +1 -0
- package/dist/interview/App.d.ts +14 -0
- package/dist/interview/App.d.ts.map +1 -0
- package/dist/interview/App.js +159 -0
- package/dist/interview/App.js.map +1 -0
- package/dist/interview/index.d.ts +30 -0
- package/dist/interview/index.d.ts.map +1 -0
- package/dist/interview/index.js +52 -0
- package/dist/interview/index.js.map +1 -0
- package/dist/interview/prompts.d.ts +36 -0
- package/dist/interview/prompts.d.ts.map +1 -0
- package/dist/interview/prompts.js +116 -0
- package/dist/interview/prompts.js.map +1 -0
- package/dist/pack-installer/github.d.ts +41 -0
- package/dist/pack-installer/github.d.ts.map +1 -0
- package/dist/pack-installer/github.js +294 -0
- package/dist/pack-installer/github.js.map +1 -0
- package/dist/pack-installer/index.d.ts +57 -0
- package/dist/pack-installer/index.d.ts.map +1 -0
- package/dist/pack-installer/index.js +257 -0
- package/dist/pack-installer/index.js.map +1 -0
- package/dist/plugins/config-schema.d.ts +32 -0
- package/dist/plugins/config-schema.d.ts.map +1 -0
- package/dist/plugins/config-schema.js +26 -0
- package/dist/plugins/config-schema.js.map +1 -0
- package/dist/plugins/implementations/file-watcher/index.d.ts +110 -0
- package/dist/plugins/implementations/file-watcher/index.d.ts.map +1 -0
- package/dist/plugins/implementations/file-watcher/index.js +212 -0
- package/dist/plugins/implementations/file-watcher/index.js.map +1 -0
- package/dist/plugins/implementations/github/index.d.ts +201 -0
- package/dist/plugins/implementations/github/index.d.ts.map +1 -0
- package/dist/plugins/implementations/github/index.js +337 -0
- package/dist/plugins/implementations/github/index.js.map +1 -0
- package/dist/plugins/implementations/slack/index.d.ts +153 -0
- package/dist/plugins/implementations/slack/index.d.ts.map +1 -0
- package/dist/plugins/implementations/slack/index.js +221 -0
- package/dist/plugins/implementations/slack/index.js.map +1 -0
- package/dist/plugins/index.d.ts +23 -0
- package/dist/plugins/index.d.ts.map +1 -0
- package/dist/plugins/index.js +35 -0
- package/dist/plugins/index.js.map +1 -0
- package/dist/plugins/plugin-manager.d.ts +66 -0
- package/dist/plugins/plugin-manager.d.ts.map +1 -0
- package/dist/plugins/plugin-manager.js +198 -0
- package/dist/plugins/plugin-manager.js.map +1 -0
- package/dist/plugins/types.d.ts +102 -0
- package/dist/plugins/types.d.ts.map +1 -0
- package/dist/plugins/types.js +38 -0
- package/dist/plugins/types.js.map +1 -0
- package/dist/plugins/utils/security.d.ts +43 -0
- package/dist/plugins/utils/security.d.ts.map +1 -0
- package/dist/plugins/utils/security.js +115 -0
- package/dist/plugins/utils/security.js.map +1 -0
- package/dist/query-engine/index.d.ts +10 -0
- package/dist/query-engine/index.d.ts.map +1 -0
- package/dist/query-engine/index.js +10 -0
- package/dist/query-engine/index.js.map +1 -0
- package/dist/query-engine/navigator-loader.d.ts +37 -0
- package/dist/query-engine/navigator-loader.d.ts.map +1 -0
- package/dist/query-engine/navigator-loader.js +167 -0
- package/dist/query-engine/navigator-loader.js.map +1 -0
- package/dist/query-engine/output-formatter.d.ts +55 -0
- package/dist/query-engine/output-formatter.d.ts.map +1 -0
- package/dist/query-engine/output-formatter.js +165 -0
- package/dist/query-engine/output-formatter.js.map +1 -0
- package/dist/query-engine/response-validator.d.ts +55 -0
- package/dist/query-engine/response-validator.d.ts.map +1 -0
- package/dist/query-engine/response-validator.js +92 -0
- package/dist/query-engine/response-validator.js.map +1 -0
- package/dist/templates/.gitignore.template +23 -0
- package/dist/templates/CLAUDE-pack.md.template +32 -0
- package/dist/templates/CLAUDE.md.template +128 -0
- package/dist/templates/README.md.template +174 -0
- package/dist/templates/config-pack.json.template +16 -0
- package/dist/templates/config.json.template +11 -0
- package/dist/templates/index.d.ts +22 -0
- package/dist/templates/index.d.ts.map +1 -0
- package/dist/templates/index.js +32 -0
- package/dist/templates/index.js.map +1 -0
- package/dist/templates/plugins.json.template +33 -0
- package/dist/templates/system-configuration.md.template +66 -0
- package/dist/tools/handler.d.ts +20 -0
- package/dist/tools/handler.d.ts.map +1 -0
- package/dist/tools/handler.js +202 -0
- package/dist/tools/handler.js.map +1 -0
- package/dist/tools/index.d.ts +10 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +10 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/response.d.ts +30 -0
- package/dist/tools/response.d.ts.map +1 -0
- package/dist/tools/response.js +68 -0
- package/dist/tools/response.js.map +1 -0
- package/dist/tools/self-config.d.ts +54 -0
- package/dist/tools/self-config.d.ts.map +1 -0
- package/dist/tools/self-config.js +84 -0
- package/dist/tools/self-config.js.map +1 -0
- package/dist/validation/index.d.ts +19 -0
- package/dist/validation/index.d.ts.map +1 -0
- package/dist/validation/index.js +91 -0
- package/dist/validation/index.js.map +1 -0
- package/package.json +71 -0
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import chalk from "chalk";
|
|
2
|
+
/**
|
|
3
|
+
* Format a navigator response for display
|
|
4
|
+
*
|
|
5
|
+
* @param response - Navigator response to format
|
|
6
|
+
* @param options - Formatting options
|
|
7
|
+
* @returns Formatted string for display
|
|
8
|
+
*/
|
|
9
|
+
export function formatResponse(response, options) {
|
|
10
|
+
// Disable chalk if noColor is set
|
|
11
|
+
if (options.noColor) {
|
|
12
|
+
chalk.level = 0;
|
|
13
|
+
}
|
|
14
|
+
switch (options.format) {
|
|
15
|
+
case "json":
|
|
16
|
+
return formatJSON(response);
|
|
17
|
+
case "compact":
|
|
18
|
+
return formatCompact(response);
|
|
19
|
+
case "pretty":
|
|
20
|
+
default:
|
|
21
|
+
return formatPretty(response, options.verbose);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Format response as JSON
|
|
26
|
+
*/
|
|
27
|
+
function formatJSON(response) {
|
|
28
|
+
return JSON.stringify(response, null, 2);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Format response in compact mode
|
|
32
|
+
* Answer + minimal source citations in brackets
|
|
33
|
+
*/
|
|
34
|
+
function formatCompact(response) {
|
|
35
|
+
const lines = [];
|
|
36
|
+
// Answer
|
|
37
|
+
lines.push(response.answer);
|
|
38
|
+
// Sources in brackets (using file field)
|
|
39
|
+
if (response.sources.length > 0) {
|
|
40
|
+
const sourceCitations = response.sources
|
|
41
|
+
.map((source) => source.file)
|
|
42
|
+
.join(", ");
|
|
43
|
+
lines.push(`[${sourceCitations}]`);
|
|
44
|
+
}
|
|
45
|
+
return lines.join("\n");
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Format response in pretty mode
|
|
49
|
+
* Clear sections with formatting
|
|
50
|
+
*/
|
|
51
|
+
function formatPretty(response, verbose) {
|
|
52
|
+
const lines = [];
|
|
53
|
+
// Answer section
|
|
54
|
+
lines.push(chalk.bold.cyan("Answer:"));
|
|
55
|
+
lines.push(response.answer);
|
|
56
|
+
lines.push("");
|
|
57
|
+
// Sources section
|
|
58
|
+
if (response.sources.length > 0) {
|
|
59
|
+
lines.push(chalk.bold.cyan("Sources:"));
|
|
60
|
+
for (const source of response.sources) {
|
|
61
|
+
const filePath = chalk.white(source.file);
|
|
62
|
+
const sectionInfo = chalk.dim(` (${source.section})`);
|
|
63
|
+
lines.push(`${chalk.green("✓")} ${filePath}${sectionInfo}`);
|
|
64
|
+
// Show relevance
|
|
65
|
+
if (source.relevance) {
|
|
66
|
+
lines.push(chalk.dim(` Relevance: ${source.relevance}`));
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
lines.push("");
|
|
70
|
+
}
|
|
71
|
+
// Confidence section (using enum value directly)
|
|
72
|
+
const confidenceColor = getConfidenceColor(response.confidence);
|
|
73
|
+
lines.push(`${chalk.bold("Confidence:")} ${confidenceColor(response.confidence)}`);
|
|
74
|
+
if (response.confidenceReason) {
|
|
75
|
+
lines.push(chalk.dim(` Reason: ${response.confidenceReason}`));
|
|
76
|
+
}
|
|
77
|
+
lines.push("");
|
|
78
|
+
// Out of domain warning
|
|
79
|
+
if (response.outOfDomain) {
|
|
80
|
+
lines.push(chalk.yellow("⚠ This question is outside the navigator's domain"));
|
|
81
|
+
lines.push("");
|
|
82
|
+
}
|
|
83
|
+
// Related topics
|
|
84
|
+
if (response.relatedTopics && response.relatedTopics.length > 0) {
|
|
85
|
+
lines.push(chalk.bold.cyan("Related Topics:"));
|
|
86
|
+
for (const topic of response.relatedTopics) {
|
|
87
|
+
lines.push(` ${chalk.dim("•")} ${topic}`);
|
|
88
|
+
}
|
|
89
|
+
lines.push("");
|
|
90
|
+
}
|
|
91
|
+
// Verbose information
|
|
92
|
+
if (verbose) {
|
|
93
|
+
lines.push(chalk.bold.dim("Debug Information:"));
|
|
94
|
+
lines.push(chalk.dim(`Protocol Version: ${response.protocolVersion}`));
|
|
95
|
+
if (response.metadata) {
|
|
96
|
+
lines.push(chalk.dim(`Navigator: ${response.metadata.navigatorName || "N/A"}`));
|
|
97
|
+
if (response.metadata.responseTimeMs) {
|
|
98
|
+
lines.push(chalk.dim(`Response Time: ${response.metadata.responseTimeMs}ms`));
|
|
99
|
+
}
|
|
100
|
+
if (response.metadata.filesSearched !== undefined) {
|
|
101
|
+
lines.push(chalk.dim(`Files Searched: ${response.metadata.filesSearched}`));
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
lines.push("");
|
|
105
|
+
}
|
|
106
|
+
return lines.join("\n");
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Get color function for confidence level
|
|
110
|
+
*/
|
|
111
|
+
function getConfidenceColor(level) {
|
|
112
|
+
switch (level) {
|
|
113
|
+
case "high":
|
|
114
|
+
return chalk.green;
|
|
115
|
+
case "medium":
|
|
116
|
+
return chalk.yellow;
|
|
117
|
+
case "low":
|
|
118
|
+
return chalk.red;
|
|
119
|
+
default:
|
|
120
|
+
return chalk.gray;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Format loading message
|
|
125
|
+
*/
|
|
126
|
+
export function formatLoadingMessage(navigatorName) {
|
|
127
|
+
return `${chalk.blue("🔍")} Loading navigator: ${chalk.bold(navigatorName)}`;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Format query message
|
|
131
|
+
*/
|
|
132
|
+
export function formatQueryMessage(question) {
|
|
133
|
+
return `${chalk.blue("❓")} Question: ${chalk.italic(question)}`;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Format success message
|
|
137
|
+
*/
|
|
138
|
+
export function formatSuccessMessage(sourcesCount) {
|
|
139
|
+
return `${chalk.green("✅")} Query completed successfully! (${sourcesCount} source${sourcesCount !== 1 ? "s" : ""} cited)`;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Format error message
|
|
143
|
+
*/
|
|
144
|
+
export function formatErrorMessage(error) {
|
|
145
|
+
const message = error instanceof Error ? error.message : error;
|
|
146
|
+
return `${chalk.red("❌")} Error: ${message}`;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Format warning message
|
|
150
|
+
*/
|
|
151
|
+
export function formatWarningMessage(message) {
|
|
152
|
+
return `${chalk.yellow("⚠")} Warning: ${message}`;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Create a suggestion message with helpful text
|
|
156
|
+
*/
|
|
157
|
+
export function formatSuggestion(title, suggestions) {
|
|
158
|
+
const lines = [];
|
|
159
|
+
lines.push(chalk.bold(title));
|
|
160
|
+
for (const suggestion of suggestions) {
|
|
161
|
+
lines.push(` ${chalk.dim("•")} ${suggestion}`);
|
|
162
|
+
}
|
|
163
|
+
return lines.join("\n");
|
|
164
|
+
}
|
|
165
|
+
//# sourceMappingURL=output-formatter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"output-formatter.js","sourceRoot":"","sources":["../../src/query-engine/output-formatter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AA4B1B;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAC5B,QAA2B,EAC3B,OAA4B;IAE5B,kCAAkC;IAClC,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;QACpB,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC;IAClB,CAAC;IAED,QAAQ,O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B;IACtD,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC;IAC/D,OAAO,GAAG,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,WAAW,OAAO,EAAE,CAAC;AAC/C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,OAAe;IAClD,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,aAAa,OAAO,EAAE,CAAC;AACpD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAC9B,KAAa,EACb,WAAqB;IAErB,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IAC9B,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE,CAAC;QACrC,KAAK,CAAC,IAAI,CAAC,KAAK,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,UAAU,EAAE,CAAC,CAAC;IAClD,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { NavigatorResponse, type ValidationResult, type ConfidenceLevel } from "@autonav/communication-layer";
|
|
2
|
+
/**
|
|
3
|
+
* Response validation options
|
|
4
|
+
*/
|
|
5
|
+
export interface ResponseValidationOptions {
|
|
6
|
+
/**
|
|
7
|
+
* Minimum acceptable confidence level
|
|
8
|
+
* If set, responses below this level will fail validation
|
|
9
|
+
*/
|
|
10
|
+
minimumConfidence?: ConfidenceLevel;
|
|
11
|
+
/**
|
|
12
|
+
* Whether to fail on missing sources (strict mode)
|
|
13
|
+
* Default: false (warnings only)
|
|
14
|
+
*/
|
|
15
|
+
strictSourceValidation?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Knowledge base path for source validation
|
|
18
|
+
*/
|
|
19
|
+
knowledgeBasePath: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Extended validation result with confidence checking
|
|
23
|
+
*/
|
|
24
|
+
export interface ExtendedValidationResult extends ValidationResult {
|
|
25
|
+
/**
|
|
26
|
+
* Whether confidence level meets minimum requirement
|
|
27
|
+
*/
|
|
28
|
+
confidenceMet: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Confidence level of the response
|
|
31
|
+
*/
|
|
32
|
+
confidenceLevel?: ConfidenceLevel;
|
|
33
|
+
/**
|
|
34
|
+
* Minimum required confidence level
|
|
35
|
+
*/
|
|
36
|
+
minimumConfidence?: ConfidenceLevel;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Validate a navigator response with additional checks
|
|
40
|
+
*
|
|
41
|
+
* @param response - Navigator response to validate
|
|
42
|
+
* @param options - Validation options
|
|
43
|
+
* @returns Extended validation result
|
|
44
|
+
*/
|
|
45
|
+
export declare function validateResponse(response: NavigatorResponse, options: ResponseValidationOptions): ExtendedValidationResult;
|
|
46
|
+
/**
|
|
47
|
+
* Format validation errors for display
|
|
48
|
+
*/
|
|
49
|
+
export declare function formatValidationErrors(validation: ExtendedValidationResult): string;
|
|
50
|
+
/**
|
|
51
|
+
* Format confidence information for display
|
|
52
|
+
*/
|
|
53
|
+
export declare function formatConfidenceInfo(validation: ExtendedValidationResult): string;
|
|
54
|
+
export type { ConfidenceLevel };
|
|
55
|
+
//# sourceMappingURL=response-validator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"response-validator.d.ts","sourceRoot":"","sources":["../../src/query-engine/response-validator.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EAGjB,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACrB,MAAM,8BAA8B,CAAC;AAEtC;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC;;;OAGG;IACH,iBAAiB,CAAC,EAAE,eAAe,CAAC;IAEpC;;;OAGG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAC;IAEjC;;OAEG;IACH,iBAAiB,EAAE,MAAM,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,wBAAyB,SAAQ,gBAAgB;IAChE;;OAEG;IACH,aAAa,EAAE,OAAO,CAAC;IAEvB;;OAEG;IACH,eAAe,CAAC,EAAE,eAAe,CAAC;IAElC;;OAEG;IACH,iBAAiB,CAAC,EAAE,eAAe,CAAC;CACrC;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,iBAAiB,EAC3B,OAAO,EAAE,yBAAyB,GACjC,wBAAwB,CAoD1B;AAuBD;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,wBAAwB,GACnC,MAAM,CAkBR;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,UAAU,EAAE,wBAAwB,GACnC,MAAM,CAeR;AAGD,YAAY,EAAE,eAAe,EAAE,CAAC"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { checkSourcesExist, detectHallucinations, } from "@autonav/communication-layer";
|
|
2
|
+
/**
|
|
3
|
+
* Validate a navigator response with additional checks
|
|
4
|
+
*
|
|
5
|
+
* @param response - Navigator response to validate
|
|
6
|
+
* @param options - Validation options
|
|
7
|
+
* @returns Extended validation result
|
|
8
|
+
*/
|
|
9
|
+
export function validateResponse(response, options) {
|
|
10
|
+
// Run base validation (source existence, hallucination detection)
|
|
11
|
+
const sourceCheck = checkSourcesExist(response, options.knowledgeBasePath);
|
|
12
|
+
const hallucinationCheck = detectHallucinations(response);
|
|
13
|
+
// Combine validation results
|
|
14
|
+
const baseValidation = {
|
|
15
|
+
valid: sourceCheck.valid && hallucinationCheck.valid,
|
|
16
|
+
errors: [...sourceCheck.errors, ...hallucinationCheck.errors],
|
|
17
|
+
warnings: [...sourceCheck.warnings, ...hallucinationCheck.warnings],
|
|
18
|
+
};
|
|
19
|
+
// Check confidence level (now using enum)
|
|
20
|
+
const confidenceLevel = response.confidence;
|
|
21
|
+
const confidenceMet = checkConfidenceMeetsMinimum(confidenceLevel, options.minimumConfidence);
|
|
22
|
+
// Combine results
|
|
23
|
+
const extendedResult = {
|
|
24
|
+
...baseValidation,
|
|
25
|
+
confidenceMet,
|
|
26
|
+
confidenceLevel,
|
|
27
|
+
minimumConfidence: options.minimumConfidence,
|
|
28
|
+
};
|
|
29
|
+
// Add confidence errors if threshold not met
|
|
30
|
+
if (!confidenceMet && options.minimumConfidence) {
|
|
31
|
+
extendedResult.valid = false;
|
|
32
|
+
extendedResult.errors.push(new Error(`Response confidence (${confidenceLevel}) is below required minimum (${options.minimumConfidence})`));
|
|
33
|
+
}
|
|
34
|
+
// Convert source validation warnings to errors if strict mode
|
|
35
|
+
if (options.strictSourceValidation && baseValidation.warnings.length > 0) {
|
|
36
|
+
const sourceWarnings = baseValidation.warnings.filter((w) => w.includes("Source file does not exist") || w.includes("not a file"));
|
|
37
|
+
if (sourceWarnings.length > 0) {
|
|
38
|
+
extendedResult.valid = false;
|
|
39
|
+
extendedResult.errors.push(...sourceWarnings.map((w) => new Error(`[STRICT MODE] ${w}`)));
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return extendedResult;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Check if confidence level meets minimum requirement
|
|
46
|
+
*/
|
|
47
|
+
function checkConfidenceMeetsMinimum(actual, minimum) {
|
|
48
|
+
// If no minimum required, always pass
|
|
49
|
+
if (!minimum) {
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
52
|
+
const levels = {
|
|
53
|
+
low: 1,
|
|
54
|
+
medium: 2,
|
|
55
|
+
high: 3,
|
|
56
|
+
};
|
|
57
|
+
return levels[actual] >= levels[minimum];
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Format validation errors for display
|
|
61
|
+
*/
|
|
62
|
+
export function formatValidationErrors(validation) {
|
|
63
|
+
const lines = [];
|
|
64
|
+
if (validation.errors.length > 0) {
|
|
65
|
+
lines.push("Validation errors:");
|
|
66
|
+
for (const error of validation.errors) {
|
|
67
|
+
lines.push(` ❌ ${error.message}`);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
if (validation.warnings.length > 0) {
|
|
71
|
+
lines.push("\nValidation warnings:");
|
|
72
|
+
for (const warning of validation.warnings) {
|
|
73
|
+
lines.push(` ⚠ ${warning}`);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return lines.join("\n");
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Format confidence information for display
|
|
80
|
+
*/
|
|
81
|
+
export function formatConfidenceInfo(validation) {
|
|
82
|
+
const lines = [];
|
|
83
|
+
if (validation.confidenceLevel) {
|
|
84
|
+
lines.push(`Confidence: ${validation.confidenceLevel}`);
|
|
85
|
+
if (validation.minimumConfidence) {
|
|
86
|
+
lines.push(`Required: ${validation.minimumConfidence}`);
|
|
87
|
+
lines.push(`Met: ${validation.confidenceMet ? "✓ Yes" : "✗ No"}`);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return lines.join("\n");
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=response-validator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"response-validator.js","sourceRoot":"","sources":["../../src/query-engine/response-validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,EACjB,oBAAoB,GAGrB,MAAM,8BAA8B,CAAC;AA4CtC;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAC9B,QAA2B,EAC3B,OAAkC;IAElC,kEAAkE;IAClE,MAAM,WAAW,GAAG,iBAAiB,CAAC,QAAQ,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAC3E,MAAM,kBAAkB,GAAG,oBAAoB,CAAC,QAAQ,CAAC,CAAC;IAE1D,6BAA6B;IAC7B,MAAM,cAAc,GAAqB;QACvC,KAAK,EAAE,WAAW,C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;IAEpC,MAAM,KAAK,GAAa,EAAE,CAAC;IAE3B,IAAI,UAAU,CAAC,eAAe,EAAE,CAAC;QAC/B,KAAK,CAAC,IAAI,CAAC,eAAe,UAAU,CAAC,eAAe,EAAE,CAAC,CAAC;QAExD,IAAI,UAAU,CAAC,iBAAiB,EAAE,CAAC;YACjC,KAAK,CAAC,IAAI,CAAC,aAAa,UAAU,CAAC,iBAAiB,EAAE,CAAC,CAAC;YACxD,KAAK,CAAC,IAAI,CACR,QAAQ,UAAU,CAAC,aAAa,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,EAAE,CACtD,CAAC;QACJ,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Node modules
|
|
2
|
+
node_modules/
|
|
3
|
+
|
|
4
|
+
# Environment variables
|
|
5
|
+
.env
|
|
6
|
+
.env.local
|
|
7
|
+
|
|
8
|
+
# Plugin credentials (NEVER commit these!)
|
|
9
|
+
.claude/plugins.json
|
|
10
|
+
|
|
11
|
+
# OS files
|
|
12
|
+
.DS_Store
|
|
13
|
+
Thumbs.db
|
|
14
|
+
|
|
15
|
+
# IDE
|
|
16
|
+
.vscode/
|
|
17
|
+
.idea/
|
|
18
|
+
*.swp
|
|
19
|
+
*.swo
|
|
20
|
+
|
|
21
|
+
# Logs
|
|
22
|
+
*.log
|
|
23
|
+
npm-debug.log*
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Navigator: {{NAVIGATOR_NAME}}
|
|
2
|
+
|
|
3
|
+
You are a specialized navigator using the {{PACK_NAME}} knowledge pack.
|
|
4
|
+
|
|
5
|
+
## System Configuration
|
|
6
|
+
|
|
7
|
+
Your domain-specific configuration is in `system-configuration.md`. Read and follow those guidelines carefully.
|
|
8
|
+
|
|
9
|
+
## Your Knowledge Base
|
|
10
|
+
|
|
11
|
+
Your knowledge is located in the `knowledge/` directory. This has been populated from the {{PACK_NAME}} knowledge pack.
|
|
12
|
+
|
|
13
|
+
When answering questions:
|
|
14
|
+
- Always cite specific files and sections
|
|
15
|
+
- Use exact headings and references from the knowledge base
|
|
16
|
+
- If you don't know something, say so explicitly
|
|
17
|
+
- Never make up information not in your knowledge base
|
|
18
|
+
- Follow the guidelines and response format specified in `system-configuration.md`
|
|
19
|
+
|
|
20
|
+
## Source Citation
|
|
21
|
+
|
|
22
|
+
Always structure responses with proper source citations as specified in `system-configuration.md`.
|
|
23
|
+
|
|
24
|
+
Include:
|
|
25
|
+
- Direct answer
|
|
26
|
+
- File path references: [filename.md: Section Heading]
|
|
27
|
+
- Relevant excerpts from sources
|
|
28
|
+
- Confidence level
|
|
29
|
+
|
|
30
|
+
## Response Format
|
|
31
|
+
|
|
32
|
+
Follow the response format guidelines in `system-configuration.md`. Always use structured JSON responses following the NavigatorResponse schema.
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# Navigator: {{NAVIGATOR_NAME}}
|
|
2
|
+
|
|
3
|
+
You are a specialized navigator created with Autonav.
|
|
4
|
+
|
|
5
|
+
## System Configuration
|
|
6
|
+
|
|
7
|
+
If a `system-configuration.md` file exists, read it first. It contains domain-specific instructions, scope definitions, and response guidelines that override defaults.
|
|
8
|
+
|
|
9
|
+
## Your Knowledge Base
|
|
10
|
+
|
|
11
|
+
Your knowledge is located in the `knowledge/` directory. When answering questions:
|
|
12
|
+
- Always cite specific files and sections
|
|
13
|
+
- Use exact headings and references
|
|
14
|
+
- If you don't know something, say so explicitly
|
|
15
|
+
- Never make up information not in your knowledge base
|
|
16
|
+
|
|
17
|
+
## Grounding Rules
|
|
18
|
+
|
|
19
|
+
You MUST follow these rules when answering questions:
|
|
20
|
+
|
|
21
|
+
1. **Always cite sources**: Every answer must reference specific files from the knowledge base
|
|
22
|
+
2. **Quote directly**: Use exact excerpts from files, don't paraphrase
|
|
23
|
+
3. **Never invent**: If information isn't in the knowledge base, say so clearly
|
|
24
|
+
4. **File paths must exist**: Only cite files that actually exist in the knowledge/ directory
|
|
25
|
+
5. **Be specific**: Include section headings or line numbers when citing sources
|
|
26
|
+
6. **Acknowledge uncertainty**: If you're not confident, state that explicitly
|
|
27
|
+
|
|
28
|
+
**Never do this**:
|
|
29
|
+
- Don't make up commands, file paths, or configurations
|
|
30
|
+
- Don't invent AWS resource names or ARNs
|
|
31
|
+
- Don't hallucinate service endpoints or URLs
|
|
32
|
+
- Don't guess if the information isn't in the docs
|
|
33
|
+
|
|
34
|
+
**Always do this**:
|
|
35
|
+
- Search the knowledge base thoroughly before answering
|
|
36
|
+
- Cite specific files and sections
|
|
37
|
+
- If unsure, say "I don't have information about that in the knowledge base"
|
|
38
|
+
- Provide confidence scores honestly
|
|
39
|
+
|
|
40
|
+
## How to Answer Questions
|
|
41
|
+
|
|
42
|
+
1. **Search first**: Use grep/find to search the knowledge base for relevant information
|
|
43
|
+
2. **Read carefully**: Use the Read tool to examine relevant files
|
|
44
|
+
3. **Cite sources**: Always reference specific files and sections
|
|
45
|
+
4. **Be honest**: If you don't know, say so clearly
|
|
46
|
+
|
|
47
|
+
## Domain Scope
|
|
48
|
+
|
|
49
|
+
[Define what this navigator knows about and what it doesn't]
|
|
50
|
+
|
|
51
|
+
## Response Format
|
|
52
|
+
|
|
53
|
+
Always structure your responses as JSON following the NavigatorResponse schema:
|
|
54
|
+
|
|
55
|
+
```json
|
|
56
|
+
{
|
|
57
|
+
"protocolVersion": "1.0.0",
|
|
58
|
+
"query": "the question asked",
|
|
59
|
+
"answer": "your detailed answer with inline citations",
|
|
60
|
+
"sources": [
|
|
61
|
+
{
|
|
62
|
+
"filePath": "relative/path/from/knowledge-base/file.md",
|
|
63
|
+
"excerpt": "exact quote from the file",
|
|
64
|
+
"section": "section heading"
|
|
65
|
+
}
|
|
66
|
+
],
|
|
67
|
+
"confidence": 0.95
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Knowledge Base Location
|
|
72
|
+
|
|
73
|
+
All documentation is in the `knowledge/` directory. Only cite files that exist in this directory.
|
|
74
|
+
|
|
75
|
+
## Example: Good Response
|
|
76
|
+
|
|
77
|
+
**Question**: "How do I configure SSL?"
|
|
78
|
+
|
|
79
|
+
```json
|
|
80
|
+
{
|
|
81
|
+
"protocolVersion": "1.0.0",
|
|
82
|
+
"query": "How do I configure SSL?",
|
|
83
|
+
"answer": "To configure SSL, you need to update the load balancer settings. According to deployment/ssl-config.md, you should set the certificate ARN in the Terraform configuration.",
|
|
84
|
+
"sources": [
|
|
85
|
+
{
|
|
86
|
+
"filePath": "deployment/ssl-config.md",
|
|
87
|
+
"excerpt": "Set the certificate_arn parameter in the aws_lb_listener resource",
|
|
88
|
+
"section": "SSL Configuration"
|
|
89
|
+
}
|
|
90
|
+
],
|
|
91
|
+
"confidence": 0.95
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Example: Bad Response (Don't do this)
|
|
96
|
+
|
|
97
|
+
**Question**: "How do I configure SSL?"
|
|
98
|
+
|
|
99
|
+
```json
|
|
100
|
+
{
|
|
101
|
+
"query": "How do I configure SSL?",
|
|
102
|
+
"answer": "You can configure SSL by updating the config.yaml file and setting ssl_enabled to true.",
|
|
103
|
+
"sources": [],
|
|
104
|
+
"confidence": 0.8
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
**Problems**:
|
|
109
|
+
- No sources cited
|
|
110
|
+
- File path (config.yaml) may not exist
|
|
111
|
+
- Vague answer without specifics
|
|
112
|
+
- Claims knowledge without evidence
|
|
113
|
+
|
|
114
|
+
## Confidence Scoring Guide
|
|
115
|
+
|
|
116
|
+
- **1.0**: Fully grounded, multiple authoritative sources, no ambiguity
|
|
117
|
+
- **0.8-0.9**: Well grounded, clear sources, minor gaps
|
|
118
|
+
- **0.6-0.7**: Partially grounded, some inference required
|
|
119
|
+
- **0.4-0.5**: Weakly grounded, significant uncertainty
|
|
120
|
+
- **0.0-0.3**: Not grounded, likely needs human review
|
|
121
|
+
|
|
122
|
+
If your confidence is below 0.5, acknowledge the uncertainty in your answer and suggest that a human review may be needed.
|
|
123
|
+
|
|
124
|
+
## Remember
|
|
125
|
+
|
|
126
|
+
Your value comes from accurately surfacing knowledge that already exists. Never invent information.
|
|
127
|
+
|
|
128
|
+
You are here to multiply human potential by making existing knowledge easily accessible, not to replace human expertise.
|