@noodleseed/assistant 1.21.0 → 1.23.0

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.
Files changed (44) hide show
  1. package/README.md +47 -9
  2. package/dist/app-view-element-1i_w6FDf.d.cts +40 -0
  3. package/dist/app-view-element-7ZQZLYbL.d.ts +40 -0
  4. package/dist/app-view.cjs +18666 -0
  5. package/dist/app-view.cjs.map +1 -0
  6. package/dist/app-view.d.cts +9 -0
  7. package/dist/app-view.d.ts +9 -0
  8. package/dist/app-view.js +15 -0
  9. package/dist/app-view.js.map +1 -0
  10. package/dist/chunk-5NBHHNI3.js +180 -0
  11. package/dist/chunk-5NBHHNI3.js.map +1 -0
  12. package/dist/{chunk-ZPZHPXIQ.js → chunk-IBDP6PXQ.js} +9 -3882
  13. package/dist/chunk-IBDP6PXQ.js.map +1 -0
  14. package/dist/chunk-P223CYPO.js +3880 -0
  15. package/dist/chunk-P223CYPO.js.map +1 -0
  16. package/dist/{chunk-LEKEIHJV.js → chunk-X7UQDIGS.js} +824 -4049
  17. package/dist/chunk-X7UQDIGS.js.map +1 -0
  18. package/dist/chunk-XKTUXFGX.js +3323 -0
  19. package/dist/chunk-XKTUXFGX.js.map +1 -0
  20. package/dist/{client-BkJlpN5N.d.ts → client-Bp_VKpMg.d.ts} +1 -1
  21. package/dist/{client-BZ7xPwfW.d.cts → client-uo57Swlm.d.cts} +1 -1
  22. package/dist/client.d.cts +1 -1
  23. package/dist/client.d.ts +1 -1
  24. package/dist/client.js +2 -1
  25. package/dist/embed.global.js +90 -75
  26. package/dist/index.cjs +111 -24
  27. package/dist/index.cjs.map +1 -1
  28. package/dist/index.d.cts +2 -2
  29. package/dist/index.d.ts +2 -2
  30. package/dist/index.js +4 -2
  31. package/dist/index.js.map +1 -1
  32. package/dist/react/client.d.cts +1 -1
  33. package/dist/react/client.d.ts +1 -1
  34. package/dist/react/client.js +2 -1
  35. package/dist/react/client.js.map +1 -1
  36. package/dist/react.cjs +299 -56
  37. package/dist/react.cjs.map +1 -1
  38. package/dist/react.d.cts +7 -8
  39. package/dist/react.d.ts +7 -8
  40. package/dist/react.js +31 -41
  41. package/dist/react.js.map +1 -1
  42. package/package.json +16 -2
  43. package/dist/chunk-LEKEIHJV.js.map +0 -1
  44. package/dist/chunk-ZPZHPXIQ.js.map +0 -1
package/README.md CHANGED
@@ -2,8 +2,9 @@
2
2
 
3
3
  Customer-branded embedded assistant surfaces for Noodle Seed deployments.
4
4
 
5
- The package exports the canonical `<noodle-assistant>` Web Component, a managed React wrapper and secure
6
- `NoodleAppView` MCP App renderer from `@noodleseed/assistant/react`, a renderer-free React hook from
5
+ The package exports the canonical `<noodle-assistant>` managed Web Component, the framework-neutral
6
+ `<noodle-app-view>` MCP App host from `@noodleseed/assistant/app-view`, a managed React wrapper and
7
+ `NoodleAppView` adapter from `@noodleseed/assistant/react`, a renderer-free React hook from
7
8
  `@noodleseed/assistant/react/client`, a DOM-free client from `@noodleseed/assistant/client`, and the
8
9
  backend-only `createAssistantSession` helper from `@noodleseed/assistant/server`. Light, dark, and automatic
9
10
  themes work without configuration; the component inherits the deployed MCP server's brand kit while slots,
@@ -222,7 +223,10 @@ instead of `sessionEndpoint` — the two are mutually exclusive, and a public em
222
223
  ```
223
224
 
224
225
  A public embed opens its session on **first open**, never on mount — every mount would otherwise spend
225
- one of the surface's daily admission budget. Add `signIn: true` to the surface and it becomes **mixed**:
226
+ one of the surface's daily admission budget. While that first session is resolving, the launcher remains as
227
+ a loading affordance and the panel stays hidden. The panel's first visible frame therefore already carries
228
+ the deployment's compiled name, labels, presentation, and light/dark brand tokens instead of flashing the
229
+ built-in defaults. Add `signIn: true` to the surface and it becomes **mixed**:
226
230
  anonymous visitors start immediately, and identity-dependent capabilities raise the sign-in flow below.
227
231
  Before shipping, preflight the host with `noodle assistant embed --check --surface public` (or `mixed`) —
228
232
  it verifies `script-src` too, the one CSP directive whose failure runs no widget code at all.
@@ -373,20 +377,54 @@ if (part.type === "data-view") {
373
377
  }
374
378
  ```
