@happyvertical/smrt-core 0.47.0 → 0.47.1
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 +1 -0
- package/agents/generators.md +19 -5
- package/agents/system-diagnostics.md +43 -0
- package/dist/browser.js +2 -1
- package/dist/change-feed.d.ts +8 -0
- package/dist/change-feed.d.ts.map +1 -1
- package/dist/change-feed.js +1 -1
- package/dist/change-feed.js.map +1 -1
- package/dist/index.js +2 -1
- package/dist/manifest/static-manifest.js +1 -1
- package/dist/manifest/static-manifest.js.map +1 -1
- package/dist/manifest/store.js +1 -1
- package/dist/manifest.json +1 -1
- package/dist/postgres-permissions.d.ts +3 -0
- package/dist/postgres-permissions.d.ts.map +1 -1
- package/dist/postgres-permissions.js +49 -6
- package/dist/postgres-permissions.js.map +1 -1
- package/dist/smrt-knowledge.json +14 -8
- package/dist/system/diagnostics.d.ts +299 -0
- package/dist/system/diagnostics.d.ts.map +1 -0
- package/dist/system/diagnostics.js +530 -0
- package/dist/system/diagnostics.js.map +1 -0
- package/dist/system/index.d.ts +1 -0
- package/dist/system/index.d.ts.map +1 -1
- package/dist/system/index.js +2 -1
- package/dist/utils/scanner-module.d.ts +16 -0
- package/dist/utils/scanner-module.d.ts.map +1 -1
- package/dist/vite-plugin/index.d.ts +34 -1
- package/dist/vite-plugin/index.d.ts.map +1 -1
- package/dist/vite-plugin/index.js +81 -2
- package/dist/vite-plugin/index.js.map +1 -1
- package/dist/vite-plugin.js +2 -2
- package/package.json +10 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scanner-module.d.ts","sourceRoot":"","sources":["../../src/utils/scanner-module.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,wBAAwB,EACxB,2BAA2B,EAC5B,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE/D;;;;;;;;GAQG;AACH,MAAM,WA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AAE,MAAM,EAAE,CAAC;QAClB,OAAO,EAAE,MAAM,EAAE,CAAC;QAClB,mBAAmB,CAAC,EAAE,OAAO,CAAC;KAC/B,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IACtB;;;;;;;;OAQG;IACH,0BAA0B,CACxB,OAAO,EAAE,mBAAmB,EAC5B,OAAO,EAAE;QACP,kBAAkB,CAAC,EAAE,aAAa,CAAC;YACjC,IAAI,EAAE,MAAM,CAAC;YACb,UAAU,CAAC,EAAE,MAAM,CAAC;SACrB,CAAC,CAAC;QACH,cAAc,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;KACpC,GACA,mBAAmB,CAAC,aAAa,CAAC,CAAC;CACvC"}
|
|
@@ -2,7 +2,7 @@ import { DomainKnowledgeAgentSurface, DomainKnowledgeConfig } from '@happyvertic
|
|
|
2
2
|
import { Plugin } from 'vite';
|
|
3
3
|
import { SmrtGenerationSnapshotOptions } from '../generation-snapshot.js';
|
|
4
4
|
import { SmartObjectManifest } from '../scanner/types.js';
|
|
5
|
-
import { ScannerAgentSurface } from '../utils/scanner-module.js';
|
|
5
|
+
import { ScannerAgentSurface, ScannerModule } from '../utils/scanner-module.js';
|
|
6
6
|
export { loadVerifiedSmrtGenerationSnapshot, type SerializeSmrtGenerationSnapshotOptions, type SmrtGenerationSnapshotArtifact, type SmrtGenerationSnapshotOptions, type SmrtGenerationSnapshotView, serializeSmrtGenerationSnapshot, sha256SmrtGenerationSnapshot, } from '../generation-snapshot.js';
|
|
7
7
|
export type { CliApiCoherenceViolation, SvelteKitOptions, } from './sveltekit-generator.js';
|
|
8
8
|
export { findCliApiCoherenceViolations, generateSvelteKitRoutes, methodNameToKebab, resolveApiActionRouteConfig, resolveApiActionSet, validateCliIncludeAgainstApi, } from './sveltekit-generator.js';
|
|
@@ -112,6 +112,39 @@ export interface SmrtPluginOptions {
|
|
|
112
112
|
* scan path.
|
|
113
113
|
*/
|
|
114
114
|
export declare function toKnowledgeAgentSurface(surface: ScannerAgentSurface | undefined): DomainKnowledgeAgentSurface | undefined;
|
|
115
|
+
/**
|
|
116
|
+
* Compare the emitted intents against the tool names this build will really
|
|
117
|
+
* register, and project the result into the knowledge-artifact shape (#2725).
|
|
118
|
+
*
|
|
119
|
+
* The rule lives in the scanner, which owns the tool-name derivation. The INPUT
|
|
120
|
+
* lives here, because only core resolves the exposure policy:
|
|
121
|
+
* {@link buildWebMcpToolDefinitions} is the function that emits the runtime
|
|
122
|
+
* `webMcpToolDefinitions`, so its output is the set that actually registers.
|
|
123
|
+
* Handing the scanner every verb a class COULD expose would report collisions
|
|
124
|
+
* with tools nobody mounts.
|
|
125
|
+
*
|
|
126
|
+
* The check is passed in rather than imported: core reaches the scanner through
|
|
127
|
+
* {@link importScanner}, which resolves src or dist depending on how core itself
|
|
128
|
+
* was built, and a static import here would defeat that.
|
|
129
|
+
*
|
|
130
|
+
* `declaredBy` is `Class.action` — the same identity `smrt doctor` prints beside
|
|
131
|
+
* a generated model tool — so a reader can find the other side of the collision
|
|
132
|
+
* without cross-referencing anything.
|
|
133
|
+
*/
|
|
134
|
+
export declare function collectAgentSurfaceToolNameCollisions(input: {
|
|
135
|
+
surface: ScannerAgentSurface;
|
|
136
|
+
manifest: SmartObjectManifest;
|
|
137
|
+
checkAgentSurfaceToolNames: ScannerModule['checkAgentSurfaceToolNames'];
|
|
138
|
+
kebabRoutes?: boolean;
|
|
139
|
+
/**
|
|
140
|
+
* Prefixes the fixed UI tools mount under. Nothing in a build knows this —
|
|
141
|
+
* `ui.prefix` is a runtime `<Provider webmcp={{ ui: { prefix } }}>` prop, and
|
|
142
|
+
* the scanner's default of `smrt_ui_` is correct for every app that leaves it
|
|
143
|
+
* alone. Threaded anyway so the seam is complete: the day a build-time source
|
|
144
|
+
* exists, only this call site changes.
|
|
145
|
+
*/
|
|
146
|
+
uiToolPrefixes?: readonly string[];
|
|
147
|
+
}): DomainKnowledgeAgentSurface['diagnostics'];
|
|
115
148
|
export declare function isRegisterShimModuleId(id: string): boolean;
|
|
116
149
|
/**
|
|
117
150
|
* Generate the replacement `__smrt-register__` module with the build-time
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/vite-plugin/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,KAAK,EACV,2BAA2B,EAC3B,qBAAqB,EAEtB,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,MAAM,EAAiC,MAAM,MAAM,CAAC;AAClE,OAAO,EAEL,KAAK,6BAA6B,EACnC,MAAM,2BAA2B,CAAC;AAGnC,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,KAAK,EACV,mBAAmB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/vite-plugin/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,KAAK,EACV,2BAA2B,EAC3B,qBAAqB,EAEtB,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,MAAM,EAAiC,MAAM,MAAM,CAAC;AAClE,OAAO,EAEL,KAAK,6BAA6B,EACnC,MAAM,2BAA2B,CAAC;AAGnC,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,KAAK,EACV,mBAAmB,EACnB,aAAa,EACd,MAAM,4BAA4B,CAAC;AAyBpC,OAAO,EACL,kCAAkC,EAClC,KAAK,sCAAsC,EAC3C,KAAK,8BAA8B,EACnC,KAAK,6BAA6B,EAClC,KAAK,0BAA0B,EAC/B,+BAA+B,EAC/B,4BAA4B,GAC7B,MAAM,2BAA2B,CAAC;AACnC,YAAY,EACV,wBAAwB,EACxB,gBAAgB,GACjB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,6BAA6B,EAC7B,uBAAuB,EACvB,iBAAiB,EACjB,2BAA2B,EAC3B,mBAAmB,EACnB,4BAA4B,GAC7B,MAAM,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IAAI,CAAC,CAqZf"}
|
|
@@ -68,6 +68,70 @@ function reportAgentSurfaceDiagnostics(surface) {
|
|
|
68
68
|
console.warn(` ${where} — ${diagnostic.message}`);
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
|
+
/**
|
|
72
|
+
* Compare the emitted intents against the tool names this build will really
|
|
73
|
+
* register, and project the result into the knowledge-artifact shape (#2725).
|
|
74
|
+
*
|
|
75
|
+
* The rule lives in the scanner, which owns the tool-name derivation. The INPUT
|
|
76
|
+
* lives here, because only core resolves the exposure policy:
|
|
77
|
+
* {@link buildWebMcpToolDefinitions} is the function that emits the runtime
|
|
78
|
+
* `webMcpToolDefinitions`, so its output is the set that actually registers.
|
|
79
|
+
* Handing the scanner every verb a class COULD expose would report collisions
|
|
80
|
+
* with tools nobody mounts.
|
|
81
|
+
*
|
|
82
|
+
* The check is passed in rather than imported: core reaches the scanner through
|
|
83
|
+
* {@link importScanner}, which resolves src or dist depending on how core itself
|
|
84
|
+
* was built, and a static import here would defeat that.
|
|
85
|
+
*
|
|
86
|
+
* `declaredBy` is `Class.action` — the same identity `smrt doctor` prints beside
|
|
87
|
+
* a generated model tool — so a reader can find the other side of the collision
|
|
88
|
+
* without cross-referencing anything.
|
|
89
|
+
*/
|
|
90
|
+
function collectAgentSurfaceToolNameCollisions(input) {
|
|
91
|
+
return input.checkAgentSurfaceToolNames(input.surface, {
|
|
92
|
+
generatedToolNames: buildWebMcpToolDefinitions(input.manifest, { kebabRoutes: input.kebabRoutes ?? false }).map((definition) => ({
|
|
93
|
+
name: definition.name,
|
|
94
|
+
declaredBy: `${definition.className}.${definition.action}`
|
|
95
|
+
})),
|
|
96
|
+
...input.uiToolPrefixes ? { uiToolPrefixes: input.uiToolPrefixes } : {}
|
|
97
|
+
}).map(({ filePath, ...rest }) => ({
|
|
98
|
+
...rest,
|
|
99
|
+
sourceFile: filePath
|
|
100
|
+
}));
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Print every emitted intent whose WebMCP tool name something else also claims
|
|
104
|
+
* (#2725).
|
|
105
|
+
*
|
|
106
|
+
* "Also claims", not "is already taken", for the same reason `smrt doctor`'s
|
|
107
|
+
* header says so: a build cannot see the provider's WebMCP `namespace` or
|
|
108
|
+
* `effects` policy, either of which separates the pair outright. This line runs
|
|
109
|
+
* on every build and every watch rebuild, so it is the surface an author sees
|
|
110
|
+
* most; each message beneath states the condition, and the header must not
|
|
111
|
+
* assert past it.
|
|
112
|
+
*
|
|
113
|
+
* Separate from {@link reportAgentSurfaceDiagnostics} because it says
|
|
114
|
+
* something different: those declarations were EXCLUDED, these are emitted and
|
|
115
|
+
* merely at risk. Folding them into that header would tell an author their
|
|
116
|
+
* intent had been dropped when it had not.
|
|
117
|
+
*/
|
|
118
|
+
function reportAgentSurfaceToolNameCollisions(diagnostics) {
|
|
119
|
+
if (diagnostics.length === 0) return;
|
|
120
|
+
console.warn(`[smrt] ⚠️ ${diagnostics.length} declared intent(s) derive a WebMCP tool name something else also claims:`);
|
|
121
|
+
for (const diagnostic of diagnostics) {
|
|
122
|
+
const where = diagnostic.line ? `${diagnostic.sourceFile}:${diagnostic.line}` : diagnostic.sourceFile;
|
|
123
|
+
console.warn(` ${where} — ${diagnostic.message}`);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Order the emitted diagnostics the way the scanner's own merge does, so
|
|
128
|
+
* appending the manifest-derived collisions cannot make the artifact depend on
|
|
129
|
+
* when they were computed.
|
|
130
|
+
*/
|
|
131
|
+
function sortKnowledgeAgentSurfaceDiagnostics(diagnostics) {
|
|
132
|
+
const compare = (a, b) => a < b ? -1 : a > b ? 1 : 0;
|
|
133
|
+
return [...diagnostics].sort((a, b) => compare(a.sourceFile, b.sourceFile) || (a.line ?? 0) - (b.line ?? 0) || (a.column ?? 0) - (b.column ?? 0) || compare(a.code, b.code) || compare(a.message, b.message));
|
|
134
|
+
}
|
|
71
135
|
async function importScanner() {
|
|
72
136
|
return importWorkspaceModule({
|
|
73
137
|
packageName: "@happyvertical/smrt-scanner",
|
|
@@ -578,7 +642,8 @@ function smrtPlugin(options = {}) {
|
|
|
578
642
|
async function scanWithOxc(rootDir) {
|
|
579
643
|
const startTime = performance.now();
|
|
580
644
|
try {
|
|
581
|
-
const
|
|
645
|
+
const scannerModule = await importScanner();
|
|
646
|
+
const { OxcScanner, ManifestAdapter } = scannerModule;
|
|
582
647
|
console.log(`[smrt] Using experimental OXC scanner for faster builds`);
|
|
583
648
|
const safeExclude = [...exclude || [], "**/*.svelte"];
|
|
584
649
|
const { results, resolved } = await new OxcScanner({
|
|
@@ -626,6 +691,20 @@ function smrtPlugin(options = {}) {
|
|
|
626
691
|
packageName,
|
|
627
692
|
packageJson
|
|
628
693
|
});
|
|
694
|
+
if (agentSurface && results.agentSurface) try {
|
|
695
|
+
const collisions = collectAgentSurfaceToolNameCollisions({
|
|
696
|
+
surface: results.agentSurface,
|
|
697
|
+
manifest: newManifest,
|
|
698
|
+
checkAgentSurfaceToolNames: scannerModule.checkAgentSurfaceToolNames,
|
|
699
|
+
kebabRoutes: svelteKit.kebabRoutes ?? false
|
|
700
|
+
});
|
|
701
|
+
if (collisions.length > 0) {
|
|
702
|
+
reportAgentSurfaceToolNameCollisions(collisions);
|
|
703
|
+
agentSurface.diagnostics = sortKnowledgeAgentSurfaceDiagnostics([...agentSurface.diagnostics, ...collisions]);
|
|
704
|
+
}
|
|
705
|
+
} catch (error) {
|
|
706
|
+
console.warn("[smrt] Skipped the agent-surface tool-name collision check:", error);
|
|
707
|
+
}
|
|
629
708
|
const elapsed = performance.now() - startTime;
|
|
630
709
|
const objectCount = Object.keys(newManifest.objects).length;
|
|
631
710
|
if (objectCount > 0) {
|
|
@@ -1296,6 +1375,6 @@ async function loadDefaultUI() {
|
|
|
1296
1375
|
return getDefaultUIModule();
|
|
1297
1376
|
}
|
|
1298
1377
|
//#endregion
|
|
1299
|
-
export { buildWebMcpToolDefinitions, findCliApiCoherenceViolations, generateInlineRegisterModule, generateSvelteKitRoutes, generateTypeDeclarationFile, isRegisterShimModuleId, loadVerifiedSmrtGenerationSnapshot, methodNameToKebab, resolveApiActionRouteConfig, resolveApiActionSet, serializeSmrtGenerationSnapshot, sha256SmrtGenerationSnapshot, smrtPlugin, toKnowledgeAgentSurface, validateCliIncludeAgainstApi };
|
|
1378
|
+
export { buildWebMcpToolDefinitions, collectAgentSurfaceToolNameCollisions, findCliApiCoherenceViolations, generateInlineRegisterModule, generateSvelteKitRoutes, generateTypeDeclarationFile, isRegisterShimModuleId, loadVerifiedSmrtGenerationSnapshot, methodNameToKebab, resolveApiActionRouteConfig, resolveApiActionSet, serializeSmrtGenerationSnapshot, sha256SmrtGenerationSnapshot, smrtPlugin, toKnowledgeAgentSurface, validateCliIncludeAgainstApi };
|
|
1300
1379
|
|
|
1301
1380
|
//# sourceMappingURL=index.js.map
|