@happyvertical/smrt-core 0.55.10 → 0.55.12
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 +2 -0
- package/agents/build-knowledge.md +40 -0
- package/agents/cookbook-engine.md +102 -0
- package/agents/cookbook.md +74 -0
- package/dist/consumer-plugin/artifact-publication.js +3 -3
- package/dist/consumer-plugin/artifact-publication.js.map +1 -1
- package/dist/consumer-plugin/hosted-sti-collections.d.ts +10 -0
- package/dist/consumer-plugin/hosted-sti-collections.d.ts.map +1 -0
- package/dist/consumer-plugin/hosted-sti-collections.js +96 -0
- package/dist/consumer-plugin/hosted-sti-collections.js.map +1 -0
- package/dist/consumer-plugin/index.d.ts +1 -1
- package/dist/consumer-plugin/index.d.ts.map +1 -1
- package/dist/consumer-plugin/index.js +76 -51
- package/dist/consumer-plugin/index.js.map +1 -1
- package/dist/cookbook/engine/commands.d.ts +37 -0
- package/dist/cookbook/engine/commands.d.ts.map +1 -0
- package/dist/cookbook/engine/commands.js +275 -0
- package/dist/cookbook/engine/commands.js.map +1 -0
- package/dist/cookbook/engine/defaults.d.ts +10 -0
- package/dist/cookbook/engine/defaults.d.ts.map +1 -0
- package/dist/cookbook/engine/defaults.js +49 -0
- package/dist/cookbook/engine/defaults.js.map +1 -0
- package/dist/cookbook/engine/document.d.ts +66 -0
- package/dist/cookbook/engine/document.d.ts.map +1 -0
- package/dist/cookbook/engine/document.js +357 -0
- package/dist/cookbook/engine/document.js.map +1 -0
- package/dist/cookbook/engine/engine.d.ts +49 -0
- package/dist/cookbook/engine/engine.d.ts.map +1 -0
- package/dist/cookbook/engine/engine.js +399 -0
- package/dist/cookbook/engine/engine.js.map +1 -0
- package/dist/cookbook/engine/index.d.ts +14 -0
- package/dist/cookbook/engine/index.d.ts.map +1 -0
- package/dist/cookbook/engine/index.js +8 -0
- package/dist/cookbook/engine/nav.d.ts +45 -0
- package/dist/cookbook/engine/nav.d.ts.map +1 -0
- package/dist/cookbook/engine/nav.js +191 -0
- package/dist/cookbook/engine/nav.js.map +1 -0
- package/dist/cookbook/engine/schemas.d.ts +29 -0
- package/dist/cookbook/engine/schemas.d.ts.map +1 -0
- package/dist/cookbook/engine/schemas.js +363 -0
- package/dist/cookbook/engine/schemas.js.map +1 -0
- package/dist/cookbook/engine/types.d.ts +331 -0
- package/dist/cookbook/engine/types.d.ts.map +1 -0
- package/dist/cookbook/engine/types.js +10 -0
- package/dist/cookbook/engine/types.js.map +1 -0
- package/dist/cookbook/engine.d.ts +2 -0
- package/dist/cookbook/engine.d.ts.map +1 -0
- package/dist/cookbook/engine.js +9 -0
- package/dist/cookbook/index.d.ts +6 -0
- package/dist/cookbook/index.d.ts.map +1 -0
- package/dist/cookbook/v1.schema.json +131 -0
- package/dist/cookbook/validate.d.ts +37 -0
- package/dist/cookbook/validate.d.ts.map +1 -0
- package/dist/cookbook/validate.js +172 -0
- package/dist/cookbook/validate.js.map +1 -0
- package/dist/cookbook.d.ts +7 -0
- package/dist/cookbook.d.ts.map +1 -0
- package/dist/cookbook.js +2 -0
- 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/prebuild/index.js +13 -13
- package/dist/prebuild/index.js.map +1 -1
- package/dist/scanner/types.d.ts +8 -0
- package/dist/scanner/types.d.ts.map +1 -1
- package/dist/scanner/types.js.map +1 -1
- package/dist/smrt-knowledge.json +23 -7
- package/dist/vite-plugin/sveltekit-generator.d.ts.map +1 -1
- package/dist/vite-plugin/sveltekit-generator.js +4 -1
- package/dist/vite-plugin/sveltekit-generator.js.map +1 -1
- package/dist/vite-plugin/sync-apply-route.d.ts.map +1 -1
- package/dist/vite-plugin/sync-apply-route.js +1 -0
- package/dist/vite-plugin/sync-apply-route.js.map +1 -1
- package/dist/vite-plugin/web-collections.d.ts +5 -0
- package/dist/vite-plugin/web-collections.d.ts.map +1 -1
- package/dist/vite-plugin/web-collections.js +1 -1
- package/dist/vite-plugin/web-collections.js.map +1 -1
- package/dist/vite-preset/cookbook-exposure.d.ts +11 -0
- package/dist/vite-preset/cookbook-exposure.d.ts.map +1 -0
- package/dist/vite-preset/cookbook-exposure.js +95 -0
- package/dist/vite-preset/cookbook-exposure.js.map +1 -0
- package/dist/vite-preset/index.d.ts +9 -0
- package/dist/vite-preset/index.d.ts.map +1 -1
- package/dist/vite-preset/index.js +17 -7
- package/dist/vite-preset/index.js.map +1 -1
- package/package.json +18 -6
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { manifestExportCandidates } from "../manifest/package-manifest-exports.js";
|
|
2
|
+
import { validateCookbook } from "../cookbook/validate.js";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import fs from "node:fs";
|
|
5
|
+
//#region src/vite-preset/cookbook-exposure.ts
|
|
6
|
+
/**
|
|
7
|
+
* Which consumed package models an app hosts over REST, derived from its
|
|
8
|
+
* cookbook (#3749).
|
|
9
|
+
*
|
|
10
|
+
* `smrtConsumer({ svelteKit: { objects } })` already generates routes for an
|
|
11
|
+
* explicit, provider-qualified allowlist and honours each model's `api` config
|
|
12
|
+
* (an `api: false` or empty-include model gets no route). The cookbook is that
|
|
13
|
+
* allowlist: the models of its recipes plus its `features`. The cookbook's own
|
|
14
|
+
* `exposure` (surfaces switched off per model) and a recipe's
|
|
15
|
+
* `options[model].exposure.api === false` withdraw a model; nothing here widens
|
|
16
|
+
* what a model declares.
|
|
17
|
+
*/
|
|
18
|
+
/** The cookbook file `smrt cookbook apply` writes at the project root. */
|
|
19
|
+
var COOKBOOK_FILE = "smrt.cookbook.json";
|
|
20
|
+
function readJson(file) {
|
|
21
|
+
return JSON.parse(fs.readFileSync(file, "utf8"));
|
|
22
|
+
}
|
|
23
|
+
/** The package's JSON manifest, found the way the consumer plugin finds it. */
|
|
24
|
+
function readPackageManifest(projectRoot, packageName) {
|
|
25
|
+
const dir = path.join(projectRoot, "node_modules", packageName);
|
|
26
|
+
const candidates = [
|
|
27
|
+
...manifestExportCandidates(dir),
|
|
28
|
+
path.join(dir, "dist", "manifest.json"),
|
|
29
|
+
path.join(dir, "manifest.json")
|
|
30
|
+
];
|
|
31
|
+
for (const file of candidates) {
|
|
32
|
+
if (!file.endsWith(".json") || !fs.existsSync(file)) continue;
|
|
33
|
+
try {
|
|
34
|
+
const parsed = readJson(file);
|
|
35
|
+
if (parsed && typeof parsed === "object") return parsed;
|
|
36
|
+
} catch {}
|
|
37
|
+
}
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
function objectRef(key, def, fallbackPackage) {
|
|
41
|
+
if (key.includes(":")) return key;
|
|
42
|
+
if (def.qualifiedName?.includes(":")) return def.qualifiedName;
|
|
43
|
+
const pkg = def.packageName ?? fallbackPackage;
|
|
44
|
+
return def.className ? `${pkg}:${def.className}` : void 0;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Qualified refs of the consumed models the project's cookbook hosts. Returns
|
|
48
|
+
* `[]` when the project has no cookbook. Refs that no consumed package
|
|
49
|
+
* declares are dropped (the shell reports an unknown recipe or feature).
|
|
50
|
+
*
|
|
51
|
+
* @throws When `smrt.cookbook.json` is present but unreadable or invalid.
|
|
52
|
+
*/
|
|
53
|
+
function resolveCookbookHostedObjects(projectRoot, packages) {
|
|
54
|
+
const file = path.join(projectRoot, COOKBOOK_FILE);
|
|
55
|
+
if (!fs.existsSync(file)) return [];
|
|
56
|
+
let document;
|
|
57
|
+
try {
|
|
58
|
+
document = readJson(file);
|
|
59
|
+
} catch (error) {
|
|
60
|
+
throw new Error(`[smrt] Cannot read ${COOKBOOK_FILE}: ${error instanceof Error ? error.message : String(error)}`);
|
|
61
|
+
}
|
|
62
|
+
const result = validateCookbook(document);
|
|
63
|
+
if (!result.ok) throw new Error(`[smrt] ${COOKBOOK_FILE} is not a valid cookbook:\n- ${result.errors.join("\n- ")}`);
|
|
64
|
+
const { cookbook } = result;
|
|
65
|
+
const declared = /* @__PURE__ */ new Set();
|
|
66
|
+
const recipes = /* @__PURE__ */ new Map();
|
|
67
|
+
for (const packageName of packages) {
|
|
68
|
+
const manifest = readPackageManifest(projectRoot, packageName);
|
|
69
|
+
if (!manifest) continue;
|
|
70
|
+
for (const [key, def] of Object.entries(manifest.objects ?? {})) {
|
|
71
|
+
const ref = objectRef(key, def ?? {}, manifest.packageName ?? packageName);
|
|
72
|
+
if (ref) declared.add(ref);
|
|
73
|
+
}
|
|
74
|
+
for (const recipe of manifest.recipes ?? []) if (typeof recipe.id === "string" && !recipes.has(recipe.id)) recipes.set(recipe.id, recipe);
|
|
75
|
+
}
|
|
76
|
+
const hosted = /* @__PURE__ */ new Set();
|
|
77
|
+
const withdrawn = /* @__PURE__ */ new Set();
|
|
78
|
+
for (const id of cookbook.recipes) {
|
|
79
|
+
const recipe = recipes.get(id);
|
|
80
|
+
if (!recipe || !Array.isArray(recipe.models)) continue;
|
|
81
|
+
const options = recipe.options ?? {};
|
|
82
|
+
for (const model of recipe.models) {
|
|
83
|
+
if (typeof model !== "string") continue;
|
|
84
|
+
hosted.add(model);
|
|
85
|
+
if (options[model]?.exposure?.api === false) withdrawn.add(model);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
for (const feature of cookbook.features ?? []) hosted.add(feature);
|
|
89
|
+
for (const [model, surfaces] of Object.entries(cookbook.exposure ?? {})) if (surfaces.includes("api")) withdrawn.add(model);
|
|
90
|
+
return [...hosted].filter((ref) => declared.has(ref) && !withdrawn.has(ref)).sort();
|
|
91
|
+
}
|
|
92
|
+
//#endregion
|
|
93
|
+
export { COOKBOOK_FILE, resolveCookbookHostedObjects };
|
|
94
|
+
|
|
95
|
+
//# sourceMappingURL=cookbook-exposure.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cookbook-exposure.js","names":[],"sources":["../../src/vite-preset/cookbook-exposure.ts"],"sourcesContent":["/**\n * Which consumed package models an app hosts over REST, derived from its\n * cookbook (#3749).\n *\n * `smrtConsumer({ svelteKit: { objects } })` already generates routes for an\n * explicit, provider-qualified allowlist and honours each model's `api` config\n * (an `api: false` or empty-include model gets no route). The cookbook is that\n * allowlist: the models of its recipes plus its `features`. The cookbook's own\n * `exposure` (surfaces switched off per model) and a recipe's\n * `options[model].exposure.api === false` withdraw a model; nothing here widens\n * what a model declares.\n */\nimport fs from 'node:fs';\nimport path from 'node:path';\nimport { validateCookbook } from '../cookbook/validate.js';\nimport { manifestExportCandidates } from '../manifest/package-manifest-exports.js';\n\n/** The cookbook file `smrt cookbook apply` writes at the project root. */\nexport const COOKBOOK_FILE = 'smrt.cookbook.json';\n\ninterface RecipeEntry {\n id?: unknown;\n models?: unknown;\n options?: unknown;\n}\n\ninterface PackageManifestJson {\n packageName?: string;\n objects?: Record<\n string,\n { qualifiedName?: string; className?: string; packageName?: string }\n >;\n recipes?: RecipeEntry[];\n}\n\nfunction readJson(file: string): unknown {\n return JSON.parse(fs.readFileSync(file, 'utf8'));\n}\n\n/** The package's JSON manifest, found the way the consumer plugin finds it. */\nfunction readPackageManifest(\n projectRoot: string,\n packageName: string,\n): PackageManifestJson | null {\n const dir = path.join(projectRoot, 'node_modules', packageName);\n const candidates = [\n ...manifestExportCandidates(dir),\n path.join(dir, 'dist', 'manifest.json'),\n path.join(dir, 'manifest.json'),\n ];\n for (const file of candidates) {\n if (!file.endsWith('.json') || !fs.existsSync(file)) continue;\n try {\n const parsed = readJson(file);\n if (parsed && typeof parsed === 'object') {\n return parsed as PackageManifestJson;\n }\n } catch {\n // Keep probing; the consumer plugin reports an unreadable manifest.\n }\n }\n return null;\n}\n\nfunction objectRef(\n key: string,\n def: { qualifiedName?: string; className?: string; packageName?: string },\n fallbackPackage: string,\n): string | undefined {\n if (key.includes(':')) return key;\n if (def.qualifiedName?.includes(':')) return def.qualifiedName;\n const pkg = def.packageName ?? fallbackPackage;\n return def.className ? `${pkg}:${def.className}` : undefined;\n}\n\n/**\n * Qualified refs of the consumed models the project's cookbook hosts. Returns\n * `[]` when the project has no cookbook. Refs that no consumed package\n * declares are dropped (the shell reports an unknown recipe or feature).\n *\n * @throws When `smrt.cookbook.json` is present but unreadable or invalid.\n */\nexport function resolveCookbookHostedObjects(\n projectRoot: string,\n packages: readonly string[],\n): string[] {\n const file = path.join(projectRoot, COOKBOOK_FILE);\n if (!fs.existsSync(file)) return [];\n\n let document: unknown;\n try {\n document = readJson(file);\n } catch (error) {\n throw new Error(\n `[smrt] Cannot read ${COOKBOOK_FILE}: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n const result = validateCookbook(document);\n if (!result.ok) {\n throw new Error(\n `[smrt] ${COOKBOOK_FILE} is not a valid cookbook:\\n- ${result.errors.join('\\n- ')}`,\n );\n }\n const { cookbook } = result;\n\n const declared = new Set<string>();\n const recipes = new Map<string, RecipeEntry>();\n for (const packageName of packages) {\n const manifest = readPackageManifest(projectRoot, packageName);\n if (!manifest) continue;\n for (const [key, def] of Object.entries(manifest.objects ?? {})) {\n const ref = objectRef(\n key,\n def ?? {},\n manifest.packageName ?? packageName,\n );\n if (ref) declared.add(ref);\n }\n for (const recipe of manifest.recipes ?? []) {\n if (typeof recipe.id === 'string' && !recipes.has(recipe.id)) {\n recipes.set(recipe.id, recipe);\n }\n }\n }\n\n const hosted = new Set<string>();\n const withdrawn = new Set<string>();\n for (const id of cookbook.recipes) {\n const recipe = recipes.get(id);\n if (!recipe || !Array.isArray(recipe.models)) continue;\n const options = (recipe.options ?? {}) as Record<\n string,\n { exposure?: { api?: unknown } } | undefined\n >;\n for (const model of recipe.models) {\n if (typeof model !== 'string') continue;\n hosted.add(model);\n if (options[model]?.exposure?.api === false) withdrawn.add(model);\n }\n }\n for (const feature of cookbook.features ?? []) hosted.add(feature);\n for (const [model, surfaces] of Object.entries(cookbook.exposure ?? {})) {\n if (surfaces.includes('api')) withdrawn.add(model);\n }\n\n return [...hosted]\n .filter((ref) => declared.has(ref) && !withdrawn.has(ref))\n .sort();\n}\n"],"mappings":";;;;;;;;;;;;;;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14,6 +14,15 @@ export interface SmrtPresetOptions {
|
|
|
14
14
|
* the app consumes none. Tooling/UI packages must not be listed.
|
|
15
15
|
*/
|
|
16
16
|
packages?: readonly string[];
|
|
17
|
+
/**
|
|
18
|
+
* Consumed package models to host over generated REST routes, as
|
|
19
|
+
* provider-qualified refs (`@scope/pkg:Model`). This is an HTTP exposure
|
|
20
|
+
* boundary: each model's own `api` config still applies, so an `api: false`
|
|
21
|
+
* model stays closed. Omit to derive it from `smrt.cookbook.json` (the models
|
|
22
|
+
* of its recipes and `features`, minus those its `exposure` turns off for
|
|
23
|
+
* `api`); without a cookbook nothing is hosted. `[]` hosts nothing.
|
|
24
|
+
*/
|
|
25
|
+
expose?: readonly string[];
|
|
17
26
|
/**
|
|
18
27
|
* Project root. Omit to follow the root Vite/SvelteKit resolve (the launch
|
|
19
28
|
* cwd); `smrt.config.ts` is searched from this value or `process.cwd()`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/vite-preset/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,MAAM,EAAc,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/vite-preset/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,MAAM,EAAc,MAAM,MAAM,CAAC;AAK/C,MAAM,WAAW,iBAAiB;IAChC;;;;OAIG;IACH,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC7B;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3B;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,+EAA+E;IAC/E,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,2EAA2E;IAC3E,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,sDAAsD;IACtD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,uFAAuF;IACvF,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,mDAAmD;IACnD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,yEAAyE;IACzE,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,wEAAwE;IACxE,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,eAAO,MAAM,oBAAoB;;;;;;;CAOvB,CAAC;AAmEX;;;;;;;GAOG;AACH,eAAO,MAAM,4BAA4B,4BAA6B,CAAC;AAWvE;;;;GAIG;AACH,wBAAsB,IAAI,CAAC,OAAO,GAAE,iBAAsB,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAgE7E"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { smrtPlugin } from "../vite-plugin/index.js";
|
|
2
2
|
import { smrtConsumer } from "../consumer-plugin/index.js";
|
|
3
|
+
import { resolveCookbookHostedObjects } from "./cookbook-exposure.js";
|
|
3
4
|
//#region src/vite-preset/index.ts
|
|
4
5
|
var SMRT_PRESET_DEFAULTS = {
|
|
5
6
|
objectsDir: "src/lib/objects",
|
|
@@ -75,13 +76,22 @@ async function smrt(options = {}) {
|
|
|
75
76
|
const plugins = [];
|
|
76
77
|
if (options.decorators !== false) plugins.push(decoratorPlugin());
|
|
77
78
|
plugins.push(sharedRuntimePlugin());
|
|
78
|
-
if (packages.length > 0)
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
79
|
+
if (packages.length > 0) {
|
|
80
|
+
const hosted = options.expose ? validatePackages(options.expose, "smrt({ expose })") : resolveCookbookHostedObjects(options.projectRoot ?? process.cwd(), packages);
|
|
81
|
+
plugins.push(smrtConsumer({
|
|
82
|
+
...rootOption,
|
|
83
|
+
packages,
|
|
84
|
+
generateTypes: true,
|
|
85
|
+
typesDir,
|
|
86
|
+
svelteKit: hosted.length > 0 ? {
|
|
87
|
+
objects: hosted,
|
|
88
|
+
routesDir,
|
|
89
|
+
objectsDir,
|
|
90
|
+
configPath,
|
|
91
|
+
configFileName
|
|
92
|
+
} : true
|
|
93
|
+
}));
|
|
94
|
+
}
|
|
85
95
|
const pluginOptions = {
|
|
86
96
|
...rootOption,
|
|
87
97
|
include: options.include ?? [`${objectsDir}/**/*.ts`],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/vite-preset/index.ts"],"sourcesContent":["/**\n * Single-plugin Vite preset for SMRT applications.\n *\n * `plugins: [sveltekit(), smrt()]` replaces the hand-copied glue every app\n * carried: the Oxc legacy-decorator block, `smrtConsumer({...})` with an\n * explicit package list, and `smrtPlugin({...})` with the SvelteKit path\n * options. `smrtConsumer` and `smrtPlugin` stay public and unchanged.\n */\nimport type { Plugin, UserConfig } from 'vite';\nimport { smrtConsumer } from '../consumer-plugin/index.js';\nimport { type SmrtPluginOptions, smrtPlugin } from '../vite-plugin/index.js';\n\nexport interface SmrtPresetOptions {\n /**\n * SMRT packages whose object manifests this app consumes. Takes precedence\n * over `consumer.packages` in `smrt.config.ts`. An empty array declares that\n * the app consumes none. Tooling/UI packages must not be listed.\n */\n packages?: readonly string[];\n /**\n * Project root. Omit to follow the root Vite/SvelteKit resolve (the launch\n * cwd); `smrt.config.ts` is searched from this value or `process.cwd()`.\n */\n projectRoot?: string;\n /** Directory of the app's own `@smrt()` objects. Default `src/lib/objects`. */\n objectsDir?: string;\n /** Generated type declarations. Default `src/lib/types/smrt-generated`. */\n typesDir?: string;\n /** Generated API routes. Default `src/routes/api`. */\n routesDir?: string;\n /** Directory holding the generated runtime config module. Default `src/lib/server`. */\n configPath?: string;\n /** File name of that module. Default `smrt.ts`. */\n configFileName?: string;\n /** Source globs scanned for objects. Default `<objectsDir>/**\\/*.ts`. */\n include?: string[];\n /** Source globs excluded from the scan. Default test and spec files. */\n exclude?: string[];\n /**\n * Apply the Oxc legacy-decorator config. Default `true`. Values the app sets\n * under `oxc.decorator` itself are never overwritten.\n */\n decorators?: boolean;\n}\n\nexport const SMRT_PRESET_DEFAULTS = {\n objectsDir: 'src/lib/objects',\n typesDir: 'src/lib/types/smrt-generated',\n routesDir: 'src/routes/api',\n configPath: 'src/lib/server',\n configFileName: 'smrt.ts',\n exclude: ['**/*.test.ts', '**/*.spec.ts'],\n} as const;\n\nfunction validatePackages(value: unknown, source: string): string[] {\n if (\n !Array.isArray(value) ||\n value.some((p) => typeof p !== 'string' || p.trim() === '')\n ) {\n throw new Error(\n `[smrt] ${source} must be an array of non-empty package names, got ${JSON.stringify(value)}.`,\n );\n }\n return [...new Set(value.map((p: string) => p.trim()))];\n}\n\n/** Resolve the declared consumer package list: option first, then smrt.config. */\nasync function resolvePackages(\n options: SmrtPresetOptions,\n searchFrom: string,\n): Promise<string[]> {\n if (options.packages !== undefined) {\n return validatePackages(options.packages, 'smrt({ packages })');\n }\n\n let declared: unknown;\n try {\n const { loadConfig } = await import('@happyvertical/smrt-config');\n const config = await loadConfig({ cache: false, searchFrom });\n declared = config.consumer?.packages;\n } catch (error) {\n throw new Error(\n `[smrt] Could not read smrt.config to resolve consumer packages: ${\n error instanceof Error ? error.message : String(error)\n }`,\n );\n }\n\n if (declared === undefined) {\n throw new Error(\n '[smrt] No consumer package list declared. Set `consumer: { packages: [...] }` in smrt.config.ts ' +\n '(use [] when the app consumes no SMRT packages) or pass `smrt({ packages })`. ' +\n 'The list is explicit so runtime registration is deterministic; it is never inferred from package.json.',\n );\n }\n return validatePackages(declared, 'smrt.config `consumer.packages`');\n}\n\nfunction decoratorPlugin(): Plugin {\n return {\n name: 'smrt:decorators',\n // Vite merges a hook's result over the user config, so fill only the\n // values the app has not set itself.\n config(user: UserConfig) {\n const decorator = (\n user as { oxc?: { decorator?: Record<string, unknown> } }\n ).oxc?.decorator;\n const fill: Record<string, boolean> = {};\n if (decorator?.legacy === undefined) fill.legacy = true;\n if (decorator?.emitDecoratorMetadata === undefined) {\n fill.emitDecoratorMetadata = true;\n }\n return Object.keys(fill).length\n ? ({ oxc: { decorator: fill } } as UserConfig)\n : undefined;\n },\n };\n}\n\n/**\n * Packages SMRT's SvelteKit entries share with the app by identity. SvelteKit\n * recognizes `redirect()`/`fail()` results by class, so a server entry such as\n * `@happyvertical/smrt-app-runtime/sveltekit` must import the app's own copy.\n * A registry install already resolves that peer from the app; a linked or\n * workspace package resolves it from its own directory instead, and its\n * redirects then surface as 500s. Deduping makes both layouts identical.\n */\nexport const SMRT_SHARED_RUNTIME_PACKAGES = ['@sveltejs/kit'] as const;\n\nfunction sharedRuntimePlugin(): Plugin {\n return {\n name: 'smrt:shared-runtime',\n config() {\n return { resolve: { dedupe: [...SMRT_SHARED_RUNTIME_PACKAGES] } };\n },\n };\n}\n\n/**\n * SMRT Vite preset: decorators, dependency manifests, and app object\n * generation in one entry. Returns a promise because the package list is read\n * from `smrt.config.ts`; Vite accepts promised plugins.\n */\nexport async function smrt(options: SmrtPresetOptions = {}): Promise<Plugin[]> {\n const D = SMRT_PRESET_DEFAULTS;\n const objectsDir = options.objectsDir ?? D.objectsDir;\n const typesDir = options.typesDir ?? D.typesDir;\n const routesDir = options.routesDir ?? D.routesDir;\n const configPath = options.configPath ?? D.configPath;\n const configFileName = options.configFileName ?? D.configFileName;\n const rootOption = options.projectRoot\n ? { projectRoot: options.projectRoot }\n : {};\n\n const packages = await resolvePackages(\n options,\n options.projectRoot ?? process.cwd(),\n );\n\n const plugins: Plugin[] = [];\n if (options.decorators !== false) plugins.push(decoratorPlugin());\n plugins.push(sharedRuntimePlugin());\n // smrtConsumer must precede smrtPlugin, as in the template's hand-written form.\n // With no declared packages there is nothing to consume, and an empty list\n // would otherwise trigger dependency discovery.\n if (packages.length > 0) {\n plugins.push(\n smrtConsumer({\n ...rootOption,\n packages,\n generateTypes: true,\n typesDir,\n svelteKit: true,\n }),\n );\n }\n const pluginOptions: SmrtPluginOptions = {\n ...rootOption,\n include: options.include ?? [`${objectsDir}/**/*.ts`],\n exclude: options.exclude ?? [...D.exclude],\n generateTypes: true,\n typeDeclarationsPath: typesDir,\n svelteKit: {\n enabled: true,\n routesDir,\n objectsDir,\n configPath,\n configFileName,\n },\n };\n plugins.push(smrtPlugin(pluginOptions));\n return plugins;\n}\n"],"mappings":";;;AA6CA,IAAa,uBAAuB;CAClC,YAAY;CACZ,UAAU;CACV,WAAW;CACX,YAAY;CACZ,gBAAgB;CAChB,SAAS,CAAC,gBAAgB,cAAc;AAC1C;AAEA,SAAS,iBAAiB,OAAgB,QAA0B;CAClE,IACE,CAAC,MAAM,QAAQ,KAAK,KACpB,MAAM,MAAM,MAAM,OAAO,MAAM,YAAY,EAAE,KAAK,MAAM,EAAE,GAE1D,MAAM,IAAI,MACR,UAAU,OAAO,oDAAoD,KAAK,UAAU,KAAK,EAAE,EAC7F;CAEF,OAAO,CAAC,GAAG,IAAI,IAAI,MAAM,KAAK,MAAc,EAAE,KAAK,CAAC,CAAC,CAAC;AACxD;;AAGA,eAAe,gBACb,SACA,YACmB;CACnB,IAAI,QAAQ,aAAa,KAAA,GACvB,OAAO,iBAAiB,QAAQ,UAAU,oBAAoB;CAGhE,IAAI;CACJ,IAAI;EACF,MAAM,EAAE,eAAe,MAAM,OAAO;EAEpC,YAAW,MADU,WAAW;GAAE,OAAO;GAAO;EAAW,CAAC,EAAA,CAC1C,UAAU;CAC9B,SAAS,OAAO;EACd,MAAM,IAAI,MACR,mEACE,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,GAEzD;CACF;CAEA,IAAI,aAAa,KAAA,GACf,MAAM,IAAI,MACR,sRAGF;CAEF,OAAO,iBAAiB,UAAU,iCAAiC;AACrE;AAEA,SAAS,kBAA0B;CACjC,OAAO;EACL,MAAM;EAGN,OAAO,MAAkB;GACvB,MAAM,YACJ,KACA,KAAK;GACP,MAAM,OAAgC,CAAC;GACvC,IAAI,WAAW,WAAW,KAAA,GAAW,KAAK,S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"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/vite-preset/index.ts"],"sourcesContent":["/**\n * Single-plugin Vite preset for SMRT applications.\n *\n * `plugins: [sveltekit(), smrt()]` replaces the hand-copied glue every app\n * carried: the Oxc legacy-decorator block, `smrtConsumer({...})` with an\n * explicit package list, and `smrtPlugin({...})` with the SvelteKit path\n * options. `smrtConsumer` and `smrtPlugin` stay public and unchanged.\n */\nimport type { Plugin, UserConfig } from 'vite';\nimport { smrtConsumer } from '../consumer-plugin/index.js';\nimport { type SmrtPluginOptions, smrtPlugin } from '../vite-plugin/index.js';\nimport { resolveCookbookHostedObjects } from './cookbook-exposure.js';\n\nexport interface SmrtPresetOptions {\n /**\n * SMRT packages whose object manifests this app consumes. Takes precedence\n * over `consumer.packages` in `smrt.config.ts`. An empty array declares that\n * the app consumes none. Tooling/UI packages must not be listed.\n */\n packages?: readonly string[];\n /**\n * Consumed package models to host over generated REST routes, as\n * provider-qualified refs (`@scope/pkg:Model`). This is an HTTP exposure\n * boundary: each model's own `api` config still applies, so an `api: false`\n * model stays closed. Omit to derive it from `smrt.cookbook.json` (the models\n * of its recipes and `features`, minus those its `exposure` turns off for\n * `api`); without a cookbook nothing is hosted. `[]` hosts nothing.\n */\n expose?: readonly string[];\n /**\n * Project root. Omit to follow the root Vite/SvelteKit resolve (the launch\n * cwd); `smrt.config.ts` is searched from this value or `process.cwd()`.\n */\n projectRoot?: string;\n /** Directory of the app's own `@smrt()` objects. Default `src/lib/objects`. */\n objectsDir?: string;\n /** Generated type declarations. Default `src/lib/types/smrt-generated`. */\n typesDir?: string;\n /** Generated API routes. Default `src/routes/api`. */\n routesDir?: string;\n /** Directory holding the generated runtime config module. Default `src/lib/server`. */\n configPath?: string;\n /** File name of that module. Default `smrt.ts`. */\n configFileName?: string;\n /** Source globs scanned for objects. Default `<objectsDir>/**\\/*.ts`. */\n include?: string[];\n /** Source globs excluded from the scan. Default test and spec files. */\n exclude?: string[];\n /**\n * Apply the Oxc legacy-decorator config. Default `true`. Values the app sets\n * under `oxc.decorator` itself are never overwritten.\n */\n decorators?: boolean;\n}\n\nexport const SMRT_PRESET_DEFAULTS = {\n objectsDir: 'src/lib/objects',\n typesDir: 'src/lib/types/smrt-generated',\n routesDir: 'src/routes/api',\n configPath: 'src/lib/server',\n configFileName: 'smrt.ts',\n exclude: ['**/*.test.ts', '**/*.spec.ts'],\n} as const;\n\nfunction validatePackages(value: unknown, source: string): string[] {\n if (\n !Array.isArray(value) ||\n value.some((p) => typeof p !== 'string' || p.trim() === '')\n ) {\n throw new Error(\n `[smrt] ${source} must be an array of non-empty package names, got ${JSON.stringify(value)}.`,\n );\n }\n return [...new Set(value.map((p: string) => p.trim()))];\n}\n\n/** Resolve the declared consumer package list: option first, then smrt.config. */\nasync function resolvePackages(\n options: SmrtPresetOptions,\n searchFrom: string,\n): Promise<string[]> {\n if (options.packages !== undefined) {\n return validatePackages(options.packages, 'smrt({ packages })');\n }\n\n let declared: unknown;\n try {\n const { loadConfig } = await import('@happyvertical/smrt-config');\n const config = await loadConfig({ cache: false, searchFrom });\n declared = config.consumer?.packages;\n } catch (error) {\n throw new Error(\n `[smrt] Could not read smrt.config to resolve consumer packages: ${\n error instanceof Error ? error.message : String(error)\n }`,\n );\n }\n\n if (declared === undefined) {\n throw new Error(\n '[smrt] No consumer package list declared. Set `consumer: { packages: [...] }` in smrt.config.ts ' +\n '(use [] when the app consumes no SMRT packages) or pass `smrt({ packages })`. ' +\n 'The list is explicit so runtime registration is deterministic; it is never inferred from package.json.',\n );\n }\n return validatePackages(declared, 'smrt.config `consumer.packages`');\n}\n\nfunction decoratorPlugin(): Plugin {\n return {\n name: 'smrt:decorators',\n // Vite merges a hook's result over the user config, so fill only the\n // values the app has not set itself.\n config(user: UserConfig) {\n const decorator = (\n user as { oxc?: { decorator?: Record<string, unknown> } }\n ).oxc?.decorator;\n const fill: Record<string, boolean> = {};\n if (decorator?.legacy === undefined) fill.legacy = true;\n if (decorator?.emitDecoratorMetadata === undefined) {\n fill.emitDecoratorMetadata = true;\n }\n return Object.keys(fill).length\n ? ({ oxc: { decorator: fill } } as UserConfig)\n : undefined;\n },\n };\n}\n\n/**\n * Packages SMRT's SvelteKit entries share with the app by identity. SvelteKit\n * recognizes `redirect()`/`fail()` results by class, so a server entry such as\n * `@happyvertical/smrt-app-runtime/sveltekit` must import the app's own copy.\n * A registry install already resolves that peer from the app; a linked or\n * workspace package resolves it from its own directory instead, and its\n * redirects then surface as 500s. Deduping makes both layouts identical.\n */\nexport const SMRT_SHARED_RUNTIME_PACKAGES = ['@sveltejs/kit'] as const;\n\nfunction sharedRuntimePlugin(): Plugin {\n return {\n name: 'smrt:shared-runtime',\n config() {\n return { resolve: { dedupe: [...SMRT_SHARED_RUNTIME_PACKAGES] } };\n },\n };\n}\n\n/**\n * SMRT Vite preset: decorators, dependency manifests, and app object\n * generation in one entry. Returns a promise because the package list is read\n * from `smrt.config.ts`; Vite accepts promised plugins.\n */\nexport async function smrt(options: SmrtPresetOptions = {}): Promise<Plugin[]> {\n const D = SMRT_PRESET_DEFAULTS;\n const objectsDir = options.objectsDir ?? D.objectsDir;\n const typesDir = options.typesDir ?? D.typesDir;\n const routesDir = options.routesDir ?? D.routesDir;\n const configPath = options.configPath ?? D.configPath;\n const configFileName = options.configFileName ?? D.configFileName;\n const rootOption = options.projectRoot\n ? { projectRoot: options.projectRoot }\n : {};\n\n const packages = await resolvePackages(\n options,\n options.projectRoot ?? process.cwd(),\n );\n\n const plugins: Plugin[] = [];\n if (options.decorators !== false) plugins.push(decoratorPlugin());\n plugins.push(sharedRuntimePlugin());\n // smrtConsumer must precede smrtPlugin, as in the template's hand-written form.\n // With no declared packages there is nothing to consume, and an empty list\n // would otherwise trigger dependency discovery.\n if (packages.length > 0) {\n const hosted = options.expose\n ? validatePackages(options.expose, 'smrt({ expose })')\n : resolveCookbookHostedObjects(\n options.projectRoot ?? process.cwd(),\n packages,\n );\n plugins.push(\n smrtConsumer({\n ...rootOption,\n packages,\n generateTypes: true,\n typesDir,\n svelteKit:\n hosted.length > 0\n ? {\n objects: hosted,\n routesDir,\n objectsDir,\n configPath,\n configFileName,\n }\n : true,\n }),\n );\n }\n const pluginOptions: SmrtPluginOptions = {\n ...rootOption,\n include: options.include ?? [`${objectsDir}/**/*.ts`],\n exclude: options.exclude ?? [...D.exclude],\n generateTypes: true,\n typeDeclarationsPath: typesDir,\n svelteKit: {\n enabled: true,\n routesDir,\n objectsDir,\n configPath,\n configFileName,\n },\n };\n plugins.push(smrtPlugin(pluginOptions));\n return plugins;\n}\n"],"mappings":";;;;AAuDA,IAAa,uBAAuB;CAClC,YAAY;CACZ,UAAU;CACV,WAAW;CACX,YAAY;CACZ,gBAAgB;CAChB,SAAS,CAAC,gBAAgB,cAAc;AAC1C;AAEA,SAAS,iBAAiB,OAAgB,QAA0B;CAClE,IACE,CAAC,MAAM,QAAQ,KAAK,KACpB,MAAM,MAAM,MAAM,OAAO,MAAM,YAAY,EAAE,KAAK,MAAM,EAAE,GAE1D,MAAM,IAAI,MACR,UAAU,OAAO,oDAAoD,KAAK,UAAU,KAAK,EAAE,EAC7F;CAEF,OAAO,CAAC,GAAG,IAAI,IAAI,MAAM,KAAK,MAAc,EAAE,KAAK,CAAC,CAAC,CAAC;AACxD;;AAGA,eAAe,gBACb,SACA,YACmB;CACnB,IAAI,QAAQ,aAAa,KAAA,GACvB,OAAO,iBAAiB,QAAQ,UAAU,oBAAoB;CAGhE,IAAI;CACJ,IAAI;EACF,MAAM,EAAE,eAAe,MAAM,OAAO;EAEpC,YAAW,MADU,WAAW;GAAE,OAAO;GAAO;EAAW,CAAC,EAAA,CAC1C,UAAU;CAC9B,SAAS,OAAO;EACd,MAAM,IAAI,MACR,mEACE,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,GAEzD;CACF;CAEA,IAAI,aAAa,KAAA,GACf,MAAM,IAAI,MACR,sRAGF;CAEF,OAAO,iBAAiB,UAAU,iCAAiC;AACrE;AAEA,SAAS,kB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ACZ;IACE,SAAS;IACT;IACA;IACA;IACA;GACF,IACA;EACR,CAAC,CACH;CACF;CACA,MAAM,gBAAmC;EACvC,GAAG;EACH,SAAS,QAAQ,WAAW,CAAC,GAAG,WAAW,SAAS;EACpD,SAAS,QAAQ,WAAW,CAAC,GAAG,EAAE,OAAO;EACzC,eAAe;EACf,sBAAsB;EACtB,WAAW;GACT,SAAS;GACT;GACA;GACA;GACA;EACF;CACF;CACA,QAAQ,KAAK,WAAW,aAAa,CAAC;CACtC,OAAO;AACT"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@happyvertical/smrt-core",
|
|
3
|
-
"version": "0.55.
|
|
3
|
+
"version": "0.55.12",
|
|
4
4
|
"description": "Core AI agent framework with standardized collections, object-relational mapping, and code generators",
|
|
5
5
|
"author": "HappyVertical",
|
|
6
6
|
"type": "module",
|
|
@@ -167,7 +167,18 @@
|
|
|
167
167
|
"types": "./dist/testing.d.ts",
|
|
168
168
|
"import": "./dist/testing.js",
|
|
169
169
|
"default": "./dist/testing.js"
|
|
170
|
-
}
|
|
170
|
+
},
|
|
171
|
+
"./cookbook": {
|
|
172
|
+
"types": "./dist/cookbook.d.ts",
|
|
173
|
+
"import": "./dist/cookbook.js",
|
|
174
|
+
"default": "./dist/cookbook.js"
|
|
175
|
+
},
|
|
176
|
+
"./cookbook/engine": {
|
|
177
|
+
"types": "./dist/cookbook/engine.d.ts",
|
|
178
|
+
"import": "./dist/cookbook/engine.js",
|
|
179
|
+
"default": "./dist/cookbook/engine.js"
|
|
180
|
+
},
|
|
181
|
+
"./cookbook/v1.schema.json": "./dist/cookbook/v1.schema.json"
|
|
171
182
|
},
|
|
172
183
|
"browser": {
|
|
173
184
|
"./dist/host.js": "./dist/host.browser.js",
|
|
@@ -178,9 +189,9 @@
|
|
|
178
189
|
"@happyvertical/files": "^0.103.1",
|
|
179
190
|
"@happyvertical/json": "^0.103.1",
|
|
180
191
|
"@happyvertical/logger": "^0.103.1",
|
|
181
|
-
"@happyvertical/smrt-config": "0.55.
|
|
182
|
-
"@happyvertical/smrt-scanner": "0.55.
|
|
183
|
-
"@happyvertical/smrt-types": "0.55.
|
|
192
|
+
"@happyvertical/smrt-config": "0.55.12",
|
|
193
|
+
"@happyvertical/smrt-scanner": "0.55.12",
|
|
194
|
+
"@happyvertical/smrt-types": "0.55.12",
|
|
184
195
|
"@happyvertical/sql": "^0.103.1",
|
|
185
196
|
"@happyvertical/utils": "^0.103.1",
|
|
186
197
|
"@noble/hashes": "^2.4.0",
|
|
@@ -213,6 +224,7 @@
|
|
|
213
224
|
"@types/node": "24.13.6",
|
|
214
225
|
"@types/pluralize": "^0.0.33",
|
|
215
226
|
"@xenova/transformers": "^2.17.2",
|
|
227
|
+
"ajv": "8.20.0",
|
|
216
228
|
"svelte": "^5.57.1",
|
|
217
229
|
"svelte-check": "^4.7.6",
|
|
218
230
|
"typescript": "6.0.3",
|
|
@@ -237,7 +249,7 @@
|
|
|
237
249
|
"test:postgres": "node scripts/generate-test-manifest.js && NODE_OPTIONS=--trace-deprecation node ../../scripts/run-with-ci-postgres.mjs -- pnpm exec vitest run optional.test.ts",
|
|
238
250
|
"test:integration": "TEST_INTEGRATION=1 vitest run src/__tests__/full-registry-integration.test.ts src/__tests__/manifest-no-leak.test.ts",
|
|
239
251
|
"test:watch": "node scripts/generate-test-manifest.js && vitest",
|
|
240
|
-
"build": "node scripts/generate-manifest.js && vite build && cp -r src/vite-plugin/templates dist/vite-plugin/ && cp -r scripts dist/ && cp src/manifest/static-manifest.json dist/manifest.json && cp src/manifest/smrt-knowledge.json dist/smrt-knowledge.json",
|
|
252
|
+
"build": "node scripts/generate-manifest.js && vite build && cp -r src/vite-plugin/templates dist/vite-plugin/ && cp -r scripts dist/ && cp src/manifest/static-manifest.json dist/manifest.json && cp src/manifest/smrt-knowledge.json dist/smrt-knowledge.json && cp src/cookbook/v1.schema.json dist/cookbook/v1.schema.json",
|
|
241
253
|
"build:watch": "vite build --watch",
|
|
242
254
|
"clean": "rm -rf dist docs",
|
|
243
255
|
"dev": "npm run build:watch & npm run test:watch",
|