375
379
 
376
- `NoodleAppView` owns the double iframe and AppBridge. Its lifecycle identity is the supplied client plus
380
+ `<noodle-app-view>` owns the double iframe and AppBridge; `NoodleAppView` delegates to it. Its lifecycle identity is the supplied client plus
377
381
  `view.id` plus `view.resourceUri`: ordinary parent rerenders and fresh view/callback objects retain the
378
382
  iframe, while a semantic view replacement or unmount requests standard App teardown and closes the bridge.
379
383
  Do not also key an ancestor by the whole view object or a callback. Pass the embedding application's
380
384
  resolved `"light"` or `"dark"` theme; later changes are published through MCP Apps host context without
381
385
  replacing the iframe.
382
386
 
387
+ App views stay inline by default. The host advertises only inline presentation and rejects an untrusted
388
+ App's fullscreen request, so stale or third-party widget code cannot take over the embedding application's
389
+ viewport. If fullscreen is an intentional part of the customer-owned experience, opt in explicitly with
390
+ `allowFullscreen` on `NoodleAppView` or `allow-fullscreen` on `<noodle-app-view>`; do not enable it merely
391
+ because a widget requests it. After an accepted fullscreen request, the host displays an accessible exit
392
+ control in the top-right corner. It returns the same mounted App to inline mode without resetting its state.
393
+
394
+ Vue, Angular, and plain DOM renderers use the same host without installing React. Import its dedicated entry
395
+ once, then assign the complex values as element properties. In Vue, the explicit `.prop` modifier makes that
396
+ boundary unambiguous:
397
+
398
+ ```vue
399
+ <script setup lang="ts">
400
+ import "@noodleseed/assistant/app-view";
401
+ </script>
402
+
403
+ <template>
404
+ <noodle-app-view
405
+ :client.prop="assistant"
406
+ :view.prop="part.data"
407
+ :theme="resolvedTheme"
408
+ @assistant-error="reportAssistantError"
409
+ />
410
+ </template>
411
+ ```
412
+
413
+ Configure Vue's `isCustomElement` for `noodle-app-view`. Angular uses the same element with `[client]`,
414
+ `[view]`, and `[theme]` property bindings. Do not serialize `client` or `view` into attributes.
415
+
416
+ `<noodle-app-view>` is the canonical host; `NoodleAppView` delegates to it. Both use the
417
+ service-advertised sandbox URL, route App calls through the supplied client, publish theme changes without
418
+ replacing the iframe, and request standard teardown on semantic replacement, disconnect, or an App teardown
419
+ request.
420
+
383
421
  The App document owns its action intent: it calls standard `tools/call` after connecting and never relies on
384
422
  native form navigation. If that call needs input or confirmation, the same `client` publishes the normal
385
423
  pending interaction part for either managed or customer-owned rendering. The original App call stays pending
386
424
  and receives its MCP result after `client.respond(...)`; applications must not retry or translate the click.
387
425
 
388
- Outside React, subscribe to the DOM-free AI SDK `UIMessage` state without registering a custom element or
389
- touching browser storage:
426
+ Outside React, subscribe to the DOM-free AI SDK `UIMessage` state without touching browser storage. The
427
+ client itself registers no element; import `/app-view` only when the transcript renders linked MCP Apps:
390
428
 
391
429
  ```ts
392
430
  import { createAssistantClient } from "@noodleseed/assistant/client";
@@ -488,8 +526,8 @@ flow collects all elicited input before its first connector operation.
488
526
 
489
527
  A completed widget-linked tool emits typed `view_available` data with its call/interaction id, tool,
490
528
  `ui://` resource identity, optional title, bounded/redacted public result, and—on current services—the
491
- self-contained App document. This is an availability signal, not proof of rendering. A customer-owned React
492
- renderer either mounts the actual App with `NoodleAppView` or deliberately substitutes a component already
529
+ self-contained App document. This is an availability signal, not proof of rendering. A customer-owned
530
+ renderer either mounts the actual App with `<noodle-app-view>` (or its React `NoodleAppView` adapter) or deliberately substitutes a component already
493
531
  trusted by the application and selected by `resourceUri`/tool. The JSON `result` is data for a native
494
532
  component; serializing it is not a rendering of the linked App. Never fetch the `ui://` URI, inject
495
533
  `part.data.html`, or assign it to `srcdoc` yourself. The standard element also forwards the same detail as a
@@ -612,7 +650,7 @@ shadow-DOM selectors and classes are not public API.
612
650
 
