@happyvertical/smrt-svelte 0.51.37 → 0.51.39

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
@@ -38,6 +38,12 @@ principal tools, opaque action preview/apply, and ContentList/report adapters.
38
38
  When changing a data-surface wire field or refusal reason, update the
39
39
  versioned normalizers and the conformance fixture together.
40
40
 
41
+ The explicit `./mcp-apps` subpath owns portable MCP Apps mount/dispose bindings.
42
+ It reuses `compileViewIntentToolSpec` for local registry interactions, never
43
+ advertises browser closures as remote tools, and does not use
44
+ `document.modelContext`. See [bridge contract](../mcp-apps/README.md). Its browser
45
+ gate is `e2e/mcp-apps.spec.ts`, including trusted human staged-review enforcement.
46
+
41
47
  ## The UI split — primitive-adoption contract (#1589)
42
48
 
43
49
  SMRT's shared UI primitives are split by concern: **`smrt-ui` owns the
package/README.md CHANGED
@@ -438,3 +438,12 @@ all other currencies render their ISO code for deterministic SSR hydration.
438
438
 
439
439
  - `@happyvertical/smrt-types` -- shared type definitions
440
440
  - Peer: `svelte` >=5.18.2, `@happyvertical/smrt-jobs`, `@happyvertical/smrt-profiles`, `@happyvertical/smrt-users` (all optional)
441
+
442
+ ## Portable MCP Apps
443
+
444
+ The opt-in `@happyvertical/smrt-svelte/mcp-apps` entry exports `useMcpApp` for
445
+ mount-owned host negotiation/disposal and `useMcpAppIntent` for component-local
446
+ public registry interactions. It does not require `document.modelContext` or
447
+ export mounted closures to remote MCP. Agent proposals retain trusted human
448
+ staged review. See the [bridge contract](../mcp-apps/README.md) for origin
449
+ configuration, capabilities, fallback and synthetic-browser evidence limits.
@@ -15,6 +15,13 @@ presentation, focus tool registration, activity registry/watch components, and
15
15
  optional SMRT-fed content seams. It does not depend on jobs, users, tenancy, or
16
16
  SvelteKit route APIs; apps pass data, endpoints, and permission-filtered nav in.
17
17
 
18
+ The explicit `@happyvertical/smrt-svelte/workspace/legacy` ToolsDock entry keeps
19
+ its polite status live region visually clipped and anchored inside its
20
+ positioning container. Mounting the dock at a flex container's trailing edge
21
+ does not let that hidden region add horizontal scrolling. The package browser
22
+ fixture checks its bounds and preserves announcement updates and Escape focus
23
+ restoration at mobile and desktop widths.
24
+
18
25
  ## Main Exports
19
26
 
20
27
  - `AdminShell`
@@ -508,6 +508,8 @@
508
508
 
