@happyvertical/smrt-template-sveltekit 0.54.1 → 0.55.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 CHANGED
@@ -104,12 +104,18 @@ It is the ground-up alternative to `smrt-saas-starter`.
104
104
  (`createRuntimeDiagnosticsHandler`) requires a direct active tenant membership
105
105
  plus the owner role or `runtime_diagnostics.read` before any projection or
106
106
  probe; it never calls principal-bound server tools.
107
- - The opt-in `mcp-apps-template/` overlay is one `mountMcpAppRoute()` route
108
- and the protected-resource metadata route, both using
109
- `createHostedMcpResourceAuth({ profile, runtime })` (local owner tokens,
110
- hosted membership-backed principals); `pnpm typecheck` checks it against
111
- the template. `__tests__/localMcpToken.test.ts` proves mint → real
107
+ - The opt-in `mcp-apps-template/` overlay is one
108
+ `mountMcpAppRoute({ runtime })` route and
109
+ `mountMcpProtectedResourceMetadataRoute({ runtime })` (#3491): the
110
+ runtime supplies the request database, `runAsPrincipal` and, per request,
111
+ the profile's bearer adapter (local owner tokens, hosted membership-backed
112
+ principals). No `mcp.ts` helper or top-level `await`; `pnpm typecheck`
113
+ checks it against the template. `__tests__/localMcpToken.test.ts` proves mint → real
112
114
  `smrt-mcp-bridge` stdio → route against the real runtime.
