@aaronsb/kg-cli 0.6.6 → 0.8.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.
Files changed (103) hide show
  1. package/dist/api/client.d.ts +168 -1
  2. package/dist/api/client.d.ts.map +1 -1
  3. package/dist/api/client.js +266 -0
  4. package/dist/api/client.js.map +1 -1
  5. package/dist/cli/batch.d.ts +8 -0
  6. package/dist/cli/batch.d.ts.map +1 -0
  7. package/dist/cli/batch.js +225 -0
  8. package/dist/cli/batch.js.map +1 -0
  9. package/dist/cli/commands.d.ts.map +1 -1
  10. package/dist/cli/commands.js +8 -0
  11. package/dist/cli/commands.js.map +1 -1
  12. package/dist/cli/concept.d.ts +9 -0
  13. package/dist/cli/concept.d.ts.map +1 -0
  14. package/dist/cli/concept.js +336 -0
  15. package/dist/cli/concept.js.map +1 -0
  16. package/dist/cli/edge.d.ts +9 -0
  17. package/dist/cli/edge.d.ts.map +1 -0
  18. package/dist/cli/edge.js +364 -0
  19. package/dist/cli/edge.js.map +1 -0
  20. package/dist/cli/jobs.js +111 -3
  21. package/dist/cli/jobs.js.map +1 -1
  22. package/dist/cli/ontology.d.ts.map +1 -1
  23. package/dist/cli/ontology.js +534 -1
  24. package/dist/cli/ontology.js.map +1 -1
  25. package/dist/cli/storage.d.ts +10 -0
  26. package/dist/cli/storage.d.ts.map +1 -0
  27. package/dist/cli/storage.js +260 -0
  28. package/dist/cli/storage.js.map +1 -0
  29. package/dist/cli/vocabulary/index.d.ts.map +1 -1
  30. package/dist/cli/vocabulary/index.js +1 -0
  31. package/dist/cli/vocabulary/index.js.map +1 -1
  32. package/dist/cli/vocabulary/similarity.d.ts +1 -0
  33. package/dist/cli/vocabulary/similarity.d.ts.map +1 -1
  34. package/dist/cli/vocabulary/similarity.js +60 -9
  35. package/dist/cli/vocabulary/similarity.js.map +1 -1
  36. package/dist/lib/interactive.d.ts +84 -0
  37. package/dist/lib/interactive.d.ts.map +1 -0
  38. package/dist/lib/interactive.js +296 -0
  39. package/dist/lib/interactive.js.map +1 -0
  40. package/dist/lib/validation.d.ts +106 -0
  41. package/dist/lib/validation.d.ts.map +1 -0
  42. package/dist/lib/validation.js +354 -0
  43. package/dist/lib/validation.js.map +1 -0
  44. package/dist/mcp/formatters/concept.d.ts +24 -0
  45. package/dist/mcp/formatters/concept.d.ts.map +1 -0
  46. package/dist/mcp/formatters/concept.js +243 -0
  47. package/dist/mcp/formatters/concept.js.map +1 -0
  48. package/dist/mcp/formatters/document.d.ts +25 -0
  49. package/dist/mcp/formatters/document.d.ts.map +1 -0
  50. package/dist/mcp/formatters/document.js +178 -0
  51. package/dist/mcp/formatters/document.js.map +1 -0
  52. package/dist/mcp/formatters/epistemic.d.ts +16 -0
  53. package/dist/mcp/formatters/epistemic.d.ts.map +1 -0
  54. package/dist/mcp/formatters/epistemic.js +269 -0
  55. package/dist/mcp/formatters/epistemic.js.map +1 -0
  56. package/dist/mcp/formatters/graph.d.ts +63 -0
  57. package/dist/mcp/formatters/graph.d.ts.map +1 -0
  58. package/dist/mcp/formatters/graph.js +220 -0
  59. package/dist/mcp/formatters/graph.js.map +1 -0
  60. package/dist/mcp/formatters/index.d.ts +19 -0
  61. package/dist/mcp/formatters/index.d.ts.map +1 -0
  62. package/dist/mcp/formatters/index.js +73 -0
  63. package/dist/mcp/formatters/index.js.map +1 -0
  64. package/dist/mcp/formatters/ingest.d.ts +16 -0
  65. package/dist/mcp/formatters/ingest.d.ts.map +1 -0
  66. package/dist/mcp/formatters/ingest.js +169 -0
  67. package/dist/mcp/formatters/ingest.js.map +1 -0
  68. package/dist/mcp/formatters/job.d.ts +13 -0
  69. package/dist/mcp/formatters/job.d.ts.map +1 -0
  70. package/dist/mcp/formatters/job.js +204 -0
  71. package/dist/mcp/formatters/job.js.map +1 -0
  72. package/dist/mcp/formatters/ontology.d.ts +93 -0
  73. package/dist/mcp/formatters/ontology.d.ts.map +1 -0
  74. package/dist/mcp/formatters/ontology.js +328 -0
  75. package/dist/mcp/formatters/ontology.js.map +1 -0
  76. package/dist/mcp/formatters/source.d.ts +19 -0
  77. package/dist/mcp/formatters/source.d.ts.map +1 -0
  78. package/dist/mcp/formatters/source.js +182 -0
  79. package/dist/mcp/formatters/source.js.map +1 -0
  80. package/dist/mcp/formatters/system.d.ts +10 -0
  81. package/dist/mcp/formatters/system.d.ts.map +1 -0
  82. package/dist/mcp/formatters/system.js +152 -0
  83. package/dist/mcp/formatters/system.js.map +1 -0
  84. package/dist/mcp/formatters/utils.d.ts +17 -0
  85. package/dist/mcp/formatters/utils.d.ts.map +1 -0
  86. package/dist/mcp/formatters/utils.js +55 -0
  87. package/dist/mcp/formatters/utils.js.map +1 -0
  88. package/dist/mcp/graph-operations.d.ts +242 -0
  89. package/dist/mcp/graph-operations.d.ts.map +1 -0
  90. package/dist/mcp/graph-operations.js +532 -0
  91. package/dist/mcp/graph-operations.js.map +1 -0
  92. package/dist/mcp-server.js +625 -37
  93. package/dist/mcp-server.js.map +1 -1
  94. package/dist/types/index.d.ts +289 -0
  95. package/dist/types/index.d.ts.map +1 -1
  96. package/dist/version.d.ts +3 -3
  97. package/dist/version.js +3 -3
  98. package/dist/version.js.map +1 -1
  99. package/package.json +1 -1
  100. package/dist/mcp/formatters.d.ts +0 -100
  101. package/dist/mcp/formatters.d.ts.map +0 -1
  102. package/dist/mcp/formatters.js +0 -1411
  103. 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,EAA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(ADR-200)
