mote-core 0.1.2

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/kernel.js ADDED
@@ -0,0 +1,421 @@
1
+ import { z } from "zod";
2
+ import { createExecutionContext, dashboardSpecSchema, executionContextSchema, insightBundleSchema, insightRequestSchema, knowledgeQueryResultSchema, knowledgeQueryRequestSchema, structuredQueryResultSchema, structuredQueryRequestSchema } from "./contracts.js";
3
+ import { InMemoryCacheStore, createScopedCacheKey } from "./cache.js";
4
+ import { DeterministicInsightEngine } from "./runtime/engine.js";
5
+ import { Registry } from "./registry.js";
6
+ export class Kernel {
7
+ cache;
8
+ resources = new Registry();
9
+ tools = new Registry();
10
+ prompts = new Registry();
11
+ connectors = new Map();
12
+ structuredConnectors = new Map();
13
+ knowledgeConnectors = new Map();
14
+ insightEngine;
15
+ constructor(config = {}) {
16
+ this.cache = config.cache ?? new InMemoryCacheStore();
17
+ this.insightEngine = config.insightEngine ?? new DeterministicInsightEngine();
18
+ for (const connector of config.connectors ?? []) {
19
+ this.registerConnector(connector);
20
+ }
21
+ for (const resource of config.resources ?? []) {
22
+ this.resources.add(resource);
23
+ }
24
+ for (const tool of config.tools ?? []) {
25
+ this.tools.add(tool);
26
+ }
27
+ for (const prompt of config.prompts ?? []) {
28
+ this.prompts.add(prompt);
29
+ }
30
+ this.registerBuiltins();
31
+ }
32
+ registerConnector(connector) {
33
+ if (this.connectors.has(connector.descriptor.id)) {
34
+ throw new Error(`duplicate connector: ${connector.descriptor.id}`);
35
+ }
36
+ this.connectors.set(connector.descriptor.id, connector);
37
+ if (connector.descriptor.kind === "structured") {
38
+ this.structuredConnectors.set(connector.descriptor.id, connector);
39
+ }
40
+ else {
41
+ this.knowledgeConnectors.set(connector.descriptor.id, connector);
42
+ }
43
+ }
44
+ listConnectors() {
45
+ return [...this.connectors.values()];
46
+ }
47
+ getStructuredConnector(id) {
48
+ const connector = this.structuredConnectors.get(id);
49
+ if (!connector) {
50
+ throw new Error(`unknown structured connector: ${id}`);
51
+ }
52
+ return connector;
53
+ }
54
+ getKnowledgeConnector(id) {
55
+ const connector = this.knowledgeConnectors.get(id);
56
+ if (!connector) {
57
+ throw new Error(`unknown knowledge connector: ${id}`);
58
+ }
59
+ return connector;
60
+ }
61
+ async describeConnectors(contextInput) {
62
+ const context = createExecutionContext(contextInput);
63
+ return Promise.all(this.listConnectors().map(async (connector) => ({
64
+ descriptor: connector.descriptor,
65
+ health: await connector.getHealth(context)
66
+ })));
67
+ }
68
+ async getResource(id, contextInput) {
69
+ const context = createExecutionContext(contextInput);
70
+ const resource = this.resources.get(id);
71
+ return resource.load({ context });
72
+ }
73
+ async executeTool(id, input, contextInput) {
74
+ const context = createExecutionContext(contextInput);
75
+ const tool = this.tools.get(id);
76
+ const parsedInput = tool.inputSchema.parse(input);
77
+ const result = await tool.execute(parsedInput, { context });
78
+ return tool.outputSchema.parse(result);
79
+ }
80
+ async renderPrompt(id, input, contextInput) {
81
+ const context = createExecutionContext(contextInput);
82
+ const prompt = this.prompts.get(id);
83
+ const parsedInput = prompt.inputSchema.parse(input);
84
+ return await prompt.render(parsedInput, { context });
85
+ }
86
+ async generateInsight(requestInput, contextInput) {
87
+ const context = executionContextSchema.parse(createExecutionContext(contextInput));
88
+ const request = insightRequestSchema.parse(requestInput);
89
+ const prompt = request.promptId ? await this.renderPrompt(request.promptId, { request }, context) : undefined;
90
+ const insightContext = await this.buildInsightContext(request, context, prompt);
91
+ const result = await this.insightEngine.generate(insightContext);
92
+ return insightBundleSchema.parse(result);
93
+ }
94
+ async buildDashboard(insightInput, _contextInput) {
95
+ const insight = insightBundleSchema.parse(insightInput);
96
+ const charts = insight.findings.flatMap((finding) => finding.chartIntents.map((intent, index) => ({
97
+ id: `${finding.id}:chart:${index + 1}`,
98
+ type: intent.type,
99
+ title: intent.title,
100
+ datasetId: intent.datasetId,
101
+ xField: intent.xField,
102
+ yField: intent.yField,
103
+ groupBy: intent.groupBy,
104
+ rationale: intent.rationale
105
+ })));
106
+ const sections = [
107
+ {
108
+ id: "overview",
109
+ title: "Overview",
110
+ chartIds: charts.map((chart) => chart.id),
111
+ narrative: insight.summary
112
+ }
113
+ ];
114
+ return dashboardSpecSchema.parse({
115
+ dashboardId: `dashboard:${slugify(insight.question)}`,
116
+ title: `Dashboard for ${insight.question}`,
117
+ question: insight.question,
118
+ sections,
119
+ charts,
120
+ datasets: insight.datasets,
121
+ insights: insight.findings,
122
+ warnings: insight.warnings,
123
+ provenance: insight.evidence
124
+ });
125
+ }
126
+ async buildInsightContext(request, context, prompt) {
127
+ const resourceValues = await Promise.all(request.resourceIds.map(async (id) => ({
128
+ id,
129
+ value: await this.getResource(id, context)
130
+ })));
131
+ const structuredResults = await Promise.all(request.structuredQueries.map(async (entry, index) => ({
132
+ queryId: `structured:${index + 1}:${entry.connectorId}:${entry.request.surface}`,
133
+ result: await this.getStructuredConnector(entry.connectorId).executeQuery(entry.request, context)
134
+ })));
135
+ const knowledgeResults = await Promise.all(request.knowledgeQueries.map(async (entry, index) => ({
136
+ queryId: `knowledge:${index + 1}:${entry.connectorId}`,
137
+ result: await this.getKnowledgeConnector(entry.connectorId).query(entry.request, context)
138
+ })));
139
+ const result = {
140
+ request,
141
+ context,
142
+ resources: resourceValues,
143
+ structuredResults,
144
+ knowledgeResults
145
+ };
146
+ if (prompt !== undefined) {
147
+ result.prompt = prompt;
148
+ }
149
+ return result;
150
+ }
151
+ registerBuiltins() {
152
+ if (!this.tools.list().some((tool) => tool.id === "build_insight_context")) {
153
+ this.tools.add({
154
+ id: "build_insight_context",
155
+ title: "Build Insight Context",
156
+ description: "Fetch structured data, knowledge hits, and registered resources for an insight request.",
157
+ connectorKinds: ["structured", "knowledge"],
158
+ inputSchema: insightRequestSchema,
159
+ outputSchema: z.object({
160
+ question: z.string(),
161
+ resources: z.array(z.object({
162
+ id: z.string(),
163
+ value: z.unknown()
164
+ })),
165
+ structuredResults: z.array(z.object({
166
+ queryId: z.string(),
167
+ result: structuredQueryResultSchema
168
+ })),
169
+ knowledgeResults: z.array(z.object({
170
+ queryId: z.string(),
171
+ result: knowledgeQueryResultSchema
172
+ }))
173
+ }),
174
+ mcp: {
175
+ enabled: true,
176
+ kind: "tool",
177
+ tenantSafe: true
178
+ },
179
+ execute: async (request, { context }) => {
180
+ const parsedRequest = insightRequestSchema.parse(request);
181
+ const built = await this.buildInsightContext(parsedRequest, context);
182
+ return {
183
+ question: built.request.question,
184
+ resources: built.resources,
185
+ structuredResults: built.structuredResults,
186
+ knowledgeResults: built.knowledgeResults
187
+ };
188
+ }
189
+ });
190
+ }
191
+ if (!this.tools.list().some((tool) => tool.id === "run_structured_query")) {
192
+ this.tools.add({
193
+ id: "run_structured_query",
194
+ title: "Run Structured Query",
195
+ description: "Execute a typed query against a structured connector.",
196
+ connectorKinds: ["structured"],
197
+ inputSchema: z.object({
198
+ connectorId: z.string(),
199
+ request: structuredQueryRequestSchema
200
+ }),
201
+ outputSchema: structuredQueryResultSchema,
202
+ mcp: {
203
+ enabled: true,
204
+ kind: "tool",
205
+ tenantSafe: true
206
+ },
207
+ execute: async (input, { context }) => {
208
+ const { connectorId, request } = z.object({
209
+ connectorId: z.string(),
210
+ request: structuredQueryRequestSchema
211
+ }).parse(input);
212
+ return this.getStructuredConnector(connectorId).executeQuery(request, context);
213
+ }
214
+ });
215
+ }
216
+ if (!this.tools.list().some((tool) => tool.id === "run_knowledge_query")) {
217
+ this.tools.add({
218
+ id: "run_knowledge_query",
219
+ title: "Run Knowledge Query",
220
+ description: "Execute a knowledge search against a knowledge connector.",
221
+ connectorKinds: ["knowledge"],
222
+ inputSchema: z.object({
223
+ connectorId: z.string(),
224
+ request: knowledgeQueryRequestSchema
225
+ }),
226
+ outputSchema: knowledgeQueryResultSchema,
227
+ mcp: {
228
+ enabled: true,
229
+ kind: "tool",
230
+ tenantSafe: true
231
+ },
232
+ execute: async (input, { context }) => {
233
+ const { connectorId, request } = z.object({
234
+ connectorId: z.string(),
235
+ request: knowledgeQueryRequestSchema
236
+ }).parse(input);
237
+ return this.getKnowledgeConnector(connectorId).query(request, context);
238
+ }
239
+ });
240
+ }
241
+ if (!this.tools.list().some((tool) => tool.id === "generate_insight")) {
242
+ this.tools.add({
243
+ id: "generate_insight",
244
+ title: "Generate Insight",
245
+ description: "Generate a typed insight bundle from structured and knowledge queries.",
246
+ connectorKinds: ["structured", "knowledge"],
247
+ inputSchema: insightRequestSchema,
248
+ outputSchema: insightBundleSchema,
249
+ mcp: {
250
+ enabled: true,
251
+ kind: "tool",
252
+ tenantSafe: true
253
+ },
254
+ execute: async (input, { context }) => {
255
+ const request = insightRequestSchema.parse(input);
256
+ return this.generateInsight(request, context);
257
+ }
258
+ });
259
+ }
260
+ if (!this.tools.list().some((tool) => tool.id === "build_dashboard")) {
261
+ this.tools.add({
262
+ id: "build_dashboard",
263
+ title: "Build Dashboard",
264
+ description: "Build a declarative dashboard specification from a typed insight bundle.",
265
+ connectorKinds: ["structured", "knowledge"],
266
+ inputSchema: z.object({
267
+ insight: insightBundleSchema
268
+ }),
269
+ outputSchema: dashboardSpecSchema,
270
+ mcp: {
271
+ enabled: true,
272
+ kind: "tool",
273
+ tenantSafe: true
274
+ },
275
+ execute: async (input, { context }) => {
276
+ const { insight } = z.object({
277
+ insight: insightBundleSchema
278
+ }).parse(input);
279
+ return this.buildDashboard(insight, context);
280
+ }
281
+ });
282
+ }
283
+ if (!this.prompts.list().some((prompt) => prompt.id === "insight_analyst")) {
284
+ this.prompts.add({
285
+ id: "insight_analyst",
286
+ title: "Insight Analyst",
287
+ description: "Prompt template for insight generation from shared kernel resources.",
288
+ connectorKinds: ["structured", "knowledge"],
289
+ inputSchema: z.object({
290
+ request: insightRequestSchema,
291
+ insight: insightBundleSchema.optional()
292
+ }),
293
+ mcp: {
294
+ enabled: true,
295
+ kind: "prompt",
296
+ tenantSafe: true
297
+ },
298
+ render: async (input, { context }) => {
299
+ const { request, insight } = z.object({
300
+ request: insightRequestSchema,
301
+ insight: insightBundleSchema.optional()
302
+ }).parse(input);
303
+ const connectorSummary = this.listConnectors()
304
+ .map((connector) => `${connector.descriptor.id}:${connector.descriptor.kind}`)
305
+ .join(", ");
306
+ const lines = [
307
+ `Question: ${request.question}`,
308
+ `Access mode: ${context.accessMode}`,
309
+ `Tenant: ${context.tenantId ?? "none"}`,
310
+ `Connectors: ${connectorSummary || "none"}`,
311
+ `Structured queries: ${request.structuredQueries.length}`,
312
+ `Knowledge queries: ${request.knowledgeQueries.length}`
313
+ ];
314
+ if (insight) {
315
+ lines.push(`Existing insight summary: ${insight.summary}`);
316
+ }
317
+ return lines.join("\n");
318
+ }
319
+ });
320
+ }
321
+ if (!this.prompts.list().some((prompt) => prompt.id === "dashboard_composer")) {
322
+ this.prompts.add({
323
+ id: "dashboard_composer",
324
+ title: "Dashboard Composer",
325
+ description: "Prompt template for turning an insight bundle into a dashboard spec.",
326
+ connectorKinds: ["structured", "knowledge"],
327
+ inputSchema: z.object({
328
+ request: z.string(),
329
+ insight: insightBundleSchema
330
+ }),
331
+ mcp: {
332
+ enabled: true,
333
+ kind: "prompt",
334
+ tenantSafe: true
335
+ },
336
+ render: (input) => {
337
+ const { request, insight } = z.object({
338
+ request: z.string(),
339
+ insight: insightBundleSchema
340
+ }).parse(input);
341
+ return [
342
+ `Compose a dashboard for: ${request}`,
343
+ `Findings: ${insight.findings.length}`,
344
+ `Datasets: ${insight.datasets.length}`,
345
+ `Warnings: ${insight.warnings.join("; ") || "none"}`
346
+ ].join("\n");
347
+ }
348
+ });
349
+ }
350
+ if (!this.resources.list().some((resource) => resource.id === "connector_health")) {
351
+ this.resources.add({
352
+ id: "connector_health",
353
+ title: "Connector Health",
354
+ description: "Health snapshot for all registered connectors.",
355
+ connectorKinds: ["structured", "knowledge"],
356
+ cacheTtlMs: 15_000,
357
+ mcp: {
358
+ enabled: true,
359
+ kind: "resource",
360
+ tenantSafe: true
361
+ },
362
+ load: async ({ context }) => {
363
+ const cacheKey = createScopedCacheKey("resource.connector_health", {
364
+ tenantId: context.tenantId,
365
+ accessMode: context.accessMode
366
+ });
367
+ const cached = this.cache.get(cacheKey);
368
+ if (cached) {
369
+ return cached;
370
+ }
371
+ const value = await this.describeConnectors(context);
372
+ this.cache.set(cacheKey, value, 15_000);
373
+ return value;
374
+ }
375
+ });
376
+ }
377
+ for (const connector of this.listConnectors()) {
378
+ const resourceId = `connector.${connector.descriptor.id}.catalog`;
379
+ if (this.resources.list().some((resource) => resource.id === resourceId)) {
380
+ continue;
381
+ }
382
+ this.resources.add({
383
+ id: resourceId,
384
+ title: `${connector.descriptor.label} Catalog`,
385
+ description: `Catalog view for the ${connector.descriptor.label} connector.`,
386
+ connectorKinds: [connector.descriptor.kind],
387
+ mcp: {
388
+ enabled: true,
389
+ kind: "resource",
390
+ tenantSafe: true
391
+ },
392
+ load: async ({ context }) => {
393
+ if (connector.descriptor.kind === "structured") {
394
+ return this.getStructuredConnector(connector.descriptor.id).getSchemaSnapshot(context);
395
+ }
396
+ return this.getKnowledgeConnector(connector.descriptor.id).getCollections(context);
397
+ }
398
+ });
399
+ const healthResourceId = `connector.${connector.descriptor.id}.health`;
400
+ if (this.resources.list().some((resource) => resource.id === healthResourceId)) {
401
+ continue;
402
+ }
403
+ this.resources.add({
404
+ id: healthResourceId,
405
+ title: `${connector.descriptor.label} Health`,
406
+ description: `Health view for the ${connector.descriptor.label} connector.`,
407
+ connectorKinds: [connector.descriptor.kind],
408
+ mcp: {
409
+ enabled: true,
410
+ kind: "resource",
411
+ tenantSafe: true
412
+ },
413
+ load: async ({ context }) => connector.getHealth(context)
414
+ });
415
+ }
416
+ }
417
+ }
418
+ function slugify(value) {
419
+ return value.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
420
+ }
421
+ //# sourceMappingURL=kernel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kernel.js","sourceRoot":"","sources":["../src/kernel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK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