@happyvertical/smrt-template-sveltekit 0.43.3 → 0.43.5
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 +6 -3
- package/README.md +12 -12
- package/package.json +4 -4
- package/template/AGENTS.md +4 -2
- package/template/README.md +26 -24
- package/template/package.json +9 -8
- package/template/src/routes/+layout.svelte +14 -1
- package/template/src/smrt-webmcp.d.ts +6 -0
package/AGENTS.md
CHANGED
|
@@ -16,7 +16,8 @@ It is the ground-up alternative to `smrt-saas-starter`.
|
|
|
16
16
|
- Node `>=24.18.0`; pnpm `10.34.4` via `packageManager` and `engines`.
|
|
17
17
|
- Directly used `@happyvertical/smrt-*` packages share one current release range.
|
|
18
18
|
- `@happyvertical/smrt-cli` is a direct dev dependency because scripts/docs use
|
|
19
|
-
its binary. `@happyvertical/smrt-web`
|
|
19
|
+
its binary. The template includes `@happyvertical/smrt-web` because the root
|
|
20
|
+
Provider wires the generated read-only WebMCP definitions for every page.
|
|
20
21
|
- The generated MCP server resolves its imports from the scaffolded app, not
|
|
21
22
|
from the CLI, so every specifier `generate-mcp` emits must be declared here.
|
|
22
23
|
`@modelcontextprotocol/server` (plus its `/stdio` subpath),
|
|
@@ -50,8 +51,10 @@ It is the ground-up alternative to `smrt-saas-starter`.
|
|
|
50
51
|
exact permission snapshot.
|
|
51
52
|
- The root layout uses Provider, the current smrt-ui ThemeProvider, AdminShell,
|
|
52
53
|
and a small explicit TenantNav. Generated REST routes do not imply page routes.
|
|
53
|
-
-
|
|
54
|
-
|
|
54
|
+
- The root Provider registers generated WebMCP read tools with the authenticated
|
|
55
|
+
page session. Write/destructive effects require an explicit page-owned policy.
|
|
56
|
+
Live browser collections remain opt-in per page and must seed from SSR
|
|
57
|
+
`initialData` to avoid a duplicate first request.
|
|
55
58
|
|
|
56
59
|
## Tests
|
|
57
60
|
|
package/README.md
CHANGED
|
@@ -120,27 +120,27 @@ pnpm smrt schema Item
|
|
|
120
120
|
pnpm smrt generate-mcp --no-config --no-readme
|
|
121
121
|
```
|
|
122
122
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
123
|
+
The root layout wires the generated `webMcpToolDefinitions` into the Provider,
|
|
124
|
+
so each browser page exposes only read-effect generated model tools by default.
|
|
125
|
+
Write and destructive effects require explicit page-owned opt-in, and all
|
|
126
|
+
custom actions execute through their authenticated generated REST routes. For a
|
|
127
|
+
smaller page-specific surface, pass a filtered `definitions` array or use the
|
|
128
|
+
framework-agnostic `registerWebMcpTools()` API from `@happyvertical/smrt-web`.
|
|
127
129
|
The CLI's manifest-only `objects` and `schema` commands work in this
|
|
128
130
|
source-first template. Local-object CRUD execution through the generic CLI
|
|
129
131
|
additionally requires a compiled JavaScript project entry point.
|
|
130
132
|
|
|
131
133
|
## 9. Add optional live browser data
|
|
132
134
|
|
|
133
|
-
`@happyvertical/smrt-web` is
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
pnpm add @happyvertical/smrt-web@0.38.25
|
|
138
|
-
```
|
|
135
|
+
`@happyvertical/smrt-web` is included on the synchronized release line because
|
|
136
|
+
the root Provider loads the generated WebMCP definitions. No separate install
|
|
137
|
+
is needed for WebMCP. Live browser collections remain opt-in per page; import
|
|
138
|
+
the collection helpers only on pages that need interactive client data.
|
|
139
139
|
|
|
140
140
|
The generated-project README shows the current hydration pattern:
|
|
141
141
|
`createSmrtCollection(getCollectionDefinition('items'), { initialData,
|
|
142
|
-
basePath: '/api' })` followed by `liveCollection()`. The root layout
|
|
143
|
-
|
|
142
|
+
basePath: '/api' })` followed by `liveCollection()`. The root layout's
|
|
143
|
+
read-only WebMCP registration does not materialize live collections.
|
|
144
144
|
|
|
145
145
|
## 10. Graduate to smrt-saas-starter
|
|
146
146
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@happyvertical/smrt-template-sveltekit",
|
|
3
|
-
"version": "0.43.
|
|
3
|
+
"version": "0.43.5",
|
|
4
4
|
"description": "Minimal SvelteKit project template with s-m-r-t framework integration",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
@@ -29,12 +29,12 @@
|
|
|
29
29
|
"directory": "packages/template-sveltekit"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
|
-
"@happyvertical/smrt-core": "0.43.
|
|
32
|
+
"@happyvertical/smrt-core": "0.43.5"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"vitest": "4.1.10",
|
|
36
|
-
"@happyvertical/smrt-tenancy": "0.43.
|
|
37
|
-
"@happyvertical/smrt-users": "0.43.
|
|
36
|
+
"@happyvertical/smrt-tenancy": "0.43.5",
|
|
37
|
+
"@happyvertical/smrt-users": "0.43.5"
|
|
38
38
|
},
|
|
39
39
|
"publishConfig": {
|
|
40
40
|
"registry": "https://registry.npmjs.org",
|
package/template/AGENTS.md
CHANGED
|
@@ -30,6 +30,8 @@ tools, WebMCP definitions, and agent/developer knowledge artifacts.
|
|
|
30
30
|
- Keep object relationship metadata close to `@smrt()`.
|
|
31
31
|
- Add human-facing routes explicitly; generated REST routes do not create nav
|
|
32
32
|
pages.
|
|
33
|
-
-
|
|
34
|
-
|
|
33
|
+
- The root layout includes `@happyvertical/smrt-web` and registers generated
|
|
34
|
+
WebMCP read tools through Provider when the browser exposes `modelContext`.
|
|
35
|
+
Keep the guard in place for SSR and seed live collections with SSR
|
|
36
|
+
`initialData`.
|
|
35
37
|
- Do not enable knowledge HTTP routes in production without explicit admin auth.
|
package/template/README.md
CHANGED
|
@@ -249,40 +249,42 @@ Add the jobs package on the same release line as the other
|
|
|
249
249
|
`@happyvertical/smrt-*` pins in `package.json`, then reinstall. Missing one of
|
|
250
250
|
these fails at startup with `ERR_MODULE_NOT_FOUND` naming the package to add.
|
|
251
251
|
|
|
252
|
-
WebMCP is
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
pnpm add @happyvertical/smrt-web@0.38.25
|
|
257
|
-
```
|
|
252
|
+
WebMCP is wired at the root Provider as a read-only, authenticated browser
|
|
253
|
+
surface. The template includes `@happyvertical/smrt-web` on the synchronized
|
|
254
|
+
release line; keep the generated definitions page-owned when you need a
|
|
255
|
+
narrower tool set.
|
|
258
256
|
|
|
259
257
|
```svelte
|
|
260
258
|
<script lang="ts">
|
|
261
|
-
import {
|
|
262
|
-
import {
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
});
|
|
270
|
-
});
|
|
271
|
-
return () => dispose();
|
|
272
|
-
});
|
|
259
|
+
import { webMcpToolDefinitions } from '@happyvertical/smrt-virt-web';
|
|
260
|
+
import { Provider } from '@happyvertical/smrt-svelte';
|
|
261
|
+
|
|
262
|
+
const webmcp = $derived(
|
|
263
|
+
typeof document !== 'undefined' && 'modelContext' in document
|
|
264
|
+
? { definitions: webMcpToolDefinitions, basePath: '/api', effects: ['read'] as const }
|
|
265
|
+
: false,
|
|
266
|
+
);
|
|
273
267
|
</script>
|
|
268
|
+
|
|
269
|
+
<Provider {webmcp}>
|
|
270
|
+
{@render children()}
|
|
271
|
+
</Provider>
|
|
274
272
|
```
|
|
275
273
|
|
|
276
274
|
`registerWebMcpTools()` feature-detects browser support and uses the current
|
|
277
|
-
authenticated page session.
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
275
|
+
authenticated page session. Omitted policy exposes all `read`-effect tools:
|
|
276
|
+
intrinsic `list`/`get` plus custom actions explicitly declared as reads. To
|
|
277
|
+
advertise mutations on a trusted surface, pass an explicit effect allowlist, for
|
|
278
|
+
example `effects: ['read', 'write']`; include `destructive` only where delete and
|
|
279
|
+
destructive custom actions are intended. Generated custom actions execute
|
|
280
|
+
through their authenticated REST routes, and undeclared custom effects fail
|
|
281
|
+
closed as destructive.
|
|
281
282
|
|
|
282
283
|
## 9. Add optional live browser data
|
|
283
284
|
|
|
284
|
-
Use this only on an interactive page.
|
|
285
|
-
|
|
285
|
+
Use this only on an interactive page. The template already includes
|
|
286
|
+
`@happyvertical/smrt-web` for the root Provider; no separate install is needed
|
|
287
|
+
for WebMCP. Live browser collections remain opt-in per page.
|
|
286
288
|
|
|
287
289
|
Keep the server load from section 7, then seed the browser collection from its
|
|
288
290
|
hydrated rows so the first render does not issue a duplicate request:
|
package/template/package.json
CHANGED
|
@@ -25,16 +25,17 @@
|
|
|
25
25
|
"svelte-check": "^4.7.2",
|
|
26
26
|
"typescript": "^6.0.3",
|
|
27
27
|
"vite": "^8.1.4",
|
|
28
|
-
"@happyvertical/smrt-cli": "^0.43.
|
|
28
|
+
"@happyvertical/smrt-cli": "^0.43.5"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@happyvertical/smrt-config": "^0.43.
|
|
32
|
-
"@happyvertical/smrt-core": "^0.43.
|
|
33
|
-
"@happyvertical/smrt-profiles": "^0.43.
|
|
34
|
-
"@happyvertical/smrt-svelte": "^0.43.
|
|
35
|
-
"@happyvertical/smrt-tenancy": "^0.43.
|
|
36
|
-
"@happyvertical/smrt-ui": "^0.43.
|
|
37
|
-
"@happyvertical/smrt-users": "^0.43.
|
|
31
|
+
"@happyvertical/smrt-config": "^0.43.5",
|
|
32
|
+
"@happyvertical/smrt-core": "^0.43.5",
|
|
33
|
+
"@happyvertical/smrt-profiles": "^0.43.5",
|
|
34
|
+
"@happyvertical/smrt-svelte": "^0.43.5",
|
|
35
|
+
"@happyvertical/smrt-tenancy": "^0.43.5",
|
|
36
|
+
"@happyvertical/smrt-ui": "^0.43.5",
|
|
37
|
+
"@happyvertical/smrt-users": "^0.43.5",
|
|
38
|
+
"@happyvertical/smrt-web": "^0.43.5",
|
|
38
39
|
"@modelcontextprotocol/server": "^2.0.0"
|
|
39
40
|
}
|
|
40
41
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { page } from '$app/state';
|
|
3
|
+
import { webMcpToolDefinitions } from '@happyvertical/smrt-virt-web';
|
|
3
4
|
import { Provider } from '@happyvertical/smrt-svelte';
|
|
4
5
|
import {
|
|
5
6
|
AdminShell,
|
|
@@ -18,6 +19,18 @@
|
|
|
18
19
|
data.session.activeTenantId ? 'Authorized session tenant' : 'No active tenant',
|
|
19
20
|
);
|
|
20
21
|
|
|
22
|
+
// Keep the optional data-plane runtime out of browsers that do not expose
|
|
23
|
+
// WebMCP. SSR remains safe because the feature check is document-guarded.
|
|
24
|
+
const webmcp = $derived(
|
|
25
|
+
typeof document !== 'undefined' && 'modelContext' in document
|
|
26
|
+
? {
|
|
27
|
+
definitions: webMcpToolDefinitions,
|
|
28
|
+
basePath: '/api',
|
|
29
|
+
effects: ['read'] as const,
|
|
30
|
+
}
|
|
31
|
+
: false,
|
|
32
|
+
);
|
|
33
|
+
|
|
21
34
|
// Add application routes here. Generated REST routes live under /api and do
|
|
22
35
|
// not automatically imply a human-facing page.
|
|
23
36
|
const nav: ShellNavItem[] = [
|
|
@@ -34,7 +47,7 @@
|
|
|
34
47
|
];
|
|
35
48
|
</script>
|
|
36
49
|
|
|
37
|
-
<Provider>
|
|
50
|
+
<Provider {webmcp}>
|
|
38
51
|
<ThemeProvider preset="smrt" colorScheme="system" persist={true}>
|
|
39
52
|
<AdminShell
|
|
40
53
|
title="s-m-r-t app"
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// `smrtPlugin` supplies the runtime virtual module during Vite builds. Keep
|
|
2
|
+
// source-first `svelte-check` useful before that build has emitted its ambient
|
|
3
|
+
// declaration, while preserving the generated shape when the plugin runs.
|
|
4
|
+
declare module '@happyvertical/smrt-virt-web' {
|
|
5
|
+
export const webMcpToolDefinitions: readonly import('@happyvertical/smrt-web').WebMcpToolDefinition[];
|
|
6
|
+
}
|