3
+ *
4
+ * Formats ontology responses as markdown for AI agents.
5
+ * - Core: Ontology list, info, scores
6
+ * - Phase 3b/4: Proposal list, proposal details, proposal review
7
+ * - Phase 5: Ontology edges, affinity
8
+ */
9
+ /**
10
+ * Format ontology list
11
+ */
12
+ export declare function formatOntologyList(data: any): string;
13
+ /**
14
+ * Format ontology info (detail view)
15
+ */
16
+ export declare function formatOntologyInfo(data: any): string;
17
+ /**
18
+ * Format ontology scores (single or all)
19
+ */
20
+ export declare function formatOntologyScores(data: any): string;
21
+ interface OntologyEdge {
22
+ from_ontology: string;
23
+ to_ontology: string;
24
+ edge_type: string;
25
+ score: number;
26
+ shared_concept_count: number;
27
+ computed_at_epoch: number;
28
+ source: string;
29
+ direction: string;
30
+ }
31
+ interface OntologyEdgesResponse {
32
+ ontology: string;
33
+ count: number;
34
+ edges: OntologyEdge[];
35
+ }
36
+ /**
37
+ * Format ontology-to-ontology edges
38
+ */
39
+ export declare function formatOntologyEdges(data: OntologyEdgesResponse): string;
40
+ interface OntologyAffinity {
41
+ other_ontology: string;
42
+ shared_concept_count: number;
43
+ total_concepts: number;
44
+ affinity_score: number;
45
+ }
46
+ interface OntologyAffinityResponse {
47
+ ontology: string;
48
+ count: number;
49
+ affinities: OntologyAffinity[];
50
+ }
51
+ /**
52
+ * Format ontology affinity (cross-ontology concept overlap)
53
+ */
54
+ export declare function formatOntologyAffinity(data: OntologyAffinityResponse): string;
55
+ interface AnnealingProposal {
56
+ id: number;
57
+ proposal_type: string;
58
+ ontology_name: string;
59
+ anchor_concept_id?: string;
60
+ target_ontology?: string;
61
+ reasoning: string;
62
+ mass_score?: number;
63
+ coherence_score?: number;
64
+ protection_score?: number;
65
+ status: string;
66
+ created_at: string;
67
+ created_at_epoch: number;
68
+ reviewed_at?: string;
69
+ reviewed_by?: string;
70
+ reviewer_notes?: string;
71
+ executed_at?: string;
72
+ execution_result?: Record<string, unknown>;
73
+ suggested_name?: string;
74
+ suggested_description?: string;
75
+ }
76
+ interface ProposalListResponse {
77
+ proposals: AnnealingProposal[];
78
+ count: number;
79
+ }
80
+ /**
81
+ * Format a list of annealing proposals
82
+ */
83
+ export declare function formatProposalList(data: ProposalListResponse): string;
84
+ /**
85
+ * Format a single proposal (detail view or review result)
86
+ */
87
+ export declare function formatProposalDetail(p: AnnealingProposal): string;
88
+ /**
89
+ * Format a annealing cycle result
90
+ */
91
+ export declare function formatAnnealingCycleResult(data: any): string;
92
+ export {};
93
+ //# sourceMappingURL=ontology.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ontology.d.ts","sourceRoot":"","sources":["../../../src/mcp/formatters/ontology.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH;;GAEG;AAEH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,GAAG,GAAG,MAAM,CAmBpD;AAED;;GAEG;AAEH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,GAAG,GAAG,MAAM,CAuCpD;AAED;;GAEG;AAEH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,GAAG,GAAG,MAAM,CAkCtD;AAID,UAAU,YAAY;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,oBAAoB,EAAE,MAAM,CAAC;IAC7B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,UAAU,qBAAqB;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,YAAY,EAAE,CAAC;CACvB;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,qBAAqB,GAAG,MAAM,CAuCvE;AAED,UAAU,gBAAgB;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,oBAAoB,EAAE,MAAM,CAAC;IAC7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gDjE;AAED;;GAEG;AAEH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,GAAG,GAAG,MAAM,CAgC5D"}
@@ -0,0 +1,328 @@
1
+ "use strict";
2
+ /**
3
+ * Ontology formatters (ADR-200)
4
+ *
5
+ * Formats ontology responses as markdown for AI agents.
6
+ * - Core: Ontology list, info, scores
7
+ * - Phase 3b/4: Proposal list, proposal details, proposal review
8
+ * - Phase 5: Ontology edges, affinity
9
+ */
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ exports.formatOntologyList = formatOntologyList;
12
+ exports.formatOntologyInfo = formatOntologyInfo;
13
+ exports.formatOntologyScores = formatOntologyScores;
14
+ exports.formatOntologyEdges = formatOntologyEdges;
15
+ exports.formatOntologyAffinity = formatOntologyAffinity;
16
+ exports.formatProposalList = formatProposalList;
17
+ exports.formatProposalDetail = formatProposalDetail;
18
+ exports.formatAnnealingCycleResult = formatAnnealingCycleResult;
19
+ // ========== Core Ontology Formatters ==========
20
+ /**
21
+ * Format ontology list
22
+ */
23
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
24
+ function formatOntologyList(data) {
25
+ let output = `# Ontologies\n\n`;
26
+ output += `**Total:** ${data.count}\n\n`;
27
+ if (data.count === 0) {
28
+ output += `No ontologies found.\n`;
29
+ return output;
30
+ }
31
+ output += `| Ontology | Concepts | Sources | Lifecycle | Epoch |\n`;
32
+ output += `|----------|----------|---------|-----------|-------|\n`;
33
+ for (const o of data.ontologies) {
34
+ const lifecycle = o.lifecycle_state || 'active';
35
+ const epoch = o.creation_epoch ?? '-';
36
+ output += `| **${o.ontology}** | ${o.concept_count} | ${o.source_count} | ${lifecycle} | ${epoch} |\n`;
37
+ }
38
+ return output;
39
+ }
40
+ /**
41
+ * Format ontology info (detail view)
42
+ */
43
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
44
+ function formatOntologyInfo(data) {
45
+ let output = `# Ontology: ${data.ontology}\n\n`;
46
+ if (!data.node) {
47
+ output += `**Warning:** Ontology node not found in graph. Sources may exist with this document name but no Ontology node is registered.\n\n`;
48
+ }
49
+ else {
50
+ output += `| Property | Value |\n|----------|-------|\n`;
51
+ output += `| ID | \`${data.node.ontology_id}\` |\n`;
52
+ if (data.node.description) {
53
+ output += `| Description | ${data.node.description} |\n`;
54
+ }
55
+ output += `| Lifecycle | ${data.node.lifecycle_state} |\n`;
56
+ output += `| Creation epoch | ${data.node.creation_epoch} |\n`;
57
+ output += `| Has embedding | ${data.node.has_embedding} |\n`;
58
+ if (data.node.created_by) {
59
+ output += `| Created by | ${data.node.created_by} |\n`;
60
+ }
61
+ if (data.node.search_terms && data.node.search_terms.length > 0) {
62
+ output += `| Search terms | ${data.node.search_terms.join(', ')} |\n`;
63
+ }
64
+ output += `\n`;
65
+ }
66
+ output += `## Statistics\n\n`;
67
+ output += `| Metric | Count |\n|--------|-------|\n`;
68
+ output += `| Concepts | ${data.statistics.concept_count} |\n`;
69
+ output += `| Sources | ${data.statistics.source_count} |\n`;
70
+ output += `| Files | ${data.statistics.file_count} |\n`;
71
+ output += `| Instances | ${data.statistics.instance_count} |\n`;
72
+ output += `| Relationships | ${data.statistics.relationship_count} |\n`;
73
+ if (data.files.length > 0) {
74
+ output += `\n## Files (${data.files.length})\n\n`;
75
+ for (const f of data.files) {
76
+ output += `- ${f}\n`;
77
+ }
78
+ }
79
+ return output;
80
+ }
81
+ /**
82
+ * Format ontology scores (single or all)
83
+ */
84
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
85
+ function formatOntologyScores(data) {
86
+ // Single ontology score
87
+ if (data.ontology && data.mass_score !== undefined) {
88
+ const fmt = (v) => v != null ? v.toFixed(4) : '-';
89
+ let output = `# Ontology Scores: ${data.ontology}\n\n`;
90
+ output += `| Metric | Value |\n|--------|-------|\n`;
91
+ output += `| Mass | ${fmt(data.mass_score)} |\n`;
92
+ output += `| Coherence | ${fmt(data.coherence_score)} |\n`;
93
+ output += `| Raw exposure | ${fmt(data.raw_exposure)} |\n`;
94
+ output += `| Weighted exposure | ${fmt(data.weighted_exposure)} |\n`;
95
+ output += `| **Protection** | **${fmt(data.protection_score)}** |\n`;
96
+ output += `| Epoch | ${data.last_evaluated_epoch ?? '-'} |\n`;
97
+ return output;
98
+ }
99
+ // All ontology scores
100
+ let output = `# Ontology Scores\n\n`;
101
+ output += `**Epoch:** ${data.global_epoch ?? '-'} | **Count:** ${data.count ?? 0}\n\n`;
102
+ const scores = data.scores || [];
103
+ if (scores.length === 0) {
104
+ output += `No scores available.\n`;
105
+ return output;
106
+ }
107
+ output += `| Ontology | Mass | Coherence | Exposure | Protection | Epoch |\n`;
108
+ output += `|----------|------|-----------|----------|------------|-------|\n`;
109
+ const fmt3 = (v) => v != null ? v.toFixed(3) : '-';
110
+ for (const s of scores) {
111
+ output += `| **${s.ontology}** | ${fmt3(s.mass_score)} | ${fmt3(s.coherence_score)} | ${fmt3(s.weighted_exposure)} | ${fmt3(s.protection_score)} | ${s.last_evaluated_epoch ?? '-'} |\n`;
112
+ }
113
+ return output;
114
+ }
115
+ /**
116
+ * Format ontology-to-ontology edges
117
+ */
118
+ function formatOntologyEdges(data) {
119
+ let output = `# Ontology Edges: ${data.ontology}\n\n`;
120
+ if (data.count === 0) {
121
+ output += `No edges found. Edges are derived during annealing cycles when ontologies share concepts.\n`;
122
+ return output;
123
+ }
124
+ output += `**Total:** ${data.count} edges\n\n`;
125
+ // Group by edge type
126
+ const byType = {};
127
+ for (const edge of data.edges) {
128
+ const type = edge.edge_type;
129
+ if (!byType[type])
130
+ byType[type] = [];
131
+ byType[type].push(edge);
132
+ }
133
+ for (const [type, edges] of Object.entries(byType)) {
134
+ output += `## ${type} (${edges.length})\n\n`;
135
+ for (const edge of edges) {
136
+ const arrow = edge.direction === 'outgoing' ? '->' : '<-';
137
+ const other = edge.direction === 'outgoing' ? edge.to_ontology : edge.from_ontology;
138
+ const scorePercent = (edge.score * 100).toFixed(1);
139
+ output += `- ${data.ontology} ${arrow} **${other}**`;
140
+ output += ` | score: ${scorePercent}%`;
141
+ output += ` | shared: ${edge.shared_concept_count}`;
142
+ output += ` | source: ${edge.source}`;
143
+ if (edge.computed_at_epoch > 0) {
144
+ output += ` | epoch: ${edge.computed_at_epoch}`;
145
+ }
146
+ output += `\n`;
147
+ }
148
+ output += `\n`;
149
+ }
150
+ return output;
151
+ }
152
+ /**
153
+ * Format ontology affinity (cross-ontology concept overlap)
154
+ */
155
+ function formatOntologyAffinity(data) {
156
+ let output = `# Ontology Affinity: ${data.ontology}\n\n`;
157
+ if (data.count === 0) {
158
+ output += `No shared concepts with other ontologies.\n`;
159
+ return output;
160
+ }
161
+ output += `**Compared against:** ${data.count} ontologies\n\n`;
162
+ for (const aff of data.affinities) {
163
+ const scorePercent = (aff.affinity_score * 100).toFixed(1);
164
+ output += `- **${aff.other_ontology}** | ${scorePercent}% affinity | ${aff.shared_concept_count} shared of ${aff.total_concepts} total\n`;
165
+ }
166
+ return output;
167
+ }
168
+ function formatStatus(status) {
169
+ const icons = {
170
+ pending: '[PENDING]',
171
+ approved: '[APPROVED]',
172
+ executing: '[EXECUTING]',
173
+ executed: '[EXECUTED]',
174
+ rejected: '[REJECTED]',
175
+ failed: '[FAILED]',
176
+ expired: '[EXPIRED]',
177
+ };
178
+ return icons[status] || `[${status.toUpperCase()}]`;
179
+ }
180
+ function formatScores(p) {
181
+ const parts = [];
182
+ if (p.mass_score != null)
183
+ parts.push(`mass: ${p.mass_score.toFixed(3)}`);
184
+ if (p.coherence_score != null)
185
+ parts.push(`coherence: ${p.coherence_score.toFixed(3)}`);
186
+ if (p.protection_score != null)
187
+ parts.push(`protection: ${p.protection_score.toFixed(3)}`);
188
+ return parts.length > 0 ? parts.join(' | ') : '';
189
+ }
190
+ /**
191
+ * Format a list of annealing proposals
192
+ */
193
+ function formatProposalList(data) {
194
+ let output = `# Annealing Proposals\n\n`;
195
+ if (data.count === 0) {
196
+ output += `No proposals found.\n`;
197
+ return output;
198
+ }
199
+ output += `**Total:** ${data.count}\n\n`;
200
+ for (const p of data.proposals) {
201
+ const typeIcon = p.proposal_type === 'promotion' ? 'PROMOTE' : 'DEMOTE';
202
+ output += `### #${p.id} ${typeIcon}: ${p.ontology_name} ${formatStatus(p.status)}\n\n`;
203
+ output += `${p.reasoning}\n\n`;
204
+ if (p.proposal_type === 'promotion' && p.anchor_concept_id) {
205
+ output += `- **Anchor concept:** ${p.anchor_concept_id}\n`;
206
+ if (p.suggested_name)
207
+ output += `- **Suggested name:** ${p.suggested_name}\n`;
208
+ }
209
+ if (p.proposal_type === 'demotion' && p.target_ontology) {
210
+ output += `- **Absorption target:** ${p.target_ontology}\n`;
211
+ }
212
+ const scores = formatScores(p);
213
+ if (scores)
214
+ output += `- **Scores:** ${scores}\n`;
215
+ output += `- **Epoch:** ${p.created_at_epoch} | **Created:** ${p.created_at}\n`;
216
+ if (p.reviewed_at) {
217
+ output += `- **Reviewed:** ${p.reviewed_at} by ${p.reviewed_by || 'unknown'}\n`;
218
+ }
219
+ if (p.execution_result) {
220
+ const r = p.execution_result;
221
+ if (r.ontology_created)
222
+ output += `- **Created ontology:** ${r.ontology_created}\n`;
223
+ if (r.absorbed_into)
224
+ output += `- **Absorbed into:** ${r.absorbed_into}\n`;
225
+ if (r.sources_reassigned !== undefined)
226
+ output += `- **Sources reassigned:** ${r.sources_reassigned}\n`;
227
+ if (r.error)
228
+ output += `- **Error:** ${r.error}\n`;
229
+ }
230
+ output += `\n`;
231
+ }
232
+ return output;
233
+ }
234
+ /**
235
+ * Format a single proposal (detail view or review result)
236
+ */
237
+ function formatProposalDetail(p) {
238
+ const typeIcon = p.proposal_type === 'promotion' ? 'PROMOTE' : 'DEMOTE';
239
+ let output = `# Proposal #${p.id}: ${typeIcon} ${p.ontology_name}\n\n`;
240
+ output += `**Status:** ${formatStatus(p.status)}\n\n`;
241
+ output += `## Reasoning\n\n${p.reasoning}\n\n`;
242
+ output += `## Details\n\n`;
243
+ if (p.proposal_type === 'promotion') {
244
+ if (p.anchor_concept_id)
245
+ output += `- **Anchor concept:** ${p.anchor_concept_id}\n`;
246
+ if (p.suggested_name)
247
+ output += `- **Suggested name:** ${p.suggested_name}\n`;
248
+ if (p.suggested_description)
249
+ output += `- **Suggested description:** ${p.suggested_description}\n`;
250
+ }
251
+ if (p.proposal_type === 'demotion' && p.target_ontology) {
252
+ output += `- **Absorption target:** ${p.target_ontology}\n`;
253
+ }
254
+ const scores = formatScores(p);
255
+ if (scores)
256
+ output += `- **Scores:** ${scores}\n`;
257
+ output += `- **Epoch:** ${p.created_at_epoch}\n`;
258
+ output += `- **Created:** ${p.created_at}\n`;
259
+ if (p.reviewed_at) {
260
+ output += `\n## Review\n\n`;
261
+ output += `- **Reviewed:** ${p.reviewed_at} by ${p.reviewed_by || 'unknown'}\n`;
262
+ if (p.reviewer_notes)
263
+ output += `- **Notes:** ${p.reviewer_notes}\n`;
264
+ }
265
+ if (p.executed_at || p.execution_result) {
266
+ output += `\n## Execution\n\n`;
267
+ if (p.executed_at)
268
+ output += `- **Executed:** ${p.executed_at}\n`;
269
+ if (p.execution_result) {
270
+ const r = p.execution_result;
271
+ if (r.ontology_created)
272
+ output += `- **Created ontology:** ${r.ontology_created}\n`;
273
+ if (r.ontology_id)
274
+ output += `- **Ontology ID:** ${r.ontology_id}\n`;
275
+ if (r.absorbed_into)
276
+ output += `- **Absorbed into:** ${r.absorbed_into}\n`;
277
+ if (r.sources_reassigned !== undefined)
278
+ output += `- **Sources reassigned:** ${r.sources_reassigned}\n`;
279
+ if (r.sources_found !== undefined)
280
+ output += `- **Sources found:** ${r.sources_found}\n`;
281
+ if (r.parent_ontology)
282
+ output += `- **Parent ontology:** ${r.parent_ontology}\n`;
283
+ if (r.ontology_node_deleted !== undefined)
284
+ output += `- **Node deleted:** ${r.ontology_node_deleted}\n`;
285
+ if (r.error)
286
+ output += `- **Error:** ${r.error}\n`;
287
+ }
288
+ }
289
+ if (p.status === 'pending') {
290
+ output += `\n---\n*Use proposal_review action with status "approved" or "rejected" to review.*\n`;
291
+ }
292
+ return output;
293
+ }
294
+ /**
295
+ * Format a annealing cycle result
296
+ */
297
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
298
+ function formatAnnealingCycleResult(data) {
299
+ let output = `# Annealing Cycle Result\n\n`;
300
+ if (data.dry_run)
301
+ output += `**Mode:** Dry run (no proposals stored)\n\n`;
302
+ output += `| Metric | Value |\n|--------|-------|\n`;
303
+ output += `| Proposals generated | ${data.proposals_generated ?? 0} |\n`;
304
+ output += `| Demotion candidates | ${data.demotion_candidates ?? 0} |\n`;
305
+ output += `| Promotion candidates | ${data.promotion_candidates ?? 0} |\n`;
306
+ output += `| Ontologies scored | ${data.scores_updated ?? 0} |\n`;
307
+ output += `| Centroids updated | ${data.centroids_updated ?? 0} |\n`;
308
+ output += `| Edges created | ${data.edges_created ?? 0} |\n`;
309
+ output += `| Edges deleted | ${data.edges_deleted ?? 0} |\n`;
310
+ output += `| Cycle epoch | ${data.cycle_epoch ?? 0} |\n`;
311
+ if (data.candidates && typeof data.candidates === 'object') {
312
+ const c = data.candidates;
313
+ if (c.demotions && Array.isArray(c.demotions) && c.demotions.length > 0) {
314
+ output += `\n## Demotion Candidates\n\n`;
315
+ for (const d of c.demotions) {
316
+ output += `- **${d.ontology}** (protection: ${d.protection})\n`;
317
+ }
318
+ }
319
+ if (c.promotions && Array.isArray(c.promotions) && c.promotions.length > 0) {
320
+ output += `\n## Promotion Candidates\n\n`;
321
+ for (const p of c.promotions) {
322
+ output += `- **${p.concept}** in ${p.ontology} (degree: ${p.degree})\n`;
323
+ }
324
+ }
325
+ }
326
+ return output;
327
+ }
328
+ //# sourceMappingURL=ontology.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ontology.js","sourceRoot":"","sources":["../../../src/mcp/formatters/ontology.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;AAQH,gDAmBC;AAMD,gDAuCC;AAMD,oDAkCC;AAwBD,kDAuCC;AAkBD,wDAgBC;AAuDD,gDA0CC;AAKD,oDAgDC;AAMD,gEA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