@happyvertical/smrt-dev-mcp 0.51.27 → 0.51.33
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/AGENTS.md +40 -3
- package/README.md +35 -3
- package/dist/dev-plane.d.ts.map +1 -1
- package/dist/dev-plane.js +6 -4
- package/dist/dev-plane.js.map +1 -1
- package/dist/{http-TeoaK9Xr.js → http-C302xXnO.js} +5 -4
- package/dist/{http-TeoaK9Xr.js.map → http-C302xXnO.js.map} +1 -1
- package/dist/http.d.ts +18 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +31 -454
- package/dist/index.js.map +1 -1
- package/dist/introspect-project-Peu2LC2T.js +490 -0
- package/dist/introspect-project-Peu2LC2T.js.map +1 -0
- package/dist/knowledge/index.d.ts +3 -1
- package/dist/knowledge/index.d.ts.map +1 -1
- package/dist/knowledge/mcp-docs.d.ts +1 -1
- package/dist/{knowledge-DYe5lCfq.js → knowledge-CvNlDTLz.js} +9 -6
- package/dist/knowledge-CvNlDTLz.js.map +1 -0
- package/dist/knowledge.js +2 -2
- package/dist/observation-CqE0tBgS.js +386 -0
- package/dist/observation-CqE0tBgS.js.map +1 -0
- package/dist/runtime-test-fixture.d.ts +3 -0
- package/dist/runtime-test-fixture.d.ts.map +1 -0
- package/dist/runtime.d.ts +1 -1
- package/dist/runtime.js +2 -1
- package/dist/runtime.js.map +1 -1
- package/dist/{tool-catalog-Zl-bcimC.js → tool-catalog-RHq7nyCm.js} +26 -2
- package/dist/tool-catalog-RHq7nyCm.js.map +1 -0
- package/dist/tool-catalog.d.ts +1 -1
- package/dist/tool-catalog.d.ts.map +1 -1
- package/dist/tools/introspect-project.d.ts.map +1 -1
- package/dist/tools/runtime/boot.d.ts.map +1 -1
- package/dist/tools/runtime/connection.d.ts +23 -3
- package/dist/tools/runtime/connection.d.ts.map +1 -1
- package/dist/tools/runtime/observation.d.ts +17 -12
- package/dist/tools/runtime/observation.d.ts.map +1 -1
- package/dist/tools/runtime/project-runtime.d.ts +16 -0
- package/dist/tools/runtime/project-runtime.d.ts.map +1 -0
- package/dist/tools/runtime/tools.d.ts +23 -3
- package/dist/tools/runtime/tools.d.ts.map +1 -1
- package/dist/tools-ma2JFPVY.js +568 -0
- package/dist/tools-ma2JFPVY.js.map +1 -0
- package/package.json +11 -9
- package/dist/knowledge-DYe5lCfq.js.map +0 -1
- package/dist/observation-VJgHaPps.js +0 -802
- package/dist/observation-VJgHaPps.js.map +0 -1
- package/dist/tool-catalog-Zl-bcimC.js.map +0 -1
|
@@ -0,0 +1,386 @@
|
|
|
1
|
+
import { _ as projectRuntimeRoot, d as withRuntimeSetup, g as loadProjectCore, h as importProjectRuntimeModule, m as ProjectRuntimeResolutionError, u as withRuntimeConnection, y as __exportAll } from "./tools-ma2JFPVY.js";
|
|
2
|
+
import { existsSync, readFileSync, statSync } from "node:fs";
|
|
3
|
+
import { basename, isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
4
|
+
//#region src/tools/runtime/boot.ts
|
|
5
|
+
/**
|
|
6
|
+
* Confined runtime bootstrap for the Level 2 observation plane (#1831).
|
|
7
|
+
*
|
|
8
|
+
* "Booting" here means registering *manifests* into the in-process
|
|
9
|
+
* `ObjectRegistry` — the project's own `.smrt/manifest.json` (or built
|
|
10
|
+
* `dist/manifest.json`) plus every installed SMRT package manifest that the
|
|
11
|
+
* project's dependency tree resolves to. No project source is imported, no
|
|
12
|
+
* module is executed, no database is touched. That confinement is the safety
|
|
13
|
+
* boundary: an observing agent sees what the runtime *would* register, never
|
|
14
|
+
* what arbitrary project code does on import.
|
|
15
|
+
*
|
|
16
|
+
* The registry is a process-global singleton, so a process boots once. There
|
|
17
|
+
* is deliberately no re-boot tool; restart the process to observe a rebuilt
|
|
18
|
+
* manifest.
|
|
19
|
+
*/
|
|
20
|
+
/** Provenance label for facts read from authored/installed manifests. */
|
|
21
|
+
var DECLARED_PROVENANCE = "declared (manifest)";
|
|
22
|
+
/** Project manifest candidates, most authoritative first. */
|
|
23
|
+
var PROJECT_MANIFEST_CANDIDATES = [".smrt/manifest.json", "dist/manifest.json"];
|
|
24
|
+
function relativePath(projectRoot, path) {
|
|
25
|
+
const rel = relative(projectRoot, path);
|
|
26
|
+
if (rel === ".." || rel.startsWith(`..${sep}`) || isAbsolute(rel)) return basename(path);
|
|
27
|
+
return rel.split(sep).join("/");
|
|
28
|
+
}
|
|
29
|
+
function readManifest(path) {
|
|
30
|
+
try {
|
|
31
|
+
const parsed = JSON.parse(readFileSync(path, "utf8"));
|
|
32
|
+
return parsed && typeof parsed === "object" ? parsed : null;
|
|
33
|
+
} catch {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
function registerManifest(ObjectRegistry, manifest, fallbackPackageName) {
|
|
38
|
+
const manifestPackageName = typeof manifest.packageName === "string" && manifest.packageName ? manifest.packageName : fallbackPackageName ?? void 0;
|
|
39
|
+
let count = 0;
|
|
40
|
+
for (const [name, definition] of Object.entries(manifest.objects ?? {})) {
|
|
41
|
+
if (!definition || typeof definition !== "object") continue;
|
|
42
|
+
const ownPackage = definition.packageName;
|
|
43
|
+
ObjectRegistry.registerFromManifest(name, definition, typeof ownPackage === "string" && ownPackage ? ownPackage : manifestPackageName);
|
|
44
|
+
count += 1;
|
|
45
|
+
}
|
|
46
|
+
return count;
|
|
47
|
+
}
|
|
48
|
+
var booting = null;
|
|
49
|
+
var booted = null;
|
|
50
|
+
var bootedProjectRoot = null;
|
|
51
|
+
var bootedProjectManifestPath = null;
|
|
52
|
+
var bootedProjectManifestMtimeMs = null;
|
|
53
|
+
/**
|
|
54
|
+
* Whether the project manifest on disk is newer than the one this process
|
|
55
|
+
* booted. The registry is process-global and boots once, so this is the only
|
|
56
|
+
* signal an agent has that a rebuild happened underneath it.
|
|
57
|
+
*/
|
|
58
|
+
function getBootStaleness() {
|
|
59
|
+
if (!booted || !bootedProjectManifestPath) return {
|
|
60
|
+
stale: false,
|
|
61
|
+
bootedAt: booted?.bootedAt ?? null,
|
|
62
|
+
manifestModifiedAt: null
|
|
63
|
+
};
|
|
64
|
+
try {
|
|
65
|
+
const mtimeMs = statSync(bootedProjectManifestPath).mtimeMs;
|
|
66
|
+
return {
|
|
67
|
+
stale: bootedProjectManifestMtimeMs !== null && mtimeMs > bootedProjectManifestMtimeMs,
|
|
68
|
+
bootedAt: booted.bootedAt,
|
|
69
|
+
manifestModifiedAt: new Date(mtimeMs).toISOString()
|
|
70
|
+
};
|
|
71
|
+
} catch {
|
|
72
|
+
return {
|
|
73
|
+
stale: false,
|
|
74
|
+
bootedAt: booted.bootedAt,
|
|
75
|
+
manifestModifiedAt: null
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* The resolved root the process booted from. Consumers must relativize
|
|
81
|
+
* paths against *this* root, never a per-request argument, or a caller could
|
|
82
|
+
* widen the root (e.g. `/`) and read the layout back through "relative" paths.
|
|
83
|
+
*/
|
|
84
|
+
function getBootedProjectRoot() {
|
|
85
|
+
return bootedProjectRoot;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Boot the confined runtime once per process. A second call returns the
|
|
89
|
+
* existing record without touching the registry.
|
|
90
|
+
*/
|
|
91
|
+
async function bootRuntime(options = {}) {
|
|
92
|
+
const projectRoot = resolve(options.projectRoot ?? process.cwd());
|
|
93
|
+
if (bootedProjectRoot && projectRuntimeRoot(bootedProjectRoot) !== projectRuntimeRoot(projectRoot)) throw new ProjectRuntimeResolutionError("@happyvertical/smrt-core", "runtime_project_mismatch");
|
|
94
|
+
if (booted) return booted;
|
|
95
|
+
if (booting) return booting;
|
|
96
|
+
bootedProjectRoot = projectRoot;
|
|
97
|
+
booting = performBoot(projectRoot, options).catch((error) => {
|
|
98
|
+
booting = null;
|
|
99
|
+
bootedProjectRoot = null;
|
|
100
|
+
throw error;
|
|
101
|
+
});
|
|
102
|
+
return booting;
|
|
103
|
+
}
|
|
104
|
+
async function performBoot(projectRoot, options) {
|
|
105
|
+
const { ObjectRegistry } = await loadProjectCore(projectRoot);
|
|
106
|
+
const { discoverSmrtPackages, resolveManifestPath } = await importProjectRuntimeModule(projectRoot, "@happyvertical/smrt-core/manifest/discover-smrt-packages");
|
|
107
|
+
if (typeof ObjectRegistry?.registerFromManifest !== "function" || typeof discoverSmrtPackages !== "function" || typeof resolveManifestPath !== "function") throw new ProjectRuntimeResolutionError("@happyvertical/smrt-core");
|
|
108
|
+
const diagnostics = [];
|
|
109
|
+
const manifests = [];
|
|
110
|
+
const projectManifestPath = PROJECT_MANIFEST_CANDIDATES.map((candidate) => join(projectRoot, candidate)).find((path) => existsSync(path));
|
|
111
|
+
const projectPackageName = readProjectPackageName(projectRoot);
|
|
112
|
+
if (!projectManifestPath) diagnostics.push({
|
|
113
|
+
severity: "warning",
|
|
114
|
+
code: "project_manifest_missing",
|
|
115
|
+
message: "No project manifest found (.smrt/manifest.json or dist/manifest.json); run the project build so the runtime manifest exists."
|
|
116
|
+
});
|
|
117
|
+
else {
|
|
118
|
+
const manifest = readManifest(projectManifestPath);
|
|
119
|
+
if (!manifest) diagnostics.push({
|
|
120
|
+
severity: "error",
|
|
121
|
+
code: "project_manifest_invalid",
|
|
122
|
+
message: `Project manifest at ${relativePath(projectRoot, projectManifestPath)} is not valid JSON.`
|
|
123
|
+
});
|
|
124
|
+
else manifests.push({
|
|
125
|
+
kind: "project",
|
|
126
|
+
packageName: typeof manifest.packageName === "string" ? manifest.packageName : projectPackageName,
|
|
127
|
+
path: relativePath(projectRoot, projectManifestPath),
|
|
128
|
+
objectCount: registerManifest(ObjectRegistry, manifest, projectPackageName)
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
let dependencyNames = [];
|
|
132
|
+
try {
|
|
133
|
+
dependencyNames = discoverSmrtPackages({
|
|
134
|
+
baseDir: projectRoot,
|
|
135
|
+
noCache: true
|
|
136
|
+
});
|
|
137
|
+
} catch (error) {
|
|
138
|
+
diagnostics.push({
|
|
139
|
+
severity: "warning",
|
|
140
|
+
code: "dependency_discovery_failed",
|
|
141
|
+
message: `Installed SMRT package discovery failed: ${error instanceof Error ? error.message : "unknown error"}`
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
for (const dependency of dependencyNames.sort()) {
|
|
145
|
+
const manifestPath = resolveManifestPath(dependency, projectRoot);
|
|
146
|
+
if (!manifestPath) {
|
|
147
|
+
diagnostics.push({
|
|
148
|
+
severity: "info",
|
|
149
|
+
code: "dependency_manifest_missing",
|
|
150
|
+
message: `Installed SMRT package ${dependency} exposes no runtime manifest.`
|
|
151
|
+
});
|
|
152
|
+
continue;
|
|
153
|
+
}
|
|
154
|
+
const manifest = readManifest(manifestPath);
|
|
155
|
+
if (!manifest) {
|
|
156
|
+
diagnostics.push({
|
|
157
|
+
severity: "warning",
|
|
158
|
+
code: "dependency_manifest_invalid",
|
|
159
|
+
message: `Manifest for ${dependency} is not valid JSON.`
|
|
160
|
+
});
|
|
161
|
+
continue;
|
|
162
|
+
}
|
|
163
|
+
manifests.push({
|
|
164
|
+
kind: "dependency",
|
|
165
|
+
packageName: dependency,
|
|
166
|
+
path: relativePath(projectRoot, manifestPath),
|
|
167
|
+
objectCount: registerManifest(ObjectRegistry, manifest, dependency)
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
bootedProjectRoot = projectRoot;
|
|
171
|
+
if (projectManifestPath) {
|
|
172
|
+
bootedProjectManifestPath = projectManifestPath;
|
|
173
|
+
try {
|
|
174
|
+
bootedProjectManifestMtimeMs = statSync(projectManifestPath).mtimeMs;
|
|
175
|
+
} catch {
|
|
176
|
+
bootedProjectManifestMtimeMs = null;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
booted = {
|
|
180
|
+
provenance: DECLARED_PROVENANCE,
|
|
181
|
+
bootedAt: (options.now ?? /* @__PURE__ */ new Date()).toISOString(),
|
|
182
|
+
projectName: projectPackageName ?? basename(projectRoot),
|
|
183
|
+
manifests,
|
|
184
|
+
objectCount: manifests.reduce((sum, m) => sum + m.objectCount, 0),
|
|
185
|
+
diagnostics
|
|
186
|
+
};
|
|
187
|
+
return booted;
|
|
188
|
+
}
|
|
189
|
+
function readProjectPackageName(projectRoot) {
|
|
190
|
+
try {
|
|
191
|
+
const parsed = JSON.parse(readFileSync(join(projectRoot, "package.json"), "utf8"));
|
|
192
|
+
return typeof parsed.name === "string" && parsed.name ? parsed.name : null;
|
|
193
|
+
} catch {
|
|
194
|
+
return null;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
//#endregion
|
|
198
|
+
//#region src/tools/runtime/observation.ts
|
|
199
|
+
var observation_exports = /* @__PURE__ */ __exportAll({
|
|
200
|
+
REGISTRY_PAGE_LIMIT: () => 50,
|
|
201
|
+
runtimeObject: () => runtimeObject,
|
|
202
|
+
runtimeRegistry: () => runtimeRegistry,
|
|
203
|
+
runtimeSchemaDiff: () => runtimeSchemaDiff
|
|
204
|
+
});
|
|
205
|
+
/** Row budget for `runtime-schema-diff` change lists. */
|
|
206
|
+
var SCHEMA_DIFF_CHANGE_LIMIT = 200;
|
|
207
|
+
function bootDiagnostics(boot) {
|
|
208
|
+
return boot.diagnostics.filter((d) => d.severity !== "info").map((d) => ({
|
|
209
|
+
severity: d.severity === "error" ? "warning" : d.severity,
|
|
210
|
+
code: `boot_${d.code}`,
|
|
211
|
+
message: d.message
|
|
212
|
+
}));
|
|
213
|
+
}
|
|
214
|
+
var bootPreambleSent = false;
|
|
215
|
+
/**
|
|
216
|
+
* The full manifest list is emitted once per process; later envelopes carry
|
|
217
|
+
* only the identifying fields. Every runtime response re-embedding the same
|
|
218
|
+
* multi-manifest block was pure repetition for an agent.
|
|
219
|
+
*/
|
|
220
|
+
function bootSummary(boot) {
|
|
221
|
+
const compact = {
|
|
222
|
+
provenance: boot.provenance,
|
|
223
|
+
bootedAt: boot.bootedAt,
|
|
224
|
+
projectName: boot.projectName,
|
|
225
|
+
objectCount: boot.objectCount,
|
|
226
|
+
manifestCount: boot.manifests.length
|
|
227
|
+
};
|
|
228
|
+
if (bootPreambleSent) return compact;
|
|
229
|
+
bootPreambleSent = true;
|
|
230
|
+
return {
|
|
231
|
+
...compact,
|
|
232
|
+
manifests: boot.manifests
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
function stalenessDiagnostics() {
|
|
236
|
+
const staleness = getBootStaleness();
|
|
237
|
+
if (!staleness.stale) return [];
|
|
238
|
+
return [{
|
|
239
|
+
severity: "warning",
|
|
240
|
+
code: "manifest_newer_than_boot",
|
|
241
|
+
message: `The project manifest changed at ${staleness.manifestModifiedAt} after this process booted at ${staleness.bootedAt}; restart the server to observe the rebuilt registry.`
|
|
242
|
+
}];
|
|
243
|
+
}
|
|
244
|
+
function objectKey(object) {
|
|
245
|
+
return object.qualifiedName ?? object.name;
|
|
246
|
+
}
|
|
247
|
+
/** `runtime-registry`: sanitized snapshot of the booted registry. */
|
|
248
|
+
async function runtimeRegistryFromProject(args = {}) {
|
|
249
|
+
const boot = await bootRuntime({ projectRoot: args.projectPath });
|
|
250
|
+
const { snapshotRegistry } = await loadProjectCore(args.projectPath);
|
|
251
|
+
if (typeof snapshotRegistry !== "function") throw new ProjectRuntimeResolutionError("@happyvertical/smrt-core");
|
|
252
|
+
const snapshot = snapshotRegistry({
|
|
253
|
+
projectRoot: getBootedProjectRoot() ?? void 0,
|
|
254
|
+
objects: args.objects,
|
|
255
|
+
detail: args.detail ?? Boolean(args.objects?.length)
|
|
256
|
+
});
|
|
257
|
+
const limit = Math.min(Math.max(Math.floor(args.limit ?? 50), 1), 500);
|
|
258
|
+
const cursor = typeof args.cursor === "string" && args.cursor.length > 0 ? args.cursor : null;
|
|
259
|
+
const all = snapshot.objects;
|
|
260
|
+
const afterCursor = cursor ? all.filter((object) => objectKey(object).localeCompare(cursor) > 0) : all;
|
|
261
|
+
const objects = afterCursor.slice(0, limit);
|
|
262
|
+
const nextCursor = afterCursor.length > objects.length && objects.length > 0 ? objectKey(objects[objects.length - 1]) : null;
|
|
263
|
+
return {
|
|
264
|
+
ok: true,
|
|
265
|
+
coverage: null,
|
|
266
|
+
diagnostics: [...bootDiagnostics(boot), ...stalenessDiagnostics()],
|
|
267
|
+
data: {
|
|
268
|
+
provenance: snapshot.provenance,
|
|
269
|
+
boot: bootSummary(boot),
|
|
270
|
+
page: {
|
|
271
|
+
returned: objects.length,
|
|
272
|
+
matched: all.length,
|
|
273
|
+
limit,
|
|
274
|
+
cursor,
|
|
275
|
+
nextCursor
|
|
276
|
+
},
|
|
277
|
+
snapshot: {
|
|
278
|
+
...snapshot,
|
|
279
|
+
objects
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
/** `runtime-object`: one object's sanitized definition plus its generated DDL. */
|
|
285
|
+
async function runtimeObjectFromProject(args) {
|
|
286
|
+
const boot = await bootRuntime({ projectRoot: args.projectPath });
|
|
287
|
+
const { ObjectRegistry, snapshotRegistry } = await loadProjectCore(args.projectPath);
|
|
288
|
+
const name = typeof args.name === "string" ? args.name.trim() : "";
|
|
289
|
+
if (typeof snapshotRegistry !== "function") throw new ProjectRuntimeResolutionError("@happyvertical/smrt-core");
|
|
290
|
+
const snapshot = snapshotRegistry({
|
|
291
|
+
projectRoot: getBootedProjectRoot() ?? void 0,
|
|
292
|
+
objects: name ? [name] : [],
|
|
293
|
+
detail: true
|
|
294
|
+
});
|
|
295
|
+
const diagnostics = [...bootDiagnostics(boot), ...stalenessDiagnostics()];
|
|
296
|
+
let object = snapshot.objects[0] ?? null;
|
|
297
|
+
if (snapshot.objects.length > 1) {
|
|
298
|
+
object = null;
|
|
299
|
+
diagnostics.push({
|
|
300
|
+
severity: "warning",
|
|
301
|
+
code: "object_ambiguous",
|
|
302
|
+
message: `${name} is registered by several packages; pass a qualified name: ${snapshot.objects.map((candidate) => candidate.qualifiedName ?? candidate.name).join(", ")}`
|
|
303
|
+
});
|
|
304
|
+
} else if (!object) diagnostics.push({
|
|
305
|
+
severity: "warning",
|
|
306
|
+
code: "object_not_found",
|
|
307
|
+
message: name ? `No booted object named ${name}; use runtime-registry to list names.` : "name is required."
|
|
308
|
+
});
|
|
309
|
+
let ddl = null;
|
|
310
|
+
if (object) try {
|
|
311
|
+
ddl = ObjectRegistry.getSchemaDDL(object.qualifiedName ?? object.name, args.engine) ?? null;
|
|
312
|
+
} catch (error) {
|
|
313
|
+
diagnostics.push({
|
|
314
|
+
severity: "warning",
|
|
315
|
+
code: "ddl_unavailable",
|
|
316
|
+
message: `Generated DDL unavailable: ${error instanceof Error ? error.message : "unknown error"}`
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
return {
|
|
320
|
+
ok: true,
|
|
321
|
+
coverage: null,
|
|
322
|
+
diagnostics,
|
|
323
|
+
data: {
|
|
324
|
+
provenance: snapshot.provenance,
|
|
325
|
+
boot: bootSummary(boot),
|
|
326
|
+
object,
|
|
327
|
+
ddl
|
|
328
|
+
}
|
|
329
|
+
};
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* `runtime-schema-diff`: booted registry schemas versus the live database,
|
|
333
|
+
* using the same comparer `db:diff`/`db:migrate` use. Introspection only —
|
|
334
|
+
* drop/relax options are pinned off and nothing is executed.
|
|
335
|
+
*/
|
|
336
|
+
async function runtimeSchemaDiffFromProject(args = {}) {
|
|
337
|
+
const boot = await bootRuntime({ projectRoot: args.projectPath });
|
|
338
|
+
const { ObjectRegistry } = await loadProjectCore(args.projectPath);
|
|
339
|
+
const envelope = await withRuntimeConnection(args, async (db) => {
|
|
340
|
+
const { SchemaComparer } = await importProjectRuntimeModule(args.projectPath, "@happyvertical/smrt-core/migrations");
|
|
341
|
+
if (typeof SchemaComparer !== "function") throw new ProjectRuntimeResolutionError("@happyvertical/smrt-core/migrations");
|
|
342
|
+
const diff = await new SchemaComparer(db, {
|
|
343
|
+
includeDroppedTables: false,
|
|
344
|
+
includeDroppedColumns: false,
|
|
345
|
+
includeDroppedIndexes: false,
|
|
346
|
+
relaxColumns: false
|
|
347
|
+
}).compare(ObjectRegistry.getAllSchemasAsDefinitions());
|
|
348
|
+
const byType = {};
|
|
349
|
+
for (const change of diff.changes) {
|
|
350
|
+
const type = String(change.type ?? "unknown");
|
|
351
|
+
byType[type] = (byType[type] ?? 0) + 1;
|
|
352
|
+
}
|
|
353
|
+
const addedTables = diff.added_tables.map((t) => t.tableName);
|
|
354
|
+
if (addedTables.length > 0) byType.add_table = addedTables.length;
|
|
355
|
+
if (diff.dropped_tables.length > 0) byType.drop_table = diff.dropped_tables.length;
|
|
356
|
+
const changeCount = diff.changes.length + addedTables.length + diff.dropped_tables.length;
|
|
357
|
+
return {
|
|
358
|
+
data: {
|
|
359
|
+
boot: bootSummary(boot),
|
|
360
|
+
hasChanges: diff.has_changes,
|
|
361
|
+
addedTables,
|
|
362
|
+
droppedTables: diff.dropped_tables,
|
|
363
|
+
orphanTables: diff.orphan_tables ?? [],
|
|
364
|
+
changeCount,
|
|
365
|
+
columnChangeCount: diff.changes.length,
|
|
366
|
+
changesByType: byType,
|
|
367
|
+
changes: diff.changes.slice(0, SCHEMA_DIFF_CHANGE_LIMIT),
|
|
368
|
+
truncated: diff.changes.length > SCHEMA_DIFF_CHANGE_LIMIT
|
|
369
|
+
},
|
|
370
|
+
diagnostics: []
|
|
371
|
+
};
|
|
372
|
+
}, "booted registry schemas only; connect a dev database to diff against live tables");
|
|
373
|
+
envelope.diagnostics = [
|
|
374
|
+
...bootDiagnostics(boot),
|
|
375
|
+
...stalenessDiagnostics(),
|
|
376
|
+
...envelope.diagnostics
|
|
377
|
+
];
|
|
378
|
+
return envelope;
|
|
379
|
+
}
|
|
380
|
+
var runtimeRegistry = (args = {}) => withRuntimeSetup(() => runtimeRegistryFromProject(args));
|
|
381
|
+
var runtimeObject = (args) => withRuntimeSetup(() => runtimeObjectFromProject(args));
|
|
382
|
+
var runtimeSchemaDiff = (args = {}) => withRuntimeSetup(() => runtimeSchemaDiffFromProject(args));
|
|
383
|
+
//#endregion
|
|
384
|
+
export { bootRuntime as a, runtimeSchemaDiff as i, runtimeObject as n, runtimeRegistry as r, observation_exports as t };
|
|
385
|
+
|
|
386
|
+
//# sourceMappingURL=observation-CqE0tBgS.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"observation-CqE0tBgS.js","names":[],"sources":["../src/tools/runtime/boot.ts","../src/tools/runtime/observation.ts"],"sourcesContent":["/**\n * Confined runtime bootstrap for the Level 2 observation plane (#1831).\n *\n * \"Booting\" here means registering *manifests* into the in-process\n * `ObjectRegistry` — the project's own `.smrt/manifest.json` (or built\n * `dist/manifest.json`) plus every installed SMRT package manifest that the\n * project's dependency tree resolves to. No project source is imported, no\n * module is executed, no database is touched. That confinement is the safety\n * boundary: an observing agent sees what the runtime *would* register, never\n * what arbitrary project code does on import.\n *\n * The registry is a process-global singleton, so a process boots once. There\n * is deliberately no re-boot tool; restart the process to observe a rebuilt\n * manifest.\n */\n\nimport { existsSync, readFileSync, statSync } from 'node:fs';\nimport { basename, isAbsolute, join, relative, resolve, sep } from 'node:path';\nimport {\n importProjectRuntimeModule,\n loadProjectCore,\n ProjectRuntimeResolutionError,\n projectRuntimeRoot,\n resetProjectRuntimeForTests,\n} from './project-runtime.js';\n\n/** Provenance label for facts read from authored/installed manifests. */\nexport const DECLARED_PROVENANCE = 'declared (manifest)';\n\n/** Project manifest candidates, most authoritative first. */\nconst PROJECT_MANIFEST_CANDIDATES = [\n '.smrt/manifest.json',\n 'dist/manifest.json',\n] as const;\n\nexport interface BootDiagnostic {\n severity: 'info' | 'warning' | 'error';\n code: string;\n message: string;\n}\n\nexport interface BootedManifest {\n /** `project` for the project's own manifest, `dependency` for installed packages. */\n kind: 'project' | 'dependency';\n packageName: string | null;\n /** Path relative to the project root (never absolute). */\n path: string;\n objectCount: number;\n}\n\nexport interface RuntimeBoot {\n provenance: typeof DECLARED_PROVENANCE;\n bootedAt: string;\n /** Basename only; the absolute project root never leaves the process. */\n projectName: string;\n manifests: BootedManifest[];\n objectCount: number;\n diagnostics: BootDiagnostic[];\n}\n\ninterface ManifestLike {\n packageName?: unknown;\n moduleType?: unknown;\n objects?: Record<string, unknown>;\n}\n\nfunction relativePath(projectRoot: string, path: string): string {\n const rel = relative(projectRoot, path);\n // Anything outside the root — the parent itself, a `..` walk, or a path on\n // another drive (Windows keeps those absolute) — is reduced to a basename.\n if (rel === '..' || rel.startsWith(`..${sep}`) || isAbsolute(rel)) {\n return basename(path);\n }\n return rel.split(sep).join('/');\n}\n\nfunction readManifest(path: string): ManifestLike | null {\n try {\n const parsed = JSON.parse(readFileSync(path, 'utf8')) as unknown;\n return parsed && typeof parsed === 'object'\n ? (parsed as ManifestLike)\n : null;\n } catch {\n return null;\n }\n}\n\nfunction registerManifest(\n ObjectRegistry: typeof import('@happyvertical/smrt-core').ObjectRegistry,\n manifest: ManifestLike,\n fallbackPackageName: string | null,\n): number {\n const manifestPackageName =\n typeof manifest.packageName === 'string' && manifest.packageName\n ? manifest.packageName\n : (fallbackPackageName ?? undefined);\n let count = 0;\n for (const [name, definition] of Object.entries(manifest.objects ?? {})) {\n if (!definition || typeof definition !== 'object') continue;\n // An aggregate project manifest (consumer plugin output) carries\n // dependency objects that keep their own `packageName`; registering them\n // under the app's name would mint false `@app:Object` identities that\n // collide with the dependency's own manifest. Per-object ownership wins.\n const ownPackage = (definition as { packageName?: unknown }).packageName;\n ObjectRegistry.registerFromManifest(\n name,\n definition as Parameters<typeof ObjectRegistry.registerFromManifest>[1],\n typeof ownPackage === 'string' && ownPackage\n ? ownPackage\n : manifestPackageName,\n );\n count += 1;\n }\n return count;\n}\n\nlet booting: Promise<RuntimeBoot> | null = null;\nlet booted: RuntimeBoot | null = null;\nlet bootedProjectRoot: string | null = null;\nlet bootedProjectManifestPath: string | null = null;\nlet bootedProjectManifestMtimeMs: number | null = null;\n\n/**\n * Whether the project manifest on disk is newer than the one this process\n * booted. The registry is process-global and boots once, so this is the only\n * signal an agent has that a rebuild happened underneath it.\n */\nexport function getBootStaleness(): {\n stale: boolean;\n bootedAt: string | null;\n manifestModifiedAt: string | null;\n} {\n if (!booted || !bootedProjectManifestPath) {\n return {\n stale: false,\n bootedAt: booted?.bootedAt ?? null,\n manifestModifiedAt: null,\n };\n }\n try {\n const mtimeMs = statSync(bootedProjectManifestPath).mtimeMs;\n return {\n stale:\n bootedProjectManifestMtimeMs !== null &&\n mtimeMs > bootedProjectManifestMtimeMs,\n bootedAt: booted.bootedAt,\n manifestModifiedAt: new Date(mtimeMs).toISOString(),\n };\n } catch {\n return {\n stale: false,\n bootedAt: booted.bootedAt,\n manifestModifiedAt: null,\n };\n }\n}\n\n/** The boot record for this process, or `null` before {@link bootRuntime}. */\nexport function getRuntimeBoot(): RuntimeBoot | null {\n return booted;\n}\n\n/**\n * The resolved root the process booted from. Consumers must relativize\n * paths against *this* root, never a per-request argument, or a caller could\n * widen the root (e.g. `/`) and read the layout back through \"relative\" paths.\n */\nexport function getBootedProjectRoot(): string | null {\n return bootedProjectRoot;\n}\n\n/** Test seam: forget the boot record (the registry itself is cleared by the caller). */\nexport function resetRuntimeBootForTests(): void {\n resetProjectRuntimeForTests();\n booting = null;\n booted = null;\n bootedProjectRoot = null;\n bootedProjectManifestPath = null;\n bootedProjectManifestMtimeMs = null;\n}\n\nexport interface BootRuntimeOptions {\n projectRoot?: string;\n /** Clock for `bootedAt` (defaults to `new Date()`). */\n now?: Date;\n}\n\n/**\n * Boot the confined runtime once per process. A second call returns the\n * existing record without touching the registry.\n */\nexport async function bootRuntime(\n options: BootRuntimeOptions = {},\n): Promise<RuntimeBoot> {\n const projectRoot = resolve(options.projectRoot ?? process.cwd());\n if (\n bootedProjectRoot &&\n projectRuntimeRoot(bootedProjectRoot) !== projectRuntimeRoot(projectRoot)\n ) {\n throw new ProjectRuntimeResolutionError(\n '@happyvertical/smrt-core',\n 'runtime_project_mismatch',\n );\n }\n if (booted) return booted;\n if (booting) return booting;\n bootedProjectRoot = projectRoot;\n booting = performBoot(projectRoot, options).catch((error) => {\n booting = null;\n bootedProjectRoot = null;\n throw error;\n });\n return booting;\n}\n\nasync function performBoot(\n projectRoot: string,\n options: BootRuntimeOptions,\n): Promise<RuntimeBoot> {\n const { ObjectRegistry } = await loadProjectCore(projectRoot);\n const { discoverSmrtPackages, resolveManifestPath } =\n await importProjectRuntimeModule<\n typeof import('@happyvertical/smrt-core/manifest/discover-smrt-packages')\n >(projectRoot, '@happyvertical/smrt-core/manifest/discover-smrt-packages');\n if (\n typeof ObjectRegistry?.registerFromManifest !== 'function' ||\n typeof discoverSmrtPackages !== 'function' ||\n typeof resolveManifestPath !== 'function'\n ) {\n throw new ProjectRuntimeResolutionError('@happyvertical/smrt-core');\n }\n const diagnostics: BootDiagnostic[] = [];\n const manifests: BootedManifest[] = [];\n\n const projectManifestPath = PROJECT_MANIFEST_CANDIDATES.map((candidate) =>\n join(projectRoot, candidate),\n ).find((path) => existsSync(path));\n const projectPackageName = readProjectPackageName(projectRoot);\n\n if (!projectManifestPath) {\n diagnostics.push({\n severity: 'warning',\n code: 'project_manifest_missing',\n message:\n 'No project manifest found (.smrt/manifest.json or dist/manifest.json); run the project build so the runtime manifest exists.',\n });\n } else {\n const manifest = readManifest(projectManifestPath);\n if (!manifest) {\n diagnostics.push({\n severity: 'error',\n code: 'project_manifest_invalid',\n message: `Project manifest at ${relativePath(projectRoot, projectManifestPath)} is not valid JSON.`,\n });\n } else {\n manifests.push({\n kind: 'project',\n packageName:\n typeof manifest.packageName === 'string'\n ? manifest.packageName\n : projectPackageName,\n path: relativePath(projectRoot, projectManifestPath),\n objectCount: registerManifest(\n ObjectRegistry,\n manifest,\n projectPackageName,\n ),\n });\n }\n }\n\n let dependencyNames: string[] = [];\n try {\n // `noCache` keeps discovery from writing `.smrt/discovery-cache.json`:\n // observing a project must never dirty it.\n dependencyNames = discoverSmrtPackages({\n baseDir: projectRoot,\n noCache: true,\n });\n } catch (error) {\n diagnostics.push({\n severity: 'warning',\n code: 'dependency_discovery_failed',\n message: `Installed SMRT package discovery failed: ${error instanceof Error ? error.message : 'unknown error'}`,\n });\n }\n for (const dependency of dependencyNames.sort()) {\n const manifestPath = resolveManifestPath(dependency, projectRoot);\n if (!manifestPath) {\n diagnostics.push({\n severity: 'info',\n code: 'dependency_manifest_missing',\n message: `Installed SMRT package ${dependency} exposes no runtime manifest.`,\n });\n continue;\n }\n const manifest = readManifest(manifestPath);\n if (!manifest) {\n diagnostics.push({\n severity: 'warning',\n code: 'dependency_manifest_invalid',\n message: `Manifest for ${dependency} is not valid JSON.`,\n });\n continue;\n }\n manifests.push({\n kind: 'dependency',\n packageName: dependency,\n path: relativePath(projectRoot, manifestPath),\n objectCount: registerManifest(ObjectRegistry, manifest, dependency),\n });\n }\n\n bootedProjectRoot = projectRoot;\n if (projectManifestPath) {\n bootedProjectManifestPath = projectManifestPath;\n try {\n bootedProjectManifestMtimeMs = statSync(projectManifestPath).mtimeMs;\n } catch {\n bootedProjectManifestMtimeMs = null;\n }\n }\n booted = {\n provenance: DECLARED_PROVENANCE,\n bootedAt: (options.now ?? new Date()).toISOString(),\n projectName: projectPackageName ?? basename(projectRoot),\n manifests,\n objectCount: manifests.reduce((sum, m) => sum + m.objectCount, 0),\n diagnostics,\n };\n return booted;\n}\n\nfunction readProjectPackageName(projectRoot: string): string | null {\n try {\n const parsed = JSON.parse(\n readFileSync(join(projectRoot, 'package.json'), 'utf8'),\n ) as { name?: unknown };\n return typeof parsed.name === 'string' && parsed.name ? parsed.name : null;\n } catch {\n return null;\n }\n}\n","/**\n * Level 2 read-only observation tools over the booted runtime (#1831).\n *\n * Three facts planes, labelled separately in every envelope:\n * - `declared (manifest)`: what the confined boot registered ({@link bootRuntime});\n * - `booted (registry)`: the in-process `ObjectRegistry` projected through the\n * sanitized {@link snapshotRegistry} DTO;\n * - `runtime (live DB)`: the optional read-only connection, reused from Level 1.\n *\n * Nothing here mutates: no writes, no `do()`, no generated CRUD, no project\n * code execution. `runtime-schema-diff` only *introspects* the live schema.\n */\n\nimport type { RegistrySnapshotObject } from '@happyvertical/smrt-core';\nimport {\n bootRuntime,\n getBootedProjectRoot,\n getBootStaleness,\n type RuntimeBoot,\n} from './boot.js';\nimport type { RuntimeDatabaseArgs } from './connection.js';\nimport {\n importProjectRuntimeModule,\n loadProjectCore,\n ProjectRuntimeResolutionError,\n} from './project-runtime.js';\nimport {\n type RuntimeDiagnostic,\n type RuntimeToolEnvelope,\n withRuntimeConnection,\n withRuntimeSetup,\n} from './tools.js';\n\n/** Row budget for `runtime-schema-diff` change lists. */\nconst SCHEMA_DIFF_CHANGE_LIMIT = 200;\n\nexport interface RuntimeProjectArgs {\n /** Project root to boot from (defaults to the server's cwd). */\n projectPath?: string;\n}\n\nfunction bootDiagnostics(boot: RuntimeBoot): RuntimeDiagnostic[] {\n return boot.diagnostics\n .filter((d) => d.severity !== 'info')\n .map((d) => ({\n severity: d.severity === 'error' ? 'warning' : d.severity,\n code: `boot_${d.code}`,\n message: d.message,\n }));\n}\n\nlet bootPreambleSent = false;\n\n/**\n * The full manifest list is emitted once per process; later envelopes carry\n * only the identifying fields. Every runtime response re-embedding the same\n * multi-manifest block was pure repetition for an agent.\n */\nfunction bootSummary(boot: RuntimeBoot) {\n const compact = {\n provenance: boot.provenance,\n bootedAt: boot.bootedAt,\n projectName: boot.projectName,\n objectCount: boot.objectCount,\n manifestCount: boot.manifests.length,\n };\n if (bootPreambleSent) return compact;\n bootPreambleSent = true;\n return { ...compact, manifests: boot.manifests };\n}\n\n/** Test seam paired with `resetRuntimeBootForTests()`. */\nexport function resetBootPreambleForTests(): void {\n bootPreambleSent = false;\n}\n\nfunction stalenessDiagnostics(): RuntimeDiagnostic[] {\n const staleness = getBootStaleness();\n if (!staleness.stale) return [];\n return [\n {\n severity: 'warning',\n code: 'manifest_newer_than_boot',\n message: `The project manifest changed at ${staleness.manifestModifiedAt} after this process booted at ${staleness.bootedAt}; restart the server to observe the rebuilt registry.`,\n },\n ];\n}\n\nexport interface RuntimeRegistryArgs extends RuntimeProjectArgs {\n /** Restrict object detail to these simple or qualified names. */\n objects?: string[];\n /** Include field/method detail (default: only when `objects` is given). */\n detail?: boolean;\n /**\n * Resume after this object key: the qualified name when the object has\n * one, otherwise its simple name — exactly the value a previous response\n * returned as `page.nextCursor` (#2779). Objects are sorted by that key.\n */\n cursor?: string;\n /** Objects per page (default {@link REGISTRY_PAGE_LIMIT}, max 500). */\n limit?: number;\n}\n\n/** Default objects per `runtime-registry` page. */\nexport const REGISTRY_PAGE_LIMIT = 50;\n\nfunction objectKey(object: {\n qualifiedName: string | null;\n name: string;\n}): string {\n return object.qualifiedName ?? object.name;\n}\n\n/** `runtime-registry`: sanitized snapshot of the booted registry. */\nasync function runtimeRegistryFromProject(\n args: RuntimeRegistryArgs = {},\n): Promise<RuntimeToolEnvelope> {\n const boot = await bootRuntime({ projectRoot: args.projectPath });\n const { snapshotRegistry } = await loadProjectCore(args.projectPath);\n // Paths are relativized against the root the process actually booted from,\n // never the per-request argument (which is ignored after the first boot).\n if (typeof snapshotRegistry !== 'function')\n throw new ProjectRuntimeResolutionError('@happyvertical/smrt-core');\n const snapshot = snapshotRegistry({\n projectRoot: getBootedProjectRoot() ?? undefined,\n objects: args.objects,\n detail: args.detail ?? Boolean(args.objects?.length),\n });\n // Page the object list (summary stays global). A 76-object app answered in\n // 56 KB before paging; an agent hunting one class needs a cursor, not a cut.\n const limit = Math.min(\n Math.max(Math.floor(args.limit ?? REGISTRY_PAGE_LIMIT), 1),\n 500,\n );\n // The cursor is compared against the same key `page.nextCursor` carries.\n const cursor =\n typeof args.cursor === 'string' && args.cursor.length > 0\n ? args.cursor\n : null;\n const all = snapshot.objects;\n const afterCursor = cursor\n ? all.filter((object) => objectKey(object).localeCompare(cursor) > 0)\n : all;\n const objects = afterCursor.slice(0, limit);\n const nextCursor =\n afterCursor.length > objects.length && objects.length > 0\n ? objectKey(objects[objects.length - 1])\n : null;\n return {\n ok: true,\n coverage: null,\n diagnostics: [...bootDiagnostics(boot), ...stalenessDiagnostics()],\n data: {\n provenance: snapshot.provenance,\n boot: bootSummary(boot),\n page: {\n returned: objects.length,\n matched: all.length,\n limit,\n cursor,\n nextCursor,\n },\n snapshot: { ...snapshot, objects },\n },\n };\n}\n\nexport interface RuntimeObjectArgs extends RuntimeProjectArgs {\n /** Simple or qualified object name. */\n name: string;\n /** Engine for the generated DDL preview (default: the registry's default). */\n engine?: 'sqlite' | 'postgres' | 'duckdb';\n}\n\n/** `runtime-object`: one object's sanitized definition plus its generated DDL. */\nasync function runtimeObjectFromProject(\n args: RuntimeObjectArgs,\n): Promise<RuntimeToolEnvelope> {\n const boot = await bootRuntime({ projectRoot: args.projectPath });\n const { ObjectRegistry, snapshotRegistry } = await loadProjectCore(\n args.projectPath,\n );\n const name = typeof args.name === 'string' ? args.name.trim() : '';\n if (typeof snapshotRegistry !== 'function')\n throw new ProjectRuntimeResolutionError('@happyvertical/smrt-core');\n const snapshot = snapshotRegistry({\n projectRoot: getBootedProjectRoot() ?? undefined,\n objects: name ? [name] : [],\n detail: true,\n });\n const diagnostics = [...bootDiagnostics(boot), ...stalenessDiagnostics()];\n let object: RegistrySnapshotObject | null = snapshot.objects[0] ?? null;\n if (snapshot.objects.length > 1) {\n // Two packages registering the same simple name is legal; picking one\n // silently would misreport identity. Ask for the qualified name instead.\n object = null;\n diagnostics.push({\n severity: 'warning',\n code: 'object_ambiguous',\n message: `${name} is registered by several packages; pass a qualified name: ${snapshot.objects\n .map((candidate) => candidate.qualifiedName ?? candidate.name)\n .join(', ')}`,\n });\n } else if (!object) {\n diagnostics.push({\n severity: 'warning',\n code: 'object_not_found',\n message: name\n ? `No booted object named ${name}; use runtime-registry to list names.`\n : 'name is required.',\n });\n }\n let ddl: string | null = null;\n if (object) {\n try {\n // Resolve by qualified identity so a same-name class in another package\n // can never answer for this one.\n ddl =\n ObjectRegistry.getSchemaDDL(\n object.qualifiedName ?? object.name,\n args.engine,\n ) ?? null;\n } catch (error) {\n diagnostics.push({\n severity: 'warning',\n code: 'ddl_unavailable',\n message: `Generated DDL unavailable: ${error instanceof Error ? error.message : 'unknown error'}`,\n });\n }\n }\n return {\n ok: true,\n coverage: null,\n diagnostics,\n data: {\n provenance: snapshot.provenance,\n boot: bootSummary(boot),\n object,\n ddl,\n },\n };\n}\n\nexport interface RuntimeSchemaDiffArgs\n extends RuntimeDatabaseArgs,\n RuntimeProjectArgs {}\n\n/**\n * `runtime-schema-diff`: booted registry schemas versus the live database,\n * using the same comparer `db:diff`/`db:migrate` use. Introspection only —\n * drop/relax options are pinned off and nothing is executed.\n */\nasync function runtimeSchemaDiffFromProject(\n args: RuntimeSchemaDiffArgs = {},\n): Promise<RuntimeToolEnvelope> {\n const boot = await bootRuntime({ projectRoot: args.projectPath });\n const { ObjectRegistry } = await loadProjectCore(args.projectPath);\n const envelope = await withRuntimeConnection(\n args,\n async (db) => {\n const { SchemaComparer } = await importProjectRuntimeModule<\n typeof import('@happyvertical/smrt-core/migrations')\n >(args.projectPath, '@happyvertical/smrt-core/migrations');\n if (typeof SchemaComparer !== 'function')\n throw new ProjectRuntimeResolutionError(\n '@happyvertical/smrt-core/migrations',\n );\n const comparer = new SchemaComparer(\n db as ConstructorParameters<typeof SchemaComparer>[0],\n {\n includeDroppedTables: false,\n includeDroppedColumns: false,\n includeDroppedIndexes: false,\n relaxColumns: false,\n },\n );\n const diff = await comparer.compare(\n ObjectRegistry.getAllSchemasAsDefinitions(),\n );\n const byType: Record<string, number> = {};\n for (const change of diff.changes) {\n const type = String((change as { type?: unknown }).type ?? 'unknown');\n byType[type] = (byType[type] ?? 0) + 1;\n }\n // `hasChanges` covers table adds/drops too; count them so the two agree.\n const addedTables = diff.added_tables.map((t) => t.tableName);\n if (addedTables.length > 0) byType.add_table = addedTables.length;\n if (diff.dropped_tables.length > 0)\n byType.drop_table = diff.dropped_tables.length;\n const changeCount =\n diff.changes.length + addedTables.length + diff.dropped_tables.length;\n return {\n data: {\n boot: bootSummary(boot),\n hasChanges: diff.has_changes,\n addedTables,\n droppedTables: diff.dropped_tables,\n orphanTables: diff.orphan_tables ?? [],\n changeCount,\n columnChangeCount: diff.changes.length,\n changesByType: byType,\n changes: diff.changes.slice(0, SCHEMA_DIFF_CHANGE_LIMIT),\n truncated: diff.changes.length > SCHEMA_DIFF_CHANGE_LIMIT,\n },\n diagnostics: [],\n };\n },\n 'booted registry schemas only; connect a dev database to diff against live tables',\n );\n envelope.diagnostics = [\n ...bootDiagnostics(boot),\n ...stalenessDiagnostics(),\n ...envelope.diagnostics,\n ];\n return envelope;\n}\n\nexport const runtimeRegistry = (args: RuntimeRegistryArgs = {}) =>\n withRuntimeSetup(() => runtimeRegistryFromProject(args));\nexport const runtimeObject = (args: RuntimeObjectArgs) =>\n withRuntimeSetup(() => runtimeObjectFromProject(args));\nexport const runtimeSchemaDiff = (args: RuntimeSchemaDiffArgs = {}) =>\n withRuntimeSetup(() => runtimeSchemaDiffFromProject(args));\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA2BA,IAAa,sBAAsB;;AAGnC,IAAM,8BAA8B,CAClC,uBACA,oBACF;AAiCA,SAAS,aAAa,aAAqB,MAAsB;CAC/D,MAAM,MAAM,SAAS,aAAa,IAAI;CAGtC,IAAI,QAAQ,QAAQ,IAAI,WAAW,KAAK,KAAK,KAAK,WAAW,GAAG,GAC9D,OAAO,SAAS,IAAI;CAEtB,OAAO,IAAI,MAAM,GAAG,CAAC,CAAC,KAAK,GAAG;AAChC;AAEA,SAAS,aAAa,MAAmC;CACvD,IAAI;EACF,MAAM,SAAS,KAAK,MAAM,aAAa,MAAM,MAAM,CAAC;EACpD,OAAO,UAAU,OAAO,WAAW,WAC9B,SACD;CACN,QAAQ;EACN,OAAO;CACT;AACF;AAEA,SAAS,iBACP,gBACA,UACA,qBACQ;CACR,MAAM,sBACJ,OAAO,SAAS,gBAAgB,YAAY,SAAS,cACjD,SAAS,cACR,uBAAuB,KAAA;CAC9B,IAAI,QAAQ;CACZ,KAAK,MAAM,CAAC,MAAM,eAAe,OAAO,QAAQ,SAAS,WAAW,CAAC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mB,OAA4B,CAAC,MAC3D,uBAAuB,2BAA2B,IAAI,CAAC;AACzD,IAAa,iBAAiB,SAC5B,uBAAuB,yBAAyB,IAAI,CAAC;AACvD,IAAa,qBAAqB,OAA8B,CAAC,MAC/D,uBAAuB,6BAA6B,IAAI,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-test-fixture.d.ts","sourceRoot":"","sources":["../src/runtime-test-fixture.ts"],"names":[],"mappings":"AAIA,mFAAmF;AACnF,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAMxD"}
|
package/dist/runtime.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { RuntimeToolEnvelope } from './tools/runtime/tools.js';
|
|
2
1
|
/**
|
|
3
2
|
* `@happyvertical/smrt-dev-mcp/runtime`: the runtime tool functions as a
|
|
4
3
|
* plain map, for in-process callers (the `smrt dev:runtime` CLI fallback,
|
|
@@ -6,6 +5,7 @@ import { RuntimeToolEnvelope } from './tools/runtime/tools.js';
|
|
|
6
5
|
*/
|
|
7
6
|
export { runtimeObject, runtimeRegistry, runtimeSchemaDiff, } from './tools/runtime/observation.js';
|
|
8
7
|
export { RUNTIME_PROVENANCE, type RuntimeDiagnostic, type RuntimeToolEnvelope, runtimeDispatchHealth, runtimeJobHealth, runtimeMigrationStatus, runtimeRecentChanges, runtimeRegistryDrift, runtimeScheduleHealth, STATIC_PROVENANCE, } from './tools/runtime/tools.js';
|
|
8
|
+
import { type RuntimeToolEnvelope } from './tools/runtime/tools.js';
|
|
9
9
|
/** Name → handler for every Level 2 runtime tool. */
|
|
10
10
|
export declare const RUNTIME_TOOLS: {
|
|
11
11
|
'runtime-registry': (args: Record<string, unknown>) => Promise<RuntimeToolEnvelope>;
|
package/dist/runtime.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { a as
|
|
1
|
+
import { a as runtimeMigrationStatus, c as runtimeScheduleHealth, i as runtimeJobHealth, n as STATIC_PROVENANCE, o as runtimeRecentChanges, r as runtimeDispatchHealth, s as runtimeRegistryDrift, t as RUNTIME_PROVENANCE } from "./tools-ma2JFPVY.js";
|
|
2
|
+
import { i as runtimeSchemaDiff, n as runtimeObject, r as runtimeRegistry } from "./observation-CqE0tBgS.js";
|
|
2
3
|
//#region src/runtime.ts
|
|
3
4
|
/** Name → handler for every Level 2 runtime tool. */
|
|
4
5
|
var RUNTIME_TOOLS = {
|
package/dist/runtime.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.js","names":[],"sources":["../src/runtime.ts"],"sourcesContent":["/**\n * `@happyvertical/smrt-dev-mcp/runtime`: the runtime tool functions as a\n * plain map, for in-process callers (the `smrt dev:runtime` CLI fallback,\n * tests) that want the envelopes without an MCP transport.\n */\nexport {\n runtimeObject,\n runtimeRegistry,\n runtimeSchemaDiff,\n} from './tools/runtime/observation.js';\nexport {\n RUNTIME_PROVENANCE,\n type RuntimeDiagnostic,\n type RuntimeToolEnvelope,\n runtimeDispatchHealth,\n runtimeJobHealth,\n runtimeMigrationStatus,\n runtimeRecentChanges,\n runtimeRegistryDrift,\n runtimeScheduleHealth,\n STATIC_PROVENANCE,\n} from './tools/runtime/tools.js';\n\nimport {\n runtimeObject,\n runtimeRegistry,\n runtimeSchemaDiff,\n} from './tools/runtime/observation.js';\nimport {\n type RuntimeToolEnvelope,\n runtimeDispatchHealth,\n runtimeJobHealth,\n runtimeMigrationStatus,\n runtimeRecentChanges,\n runtimeRegistryDrift,\n runtimeScheduleHealth,\n} from './tools/runtime/tools.js';\n\n/** Name → handler for every Level 2 runtime tool. */\nexport const RUNTIME_TOOLS = {\n 'runtime-registry': (args: Record<string, unknown>) =>\n runtimeRegistry(args as never),\n 'runtime-object': (args: Record<string, unknown>) =>\n runtimeObject(args as never),\n 'runtime-schema-diff': (args: Record<string, unknown>) =>\n runtimeSchemaDiff(args as never),\n 'migration-status': (args: Record<string, unknown>) =>\n runtimeMigrationStatus(args as never),\n 'job-health': (args: Record<string, unknown>) =>\n runtimeJobHealth(args as never),\n 'schedule-health': (args: Record<string, unknown>) =>\n runtimeScheduleHealth(args as never),\n 'dispatch-health': (args: Record<string, unknown>) =>\n runtimeDispatchHealth(args as never),\n 'recent-changes': (args: Record<string, unknown>) =>\n runtimeRecentChanges(args as never),\n 'registry-drift': (args: Record<string, unknown>) =>\n runtimeRegistryDrift(args as never),\n} satisfies Record<\n string,\n (args: Record<string, unknown>) => Promise<RuntimeToolEnvelope>\n>;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"runtime.js","names":[],"sources":["../src/runtime.ts"],"sourcesContent":["/**\n * `@happyvertical/smrt-dev-mcp/runtime`: the runtime tool functions as a\n * plain map, for in-process callers (the `smrt dev:runtime` CLI fallback,\n * tests) that want the envelopes without an MCP transport.\n */\nexport {\n runtimeObject,\n runtimeRegistry,\n runtimeSchemaDiff,\n} from './tools/runtime/observation.js';\nexport {\n RUNTIME_PROVENANCE,\n type RuntimeDiagnostic,\n type RuntimeToolEnvelope,\n runtimeDispatchHealth,\n runtimeJobHealth,\n runtimeMigrationStatus,\n runtimeRecentChanges,\n runtimeRegistryDrift,\n runtimeScheduleHealth,\n STATIC_PROVENANCE,\n} from './tools/runtime/tools.js';\n\nimport {\n runtimeObject,\n runtimeRegistry,\n runtimeSchemaDiff,\n} from './tools/runtime/observation.js';\nimport {\n type RuntimeToolEnvelope,\n runtimeDispatchHealth,\n runtimeJobHealth,\n runtimeMigrationStatus,\n runtimeRecentChanges,\n runtimeRegistryDrift,\n runtimeScheduleHealth,\n} from './tools/runtime/tools.js';\n\n/** Name → handler for every Level 2 runtime tool. */\nexport const RUNTIME_TOOLS = {\n 'runtime-registry': (args: Record<string, unknown>) =>\n runtimeRegistry(args as never),\n 'runtime-object': (args: Record<string, unknown>) =>\n runtimeObject(args as never),\n 'runtime-schema-diff': (args: Record<string, unknown>) =>\n runtimeSchemaDiff(args as never),\n 'migration-status': (args: Record<string, unknown>) =>\n runtimeMigrationStatus(args as never),\n 'job-health': (args: Record<string, unknown>) =>\n runtimeJobHealth(args as never),\n 'schedule-health': (args: Record<string, unknown>) =>\n runtimeScheduleHealth(args as never),\n 'dispatch-health': (args: Record<string, unknown>) =>\n runtimeDispatchHealth(args as never),\n 'recent-changes': (args: Record<string, unknown>) =>\n runtimeRecentChanges(args as never),\n 'registry-drift': (args: Record<string, unknown>) =>\n runtimeRegistryDrift(args as never),\n} satisfies Record<\n string,\n (args: Record<string, unknown>) => Promise<RuntimeToolEnvelope>\n>;\n"],"mappings":";;;;AAuCA,IAAa,gBAAgB;CAC3B,qBAAqB,SACnB,gBAAgB,IAAa;CAC/B,mBAAmB,SACjB,cAAc,IAAa;CAC7B,wBAAwB,SACtB,kBAAkB,IAAa;CACjC,qBAAqB,SACnB,uBAAuB,IAAa;CACtC,eAAe,SACb,iBAAiB,IAAa;CAChC,oBAAoB,SAClB,sBAAsB,IAAa;CACrC,oBAAoB,SAClB,sBAAsB,IAAa;CACrC,mBAAmB,SACjB,qBAAqB,IAAa;CACpC,mBAAmB,SACjB,qBAAqB,IAAa;AACtC"}
|
|
@@ -51,7 +51,7 @@ var DATABASE_TYPE_PROPERTY = {
|
|
|
51
51
|
};
|
|
52
52
|
var PROJECT_PATH_PROPERTY = {
|
|
53
53
|
type: "string",
|
|
54
|
-
description: "Project root to boot manifests from (default: the server working directory;
|
|
54
|
+
description: "Project root to boot manifests from (default: the server working directory; pinned by the HTTP host; a different loaded project requires restart)"
|
|
55
55
|
};
|
|
56
56
|
var LIMIT_PROPERTY = {
|
|
57
57
|
type: "number",
|
|
@@ -488,6 +488,10 @@ var TOOLS = [
|
|
|
488
488
|
inputSchema: {
|
|
489
489
|
type: "object",
|
|
490
490
|
properties: {
|
|
491
|
+
projectPath: {
|
|
492
|
+
type: "string",
|
|
493
|
+
description: "Project root with the installed SMRT runtime (default: server working directory)"
|
|
494
|
+
},
|
|
491
495
|
dbUrl: DATABASE_URL_PROPERTY,
|
|
492
496
|
dbType: DATABASE_TYPE_PROPERTY,
|
|
493
497
|
limit: LIMIT_PROPERTY
|
|
@@ -500,6 +504,10 @@ var TOOLS = [
|
|
|
500
504
|
inputSchema: {
|
|
501
505
|
type: "object",
|
|
502
506
|
properties: {
|
|
507
|
+
projectPath: {
|
|
508
|
+
type: "string",
|
|
509
|
+
description: "Project root with the installed SMRT runtime (default: server working directory)"
|
|
510
|
+
},
|
|
503
511
|
dbUrl: DATABASE_URL_PROPERTY,
|
|
504
512
|
dbType: DATABASE_TYPE_PROPERTY,
|
|
505
513
|
limit: LIMIT_PROPERTY
|
|
@@ -512,6 +520,10 @@ var TOOLS = [
|
|
|
512
520
|
inputSchema: {
|
|
513
521
|
type: "object",
|
|
514
522
|
properties: {
|
|
523
|
+
projectPath: {
|
|
524
|
+
type: "string",
|
|
525
|
+
description: "Project root with the installed SMRT runtime (default: server working directory)"
|
|
526
|
+
},
|
|
515
527
|
dbUrl: DATABASE_URL_PROPERTY,
|
|
516
528
|
dbType: DATABASE_TYPE_PROPERTY,
|
|
517
529
|
limit: LIMIT_PROPERTY
|
|
@@ -524,6 +536,10 @@ var TOOLS = [
|
|
|
524
536
|
inputSchema: {
|
|
525
537
|
type: "object",
|
|
526
538
|
properties: {
|
|
539
|
+
projectPath: {
|
|
540
|
+
type: "string",
|
|
541
|
+
description: "Project root with the installed SMRT runtime (default: server working directory)"
|
|
542
|
+
},
|
|
527
543
|
dbUrl: DATABASE_URL_PROPERTY,
|
|
528
544
|
dbType: DATABASE_TYPE_PROPERTY,
|
|
529
545
|
limit: LIMIT_PROPERTY
|
|
@@ -536,6 +552,10 @@ var TOOLS = [
|
|
|
536
552
|
inputSchema: {
|
|
537
553
|
type: "object",
|
|
538
554
|
properties: {
|
|
555
|
+
projectPath: {
|
|
556
|
+
type: "string",
|
|
557
|
+
description: "Project root with the installed SMRT runtime (default: server working directory)"
|
|
558
|
+
},
|
|
539
559
|
dbUrl: DATABASE_URL_PROPERTY,
|
|
540
560
|
dbType: DATABASE_TYPE_PROPERTY,
|
|
541
561
|
since: {
|
|
@@ -561,6 +581,10 @@ var TOOLS = [
|
|
|
561
581
|
inputSchema: {
|
|
562
582
|
type: "object",
|
|
563
583
|
properties: {
|
|
584
|
+
projectPath: {
|
|
585
|
+
type: "string",
|
|
586
|
+
description: "Project root with the installed SMRT runtime (default: server working directory)"
|
|
587
|
+
},
|
|
564
588
|
dbUrl: DATABASE_URL_PROPERTY,
|
|
565
589
|
dbType: DATABASE_TYPE_PROPERTY
|
|
566
590
|
}
|
|
@@ -640,4 +664,4 @@ var TOOLS = [
|
|
|
640
664
|
//#endregion
|
|
641
665
|
export { TOOLS as n, REVIEW_SKILL_NAME as t };
|
|
642
666
|
|
|
643
|
-
//# sourceMappingURL=tool-catalog-
|
|
667
|
+
//# sourceMappingURL=tool-catalog-RHq7nyCm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-catalog-RHq7nyCm.js","names":[],"sources":["../src/tool-catalog.ts"],"sourcesContent":["import type { Tool } from '@modelcontextprotocol/server';\n\nexport const REVIEW_SKILL_NAME = 'smrt-code-review';\n\nconst JSON_SCHEMA_2020_12 = 'https://json-schema.org/draft/2020-12/schema';\n\nfunction compareToolNames(left: string, right: string): number {\n return left < right ? -1 : left > right ? 1 : 0;\n}\n\n/**\n * Stable success/error envelope for development tools. `data` preserves each\n * tool's existing payload exactly; coverage/diagnostics are promoted only when\n * the underlying result actually reports them.\n */\nconst DEV_MCP_OUTPUT_SCHEMA: NonNullable<Tool['outputSchema']> = {\n $schema: JSON_SCHEMA_2020_12,\n type: 'object',\n additionalProperties: false,\n required: ['ok', 'coverage', 'diagnostics', 'data'],\n properties: {\n ok: { type: 'boolean' },\n coverage: { type: ['object', 'null'], additionalProperties: true },\n diagnostics: {\n type: 'array',\n items: { type: 'object', additionalProperties: true },\n },\n data: {},\n },\n};\n\nconst KNOWLEDGE_DETAIL_DESCRIPTION =\n 'summary: authored package docs are listed by path to stay inside tool-result budgets. full: embed package docs and matching modules with structural object facts. complete: embed all modules and return full package records.';\n\nconst DATABASE_URL_PROPERTY = {\n type: 'string',\n description:\n 'Optional dev database URL override (read-only diagnostics); prefer SMRT_DEV_DB_URL or cli.database config',\n};\n\nconst DATABASE_TYPE_PROPERTY = {\n type: 'string',\n enum: ['sqlite', 'postgres', 'duckdb'],\n description:\n 'Optional engine hint for dbUrl or the environment connection (sqlite, postgres, duckdb); inferred from the URL scheme when omitted',\n};\n\nconst PROJECT_PATH_PROPERTY = {\n type: 'string',\n description:\n 'Project root to boot manifests from (default: the server working directory; pinned by the HTTP host; a different loaded project requires restart)',\n} as const;\n\nconst LIMIT_PROPERTY = {\n type: 'number',\n description: 'Row budget for result lists (default 50, capped at 500)',\n};\n\n// Tool definitions\nconst TOOL_DEFINITIONS: Array<\n Pick<Tool, 'name' | 'description' | 'inputSchema'>\n> = [\n // Code Generation Tools\n {\n name: 'generate-smrt-class',\n description: 'Generate a complete SMRT class with @smrt() decorator',\n inputSchema: {\n type: 'object',\n properties: {\n className: {\n type: 'string',\n description: 'Name of the class (PascalCase)',\n },\n properties: {\n type: 'array',\n description: 'Array of property definitions',\n items: {\n type: 'object',\n properties: {\n name: { type: 'string' },\n type: {\n type: 'string',\n enum: [\n 'text',\n 'integer',\n 'decimal',\n 'boolean',\n 'datetime',\n 'json',\n ],\n },\n required: { type: 'boolean' },\n nullable: { type: 'boolean' },\n description: { type: 'string' },\n defaultValue: {\n oneOf: [\n { type: 'string' },\n { type: 'number' },\n { type: 'boolean' },\n { type: 'object' },\n { type: 'null' },\n ],\n },\n },\n required: ['name', 'type'],\n },\n },\n baseClass: {\n type: 'string',\n enum: ['SmrtObject', 'SmrtCollection'],\n default: 'SmrtObject',\n },\n template: {\n type: 'string',\n enum: [\n 'basic',\n 'global-catalog',\n 'optional-catalog',\n 'tenant-project-object',\n 'tenant-event-log-object',\n 'cross-package-reference',\n ],\n default: 'basic',\n },\n tableName: { type: 'string' },\n conflictColumns: {\n type: 'array',\n items: { type: 'string' },\n },\n tenantScoped: {\n oneOf: [\n { type: 'boolean' },\n {\n type: 'object',\n properties: {\n mode: { type: 'string', enum: ['required', 'optional'] },\n field: { type: 'string' },\n autoFilter: { type: 'boolean' },\n autoPopulate: { type: 'boolean' },\n allowSuperAdminBypass: { type: 'boolean' },\n },\n },\n ],\n },\n includeTenantIdField: { type: 'boolean' },\n relationships: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n name: { type: 'string' },\n type: {\n type: 'string',\n enum: [\n 'foreignKey',\n 'crossPackageRef',\n 'oneToMany',\n 'manyToMany',\n ],\n },\n related: { type: 'string' },\n required: { type: 'boolean' },\n nullable: { type: 'boolean' },\n description: { type: 'string' },\n validate: { type: 'boolean' },\n foreignKey: { type: 'string' },\n through: { type: 'string' },\n sourceKey: { type: 'string' },\n targetKey: { type: 'string' },\n },\n required: ['name', 'type', 'related'],\n },\n },\n includeCompanionSnippets: { type: 'boolean', default: false },\n includeApiConfig: { type: 'boolean', default: true },\n includeMcpConfig: { type: 'boolean', default: true },\n includeCliConfig: { type: 'boolean', default: true },\n },\n required: ['className', 'properties'],\n },\n },\n // Project Introspection Tools\n {\n name: 'introspect-project',\n description:\n 'Scan a directory for SMRT objects. Returns a compact summary by default; pass detail: \"full\" for field, schema, and method details.',\n inputSchema: {\n type: 'object',\n properties: {\n directory: {\n type: 'string',\n description: 'Project directory (default: cwd)',\n },\n manifestPath: {\n type: 'string',\n description:\n 'Optional manifest path. Defaults to .smrt/manifest.json, dist/manifest.json, then source scanning.',\n },\n detail: {\n type: 'string',\n enum: ['summary', 'full'],\n default: 'summary',\n description:\n 'summary: one compact record per object. full: complete field/schema/method detail (large).',\n },\n maxChars: {\n type: 'number',\n description:\n 'Character budget for the `objects` payload. Objects past the budget are omitted and reported under `truncated`. Project metadata and diagnostics are always returned in full, so the serialized response is somewhat larger than this budget.',\n },\n cursor: {\n type: 'string',\n description:\n \"Resume after this className (objects are sorted alphabetically). Pass a previous response's `nextCursor` to read the next page instead of raising maxChars.\",\n },\n limit: {\n type: 'number',\n description:\n 'Maximum objects per page, applied before the character budget',\n },\n includeFields: {\n type: 'boolean',\n description: 'Include field details (detail: \"full\" only)',\n },\n includeRelationships: {\n type: 'boolean',\n description: 'Analyze relationships (detail: \"full\" only)',\n },\n includeMethods: {\n type: 'boolean',\n description: 'Include public method details (detail: \"full\" only)',\n },\n },\n },\n },\n {\n name: 'review-smrt-project',\n description:\n 'Advisory ecosystem alignment review for downstream SMRT projects',\n inputSchema: {\n type: 'object',\n properties: {\n directory: {\n type: 'string',\n description: 'Project directory (default: cwd)',\n },\n rootDir: {\n type: 'string',\n description: 'Compatibility alias for directory',\n },\n includeSourceEvidence: {\n type: 'boolean',\n description: 'Include file and line evidence in findings',\n default: true,\n },\n maxFindings: {\n type: 'number',\n description: 'Optional maximum number of findings to return',\n },\n },\n },\n },\n {\n name: 'reflect-knowledge',\n description:\n 'Report deterministic SMRT + HappyVertical SDK knowledge coverage and freshness',\n inputSchema: {\n type: 'object',\n properties: {\n rootDir: {\n type: 'string',\n description: 'Project root directory (default: cwd)',\n },\n },\n },\n },\n {\n name: 'reflect-domain-knowledge',\n description:\n 'Report domain-scoped SMRT knowledge artifacts, SDK packages, and freshness',\n inputSchema: {\n type: 'object',\n properties: {\n rootDir: { type: 'string' },\n scope: {\n type: 'string',\n enum: ['project', 'local', 'package', 'sdk', 'installed'],\n default: 'project',\n },\n package: { type: 'string' },\n },\n },\n },\n {\n name: 'check-knowledge-freshness',\n description: 'Run deterministic freshness checks for SMRT agent knowledge',\n inputSchema: {\n type: 'object',\n properties: {\n rootDir: { type: 'string' },\n changed: {\n type: 'boolean',\n description: 'Limit stale-pattern checks to changed files',\n },\n strict: {\n type: 'boolean',\n description: 'Treat stale-pattern findings as errors',\n },\n },\n },\n },\n {\n name: 'build-context',\n description:\n 'Build model-ready SMRT context. task: \"review\" routes changedFiles/focus to package experts and returns file-anchored findings, package hints, and a prompt bundle; task: \"architecture\" ranks packages by the idea text and returns the bundle plus recommendations. Replaces build-review-context, build-domain-review-context, build-architecture-context, and build-domain-architecture-context.',\n inputSchema: {\n type: 'object',\n properties: {\n task: {\n type: 'string',\n enum: ['review', 'architecture'],\n description:\n 'review: changed files and focus. architecture: an idea or documentation.',\n },\n rootDir: { type: 'string' },\n changedFiles: {\n type: 'array',\n items: { type: 'string' },\n description: 'Files to route to package experts (task: review)',\n },\n focus: { type: 'string', description: 'Concern to prioritise' },\n documentation: {\n type: 'string',\n description: 'Existing docs, notes, or requirements',\n },\n idea: {\n type: 'string',\n description: 'Product or implementation idea (task: architecture)',\n },\n scope: {\n type: 'string',\n enum: ['project', 'local', 'package', 'sdk', 'installed'],\n default: 'project',\n },\n package: {\n type: 'string',\n description: 'Package name or short name to focus',\n },\n mode: {\n type: 'string',\n enum: ['findings', 'prompt-bundle', 'both'],\n default: 'both',\n description: 'task: review only',\n },\n detail: {\n type: 'string',\n enum: ['summary', 'full', 'complete'],\n default: 'summary',\n description: KNOWLEDGE_DETAIL_DESCRIPTION,\n },\n },\n required: ['task'],\n },\n },\n {\n name: 'smrt-review',\n description:\n 'Deprecated compatibility name for build-context with task: \"review\"; removed in the next minor release. For a formal downstream review, first call get-agent-skill with { \"name\": \"smrt-code-review\" }.',\n inputSchema: {\n type: 'object',\n properties: {\n rootDir: { type: 'string' },\n changedFiles: { type: 'array', items: { type: 'string' } },\n focus: { type: 'string' },\n documentation: { type: 'string' },\n mode: {\n type: 'string',\n enum: ['findings', 'prompt-bundle', 'both'],\n default: 'both',\n },\n detail: {\n type: 'string',\n enum: ['summary', 'full', 'complete'],\n default: 'summary',\n description: KNOWLEDGE_DETAIL_DESCRIPTION,\n },\n },\n },\n },\n {\n name: 'build-package-specialist-context',\n description:\n 'Build deterministic package specialist context for the SMRT workbench',\n inputSchema: {\n type: 'object',\n properties: {\n rootDir: { type: 'string' },\n package: {\n type: 'string',\n description:\n 'Package name or short package query, e.g. @happyvertical/smrt-content or content',\n },\n focus: { type: 'string' },\n },\n required: ['package'],\n },\n },\n {\n name: 'smrt-architecture',\n description:\n 'Deprecated compatibility name for build-context with task: \"architecture\"; removed in the next minor release.',\n inputSchema: {\n type: 'object',\n properties: {\n rootDir: { type: 'string' },\n idea: { type: 'string' },\n documentation: { type: 'string' },\n focus: { type: 'string' },\n detail: {\n type: 'string',\n enum: ['summary', 'full', 'complete'],\n default: 'summary',\n description: KNOWLEDGE_DETAIL_DESCRIPTION,\n },\n },\n },\n },\n {\n name: 'list-agent-skills',\n description:\n 'List bundled harness-agnostic agent skills shipped with smrt-dev-mcp',\n inputSchema: {\n type: 'object',\n properties: {},\n },\n },\n {\n name: 'get-agent-skill',\n description:\n 'Return a bundled harness-agnostic agent skill as Markdown plus optional references',\n inputSchema: {\n type: 'object',\n properties: {\n name: {\n type: 'string',\n enum: [REVIEW_SKILL_NAME],\n description: 'Bundled agent skill name',\n },\n includeReferences: {\n type: 'boolean',\n default: true,\n description: 'Include referenced files with the skill bundle',\n },\n },\n required: ['name'],\n },\n },\n {\n name: 'migration-status',\n description:\n 'Live migration status from the _smrt_schema_migrations system table (runtime provenance; read-only)',\n inputSchema: {\n type: 'object',\n properties: {\n projectPath: {\n type: 'string',\n description:\n 'Project root with the installed SMRT runtime (default: server working directory)',\n },\n dbUrl: DATABASE_URL_PROPERTY,\n dbType: DATABASE_TYPE_PROPERTY,\n limit: LIMIT_PROPERTY,\n },\n },\n },\n {\n name: 'job-health',\n description:\n 'Live job queue health from the _smrt_jobs/_smrt_workers system tables (runtime provenance; read-only)',\n inputSchema: {\n type: 'object',\n properties: {\n projectPath: {\n type: 'string',\n description:\n 'Project root with the installed SMRT runtime (default: server working directory)',\n },\n dbUrl: DATABASE_URL_PROPERTY,\n dbType: DATABASE_TYPE_PROPERTY,\n limit: LIMIT_PROPERTY,\n },\n },\n },\n {\n name: 'schedule-health',\n description:\n 'Live agent schedule health from the _smrt_agent_schedules system table (runtime provenance; read-only; sensitive agentConfig never read)',\n inputSchema: {\n type: 'object',\n properties: {\n projectPath: {\n type: 'string',\n description:\n 'Project root with the installed SMRT runtime (default: server working directory)',\n },\n dbUrl: DATABASE_URL_PROPERTY,\n dbType: DATABASE_TYPE_PROPERTY,\n limit: LIMIT_PROPERTY,\n },\n },\n },\n {\n name: 'dispatch-health',\n description:\n 'Live dispatch health from the _smrt_dispatch/_smrt_dispatch_subscriptions system tables (runtime provenance; read-only; payloads never read)',\n inputSchema: {\n type: 'object',\n properties: {\n projectPath: {\n type: 'string',\n description:\n 'Project root with the installed SMRT runtime (default: server working directory)',\n },\n dbUrl: DATABASE_URL_PROPERTY,\n dbType: DATABASE_TYPE_PROPERTY,\n limit: LIMIT_PROPERTY,\n },\n },\n },\n {\n name: 'recent-changes',\n description:\n 'Tail of the _smrt_changes change feed (runtime provenance; read-only; filter by table/tenant)',\n inputSchema: {\n type: 'object',\n properties: {\n projectPath: {\n type: 'string',\n description:\n 'Project root with the installed SMRT runtime (default: server working directory)',\n },\n dbUrl: DATABASE_URL_PROPERTY,\n dbType: DATABASE_TYPE_PROPERTY,\n since: {\n type: 'number',\n description: 'Cursor to read after (default 0)',\n },\n tables: {\n type: 'array',\n items: { type: 'string' },\n description: 'Restrict to these physical table names',\n },\n tenantId: {\n type: 'string',\n description: 'Tenant narrowing filter',\n },\n limit: LIMIT_PROPERTY,\n },\n },\n },\n {\n name: 'registry-drift',\n description:\n 'Registry drift report; _smrt_registry is retired and reported as such, never queried (read-only)',\n inputSchema: {\n type: 'object',\n properties: {\n projectPath: {\n type: 'string',\n description:\n 'Project root with the installed SMRT runtime (default: server working directory)',\n },\n dbUrl: DATABASE_URL_PROPERTY,\n dbType: DATABASE_TYPE_PROPERTY,\n },\n },\n },\n {\n name: 'runtime-registry',\n description:\n 'Sanitized snapshot of the booted ObjectRegistry from the project and installed manifests (booted provenance; read-only; no project code executed)',\n inputSchema: {\n type: 'object',\n properties: {\n projectPath: PROJECT_PATH_PROPERTY,\n objects: {\n type: 'array',\n items: { type: 'string' },\n description:\n 'Restrict field/method detail to these simple or qualified object names',\n },\n detail: {\n type: 'boolean',\n description:\n 'Include field and method detail for every object (default: only when objects is given)',\n },\n cursor: {\n type: 'string',\n description:\n \"Resume after this qualified object name; pass a previous response's `page.nextCursor`\",\n },\n limit: {\n type: 'number',\n description: 'Objects per page (default 50, capped at 500)',\n },\n },\n },\n },\n {\n name: 'runtime-object',\n description:\n 'One booted object: sanitized fields, methods, tenancy, inheritance, and the DDL the registry would generate (booted provenance; read-only)',\n inputSchema: {\n type: 'object',\n properties: {\n projectPath: PROJECT_PATH_PROPERTY,\n name: {\n type: 'string',\n description: 'Simple or qualified object name',\n },\n engine: {\n type: 'string',\n enum: ['sqlite', 'postgres', 'duckdb'],\n description: 'Engine for the DDL preview (default: registry default)',\n },\n },\n required: ['name'],\n },\n },\n {\n name: 'runtime-schema-diff',\n description:\n 'Booted registry schemas versus the live dev database using the db:diff comparer; introspection only, drops/relaxations never proposed (runtime provenance; read-only)',\n inputSchema: {\n type: 'object',\n properties: {\n projectPath: PROJECT_PATH_PROPERTY,\n dbUrl: DATABASE_URL_PROPERTY,\n dbType: DATABASE_TYPE_PROPERTY,\n },\n },\n },\n];\n\nexport const TOOLS: Tool[] = TOOL_DEFINITIONS.map((tool) => ({\n ...tool,\n inputSchema: {\n ...tool.inputSchema,\n $schema: JSON_SCHEMA_2020_12,\n },\n outputSchema: DEV_MCP_OUTPUT_SCHEMA,\n})).sort((left, right) => compareToolNames(left.name, right.name));\n"],"mappings":";AAEA,IAAa,oBAAoB;AAEjC,IAAM,sBAAsB;AAE5B,SAAS,iBAAiB,MAAc,OAAuB;CAC7D,OAAO,OAAO,QAAQ,KAAK,OAAO,QAAQ,IAAI;AAChD;;;;;;AAOA,IAAM,wBAA2D;CAC/D,SAAS;CACT,MAAM;CACN,sBAAsB;CACtB,UAAU;EAAC;EAAM;EAAY;EAAe;CAAM;CAClD,YAAY;EACV,IAAI,EAAE,MAAM,UAAU;EACtB,UAAU;GAAE,MAAM,CAAC,UAAU,MAAM;GAA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IACA,QAAQ;KACN,MAAM;KACN,aACE;IACJ;IACA,OAAO;KACL,MAAM;KACN,aACE;IACJ;IACA,eAAe;KACb,MAAM;KACN,aAAa;IACf;IACA,sBAAsB;KACpB,MAAM;KACN,aAAa;IACf;IACA,gBAAgB;KACd,MAAM;KACN,aAAa;IACf;GACF;EACF;CACF;CACA;EACE,MAAM;EACN,aACE;EACF,aAAa;GACX,MAAM;GACN,YAAY;IACV,WAAW;KACT,MAAM;KACN,aAAa;IACf;IACA,SAAS;KACP,MAAM;KACN,aAAa;IACf;IACA,uBAAuB;KACrB,MAAM;KACN,aAAa;KACb,SAAS;IACX;IACA,aAAa;KACX,MAAM;KACN,aAAa;IACf;GACF;EACF;CACF;CACA;EACE,MAAM;EACN,aACE;EACF,aAAa;GACX,MAAM;GACN,YAAY,EACV,SAAS;IACP,MAAM;IACN,aAAa;GACf,EACF;EACF;CACF;CACA;EACE,MAAM;EACN,aACE;EACF,aAAa;GACX,MAAM;GACN,YAAY;IACV,SAAS,EAAE,MAAM,SAAS;IAC1B,OAAO;KACL,MAAM;KACN,MAAM;MAAC;MAAW;MAAS;MAAW;MAAO;KAAW;KACxD,SAAS;IACX;IACA,SAAS,EAAE,MAAM,SAAS;GAC5B;EACF;CACF;CACA;EACE,MAAM;EACN,aAAa;EACb,aAAa;GACX,MAAM;GACN,YAAY;IACV,SAAS,EAAE,MAAM,SAAS;IAC1B,SAAS;KACP,MAAM;KACN,aAAa;IACf;IACA,QAAQ;KACN,MAAM;KACN,aAAa;IACf;GACF;EACF;CACF;CACA;EACE,MAAM;EACN,aACE;EACF,aAAa;GACX,MAAM;GACN,YAAY;IACV,MAAM;KACJ,MAAM;KACN,MAAM,CAAC,UAAU,cAAc;KAC/B,aACE;IACJ;IACA,SAAS,EAAE,MAAM,SAAS;IAC1B,cAAc;KACZ,MAAM;KACN,OAAO,EAAE,MAAM,SAAS;KACxB,aAAa;IACf;IACA,OAAO;KAAE,MAAM;KAAU,aAAa;IAAwB;IAC9D,e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,SAAS;KACT,aAAa;IACf;GACF;EACF;CACF;CACA;EACE,MAAM;EACN,aACE;EACF,aAAa;GACX,MAAM;GACN,YAAY,CAAC;EACf;CACF;CACA;EACE,MAAM;EACN,aACE;EACF,aAAa;GACX,MAAM;GACN,YAAY;IACV,MAAM;KACJ,MAAM;KACN,MAAM,CAAC,iBAAiB;KACxB,aAAa;IACf;IACA,mBAAmB;KACjB,MAAM;KACN,SAAS;KACT,aAAa;IACf;GACF;GACA,UAAU,CAAC,MAAM;EACnB;CACF;CACA;EACE,MAAM;EACN,aACE;EACF,aAAa;GACX,MAAM;GACN,YAAY;IACV,aAAa;KACX,MAAM;KACN,aACE;IACJ;IACA,OAAO;IACP,QAAQ;IACR,OAAO;GACT;EACF;CACF;CACA;EACE,MAAM;EACN,aACE;EACF,aAAa;GACX,MAAM;GACN,YAAY;IACV,aAAa;KACX,MAAM;KACN,aACE;IACJ;IACA,OAAO;IACP,QAAQ;IACR,OAAO;GACT;EACF;CACF;CACA;EACE,MAAM;EACN,aACE;EACF,aAAa;GACX,MAAM;GACN,YAAY;IACV,aAAa;KACX,MAAM;KACN,aACE;IACJ;IACA,OAAO;IACP,QAAQ;IACR,OAAO;GACT;EACF;CACF;CACA;EACE,MAAM;EACN,aACE;EACF,aAAa;GACX,MAAM;GACN,YAAY;IACV,aAAa;KACX,MAAM;KACN,aACE;IACJ;IACA,OAAO;IACP,QAAQ;IACR,OAAO;GACT;EACF;CACF;CACA;EACE,MAAM;EACN,aACE;EACF,aAAa;GACX,MAAM;GACN,YAAY;IACV,aAAa;KACX,MAAM;KACN,aACE;IACJ;IACA,OAAO;IACP,QAAQ;IACR,OAAO;KACL,MAAM;KACN,aAAa;IACf;IACA,QAAQ;KACN,MAAM;KACN,OAAO,EAAE,MAAM,SAAS;KACxB,aAAa;IACf;IACA,UAAU;KACR,MAAM;KACN,aAAa;IACf;IACA,OAAO;GACT;EACF;CACF;CACA;EACE,MAAM;EACN,aACE;EACF,aAAa;GACX,MAAM;GACN,YAAY;IACV,aAAa;KACX,MAAM;KACN,aACE;IACJ;IACA,OAAO;IACP,QAAQ;GACV;EACF;CACF;CACA;EACE,MAAM;EACN,aACE;EACF,aAAa;GACX,MAAM;GACN,YAAY;IACV,aAAa;IACb,SAAS;KACP,MAAM;KACN,OAAO,EAAE,MAAM,SAAS;KACxB,aACE;IACJ;IACA,QAAQ;KACN,MAAM;KACN,aACE;IACJ;IACA,QAAQ;KACN,MAAM;KACN,aACE;IACJ;IACA,OAAO;KACL,MAAM;KACN,aAAa;IACf;GACF;EACF;CACF;CACA;EACE,MAAM;EACN,aACE;EACF,aAAa;GACX,MAAM;GACN,YAAY;IACV,aAAa;IACb,MAAM;KACJ,MAAM;KACN,aAAa;IACf;IACA,QAAQ;KACN,MAAM;KACN,MAAM;MAAC;MAAU;MAAY;KAAQ;KACrC,aAAa;IACf;GACF;GACA,UAAU,CAAC,MAAM;EACnB;CACF;CACA;EACE,MAAM;EACN,aACE;EACF,aAAa;GACX,MAAM;GACN,YAAY;IACV,aAAa;IACb,OAAO;IACP,QAAQ;GACV;EACF;CACF;AAG2B,CAAA,CAAiB,KAAK,UAAU;CAC3D,GAAG;CACH,aAAa;EACX,GAAG,KAAK;EACR,SAAS;CACX;CACA,cAAc;AAChB,EAAE,CAAC,CAAC,MAAM,MAAM,UAAU,iBAAiB,KAAK,MAAM,MAAM,IAAI,CAAC"}
|