115
+ `__tests__/mcpConsumerBundle.test.ts` (why `@happyvertical/smrt-chat` is a
116
+ devDependency) Vite-SSR-builds `fixtures/mcp-chat-consumer/` with chat and
117
+ smrt-agents inlined, runs it in plain Node, and requires one registry entry
118
+ per inlined class and exactly the allow-listed tools on the route (#3490).
113
119
 
114
120
  ## Tests
115
121
 
@@ -1,4 +1,4 @@
1
1
  {
2
- "@happyvertical/smrt-app-mcp": "^0.54.1",
3
- "@happyvertical/smrt-mcp-openai": "^0.54.1"
2
+ "@happyvertical/smrt-app-mcp": "^0.55.1",
3
+ "@happyvertical/smrt-mcp-openai": "^0.55.1"
4
4
  }
@@ -1,11 +1,6 @@
1
- import { createHostedMcpResourceAuth } from '@happyvertical/smrt-app-mcp/auth';
2
1
  import { mountMcpProtectedResourceMetadataRoute } from '@happyvertical/smrt-app-mcp/sveltekit';
3
2
 
4
3
  import { runtime } from '$lib/server/smrt';
5
4
 
6
- const { profile } = await runtime.resolvedRuntime();
7
-
8
5
  /** RFC 9728 metadata at exactly the URL hosted bearer challenges advertise (404 locally). */
9
- export const GET = mountMcpProtectedResourceMetadataRoute(
10
- createHostedMcpResourceAuth({ profile, runtime }),
11
- );
6
+ export const GET = mountMcpProtectedResourceMetadataRoute({ runtime });
@@ -1,5 +1,4 @@
1
1
  import type { McpWorkflowToolDefinition } from '@happyvertical/smrt-app-mcp';
2
- import { createHostedMcpResourceAuth } from '@happyvertical/smrt-app-mcp/auth';
3
2
  import { mountMcpAppRoute } from '@happyvertical/smrt-app-mcp/sveltekit';
4
3
  import { openAiDisplayMetadata, withOpenAiEntrypoints } from '@happyvertical/smrt-mcp-openai';
5
4
 
@@ -35,28 +34,27 @@ const itemsOverview: McpWorkflowToolDefinition = withOpenAiEntrypoints(
35
34
  ['global'],
36
35
  );
37
36
 
38
- const { profile } = await runtime.resolvedRuntime();
39
-
40
37
  /**
41
38
  * Stateless SDK-v2 Streamable HTTP MCP endpoint for this app's own `Item`.
42
- * Locally the principal is the signed session (user, authorized tenant, and
43
- * permission slugs), or an owner-minted bearer token from `smrt app token`
44
- * for a local MCP client such as the `smrt-mcp-bridge` stdio bridge. Hosted
45
- * profiles verify a bearer access token and map it through the runtime's
46
- * membership-backed `resolveMcpPrincipal` (pass `resolvePrincipal` to
47
- * override it). A bearer principal is bound into the request permission
39
+ * `runtime` supplies the request database, the bearer adapter for the profile
40
+ * it resolves per request, and the principal binding. Locally the principal
41
+ * is the signed session (user, authorized tenant, and permission slugs), or
42
+ * an owner-minted bearer token from `smrt app token` for a local MCP client
43
+ * such as the `smrt-mcp-bridge` stdio bridge. Hosted profiles verify a bearer
44
+ * access token and map it through the runtime's membership-backed
45
+ * `resolveMcpPrincipal` (pass an explicit `auth` built with
46
+ * `createHostedMcpResourceAuth({ ..., resolvePrincipal })` to override it).
47
+ * A bearer principal is bound into the request permission
48
48
  * context (under `database-rls`, its own RLS transaction) with its scopes
49
49
  * capped to live permissions. Every principal needs `items.read`, so only
50
50
  * read-only tools are published until per-operation authorization exists;
51
51
  * browser requests from a foreign `Origin` are refused.
52
52
  */
53
53
  export const POST = mountMcpAppRoute({
54
+ runtime,
54
55
  models: [Item],
55
56
  requiredScopes: ['items.read'],
56
57
  effects: ['read'],
57
- smrtOptions: () => ({ db: runtime.databaseConfig() }),
58
- auth: createHostedMcpResourceAuth({ profile, runtime }),
59
- bindPrincipal: runtime.runAsPrincipal,
60
58
  workflowTools: [itemsOverview],
61
59
  resources: [
62
60
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@happyvertical/smrt-template-sveltekit",
3
- "version": "0.54.1",
3
+ "version": "0.55.1",
4
4
  "description": "Minimal SvelteKit project template with s-m-r-t framework integration",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -32,25 +32,26 @@
32
32
  "directory": "packages/template-sveltekit"
33
33
  },
34
34
  "peerDependencies": {
35
- "@happyvertical/smrt-core": "0.54.1"
35
+ "@happyvertical/smrt-core": "0.55.1"
36
36
  },
37
37
  "devDependencies": {
38
- "@happyvertical/smrt-app-cli": "0.54.1",
39
- "@happyvertical/smrt-app-mcp": "0.54.1",
40
- "@happyvertical/smrt-app-runtime": "0.54.1",
41
- "@happyvertical/smrt-assets": "0.54.1",
42
- "@happyvertical/smrt-cli": "0.54.1",
43
- "@happyvertical/smrt-config": "0.54.1",
44
- "@happyvertical/smrt-jobs": "0.54.1",
45
- "@happyvertical/smrt-mcp-openai": "0.54.1",
46
- "@happyvertical/smrt-playbooks": "0.54.1",
47
- "@happyvertical/smrt-profiles": "0.54.1",
48
- "@happyvertical/smrt-scanner": "0.54.1",
49
- "@happyvertical/smrt-svelte": "0.54.1",
50
- "@happyvertical/smrt-tenancy": "0.54.1",
51
- "@happyvertical/smrt-ui": "0.54.1",
52
- "@happyvertical/smrt-users": "0.54.1",
53
- "@happyvertical/smrt-web": "0.54.1",
38
+ "@happyvertical/smrt-app-cli": "0.55.1",
39
+ "@happyvertical/smrt-app-mcp": "0.55.1",
40
+ "@happyvertical/smrt-app-runtime": "0.55.1",
41
+ "@happyvertical/smrt-assets": "0.55.1",
42
+ "@happyvertical/smrt-chat": "0.55.1",
43
+ "@happyvertical/smrt-cli": "0.55.1",
44
+ "@happyvertical/smrt-config": "0.55.1",
45
+ "@happyvertical/smrt-jobs": "0.55.1",
46
+ "@happyvertical/smrt-mcp-openai": "0.55.1",
47
+ "@happyvertical/smrt-playbooks": "0.55.1",
48
+ "@happyvertical/smrt-profiles": "0.55.1",
49
+ "@happyvertical/smrt-scanner": "0.55.1",
50
+ "@happyvertical/smrt-svelte": "0.55.1",
51
+ "@happyvertical/smrt-tenancy": "0.55.1",
52
+ "@happyvertical/smrt-ui": "0.55.1",
53
+ "@happyvertical/smrt-users": "0.55.1",
54
+ "@happyvertical/smrt-web": "0.55.1",
54
55
  "@happyvertical/sql": "^0.89.12",
55
56
  "@modelcontextprotocol/client": "2.0.0",
56
57
  "@modelcontextprotocol/server": "^2.0.0",
@@ -254,8 +254,9 @@ non-object or malformed manifests, credential-shaped JSON fields and credential
254
254
  URL userinfo, non-portable schemas, and non-loopback HTTP server URLs. Diagnostics never
255
255
  include malformed manifest content.
256
256
 
257
- The option stages `src/routes/api/mcp/+server.ts`, one `mountMcpAppRoute()`
258
- call from `@happyvertical/smrt-app-mcp/sveltekit` that publishes `Item` to
257
+ The option stages `src/routes/api/mcp/+server.ts`, one
258
+ `mountMcpAppRoute({ runtime, ... })` call from
259
+ `@happyvertical/smrt-app-mcp/sveltekit` that publishes `Item` to
259
260
  principals holding `items.read` (the signed session's permissions locally),
260
261
  refuses browser requests from a foreign `Origin`, and serves a bounded static
261
262
  resource with a restrictive CSP and the optional OpenAI display metadata. It
@@ -456,7 +457,7 @@ For `self-hosted` and `cloud`, configure HTTPS `SMRT_MCP_RESOURCE`,
456
457
  `SMRT_MCP_SCOPES` values. On every request, the runtime maps the verified
457
458
  issuer and subject to the user linked through OIDC login. That user must have
458
459
  exactly one active tenant membership. Disabled, unmapped, or multi-tenant
459
- identities are denied. To use a different lookup, pass `resolvePrincipal` to
460
- `createHostedMcpResourceAuth`. The route never derives tenant authority from
460
+ identities are denied. To use a different lookup, pass the route an explicit
461
+ `auth` built with `createHostedMcpResourceAuth({ ..., resolvePrincipal })`. The route never derives tenant authority from
461
462
  JWT claims, request headers, or tool arguments. Missing configuration fails
462
463
  closed before MCP dispatch.
@@ -39,19 +39,19 @@
39
39
  "svelte-check": "^4.7.6",
40
40
  "typescript": "6.0.3",
41
41
  "vite": "8.3.0",
42
- "@happyvertical/smrt-cli": "^0.54.1"
42
+ "@happyvertical/smrt-cli": "^0.55.1"
43
43
  },
44
44
  "dependencies": {
45
- "@happyvertical/smrt-app-runtime": "^0.54.1",
46
- "@happyvertical/smrt-config": "^0.54.1",
47
- "@happyvertical/smrt-core": "^0.54.1",
48
- "@happyvertical/smrt-jobs": "^0.54.1",
49
- "@happyvertical/smrt-profiles": "^0.54.1",
50
- "@happyvertical/smrt-svelte": "^0.54.1",
51
- "@happyvertical/smrt-tenancy": "^0.54.1",
52
- "@happyvertical/smrt-ui": "^0.54.1",
53
- "@happyvertical/smrt-users": "^0.54.1",
54
- "@happyvertical/smrt-web": "^0.54.1",
45
+ "@happyvertical/smrt-app-runtime": "^0.55.1",
46
+ "@happyvertical/smrt-config": "^0.55.1",
47
+ "@happyvertical/smrt-core": "^0.55.1",
48
+ "@happyvertical/smrt-jobs": "^0.55.1",
49
+ "@happyvertical/smrt-profiles": "^0.55.1",
50
+ "@happyvertical/smrt-svelte": "^0.55.1",
51
+ "@happyvertical/smrt-tenancy": "^0.55.1",
52
+ "@happyvertical/smrt-ui": "^0.55.1",
53
+ "@happyvertical/smrt-users": "^0.55.1",
54
+ "@happyvertical/smrt-web": "^0.55.1",
55
55
  "@happyvertical/sql": "^0.89.12",
56
56
  "@modelcontextprotocol/server": "^2.0.0"
57
57
  }
@@ -19,22 +19,22 @@ export default {
19
19
 
20
20
  // Dependencies to add to generated project
21
21
  dependencies: {
22
- '@happyvertical/smrt-app-runtime': '^0.54.1',
23
- '@happyvertical/smrt-config': '^0.54.1',
24
- '@happyvertical/smrt-core': '^0.54.1',
25
- '@happyvertical/smrt-jobs': '^0.54.1',
26
- '@happyvertical/smrt-profiles': '^0.54.1',
27
- '@happyvertical/smrt-svelte': '^0.54.1',
28
- '@happyvertical/smrt-tenancy': '^0.54.1',
29
- '@happyvertical/smrt-ui': '^0.54.1',
30
- '@happyvertical/smrt-users': '^0.54.1',
31
- '@happyvertical/smrt-web': '^0.54.1',
22
+ '@happyvertical/smrt-app-runtime': '^0.55.1',
23
+ '@happyvertical/smrt-config': '^0.55.1',
24
+ '@happyvertical/smrt-core': '^0.55.1',
25
+ '@happyvertical/smrt-jobs': '^0.55.1',
26
+ '@happyvertical/smrt-profiles': '^0.55.1',
27
+ '@happyvertical/smrt-svelte': '^0.55.1',
28
+ '@happyvertical/smrt-tenancy': '^0.55.1',
29
+ '@happyvertical/smrt-ui': '^0.55.1',
30
+ '@happyvertical/smrt-users': '^0.55.1',
31
+ '@happyvertical/smrt-web': '^0.55.1',
32
32
  '@happyvertical/sql': '^0.89.12',
33
33
  '@modelcontextprotocol/server': '^2.0.0',
34
34
  },
35
35
 
36
36
  devDependencies: {
37
- '@happyvertical/smrt-cli': '^0.54.1',
37
+ '@happyvertical/smrt-cli': '^0.55.1',
38
38
  '@sveltejs/adapter-node': '^5.5.7',
39
39
  '@sveltejs/kit': '2.70.3',
40
40
  '@sveltejs/vite-plugin-svelte': '^7.3.0',