509
509
  .tools-dock__sr-only {
510
510
  position: absolute;
511
+ top: 0;
512
+ left: 0;
511
513
  width: 1px;
512
514
  height: 1px;
513
515
  padding: 0;
@@ -0,0 +1,3 @@
1
+ export type { McpAppState } from './mcp-apps.svelte.js';
2
+ export { useMcpApp, useMcpAppIntent } from './mcp-apps.svelte.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mcp-apps/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC"}
@@ -0,0 +1 @@
1
+ export { useMcpApp, useMcpAppIntent } from './mcp-apps.svelte.js';
@@ -0,0 +1,18 @@
1
+ import type { McpAppBridgeOptions, McpAppSnapshot } from '@happyvertical/smrt-mcp-apps';
2
+ import { McpAppBridge } from '@happyvertical/smrt-mcp-apps';
3
+ import type { ViewIntent, ViewIntentBinding } from '@happyvertical/smrt-web/intents';
4
+ export interface McpAppState {
5
+ readonly bridge: McpAppBridge | undefined;
6
+ readonly snapshot: McpAppSnapshot | undefined;
7
+ readonly error: string | undefined;
8
+ }
9
+ /** Mount-owned bridge. Options factory runs only in the browser; SSR stays inert. */
10
+ export declare function useMcpApp(options: () => McpAppBridgeOptions): McpAppState;
11
+ /**
12
+ * Component-local intent; never advertised to the remote host. The public compiler
13
+ * dispatches to ControlInteractionRegistry/DataSurfaceRegistry. Control commands
14
+ * retain source=agent, so staged edits require the existing trusted human review.
15
+ * Explicit bindings also work without Provider or document.modelContext.
16
+ */
17
+ export declare function useMcpAppIntent(intent: ViewIntent, binding: ViewIntentBinding): (args?: Record<string, unknown>) => Promise<string>;
18
+ //# sourceMappingURL=mcp-apps.svelte.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp-apps.svelte.d.ts","sourceRoot":"","sources":["../../src/mcp-apps/mcp-apps.svelte.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,cAAc,EACf,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,KAAK,EACV,UAAU,EACV,iBAAiB,EAClB,MAAM,iCAAiC,CAAC;AAIzC,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,MAAM,EAAE,YAAY,GAAG,SAAS,CAAC;IAC1C,QAAQ,CAAC,QAAQ,EAAE,cAAc,GAAG,SAAS,CAAC;IAC9C,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;CACpC;AACD,qFAAqF;AACrF,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,mBAAmB,GAAG,WAAW,CAiCzE;AACD;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,UAAU,EAClB,OAAO,EAAE,iBAAiB,GACzB,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,MAAM,CAAC,CAerD"}
@@ -0,0 +1,63 @@
1
+ import { McpAppBridge } from '@happyvertical/smrt-mcp-apps';
2
+ import { compileViewIntentToolSpec } from '@happyvertical/smrt-web/intents';
3
+ import { onMount } from 'svelte';
4
+ /** Mount-owned bridge. Options factory runs only in the browser; SSR stays inert. */
5
+ export function useMcpApp(options) {
6
+ let bridge = $state();
7
+ let snapshot = $state();
8
+ let error = $state();
9
+ onMount(() => {
10
+ let active = true;
11
+ const current = new McpAppBridge(options());
12
+ bridge = current;
13
+ const unsubscribe = current.subscribe((next) => {
14
+ if (active)
15
+ snapshot = next;
16
+ });
17
+ void current.connect().catch((failure) => {
18
+ if (active)
19
+ error = failure instanceof Error ? failure.message : 'Host unavailable';
20
+ });
21
+ return () => {
22
+ active = false;
23
+ unsubscribe();
24
+ current.dispose();
25
+ bridge = undefined;
26
+ };
27
+ });
28
+ return {
29
+ get bridge() {
30
+ return bridge;
31
+ },
32
+ get snapshot() {
33
+ return snapshot;
34
+ },
35
+ get error() {
36
+ return error;
37
+ },
38
+ };
39
+ }
40
+ /**
41
+ * Component-local intent; never advertised to the remote host. The public compiler
42
+ * dispatches to ControlInteractionRegistry/DataSurfaceRegistry. Control commands
43
+ * retain source=agent, so staged edits require the existing trusted human review.
44
+ * Explicit bindings also work without Provider or document.modelContext.
45
+ */
46
+ export function useMcpAppIntent(intent, binding) {
47
+ const spec = compileViewIntentToolSpec(intent, binding);
48
+ let active = false;
49
+ onMount(() => {
50
+ active = true;
51
+ return () => {
52
+ active = false;
53
+ };
54
+ });
55
+ return async (args = {}) => {
56
+ if (!active)
57
+ throw new Error('MCP App intent is not mounted');
58
+ const result = await spec.execute(args);
59
+ if (!active)
60
+ throw new Error('MCP App intent was unmounted');
61
+ return result;
62
+ };
63
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@happyvertical/smrt-svelte",
3
- "version": "0.51.37",
3
+ "version": "0.51.39",
4
4
  "smrtJsdoc": "strict",
5
5
  "description": "Svelte 5 components for SMRT user management - auth, users, tenants, roles, permissions, groups",
6
6
  "type": "module",
@@ -89,6 +89,12 @@
89
89
  "svelte": "./dist/data-surface.js",
90
90
  "import": "./dist/data-surface.js",
91
91
  "default": "./dist/data-surface.js"
92
+ },
93
+ "./mcp-apps": {
94
+ "types": "./dist/mcp-apps/index.d.ts",
95
+ "svelte": "./dist/mcp-apps/index.js",
96
+ "import": "./dist/mcp-apps/index.js",
97
+ "default": "./dist/mcp-apps/index.js"
92
98
  }
93
99
  },
94
100
  "files": [
@@ -121,10 +127,11 @@
121
127
  },
122
128
  "dependencies": {
123
129
  "@happyvertical/logger": "^0.96.0",
124
- "@happyvertical/smrt-languages": "0.51.37",
125
- "@happyvertical/smrt-types": "0.51.37",
126
- "@happyvertical/smrt-ui": "0.51.37",
127
- "@happyvertical/smrt-web": "0.51.37",
130
+ "@happyvertical/smrt-languages": "0.51.39",
131
+ "@happyvertical/smrt-mcp-apps": "0.51.39",
132
+ "@happyvertical/smrt-types": "0.51.39",
133
+ "@happyvertical/smrt-ui": "0.51.39",
134
+ "@happyvertical/smrt-web": "0.51.39",
128
135
  "@tanstack/db": "^0.6.14",
129
136
  "@tanstack/svelte-db": "^0.1.91",
130
137
  "esm-env": "^1.2.2"
@@ -159,14 +166,14 @@
159
166
  }
160
167
  },
161
168
  "devDependencies": {
162
- "@happyvertical/smrt-agents": "0.51.37",
163
- "@happyvertical/smrt-chat": "0.51.37",
164
- "@happyvertical/smrt-content": "0.51.37",
165
- "@happyvertical/smrt-core": "0.51.37",
166
- "@happyvertical/smrt-reports": "0.51.37",
167
- "@happyvertical/smrt-scanner": "0.51.37",
168
- "@happyvertical/smrt-tenancy": "0.51.37",
169
- "@happyvertical/smrt-users": "0.51.37",
169
+ "@happyvertical/smrt-agents": "0.51.39",
170
+ "@happyvertical/smrt-chat": "0.51.39",
171
+ "@happyvertical/smrt-content": "0.51.39",
172
+ "@happyvertical/smrt-core": "0.51.39",
173
+ "@happyvertical/smrt-reports": "0.51.39",
174
+ "@happyvertical/smrt-scanner": "0.51.39",
175
+ "@happyvertical/smrt-tenancy": "0.51.39",
176
+ "@happyvertical/smrt-users": "0.51.39",
170
177
  "@sveltejs/package": "^2.5.8",
171
178
  "@sveltejs/vite-plugin-svelte": "^7.3.0",
172
179
  "@testing-library/jest-dom": "^7.0.1",