@aaronsb/kg-cli 0.6.6 → 0.7.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/dist/api/client.d.ts +127 -1
- package/dist/api/client.d.ts.map +1 -1
- package/dist/api/client.js +147 -0
- package/dist/api/client.js.map +1 -1
- package/dist/cli/batch.d.ts +8 -0
- package/dist/cli/batch.d.ts.map +1 -0
- package/dist/cli/batch.js +225 -0
- package/dist/cli/batch.js.map +1 -0
- package/dist/cli/commands.d.ts.map +1 -1
- package/dist/cli/commands.js +8 -0
- package/dist/cli/commands.js.map +1 -1
- package/dist/cli/concept.d.ts +9 -0
- package/dist/cli/concept.d.ts.map +1 -0
- package/dist/cli/concept.js +336 -0
- package/dist/cli/concept.js.map +1 -0
- package/dist/cli/edge.d.ts +9 -0
- package/dist/cli/edge.d.ts.map +1 -0
- package/dist/cli/edge.js +364 -0
- package/dist/cli/edge.js.map +1 -0
- package/dist/cli/jobs.js +111 -3
- package/dist/cli/jobs.js.map +1 -1
- package/dist/cli/storage.d.ts +10 -0
- package/dist/cli/storage.d.ts.map +1 -0
- package/dist/cli/storage.js +260 -0
- package/dist/cli/storage.js.map +1 -0
- package/dist/cli/vocabulary/index.d.ts.map +1 -1
- package/dist/cli/vocabulary/index.js +1 -0
- package/dist/cli/vocabulary/index.js.map +1 -1
- package/dist/cli/vocabulary/similarity.d.ts +1 -0
- package/dist/cli/vocabulary/similarity.d.ts.map +1 -1
- package/dist/cli/vocabulary/similarity.js +60 -9
- package/dist/cli/vocabulary/similarity.js.map +1 -1
- package/dist/lib/interactive.d.ts +84 -0
- package/dist/lib/interactive.d.ts.map +1 -0
- package/dist/lib/interactive.js +296 -0
- package/dist/lib/interactive.js.map +1 -0
- package/dist/lib/validation.d.ts +106 -0
- package/dist/lib/validation.d.ts.map +1 -0
- package/dist/lib/validation.js +354 -0
- package/dist/lib/validation.js.map +1 -0
- package/dist/mcp/formatters/concept.d.ts +24 -0
- package/dist/mcp/formatters/concept.d.ts.map +1 -0
- package/dist/mcp/formatters/concept.js +243 -0
- package/dist/mcp/formatters/concept.js.map +1 -0
- package/dist/mcp/formatters/document.d.ts +25 -0
- package/dist/mcp/formatters/document.d.ts.map +1 -0
- package/dist/mcp/formatters/document.js +178 -0
- package/dist/mcp/formatters/document.js.map +1 -0
- package/dist/mcp/formatters/epistemic.d.ts +16 -0
- package/dist/mcp/formatters/epistemic.d.ts.map +1 -0
- package/dist/mcp/formatters/epistemic.js +269 -0
- package/dist/mcp/formatters/epistemic.js.map +1 -0
- package/dist/mcp/formatters/graph.d.ts +63 -0
- package/dist/mcp/formatters/graph.d.ts.map +1 -0
- package/dist/mcp/formatters/graph.js +220 -0
- package/dist/mcp/formatters/graph.js.map +1 -0
- package/dist/mcp/formatters/index.d.ts +18 -0
- package/dist/mcp/formatters/index.d.ts.map +1 -0
- package/dist/mcp/formatters/index.js +63 -0
- package/dist/mcp/formatters/index.js.map +1 -0
- package/dist/mcp/formatters/ingest.d.ts +16 -0
- package/dist/mcp/formatters/ingest.d.ts.map +1 -0
- package/dist/mcp/formatters/ingest.js +169 -0
- package/dist/mcp/formatters/ingest.js.map +1 -0
- package/dist/mcp/formatters/job.d.ts +13 -0
- package/dist/mcp/formatters/job.d.ts.map +1 -0
- package/dist/mcp/formatters/job.js +204 -0
- package/dist/mcp/formatters/job.js.map +1 -0
- package/dist/mcp/formatters/source.d.ts +19 -0
- package/dist/mcp/formatters/source.d.ts.map +1 -0
- package/dist/mcp/formatters/source.js +182 -0
- package/dist/mcp/formatters/source.js.map +1 -0
- package/dist/mcp/formatters/system.d.ts +10 -0
- package/dist/mcp/formatters/system.d.ts.map +1 -0
- package/dist/mcp/formatters/system.js +152 -0
- package/dist/mcp/formatters/system.js.map +1 -0
- package/dist/mcp/formatters/utils.d.ts +17 -0
- package/dist/mcp/formatters/utils.d.ts.map +1 -0
- package/dist/mcp/formatters/utils.js +55 -0
- package/dist/mcp/formatters/utils.js.map +1 -0
- package/dist/mcp/graph-operations.d.ts +242 -0
- package/dist/mcp/graph-operations.d.ts.map +1 -0
- package/dist/mcp/graph-operations.js +532 -0
- package/dist/mcp/graph-operations.js.map +1 -0
- package/dist/mcp-server.js +460 -32
- package/dist/mcp-server.js.map +1 -1
- package/dist/types/index.d.ts +153 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/version.d.ts +3 -3
- package/dist/version.js +3 -3
- package/dist/version.js.map +1 -1
- package/package.json +1 -1
- package/dist/mcp/formatters.d.ts +0 -100
- package/dist/mcp/formatters.d.ts.map +0 -1
- package/dist/mcp/formatters.js +0 -1411
- package/dist/mcp/formatters.js.map +0 -1
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Job formatters
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.formatJobList = formatJobList;
|
|
7
|
+
exports.formatJobStatus = formatJobStatus;
|
|
8
|
+
/**
|
|
9
|
+
* Format job list as markdown (token-efficient summary view)
|
|
10
|
+
*/
|
|
11
|
+
function formatJobList(jobs) {
|
|
12
|
+
let output = `# Ingestion Jobs\n\n`;
|
|
13
|
+
output += `Total: ${jobs.length} job(s)\n\n`;
|
|
14
|
+
if (jobs.length === 0) {
|
|
15
|
+
output += 'No jobs found.\n';
|
|
16
|
+
return output;
|
|
17
|
+
}
|
|
18
|
+
// Group by status for quick overview
|
|
19
|
+
const byStatus = {};
|
|
20
|
+
jobs.forEach(job => {
|
|
21
|
+
const status = job.status;
|
|
22
|
+
if (!byStatus[status])
|
|
23
|
+
byStatus[status] = [];
|
|
24
|
+
byStatus[status].push(job);
|
|
25
|
+
});
|
|
26
|
+
// Status summary
|
|
27
|
+
output += '## Status Summary\n\n';
|
|
28
|
+
const statusOrder = ['processing', 'awaiting_approval', 'pending', 'approved', 'queued', 'completed', 'failed', 'cancelled'];
|
|
29
|
+
statusOrder.forEach(status => {
|
|
30
|
+
if (byStatus[status] && byStatus[status].length > 0) {
|
|
31
|
+
const icon = status === 'completed' ? '✓' :
|
|
32
|
+
status === 'processing' ? '▶' :
|
|
33
|
+
status === 'awaiting_approval' ? '⏳' :
|
|
34
|
+
status === 'failed' ? '✗' :
|
|
35
|
+
status === 'cancelled' ? '⊘' : '○';
|
|
36
|
+
output += `- ${icon} **${status}**: ${byStatus[status].length}\n`;
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
output += '\n';
|
|
40
|
+
// Detailed list
|
|
41
|
+
output += '## Jobs\n\n';
|
|
42
|
+
jobs.forEach((job, idx) => {
|
|
43
|
+
const statusIcon = job.status === 'completed' ? '✓' :
|
|
44
|
+
job.status === 'processing' ? '▶' :
|
|
45
|
+
job.status === 'awaiting_approval' ? '⏳' :
|
|
46
|
+
job.status === 'failed' ? '✗' :
|
|
47
|
+
job.status === 'cancelled' ? '⊘' : '○';
|
|
48
|
+
// Header with status and filename
|
|
49
|
+
const filename = job.filename || job.analysis?.file_stats?.filename || 'Unknown';
|
|
50
|
+
output += `### ${idx + 1}. ${statusIcon} ${filename}\n\n`;
|
|
51
|
+
// Core info
|
|
52
|
+
output += `- **Job ID:** ${job.job_id}\n`;
|
|
53
|
+
output += `- **Status:** ${job.status}`;
|
|
54
|
+
if (job.progress?.stage) {
|
|
55
|
+
output += ` (${job.progress.stage})`;
|
|
56
|
+
}
|
|
57
|
+
output += '\n';
|
|
58
|
+
if (job.ontology) {
|
|
59
|
+
output += `- **Ontology:** ${job.ontology}\n`;
|
|
60
|
+
}
|
|
61
|
+
// Progress for processing jobs
|
|
62
|
+
if (job.status === 'processing' && job.progress) {
|
|
63
|
+
const p = job.progress;
|
|
64
|
+
if (p.percent !== undefined) {
|
|
65
|
+
output += `- **Progress:** ${p.percent}%`;
|
|
66
|
+
if (p.chunks_total !== undefined) {
|
|
67
|
+
output += ` (${p.chunks_processed || 0}/${p.chunks_total} chunks)`;
|
|
68
|
+
}
|
|
69
|
+
output += '\n';
|
|
70
|
+
}
|
|
71
|
+
if (p.concepts_created !== undefined) {
|
|
72
|
+
output += `- **Created:** ${p.concepts_created} concepts, ${p.sources_created || 0} sources\n`;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
// Cost for awaiting_approval
|
|
76
|
+
if (job.status === 'awaiting_approval' && job.analysis?.cost_estimate?.total) {
|
|
77
|
+
const cost = job.analysis.cost_estimate.total;
|
|
78
|
+
output += `- **Est. Cost:** $${cost.cost_low.toFixed(3)} - $${cost.cost_high.toFixed(3)}\n`;
|
|
79
|
+
}
|
|
80
|
+
// Results for completed jobs
|
|
81
|
+
if (job.status === 'completed' && job.result?.stats) {
|
|
82
|
+
const s = job.result.stats;
|
|
83
|
+
output += `- **Result:** ${s.concepts_created || 0} concepts, ${s.relationships_created || 0} relationships\n`;
|
|
84
|
+
if (job.result.cost?.total) {
|
|
85
|
+
output += `- **Cost:** ${job.result.cost.total}\n`;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
// Error for failed jobs
|
|
89
|
+
if (job.status === 'failed' && job.error) {
|
|
90
|
+
const truncatedError = job.error.length > 100 ? job.error.substring(0, 100) + '...' : job.error;
|
|
91
|
+
output += `- **Error:** ${truncatedError}\n`;
|
|
92
|
+
}
|
|
93
|
+
output += '\n';
|
|
94
|
+
});
|
|
95
|
+
// Usage hints
|
|
96
|
+
output += '## Actions\n\n';
|
|
97
|
+
output += '- Use `job` tool with action "status" and job_id for full details\n';
|
|
98
|
+
output += '- Use `job` tool with action "approve" to start awaiting jobs\n';
|
|
99
|
+
output += '- Use `job` tool with action "cancel" to cancel pending jobs\n';
|
|
100
|
+
return output;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Format job status as markdown (token-efficient)
|
|
104
|
+
*/
|
|
105
|
+
function formatJobStatus(job) {
|
|
106
|
+
let output = `# Job: ${job.job_id}\n\n`;
|
|
107
|
+
output += `Type: ${job.job_type}\n`;
|
|
108
|
+
output += `Status: ${job.status}`;
|
|
109
|
+
// Add stage info if available
|
|
110
|
+
if (job.progress?.stage) {
|
|
111
|
+
output += ` (${job.progress.stage})`;
|
|
112
|
+
}
|
|
113
|
+
output += '\n';
|
|
114
|
+
// Ontology and processing mode
|
|
115
|
+
if (job.ontology) {
|
|
116
|
+
output += `Ontology: ${job.ontology}\n`;
|
|
117
|
+
}
|
|
118
|
+
if (job.processing_mode) {
|
|
119
|
+
output += `Processing Mode: ${job.processing_mode}\n`;
|
|
120
|
+
}
|
|
121
|
+
// Progress information
|
|
122
|
+
if (job.progress) {
|
|
123
|
+
const p = job.progress;
|
|
124
|
+
output += '\n## Progress\n\n';
|
|
125
|
+
if (p.percent !== undefined) {
|
|
126
|
+
output += `Completion: ${p.percent}%\n`;
|
|
127
|
+
}
|
|
128
|
+
if (p.chunks_total !== undefined) {
|
|
129
|
+
const processed = p.chunks_processed || 0;
|
|
130
|
+
output += `Chunks: ${processed}/${p.chunks_total}\n`;
|
|
131
|
+
}
|
|
132
|
+
if (p.concepts_created !== undefined || p.concepts_linked !== undefined) {
|
|
133
|
+
if (p.concepts_created !== undefined) {
|
|
134
|
+
output += `Concepts Created: ${p.concepts_created}\n`;
|
|
135
|
+
}
|
|
136
|
+
if (p.concepts_linked !== undefined) {
|
|
137
|
+
output += `Concepts Linked: ${p.concepts_linked}\n`;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
if (p.sources_created !== undefined) {
|
|
141
|
+
output += `Sources Created: ${p.sources_created}\n`;
|
|
142
|
+
}
|
|
143
|
+
if (p.instances_created !== undefined) {
|
|
144
|
+
output += `Instances Created: ${p.instances_created}\n`;
|
|
145
|
+
}
|
|
146
|
+
if (p.relationships_created !== undefined) {
|
|
147
|
+
output += `Relationships Created: ${p.relationships_created}\n`;
|
|
148
|
+
}
|
|
149
|
+
if (p.message) {
|
|
150
|
+
output += `Message: ${p.message}\n`;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
// Cost estimate (for awaiting_approval status)
|
|
154
|
+
if (job.status === 'awaiting_approval' && job.analysis?.cost_estimate) {
|
|
155
|
+
const cost = job.analysis.cost_estimate;
|
|
156
|
+
output += '\n## Cost Estimate\n\n';
|
|
157
|
+
if (cost.total) {
|
|
158
|
+
output += `Total: $${cost.total.cost_low.toFixed(4)} - $${cost.total.cost_high.toFixed(4)} ${cost.total.currency}\n`;
|
|
159
|
+
}
|
|
160
|
+
if (cost.extraction) {
|
|
161
|
+
output += `Extraction: $${cost.extraction.cost_low.toFixed(4)} - $${cost.extraction.cost_high.toFixed(4)}\n`;
|
|
162
|
+
}
|
|
163
|
+
if (cost.embeddings) {
|
|
164
|
+
output += `Embeddings: $${cost.embeddings.cost_low.toFixed(4)} - $${cost.embeddings.cost_high.toFixed(4)}\n`;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
// Result (for completed jobs)
|
|
168
|
+
if (job.result) {
|
|
169
|
+
output += '\n## Result\n\n';
|
|
170
|
+
if (job.result.stats) {
|
|
171
|
+
output += `Concepts Created: ${job.result.stats.concepts_created || 0}\n`;
|
|
172
|
+
output += `Concepts Linked: ${job.result.stats.concepts_linked || 0}\n`;
|
|
173
|
+
output += `Sources Created: ${job.result.stats.sources_created || 0}\n`;
|
|
174
|
+
output += `Instances Created: ${job.result.stats.instances_created || 0}\n`;
|
|
175
|
+
output += `Relationships Created: ${job.result.stats.relationships_created || 0}\n`;
|
|
176
|
+
output += `Chunks Processed: ${job.result.stats.chunks_processed || 0}\n`;
|
|
177
|
+
}
|
|
178
|
+
if (job.result.cost) {
|
|
179
|
+
output += `Cost: ${job.result.cost.total}\n`;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
// Error (for failed jobs)
|
|
183
|
+
if (job.error) {
|
|
184
|
+
output += '\n## Error\n\n';
|
|
185
|
+
output += `${job.error}\n`;
|
|
186
|
+
}
|
|
187
|
+
// Timestamps
|
|
188
|
+
output += '\n## Timeline\n\n';
|
|
189
|
+
output += `Created: ${job.created_at}\n`;
|
|
190
|
+
if (job.started_at) {
|
|
191
|
+
output += `Started: ${job.started_at}\n`;
|
|
192
|
+
}
|
|
193
|
+
if (job.completed_at) {
|
|
194
|
+
output += `Completed: ${job.completed_at}\n`;
|
|
195
|
+
}
|
|
196
|
+
if (job.approved_at) {
|
|
197
|
+
output += `Approved: ${job.approved_at} (by ${job.approved_by || 'unknown'})\n`;
|
|
198
|
+
}
|
|
199
|
+
if (job.expires_at) {
|
|
200
|
+
output += `Expires: ${job.expires_at}\n`;
|
|
201
|
+
}
|
|
202
|
+
return output;
|
|
203
|
+
}
|
|
204
|
+
//# sourceMappingURL=job.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"job.js","sourceRoot":"","sources":["../../../src/mcp/formatters/job.ts"],"names":[],"mappings":";AAAA;;GAEG;;AAOH,sCAwGC;AAKD,0CAiHC;AAjOD;;GAEG;AACH,SAAgB,aAAa,CAAC,IAAiB;IAC7C,IAAI,MAAM,GAAG,sBAAsB,CAAC;IACpC,MAAM,IAAI,UAAU,IAAI,CAAC,MAAM,aAAa,CAAC;IAE7C,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACtB,MAAM,IAAI,kBAAkB,CAAC;QAC7B,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,qCAAqC;IACrC,MAAM,QAAQ,GAAmC,EAAE,CAAC;IACpD,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;QACjB,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC;QAC1B,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC;YAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC;QAC7C,QAAQ,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC7B,CAAC,CAAC,CAAC;IAEH,iBAAiB;IACjB,MAAM,IAAI,uBAAuB,CAAC;IAClC,MAAM,WAAW,GAAG,CAAC,YAAY,EAAE,mBAAmB,EAAE,SAAS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AAC,KAAK,CAAC,gBAAgB,IAAI,CAAC,IAAI,CAAC;QAC5E,CAAC;QACD,IAAI,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;YACpB,MAAM,IAAI,SAAS,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC;QAC/C,CAAC;IACH,CAAC;IAED,0BAA0B;IAC1B,IAAI,GAAG,CAAC,KAAK,EAAE,CAAC;QACd,MAAM,IAAI,gBAAgB,CAAC;QAC3B,MAAM,IAAI,GAAG,GAAG,CAAC,KAAK,IAAI,CAAC;IAC7B,CAAC;IAED,aAAa;IACb,MAAM,IAAI,mBAAmB,CAAC;IAC9B,MAAM,IAAI,YAAY,GAAG,CAAC,UAAU,IAAI,CAAC;IACzC,IAAI,GAAG,CAAC,UAAU,EAAE,CAAC;QACnB,MAAM,IAAI,YAAY,GAAG,CAAC,UAAU,IAAI,CAAC;IAC3C,CAAC;IACD,IAAI,GAAG,CAAC,YAAY,EAAE,CAAC;QACrB,MAAM,IAAI,cAAc,GAAG,CAAC,YAAY,IAAI,CAAC;IAC/C,CAAC;IACD,IAAI,GAAG,CAAC,WAAW,EAAE,CAAC;QACpB,MAAM,IAAI,aAAa,GAAG,CAAC,WAAW,QAAQ,GAAG,CAAC,WAAW,IAAI,SAAS,KAAK,CAAC;IAClF,CAAC;IACD,IAAI,GAAG,CAAC,UAAU,EAAE,CAAC;QACnB,MAAM,IAAI,YAAY,GAAG,CAAC,UAAU,IAAI,CAAC;IAC3C,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Source and polarity axis formatters
|
|
3
|
+
*/
|
|
4
|
+
import type { SourceSearchResponse } from '../../types/index.js';
|
|
5
|
+
/**
|
|
6
|
+
* Format source search results as markdown (ADR-068 Phase 5)
|
|
7
|
+
*
|
|
8
|
+
* Optimized for MCP/AI consumption - shows matched chunks with offsets
|
|
9
|
+
* and related concepts extracted from those sources.
|
|
10
|
+
*/
|
|
11
|
+
export declare function formatSourceSearchResults(result: SourceSearchResponse): string;
|
|
12
|
+
/**
|
|
13
|
+
* Format polarity axis analysis results as markdown (ADR-070)
|
|
14
|
+
*
|
|
15
|
+
* Optimized for MCP/AI consumption - shows axis definition, projections,
|
|
16
|
+
* statistics, and grounding correlation patterns.
|
|
17
|
+
*/
|
|
18
|
+
export declare function formatPolarityAxisResults(result: any): string;
|
|
19
|
+
//# sourceMappingURL=source.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source.d.ts","sourceRoot":"","sources":["../../../src/mcp/formatters/source.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAGjE;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,oBAAoB,GAAG,MAAM,CAuD9E;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,GAAG,GAAG,MAAM,CAgI7D"}
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Source and polarity axis formatters
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.formatSourceSearchResults = formatSourceSearchResults;
|
|
7
|
+
exports.formatPolarityAxisResults = formatPolarityAxisResults;
|
|
8
|
+
const utils_js_1 = require("./utils.js");
|
|
9
|
+
/**
|
|
10
|
+
* Format source search results as markdown (ADR-068 Phase 5)
|
|
11
|
+
*
|
|
12
|
+
* Optimized for MCP/AI consumption - shows matched chunks with offsets
|
|
13
|
+
* and related concepts extracted from those sources.
|
|
14
|
+
*/
|
|
15
|
+
function formatSourceSearchResults(result) {
|
|
16
|
+
let output = `# Source Search: "${result.query}"\n\n`;
|
|
17
|
+
output += `Found ${result.count} source passage(s) (threshold: ${(result.threshold_used || 0.7) * 100}%)\n\n`;
|
|
18
|
+
if (result.count === 0) {
|
|
19
|
+
output += 'No source passages found matching this query.\n\n';
|
|
20
|
+
output += '**Tips:**\n';
|
|
21
|
+
output += '- Source search uses text embeddings, not concept embeddings\n';
|
|
22
|
+
output += '- Try broader queries or lower similarity thresholds\n';
|
|
23
|
+
output += '- Use concept search to find concepts, then view their evidence\n';
|
|
24
|
+
return output;
|
|
25
|
+
}
|
|
26
|
+
result.results.forEach((source, i) => {
|
|
27
|
+
output += `## ${i + 1}. ${source.document} (para ${source.paragraph})\n\n`;
|
|
28
|
+
output += `- **Source ID:** ${source.source_id}\n`;
|
|
29
|
+
output += `- **Similarity:** ${(source.similarity * 100).toFixed(1)}%\n`;
|
|
30
|
+
if (source.is_stale) {
|
|
31
|
+
output += `- **Status:** ⚠ Stale embedding (source text changed since embedding)\n`;
|
|
32
|
+
}
|
|
33
|
+
output += `\n**Matched Chunk** [offset ${source.matched_chunk.start_offset}:${source.matched_chunk.end_offset}]:\n\n`;
|
|
34
|
+
output += `> ${source.matched_chunk.chunk_text}\n\n`;
|
|
35
|
+
if (source.full_text) {
|
|
36
|
+
const truncated = source.full_text.length > 300
|
|
37
|
+
? source.full_text.substring(0, 300) + '...'
|
|
38
|
+
: source.full_text;
|
|
39
|
+
output += `**Full Context:**\n\n${truncated}\n\n`;
|
|
40
|
+
}
|
|
41
|
+
if (source.concepts && source.concepts.length > 0) {
|
|
42
|
+
output += `**Concepts Extracted** (${source.concepts.length}):\n\n`;
|
|
43
|
+
source.concepts.slice(0, 5).forEach(concept => {
|
|
44
|
+
output += `- **${concept.label}** (${concept.concept_id})\n`;
|
|
45
|
+
if (concept.description) {
|
|
46
|
+
output += ` ${concept.description}\n`;
|
|
47
|
+
}
|
|
48
|
+
output += ` Evidence: "${concept.instance_quote}"\n`;
|
|
49
|
+
});
|
|
50
|
+
if (source.concepts.length > 5) {
|
|
51
|
+
output += `\n... and ${source.concepts.length - 5} more concepts\n`;
|
|
52
|
+
}
|
|
53
|
+
output += '\n';
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
output += '**Next Steps:**\n';
|
|
57
|
+
output += '- Use concept IDs with `concept` tool (action: "details") to explore further\n';
|
|
58
|
+
output += '- Use `concept` tool (action: "connect") to find relationships between concepts\n';
|
|
59
|
+
output += '- Adjust similarity threshold if results are too broad or too narrow\n';
|
|
60
|
+
return output;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Format polarity axis analysis results as markdown (ADR-070)
|
|
64
|
+
*
|
|
65
|
+
* Optimized for MCP/AI consumption - shows axis definition, projections,
|
|
66
|
+
* statistics, and grounding correlation patterns.
|
|
67
|
+
*/
|
|
68
|
+
function formatPolarityAxisResults(result) {
|
|
69
|
+
let output = `# Polarity Axis Analysis\n\n`;
|
|
70
|
+
// Axis definition
|
|
71
|
+
output += `## Polarity Axis: ${result.axis.positive_pole.label} ↔ ${result.axis.negative_pole.label}\n\n`;
|
|
72
|
+
output += `**Positive Pole:** ${result.axis.positive_pole.label}\n`;
|
|
73
|
+
output += ` Grounding: ${(0, utils_js_1.formatGroundingStrength)(result.axis.positive_pole.grounding)}\n`;
|
|
74
|
+
output += ` ID: ${result.axis.positive_pole.concept_id}\n\n`;
|
|
75
|
+
output += `**Negative Pole:** ${result.axis.negative_pole.label}\n`;
|
|
76
|
+
output += ` Grounding: ${(0, utils_js_1.formatGroundingStrength)(result.axis.negative_pole.grounding)}\n`;
|
|
77
|
+
output += ` ID: ${result.axis.negative_pole.concept_id}\n\n`;
|
|
78
|
+
output += `**Axis Magnitude:** ${result.axis.magnitude.toFixed(4)}\n`;
|
|
79
|
+
const qualityLabel = result.axis.axis_quality === 'strong'
|
|
80
|
+
? '✓ Strong (poles are semantically distinct)'
|
|
81
|
+
: '⚠ Weak (poles may be too similar)';
|
|
82
|
+
output += `**Axis Quality:** ${qualityLabel}\n\n`;
|
|
83
|
+
// Statistics
|
|
84
|
+
output += `## Statistics\n\n`;
|
|
85
|
+
output += `- **Total Concepts:** ${result.statistics.total_concepts}\n`;
|
|
86
|
+
output += `- **Position Range:** [${result.statistics.position_range[0].toFixed(3)}, ${result.statistics.position_range[1].toFixed(3)}]\n`;
|
|
87
|
+
output += `- **Mean Position:** ${result.statistics.mean_position.toFixed(3)} `;
|
|
88
|
+
if (result.statistics.mean_position > 0.2) {
|
|
89
|
+
output += '(skewed toward positive pole)\n';
|
|
90
|
+
}
|
|
91
|
+
else if (result.statistics.mean_position < -0.2) {
|
|
92
|
+
output += '(skewed toward negative pole)\n';
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
output += '(balanced)\n';
|
|
96
|
+
}
|
|
97
|
+
output += `- **Mean Axis Distance:** ${result.statistics.mean_axis_distance.toFixed(3)} (orthogonal spread)\n\n`;
|
|
98
|
+
// Direction distribution
|
|
99
|
+
output += `**Direction Distribution:**\n`;
|
|
100
|
+
output += `- Positive (>0.3): ${result.statistics.direction_distribution.positive} concepts\n`;
|
|
101
|
+
output += `- Neutral (-0.3 to 0.3): ${result.statistics.direction_distribution.neutral} concepts\n`;
|
|
102
|
+
output += `- Negative (<-0.3): ${result.statistics.direction_distribution.negative} concepts\n\n`;
|
|
103
|
+
// Grounding correlation
|
|
104
|
+
output += `## Grounding Correlation\n\n`;
|
|
105
|
+
output += `**Pearson r:** ${result.grounding_correlation.pearson_r.toFixed(3)}\n`;
|
|
106
|
+
output += `**p-value:** ${result.grounding_correlation.p_value.toFixed(4)}\n`;
|
|
107
|
+
output += `**Interpretation:** ${result.grounding_correlation.interpretation}\n\n`;
|
|
108
|
+
// Add practical interpretation
|
|
109
|
+
const r = result.grounding_correlation.pearson_r;
|
|
110
|
+
if (Math.abs(r) < 0.1) {
|
|
111
|
+
output += `→ No correlation: Position and grounding are independent\n\n`;
|
|
112
|
+
}
|
|
113
|
+
else if (r > 0.3) {
|
|
114
|
+
output += `→ Positive correlation: Concepts near positive pole tend to have higher grounding\n\n`;
|
|
115
|
+
}
|
|
116
|
+
else if (r < -0.3) {
|
|
117
|
+
output += `→ Negative correlation: Concepts near negative pole tend to have higher grounding\n\n`;
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
output += `→ Weak correlation: Position and grounding are loosely related\n\n`;
|
|
121
|
+
}
|
|
122
|
+
// Projections (top concepts for each direction)
|
|
123
|
+
if (result.projections && result.projections.length > 0) {
|
|
124
|
+
output += `## Concept Projections (${result.projections.length} total)\n\n`;
|
|
125
|
+
// Sort by position
|
|
126
|
+
const sorted = [...result.projections].sort((a, b) => b.position - a.position);
|
|
127
|
+
// Show top 5 positive
|
|
128
|
+
const positive = sorted.filter((p) => p.direction === 'positive').slice(0, 5);
|
|
129
|
+
if (positive.length > 0) {
|
|
130
|
+
output += `### Positive Direction (toward ${result.axis.positive_pole.label})\n\n`;
|
|
131
|
+
positive.forEach((proj, i) => {
|
|
132
|
+
output += `${i + 1}. **${proj.label}**\n`;
|
|
133
|
+
output += ` Position: ${proj.position.toFixed(3)} | `;
|
|
134
|
+
output += `Grounding: ${(0, utils_js_1.formatGroundingStrength)(proj.grounding)} | `;
|
|
135
|
+
output += `Axis distance: ${proj.axis_distance.toFixed(4)}\n`;
|
|
136
|
+
output += ` ID: ${proj.concept_id}\n`;
|
|
137
|
+
});
|
|
138
|
+
output += '\n';
|
|
139
|
+
}
|
|
140
|
+
// Show neutral concepts (if any)
|
|
141
|
+
const neutral = sorted.filter((p) => p.direction === 'neutral').slice(0, 3);
|
|
142
|
+
if (neutral.length > 0) {
|
|
143
|
+
output += `### Neutral (balanced between poles)\n\n`;
|
|
144
|
+
neutral.forEach((proj, i) => {
|
|
145
|
+
output += `${i + 1}. **${proj.label}**\n`;
|
|
146
|
+
output += ` Position: ${proj.position.toFixed(3)} | `;
|
|
147
|
+
output += `Grounding: ${(0, utils_js_1.formatGroundingStrength)(proj.grounding)} | `;
|
|
148
|
+
output += `Axis distance: ${proj.axis_distance.toFixed(4)}\n`;
|
|
149
|
+
output += ` ID: ${proj.concept_id}\n`;
|
|
150
|
+
});
|
|
151
|
+
output += '\n';
|
|
152
|
+
}
|
|
153
|
+
// Show top 5 negative
|
|
154
|
+
const negative = sorted.filter((p) => p.direction === 'negative').slice(-5).reverse();
|
|
155
|
+
if (negative.length > 0) {
|
|
156
|
+
output += `### Negative Direction (toward ${result.axis.negative_pole.label})\n\n`;
|
|
157
|
+
negative.forEach((proj, i) => {
|
|
158
|
+
output += `${i + 1}. **${proj.label}**\n`;
|
|
159
|
+
output += ` Position: ${proj.position.toFixed(3)} | `;
|
|
160
|
+
output += `Grounding: ${(0, utils_js_1.formatGroundingStrength)(proj.grounding)} | `;
|
|
161
|
+
output += `Axis distance: ${proj.axis_distance.toFixed(4)}\n`;
|
|
162
|
+
output += ` ID: ${proj.concept_id}\n`;
|
|
163
|
+
});
|
|
164
|
+
output += '\n';
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
output += `## How to Use This Analysis\n\n`;
|
|
168
|
+
output += `**Understanding Positions:**\n`;
|
|
169
|
+
output += `- Position closer to +1.0 → More aligned with "${result.axis.positive_pole.label}"\n`;
|
|
170
|
+
output += `- Position closer to -1.0 → More aligned with "${result.axis.negative_pole.label}"\n`;
|
|
171
|
+
output += `- Position near 0.0 → Balanced or orthogonal to this dimension\n\n`;
|
|
172
|
+
output += `**Axis Distance (orthogonality):**\n`;
|
|
173
|
+
output += `- Low distance → Concept lies close to the axis (well-explained by this dimension)\n`;
|
|
174
|
+
output += `- High distance → Concept is orthogonal (other dimensions more relevant)\n\n`;
|
|
175
|
+
output += `**Next Steps:**\n`;
|
|
176
|
+
output += `- Use concept IDs with \`concept\` tool (action: "details") to explore individual concepts\n`;
|
|
177
|
+
output += `- Use \`concept\` tool (action: "connect") to find paths between concepts on the axis\n`;
|
|
178
|
+
output += `- Try different pole pairs to explore other semantic dimensions\n`;
|
|
179
|
+
output += `- Compare grounding patterns across positions to identify reliability trends\n`;
|
|
180
|
+
return output;
|
|
181
|
+
}
|
|
182
|
+
//# sourceMappingURL=source.js.map
|
|
@@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AM,IAAI,mBAAmB,CAAC;IAC9B,MAAM,IAAI,8FAA8F,CAAC;IACzG,MAAM,IAAI,yFAAyF,CAAC;IACpG,MAAM,IAAI,mEAAmE,CAAC;IAC9E,MAAM,IAAI,gFAAgF,CAAC;IAE3F,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* System and database formatters
|
|
3
|
+
*/
|
|
4
|
+
export declare function formatDatabaseStats(result: any): string;
|
|
5
|
+
export declare function formatDatabaseInfo(result: any): string;
|
|
6
|
+
export declare function formatDatabaseHealth(result: any): string;
|
|
7
|
+
export declare function formatSystemStatus(result: any): string;
|
|
8
|
+
export declare function formatApiHealth(result: any): string;
|
|
9
|
+
export declare function formatMcpAllowedPaths(result: any): string;
|
|
10
|
+
//# sourceMappingURL=system.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"system.d.ts","sourceRoot":"","sources":["../../../src/mcp/formatters/system.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,GAAG,GAAG,MAAM,CAwBvD;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,GAAG,GAAG,MAAM,CAiBtD;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,GAAG,GAAG,MAAM,CAmBxD;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,GAAG,GAAG,MAAM,CA6BtD;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,GAAG,GAAG,MAAM,CAkBnD;AAED,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,GAAG,GAAG,MAAM,CAkDzD"}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* System and database formatters
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.formatDatabaseStats = formatDatabaseStats;
|
|
7
|
+
exports.formatDatabaseInfo = formatDatabaseInfo;
|
|
8
|
+
exports.formatDatabaseHealth = formatDatabaseHealth;
|
|
9
|
+
exports.formatSystemStatus = formatSystemStatus;
|
|
10
|
+
exports.formatApiHealth = formatApiHealth;
|
|
11
|
+
exports.formatMcpAllowedPaths = formatMcpAllowedPaths;
|
|
12
|
+
function formatDatabaseStats(result) {
|
|
13
|
+
let output = `# Database Statistics\n\n`;
|
|
14
|
+
if (result.graph_name) {
|
|
15
|
+
output += `Graph: ${result.graph_name}\n\n`;
|
|
16
|
+
}
|
|
17
|
+
output += `## Nodes\n\n`;
|
|
18
|
+
output += `Concepts: ${result.concept_count?.toLocaleString() || 0}\n`;
|
|
19
|
+
output += `Sources: ${result.source_count?.toLocaleString() || 0}\n`;
|
|
20
|
+
output += `Instances: ${result.instance_count?.toLocaleString() || 0}\n`;
|
|
21
|
+
output += `Total: ${result.total_node_count?.toLocaleString() || 0}\n\n`;
|
|
22
|
+
output += `## Relationships\n\n`;
|
|
23
|
+
output += `Total: ${result.total_edge_count?.toLocaleString() || 0}\n\n`;
|
|
24
|
+
if (result.ontologies && result.ontologies.length > 0) {
|
|
25
|
+
output += `## Ontologies (${result.ontologies.length})\n\n`;
|
|
26
|
+
result.ontologies.forEach((ont, idx) => {
|
|
27
|
+
output += `${idx + 1}. ${ont.ontology_name} (${ont.concept_count} concepts)\n`;
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
return output;
|
|
31
|
+
}
|
|
32
|
+
function formatDatabaseInfo(result) {
|
|
33
|
+
let output = `# Database Information\n\n`;
|
|
34
|
+
if (result.database) {
|
|
35
|
+
output += `Database: ${result.database}\n`;
|
|
36
|
+
}
|
|
37
|
+
if (result.version) {
|
|
38
|
+
output += `PostgreSQL: ${result.version}\n`;
|
|
39
|
+
}
|
|
40
|
+
if (result.age_version) {
|
|
41
|
+
output += `Apache AGE: ${result.age_version}\n`;
|
|
42
|
+
}
|
|
43
|
+
if (result.graph_name) {
|
|
44
|
+
output += `Graph: ${result.graph_name}\n`;
|
|
45
|
+
}
|
|
46
|
+
return output;
|
|
47
|
+
}
|
|
48
|
+
function formatDatabaseHealth(result) {
|
|
49
|
+
let output = `# Database Health\n\n`;
|
|
50
|
+
const status = result.status || result.healthy;
|
|
51
|
+
if (status === 'healthy' || status === true) {
|
|
52
|
+
output += `Status: ✓ Healthy\n`;
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
output += `Status: ✗ Unhealthy\n`;
|
|
56
|
+
}
|
|
57
|
+
if (result.graph_available !== undefined) {
|
|
58
|
+
output += `Graph Available: ${result.graph_available ? '✓ Yes' : '✗ No'}\n`;
|
|
59
|
+
}
|
|
60
|
+
if (result.connection) {
|
|
61
|
+
output += `Connection: ${result.connection}\n`;
|
|
62
|
+
}
|
|
63
|
+
return output;
|
|
64
|
+
}
|
|
65
|
+
function formatSystemStatus(result) {
|
|
66
|
+
let output = `# System Status\n\n`;
|
|
67
|
+
if (result.scheduler) {
|
|
68
|
+
output += `## Job Scheduler\n\n`;
|
|
69
|
+
output += `Status: ${result.scheduler.running ? '✓ Running' : '✗ Stopped'}\n`;
|
|
70
|
+
if (result.scheduler.active_jobs !== undefined) {
|
|
71
|
+
output += `Active Jobs: ${result.scheduler.active_jobs}\n`;
|
|
72
|
+
}
|
|
73
|
+
if (result.scheduler.pending_jobs !== undefined) {
|
|
74
|
+
output += `Pending Jobs: ${result.scheduler.pending_jobs}\n`;
|
|
75
|
+
}
|
|
76
|
+
output += `\n`;
|
|
77
|
+
}
|
|
78
|
+
if (result.resources) {
|
|
79
|
+
output += `## Resource Usage\n\n`;
|
|
80
|
+
if (result.resources.cpu_percent !== undefined) {
|
|
81
|
+
output += `CPU: ${result.resources.cpu_percent}%\n`;
|
|
82
|
+
}
|
|
83
|
+
if (result.resources.memory_percent !== undefined) {
|
|
84
|
+
output += `Memory: ${result.resources.memory_percent}%\n`;
|
|
85
|
+
}
|
|
86
|
+
if (result.resources.disk_percent !== undefined) {
|
|
87
|
+
output += `Disk: ${result.resources.disk_percent}%\n`;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return output;
|
|
91
|
+
}
|
|
92
|
+
function formatApiHealth(result) {
|
|
93
|
+
let output = `# API Health\n\n`;
|
|
94
|
+
if (result.status === 'healthy' || result.healthy === true) {
|
|
95
|
+
output += `Status: ✓ Healthy\n`;
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
output += `Status: ✗ Unhealthy\n`;
|
|
99
|
+
}
|
|
100
|
+
if (result.timestamp) {
|
|
101
|
+
output += `Timestamp: ${new Date(result.timestamp).toLocaleString()}\n`;
|
|
102
|
+
}
|
|
103
|
+
if (result.version) {
|
|
104
|
+
output += `Version: ${result.version}\n`;
|
|
105
|
+
}
|
|
106
|
+
return output;
|
|
107
|
+
}
|
|
108
|
+
function formatMcpAllowedPaths(result) {
|
|
109
|
+
if (!result.configured) {
|
|
110
|
+
let output = `# MCP File Access Allowlist\n\n`;
|
|
111
|
+
output += `Status: ✗ Not Configured\n\n`;
|
|
112
|
+
if (result.message) {
|
|
113
|
+
output += `${result.message}\n\n`;
|
|
114
|
+
}
|
|
115
|
+
if (result.hint) {
|
|
116
|
+
output += `Hint: ${result.hint}\n`;
|
|
117
|
+
}
|
|
118
|
+
return output;
|
|
119
|
+
}
|
|
120
|
+
let output = `# MCP File Access Allowlist\n\n`;
|
|
121
|
+
output += `Status: ✓ Configured\n`;
|
|
122
|
+
output += `Version: ${result.version}\n\n`;
|
|
123
|
+
if (result.allowed_directories && result.allowed_directories.length > 0) {
|
|
124
|
+
output += `## Allowed Directories (${result.allowed_directories.length})\n\n`;
|
|
125
|
+
result.allowed_directories.forEach((dir, idx) => {
|
|
126
|
+
output += `${idx + 1}. ${dir}\n`;
|
|
127
|
+
});
|
|
128
|
+
output += `\n`;
|
|
129
|
+
}
|
|
130
|
+
if (result.allowed_patterns && result.allowed_patterns.length > 0) {
|
|
131
|
+
output += `## Allowed Patterns (${result.allowed_patterns.length})\n\n`;
|
|
132
|
+
result.allowed_patterns.forEach((pattern, idx) => {
|
|
133
|
+
output += `${idx + 1}. ${pattern}\n`;
|
|
134
|
+
});
|
|
135
|
+
output += `\n`;
|
|
136
|
+
}
|
|
137
|
+
if (result.blocked_patterns && result.blocked_patterns.length > 0) {
|
|
138
|
+
output += `## Blocked Patterns (${result.blocked_patterns.length})\n\n`;
|
|
139
|
+
result.blocked_patterns.forEach((pattern, idx) => {
|
|
140
|
+
output += `${idx + 1}. ${pattern}\n`;
|
|
141
|
+
});
|
|
142
|
+
output += `\n`;
|
|
143
|
+
}
|
|
144
|
+
output += `## Limits\n\n`;
|
|
145
|
+
output += `Max File Size: ${result.max_file_size_mb} MB\n`;
|
|
146
|
+
output += `Max Files Per Directory: ${result.max_files_per_directory}\n`;
|
|
147
|
+
if (result.config_path) {
|
|
148
|
+
output += `\nConfig Path: ${result.config_path}\n`;
|
|
149
|
+
}
|
|
150
|
+
return output;
|
|
151
|
+
}
|
|
152
|
+
//# sourceMappingURL=system.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"system.js","sourceRoot":"","sources":["../../../src/mcp/formatters/system.ts"],"names":[],"mappings":";AAAA;;GAEG;;AAEH,kDAwBC;AAED,gDAiBC;AAED,oDAmBC;AAED,gDA6BC;AAED,0CAkBC;AAED,sDAkDC;AAvKD,SAAgB,mBAAmB,CAAC,MAAW;IAC7C,IAAI,MAAM,GAAG,2BAA2B,CAAC;IAEzC,IAAI,MAAM,CAAC,UAAU,EAAE,CAAC;QACtB,MAAM,IAAI,UAAU,MAAM,CAAC,UAAU,MAAM,CAAC;IAC9C,CAAC;IAED,MAAM,IAAI,cAAc,CAAC;IACzB,MAAM,IAAI,aAAa,MAAM,CAAC,aAAa,EAAE,cAAc,EAAE,IAAI,CAAC,IAAI,CAAC;IACvE,MAAM,IAAI,YAAY,MAAM,CAAC,YAAY,EAAE,cAAc,EAAE,IAAI,CAAC,IAAI,CAAC;IACrE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,MAAM,GAAG,CAAC,EAAE,CAAC;QAClE,MAAM,IAAI,wBAAwB,MAAM,CAAC,gBAAgB,CAAC,MAAM,OAAO,CAAC;QACxE,MAAM,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,OAAe,EAAE,GAAW,EAAE,EAAE;YAC/D,MAAM,IAAI,GAAG,GAAG,GAAG,CAAC,KAAK,OAAO,IAAI,CAAC;QACvC,CAAC,CAAC,CAAC;QACH,MAAM,IAAI,IAAI,CAAC;IACjB,CAAC;IAED,MAAM,IAAI,eAAe,CAAC;IAC1B,MAAM,IAAI,kBAAkB,MAAM,CAAC,gBAAgB,OAAO,CAAC;IAC3D,MAAM,IAAI,4BAA4B,MAAM,CAAC,uBAAuB,IAAI,CAAC;IAEzE,IAAI,MAAM,CAAC,WAAW,EAAE,CAAC;QACvB,MAAM,IAAI,kBAAkB,MAAM,CAAC,WAAW,IAAI,CAAC;IACrD,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared utilities for MCP formatters
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Format grounding strength as text (token-efficient)
|
|
6
|
+
* This is the fallback when grounding_display is not available.
|
|
7
|
+
*/
|
|
8
|
+
export declare function formatGroundingStrength(grounding: number): string;
|
|
9
|
+
/**
|
|
10
|
+
* Format grounding with confidence-awareness (grounding × confidence two-dimensional model)
|
|
11
|
+
*
|
|
12
|
+
* Uses grounding_display when available (categorical label from API).
|
|
13
|
+
* Includes numeric confidence_score alongside the label for quantitative insight.
|
|
14
|
+
* Falls back to raw grounding score display for backwards compatibility.
|
|
15
|
+
*/
|
|
16
|
+
export declare function formatGroundingWithConfidence(grounding: number | undefined | null, groundingDisplay: string | undefined | null, confidenceScore?: number | undefined | null): string;
|
|
17
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/mcp/formatters/utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAiBjE;AAED;;;;;;GAMG;AACH,wBAAgB,6BAA6B,CAC3C,SAAS,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,EACpC,gBAAgB,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,EAC3C,eAAe,GAAE,MAAM,GAAG,SAAS,GAAG,IAAW,GAChD,MAAM,CAkBR"}
|