@happyvertical/smrt-core 0.55.0 → 0.55.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +8 -0
- package/agents/build-knowledge.md +42 -0
- package/agents/generators.md +13 -0
- package/agents/recipes.md +150 -0
- package/dist/browser.d.ts +3 -0
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js +4 -1
- package/dist/generators/mcp.d.ts.map +1 -1
- package/dist/generators/mcp.js +10 -6
- package/dist/generators/mcp.js.map +1 -1
- package/dist/generators/swagger.d.ts.map +1 -1
- package/dist/generators/swagger.js +3 -0
- package/dist/generators/swagger.js.map +1 -1
- package/dist/generators/tool-schema.d.ts +9 -0
- package/dist/generators/tool-schema.d.ts.map +1 -1
- package/dist/generators/tool-schema.js +10 -7
- package/dist/generators/tool-schema.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -1
- package/dist/knowledge.d.ts.map +1 -1
- package/dist/knowledge.js +13 -2
- package/dist/knowledge.js.map +1 -1
- package/dist/manifest/generator.d.ts.map +1 -1
- package/dist/manifest/generator.js +3 -1
- package/dist/manifest/generator.js.map +1 -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/object.d.ts.map +1 -1
- package/dist/object.js +9 -3
- package/dist/object.js.map +1 -1
- package/dist/prebuild/index.d.ts.map +1 -1
- package/dist/prebuild/index.js +1 -0
- package/dist/prebuild/index.js.map +1 -1
- package/dist/recipe-help.d.ts +186 -0
- package/dist/recipe-help.d.ts.map +1 -0
- package/dist/recipe-help.js +311 -0
- package/dist/recipe-help.js.map +1 -0
- package/dist/recipe.d.ts +83 -0
- package/dist/recipe.d.ts.map +1 -0
- package/dist/recipe.js +30 -0
- package/dist/recipe.js.map +1 -0
- package/dist/registry/manifest-field-merge.d.ts +6 -0
- package/dist/registry/manifest-field-merge.d.ts.map +1 -1
- package/dist/registry/manifest-field-merge.js +12 -1
- package/dist/registry/manifest-field-merge.js.map +1 -1
- package/dist/registry/types.d.ts +17 -0
- package/dist/registry/types.d.ts.map +1 -1
- package/dist/scanner/index.d.ts +1 -1
- package/dist/scanner/index.d.ts.map +1 -1
- package/dist/scanner/manifest-generator.d.ts +33 -0
- package/dist/scanner/manifest-generator.d.ts.map +1 -1
- package/dist/scanner/manifest-generator.js +124 -0
- package/dist/scanner/manifest-generator.js.map +1 -1
- package/dist/scanner/types.d.ts +47 -0
- package/dist/scanner/types.d.ts.map +1 -1
- package/dist/scanner/types.js.map +1 -1
- package/dist/smrt-knowledge.json +16 -9
- package/dist/ui-metadata.d.ts +60 -0
- package/dist/ui-metadata.d.ts.map +1 -0
- package/dist/ui-metadata.js +85 -0
- package/dist/ui-metadata.js.map +1 -0
- package/dist/utils/scanner-module.d.ts +18 -1
- package/dist/utils/scanner-module.d.ts.map +1 -1
- package/dist/vite-plugin/index.d.ts.map +1 -1
- package/dist/vite-plugin/index.js +4 -1
- package/dist/vite-plugin/index.js.map +1 -1
- package/dist/vite-plugin/web-collections.d.ts.map +1 -1
- package/dist/vite-plugin/web-collections.js +8 -3
- package/dist/vite-plugin/web-collections.js.map +1 -1
- package/package.json +15 -10
package/AGENTS.md
CHANGED
|
@@ -26,6 +26,7 @@ and repository rules.
|
|
|
26
26
|
| `src/system/registry-snapshot.ts` | Sanitized plain-JSON projection of the booted `ObjectRegistry` for the smrt-dev-mcp runtime dev-plane (#1831); never constructors, validators, values, or absolute paths | [agents/registry-snapshot.md](agents/registry-snapshot.md) |
|
|
27
27
|
| `src/registry/qualified-name-aliases.ts`, `src/migrations/qualified-name-aliases.ts` | Model moves: `previousQualifiedNames` aliases, deprecation, doctor counts, opt-in backfill (#3338) | [agents/model-moves.md](agents/model-moves.md) |
|
|
28
28
|
| `src/run-once.ts` | Shared idempotency seam: insert-only claim + caller work in one transaction, replay on retry, typed in-flight/unknown-outcome answers (#3080) | [agents/run-once.md](agents/run-once.md) |
|
|
29
|
+
| `src/recipe.ts`, `../scanner/src/recipes.ts` | `SmrtRecipe`: declared user-facing units (models, nav, `requires`, curation `options`) collected into manifest and knowledge `recipes` (#3590) | [agents/recipes.md](agents/recipes.md) |
|
|
29
30
|
|
|
30
31
|
## Cross-module invariants
|
|
31
32
|
|
|
@@ -169,6 +170,13 @@ and repository rules.
|
|
|
169
170
|
`src/filesystem-loader.ts`, not a static files-SDK import. Fully bundled apps
|
|
170
171
|
import `@happyvertical/smrt-core/filesystem` at startup. Use
|
|
171
172
|
`importOptionalDependency()` for similarly heavy optional dependencies.
|
|
173
|
+
- `exports['.'].browser` (`dist/browser.js`) is the browser surface. Model
|
|
174
|
+
package roots are bundled for browsers by the bundle-gate browser fixture
|
|
175
|
+
(#3621): anything a model root imports from core must be exported by the
|
|
176
|
+
browser entry and must not reach `node:` built-ins, `pg`, `cosmiconfig`, or
|
|
177
|
+
`jiti`. Keep Node-only code behind a subpath or a lazy import; when a fix
|
|
178
|
+
makes a package pass, delete its entry in
|
|
179
|
+
`packages/bundle-gate/src/browser-gate/expected-failures.ts`.
|
|
172
180
|
- Database retries are transient-only, four attempts total for `get`/`upsert`.
|
|
173
181
|
Use `src/db-errors.ts` classifiers through the cause chain, never message
|
|
174
182
|
matching (SDK driver text can live in `context.originalError`). Constraints,
|
|
@@ -15,6 +15,48 @@ schemas. No schema/persistence/security effect — `sensitive`/`readPermission`
|
|
|
15
15
|
stay the security rail, and `sensitive`/`transient` fields never emit to the
|
|
16
16
|
client at all.
|
|
17
17
|
|
|
18
|
+
`ui.widget` (#3599) adds a presentation widget hint:
|
|
19
|
+
`'textarea' | 'currency' | 'email' | 'url' | 'phone'`. It rides the same
|
|
20
|
+
`_meta.ui` channel and is also emitted (sanitized) into web-collection
|
|
21
|
+
definitions. The manifest generator validates it against the field type and
|
|
22
|
+
fails the build otherwise: every widget needs a `text` field (`currency` is a
|
|
23
|
+
currency-CODE picker for an ISO 4217 string such as `currency = 'USD'`, not a
|
|
24
|
+
money amount; amounts are integer minor units and take no widget); an unknown
|
|
25
|
+
value or a non-text field is an error. `ui.widget` is a hint only — it never changes
|
|
26
|
+
the column type or validation.
|
|
27
|
+
|
|
28
|
+
## Presentation metadata (#3599)
|
|
29
|
+
|
|
30
|
+
Pure helpers live in `src/ui-metadata.ts`, published browser-safe as
|
|
31
|
+
`@happyvertical/smrt-core/ui-metadata` (also re-exported from the package
|
|
32
|
+
root). `ManifestGenerator.applyUiMetadata()` runs in `applyGenerationPasses`
|
|
33
|
+
after inheritance, so every producer (Vite plugin, `ManifestBuilder`,
|
|
34
|
+
`generateManifest`) validates the same way.
|
|
35
|
+
|
|
36
|
+
- **Display label.** `@smrt({ display: { label: '<field>' } })` names the own
|
|
37
|
+
field generic pickers and assistants use to label a record. Own fields only —
|
|
38
|
+
no paths into other packages; a model whose label lives elsewhere ships a
|
|
39
|
+
selector. Undeclared, it defaults to the first of `name`, `title`, `label`,
|
|
40
|
+
`code` that is a usable own field. Build fails when the declared field is
|
|
41
|
+
missing, `sensitive`, `transient`, or a relationship/json field. The resolved
|
|
42
|
+
field is emitted as `displayLabelField` on the manifest object and in the
|
|
43
|
+
knowledge artifact, and generated MCP/WebMCP `list`/`get`/`update`/`delete`
|
|
44
|
+
descriptions end with ``Records are identified by their `<field>` field.``
|
|
45
|
+
(`describeAction` in `generators/tool-schema.ts`; nothing is added when the
|
|
46
|
+
model has no label field).
|
|
47
|
+
- **Selector slots.** `ModuleUISlot.selects: '@scope/pkg:Model'`
|
|
48
|
+
(`@happyvertical/smrt-types`) marks a package component as THE selector for a
|
|
49
|
+
model. The scanner reads such slots statically from `src/**/ui.ts`
|
|
50
|
+
(`parseUiSelectorsFile`, independent of the class glob) and the manifest
|
|
51
|
+
carries them as `uiSelectors` keyed by slot id. `selects` must be a string
|
|
52
|
+
literal; a duplicate slot id, two selectors for one model, or an own-package
|
|
53
|
+
target that does not exist fails the build. Hosts call
|
|
54
|
+
`findSelectorFor(manifests, qualifiedName)`; generic forms use the selector
|
|
55
|
+
for any `@foreignKey`/`@crossPackageRef` field targeting that model and fall
|
|
56
|
+
back to a generic picker labelled by `displayLabelField`. `display` is read
|
|
57
|
+
per class: an STI subclass that declares none uses the default lookup rather
|
|
58
|
+
than its base's declaration, and a CTI child cannot name a parent's field.
|
|
59
|
+
|
|
18
60
|
## Worker registration artifact (#3117)
|
|
19
61
|
|
|
20
62
|
With `svelteKit.enabled`, a production `vite build` compiles the generated
|
package/agents/generators.md
CHANGED
|
@@ -302,3 +302,16 @@ and static collection-scoped actions only need registration, so they import
|
|
|
302
302
|
and `@happyvertical/smrt-app-runtime/sveltekit` resolves from the consumer, the
|
|
303
303
|
generator writes a runtime-shaped default instead of the legacy
|
|
304
304
|
`getCollection` file.
|
|
305
|
+
|
|
306
|
+
## Enum-constrained fields (#3598)
|
|
307
|
+
|
|
308
|
+
The scanner emits `enum: [...]` on a manifest field typed as a TS enum or
|
|
309
|
+
string/number literal union. Registry-sourced fields mirror it into
|
|
310
|
+
`_meta.enum` (`createFieldFromManifest` / `mergeManifestField`); read it with
|
|
311
|
+
`readFieldEnum()` (top level first, then `_meta`), never directly. Generated
|
|
312
|
+
tool schemas (`fieldTypeToJsonSchema`, so MCP and WebMCP descriptors), OpenAPI
|
|
313
|
+
(`swagger.ts`) and the legacy `generateSchemaProperties` emit JSON Schema
|
|
314
|
+
`enum` for `text`/`integer`/`decimal` fields only; a nullable field appends
|
|
315
|
+
`null` to the list so `type: [.., 'null']` still validates. The client web
|
|
316
|
+
collection `fields` map does not carry `enum` yet (it feeds the shape digest and
|
|
317
|
+
three hand-mirrored d.ts files); tool inputs read it from the manifest field.
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
# SmrtRecipe: declared units of app functionality (#3590)
|
|
2
|
+
|
|
3
|
+
A **recipe** is a small, named, user-facing unit ("Sales", "Customers"),
|
|
4
|
+
smaller than a package. An app or agent adds a recipe and gets that section:
|
|
5
|
+
navigation, list and create/edit views, and its prerequisites, without every
|
|
6
|
+
model in the owning package. Source: `src/recipe.ts` (authoring base class),
|
|
7
|
+
`packages/scanner/src/recipes.ts` (matcher and validation), types in
|
|
8
|
+
`@happyvertical/smrt-types` (`RecipeDefinition`).
|
|
9
|
+
|
|
10
|
+
## Authoring
|
|
11
|
+
|
|
12
|
+
`SmrtRecipe` is an abstract, **non-persisted, non-`@smrt()`** base class
|
|
13
|
+
exported from both core entries (`index.ts` and `browser.ts`). A recipe is a
|
|
14
|
+
subclass with static properties, in the package that owns its models:
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
export class SalesRecipe extends SmrtRecipe {
|
|
18
|
+
static id = 'commerce.sales'; // dotted lowercase, unique
|
|
19
|
+
static label = 'Sales';
|
|
20
|
+
static summary = 'Take customer orders and track them.';
|
|
21
|
+
static synonyms = ['sales orders', 'orders'];
|
|
22
|
+
static models = [Order]; // class references
|
|
23
|
+
static nav = [{ label: 'Sales Orders', model: Order }];
|
|
24
|
+
static requires = ['commerce.customers']; // recipe ids, any package
|
|
25
|
+
static options = { Order: { fields: { status: { default: 'draft' } } } };
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Statics are read **structurally** (nothing is evaluated), so each must be
|
|
30
|
+
spelled literally; `models` and `nav[].model` take identifiers. Write
|
|
31
|
+
`static options = { ... } as const` so `visibility` stays a literal type.
|
|
32
|
+
The emitted `options` are keyed by qualified model name.
|
|
33
|
+
|
|
34
|
+
## How the scanner collects it
|
|
35
|
+
|
|
36
|
+
The scanner class pass finds classes by decorator, which a recipe lacks, so
|
|
37
|
+
`recipes.ts` is a second matcher in the style of the agent-surface one: a class
|
|
38
|
+
whose `extends` resolves to the `SmrtRecipe` import binding from
|
|
39
|
+
`@happyvertical/smrt-core` (named, aliased `SmrtRecipe as R`, or namespace
|
|
40
|
+
`Core.SmrtRecipe`; any core subpath such as `/browser`). A same-named local
|
|
41
|
+
class or an import from another library is not a recipe. A recipe must extend
|
|
42
|
+
`SmrtRecipe` **directly**. Within one file, extending another recipe or declaring
|
|
43
|
+
one as a class expression or inside a block is a scan error rather than a silent
|
|
44
|
+
drop. Across files it is not detected: a module that never names `SmrtRecipe`
|
|
45
|
+
is not read, so a recipe extending a recipe or intermediate base imported from
|
|
46
|
+
another module is unsupported and would be missing from the artifacts.
|
|
47
|
+
|
|
48
|
+
Class references resolve to qualified names (`@scope/pkg:Class`) through the
|
|
49
|
+
import binding: a relative specifier picks the scanned class by file, then by
|
|
50
|
+
class name (barrel re-exports keep the name); an aliased import follows the
|
|
51
|
+
*imported* name; `Ns.Class` namespace members and same-file classes work; a
|
|
52
|
+
bare package specifier is rejected (models must belong to this package). When
|
|
53
|
+
the imported file declares no such class, the barrel fallback binds a same-named
|
|
54
|
+
scanned class, so keep model class names unique within a package. This
|
|
55
|
+
was chosen over qualified-name strings because it type-checks and survives
|
|
56
|
+
renames; strings were not needed.
|
|
57
|
+
|
|
58
|
+
Recipe discovery is independent of the model `include` glob (like intents; it is
|
|
59
|
+
not gated by the `agentSurface` option), and
|
|
60
|
+
`ScanResults.recipes` is populated by `resolve()`. Every error is a scan error,
|
|
61
|
+
so every producer that reads `scanAndResolve()` (`smrtPlugin`, `ManifestBuilder`)
|
|
62
|
+
fails the build. (The legacy `ManifestGenerator.generateManifest()` path takes
|
|
63
|
+
pre-scanned results and never sees recipes.) The adapter qualifies names and emits a top-level `recipes` array in
|
|
64
|
+
`manifest.json`; `buildDomainKnowledgeManifest` projects the same array into
|
|
65
|
+
`smrt-knowledge.json`. A package with no recipe emits no key.
|
|
66
|
+
|
|
67
|
+
## Build-time validation
|
|
68
|
+
|
|
69
|
+
Ids are dotted lowercase and unique; `models` is non-empty, resolvable, and
|
|
70
|
+
duplicate-free; every `nav` model is in `models`; `requires` are well-formed,
|
|
71
|
+
not self-referential or duplicated, and acyclic within the package (ids in other
|
|
72
|
+
packages cannot be checked at scan time); `options` name only listed models and
|
|
73
|
+
and only the keys below. Field names are checked in core
|
|
74
|
+
(`ManifestGenerator.assertRecipeOptions`, after inherited fields merge) against
|
|
75
|
+
the merged manifest, so STI-merged, tenant, and framework-base fields such as
|
|
76
|
+
`parentId` are accepted along with the universal `id`, `slug`, `context`,
|
|
77
|
+
`created_at`, `updated_at`; anything else fails the build.
|
|
78
|
+
|
|
79
|
+
## options: curation hints, never a second schema
|
|
80
|
+
|
|
81
|
+
Keyed by model class name. `fields.<name>` accepts the smrt-fields policy
|
|
82
|
+
vocabulary: `default`, `label`, `help`, `order`, `visibility`
|
|
83
|
+
(`basic | advanced | hidden`), `locked`; applying a recipe produces
|
|
84
|
+
field-policy rows. `exposure.<api|mcp|cli>` accepts only `false` or
|
|
85
|
+
non-empty `{ exclude: [...] }` naming a CRUD verb (`list`, `get`, `create`,
|
|
86
|
+
`update`, `delete`) or a public instance method the model declares or inherits: `true` and `include` are
|
|
87
|
+
rejected because they can widen what the model already declares. Custom fields are out of scope.
|
|
88
|
+
|
|
89
|
+
## User-facing help (#3591)
|
|
90
|
+
|
|
91
|
+
Help is documentation for the people using the app, not developers. It lives
|
|
92
|
+
beside the recipe as Markdown and is pointed to by `static help`:
|
|
93
|
+
|
|
94
|
+
```ts
|
|
95
|
+
export class SalesRecipe extends SmrtRecipe {
|
|
96
|
+
// ...
|
|
97
|
+
static help = './sales.recipe.md'; // relative to the recipe file, .md only
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
The file holds an **Overview** and **Tasks** (short how-tos). A step names a
|
|
102
|
+
field as `{field:<fieldName>}` or `{field:<Model>.<fieldName>}`; the Markdown
|
|
103
|
+
block (heading, paragraph, or list item) containing a reference is **tied to
|
|
104
|
+
that field**. Keep prose in the separate file rather than the recipe class.
|
|
105
|
+
Field text itself comes from `@field({ description })`, the user-facing seed
|
|
106
|
+
smrt-fields uses for form help; every field a recipe shows should carry one.
|
|
107
|
+
|
|
108
|
+
**Emission.** The scanner reads the file (a missing, empty, non-`.md`, absolute
|
|
109
|
+
or `..`-climbing path is a scan error) and emits
|
|
110
|
+
`help: { markdown, fieldRefs }` on the recipe entry in `manifest.json` and
|
|
111
|
+
`smrt-knowledge.json`, so a static host needs no further request.
|
|
112
|
+
`fieldRefs` (distinct references as written, sorted) is **derived**, never
|
|
113
|
+
authored. Knowledge fields also carry `description` (sensitive fields stay
|
|
114
|
+
excluded). `ManifestGenerator.assertRecipeHelp` fails the build on a reference
|
|
115
|
+
to a field the recipe's models do not declare, and on a `fieldRefs` list that
|
|
116
|
+
disagrees with the Markdown. The scanner has its own copy of the reference
|
|
117
|
+
grammar (`deriveHelpFieldRefs`; it cannot import core), so that comparison also
|
|
118
|
+
keeps the two from drifting. A reference to a **sensitive** or universal (`id`,
|
|
119
|
+
`slug`, ...) field also fails the build: neither reaches the knowledge artifact,
|
|
120
|
+
so a host building its field list from it would silently drop the step naming
|
|
121
|
+
one; describe such a field in prose without a reference.
|
|
122
|
+
|
|
123
|
+
Known limitation: the help file is a generator input, but editing only it does
|
|
124
|
+
not trigger a dev-server rescan (the watch matches source globs) and generation
|
|
125
|
+
snapshots do not digest it, so rebuild (or touch a `.ts` source) after editing.
|
|
126
|
+
|
|
127
|
+
**Rendering.** `src/recipe-help.ts` is pure and browser-safe (exported from
|
|
128
|
+
both core entries). `renderHelp(help, models, options?)` takes the recipe's
|
|
129
|
+
help plus the app's effective field policies (`HelpModel[]`; label, help,
|
|
130
|
+
visibility, disabled in smrt-fields vocabulary, with `@field` descriptions) and
|
|
131
|
+
returns `{ blocks, glossary, connect? }`:
|
|
132
|
+
|
|
133
|
+
- `{field:x}` becomes the effective label;
|
|
134
|
+
- a block tied to a hidden, disabled, undeclared, or **advanced** field (unless
|
|
135
|
+
`showAdvanced`) is dropped; a list item drops alone; a heading whose section
|
|
136
|
+
had content that was all dropped is pruned (a heading that never had content
|
|
137
|
+
stays);
|
|
138
|
+
- the glossary lists each shown field with its effective help, else its
|
|
139
|
+
description. A shown field with neither is **skipped**, not listed blank;
|
|
140
|
+
- `connect` is the collapsed "Connect other tools" section: the recipe's
|
|
141
|
+
generated REST routes, MCP tools and CLI commands (`options.surfaces`, from
|
|
142
|
+
the knowledge artifact), minus the recipe's `exposure` narrowing
|
|
143
|
+
(`options.exposure`). Hosts render it last.
|
|
144
|
+
|
|
145
|
+
The result is an AST of text nodes (`text`, `code`, `strong`, `em`), never HTML,
|
|
146
|
+
so authored markup stays inert text and nothing needs sanitizing. Only
|
|
147
|
+
`##`-`####` headings, paragraphs, flat lists and bold/italic/code are
|
|
148
|
+
understood. `helpToMarkdown(rendered)` flattens it for hosts with their own
|
|
149
|
+
renderer; render that with raw HTML disabled. `validateHelp(help, models)`
|
|
150
|
+
returns the build-failure problems for hand-built entries.
|
package/dist/browser.d.ts
CHANGED
|
@@ -27,10 +27,13 @@ export { type HierarchyView, SmrtHierarchical } from "./hierarchical.js";
|
|
|
27
27
|
export { type JunctionAttachOptions, type JunctionFilterOptions, SmrtJunction, SmrtJunctionBase, } from "./junction.js";
|
|
28
28
|
export * from "./object.js";
|
|
29
29
|
export { SmrtPolymorphicAssociation, type SmrtPolymorphicAssociationOptions, } from "./polymorphic-association.js";
|
|
30
|
+
export { SmrtRecipe, type SmrtRecipeModel, type SmrtRecipeModelOptions, type SmrtRecipeNavEntry, } from "./recipe.js";
|
|
31
|
+
export { buildConnectSection, buildGlossary, type ConnectSection, type ConnectSurface, createRecipeHelp, extractFieldRefs, findField, type GlossaryEntry, type HelpBlock, type HelpField, type HelpModel, helpToMarkdown, type Inline, parseHelp, type RecipeHelp, type RenderedHelp, type RenderHelpOptions, renderHelp, resolveHelp, validateHelp, } from "./recipe-help.js";
|
|
30
32
|
export * from "./registry.js";
|
|
31
33
|
export { smrt as smrtRegistry } from "./registry.js";
|
|
32
34
|
export * from "./signals/index.js";
|
|
33
35
|
export * from "./system/index.js";
|
|
34
36
|
export type { DiscoveryStrategy, ForgetOptions, ForgetScopeOptions, NoteMetadata, NoteOptions, RecallAllOptions, RecallOptions, SystemTableConfig, } from "./system/types.js";
|
|
35
37
|
export * from "./tools/index.js";
|
|
38
|
+
export * from './ui-metadata.js';
|
|
36
39
|
//# sourceMappingURL=browser.d.ts.map
|
package/dist/browser.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,cAAc,qBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAE3B,cAAc,YAAS,CAAC;AACxB,cAAc,iBAAc,CAAC;AAC7B,YAAY,EACV,aAAa,EACb,kBAAkB,EAClB,aAAa,EACb,YAAY,GACb,MAAM,aAAU,CAAC;AAElB,OAAO,EAAE,MAAM,EAAE,MAAM,aAAU,CAAC;AAOlC,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,KAAK,2BAA2B,EAChC,KAAK,iBAAiB,EACtB,yBAAyB,EACzB,4BAA4B,EAC5B,uBAAuB,EACvB,wBAAwB,EACxB,sBAAsB,GACvB,MAAM,gBAAa,CAAC;AAIrB,cAAc,gBAAa,CAAC;AAC5B,cAAc,aAAU,CAAC;AACzB,OAAO,EAAE,KAAK,aAAa,EAAE,gBAAgB,EAAE,MAAM,mBAAgB,CAAC;AACtE,OAAO,EACL,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC1B,YAAY,EACZ,gBAAgB,GACjB,MAAM,eAAY,CAAC;AACpB,cAAc,aAAU,CAAC;AACzB,OAAO,EACL,0BAA0B,EAC1B,KAAK,iCAAiC,GACvC,MAAM,8BAA2B,CAAC;AACnC,cAAc,eAAY,CAAC;AAC3B,OAAO,EAAE,IAAI,IAAI,YAAY,EAAE,MAAM,eAAY,CAAC;AAElD,cAAc,oBAAiB,CAAC;AAEhC,cAAc,mBAAgB,CAAC;AAC/B,YAAY,EACV,iBAAiB,EACjB,aAAa,EACb,kBAAkB,EAClB,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,aAAa,EACb,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T,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,UAAU,EACV,WAAW,EACX,YAAY,GACb,MAAM,kBAAe,CAAC;AACvB,cAAc,eAAY,CAAC;AAC3B,OAAO,EAAE,IAAI,IAAI,YAAY,EAAE,MAAM,eAAY,CAAC;AAElD,cAAc,oBAAiB,CAAC;AAEhC,cAAc,mBAAgB,CAAC;AAC/B,YAAY,EACV,iBAAiB,EACjB,aAAa,EACb,kBAAkB,EAClB,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,aAAa,EACb,iBAAiB,GAClB,MAAM,mBAAgB,CAAC;AAExB,cAAc,kBAAe,CAAC;AAO9B,cAAc,kBAAkB,CAAC"}
|
package/dist/browser.js
CHANGED
|
@@ -15,6 +15,8 @@ import { ensureSystemTables } from "./system/bootstrap.js";
|
|
|
15
15
|
import { SmrtClass } from "./class.js";
|
|
16
16
|
import { DEFAULT_FACET_LIMIT, EmbeddingUnavailableError, MAX_FACET_FIELDS, MAX_FACET_LIMIT, MAX_STI_READ_SCOPE_TYPES, SmrtCollection } from "./collection.js";
|
|
17
17
|
import { convertTypeToJsonSchema, generateToolFromMethod, generateToolManifest, shouldIncludeMethod } from "./tools/tool-generator.js";
|
|
18
|
+
import { buildConnectSection, buildGlossary, createRecipeHelp, extractFieldRefs, findField, helpToMarkdown, parseHelp, renderHelp, resolveHelp, validateHelp } from "./recipe-help.js";
|
|
19
|
+
import { DEFAULT_DISPLAY_LABEL_FIELDS, FIELD_UI_WIDGETS, FIELD_UI_WIDGET_TYPES, describeDisplayLabel, displayLabelFieldProblem, findSelectorFor, isFieldUIWidget, resolveDisplayLabelField } from "./ui-metadata.js";
|
|
18
20
|
import { executeToolCall, executeToolCalls, formatToolResults, validateToolCall } from "./tools/tool-executor.js";
|
|
19
21
|
import { SmrtObject } from "./object.js";
|
|
20
22
|
import { isFrameworkBaseClass } from "./registry/framework-base-classes.js";
|
|
@@ -24,10 +26,11 @@ import { auditChanges, auditSnapshot, getActiveAuditOptions, isAudited, requireA
|
|
|
24
26
|
import { SmrtHierarchical } from "./hierarchical.js";
|
|
25
27
|
import { SmrtJunction, SmrtJunctionBase } from "./junction.js";
|
|
26
28
|
import { SmrtPolymorphicAssociation } from "./polymorphic-association.js";
|
|
29
|
+
import { SmrtRecipe } from "./recipe.js";
|
|
27
30
|
import "./signals/index.js";
|
|
28
31
|
import { DIAGNOSTICS_DEFAULT_LIMIT, SYSTEM_DIAGNOSTICS_TABLES, readDispatchHealth, readJobHealth, readMigrationStatus, readRecentChanges, readRegistryDrift, readScheduleHealth, readSystemDiagnostics } from "./system/diagnostics.js";
|
|
29
32
|
import { BOOTED_PROVENANCE, assertPlainJson, sanitizeMessagePaths, snapshotRegistry } from "./system/registry-snapshot.js";
|
|
30
33
|
import { DEFAULT_RETENTION_POLICY, clearRetentionTasks, getRetentionTasks, pruneAiUsage, pruneExpiredContexts, pruneRunOnceClaims, registerRetentionTask, runRetentionSweep, unregisterRetentionTask } from "./system/retention.js";
|
|
31
34
|
import "./system/index.js";
|
|
32
35
|
import "./tools/index.js";
|
|
33
|
-
export { AIError, AiUsageCollector, AiUsagePersistenceHandler, BOOTED_PROVENANCE, ConfigurationError, DEFAULT_AI_COST_RATES, DEFAULT_FACET_LIMIT, DEFAULT_RETENTION_POLICY, DIAGNOSTICS_DEFAULT_LIMIT, DatabaseError, EmbeddingUnavailableError, ErrorUtils, FilesystemError, MAX_FACET_FIELDS, MAX_FACET_LIMIT, MAX_STI_READ_SCOPE_TYPES, MetricsAdapter, NetworkError, ObjectRegistry, PubSubAdapter, RunOnceClaimError, RuntimeError, SMRT_COLLECTION_BASE_NAMES, SMRT_SCHEMA_VERSION, SYSTEM_DIAGNOSTICS_TABLES, SignalBus, SignalSanitizer, SmrtClass, SmrtCollection, SmrtError, SmrtHierarchical, SmrtJunction, SmrtJunctionBase, SmrtObject, SmrtPolymorphicAssociation, TenantIsolationError, ValidationError, ValidationReport, ValidationUtils, assertFiniteUnitInterval, assertPlainJson, assertPostgresSystemTimestampsCurrent, auditChanges, auditSnapshot, classifyDatabaseError, classifyDialectMessage, clearRetentionTasks, config, convertTypeToJsonSchema, ensureBootstrapSystemTableCompatibility, ensureDeferredSystemTableCompatibility, ensureDispatchSubscriptionsSystemTableCompatibility, ensureDispatchSystemTableCompatibility, ensureJobEventsSystemTableCompatibility, ensureJobsSystemTableCompatibility, ensureLegacySystemTableCompatibility, ensureSystemTables, estimateAiUsageCost, executeDecision, executeToolCall, executeToolCalls, formatToolResults, generateToolFromMethod, generateToolManifest, getActiveAuditOptions, getDatabaseEngine, getRetentionTasks, isAbortedTransactionError, isAudited, isDeterministicDatabaseError, isFrameworkBaseClass, isNotNullViolationError, isSmrtCollectionExtendsName, isTransientDatabaseError, isUniqueViolationError, migratePostgresSystemTimestamps, planPostgresSystemTimestampMigrations, pruneAiUsage, pruneExpiredContexts, pruneRunOnceClaims, readDispatchHealth, readJobHealth, readMigrationStatus, readRecentChanges, readRegistryDrift, readScheduleHealth, readSystemDiagnostics, registerRetentionTask, requireAuditOptions, runRetentionSweep, sanitizeMessagePaths, shouldIncludeMethod, smrt, smrt as smrtRegistry, snapshotRegistry, tableExists, unregisterRetentionTask, validateToolCall, writeAudit };
|
|
36
|
+
export { AIError, AiUsageCollector, AiUsagePersistenceHandler, BOOTED_PROVENANCE, ConfigurationError, DEFAULT_AI_COST_RATES, DEFAULT_DISPLAY_LABEL_FIELDS, DEFAULT_FACET_LIMIT, DEFAULT_RETENTION_POLICY, DIAGNOSTICS_DEFAULT_LIMIT, DatabaseError, EmbeddingUnavailableError, ErrorUtils, FIELD_UI_WIDGETS, FIELD_UI_WIDGET_TYPES, FilesystemError, MAX_FACET_FIELDS, MAX_FACET_LIMIT, MAX_STI_READ_SCOPE_TYPES, MetricsAdapter, NetworkError, ObjectRegistry, PubSubAdapter, RunOnceClaimError, RuntimeError, SMRT_COLLECTION_BASE_NAMES, SMRT_SCHEMA_VERSION, SYSTEM_DIAGNOSTICS_TABLES, SignalBus, SignalSanitizer, SmrtClass, SmrtCollection, SmrtError, SmrtHierarchical, SmrtJunction, SmrtJunctionBase, SmrtObject, SmrtPolymorphicAssociation, SmrtRecipe, TenantIsolationError, ValidationError, ValidationReport, ValidationUtils, assertFiniteUnitInterval, assertPlainJson, assertPostgresSystemTimestampsCurrent, auditChanges, auditSnapshot, buildConnectSection, buildGlossary, classifyDatabaseError, classifyDialectMessage, clearRetentionTasks, config, convertTypeToJsonSchema, createRecipeHelp, describeDisplayLabel, displayLabelFieldProblem, ensureBootstrapSystemTableCompatibility, ensureDeferredSystemTableCompatibility, ensureDispatchSubscriptionsSystemTableCompatibility, ensureDispatchSystemTableCompatibility, ensureJobEventsSystemTableCompatibility, ensureJobsSystemTableCompatibility, ensureLegacySystemTableCompatibility, ensureSystemTables, estimateAiUsageCost, executeDecision, executeToolCall, executeToolCalls, extractFieldRefs, findField, findSelectorFor, formatToolResults, generateToolFromMethod, generateToolManifest, getActiveAuditOptions, getDatabaseEngine, getRetentionTasks, helpToMarkdown, isAbortedTransactionError, isAudited, isDeterministicDatabaseError, isFieldUIWidget, isFrameworkBaseClass, isNotNullViolationError, isSmrtCollectionExtendsName, isTransientDatabaseError, isUniqueViolationError, migratePostgresSystemTimestamps, parseHelp, planPostgresSystemTimestampMigrations, pruneAiUsage, pruneExpiredContexts, pruneRunOnceClaims, readDispatchHealth, readJobHealth, readMigrationStatus, readRecentChanges, readRegistryDrift, readScheduleHealth, readSystemDiagnostics, registerRetentionTask, renderHelp, requireAuditOptions, resolveDisplayLabelField, resolveHelp, runRetentionSweep, sanitizeMessagePaths, shouldIncludeMethod, smrt, smrt as smrtRegistry, snapshotRegistry, tableExists, unregisterRetentionTask, validateHelp, validateToolCall, writeAudit };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../../src/generators/mcp.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"mcp.d.ts","source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;;;;;;OA0BG;IACG,cAAc,CAClB,OAAO,GAAE;QACP;;;;;;WAMG;QACH,UAAU,CAAC,EAAE,MAAM,CAAC;QAEpB,oCAAoC;QACpC,UAAU,CAAC,EAAE,MAAM,CAAC;QAEpB,qBAAqB;QACrB,aAAa,CAAC,EAAE,MAAM,CAAC;QAEvB,2BAA2B;QAC3B,KAAK,CAAC,EAAE,OAAO,CAAC;QAEhB,oDAAoD;QACpD,wBAAwB,CAAC,EAAE,OAAO,CAAC;QAEnC,oCAAoC;QACpC,cAAc,CAAC,EAAE,OAAO,CAAC;QAEzB,uEAAuE;QACvE,OAAO,CAAC,EAAE,OAAO,CAAC;KACd,GACL,OAAO,CAAC,IAAI,CAAC;YA4FF,oBAAoB;IA0ClC,4EAA4E;YAC9D,kBAAkB;IAmBhC;;;;;OAKG;IACH;;;;;;;;OAQG;IACH,OAAO,CAAC,yBAAyB;IAejC;;;;OAIG;IACH,OAAO,CAAC,kBAAkB;IAkB1B,OAAO,CAAC,iBAAiB;IAyBzB;;;;;;;;;;;;;;;OAeG;YACW,qBAAqB;IA0DnC;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAiB1B;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAwBzB;;OAEG;YACW,uBAAuB;IA6MrC;;OAEG;YACW,oBAAoB;IA4LlC;;;;;OAKG;IACH,OAAO,CAAC,oBAAoB;CAsH7B"}
|
package/dist/generators/mcp.js
CHANGED
|
@@ -2,13 +2,15 @@ import { buildDefaultListOrderBy, resolveListLimit, resolveListOffset } from "..
|
|
|
2
2
|
import { SmrtCollection } from "../collection.js";
|
|
3
3
|
import { isQualifiedName } from "../utils/qualified-names.js";
|
|
4
4
|
import { SMRT_CUSTOM_ACTION_ERROR_METADATA_KEY, buildCustomActionInvocationArgs, customActionParameterInputName, isCrudOperation, isCrudToolAction, isFrameworkLifecycleMethod, normalizeCustomActionFailure, resolveCustomActionMetadata } from "./custom-action.js";
|
|
5
|
+
import { resolveDisplayLabelField } from "../ui-metadata.js";
|
|
5
6
|
import { isFrameworkBaseClass } from "../registry/framework-base-classes.js";
|
|
7
|
+
import { readFieldEnum } from "../registry/manifest-field-merge.js";
|
|
6
8
|
import { ObjectRegistry } from "../registry.js";
|
|
7
9
|
import { generatedSiblingExtension, renderGeneratedSource, resolveGeneratedSourceLanguage } from "./mcp-emit.js";
|
|
8
10
|
import { generateClaudeConfig, generateMCPDocumentation, generateMCPScript, generateRuntimeBootstrap } from "./mcp-runtime-template.js";
|
|
9
11
|
import { canonicalMcpToolNames } from "./mcp-tool-name.js";
|
|
10
12
|
import { runWithTenantGate } from "./tenant-gate.js";
|
|
11
|
-
import { assertMcpJsonSchemaSafety, buildToolInputSchema, fieldTypeToJsonSchema, finalizeMcpJsonSchema, isCrudAction, resolveToolSemantics } from "./tool-schema.js";
|
|
13
|
+
import { assertMcpJsonSchemaSafety, buildToolInputSchema, describeAction, fieldTypeToJsonSchema, finalizeMcpJsonSchema, isCrudAction, resolveToolSemantics } from "./tool-schema.js";
|
|
12
14
|
import { dirname, resolve } from "node:path";
|
|
13
15
|
import { mkdir, writeFile } from "node:fs/promises";
|
|
14
16
|
//#region src/generators/mcp.ts
|
|
@@ -244,37 +246,38 @@ var MCPGenerator = class {
|
|
|
244
246
|
const fields = ObjectRegistry.getFields(objectName);
|
|
245
247
|
const lowerName = displayName.toLowerCase();
|
|
246
248
|
const classInfo = ObjectRegistry.getClass(objectName);
|
|
249
|
+
const labelField = resolveDisplayLabelField(Object.fromEntries(fields), ObjectRegistry.getConfig(objectName).display?.label);
|
|
247
250
|
if (shouldInclude("list")) tools.push({
|
|
248
251
|
name: `${lowerName}_list`,
|
|
249
|
-
description:
|
|
252
|
+
description: describeAction("list", displayName, labelField),
|
|
250
253
|
inputSchema: this.buildInputSchema(objectName, "list", fields),
|
|
251
254
|
outputSchema: this.buildOutputSchema(objectName, "list", fields),
|
|
252
255
|
annotations: mcpToolAnnotations("list")
|
|
253
256
|
});
|
|
254
257
|
if (shouldInclude("get")) tools.push({
|
|
255
258
|
name: `${lowerName}_get`,
|
|
256
|
-
description:
|
|
259
|
+
description: describeAction("get", displayName, labelField),
|
|
257
260
|
inputSchema: this.buildInputSchema(objectName, "get", fields),
|
|
258
261
|
outputSchema: this.buildOutputSchema(objectName, "get", fields),
|
|
259
262
|
annotations: mcpToolAnnotations("get")
|
|
260
263
|
});
|
|
261
264
|
if (shouldInclude("create")) tools.push({
|
|
262
265
|
name: `${lowerName}_create`,
|
|
263
|
-
description:
|
|
266
|
+
description: describeAction("create", displayName, labelField),
|
|
264
267
|
inputSchema: this.buildInputSchema(objectName, "create", fields),
|
|
265
268
|
outputSchema: this.buildOutputSchema(objectName, "create", fields),
|
|
266
269
|
annotations: mcpToolAnnotations("create")
|
|
267
270
|
});
|
|
268
271
|
if (shouldInclude("update")) tools.push({
|
|
269
272
|
name: `${lowerName}_update`,
|
|
270
|
-
description:
|
|
273
|
+
description: describeAction("update", displayName, labelField),
|
|
271
274
|
inputSchema: this.buildInputSchema(objectName, "update", fields),
|
|
272
275
|
outputSchema: this.buildOutputSchema(objectName, "update", fields),
|
|
273
276
|
annotations: mcpToolAnnotations("update")
|
|
274
277
|
});
|
|
275
278
|
if (shouldInclude("delete")) tools.push({
|
|
276
279
|
name: `${lowerName}_delete`,
|
|
277
|
-
description:
|
|
280
|
+
description: describeAction("delete", displayName, labelField),
|
|
278
281
|
inputSchema: this.buildInputSchema(objectName, "delete", fields),
|
|
279
282
|
outputSchema: this.buildOutputSchema(objectName, "delete", fields),
|
|
280
283
|
annotations: mcpToolAnnotations("delete")
|
|
@@ -375,6 +378,7 @@ var MCPGenerator = class {
|
|
|
375
378
|
minLength: field._meta?.minLength,
|
|
376
379
|
min: field._meta?.min,
|
|
377
380
|
max: field._meta?.max,
|
|
381
|
+
enum: readFieldEnum(field),
|
|
378
382
|
related: field.related
|
|
379
383
|
}));
|
|
380
384
|
}
|