613
651
  `theme="auto"` follows the browser's operating-system color preference. When the embedding application has
614
652
  its own theme toggle, pass its resolved `"light"` or `"dark"` value to `NoodleAssistant` and every
615
- `NoodleAppView`. Updates change the assistant in place and notify mounted MCP Apps through standard host
653
+ `<noodle-app-view>`/`NoodleAppView`. Updates change the assistant in place and notify mounted MCP Apps through standard host
616
654
  context.
617
655
 
618
656
  Server branding controls customer name, themed logo/mark/avatar assets, semantic light/dark colors, density,
@@ -0,0 +1,40 @@
1
+ import { A as AssistantClient, a as AssistantViewAvailableDetail, e as AssistantErrorDetail } from './client-uo57Swlm.cjs';
2
+
3
+ declare const APP_VIEW_TAG_NAME = "noodle-app-view";
4
+ interface AssistantAppViewErrorDetail {
5
+ readonly code: 'view_render_timeout';
6
+ readonly retryable: false;
7
+ }
8
+ declare global {
9
+ interface HTMLElementTagNameMap {
10
+ 'noodle-app-view': NoodleAppViewElement;
11
+ }
12
+ interface HTMLElementEventMap {
13
+ 'assistant-error': CustomEvent<AssistantErrorDetail>;
14
+ }
15
+ }
16
+ declare const HTMLElementBase: typeof HTMLElement;
17
+ /**
18
+ * Framework-neutral host for one service-resolved MCP App view.
19
+ *
20
+ * `client` and `view` are object properties, not serialized attributes. Vue, Angular, and plain DOM
21
+ * renderers can therefore pass the same `data-view` payload without taking a React dependency.
22
+ */
23
+ declare class NoodleAppViewElement extends HTMLElementBase {
24
+ #private;
25
+ static readonly observedAttributes: string[];
26
+ get client(): AssistantClient | undefined;
27
+ /** Allow the hosted App to request fullscreen. Disabled by default. */
28
+ get allowFullscreen(): boolean;
29
+ set allowFullscreen(value: boolean);
30
+ set client(value: AssistantClient | undefined);
31
+ get view(): AssistantViewAvailableDetail | undefined;
32
+ set view(value: AssistantViewAvailableDetail | undefined);
33
+ get theme(): 'light' | 'dark';
34
+ set theme(value: 'light' | 'dark');
35
+ connectedCallback(): void;
36
+ disconnectedCallback(): void;
37
+ attributeChangedCallback(name: string, _previous: string | null, value: string | null): void;
38
+ }
39
+
40
+ export { APP_VIEW_TAG_NAME as A, NoodleAppViewElement as N, type AssistantAppViewErrorDetail as a };
@@ -0,0 +1,40 @@
1
+ import { A as AssistantClient, a as AssistantViewAvailableDetail, e as AssistantErrorDetail } from './client-Bp_VKpMg.js';
2
+
3
+ declare const APP_VIEW_TAG_NAME = "noodle-app-view";
4
+ interface AssistantAppViewErrorDetail {
5
+ readonly code: 'view_render_timeout';
6
+ readonly retryable: false;
7
+ }
8
+ declare global {
9
+ interface HTMLElementTagNameMap {
10
+ 'noodle-app-view': NoodleAppViewElement;
11
+ }
12
+ interface HTMLElementEventMap {
13
+ 'assistant-error': CustomEvent<AssistantErrorDetail>;
14
+ }
15
+ }
16
+ declare const HTMLElementBase: typeof HTMLElement;
17
+ /**
18
+ * Framework-neutral host for one service-resolved MCP App view.
19
+ *
20
+ * `client` and `view` are object properties, not serialized attributes. Vue, Angular, and plain DOM
21
+ * renderers can therefore pass the same `data-view` payload without taking a React dependency.
22
+ */
23
+ declare class NoodleAppViewElement extends HTMLElementBase {
24
+ #private;
25
+ static readonly observedAttributes: string[];
26
+ get client(): AssistantClient | undefined;
27
+ /** Allow the hosted App to request fullscreen. Disabled by default. */
28
+ get allowFullscreen(): boolean;
29
+ set allowFullscreen(value: boolean);
30
+ set client(value: AssistantClient | undefined);
31
+ get view(): AssistantViewAvailableDetail | undefined;
32
+ set view(value: AssistantViewAvailableDetail | undefined);
33
+ get theme(): 'light' | 'dark';
34
+ set theme(value: 'light' | 'dark');
35
+ connectedCallback(): void;
36
+ disconnectedCallback(): void;
37
+ attributeChangedCallback(name: string, _previous: string | null, value: string | null): void;
38
+ }
39
+
40
+ export { APP_VIEW_TAG_NAME as A, NoodleAppViewElement as N, type AssistantAppViewErrorDetail as a };